diff --git a/Diff_java_projects/simple-java-crud-app-master/.classpath b/Diff_java_projects/simple-java-crud-app-master/.classpath new file mode 100644 index 0000000..15145c7 --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/Diff_java_projects/simple-java-crud-app-master/.project b/Diff_java_projects/simple-java-crud-app-master/.project new file mode 100644 index 0000000..f0d9082 --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/.project @@ -0,0 +1,17 @@ + + + Swing26 - Tables + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Diff_java_projects/simple-java-crud-app-master/README.md b/Diff_java_projects/simple-java-crud-app-master/README.md new file mode 100644 index 0000000..f676366 --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/README.md @@ -0,0 +1,14 @@ +# Java CRUD App +Simple java business application with CRUD functional made for university course. + +## `Note!`As it project became much visible somehow I strongly encourage to use provided code on your own risk. It is very dirty and hacky! + +To run it you need to have +- Eclipse IDE (J2EE) **preferred** + + *or you need to install `JDK` on your own.* +- MySQL pre-installed +- some MySQL UI ( I used MySql Workbench ) +- mysql-connector + +also i used `weblaf` swing look and feel. diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/TestDatabase.class b/Diff_java_projects/simple-java-crud-app-master/bin/TestDatabase.class new file mode 100644 index 0000000..9979328 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/TestDatabase.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/controller/Controller.class b/Diff_java_projects/simple-java-crud-app-master/bin/controller/Controller.class new file mode 100644 index 0000000..9621d41 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/controller/Controller.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/AgeCategory.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/AgeCategory.class new file mode 100644 index 0000000..09a1ce6 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/AgeCategory.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/App$1.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/App$1.class new file mode 100644 index 0000000..776a171 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/App$1.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/App.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/App.class new file mode 100644 index 0000000..b8630a5 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/App.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryEditor$1.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryEditor$1.class new file mode 100644 index 0000000..5f8e808 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryEditor$1.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryEditor.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryEditor.class new file mode 100644 index 0000000..d3697a4 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryEditor.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryRenderer.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryRenderer.class new file mode 100644 index 0000000..3cbb53f Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryRenderer.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormEvent.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormEvent.class new file mode 100644 index 0000000..f6b031f Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormEvent.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormListener.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormListener.class new file mode 100644 index 0000000..56cdfc8 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormListener.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel$1.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel$1.class new file mode 100644 index 0000000..3752ffd Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel$1.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel$2.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel$2.class new file mode 100644 index 0000000..b86f840 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel$2.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel.class new file mode 100644 index 0000000..958afc4 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/IconRenderer.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/IconRenderer.class new file mode 100644 index 0000000..d14577a Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/IconRenderer.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$1.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$1.class new file mode 100644 index 0000000..7ff5e69 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$1.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$10.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$10.class new file mode 100644 index 0000000..46a6c1d Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$10.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$11.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$11.class new file mode 100644 index 0000000..139e82f Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$11.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$12.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$12.class new file mode 100644 index 0000000..5da5d3c Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$12.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$13.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$13.class new file mode 100644 index 0000000..db7b782 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$13.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$14.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$14.class new file mode 100644 index 0000000..91157fd Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$14.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$15.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$15.class new file mode 100644 index 0000000..44ef5d9 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$15.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$2.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$2.class new file mode 100644 index 0000000..6eebe9a Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$2.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$3.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$3.class new file mode 100644 index 0000000..a3c436e Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$3.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$4.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$4.class new file mode 100644 index 0000000..654d19d Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$4.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$5.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$5.class new file mode 100644 index 0000000..5d299d2 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$5.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$6.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$6.class new file mode 100644 index 0000000..1b287f3 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$6.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$7.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$7.class new file mode 100644 index 0000000..586121e Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$7.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$8.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$8.class new file mode 100644 index 0000000..5b95d4b Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$8.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$9.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$9.class new file mode 100644 index 0000000..652bb43 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$9.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame.class new file mode 100644 index 0000000..100f0a8 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonFileFilter.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonFileFilter.class new file mode 100644 index 0000000..a7bca58 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonFileFilter.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonTableListener.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonTableListener.class new file mode 100644 index 0000000..5c99b0d Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonTableListener.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonTableModel.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonTableModel.class new file mode 100644 index 0000000..2c44977 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonTableModel.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$1.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$1.class new file mode 100644 index 0000000..3790977 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$1.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$2.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$2.class new file mode 100644 index 0000000..6939e2c Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$2.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$3.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$3.class new file mode 100644 index 0000000..ddf05ad Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$3.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel.class new file mode 100644 index 0000000..8f5d1d3 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel.class new file mode 100644 index 0000000..a8f9243 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel2$1.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel2$1.class new file mode 100644 index 0000000..edd9196 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel2$1.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel2.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel2.class new file mode 100644 index 0000000..defe669 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel2.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/Toolbar.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/Toolbar.class new file mode 100644 index 0000000..a7f12e9 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/Toolbar.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/ToolbarListener.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/ToolbarListener.class new file mode 100644 index 0000000..e6b3513 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/ToolbarListener.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/Utils.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/Utils.class new file mode 100644 index 0000000..fcf2227 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/Utils.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444437_save_accept.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444437_save_accept.png new file mode 100644 index 0000000..48ae6ff Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444437_save_accept.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444440_Save.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444440_Save.png new file mode 100644 index 0000000..030a28e Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444440_Save.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444542_save_16.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444542_save_16.png new file mode 100644 index 0000000..cd0162b Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444542_save_16.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444547_document-save.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444547_document-save.png new file mode 100644 index 0000000..bf10639 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444547_document-save.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444559_view-refresh.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444559_view-refresh.png new file mode 100644 index 0000000..cf70ceb Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444559_view-refresh.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444563_Synchronize.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444563_Synchronize.png new file mode 100644 index 0000000..01dc229 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444563_Synchronize.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444569_gtk-refresh.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444569_gtk-refresh.png new file mode 100644 index 0000000..dc14406 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444569_gtk-refresh.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444586_import.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444586_import.png new file mode 100644 index 0000000..e4703e9 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444586_import.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444602_table-export.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444602_table-export.png new file mode 100644 index 0000000..f582fb8 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444602_table-export.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444918_application_view_xp_terminal.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444918_application_view_xp_terminal.png new file mode 100644 index 0000000..c98e419 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444918_application_view_xp_terminal.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445120_Error.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445120_Error.png new file mode 100644 index 0000000..0d6d934 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445120_Error.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445243_text_horizontalrule.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445243_text_horizontalrule.png new file mode 100644 index 0000000..3e70c65 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445243_text_horizontalrule.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445397_accept.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445397_accept.png new file mode 100644 index 0000000..68f638a Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445397_accept.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445557_Windows_16x16.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445557_Windows_16x16.png new file mode 100644 index 0000000..3fd4321 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445557_Windows_16x16.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445676_Help.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445676_Help.png new file mode 100644 index 0000000..0bd60db Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445676_Help.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400446085_Table_16x16.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400446085_Table_16x16.png new file mode 100644 index 0000000..4fe7dff Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400446085_Table_16x16.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400447294_1.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400447294_1.png new file mode 100644 index 0000000..c67d6f1 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400447294_1.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400462129_cart_add.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400462129_cart_add.png new file mode 100644 index 0000000..bc402b1 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400462129_cart_add.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400956144_gear__plus.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400956144_gear__plus.png new file mode 100644 index 0000000..bc4cd9e Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400956144_gear__plus.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/Refresh16.gif b/Diff_java_projects/simple-java-crud-app-master/bin/images/Refresh16.gif new file mode 100644 index 0000000..cf7cea3 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/Refresh16.gif differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/Save16.gif b/Diff_java_projects/simple-java-crud-app-master/bin/images/Save16.gif new file mode 100644 index 0000000..954f1ac Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/Save16.gif differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/Server16.gif b/Diff_java_projects/simple-java-crud-app-master/bin/images/Server16.gif new file mode 100644 index 0000000..4e76682 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/Server16.gif differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/car.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/car.png new file mode 100644 index 0000000..cb18738 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/car.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/gear.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/gear.png new file mode 100644 index 0000000..bc4cd9e Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/gear.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/import1.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/import1.png new file mode 100644 index 0000000..ff10bad Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/import1.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/notepad.gif b/Diff_java_projects/simple-java-crud-app-master/bin/images/notepad.gif new file mode 100644 index 0000000..074a105 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/notepad.gif differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/price.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/price.png new file mode 100644 index 0000000..ff76611 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/price.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/ware.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/ware.png new file mode 100644 index 0000000..db17c45 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/ware.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/model/AgeCategory.class b/Diff_java_projects/simple-java-crud-app-master/bin/model/AgeCategory.class new file mode 100644 index 0000000..f611783 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/model/AgeCategory.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/model/Database.class b/Diff_java_projects/simple-java-crud-app-master/bin/model/Database.class new file mode 100644 index 0000000..574dba0 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/model/Database.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/model/EmploymentCategory.class b/Diff_java_projects/simple-java-crud-app-master/bin/model/EmploymentCategory.class new file mode 100644 index 0000000..672108c Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/model/EmploymentCategory.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/model/Gender.class b/Diff_java_projects/simple-java-crud-app-master/bin/model/Gender.class new file mode 100644 index 0000000..67e682c Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/model/Gender.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/model/Person.class b/Diff_java_projects/simple-java-crud-app-master/bin/model/Person.class new file mode 100644 index 0000000..9e30802 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/model/Person.class differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/TestDatabase.java b/Diff_java_projects/simple-java-crud-app-master/src/TestDatabase.java new file mode 100644 index 0000000..d435e64 --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/TestDatabase.java @@ -0,0 +1,49 @@ +import java.sql.SQLException; + +import model.AgeCategory; +import model.Database; +import model.EmploymentCategory; +import model.Gender; +import model.Person; + + +public class TestDatabase { + + public static void main(String[] args) + { + + + System.out.println("Running database test"); + + Database db = new Database(); + try { + db.connect(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + db.addPerson(new Person("Joe222","sdsdsdsd",AgeCategory.Nissan,EmploymentCategory.sklad,"2323",false,Gender.no)); + db.addPerson(new Person("Joe222","sdsdsdsd",AgeCategory.Nissan,EmploymentCategory.sklad,"2323",false,Gender.no)); + db.addPerson(new Person("Suzana","sdssdsdsdd",AgeCategory.Nissan,EmploymentCategory.sklad,"43",true,Gender.no)); + db.addPerson(new Person("qwqw","sd12dd",AgeCategory.Mazda,EmploymentCategory.no,"43",true,Gender.yes)); + db.addPerson(new Person("qwqw","sd12dd",AgeCategory.Mazda,EmploymentCategory.no,"43",true,Gender.yes)); + db.addPerson(new Person("qwasasqw","sd12dd",AgeCategory.Mazda,EmploymentCategory.no,"43",true,Gender.yes)); + + try { + db.save(); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + try { + db.load(); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + db.disconnect(); + } + +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/controller/Controller.java b/Diff_java_projects/simple-java-crud-app-master/src/controller/Controller.java new file mode 100644 index 0000000..3e170b4 --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/controller/Controller.java @@ -0,0 +1,119 @@ +package controller; + +import gui.FormEvent; + +import java.io.File; +import java.io.IOException; +import java.sql.SQLException; +import java.util.List; + +import model.AgeCategory; +import model.Database; +import model.EmploymentCategory; +import model.Gender; +import model.Person; + +public class Controller { + Database db = new Database(); + + public List getPeople() { + return db.getPeople(); + } + + public void save() throws SQLException + { + db.save(); + } + + public void load() throws SQLException + { + db.load(); + } + public void connect() throws Exception + { + db.connect(); + } + + public void disconnect() + { + db.disconnect(); + } + + + + public void addPerson(FormEvent ev) { + String name = ev.getName(); + String occupation = ev.getOccupation(); + int ageCatId = ev.getAgeCategory(); + String empCat = ev.getEmploymentCategory(); + boolean isUs = ev.isUsCitizen(); + String taxId = ev.getTaxId(); + String gender = ev.getGender(); + + AgeCategory ageCategory = null; + + switch(ageCatId) { + case 0: + ageCategory = AgeCategory.Nissan; + break; + case 1: + ageCategory = AgeCategory.Mazda; + break; + case 2: + ageCategory = AgeCategory.Land_Rover; + break; + case 3: + ageCategory = AgeCategory.Lada; + break; + case 4: + ageCategory = AgeCategory.Honda; + break; + + } + + + EmploymentCategory empCategory; + + if(empCat.equals("����")) { + empCategory = EmploymentCategory.yes; + } + else if(empCat.equals("���")) { + empCategory = EmploymentCategory.no; + } + else if(empCat.equals("�����")) { + empCategory = EmploymentCategory.sklad; + } + else { + empCategory = EmploymentCategory.other; + System.err.println(empCat); + } + + Gender genderCat; + + if(gender.equals("yes")) { + genderCat = Gender.yes; + } + else { + genderCat = Gender.no; + } + + Person person = new Person(name, occupation, ageCategory, empCategory, + taxId, isUs, genderCat); + + db.addPerson(person); + } + public void removePerson(int index) + { + db.removePerson(index); + } + + public void saveToFile(File file) throws IOException + { + db.saveToFile(file); + } + public void loadFromFile(File file) throws IOException + { + db.loadFromFile(file); + } + +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/App.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/App.java new file mode 100644 index 0000000..e14800b --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/App.java @@ -0,0 +1,15 @@ +package gui; +import javax.swing.SwingUtilities; + +public class App { + + public static void main(String[] args) { + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + new MainFrame(); + } + }); + } + +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/EmploymentCategoryEditor.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/EmploymentCategoryEditor.java new file mode 100644 index 0000000..1d6be40 --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/EmploymentCategoryEditor.java @@ -0,0 +1,59 @@ +package gui; + +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.EventObject; + +import javax.swing.AbstractCellEditor; +import javax.swing.JComboBox; +import javax.swing.JTable; +import javax.swing.table.TableCellEditor; + +import model.EmploymentCategory; + +public class EmploymentCategoryEditor extends AbstractCellEditor implements TableCellEditor { + + private JComboBox combo; + + public EmploymentCategoryEditor() + { + combo = new JComboBox(EmploymentCategory.values()); + } + @Override + public boolean isCellEditable(EventObject e) { + + return true; + } + + @Override + public Object getCellEditorValue() { + // TODO Auto-generated method stub + return combo.getSelectedItem(); + } + + @Override + public Component getTableCellEditorComponent(JTable table, Object value, + boolean isSelected, int row, int column) { + + + combo.setSelectedItem(value); + + combo.addActionListener(new ActionListener() + { + + @Override + public void actionPerformed(ActionEvent arg0) { + fireEditingStopped(); + + } + + }); + + + return combo; + } + + + +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/EmploymentCategoryRenderer.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/EmploymentCategoryRenderer.java new file mode 100644 index 0000000..2d5a2e5 --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/EmploymentCategoryRenderer.java @@ -0,0 +1,27 @@ +package gui; + +import java.awt.Component; + +import javax.swing.JComboBox; +import javax.swing.JTable; +import javax.swing.table.TableCellRenderer; + +import model.EmploymentCategory; + +public class EmploymentCategoryRenderer implements TableCellRenderer { + + private JComboBox combo; + + public EmploymentCategoryRenderer() { + combo = new JComboBox(EmploymentCategory.values()); + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, boolean hasFocus, int row, int column) { + + combo.setSelectedItem(value); + return combo; + } + +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/FormEvent.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/FormEvent.java new file mode 100644 index 0000000..ff8639f --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/FormEvent.java @@ -0,0 +1,69 @@ +package gui; +import java.awt.event.KeyEvent; +import java.util.EventObject; + +public class FormEvent extends EventObject { + + private String name; + private String occupation; + private int ageCategory; + private String empCat; + private String taxId; + private boolean usCitizen; + private String gender; + + public FormEvent(Object source) { + super(source); + } + + public FormEvent(Object source, String name, String occupation, int ageCat, + String empCat, String taxId, boolean usCitizen, String gender) { + super(source); + + this.name = name; + this.occupation = occupation; + this.ageCategory = ageCat; + this.empCat = empCat; + this.taxId = taxId; + this.usCitizen = usCitizen; + this.gender = gender; + } + + public String getGender() { + return gender; + } + + public String getTaxId() { + return taxId; + } + + public boolean isUsCitizen() { + return usCitizen; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getOccupation() { + return occupation; + } + + public void setOccupation(String occupation) { + this.occupation = occupation; + } + + public int getAgeCategory() { + return ageCategory; + } + + public String getEmploymentCategory() { + return empCat; + } + + +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/FormListener.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/FormListener.java new file mode 100644 index 0000000..b460112 --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/FormListener.java @@ -0,0 +1,6 @@ +package gui; +import java.util.EventListener; + +public interface FormListener extends EventListener { + public void formEventOccurred(FormEvent e); +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/FormPanel.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/FormPanel.java new file mode 100644 index 0000000..4e08532 --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/FormPanel.java @@ -0,0 +1,368 @@ +package gui; +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.net.URL; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.DefaultComboBoxModel; +import javax.swing.DefaultListModel; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JTabbedPane; +import javax.swing.JTextField; +import javax.swing.border.Border; +import javax.swing.text.TabExpander; + +public class FormPanel extends JPanel { + + private JLabel nameLabel; + private JLabel imageChooseLabel; + private JLabel occupationLabel; + private JTextField nameField; + private JTextField imageChooseFieldd; + private JTextField occupationField; + private JButton okBtn; + private FormListener formListener; + private JList ageList; + private JComboBox empCombo; + private JCheckBox citizenCheck; + private JTextField taxField; + private JLabel taxLabel; + + + + private JRadioButton maleRadio; + private JRadioButton femaleRadio; + private ButtonGroup genderGroup; + + public FormPanel() { + Dimension dim = getPreferredSize(); + dim.width = 290; + setPreferredSize(dim); + + nameLabel = new JLabel("��������: "); + nameLabel.setIcon(createIcon("/images/gear.png")); + + imageChooseLabel = new JLabel("�����������: "); + occupationLabel = new JLabel("����: "); + occupationLabel.setIcon(createIcon("/images/price.png")); + nameField = new JTextField(10); + imageChooseFieldd = new JTextField(10); + occupationField = new JTextField(10); + ageList = new JList(); + empCombo = new JComboBox(); + citizenCheck = new JCheckBox(); + taxField = new JTextField(10); + taxLabel = new JLabel("���: "); + okBtn = new JButton("OK"); + okBtn.setIcon(createIcon("/images/1400445397_accept.png")); + + + // Set up mnemomics + okBtn.setMnemonic(KeyEvent.VK_O); + + nameLabel.setDisplayedMnemonic(KeyEvent.VK_N); + nameLabel.setLabelFor(nameField); + + maleRadio = new JRadioButton("����������������"); + femaleRadio = new JRadioButton("������������������"); + + maleRadio.setActionCommand("����������������"); + femaleRadio.setActionCommand("������������������"); + + genderGroup = new ButtonGroup(); + + maleRadio.setSelected(true); + + // Set up gender radios + genderGroup.add(maleRadio); + genderGroup.add(femaleRadio); + + // Set up tax ID + taxLabel.setEnabled(false); + taxField.setEnabled(false); + + citizenCheck.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + boolean isTicked = citizenCheck.isSelected(); + taxLabel.setEnabled(isTicked); + taxField.setEnabled(isTicked); + } + }); + + // Set up list box + DefaultListModel ageModel = new DefaultListModel(); + ageModel.addElement(new AgeCategory(0, "Nissan")); + ageModel.addElement(new AgeCategory(1, "Mazda")); + ageModel.addElement(new AgeCategory(2, "Land Rover")); + ageModel.addElement(new AgeCategory(3, "Lada")); + ageModel.addElement(new AgeCategory(4, "Honda")); + + ageList.setModel(ageModel); + + ageList.setPreferredSize(new Dimension(120, 120)); + ageList.setBorder(BorderFactory.createEtchedBorder()); + ageList.setSelectedIndex(1); + + // Set up combo box. + DefaultComboBoxModel empModel = new DefaultComboBoxModel(); + empModel.addElement("����"); + empModel.addElement("���"); + empModel.addElement("�����"); + empCombo.setModel(empModel); + empCombo.setSelectedIndex(0); + empCombo.setEditable(true); + + + okBtn.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + String name = nameField.getText(); + String occupation = occupationField.getText(); + AgeCategory ageCat = (AgeCategory) ageList.getSelectedValue(); + String empCat = (String) empCombo.getSelectedItem(); + String taxId = taxField.getText(); + boolean usCitizen = citizenCheck.isSelected(); + + String gender = genderGroup.getSelection().getActionCommand(); + + FormEvent ev = new FormEvent(this, name, occupation, ageCat + .getId(), empCat, taxId, usCitizen, gender); + + if (formListener != null) { + formListener.formEventOccurred(ev); + } + } + }); + + Border innerBorder = BorderFactory.createTitledBorder("�������� ��������"); + + Border outerBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5); + setBorder(BorderFactory.createCompoundBorder(outerBorder, innerBorder)); + + layoutComponents(); + } + private ImageIcon createIcon(String path) + { + URL url = getClass().getResource(path); + + if(url == null) + { + System.err.println("Unabled to load image"+path); + } + + ImageIcon icon = new ImageIcon(url); + + return icon; + } + + public void layoutComponents() { + + setLayout(new GridBagLayout()); + + GridBagConstraints gc = new GridBagConstraints(); + + // ////////// First row /////////////////////////////////// + + gc.gridy = 0; + + gc.weightx = 1; + gc.weighty = 0.1; + + gc.gridx = 0; + gc.fill = GridBagConstraints.NONE; + gc.anchor = GridBagConstraints.LINE_END; + gc.insets = new Insets(0, 0, 0, 5); + add(nameLabel, gc); + + gc.gridx = 1; + gc.gridy = 0; + gc.insets = new Insets(0, 0, 0, 0); + gc.anchor = GridBagConstraints.LINE_START; + add(nameField, gc); + + // //////////Second row /////////////////////////////////// + + gc.gridy++; + + gc.weightx = 1; + gc.weighty = 0.1; + + gc.gridx = 0; + gc.insets = new Insets(0, 0, 0, 5); + gc.anchor = GridBagConstraints.LINE_END; + add(occupationLabel, gc); + + gc.gridx = 1; + gc.insets = new Insets(0, 0, 0, 0); + gc.anchor = GridBagConstraints.LINE_START; + add(occupationField, gc); + + // //////////Next row /////////////////////////////////// + + gc.gridy++; + + gc.weightx = 1; + gc.weighty = 0.2; + + gc.gridx = 0; + gc.insets = new Insets(5, 0, 0, 5); + gc.anchor = GridBagConstraints.FIRST_LINE_END; + + JLabel carLabel = new JLabel("�����: "); + carLabel.setIcon(createIcon("/images/car.png")); + add(carLabel, gc); + + gc.gridx = 1; + gc.anchor = GridBagConstraints.FIRST_LINE_START; + gc.insets = new Insets(5, 0, 0, 0); + add(ageList, gc); + + // //////////Next row /////////////////////////////////// + + gc.gridy++; + + gc.weightx = 1; + gc.weighty = 0.2; + + gc.gridx = 0; + gc.insets = new Insets(0, 0, 0, 5); + gc.anchor = GridBagConstraints.FIRST_LINE_END; + JLabel warLabel = new JLabel("�������: "); + warLabel.setIcon(createIcon("/images/ware.png")); + add(warLabel, gc); + + gc.gridx = 1; + gc.anchor = GridBagConstraints.FIRST_LINE_START; + gc.insets = new Insets(0, 0, 0, 0); + add(empCombo, gc); + + // //////////Next row /////////////////////////////////// + + gc.gridy++; + + gc.weightx = 1; + gc.weighty = 0.2; + + gc.gridx = 0; + gc.insets = new Insets(0, 0, 0, 5); + gc.anchor = GridBagConstraints.FIRST_LINE_END; + JLabel iconLabel = new JLabel("������: "); + add(iconLabel, gc); + iconLabel.setIcon(createIcon("/images/import1.png")); + + gc.gridx = 1; + gc.anchor = GridBagConstraints.FIRST_LINE_START; + gc.insets = new Insets(0, 0, 0, 0); + add(citizenCheck, gc); + + // //////////Next row /////////////////////////////////// + + gc.gridy++; + + gc.weightx = 1; + gc.weighty = 0.2; + + gc.gridx = 0; + gc.insets = new Insets(0, 0, 0, 5); + gc.anchor = GridBagConstraints.FIRST_LINE_END; + add(taxLabel, gc); + + gc.gridx = 1; + gc.anchor = GridBagConstraints.FIRST_LINE_START; + gc.insets = new Insets(0, 0, 0, 0); + add(taxField, gc); + + // //////////Next row /////////////////////////////////// + + gc.gridy++; + + gc.weightx = 1; + gc.weighty = 0.05; + + gc.gridx = 0; + gc.insets = new Insets(0, 0, 0, 5); + gc.anchor = GridBagConstraints.LINE_END; + add(new JLabel("��������: "), gc); + + gc.gridx = 1; + gc.anchor = GridBagConstraints.FIRST_LINE_START; + gc.insets = new Insets(0, 0, 0, 0); + add(maleRadio, gc); + + + // //////////Next row /////////////////////////////////// + + gc.gridy++; + + gc.weightx = 1; + gc.weighty = 0.2; + + gc.gridx = 1; + gc.anchor = GridBagConstraints.FIRST_LINE_START; + gc.insets = new Insets(0, 0, 0, 0); + add(femaleRadio, gc); + // //////////Next row /////////////////////////////////// + + gc.gridy++; + + gc.weightx = 1; + gc.weighty = 0.2; + + gc.gridx = 0; + gc.insets = new Insets(5, 0, 0, 5); + gc.anchor = GridBagConstraints.FIRST_LINE_END; + add(imageChooseLabel, gc); + + gc.gridx = 1; + gc.anchor = GridBagConstraints.FIRST_LINE_START; + gc.insets = new Insets(5, 0, 0, 0); + add(imageChooseFieldd, gc); + + + // //////////Next row /////////////////////////////////// + + gc.gridy++; + + gc.weightx = 1; + gc.weighty = 2.0; + + gc.gridx = 1; + gc.anchor = GridBagConstraints.FIRST_LINE_START; + gc.insets = new Insets(5, 0, 0, 0); + add(okBtn, gc); + } + + public void setFormListener(FormListener listener) { + this.formListener = listener; + } +} + +class AgeCategory { + private int id; + private String text; + + public AgeCategory(int id, String text) { + this.id = id; + this.text = text; + } + + public String toString() { + return text; + } + + public int getId() { + return id; + } +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/IconRenderer.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/IconRenderer.java new file mode 100644 index 0000000..31d3eae --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/IconRenderer.java @@ -0,0 +1,38 @@ +package gui; + +import java.net.URL; + +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.table.DefaultTableCellRenderer; + +public class IconRenderer extends DefaultTableCellRenderer { + public IconRenderer() { super(); } + + public void setValue(String value) { + if (value == null) { + setText(""); + } + else + { + + setIcon(createIcon(value)); + } + } + + + + private ImageIcon createIcon(String path) + { + URL url = getClass().getResource(path); + + if(url == null) + { + System.err.println("Unabled to load image"+path); + } + + ImageIcon icon = new ImageIcon(url); + + return icon; + } +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/MainFrame.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/MainFrame.java new file mode 100644 index 0000000..be0a02c --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/MainFrame.java @@ -0,0 +1,479 @@ +package gui; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.io.IOException; +import java.net.URL; +import java.sql.SQLException; + +import javax.swing.ImageIcon; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPopupMenu; +import javax.swing.JTabbedPane; +import javax.swing.KeyStroke; +import javax.swing.UIManager; + +import com.alee.laf.WebLookAndFeel; + +import controller.Controller; + +public class MainFrame extends JFrame { + + + private static final long serialVersionUID = -7906808792207756237L; + private TextPanel textPanel; + private TextPanel textPanel2; + private TextPanel2 textPanel3; + private TextPanel2 textPanel4; + private Toolbar toolbar; + private FormPanel formPanel; + private JFileChooser fileChooser; + private Controller controller; + private TablePanel tablePanel; + private JTabbedPane tabbedPane; + private JTabbedPane tabbedPane2; + private JPopupMenu popup; + + private int pos = 2; + private int number = 2; + + + public MainFrame() { + + super("Course work"); + + + + try + { + // Setting up WebLookAndFeel style + UIManager.setLookAndFeel ( WebLookAndFeel.class.getCanonicalName () ); + } + catch ( Throwable e ) + { + // Something went wrong + } + + + + + setLayout(new BorderLayout()); + + + + toolbar = new Toolbar(); + + formPanel = new FormPanel(); + tablePanel = new TablePanel(); + + popup = new JPopupMenu(); + + + JMenuItem removeItem = new JMenuItem("�������"); + popup.add(removeItem); + + + removeItem.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) { + + CloseLastText(); + + } + + }); + + tabbedPane2 = new JTabbedPane(); + tabbedPane = new JTabbedPane(); + + getContentPane().add(tabbedPane); + getContentPane().add(tabbedPane); + + textPanel = new TextPanel(); + textPanel2 = new TextPanel(); + textPanel3 = new TextPanel2(); + textPanel4 = new TextPanel2(); + + + tabbedPane.addTab(" Console " , textPanel); + tabbedPane.addTab(" Errors " , textPanel2); + tabbedPane.addTab(" Messages " , textPanel3); + tabbedPane.setIconAt(0, createIcon("/images/1400444918_application_view_xp_terminal.png")); + tabbedPane.setIconAt(1, createIcon("/images/1400445120_Error.png")); + tabbedPane.setIconAt(2, createIcon("/images/1400445243_text_horizontalrule.png")); + + + tabbedPane2.addTab(" ������ ", tablePanel); + tabbedPane2.addTab(" ������� ", textPanel4); + tabbedPane2.setIconAt(0, createIcon("/images/1400446085_Table_16x16.png")); + tabbedPane2.setIconAt(1, createIcon("/images/notepad.gif")); + + tabbedPane2.addMouseListener(new MouseAdapter() + { + public void mousePressed(MouseEvent e) { + + + + + if(e.getButton() == MouseEvent.BUTTON3 ) + { + popup.show(tabbedPane2, e.getX(), e.getY()); + + } + + } + + }); + + textPanel4.addMouseListener(new MouseAdapter() + { + public void mousePressed(MouseEvent e) { + + + + + if(e.getButton() == MouseEvent.BUTTON3 ) + { + popup.show(tabbedPane2, e.getX(), e.getY()); + + } + + } + + }); + + + controller = new Controller(); + + tablePanel.setData(controller.getPeople()); + tablePanel.setPersonTableListener(new PersonTableListener() + { + public void rowDeleted(int row) + { + controller.removePerson(row); + } + + }); + + + fileChooser = new JFileChooser(); + + fileChooser.addChoosableFileFilter(new PersonFileFilter()); + + setJMenuBar(createMenuBar()); + + + addFormEvent(); + + textPanel3.AddKeyListenerRevelance(new KeyAdapter() + { + public void keyPressed(KeyEvent e) { + if(e.getKeyCode() == KeyEvent.VK_ENTER) + { + if(textPanel3.getTextContains("%CLEAR%")) + { + + textPanel3.DeleteText(); + textPanel.appendText("Messages window is clear"); + System.out.println("OK"); + + + } + else + { + System.out.println("������ ����"); + } + } + else + { + + } + } + }); + + textPanel3.AddKeyListenerRevelance(new KeyAdapter() + { + public void keyPressed(KeyEvent e) { + if(e.getKeyCode() == KeyEvent.VK_ENTER) + { + if(textPanel3.getTextContains("%NEW_TPANEL%")) + { + + textPanel3.DeleteText(); + CreateNewTable(new TextPanel2()); + + textPanel.appendText("New text panel created..."); + + + } + else + { + System.out.println("������ ����"); + } + } + else + { + + } + } + }); + + toolbar.setToolbarListener(new ToolbarListener() { + public void saveEventOccured() { + + + connect(); + + + try { + controller.connect(); + } catch (Exception e) { + + JOptionPane.showMessageDialog(MainFrame.this, "Can not connect to database","Database connection problems",JOptionPane.ERROR_MESSAGE); + } + try { + controller.save(); + } catch (SQLException e) { + + JOptionPane.showMessageDialog(MainFrame.this, "Can not connect to database","Database connection problems",JOptionPane.ERROR_MESSAGE); + } + + textPanel.appendText("Added to database\n"); + + + } + + public void refreshEventOccured() { + + connect(); + try { + controller.load(); + } catch (SQLException e) { + JOptionPane.showMessageDialog(MainFrame.this, "Are refresh", "Refreshing progress", JOptionPane.ERROR_MESSAGE); + } + tablePanel.refresh(); + textPanel.appendText("Database is refreshed\n"); + } + }); + + /////////////////////////////// + + + add(formPanel, BorderLayout.WEST); + add(toolbar, BorderLayout.NORTH); + add(tabbedPane2, BorderLayout.CENTER); + add(tabbedPane, BorderLayout.SOUTH); + + + setMinimumSize(new Dimension(600, 550)); + setSize(800, 650); + + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setVisible(true); + refresh(); + } + private void connect() + { + try { + controller.connect(); + } catch (Exception e) { + + JOptionPane.showMessageDialog(MainFrame.this, "Can not connect to database","Database connection problems",JOptionPane.ERROR_MESSAGE); + } + } + + private void refresh() + { + connect(); + try { + controller.load(); + } catch (SQLException e) { + JOptionPane.showMessageDialog(MainFrame.this, "Are refresh", "Refreshing progress", JOptionPane.ERROR_MESSAGE); + } + tablePanel.refresh(); + } + + private JMenuBar createMenuBar() { + JMenuBar menuBar = new JMenuBar(); + + JMenu fileMenu = new JMenu("File"); + JMenuItem exportDataItem = new JMenuItem("Export Data..."); + JMenuItem importDataItem = new JMenuItem("Import Data..."); + JMenuItem exitItem = new JMenuItem("Exit"); + + exportDataItem.setIcon(createIcon("/images/1400444602_table-export.png")); + importDataItem.setIcon(createIcon("/images/1400444586_import.png")); + + fileMenu.add(exportDataItem); + fileMenu.add(importDataItem); + fileMenu.addSeparator(); + fileMenu.add(exitItem); + + JMenu paramMenu = new JMenu("������"); + JMenuItem aboutItem = new JMenuItem("� ���������"); + aboutItem.setIcon(createIcon("/images/1400445676_Help.png")); + JMenuItem licenseItem = new JMenuItem("License"); + + paramMenu.add(aboutItem); + paramMenu.add(licenseItem); + + aboutItem.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) { + + + JOptionPane.showMessageDialog(MainFrame.this, "Created by KN NTU","� ���������",1); + + + + } + + }); + + + + JMenu windowMenu = new JMenu("Window"); + + JMenu showMenu = new JMenu("Show"); + + JCheckBoxMenuItem showFormItem = new JCheckBoxMenuItem("Add detail"); + showFormItem.setIcon(createIcon("/images/1400445557_Windows_16x16.png")); + JCheckBoxMenuItem showConsole = new JCheckBoxMenuItem("Console"); + showConsole.setIcon(createIcon("/images/1400445557_Windows_16x16.png")); + showFormItem.setSelected(true); + showConsole.setSelected(true); + + showMenu.add(showFormItem); + showMenu.add(showConsole); + windowMenu.add(showMenu); + + menuBar.add(fileMenu); + menuBar.add(windowMenu); + menuBar.add(paramMenu); + + showFormItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ev) { + JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ev.getSource(); + + formPanel.setVisible(menuItem.isSelected()); + } + }); + showConsole.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ev) { + JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ev.getSource(); + + tabbedPane.setVisible(menuItem.isSelected()); + } + }); + + fileMenu.setMnemonic(KeyEvent.VK_F); + exitItem.setMnemonic(KeyEvent.VK_X); + + exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, + ActionEvent.CTRL_MASK)); + + importDataItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if(fileChooser.showOpenDialog(MainFrame.this) == JFileChooser.APPROVE_OPTION) { + try { + controller.loadFromFile(fileChooser.getSelectedFile()); + tablePanel.refresh(); + } catch (IOException e1) { + + JOptionPane.showMessageDialog(MainFrame.this, "Failed load","Error",JOptionPane.ERROR_MESSAGE); + } + + } + } + }); + + exportDataItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if(fileChooser.showSaveDialog(MainFrame.this) == JFileChooser.APPROVE_OPTION) { + + try { + controller.saveToFile(fileChooser.getSelectedFile()); + tablePanel.refresh(); + } catch (IOException e1) { + + JOptionPane.showMessageDialog(MainFrame.this, "Failed load","Error",JOptionPane.ERROR_MESSAGE); + } + } + } + }); + + exitItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + + int action = JOptionPane.showConfirmDialog(MainFrame.this, + "Do you really want to exit the application?", + "Confirm Exit", JOptionPane.OK_CANCEL_OPTION); + + if (action == JOptionPane.OK_OPTION) { + System.exit(0); + } + } + }); + + return menuBar; + } + private ImageIcon createIcon(String path) + { + URL url = getClass().getResource(path); + + if(url == null) + { + System.err.println("Unabled to load image"+path); + } + + ImageIcon icon = new ImageIcon(url); + + return icon; + } + private void addFormEvent() + { + formPanel.setFormListener(new FormListener() { + public void formEventOccurred(FormEvent e) { + controller.addPerson(e); + tablePanel.refresh(); + textPanel.appendText("Writting proccess...\n"); + } + }); + formPanel.addKeyListener(new KeyAdapter(){ + public void keyPressed(KeyEvent e) + { + + } + }); + + } + private void CreateNewTable(TextPanel2 text) + { + + + tabbedPane2.addTab(" ������� "+ number, text); + tabbedPane2.setIconAt(pos, createIcon("/images/notepad.gif")); + pos++; + number++; + + + } + private void CloseLastText() + { + int index = pos -1; + tabbedPane2.remove(index); + pos--; + } + +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonFileFilter.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonFileFilter.java new file mode 100644 index 0000000..b2f903e --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonFileFilter.java @@ -0,0 +1,36 @@ +package gui; +import java.io.File; + +import javax.swing.filechooser.FileFilter; + + +public class PersonFileFilter extends FileFilter { + + @Override + public boolean accept(File file) { + + if(file.isDirectory()) { + return true; + } + + String name = file.getName(); + + String extension = Utils.getFileExtension(name); + + if(extension == null) { + return false; + } + + if(extension.equals("per")) { + return true; + } + + return false; + } + + @Override + public String getDescription() { + return "Person database file (*.per)"; + } + +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonTableListener.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonTableListener.java new file mode 100644 index 0000000..3d52c6f --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonTableListener.java @@ -0,0 +1,7 @@ +package gui; + +public interface PersonTableListener +{ + public void rowDeleted(int row); + +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonTableModel.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonTableModel.java new file mode 100644 index 0000000..0dce257 --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonTableModel.java @@ -0,0 +1,150 @@ +package gui; + +import java.util.List; + +import javax.swing.ImageIcon; +import javax.swing.table.AbstractTableModel; + +import model.EmploymentCategory; +import model.Person; + +public class PersonTableModel extends AbstractTableModel { + + private List db; + + private String[] colNames = {"ID", "���", "����", "����������", "�������", "������", "���","Picture"}; + + private int colLength = colNames.length; + + + + + + + public PersonTableModel() { + } + + + + @Override + public String getColumnName(int column) { + // TODO Auto-generated method stub + return colNames[column]; + } + + + + public void setData(List db) { + this.db = db; + } + @Override + public Class getColumnClass(int col) { + + switch(col) { + case 0: + return Integer.class; + case 1: + return String.class; + case 2: + return String.class; + case 3: + return String.class; + case 4: + return EmploymentCategory.class; + case 5: + return Boolean.class; + case 6: + return String.class; + case 7 : + return ImageIcon.class; + + default: + return null; + + + } + + } + + + + @Override + public void setValueAt(Object value, int row, int col) { + + if (db == null) return; + Person person = db.get(row); + switch(col) + { + case 1: + person.setName((String)value); + break; + case 2: + person.setOccupation((String)value); + break; + case 4: + person.setEmpCat((EmploymentCategory)value); + break; + case 5: + person.setUsCitizen((Boolean)value); + break; + default: + return ; + } + } + @Override + public boolean isCellEditable(int row, int col) { + + switch(col) + { + case 1: + return true; + case 2: + return true; + case 5: + return true; + case 4: + return true; + default: + return false; + } + } + + @Override + public int getColumnCount() { + return colLength; + } + + @Override + public int getRowCount() { + return db.size(); + } + + @Override + public Object getValueAt(int row, int col) { + Person person = db.get(row); + + switch(col) { + case 0: + return person.getId(); + case 1: + return person.getName(); + case 2: + return person.getOccupation(); + case 3: + return person.getAgeCategory(); + case 4: + return person.getEmpCat(); + case 5: + return person.isUsCitizen(); + case 6: + return person.getTaxId(); + + + + + } + + return null; + } + +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/TablePanel.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/TablePanel.java new file mode 100644 index 0000000..e6c760a --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/TablePanel.java @@ -0,0 +1,117 @@ +package gui; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.List; + +import javax.swing.ImageIcon; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JScrollPane; +import javax.swing.JTable; + +import model.EmploymentCategory; +import model.Person; + +public class TablePanel extends JPanel { + + private JTable table; + private PersonTableModel tableModel; + private JPopupMenu popup; + private JPopupMenu popup2; + private PersonTableListener personTableListener; + + + public TablePanel() { + + tableModel = new PersonTableModel(); + table = new JTable(tableModel); + popup = new JPopupMenu(); + popup2 = new JPopupMenu(); + + IconRenderer icRen = new IconRenderer(); + icRen.setValue("/images/gear.png"); + + + + table.setDefaultRenderer(EmploymentCategory.class, new EmploymentCategoryRenderer()); + table.setDefaultEditor(EmploymentCategory.class, new EmploymentCategoryEditor()); + table.setDefaultRenderer(ImageIcon.class,icRen); + + table.setRowHeight(24); + + + + + JMenuItem removeItem = new JMenuItem("Delete Row"); + JMenuItem selectAllItem = new JMenuItem("Select All"); + popup.add(removeItem); + popup.add(selectAllItem); + + selectAllItem.addActionListener(new ActionListener() { + + + public void actionPerformed(ActionEvent e) { + + table.selectAll(); + + } + }); + + + removeItem.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) { + + int row = table.getSelectedRow(); + + if(personTableListener != null) + { + personTableListener.rowDeleted(row); + tableModel.fireTableRowsDeleted(row, row); + } + + } + + }); + + + table.addMouseListener(new MouseAdapter() + { + public void mousePressed(MouseEvent e) { + + int row = table.rowAtPoint(e.getPoint()); + + table.getSelectionModel().setSelectionInterval(row,row ); + if(e.getButton() == MouseEvent.BUTTON3 ) + { + popup.show(table, e.getX(), e.getY()); + + } + + } + + }); + + setLayout(new BorderLayout()); + + add(new JScrollPane(table), BorderLayout.CENTER); + } + + + public void setData(List db) { + tableModel.setData(db); + } + + public void refresh() { + tableModel.fireTableDataChanged(); + } + public void setPersonTableListener(PersonTableListener listener) + { + this.personTableListener = listener; + } +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/TextPanel.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/TextPanel.java new file mode 100644 index 0000000..8cf3cf1 --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/TextPanel.java @@ -0,0 +1,31 @@ +package gui; +import java.awt.BorderLayout; +import java.awt.Dimension; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + + +public class TextPanel extends JPanel { + + private JTextArea textArea; + + public TextPanel() { + + Dimension dim = getPreferredSize(); + dim.height = 75; + setPreferredSize(dim); + textArea = new JTextArea(); + textArea.enable(false); + + + setLayout(new BorderLayout()); + + add(new JScrollPane(textArea), BorderLayout.CENTER); + } + + public void appendText(String text) { + textArea.append(text); + } +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/TextPanel2.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/TextPanel2.java new file mode 100644 index 0000000..82bef7c --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/TextPanel2.java @@ -0,0 +1,75 @@ +package gui; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; + +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + + +public class TextPanel2 extends JPanel { + + private JTextArea textArea; + private JPopupMenu popup; + + public TextPanel2() { + + Dimension dim = getPreferredSize(); + dim.height = 75; + setPreferredSize(dim); + textArea = new JTextArea(); + popup = new JPopupMenu(); + + JMenuItem removeItem = new JMenuItem("��������"); + popup.add(removeItem); + + removeItem.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) { + + DeleteText(); + + } + + }); + + setLayout(new BorderLayout()); + + add(new JScrollPane(textArea), BorderLayout.CENTER); + } + + public void appendText(String text) { + textArea.append(text); + } + public boolean getTextContains(String text) + { + if(textArea.getText().contains(text)) + { + + return true; + } + else + { + return false; + } + + } + public void DeleteText() + { + textArea.setText(null); + } + public void AddKeyListenerRevelance(KeyAdapter listener) + { + textArea.addKeyListener(listener); + } + + + +} \ No newline at end of file diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/Toolbar.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/Toolbar.java new file mode 100644 index 0000000..aa38d22 --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/Toolbar.java @@ -0,0 +1,72 @@ +package gui; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.net.URL; + +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JPanel; + + +public class Toolbar extends JPanel implements ActionListener { + private JButton saveButton; + private JButton refreshButton; + + private ToolbarListener textListener; + + public Toolbar() { + setBorder(BorderFactory.createEtchedBorder()); + + saveButton = new JButton("Save"); + saveButton.setIcon(createIcon("/images/1400444547_document-save.png")); + + refreshButton = new JButton("Refresh"); + refreshButton.setIcon(createIcon("/images/1400444569_gtk-refresh.png")); + + saveButton.addActionListener(this); + refreshButton.addActionListener(this); + + setLayout(new FlowLayout(FlowLayout.LEFT)); + + add(saveButton); + add(refreshButton); + } + + private ImageIcon createIcon(String path) + { + URL url = getClass().getResource(path); + + if(url == null) + { + System.err.println("Unabled to load image"+path); + } + + ImageIcon icon = new ImageIcon(url); + + return icon; + } + + public void setToolbarListener(ToolbarListener listener) { + this.textListener = listener; + } + + @Override + public void actionPerformed(ActionEvent e) { + JButton clicked = (JButton)e.getSource(); + + if(clicked == saveButton) { + if(textListener != null) { + textListener.saveEventOccured(); + } + } + else if(clicked == refreshButton) { + if(textListener != null) { + textListener.refreshEventOccured(); + } + } + + } +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/ToolbarListener.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/ToolbarListener.java new file mode 100644 index 0000000..cb654fa --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/ToolbarListener.java @@ -0,0 +1,6 @@ +package gui; + +public interface ToolbarListener { + public void saveEventOccured(); + public void refreshEventOccured(); +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/Utils.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/Utils.java new file mode 100644 index 0000000..34a78af --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/Utils.java @@ -0,0 +1,19 @@ +package gui; + +public class Utils { + + public static String getFileExtension(String name) { + + int pointIndex = name.lastIndexOf("."); + + if(pointIndex == -1) { + return null; + } + + if(pointIndex == name.length()-1) { + return null; + } + + return name.substring(pointIndex+1, name.length()); + } +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444437_save_accept.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444437_save_accept.png new file mode 100644 index 0000000..48ae6ff Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444437_save_accept.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444440_Save.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444440_Save.png new file mode 100644 index 0000000..030a28e Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444440_Save.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444542_save_16.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444542_save_16.png new file mode 100644 index 0000000..cd0162b Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444542_save_16.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444547_document-save.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444547_document-save.png new file mode 100644 index 0000000..bf10639 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444547_document-save.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444559_view-refresh.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444559_view-refresh.png new file mode 100644 index 0000000..cf70ceb Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444559_view-refresh.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444563_Synchronize.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444563_Synchronize.png new file mode 100644 index 0000000..01dc229 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444563_Synchronize.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444569_gtk-refresh.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444569_gtk-refresh.png new file mode 100644 index 0000000..dc14406 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444569_gtk-refresh.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444586_import.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444586_import.png new file mode 100644 index 0000000..e4703e9 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444586_import.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444602_table-export.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444602_table-export.png new file mode 100644 index 0000000..f582fb8 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444602_table-export.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444918_application_view_xp_terminal.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444918_application_view_xp_terminal.png new file mode 100644 index 0000000..c98e419 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444918_application_view_xp_terminal.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400445120_Error.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445120_Error.png new file mode 100644 index 0000000..0d6d934 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445120_Error.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400445243_text_horizontalrule.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445243_text_horizontalrule.png new file mode 100644 index 0000000..3e70c65 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445243_text_horizontalrule.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400445397_accept.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445397_accept.png new file mode 100644 index 0000000..68f638a Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445397_accept.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400445557_Windows_16x16.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445557_Windows_16x16.png new file mode 100644 index 0000000..3fd4321 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445557_Windows_16x16.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400445676_Help.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445676_Help.png new file mode 100644 index 0000000..0bd60db Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445676_Help.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400446085_Table_16x16.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400446085_Table_16x16.png new file mode 100644 index 0000000..4fe7dff Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400446085_Table_16x16.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400447294_1.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400447294_1.png new file mode 100644 index 0000000..c67d6f1 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400447294_1.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400462129_cart_add.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400462129_cart_add.png new file mode 100644 index 0000000..bc402b1 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400462129_cart_add.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400956144_gear__plus.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400956144_gear__plus.png new file mode 100644 index 0000000..bc4cd9e Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400956144_gear__plus.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/Refresh16.gif b/Diff_java_projects/simple-java-crud-app-master/src/images/Refresh16.gif new file mode 100644 index 0000000..cf7cea3 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/Refresh16.gif differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/Save16.gif b/Diff_java_projects/simple-java-crud-app-master/src/images/Save16.gif new file mode 100644 index 0000000..954f1ac Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/Save16.gif differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/Server16.gif b/Diff_java_projects/simple-java-crud-app-master/src/images/Server16.gif new file mode 100644 index 0000000..4e76682 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/Server16.gif differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/car.png b/Diff_java_projects/simple-java-crud-app-master/src/images/car.png new file mode 100644 index 0000000..cb18738 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/car.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/gear.png b/Diff_java_projects/simple-java-crud-app-master/src/images/gear.png new file mode 100644 index 0000000..bc4cd9e Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/gear.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/import1.png b/Diff_java_projects/simple-java-crud-app-master/src/images/import1.png new file mode 100644 index 0000000..ff10bad Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/import1.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/notepad.gif b/Diff_java_projects/simple-java-crud-app-master/src/images/notepad.gif new file mode 100644 index 0000000..074a105 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/notepad.gif differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/price.png b/Diff_java_projects/simple-java-crud-app-master/src/images/price.png new file mode 100644 index 0000000..ff76611 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/price.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/ware.png b/Diff_java_projects/simple-java-crud-app-master/src/images/ware.png new file mode 100644 index 0000000..db17c45 Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/ware.png differ diff --git a/Diff_java_projects/simple-java-crud-app-master/src/model/AgeCategory.java b/Diff_java_projects/simple-java-crud-app-master/src/model/AgeCategory.java new file mode 100644 index 0000000..e063c5a --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/model/AgeCategory.java @@ -0,0 +1,9 @@ +package model; + +public enum AgeCategory { + Nissan, + Mazda, + Land_Rover, + Lada, + Honda +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/model/Database.java b/Diff_java_projects/simple-java-crud-app-master/src/model/Database.java new file mode 100644 index 0000000..d3f5a2d --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/model/Database.java @@ -0,0 +1,231 @@ +package model; + + + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; + +import com.mysql.jdbc.ResultSet; + +public class Database { + + + private List people; + + private Connection con; + + + public Database() { + people = new LinkedList(); + + } + public void connect() throws Exception + { + if(con != null) return; + try { + Class.forName("com.mysql.jdbc.Driver"); + } catch (ClassNotFoundException e) { + throw new Exception("Driver not found"); + } + + String url = "jdbc:mysql://localhost:3306/swingtest_oleh"; + con = DriverManager.getConnection(url,"root",""); + + + + + + System.out.println("successful connected : " + con); + + } + + + + public void disconnect() + { + if(con != null) + { + try { + con.close(); + } catch (SQLException e) { + System.out.println("Cant close"); + } + } + + } + + + + public void save() throws SQLException + { + String checkSql = "select count(*) as count from people where id=?"; + PreparedStatement checkStmt = con.prepareStatement(checkSql); + + String insertSql = "insert into people (id , name , age , employment_status, tax_id , us_citizen ,gender, occupation) values (? , ? , ? , ? , ? , ? , ? ,? ) "; + PreparedStatement insertStatement = con.prepareStatement(insertSql); + + String updateSql = "update people set name=?, age=?, employment_status=?, tax_id=?, us_citizen=?, gender=?, occupation=? where id=?"; + PreparedStatement updateStatement = con.prepareStatement(updateSql); + + + for(Person person: people) + { + int id = person.getId(); + String name = person.getName(); + String occupation = person.getOccupation(); + AgeCategory age = person.getAgeCategory(); + EmploymentCategory emp = person.getEmpCat(); + String tax = person.getTaxId(); + boolean isUs = person.isUsCitizen(); + Gender gender = person.getGender(); + + + checkStmt.setInt(1, id); + + ResultSet checkResult = (ResultSet) checkStmt.executeQuery(); + + checkResult.next(); + + int count = checkResult.getInt(1); + + if(count == 0 ) + { + System.out.println("inserting person with ID : "+id); + + int col = 1; + insertStatement.setInt(col++, id); + insertStatement.setString(col++, name); + insertStatement.setString(col++, age.name()); + insertStatement.setString(col++, emp.name()); + insertStatement.setString(col++, tax); + insertStatement.setBoolean(col++, isUs); + insertStatement.setString(col++, gender.name()); + insertStatement.setString(col++, occupation); + + insertStatement.executeUpdate(); + + + + + + } + else + { + System.out.println("Updating person with ID" + id); + + int col = 1; + + + updateStatement.setString(col++, name); + updateStatement.setString(col++, age.name()); + updateStatement.setString(col++, emp.name()); + updateStatement.setString(col++, tax); + updateStatement.setBoolean(col++, isUs); + updateStatement.setString(col++, gender.name()); + updateStatement.setString(col++, occupation); + updateStatement.setInt(col++, id); + + updateStatement.executeUpdate(); + } + System.out.println("Count for person with id : "+ id + " is " + count); + + } + + updateStatement.close(); + insertStatement.close(); + checkStmt.close(); + } + + public void load() throws SQLException + { + people.clear(); + + String sql = "select id , name , age , employment_status, tax_id , us_citizen ,gender, occupation from people order by name "; + + Statement selectStatement = con.createStatement(); + + + + ResultSet results = (ResultSet) selectStatement.executeQuery(sql); + + while(results.next()) + { + int id = results.getInt("id"); + String name = results.getString("name"); + String age = results.getString("age"); + String emp = results.getString("employment_status"); + String tax = results.getString("tax_id"); + boolean isUs = results.getBoolean("us_citizen"); + String gender = results.getString("gender"); + String occ = results.getString("occupation"); + + + Person person = new Person(id,name,occ ,AgeCategory.valueOf(age),EmploymentCategory.valueOf(emp),tax , isUs , Gender.valueOf(gender)); + people.add(person); + + + } + + results.close(); + selectStatement.close(); + + } + public void addPerson(Person person) { + people.add(person); + } + public void removePerson(int index) + { + people.remove(index); + + } + + public List getPeople() { + return Collections.unmodifiableList(people); + } + public void saveToFile(File file) throws IOException + { + FileOutputStream fos = new FileOutputStream(file); + ObjectOutputStream oos = new ObjectOutputStream(fos); + + Person[] persons = people.toArray(new Person[people.size()]); + + oos.writeObject(persons); + + oos.close(); + } + public void loadFromFile(File file) throws IOException + { + FileInputStream fis = new FileInputStream(file); + ObjectInputStream ois = new ObjectInputStream(fis); + + try { + Person[] persons = (Person[]) ois.readObject(); + + people.clear(); + + people.addAll(Arrays.asList(persons)); + + + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + ois.close(); + + } +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/model/EmploymentCategory.java b/Diff_java_projects/simple-java-crud-app-master/src/model/EmploymentCategory.java new file mode 100644 index 0000000..7289cdf --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/model/EmploymentCategory.java @@ -0,0 +1,19 @@ +package model; + +public enum EmploymentCategory { + yes("����"), + no("���"), + sklad("�����"), + other("������"); + + private String text; + private EmploymentCategory(String text) + { + this.text = text; + + } + @Override + public String toString() { + return text; + } +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/model/Gender.java b/Diff_java_projects/simple-java-crud-app-master/src/model/Gender.java new file mode 100644 index 0000000..908b5d9 --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/model/Gender.java @@ -0,0 +1,6 @@ +package model; + +public enum Gender { + yes, + no +} diff --git a/Diff_java_projects/simple-java-crud-app-master/src/model/Person.java b/Diff_java_projects/simple-java-crud-app-master/src/model/Person.java new file mode 100644 index 0000000..56f869c --- /dev/null +++ b/Diff_java_projects/simple-java-crud-app-master/src/model/Person.java @@ -0,0 +1,129 @@ +package model; + +import java.io.Serializable; +import java.net.URL; + +import javax.swing.ImageIcon; +import javax.swing.table.DefaultTableCellRenderer; + +public class Person extends DefaultTableCellRenderer implements Serializable +{ + private static final long serialVersionUID = 4022843652518158650L; + + private static int count = 1; + + private int id; + private String name; + private String occupation; + private AgeCategory ageCategory; + private EmploymentCategory empCat; + private String taxId; + private boolean usCitizen; + private Gender gender; + private ImageIcon personIcon; + + public Person(String name, String occupation, AgeCategory ageCategory, + EmploymentCategory empCat, String taxId, + boolean usCitizen, Gender gender) { + this.name = name; + this.occupation = occupation; + this.ageCategory = ageCategory; + this.empCat = empCat; + this.taxId = taxId; + this.usCitizen = usCitizen; + this.gender = gender; + + this.id = count; + count++; + } + + public Person(int id, String name, String occupation, AgeCategory ageCategory, + EmploymentCategory empCat, String taxId, + boolean usCitizen, Gender gender) { + + this(name, occupation, ageCategory, empCat, taxId, usCitizen, gender); + + this.id = id; + + } + + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getOccupation() { + return occupation; + } + public void setOccupation(String occupation) { + this.occupation = occupation; + } + public AgeCategory getAgeCategory() { + return ageCategory; + } + public void setAgeCategory(AgeCategory ageCategory) { + this.ageCategory = ageCategory; + } + public EmploymentCategory getEmpCat() { + return empCat; + } + public void setEmpCat(EmploymentCategory empCat) { + this.empCat = empCat; + } + public String getTaxId() { + return taxId; + } + public void setTaxId(String taxId) { + this.taxId = taxId; + } + public boolean isUsCitizen() { + return usCitizen; + } + public void setUsCitizen(boolean usCitizen) { + this.usCitizen = usCitizen; + } + public Gender getGender() { + return gender; + } + public void setGender(Gender gender) { + this.gender = gender; + } + + public String toString() + { + return id + "Name: "+ name; + } + + public ImageIcon getPersonIcon() { + + personIcon = new ImageIcon(new String("/images/car.png")); + return personIcon; + } + + public void setPersonIcon(ImageIcon personIcon) { + this.personIcon = personIcon; + } + private ImageIcon createIcon(String path) + { + URL url = getClass().getResource(path); + + if(url == null) + { + System.err.println("Unabled to load image"+path); + } + + ImageIcon icon = new ImageIcon(url); + + return icon; + } + + + +} diff --git a/projects/Billing-System-master/.classpath b/projects/Billing-System-master/.classpath new file mode 100644 index 0000000..a1dda71 --- /dev/null +++ b/projects/Billing-System-master/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/projects/Billing-System-master/.project b/projects/Billing-System-master/.project new file mode 100644 index 0000000..7a2c11b --- /dev/null +++ b/projects/Billing-System-master/.project @@ -0,0 +1,17 @@ + + + Billing-System-master + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/projects/Billing-System-master/Billing System.jar b/projects/Billing-System-master/Billing System.jar new file mode 100644 index 0000000..74a9c19 Binary files /dev/null and b/projects/Billing-System-master/Billing System.jar differ diff --git a/projects/Billing-System-master/README.md b/projects/Billing-System-master/README.md new file mode 100644 index 0000000..63b894f --- /dev/null +++ b/projects/Billing-System-master/README.md @@ -0,0 +1,10 @@ +# Billing-System +A GUI Based Complete Store Billing System in java that generates Invoice of each sale. + + Requirments + +This Project Requires. + +Wamp Server Installed (Running). + +Create database "caddey" and three tables "sale" , "users" and "stock". diff --git a/projects/Billing-System-master/_invoice_.pdf b/projects/Billing-System-master/_invoice_.pdf new file mode 100644 index 0000000..7dcefe4 Binary files /dev/null and b/projects/Billing-System-master/_invoice_.pdf differ diff --git a/projects/Billing-System-master/bin/AdminPanel.class b/projects/Billing-System-master/bin/AdminPanel.class new file mode 100644 index 0000000..d8252c3 Binary files /dev/null and b/projects/Billing-System-master/bin/AdminPanel.class differ diff --git a/projects/Billing-System-master/bin/DB.class b/projects/Billing-System-master/bin/DB.class new file mode 100644 index 0000000..accd291 Binary files /dev/null and b/projects/Billing-System-master/bin/DB.class differ diff --git a/projects/Billing-System-master/bin/Invoice$1.class b/projects/Billing-System-master/bin/Invoice$1.class new file mode 100644 index 0000000..8bc4c58 Binary files /dev/null and b/projects/Billing-System-master/bin/Invoice$1.class differ diff --git a/projects/Billing-System-master/bin/Invoice$2.class b/projects/Billing-System-master/bin/Invoice$2.class new file mode 100644 index 0000000..29762ec Binary files /dev/null and b/projects/Billing-System-master/bin/Invoice$2.class differ diff --git a/projects/Billing-System-master/bin/Invoice$3.class b/projects/Billing-System-master/bin/Invoice$3.class new file mode 100644 index 0000000..3613cd1 Binary files /dev/null and b/projects/Billing-System-master/bin/Invoice$3.class differ diff --git a/projects/Billing-System-master/bin/Invoice$4.class b/projects/Billing-System-master/bin/Invoice$4.class new file mode 100644 index 0000000..9cfd157 Binary files /dev/null and b/projects/Billing-System-master/bin/Invoice$4.class differ diff --git a/projects/Billing-System-master/bin/Invoice.class b/projects/Billing-System-master/bin/Invoice.class new file mode 100644 index 0000000..9af9ce3 Binary files /dev/null and b/projects/Billing-System-master/bin/Invoice.class differ diff --git a/projects/Billing-System-master/bin/Login$1.class b/projects/Billing-System-master/bin/Login$1.class new file mode 100644 index 0000000..1f93718 Binary files /dev/null and b/projects/Billing-System-master/bin/Login$1.class differ diff --git a/projects/Billing-System-master/bin/Login$2.class b/projects/Billing-System-master/bin/Login$2.class new file mode 100644 index 0000000..99619f2 Binary files /dev/null and b/projects/Billing-System-master/bin/Login$2.class differ diff --git a/projects/Billing-System-master/bin/Login$3.class b/projects/Billing-System-master/bin/Login$3.class new file mode 100644 index 0000000..66ef0b6 Binary files /dev/null and b/projects/Billing-System-master/bin/Login$3.class differ diff --git a/projects/Billing-System-master/bin/Login.class b/projects/Billing-System-master/bin/Login.class new file mode 100644 index 0000000..a9264ef Binary files /dev/null and b/projects/Billing-System-master/bin/Login.class differ diff --git a/projects/Billing-System-master/bin/Sale$1.class b/projects/Billing-System-master/bin/Sale$1.class new file mode 100644 index 0000000..2ecc61e Binary files /dev/null and b/projects/Billing-System-master/bin/Sale$1.class differ diff --git a/projects/Billing-System-master/bin/Sale$2.class b/projects/Billing-System-master/bin/Sale$2.class new file mode 100644 index 0000000..3093ec1 Binary files /dev/null and b/projects/Billing-System-master/bin/Sale$2.class differ diff --git a/projects/Billing-System-master/bin/Sale$3.class b/projects/Billing-System-master/bin/Sale$3.class new file mode 100644 index 0000000..3a49faf Binary files /dev/null and b/projects/Billing-System-master/bin/Sale$3.class differ diff --git a/projects/Billing-System-master/bin/Sale$4.class b/projects/Billing-System-master/bin/Sale$4.class new file mode 100644 index 0000000..036d016 Binary files /dev/null and b/projects/Billing-System-master/bin/Sale$4.class differ diff --git a/projects/Billing-System-master/bin/Sale.class b/projects/Billing-System-master/bin/Sale.class new file mode 100644 index 0000000..fc60f99 Binary files /dev/null and b/projects/Billing-System-master/bin/Sale.class differ diff --git a/projects/Billing-System-master/bin/addCashier$1.class b/projects/Billing-System-master/bin/addCashier$1.class new file mode 100644 index 0000000..be23167 Binary files /dev/null and b/projects/Billing-System-master/bin/addCashier$1.class differ diff --git a/projects/Billing-System-master/bin/addCashier.class b/projects/Billing-System-master/bin/addCashier.class new file mode 100644 index 0000000..cdfd486 Binary files /dev/null and b/projects/Billing-System-master/bin/addCashier.class differ diff --git a/projects/Billing-System-master/bin/addProduct$1.class b/projects/Billing-System-master/bin/addProduct$1.class new file mode 100644 index 0000000..201dba8 Binary files /dev/null and b/projects/Billing-System-master/bin/addProduct$1.class differ diff --git a/projects/Billing-System-master/bin/addProduct.class b/projects/Billing-System-master/bin/addProduct.class new file mode 100644 index 0000000..e59e977 Binary files /dev/null and b/projects/Billing-System-master/bin/addProduct.class differ diff --git a/projects/Billing-System-master/bin/deleteCashier$1.class b/projects/Billing-System-master/bin/deleteCashier$1.class new file mode 100644 index 0000000..1e0d0f0 Binary files /dev/null and b/projects/Billing-System-master/bin/deleteCashier$1.class differ diff --git a/projects/Billing-System-master/bin/deleteCashier.class b/projects/Billing-System-master/bin/deleteCashier.class new file mode 100644 index 0000000..c97e65c Binary files /dev/null and b/projects/Billing-System-master/bin/deleteCashier.class differ diff --git a/projects/Billing-System-master/bin/deleteProduct$1.class b/projects/Billing-System-master/bin/deleteProduct$1.class new file mode 100644 index 0000000..b8d8167 Binary files /dev/null and b/projects/Billing-System-master/bin/deleteProduct$1.class differ diff --git a/projects/Billing-System-master/bin/deleteProduct.class b/projects/Billing-System-master/bin/deleteProduct.class new file mode 100644 index 0000000..dc2f3c2 Binary files /dev/null and b/projects/Billing-System-master/bin/deleteProduct.class differ diff --git a/projects/Billing-System-master/bin/generateInvoice$1.class b/projects/Billing-System-master/bin/generateInvoice$1.class new file mode 100644 index 0000000..cd38f4e Binary files /dev/null and b/projects/Billing-System-master/bin/generateInvoice$1.class differ diff --git a/projects/Billing-System-master/bin/generateInvoice.class b/projects/Billing-System-master/bin/generateInvoice.class new file mode 100644 index 0000000..d47ac3a Binary files /dev/null and b/projects/Billing-System-master/bin/generateInvoice.class differ diff --git a/projects/Billing-System-master/bin/pdfGenerator.class b/projects/Billing-System-master/bin/pdfGenerator.class new file mode 100644 index 0000000..cc378fd Binary files /dev/null and b/projects/Billing-System-master/bin/pdfGenerator.class differ diff --git a/projects/Billing-System-master/bin/searchCashier$1.class b/projects/Billing-System-master/bin/searchCashier$1.class new file mode 100644 index 0000000..3a9a04b Binary files /dev/null and b/projects/Billing-System-master/bin/searchCashier$1.class differ diff --git a/projects/Billing-System-master/bin/searchCashier.class b/projects/Billing-System-master/bin/searchCashier.class new file mode 100644 index 0000000..ccd98c3 Binary files /dev/null and b/projects/Billing-System-master/bin/searchCashier.class differ diff --git a/projects/Billing-System-master/bin/searchProduct$1.class b/projects/Billing-System-master/bin/searchProduct$1.class new file mode 100644 index 0000000..e7b882d Binary files /dev/null and b/projects/Billing-System-master/bin/searchProduct$1.class differ diff --git a/projects/Billing-System-master/bin/searchProduct.class b/projects/Billing-System-master/bin/searchProduct.class new file mode 100644 index 0000000..444a060 Binary files /dev/null and b/projects/Billing-System-master/bin/searchProduct.class differ diff --git a/projects/Billing-System-master/bin/showStock$1.class b/projects/Billing-System-master/bin/showStock$1.class new file mode 100644 index 0000000..08dd11f Binary files /dev/null and b/projects/Billing-System-master/bin/showStock$1.class differ diff --git a/projects/Billing-System-master/bin/showStock$2.class b/projects/Billing-System-master/bin/showStock$2.class new file mode 100644 index 0000000..2d32375 Binary files /dev/null and b/projects/Billing-System-master/bin/showStock$2.class differ diff --git a/projects/Billing-System-master/bin/showStock$3.class b/projects/Billing-System-master/bin/showStock$3.class new file mode 100644 index 0000000..3fcc672 Binary files /dev/null and b/projects/Billing-System-master/bin/showStock$3.class differ diff --git a/projects/Billing-System-master/bin/showStock.class b/projects/Billing-System-master/bin/showStock.class new file mode 100644 index 0000000..f636993 Binary files /dev/null and b/projects/Billing-System-master/bin/showStock.class differ diff --git a/projects/Billing-System-master/bin/updateProduct$1.class b/projects/Billing-System-master/bin/updateProduct$1.class new file mode 100644 index 0000000..eaefafc Binary files /dev/null and b/projects/Billing-System-master/bin/updateProduct$1.class differ diff --git a/projects/Billing-System-master/bin/updateProduct$2.class b/projects/Billing-System-master/bin/updateProduct$2.class new file mode 100644 index 0000000..64530e3 Binary files /dev/null and b/projects/Billing-System-master/bin/updateProduct$2.class differ diff --git a/projects/Billing-System-master/bin/updateProduct.class b/projects/Billing-System-master/bin/updateProduct.class new file mode 100644 index 0000000..98ea32b Binary files /dev/null and b/projects/Billing-System-master/bin/updateProduct.class differ diff --git a/projects/Billing-System-master/images/logo.png b/projects/Billing-System-master/images/logo.png new file mode 100644 index 0000000..cb5eb11 Binary files /dev/null and b/projects/Billing-System-master/images/logo.png differ diff --git a/projects/Billing-System-master/jgoodies-forms-1.8.0-sources.jar b/projects/Billing-System-master/jgoodies-forms-1.8.0-sources.jar new file mode 100644 index 0000000..822eb93 Binary files /dev/null and b/projects/Billing-System-master/jgoodies-forms-1.8.0-sources.jar differ diff --git a/projects/Billing-System-master/jgoodies-forms-1.8.0.jar b/projects/Billing-System-master/jgoodies-forms-1.8.0.jar new file mode 100644 index 0000000..a6a8126 Binary files /dev/null and b/projects/Billing-System-master/jgoodies-forms-1.8.0.jar differ diff --git a/projects/Billing-System-master/logo.jpg b/projects/Billing-System-master/logo.jpg new file mode 100644 index 0000000..df40dee Binary files /dev/null and b/projects/Billing-System-master/logo.jpg differ diff --git a/projects/Billing-System-master/logo.png b/projects/Billing-System-master/logo.png new file mode 100644 index 0000000..9a4fbd5 Binary files /dev/null and b/projects/Billing-System-master/logo.png differ diff --git a/projects/Billing-System-master/logo2.png b/projects/Billing-System-master/logo2.png new file mode 100644 index 0000000..1ec95d3 Binary files /dev/null and b/projects/Billing-System-master/logo2.png differ diff --git a/projects/Billing-System-master/src/AdminPanel.java b/projects/Billing-System-master/src/AdminPanel.java new file mode 100644 index 0000000..b90be57 --- /dev/null +++ b/projects/Billing-System-master/src/AdminPanel.java @@ -0,0 +1,219 @@ +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; + +import javax.swing.JFrame; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JMenu; +import java.awt.Toolkit; + + +public class AdminPanel extends JFrame implements ActionListener { + JMenuItem itmAddProduct; + JMenu mnProduct; + JMenuItem itmUpdateProduct; + JMenuItem itmDeleteProduct; + JMenu mnCashier ; + JMenuItem itmDeleteCashier; + JMenuItem itmAddCashier; + JMenu mnStock ; + JMenuItem itmShowStock; + JMenu mnExport; + ArrayList panels=new ArrayList(); + int cPanel=0; + private JMenu mnSearch; + private JMenuItem mntmSearchProduct; + private JMenuItem mntmSearchCashier; + private JMenu mnSale; + private JMenuItem mntmPrintSale; + + + /** + * Create the frame. + */ + public AdminPanel() { + setIconImage(Toolkit.getDefaultToolkit().getImage("F:\\Working Directory\\fianl project with sql\\Bill\\logo.png")); + setTitle("Admin Panel"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 840, 619); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + mnProduct = new JMenu("Product"); + menuBar.add(mnProduct); + + itmAddProduct = new JMenuItem("Add Product"); + mnProduct.add(itmAddProduct); + itmAddProduct.addActionListener(this); + + itmUpdateProduct = new JMenuItem("Update Product"); + mnProduct.add(itmUpdateProduct); + itmUpdateProduct.addActionListener(this); + + itmDeleteProduct = new JMenuItem("Delete Product"); + mnProduct.add(itmDeleteProduct); + itmDeleteProduct.addActionListener(this); + + mnCashier = new JMenu("Cashier"); + menuBar.add(mnCashier); + + itmAddCashier = new JMenuItem("Add Cashier"); + mnCashier.add(itmAddCashier); + itmAddCashier.addActionListener(this); + + itmDeleteCashier = new JMenuItem("Delete Cashier"); + mnCashier.add(itmDeleteCashier); + itmDeleteCashier.addActionListener(this); + + mnStock = new JMenu("Stock"); + menuBar.add(mnStock); + + itmShowStock = new JMenuItem("Show Stock"); + mnStock.add(itmShowStock); + itmShowStock.addActionListener(this); + + mnSearch = new JMenu("Search"); + menuBar.add(mnSearch); + + mntmSearchProduct = new JMenuItem("Search Product"); + mnSearch.add(mntmSearchProduct); + mntmSearchProduct.addActionListener(this); + + mntmSearchCashier = new JMenuItem("Search Cashier"); + mnSearch.add(mntmSearchCashier); + + mnSale = new JMenu("Sale"); + menuBar.add(mnSale); + + mntmPrintSale = new JMenuItem("Print Sale"); + mnSale.add(mntmPrintSale); + mntmPrintSale.addActionListener(this); + + mnExport = new JMenu("Account"); + menuBar.add(mnExport); + + JMenuItem logout = new JMenuItem("Logout"); + mnExport.add(logout); + logout.addActionListener(this); + mntmSearchCashier.addActionListener(this); + + getContentPane().setLayout(new BorderLayout(0, 0)); + + panels.add(new addProduct()); + panels.add(new updateProduct()); + panels.add(new deleteProduct()); + panels.add(new addCashier()); + panels.add(new deleteCashier()); + panels.add(new showStock()); + panels.add(new searchProduct()); + panels.add(new searchCashier()); + panels.add(new Sale()); + getContentPane().add(panels.get(0)); + + } + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + System.out.println("Selected: " + e.getActionCommand()); + if(e.getActionCommand().equals("Add Product")) + { + System.out.println(panels.get(cPanel)); + this.remove(panels.get(cPanel)); + this.revalidate(); + this.repaint(); + getContentPane().add(panels.get(0)); + this.setVisible(true); + cPanel=0; + this.setTitle("Add Product"); + } + else if(e.getActionCommand().equals("Update Product")) + { + this.remove(panels.get(cPanel)); + this.revalidate(); + this.repaint(); + getContentPane().add(panels.get(1)); + this.setVisible(true); + cPanel=1; + this.setTitle("Update Product"); + } + else if(e.getActionCommand().equals("Delete Product")) + { + this.remove(panels.get(cPanel)); + this.revalidate(); + this.repaint(); + getContentPane().add(panels.get(2)); + this.setVisible(true); + cPanel=2; + this.setTitle("Delete Product"); + } + else if(e.getActionCommand().equals("Add Cashier")) + { + this.remove(panels.get(cPanel)); + this.revalidate(); + this.repaint(); + getContentPane().add(panels.get(3)); + this.setVisible(true); + cPanel=3; + this.setTitle("Add Cashier"); + } + else if(e.getActionCommand().equals("Delete Cashier")) + { + this.remove(panels.get(cPanel)); + this.revalidate(); + this.repaint(); + getContentPane().add(panels.get(4)); + this.setVisible(true); + cPanel=4; + this.setTitle("Delete Cashier"); + } + else if(e.getActionCommand().equals("Show Stock")) + { + this.remove(panels.get(cPanel)); + getContentPane().add(panels.get(5)); + this.revalidate(); + this.repaint(); + this.setVisible(true); + cPanel=5; + this.setTitle("Show Stock"); + } + else if(e.getActionCommand().equals("Search Product")) + { + this.remove(panels.get(cPanel)); + getContentPane().add(panels.get(6)); + this.revalidate(); + this.repaint(); + this.setVisible(true); + cPanel=6; + this.setTitle("Search Product"); + } + else if(e.getActionCommand().equals("Search Cashier")) + { + this.remove(panels.get(cPanel)); + getContentPane().add(panels.get(7)); + this.revalidate(); + this.repaint(); + this.setVisible(true); + cPanel=7; + this.setTitle("Search Cashier"); + } + else if(e.getActionCommand().equals("Print Sale")) + { + this.remove(panels.get(cPanel)); + getContentPane().add(panels.get(8)); + this.revalidate(); + this.repaint(); + this.setVisible(true); + cPanel=8; + this.setTitle("Print Sale"); + } + else if(e.getActionCommand().equals("Logout")) + { + this.dispose(); + } + } +} diff --git a/projects/Billing-System-master/src/DB.java b/projects/Billing-System-master/src/DB.java new file mode 100644 index 0000000..a0173b9 --- /dev/null +++ b/projects/Billing-System-master/src/DB.java @@ -0,0 +1,358 @@ +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; + +import javax.swing.JOptionPane; + +public class DB { + + public static Connection DBConnection() + { + Connection conn = null; + try + { + Class.forName("com.mysql.jdbc.Driver"); + + conn = DriverManager.getConnection("jdbc:mysql://localhost/caddey","root", ""); + System.out.print("Database is connected !"); + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(null, "Do not connect to DB - Error:"+e); + + } + return conn; + } + public static void addProductToDB(String id,String detail,String comp,int quan) + { + Connection conn=DBConnection(); + try { + Statement statement = conn.createStatement(); + statement.executeUpdate("INSERT INTO stock VALUES ('"+id+"','"+detail+"','"+comp+"',"+quan+");"); + JOptionPane.showMessageDialog(null, "Product added to database"); + conn.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + JOptionPane.showMessageDialog(null, e.getMessage()); + e.printStackTrace(); + } + } + public static void updateProductToDB(String id,String detail,String comp,int quan) + { + Connection conn=DBConnection(); + try { + Statement statement = conn.createStatement(); + int status=statement.executeUpdate("UPDATE stock set Detail = '"+detail+"', Company = '"+comp+"', Quantity = "+quan+" WHERE ProductID = '"+id+"';"); + if(status==1) + JOptionPane.showMessageDialog(null, "Product updted"); + else + JOptionPane.showMessageDialog(null, "ProductID not found!"); + conn.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + JOptionPane.showMessageDialog(null, e.getMessage()); + e.printStackTrace(); + } + + } + + public static void deleteProductToDB(String id) + { + Connection conn=DBConnection(); + try { + Statement statement = conn.createStatement(); + int status=statement.executeUpdate("DELETE from stock WHERE ProductID = '"+id+"';"); + if(status==1) + JOptionPane.showMessageDialog(null, "Product deleted"); + else + JOptionPane.showMessageDialog(null, "ProductID not found!"); + conn.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + JOptionPane.showMessageDialog(null, e.getMessage()); + e.printStackTrace(); + } + + } + public static void searchProduct(String id) + { + Connection conn=DBConnection(); + try { + Statement statement = conn.createStatement(); + ResultSet rs = statement.executeQuery("Select * from stock WHERE ProductID = '"+id+"';"); + if (!rs.next()) + JOptionPane.showMessageDialog(null,"No product found with this id!"); + else + JOptionPane.showMessageDialog(null, "ProductID: "+id+"\nQuantity: "+rs.getString("Quantity")); + + conn.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + JOptionPane.showMessageDialog(null, e.getMessage()); + e.printStackTrace(); + } + } + public static void searchCashier(String email) + { + Connection conn=DBConnection(); + try { + Statement statement = conn.createStatement(); + ResultSet rs = statement.executeQuery("Select * from users WHERE Email = '"+email+"';"); + if (!rs.next()) + JOptionPane.showMessageDialog(null,"No cashier found with this email!"); + else + JOptionPane.showMessageDialog(null, "Email: "+email+"\nPassword: "+rs.getString("Password")); + + conn.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + JOptionPane.showMessageDialog(null, e.getMessage()); + e.printStackTrace(); + } + } + public static boolean varifyLogin(String email,String pass) + { + boolean login=false; + Connection conn=DBConnection(); + try { + Statement statement = conn.createStatement(); + ResultSet rs = statement.executeQuery("Select * from users WHERE Email = '"+email+"' and Password = '"+pass+"';"); + if (!rs.next()) + login=false; + else + login=true; + + conn.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + JOptionPane.showMessageDialog(null, e.getMessage()); + e.printStackTrace(); + } + return login; + } + public static void addCashier(String user,String pass) + { + Connection conn=DBConnection(); + try { + Statement statement = conn.createStatement(); + statement.executeUpdate("INSERT INTO users VALUES ('"+user+"','"+pass+"');"); + JOptionPane.showMessageDialog(null, "Cashier added to database"); + conn.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + JOptionPane.showMessageDialog(null, e.getMessage()); + e.printStackTrace(); + } + } + public static void deleteCashier(String user,String pass) + { + Connection conn=DBConnection(); + try { + Statement statement = conn.createStatement(); + int status=statement.executeUpdate("DELETE from users WHERE Email = '"+user+"' AND Password = '"+pass+"';"); + if(status==1) + JOptionPane.showMessageDialog(null, "Cashier deleted"); + else + JOptionPane.showMessageDialog(null, "Cashier not found!"); + conn.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + JOptionPane.showMessageDialog(null, e.getMessage()); + e.printStackTrace(); + } + } + + public static String searchPDetail(String id,int q) + { + Connection conn=DBConnection(); + String rt=""; + try { + int quan; + Statement statement = conn.createStatement(); + ResultSet rs = statement.executeQuery("Select * from stock WHERE ProductID = '"+id+"';"); + if (!rs.next()) + rt="nill"; + else{ + quan=Integer.parseInt(rs.getString("Quantity"))-q; + if(quan<0) + rt="item is out of stock"; + else + { + rt=rs.getString("Detail")+"%"+rs.getString("Company"); + statement.executeUpdate("UPDATE stock set Quantity = "+quan+" WHERE ProductID = '"+id+"';"); + } + + } + + conn.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + JOptionPane.showMessageDialog(null, e.getMessage()); + e.printStackTrace(); + } + return rt; + } + public static void addSaleToDB(Object data[],ArrayList comp,String name) + { + Connection conn=DBConnection(); + DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); + Date date = new Date(); + String d=dateFormat.format(date); + try { + Statement statement = conn.createStatement(); + for(int x=0;x getSale(String date,String comp) + { + String q; + ArrayList r=new ArrayList(); + + if(comp.equals("All")) + q="Select * from sale WHERE Date = '"+date+"';"; + else + q="Select * from sale WHERE Date = '"+date+"' AND Company = '"+comp+"';"; + Connection conn=DBConnection(); + try { + Statement statement = conn.createStatement(); + ResultSet rs = statement.executeQuery(q); + while(rs.next()) + { + r.add(rs.getString("Date")); + r.add(rs.getString("ProductID")); + r.add(rs.getString("Company")); + r.add(rs.getString("Payment")); + } + conn.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + JOptionPane.showMessageDialog(null, e.getMessage()); + e.printStackTrace(); + } + return r; + } + + public static ArrayList showStock(String comp) + { + String q; + ArrayList r=new ArrayList(); + if(comp.equals("All")) + q="Select * from stock;"; + else + q="Select * from stock WHERE Company = '"+comp+"';"; + Connection conn=DBConnection(); + try { + Statement statement = conn.createStatement(); + ResultSet rs = statement.executeQuery(q); + while(rs.next()) + { + r.add(rs.getString("ProductID")); + r.add(rs.getString("Detail")); + r.add(rs.getString("Company")); + r.add(rs.getString("Quantity")); + } + conn.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + JOptionPane.showMessageDialog(null, e.getMessage()); + e.printStackTrace(); + } + return r; + } + + public static String getPDetail(String id,int q) + { + Connection conn=DBConnection(); + String rt=""; + try { + int quan; + Statement statement = conn.createStatement(); + ResultSet rs = statement.executeQuery("Select * from stock WHERE ProductID = '"+id+"';"); + if (!rs.next()) + rt="nill"; + else{ + quan=Integer.parseInt(rs.getString("Quantity"))-q; + if(quan<0) + rt="item is out of stock"; + else + { + rt=rs.getString("Detail")+"%"+rs.getString("Company"); + statement.executeUpdate("UPDATE stock set Quantity = "+quan+" WHERE ProductID = '"+id+"';"); + } + + } + + conn.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + JOptionPane.showMessageDialog(null, e.getMessage()); + e.printStackTrace(); + } + return rt; + } + + public static ArrayList searchP(String id) + { + Connection conn=DBConnection(); + ArrayList data=new ArrayList(); + try { + Statement statement = conn.createStatement(); + ResultSet rs = statement.executeQuery("Select * from stock WHERE ProductID = '"+id+"';"); + if (rs.next()) + { + data.add(rs.getString("Detail")); + data.add(rs.getString("Company")); + data.add(rs.getString("Quantity")); + } + + conn.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + JOptionPane.showMessageDialog(null, e.getMessage()); + e.printStackTrace(); + } + return data; + } + + public static void updateProduct(String id,int quan) + { + Connection conn=DBConnection(); + try { + Statement statement = conn.createStatement(); + ResultSet rs = statement.executeQuery("Select * from stock WHERE ProductID = '"+id+"';"); + int q=0; + if(rs.next()) + { + q=Integer.parseInt(rs.getString("Quantity"))+quan; + statement.executeUpdate("UPDATE stock set Quantity = "+q+" WHERE ProductID = '"+id+"';"); + + } + conn.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + JOptionPane.showMessageDialog(null, e.getMessage()); + e.printStackTrace(); + } + + } + public static void main(String args[]) + { + + } +} diff --git a/projects/Billing-System-master/src/Invoice.java b/projects/Billing-System-master/src/Invoice.java new file mode 100644 index 0000000..047e7b9 --- /dev/null +++ b/projects/Billing-System-master/src/Invoice.java @@ -0,0 +1,249 @@ + + + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JLabel; +import java.awt.Font; +import javax.swing.JComboBox; +import javax.swing.JTextField; +import javax.swing.table.DefaultTableModel; +import javax.swing.JButton; +import javax.swing.JTable; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.awt.event.ActionEvent; +import java.awt.Color; + +public class Invoice extends JPanel { + private JTextField name; + private JTextField pID; + private JTextField pQuan; + private JTable items; + private JTextField UnitPrice; + JLabel lblName; + JLabel error ; + static int invo=1; + DefaultTableModel dtm; + Object data[]; + JComboBox cType; + ArrayList comp=new ArrayList(); + private JTextField dField; + long total=0; + JLabel gtotal ; + + /** + * Create the panel. + */ + public Invoice() { + setLayout(null); + + JLabel lblCustomer = new JLabel("Customer"); + lblCustomer.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblCustomer.setBounds(88, 59, 97, 23); + add(lblCustomer); + + cType = new JComboBox(); + cType.setBounds(201, 62, 89, 20); + add(cType); + cType.addItem("Walk-in customer"); + cType.addItem("Company/customer name"); + cType.setSelectedIndex(1); + cType.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent arg0) { + // TODO Auto-generated method stub + if(cType.getSelectedIndex()==1) + { + lblName.setVisible(true); + name.setVisible(true); + } + else + { + lblName.setVisible(false); + name.setVisible(false); + } + } + }); + lblName = new JLabel("Name"); + lblName.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblName.setBounds(364, 59, 64, 23); + add(lblName); + + name = new JTextField(); + name.setBounds(438, 62, 150, 20); + add(name); + name.setColumns(10); + + JLabel lblProductId = new JLabel("Product ID"); + lblProductId.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblProductId.setBounds(88, 383, 80, 23); + add(lblProductId); + + JLabel lblQuantity = new JLabel("Quantity"); + lblQuantity.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblQuantity.setBounds(88, 174, 97, 23); + add(lblQuantity); + + pID = new JTextField(); + pID.setBounds(201, 133, 89, 20); + add(pID); + pID.setColumns(10); + + pQuan = new JTextField(); + pQuan.setColumns(10); + pQuan.setBounds(201, 177, 89, 20); + add(pQuan); + + JButton btnAdd = new JButton("Add"); + btnAdd.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + if(UnitPrice.getText().equals("")||pQuan.getText().equals("")||pID.getText().equals("")) + { + error.setText("Enter required data"); + return; + } + else + error.setText(""); + + long up,fp,q; + String id,detail=""; + up=Long.parseLong(UnitPrice.getText().trim()); + q=Long.parseLong(pQuan.getText().trim()); + id=pID.getText().trim(); + UnitPrice.setText(""); + pQuan.setText(""); + pID.setText(""); + fp=(up*q); + detail=DB.searchPDetail(id,(int)q); + String str[]=detail.split("%"); + detail=str[0]; + if(detail.equals("nill")) + { + error.setText("Invalid product id!"); + return; + } + else if(detail.equals("item is out of stock")) + { + error.setText(detail); + return; + } + else + { + error.setText(""); + comp.add(str[1]); + } + dtm.addRow(new Object[]{id,detail,up,q,fp}); + total+=fp; + gtotal.setText(total+""); + + } + }); + btnAdd.setBounds(201, 265, 89, 23); + add(btnAdd); + + String [] header={"Product ID","Item Details","Unit Price","Quantity","Final Price"}; + dtm= new DefaultTableModel(header, 0); + items = new JTable(dtm); + items.setBounds(361, 135, 316, 298); + //add(items); + JScrollPane s=new JScrollPane(items); + s.setEnabled(false); + s.setBounds(361, 135, 392, 265); + add(s); + + UnitPrice = new JTextField(); + UnitPrice.setColumns(10); + UnitPrice.setBounds(201, 220, 89, 20); + add(UnitPrice); + + JLabel lblUnitPrice = new JLabel("Unit Price"); + lblUnitPrice.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblUnitPrice.setBounds(88, 217, 97, 23); + add(lblUnitPrice); + + JButton btnPrint = new JButton("PRINT"); + btnPrint.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + int x=0; + String n=""; + if(cType.getSelectedIndex()==1) + n=name.getText().trim(); + data=new Object[dtm.getColumnCount()*dtm.getRowCount()]; + for(int row=0;row comp ; + String com,dt; + static DefaultTableModel dtm; + ArrayList print=new ArrayList(); + /** + * Create the panel. + */ + public Sale() { + setLayout(null); + + String [] header={"Date","Product ID","Company","Sale"}; + dtm= new DefaultTableModel(header, 0); + sale = new JTable(dtm); + sale.setBounds(244, 69, 494, 379); + add(sale); + JScrollPane s=new JScrollPane(sale); + s.setBounds(244, 69, 494, 379); + add(s); + + JButton btnPrint = new JButton("PRINT"); + btnPrint.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + Object data[]=new Object[dtm.getColumnCount()*dtm.getRowCount()]; + int x=0; + long total=0; + for(int row=0;row(); + comp.setBounds(62, 261, 86, 20); + add(comp); + comp.addItem("All"); + comp.addItem("General"); + comp.addItem("Mats & Rugs"); + comp.addItem("N/S & Electric"); + + + + ms.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + ds.setSelected(false); + } + }); + ds.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + ms.setSelected(false); + } + }); + } + + public static void dailySale(String dt,String com) + { + ArrayList sl=new ArrayList(); + sl=DB.getSale(dt, com); + String x1,x2,x3,x4; + dtm.setRowCount(0); + int sz=sl.size()/4; + for(int x=0;x sl=new ArrayList(); + String ndt; + dtm.setRowCount(0); + for(int x=1;x<=31;x++) + { + ndt=date[0]+"/"+date[1]+"/"+s[x].trim(); + sl=DB.getSale(ndt, com); + String x1,x2,x3,x4; + + int sz=sl.size()/4; + for(int i=0;i company; + String id,detail,comp; + int quan; + String err="Enter product id and quantity"; + /** + * Create the panel. + */ + public addProduct() { + setLayout(null); + setBounds(100, 100, 840, 619); + JLabel lblAddProduct = new JLabel("ADD PRODUCT"); + lblAddProduct.setBounds(328, 45, 115, 21); + lblAddProduct.setFont(new Font("Tahoma", Font.PLAIN, 17)); + add(lblAddProduct); + + JLabel lblProductName = new JLabel("Product ID"); + lblProductName.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblProductName.setBounds(246, 136, 124, 21); + add(lblProductName); + + JLabel lblProductDescription = new JLabel("Product Details\r\n"); + lblProductDescription.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblProductDescription.setBounds(246, 168, 139, 21); + add(lblProductDescription); + + idField = new JTextField(); + idField.setBounds(449, 137, 136, 20); + add(idField); + idField.setColumns(10); + + descField = new JTextArea(); + descField.setBounds(449, 168, 136, 58); + add(descField); + JScrollPane scroll = new JScrollPane(descField); + scroll.setBounds(449, 168, 136, 58); + add(scroll); + + JLabel lblCompany = new JLabel("Company"); + lblCompany.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblCompany.setBounds(246, 241, 124, 21); + add(lblCompany); + + JButton btnAddProduct = new JButton("Add Product"); + btnAddProduct.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + if(quanField.getText().equals("")||idField.getText().equals("")) + { + error.setText(err); + } + else + { + error.setText(""); + id=idField.getText().trim(); + quan=Integer.parseInt(quanField.getText().trim()); + detail=descField.getText().trim(); + comp=company.getSelectedItem().toString(); + DB.addProductToDB(id, detail, comp, quan); + idField.setText(""); + quanField.setText(""); + descField.setText(""); + } + } + }); + btnAddProduct.setBounds(449, 334, 136, 23); + add(btnAddProduct); + + quanField = new JTextField(); + quanField.setColumns(10); + quanField.setBounds(449, 274, 136, 20); + add(quanField); + + JLabel lblQuantity = new JLabel("Items available"); + lblQuantity.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblQuantity.setBounds(246, 273, 124, 21); + add(lblQuantity); + + company = new JComboBox(); + company.setBounds(449, 243, 136, 20); + add(company); + + error = new JLabel(""); + error.setForeground(Color.RED); + error.setBounds(339, 92, 265, 14); + add(error); + company.addItem("General"); + company.addItem("Mats & Rugs"); + company.addItem("N/S & Electric"); + + } +} diff --git a/projects/Billing-System-master/src/deleteCashier.java b/projects/Billing-System-master/src/deleteCashier.java new file mode 100644 index 0000000..836e274 --- /dev/null +++ b/projects/Billing-System-master/src/deleteCashier.java @@ -0,0 +1,79 @@ +import java.awt.Font; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.JPasswordField; +import java.awt.Color; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class deleteCashier extends JPanel { + + JTextField userField; + JButton btnDeleteCashier; + private JPasswordField passwordField; + private JLabel error; + String user,pass,err="Enter username and password"; + /** + * Create the panel. + */ + public deleteCashier() { + setLayout(null); + setBounds(100, 100, 840, 619); + JLabel lblDeleteCashier = new JLabel("DELETE CASHIER"); + lblDeleteCashier.setBounds(328, 45, 182, 21); + lblDeleteCashier.setFont(new Font("Tahoma", Font.PLAIN, 17)); + add(lblDeleteCashier); + + JLabel lblUserName = new JLabel("User name"); + lblUserName.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblUserName.setBounds(246, 104, 124, 21); + add(lblUserName); + + JLabel lblPassword = new JLabel("Password"); + lblPassword.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblPassword.setBounds(246, 136, 124, 21); + add(lblPassword); + + userField = new JTextField(); + userField.setBounds(449, 106, 136, 20); + add(userField); + userField.setColumns(10); + + btnDeleteCashier = new JButton("Delete Cashier"); + btnDeleteCashier.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + user=userField.getText().trim(); + pass=passwordField.getText().trim().toLowerCase(); + if(user.equals("")||pass.equals("")) + error.setText(err); + else + { + error.setText(""); + DB.deleteCashier(user,pass); + userField.setText(""); + passwordField.setText(""); + } + } + }); + btnDeleteCashier.setBounds(449, 194, 136, 23); + add(btnDeleteCashier); + + passwordField = new JPasswordField(); + passwordField.setBounds(449, 138, 136, 19); + add(passwordField); + + error = new JLabel(""); + error.setForeground(Color.RED); + error.setBounds(277, 247, 248, 14); + add(error); + + } + +} diff --git a/projects/Billing-System-master/src/deleteProduct.java b/projects/Billing-System-master/src/deleteProduct.java new file mode 100644 index 0000000..f43db81 --- /dev/null +++ b/projects/Billing-System-master/src/deleteProduct.java @@ -0,0 +1,68 @@ +import java.awt.Font; + +import javax.swing.JButton; +import javax.swing.JLabel; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import java.awt.Color; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class deleteProduct extends JPanel { + + JTextField idField; + JButton btnDeleteProduct; + private JLabel error; + String id,err="Enter product id!"; + /** + * Create the panel. + */ + public deleteProduct() { + setLayout(null); + setBounds(100, 100, 840, 619); + JLabel lblUpdateProduct = new JLabel("DELETE PRODUCT"); + lblUpdateProduct.setBounds(319, 84, 182, 21); + lblUpdateProduct.setFont(new Font("Tahoma", Font.PLAIN, 17)); + add(lblUpdateProduct); + + JLabel lblProductName = new JLabel("Product ID"); + lblProductName.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblProductName.setBounds(253, 156, 124, 21); + add(lblProductName); + + idField = new JTextField(); + idField.setBounds(449, 158, 136, 20); + add(idField); + idField.setColumns(10); + + btnDeleteProduct = new JButton("Delete Product"); + btnDeleteProduct.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + if(idField.getText().equals("")) + { + error.setText(err); + } + else + { + error.setText(""); + id=idField.getText().trim(); + DB.deleteProductToDB(id); + idField.setText(""); + } + } + }); + btnDeleteProduct.setBounds(449, 219, 136, 23); + add(btnDeleteProduct); + + error = new JLabel(""); + error.setForeground(Color.RED); + error.setBounds(349, 277, 217, 14); + add(error); + + } + +} diff --git a/projects/Billing-System-master/src/generateInvoice.java b/projects/Billing-System-master/src/generateInvoice.java new file mode 100644 index 0000000..fe09fe0 --- /dev/null +++ b/projects/Billing-System-master/src/generateInvoice.java @@ -0,0 +1,108 @@ + + +import java.awt.BorderLayout; +import java.awt.EventQueue; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JMenuBar; +import java.awt.Toolkit; + +public class generateInvoice extends JFrame implements ActionListener{ + + private JPanel contentPane; + int jp; + ArrayList panels=new ArrayList(); + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + generateInvoice frame = new generateInvoice(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public generateInvoice() { + setIconImage(Toolkit.getDefaultToolkit().getImage("F:\\Working Directory\\fianl project with sql\\Bill\\logo.png")); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 850,600); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu = new JMenu("File"); + menuBar.add(mnNewMenu); + + JMenuItem mntmGenerateInvoice = new JMenuItem("Generate Invoice"); + mnNewMenu.add(mntmGenerateInvoice); + mntmGenerateInvoice.addActionListener(this); + + JMenuItem mntmSearch = new JMenuItem("Search Product"); + mnNewMenu.add(mntmSearch); + mntmSearch.addActionListener(this); + + JMenuItem mntmLogout = new JMenuItem("Logout"); + mnNewMenu.add(mntmLogout); + mntmLogout.addActionListener(this); + + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + contentPane.setLayout(new BorderLayout(0, 0)); + searchProduct sp=new searchProduct(); + + panels.add(new Invoice()); + panels.add(new searchProduct()); + getContentPane().add(panels.get(0)); + jp=0; + this.setTitle("Generate Invoice"); + } + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if(e.getActionCommand().equals("Search Product")) + { + this.remove(panels.get(jp)); + this.revalidate(); + this.repaint(); + getContentPane().add(panels.get(1)); + jp=1; + this.setVisible(true); + this.setTitle("Search Product"); + + } + else if(e.getActionCommand().equals("Generate Invoice")) + { + this.remove(panels.get(jp)); + this.revalidate(); + this.repaint(); + getContentPane().add(panels.get(0)); + this.setVisible(true); + jp=0; + this.setTitle("Generate Invoice"); + } + + else if(e.getActionCommand().equals("Logout")) + { + this.dispose(); + } + } +} diff --git a/projects/Billing-System-master/src/pdfGenerator.java b/projects/Billing-System-master/src/pdfGenerator.java new file mode 100644 index 0000000..71c1c36 --- /dev/null +++ b/projects/Billing-System-master/src/pdfGenerator.java @@ -0,0 +1,169 @@ +import java.awt.Desktop; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.MalformedURLException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + + +import com.itextpdf.text.Document; +import com.itextpdf.text.DocumentException; +import com.itextpdf.text.Element; +import com.itextpdf.text.Font; +import com.itextpdf.text.Image; +import com.itextpdf.text.Paragraph; +import com.itextpdf.text.Phrase; +import com.itextpdf.text.Rectangle; +import com.itextpdf.text.pdf.ColumnText; +import com.itextpdf.text.pdf.PdfContentByte; +import com.itextpdf.text.pdf.PdfPCell; +import com.itextpdf.text.pdf.PdfPTable; +import com.itextpdf.text.pdf.PdfWriter; +import com.itextpdf.tool.xml.html.table.Table; + +public class pdfGenerator { + + public static void makePdf(Object[] data,long total,int inv) + { + String invoice="_invoice_.pdf"; + DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); + Date date = new Date(); + System.out.println(dateFormat.format(date)); //2016/11/16 12:08:43 + Document document = new Document(); + + PdfWriter writer; + + try { + writer = PdfWriter.getInstance(document, new FileOutputStream(invoice)); + + + document.open(); + Font f1 = new Font(Font.FontFamily.UNDEFINED, 18, Font.BOLD); + Paragraph p1= new Paragraph("CADDEY STORE",f1); + + Paragraph p2= new Paragraph("Main Market Gulberg II Lahore"); + Paragraph p3= new Paragraph("042-35712296\n\n\n"); + Paragraph p4= new Paragraph("\n\nGrand Total: "+total,f1); + Paragraph p5= new Paragraph("\nThank you for visiting us�!!\nReturn/Exchange not possible with-out bill."); + + p1.setAlignment(Element.ALIGN_CENTER); + p3.setAlignment(Element.ALIGN_CENTER); + p2.setAlignment(Element.ALIGN_CENTER); + document.add(p1); + document.add(p2); + document.add(p3); + Font f2 = new Font(Font.FontFamily.UNDEFINED, 8, Font.NORMAL); + Phrase phrase = new Phrase("Time/Date: "+dateFormat.format(date), f2); + PdfContentByte canvas = writer.getDirectContent(); + ColumnText.showTextAligned(canvas, Element.ALIGN_LEFT, phrase, 40, 740, 0); + Phrase invNo = new Phrase("Invoice No. "+inv, f2); + PdfContentByte canv = writer.getDirectContent(); + ColumnText.showTextAligned(canv, Element.ALIGN_LEFT, invNo, 510, 785, 0); + Image image; + try { + image = Image.getInstance("E:\\XAMPP\\htdocs\\logo.png"); + image.setAbsolutePosition(10f, 730f); + document.add(image); + + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + PdfPTable table = new PdfPTable(5); + float[] columnWidths = new float[] {15f, 30f, 10f, 10f,15f}; + table.setWidths(columnWidths); + table.addCell("Product ID"); + + table.addCell("Item Detail"); + table.addCell("Unit Price"); + table.addCell("Quantity"); + table.addCell("Total Price"); + for(int aw = 0; aw < data.length; aw++){ + table.addCell(data[aw]+""); + } + document.add(table); + document.add(p4); + document.add(p5); + // writer.close(); + document.close(); + sendIn2printer(invoice); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (DocumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + public static void makePdf2(Object[] data,long total) + { + String sale="_sale_.pdf"; + Document document = new Document(); + + PdfWriter writer; + + try { + writer = PdfWriter.getInstance(document, new FileOutputStream(sale)); + + + document.open(); + Font f1 = new Font(Font.FontFamily.UNDEFINED, 18, Font.BOLD); + Paragraph p1= new Paragraph("CADDEY STORE",f1); + + Paragraph p2= new Paragraph("Main Market Gulberg II Lahore"); + Paragraph p3= new Paragraph("042-35712296\n\n\n"); + Paragraph p4= new Paragraph("\n\nGrand Total: "+total,f1); + + p1.setAlignment(Element.ALIGN_CENTER); + p3.setAlignment(Element.ALIGN_CENTER); + p2.setAlignment(Element.ALIGN_CENTER); + document.add(p1); + document.add(p2); + document.add(p3); + + PdfPTable table = new PdfPTable(4); + table.addCell("Date"); + table.addCell("Product ID"); + table.addCell("Company"); + table.addCell("Sale"); + for(int aw = 0; aw < data.length; aw++){ + table.addCell(data[aw]+""); + } + document.add(table); + document.add(p4); + + // writer.close(); + document.close(); + sendIn2printer(sale); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (DocumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static void sendIn2printer(String file) + { //The desktop api can help calling other applications in our machine + //and also many other features... + Desktop desktop = Desktop.getDesktop(); + try { + //desktop.print(new File("DocXfile.docx")); + desktop.print(new File(file)); + } catch (IOException e) { + e.printStackTrace(); + }} + public static void main(String[] args) { + // TODO Auto-generated method stub + + } + +} diff --git a/projects/Billing-System-master/src/searchCashier.java b/projects/Billing-System-master/src/searchCashier.java new file mode 100644 index 0000000..04a65e0 --- /dev/null +++ b/projects/Billing-System-master/src/searchCashier.java @@ -0,0 +1,68 @@ +import java.awt.Font; + +import javax.swing.JButton; +import javax.swing.JLabel; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import java.awt.Color; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class searchCashier extends JPanel { + + JTextField idField; + JButton btnUpdateProduct; + private JLabel error; + String id,err="Enter product id!"; + /** + * Create the panel. + */ + public searchCashier() { + setLayout(null); + setBounds(100, 100, 840, 619); + JLabel lblsearch = new JLabel("SEARCH CASHIER"); + lblsearch.setBounds(319, 84, 182, 21); + lblsearch.setFont(new Font("Tahoma", Font.PLAIN, 17)); + add(lblsearch); + + JLabel lbluser = new JLabel("User name"); + lbluser.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lbluser.setBounds(253, 156, 124, 21); + add(lbluser); + + idField = new JTextField(); + idField.setBounds(449, 158, 136, 20); + add(idField); + idField.setColumns(10); + + btnUpdateProduct = new JButton("Search"); + btnUpdateProduct.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + if(idField.getText().equals("")) + { + error.setText(err); + } + else + { + error.setText(""); + id=idField.getText().trim(); + DB.searchCashier(id); + idField.setText(""); + } + } + }); + btnUpdateProduct.setBounds(449, 219, 136, 23); + add(btnUpdateProduct); + + error = new JLabel(""); + error.setForeground(Color.RED); + error.setBounds(349, 277, 217, 14); + add(error); + + } + +} diff --git a/projects/Billing-System-master/src/searchProduct.java b/projects/Billing-System-master/src/searchProduct.java new file mode 100644 index 0000000..fd788ab --- /dev/null +++ b/projects/Billing-System-master/src/searchProduct.java @@ -0,0 +1,68 @@ +import java.awt.Font; + +import javax.swing.JButton; +import javax.swing.JLabel; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import java.awt.Color; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class searchProduct extends JPanel { + + JTextField idField; + JButton btnSearch; + private JLabel error; + String id,err="Enter product id!"; + /** + * Create the panel. + */ + public searchProduct() { + setLayout(null); + setBounds(100, 100, 840, 619); + JLabel lblSearchProduct = new JLabel("SEARCH PRODUCT"); + lblSearchProduct.setBounds(319, 84, 182, 21); + lblSearchProduct.setFont(new Font("Tahoma", Font.PLAIN, 17)); + add(lblSearchProduct); + + JLabel lblProductName = new JLabel("Product ID"); + lblProductName.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblProductName.setBounds(253, 156, 124, 21); + add(lblProductName); + + idField = new JTextField(); + idField.setBounds(449, 158, 136, 20); + add(idField); + idField.setColumns(10); + + btnSearch = new JButton("Search"); + btnSearch.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + if(idField.getText().equals("")) + { + error.setText(err); + } + else + { + error.setText(""); + id=idField.getText().trim(); + DB.searchProduct(id); + idField.setText(""); + } + } + }); + btnSearch.setBounds(449, 219, 136, 23); + add(btnSearch); + + error = new JLabel(""); + error.setForeground(Color.RED); + error.setBounds(349, 277, 217, 14); + add(error); + + } + +} diff --git a/projects/Billing-System-master/src/showStock.java b/projects/Billing-System-master/src/showStock.java new file mode 100644 index 0000000..f238d84 --- /dev/null +++ b/projects/Billing-System-master/src/showStock.java @@ -0,0 +1,131 @@ +import java.awt.Font; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; +import javax.swing.JPasswordField; +import javax.swing.JTable; +import javax.swing.JComboBox; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; +import java.awt.Color; + +public class showStock extends JPanel { + private JTable stockTable; + JComboBox comp; + DefaultTableModel model; + /** + * Create the panel. + */ + public showStock() { + setLayout(null); + setBounds(100, 100, 840, 619); + JLabel lblStock = new JLabel("AVAILABLE STOCK"); + lblStock.setBounds(328, 26, 182, 21); + lblStock.setFont(new Font("Tahoma", Font.PLAIN, 17)); + add(lblStock); + + model = new DefaultTableModel(); + stockTable = new JTable(model); + stockTable.setBounds(98, 112, 645, 397); + add(stockTable); + model.addColumn("Product ID"); + model.addColumn("Product Detail"); + model.addColumn("Company"); + model.addColumn("Quantity"); + JScrollPane scroll = new JScrollPane(stockTable); + scroll.setBounds(98, 112, 645, 397); + add(scroll); + + comp = new JComboBox(); + comp.setBackground(Color.WHITE); + comp.setBounds(583, 81, 160, 20); + add(comp); + comp.addItem("All"); + comp.addItem("General"); + comp.addItem("Mats & Rugs"); + comp.addItem("N/S & Electric"); + comp.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent arg0) { + // TODO Auto-generated method stub + updateTable(); + } + }); + + JLabel lblCompany = new JLabel("Company"); + lblCompany.setBounds(582, 68, 161, 14); + add(lblCompany); + + JButton btnExportToExcel = new JButton("Export to Excel"); + btnExportToExcel.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + toExcel(stockTable, new File("availableStock.xls")); + JOptionPane.showMessageDialog(null, "Export file created"); + } + }); + btnExportToExcel.setBounds(605, 525, 138, 23); + add(btnExportToExcel); + + JButton btnRefresh = new JButton("Refresh"); + btnRefresh.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + updateTable(); + } + }); + btnRefresh.setBounds(457, 525, 138, 23); + add(btnRefresh); + updateTable(); + + } + + public void updateTable() + { + model.setRowCount(0); + ArrayList stock=new ArrayList(); + stock=DB.showStock(comp.getSelectedItem().toString()); + for(int x=0;x company; + private JTextField quanField; + JLabel error ; + String id,detail,comp; + int quan; + String err="Enter product id and quantity"; + /** + * Create the panel. + */ + public updateProduct() { + setLayout(null); + setBounds(100, 100, 840, 619); + JLabel lblUpdateProduct = new JLabel("UPDATE PRODUCT"); + lblUpdateProduct.setBounds(328, 45, 182, 21); + lblUpdateProduct.setFont(new Font("Tahoma", Font.PLAIN, 17)); + add(lblUpdateProduct); + + JLabel lblProductName = new JLabel("Product ID"); + lblProductName.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblProductName.setBounds(246, 136, 124, 21); + add(lblProductName); + + JLabel lblProductDescription = new JLabel("Product detail\r\n"); + lblProductDescription.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblProductDescription.setBounds(246, 168, 139, 21); + add(lblProductDescription); + + idField = new JTextField(); + idField.setBounds(449, 137, 136, 20); + add(idField); + idField.setColumns(10); + + descField = new JTextArea(); + descField.setBounds(449, 168, 136, 58); + add(descField); + JScrollPane scroll = new JScrollPane(descField); + scroll.setBounds(449, 168, 136, 58); + add(scroll); + + JLabel lblCompany = new JLabel("Company"); + lblCompany.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblCompany.setBounds(246, 241, 124, 21); + add(lblCompany); + idField.addKeyListener(new KeyListener() { + + @Override + public void keyTyped(KeyEvent e) { + // TODO Auto-generated method stub + id=idField.getText().trim()+e.getKeyChar(); + ArrayList data=DB.searchP(id); + if(data.size()==3) + { + descField.setText(data.get(0)); + quanField.setText(data.get(2)); + switch(data.get(1)) + { + case "General":company.setSelectedIndex(0);break; + case "Mats & Rugs":company.setSelectedIndex(1);break; + case "N/S & Electric":company.setSelectedIndex(2);break; + } + } + } + + @Override + public void keyReleased(KeyEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void keyPressed(KeyEvent arg0) { + // TODO Auto-generated method stub + + } + }); + btnUpdateProduct = new JButton("Update Product"); + btnUpdateProduct.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + if(quanField.getText().equals("")||idField.getText().equals("")) + { + error.setText(err); + } + else + { + error.setText(""); + id=idField.getText().trim(); + quan=Integer.parseInt(quanField.getText().trim()); + detail=descField.getText().trim(); + comp=company.getSelectedItem().toString(); + DB.updateProductToDB(id, detail, comp, quan); + idField.setText(""); + quanField.setText(""); + descField.setText(""); + } + } + }); + btnUpdateProduct.setBounds(449, 338, 136, 23); + add(btnUpdateProduct); + + quanField = new JTextField(); + quanField.setColumns(10); + quanField.setBounds(449, 278, 136, 20); + add(quanField); + + JLabel lblQuantity = new JLabel("Items available"); + lblQuantity.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblQuantity.setBounds(246, 276, 124, 21); + add(lblQuantity); + + company = new JComboBox(); + company.setBounds(449, 243, 136, 20); + add(company); + + error = new JLabel(""); + error.setForeground(Color.RED); + error.setBounds(299, 95, 286, 14); + add(error); + company.addItem("General"); + company.addItem("Mats & Rugs"); + company.addItem("N/S & Electric"); + + } + +} diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/Cricket.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/Cricket.txt new file mode 100644 index 0000000..e69de29 diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/Cricket1.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/Cricket1.txt new file mode 100644 index 0000000..e69de29 diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/dfg.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/dfg.txt new file mode 100644 index 0000000..e69de29 diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/dg.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/dg.txt new file mode 100644 index 0000000..e69de29 diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/filelist.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/filelist.txt new file mode 100644 index 0000000..6f560b6 --- /dev/null +++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/filelist.txt @@ -0,0 +1,10 @@ +dfg +dg +x +we1 +raj +rajendra +nepal +nepal12 +Cricket +Cricket1 diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/nepal.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/nepal.txt new file mode 100644 index 0000000..e69de29 diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/nepal12.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/nepal12.txt new file mode 100644 index 0000000..e69de29 diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/raj.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/raj.txt new file mode 100644 index 0000000..e69de29 diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/rajendra.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/rajendra.txt new file mode 100644 index 0000000..e69de29 diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/we1.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/we1.txt new file mode 100644 index 0000000..e69de29 diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/x.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/x.txt new file mode 100644 index 0000000..e69de29 diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/bin/Debug/scoresheet.exe b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/bin/Debug/scoresheet.exe new file mode 100644 index 0000000..1ca4b70 Binary files /dev/null and b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/bin/Debug/scoresheet.exe differ diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/declaration.h b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/declaration.h new file mode 100644 index 0000000..c2457ed --- /dev/null +++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/declaration.h @@ -0,0 +1,91 @@ +//Header Files used in the program// +#include +#include +#include +#include +#include +#include +#include + + +FILE *fnew; +HANDLE rHnd, wHnd; +//int current,extrarunsA,extrarunsB,bowlingcurrent,wicketnumber,teamAtotalruns=0,teamBtotalruns=0,teamAtotalovers=0,teamBtotalovers=0; +char input; + +//List of functions used// +int initializeconsolehandles();//for initializing handles// +void file();//for file IO// +void locate(int,int);//for locating the cursor position// +void tab1(); //for updating the game records// +void tab2();//for how out input// +void tab3();//for new bowler input// +void tab4();//for new batsbaninput// +void tab5();//for end of innings// +void date();//for storing todays date// +/*void timestart();//for timestart input// +void timestop();//for timestop input//*/ + +//data structures used in the program// +struct team//for the record of batting team// +{ + char timein[9]; + char timeout[9]; + char batsmanname[50]; + int _4s; + int _6s; + int ballsfaced; + char timeplayed[9]; + char howout[20]; + char fielder[30]; + char bowler[30]; + int totalruns; + int mtsplayed; +} teamA[11],teamB[11]; + +struct bowlingteam//for the record of bowling team// +{ + char bowler[30]; + int ballthrownincurrentover; + int overs; + int maidens; + int runs; + int wickets; + int noballs; + int wides; + float average; +} bowlingteamA[8],bowlingteamB[8]; + +struct gamedetails//for the records of game details// +{ + char competition[20]; + char playedAt[50]; + char venue[30]; + char matchbetween[30]; + char versus[30]; + char tosswonby[30]; + char electedto[20]; + int inningsof; + char date[30]; + char input; + int overs; +} gamedetailA,gamedetailB; + +struct wickets +{ + int atruns; + int overnumber; +} wicketsA[8],wicketsB[8]; + + +struct undo +{ + struct team teamArecord[11]; + struct team teamBrecord[11]; + struct bowlingteam bowlingteamArecord[8]; + struct bowlingteam bowlingteamBrecord[8]; + struct wickets wicketsArecord[8]; + struct wickets wicketsBrecord[8]; +} steps[10]; + + diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/filing.h b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/filing.h new file mode 100644 index 0000000..dec4a0d --- /dev/null +++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/filing.h @@ -0,0 +1,63 @@ +void filing() +{ +// system("cls"); +// locate(20,8); +// FILE *newfile,*filelist; +// char filename[20]; +// char extension[]=".dat"; +// char filenamewithdirectory[]="Files//"; +// char filenamecheck[20]; +// char filenamecheckvar; +// int i=0,flag=1; +// filelist=fopen("Files//filelist.txt","a+"); +// if(filelist==NULL) +// { +// printf(" File Listing Error..."); +// exit(1); +// } +// while(flag==1) +// { +// if (flag==1) +// { +// printf("\nPlease enter the new file name:"); +// scanf(" %[^\n]",filename); +// i=0; +// } +// rewind(filelist); +// while(filenamecheckvar!=EOF) +// { +// filenamecheckvar=fgetc(filelist); +// filenamecheck[i]=filenamecheckvar; +// if(filenamecheckvar=='\n') +// { +// filenamecheck[i]='\0'; +// i=-1; +// if(strcmp(filenamecheck,filename)==0) +// { +// printf("Filename already exists.Please give new filename:"); +// flag=1; +// break; +// } +// } +// i++; +// flag=0; +// } +// } +// fseek(filelist,0,SEEK_END); +// fprintf(filelist,"%s",filename); +// fprintf(filelist,"\n"); +// fclose(filelist); +// strcat(filename,extension); +// strcat(filenamewithdirectory,filename); +// strcpy(file,filenamewithdirectory); +// newfile=fopen(filenamewithdirectory,"w"); +// if(newfile==NULL) +// { +// printf("File opening Error..."); +// exit(1); +// } +// printf("Creating file...\n"); +// Sleep(3000); +// printf("File Created."); +// Sleep(1000); + } diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/final.h b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/final.h new file mode 100644 index 0000000..e1b472a --- /dev/null +++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/final.h @@ -0,0 +1,589 @@ +#include +#include +#include +#include +#include +#include +#include +HANDLE rHnd, wHnd; +int initializeconsolehandles(); +void locate(int,int); +void print(); +void initialize(); +int runsinoneover[50],runsinprevover=0,flagg=0; +int position=1,undoupdatevariable=0,newbatsmancounter[11],newbatsmanincrement=0,current,extrarunsA,extrarunsB,bowlingcurrent,wicketnumber,teamAtotalruns=0,teamBtotalruns=0,teamAtotalovers=0,teamBtotalovers=0; + + +void final()//Function to give the input// +{ + int a,key; + char b; + char lastinput; + input='0'; + while(input!=27)//to end the input loop// + { + printt(); + while(1) + { + locate(0,33); + printf("Enter runs made |1|2|3|4|5|6|"); + locate(30,33); + // locate(40,33); + fflush(stdin); + if ((input=getche()) == -32)//for arrow key switching// + input = getche(); + + fflush(stdin); + if(input==75||input==77) + { + printf("\b "); + if(input==75); + //tab5(); + else + tab2(); + } + else if(input=='\b') + { + printf(" "); + continue; + } + else if (input == '\r')//processes the input only when pressed enter// + { + input=toupper(lastinput); + // undoupdate();//excluded in the output// + tab1(); + break; + } + else if (input=='0'||input=='1'||input=='2'||input=='3'||input=='4'||input=='6'||toupper(input)=='W'||toupper(input)=='N') + lastinput = input; + else if(input==27) + { + printf("\b "); + break; + } + else + printf("\a\b "); + continue; + } + } + +} + + +void tab1() +{ + int calledfromwide=0,T; + char a; + +start: + if(input=='0') + { + if(calledfromwide==1) + { + teamA[current].totalruns=0; + extrarunsA+=0; + } + else + { + teamA[current].ballsfaced++; + bowlingteamA[bowlingcurrent].ballthrownincurrentover++; + if(bowlingteamA[bowlingcurrent].ballthrownincurrentover==6) + { + bowlingteamA[bowlingcurrent].overs++; + bowlingteamA[bowlingcurrent].ballthrownincurrentover=0; + ovatglance(bowlingteamA[bowlingcurrent].overs,teamA[current].totalruns); + } + } + } + if(input=='1') + { + if(calledfromwide==1) + { + bowlingteamA[bowlingcurrent].runs+=1; + teamA[current].totalruns++; + extrarunsA+=1; + } + else + { + bowlingteamA[bowlingcurrent].runs+=1; + teamA[current].totalruns+=1; + teamA[current].ballsfaced++; + bowlingteamA[bowlingcurrent].ballthrownincurrentover++; + if(bowlingteamA[bowlingcurrent].ballthrownincurrentover==6) + { + bowlingteamA[bowlingcurrent].overs++; + bowlingteamA[bowlingcurrent].ballthrownincurrentover=0; + ovatglance(bowlingteamA[bowlingcurrent].overs,teamA[current].totalruns); + } + } + } + if(input=='2') + { + if(calledfromwide==1) + { + bowlingteamA[bowlingcurrent].runs+=2; + teamA[current].totalruns+=2; + extrarunsA+=2; + } + else + { + bowlingteamA[bowlingcurrent].runs+=2; + teamA[current].totalruns+=2; + teamA[current].ballsfaced++; + bowlingteamA[bowlingcurrent].ballthrownincurrentover++; + if(bowlingteamA[bowlingcurrent].ballthrownincurrentover==6) + { + bowlingteamA[bowlingcurrent].overs++; + bowlingteamA[bowlingcurrent].ballthrownincurrentover=0; + ovatglance(bowlingteamA[bowlingcurrent].overs,teamA[current].totalruns); + } + } + } + if(input=='3') + { + if(calledfromwide==1) + { + bowlingteamA[bowlingcurrent].runs+=3; + teamA[current].totalruns+=3; + extrarunsA+=3; + } + else + { + bowlingteamA[bowlingcurrent].runs+=3; + teamA[current].totalruns+=3; + teamA[current].ballsfaced++; + bowlingteamA[bowlingcurrent].ballthrownincurrentover++; + if(bowlingteamA[bowlingcurrent].ballthrownincurrentover==6) + { + bowlingteamA[bowlingcurrent].overs++; + bowlingteamA[bowlingcurrent].ballthrownincurrentover=0; + ovatglance(bowlingteamA[bowlingcurrent].overs,teamA[current].totalruns); + } + } + } + if(input=='4') + { + if(calledfromwide==1) + { + bowlingteamA[bowlingcurrent].runs+=4; + teamA[current].totalruns+=4; + extrarunsA+=4; + teamA[current]._4s++; + } + else + { + bowlingteamA[bowlingcurrent].runs+=4; + teamA[current].totalruns+=4; + teamA[current].ballsfaced++; + teamA[current]._4s++; + bowlingteamA[bowlingcurrent].ballthrownincurrentover++; + if(bowlingteamA[bowlingcurrent].ballthrownincurrentover==6) + { + bowlingteamA[bowlingcurrent].overs++; + bowlingteamA[bowlingcurrent].ballthrownincurrentover=0; + ovatglance(bowlingteamA[bowlingcurrent].overs,teamA[current].totalruns); + } + } + } + if(input=='6') + { + if(calledfromwide==1) + { + bowlingteamA[bowlingcurrent].runs+=6; + teamA[current].totalruns+=6; + extrarunsA+=6; + teamA[current]._6s++; + } + else + { + bowlingteamA[bowlingcurrent].runs+=6; + teamA[current].totalruns+=6; + teamA[current].ballsfaced++; + teamA[current]._6s++; + bowlingteamA[bowlingcurrent].ballthrownincurrentover++; + if(bowlingteamA[bowlingcurrent].ballthrownincurrentover==6) + { + bowlingteamA[bowlingcurrent].overs++; + bowlingteamA[bowlingcurrent].ballthrownincurrentover=0; + ovatglance(bowlingteamA[bowlingcurrent].overs,teamA[current].totalruns); + } + } + } + if(input=='N')//for noballs + { + bowlingteamA[bowlingcurrent].runs+=1; + bowlingteamA[bowlingcurrent].noballs++; + teamA[current].totalruns++; + calledfromwide=1; + locate(0,34); + printf("Enter the runs made:0/1/2/3/4/6"); + T=0; + while(T==0) + { + scanf(" %c",&input); + if(input=='0'||input=='1'||input=='2'||input=='3'||input=='4'||input=='5'||input=='6') + { + T=1; + goto start; + } + else + { + T=0; + printf("Invalid Input.Input:0/1/2/3/4/6"); + } + } + } + if(input=='W')//for noballs + { + bowlingteamA[bowlingcurrent].runs+=1; + bowlingteamA[bowlingcurrent].wides++; + teamA[current].totalruns++; + calledfromwide=1; + locate(0,34); + printf("Enter the runs made:0/1/2/3/4/6:"); + T=0; + while(T==0) + { + scanf(" %c",&input); + if(input=='0'||input=='1'||input=='2'||input=='3'||input=='4'||input=='5'||input=='6') + { + T=1; + goto start; + } + else + { + T=0; + locate(0,34); + printf("Invalid Input.Input:0/1/2/3/4/6 :"); + } + } + } + + float overs=bowlingteamA[bowlingcurrent].overs+((bowlingteamA[bowlingcurrent].ballthrownincurrentover)/6.); + // if(overs==0&&bowlingteamA[bowlingcurrent].ballthrownincurrentover==0) + // bowlingteamA[bowlingcurrent].average=0; + // else + bowlingteamA[bowlingcurrent].average= + bowlingteamA[bowlingcurrent].runs/overs; + calledfromwide=0; + +} + +void tab2() +{ + int a; + + while(1) + { + locate(28,34); + printf("How out?"); + locate(28,35); + printf("Fielding='F'"); + locate(28,36); + printf("Catch-Out='C'"); + locate(28,37); + printf("Wicket='W'"); + locate(28,33); + char temp; + + fflush(stdin); + if ((input = getche()) == -32) + input = getche(); + fflush(stdin); + if(input==75||input==77) + { + printf("\b "); + locate(28,34); + printf(" "); + locate(28,35); + printf(" "); + locate(28,36); + printf(" "); + locate(28,37); + printf(" "); + locate(28,33); + if(input==77) + { + tab3(); + //return ; + } + else if(input==75) + { + fflush(stdin); + return; + + } + } + else if(input=='\b') + { + printf(" "); + continue; + } + else if (input == '\r') + { + input=toupper(temp); + break; + } + + else if(input=='F'||input=='C'||input=='W'||input=='f'||input=='c'||input=='w') + { + temp=input; + continue; + } + else + { + printf("\a\b\b \b"); + } + } + locate(28,34); + printf(" "); + locate(28,35); + printf(" "); + locate(28,36); + printf(" "); + locate(28,37); + printf(" "); + input=toupper(input); + if(toupper(input)=='W') + { + strcpy(teamA[current].howout,"Wicket"); + wicketnumber++; + wicketsA[wicketnumber].atruns = teamAtotalruns; + wicketsA[wicketnumber].overnumber = teamAtotalovers+1; + locate(28,34); + printf("Enter the fielder's name:"); + gets(teamA[current].fielder); + locate(28,34); + printf(" "); + tab4(); + } + if(toupper(input)=='C') + { + strcpy(teamA[current].howout,"Catchout"); + wicketnumber++; + wicketsA[wicketnumber].atruns = teamAtotalruns; + wicketsA[wicketnumber].overnumber = teamAtotalovers+1; + locate(28,34); + printf("Enter the fielder's name:"); + gets(teamA[current].fielder); + locate(28,34); + printf(" "); + tab4(); + } + if(toupper(input)=='F') + { + strcpy(teamA[current].howout,"Fielding"); + wicketnumber++; + tab1(input); + wicketsA[wicketnumber].atruns = teamAtotalruns; + wicketsA[wicketnumber].overnumber = teamAtotalovers+1; + locate(28,34); + printf("Enter the fielder's name:"); + gets(teamA[current].fielder); + locate(28,34); + printf(" "); + tab4(); + } +} + +void tab3() +{ + while(1) + { + + char temp; + fflush(stdin); + locate(37,34); + printf("Select the bowler no."); + fflush(stdin); + locate(37,33); + if ((input=getche()) ==-32) + input = getche(); + fflush(stdin); + if(input==75||input==77) + { + printf("\b "); + locate(37,34); + printf(" "); + if(input==75) + //tab2(); + return; + if (input==77) + tab4(); + } + else if(input=='\b') + { + printf(" "); + continue; + } + else if (input == '\r') + { + input=temp; + break; + } + else if(input=='1'||input=='2'||input=='3'||input=='4'||input=='5'||input=='6'||input=='7'||input=='8') + { + temp=input; + continue; + } + else + { + printf("\a\b\b \b"); + } + } + bowlingcurrent = input-49; + locate(37,33); + printf(" "); + locate(37,34); + printf(" "); + return; +} + +void tab4() +{ + int currentinput = -1,number = 0; + fflush(stdin); + + while (1){ + locate(52,34); + printf("Select the new "); + locate(52,35); + printf("batsman no.from "); + locate(52,36); + printf("above list."); + if (currentinput == -1) locate(52,33) ; else locate (53,33); + if ((input=getch()) == -32) + input = getch(); + fflush(stdin); + + if(input==75||input==77) + { + printf("\b\b "); + locate(52,34); + printf(" "); + locate(52,35); + printf(" "); + locate(52,36); + printf(" "); + if(input==75) + //tab3(); + return; + if (input==77) + { + tab5(); + //return; + } + } + else if(input >= '0' && input <='9' && number !=1) + + { + if (currentinput == -1) + { + printf ("%c",input); + currentinput= input - '0'; + currentinput *= 10; + } + else{ + if ((currentinput <10) || ( (input =='0' || input == '1') && currentinput>9)) + {printf ("%c",input); + currentinput += input - '0'; + number = 1; //Two numbers entered + }} + } + + + else if (input == '\b') + { + if (number ==1 )printf ("\b \b\b"); else printf ("\b \b"); + currentinput = -1; + number = 0; + } + else if (input == '\r') + {current=currentinput -1; + //printf("%d",current); + fflush(stdin); + + } + } +} +void tab5() +{ + while(1) + { + + char ch; + fflush(stdin); + locate(68,34); + printf("Do you want "); + locate(68,35); + printf("to end the "); + locate(68,36); + printf("inning?"); + locate(68,33); + if ((input=getch()) == -32) + input = getch(); + ch=input; + fflush(stdin); + if(input==75||input==77) + { + printf("\b "); + locate(68,34); + printf(" "); + locate(68,35); + printf(" "); + locate(68,36); + printf(" "); + if(input==75) + //tab4(); + return; + if (input==77) + { + fflush(stdin); + //tab1(); + //return; + } + } + if(toupper(input)=='Y') + { + locate(68,34); + printf(" "); + locate(68,35); + printf(" "); + locate(68,36); + printf(" "); + return; + } + else + printf("\a\b "); + } + fflush(stdin); + return; +} + +int initializeconsolehandles() +{ + rHnd = GetStdHandle(STD_INPUT_HANDLE); + wHnd = GetStdHandle(STD_OUTPUT_HANDLE); + if (rHnd && wHnd) + return TRUE; + else + return FALSE; +} + +void locate(int x, int y) +{ + COORD pos = {x,y}; + SetConsoleCursorPosition (wHnd,pos); + +} + +int ovatglance(int overs,int runs) +{ + + int i=1; + runsinoneover[overs]=runs-runsinprevover; + runsinprevover=runs; + if(runsinoneover[overs]==0) + bowlingteamA[bowlingcurrent].maidens++; + return; +} diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/main.c b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/main.c new file mode 100644 index 0000000..8bd409c --- /dev/null +++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/main.c @@ -0,0 +1,36 @@ +#include"declaration.h" +#include"welcome.h" +#include"menu.h" +#include"newscoresheet.h" +#include"filing.h" +#include"final.h" +int main() +{ + system("color f1"); + int a,key; + char b,ch; + FILE *fnew; + + char lastinput; + while (TRUE) + { + initializeconsolehandles(); + welcome(); + system("cls"); + menu(); + locate(32,9); + ch=getch(); + switch(ch) + { + case '1': + fileopen(ch); + case '2': + fileopen(ch); + getch(); + case '3': + system ("cls"); + exit(0); + } + } +} + diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/menu.h b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/menu.h new file mode 100644 index 0000000..f46f7dc --- /dev/null +++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/menu.h @@ -0,0 +1,9 @@ +void menu() +{ + printf("\n\n\t\t\t\t\tMENU:\n"); + printf("\n\n\n\t\t\t\t1.New scoresheet:\n"); + printf("\t\t\t\t2.View scoresheet:\n"); + printf("\t\t\t\t3.Exit:\n\t\t"); +} + + diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/newscoresheet.h b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/newscoresheet.h new file mode 100644 index 0000000..4898f2e --- /dev/null +++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/newscoresheet.h @@ -0,0 +1,546 @@ +void date();//to store todays date// +void printt();//for printing the output// +void filewrite();//for writing to the file// +void fileread();//for accessing from the file// +void fileopen(char); +void limitinput(int); +int limitedinput(int); +FILE *newfile,*filelist; +char filenamewithdirectory[50];//to pass the filename with its directory location// +char output[100]; +void newscoresheet() +{ + system("color f4"); + int j,ln,number; + char text[50],ch; + system("cls"); + locate(20,8); + char filename[20],array[100]; + char extension[]=".txt"; + char filenamewithdirectory[]="Files//"; + char filenamecheck[20]; + char filenamecheckvar; + int i=0,flag=1,n=15; + system("cls"); + initializeconsolehandles(); + printt(); + flag=0; + while(1) + { + if(flag==0) + { + fflush(stdin); + locate(13,0); + fflush(stdin); + limitinput(n); + strcpy(gamedetailA.competition,output); + flag=1; + n=20; + } + if (flag==1) + { + locate(42,0); + limitinput(n); + strcpy(gamedetailA.venue,output); + fflush(stdin); + flag=2; + n=10; + } + if(flag==2) + { + locate(15,2); + limitinput(n); + strcpy(gamedetailA.matchbetween,output); + fflush(stdin); + flag=3; + n=10; + } + if(flag==3) + { + locate(44,2); + limitinput(n); + strcpy(gamedetailA.versus,output); + fflush(stdin); + flag=4; + n=10; + } + if(flag==4) + { + locate(13,4); + limitinput(n); + strcpy(gamedetailA.tosswonby,output); + fflush(stdin); + flag=5; + n=7; + } + if(flag==5) + { + locate(47,4); + limitinput(n); + strcpy(gamedetailA.electedto,output); + fflush(stdin); + flag=6; + n=3; + } + if(flag==6) + { + locate(11,6); + number=limitedinput(n); + gamedetailA.inningsof=number; + fflush(stdin); + flag=7; + n=10; + } + if(flag==7) + { + locate(53,6); + printf(" T to enter today's date"); + locate(43,6); + limitinput(n); + if(output[0]=='t'||output[0]=='T') + { + date(); + locate(43,6); + printf(" %s ",gamedetailA.date); + } + else + { + strcpy(gamedetailA.date,output); + locate(43,6); + if(strlen(gamedetailA.date)<2) + printf(" "); + else + printf(" %s ",gamedetailA.date); + + } + fflush(stdin); + flag=8; + n=15; + } + if(flag==8) + { + locate(12,10); + for (i=0; i<11; i++) + { + limitinput(n); + strcpy(teamA[i].batsmanname,output); + locate(12,11+i); + } + flag=9; + } + if(flag==9) + { + locate(12,24); + for (i=0; i<8; i++) + { + limitinput(n); + strcpy(teamA[i].bowler,output); + locate(12,25+i); + } + flag=80; + } + if (flag==80) + { + locate(36,33); + skip: + printf("Enter e to edit or c to continue"); + ch=getch(); + if(ch=='e'||ch=='E') + { + flag=0; + locate(36,33); + printf(" "); + + } + else if(ch=='c'||ch=='C') + { + locate(36,33); + printf(" "); + locate(14,20); + final(); + filewrite(); + } + else + { + locate(36,33); + printf(" "); + flag=80; + } + } + } +} +void printt() +{ + + int j,l,i; + locate(0,0); + printf("%ccompetition:%s",179,gamedetailA.competition); + locate(35,0); + printf("%cVenue:%s",179,gamedetailA.venue); + locate(0,1); + for(i=0; i<79; i++) + printf("%c",205); + locate(0,2); + printf("%cMatch Between:%s",179,gamedetailA.matchbetween); + locate(35,2); + printf("%cVersus:%s",179,gamedetailA.versus); + locate(0,3); + for(i=0; i<79; i++) + printf("%c",205); + locate(0,4); + printf("%cToss won by:%s",179,gamedetailA.tosswonby); + locate(35,4); + printf("%cElected To:%s",179,gamedetailA.electedto); + locate(0,5); + for(i=0; i<79; i++) + printf("%c",205); + locate(35,0); + for (i=0; i<33; i++) + { + locate(34,i); + printf("%c",182); + } + locate(0,6); + printf("%cInning Of:%d",179,gamedetailA.inningsof); + locate(35,6); + printf("%cDate:%s",179,gamedetailA.date); + locate(0,7); + for(i=0; i<79; i++) + printf("%c",205); + locate(0,21); + for(i=0; i<79; i++) + printf("%c",205); + locate(0,9); + for(i=0; i<79; i++) + printf("%c",205); + locate(5,8); + printf("Batsmanname"); + locate(0,10); + for(i=0; i<11; i++) + printf("%cBatsman %d:%s\n",179,i+1,teamA[i].batsmanname); + locate(36,8); + printf("%cTotoal runs",179); + for(i=0; i<11; i++) + { + locate(40,9+(i+1)); + printf("%d\n",teamA[i].totalruns); + } + + locate(5,22); + printf("Bowlers"); + locate(0,23); + for (i=0; i<79; i++) + printf("%c",205); + for(i=0; i<8; i++) + { + locate(0,23+(i+1)); + printf("%cBowler %d:%s\n",179,i+1,teamA[i].bowler); + } + + locate(35,22); + printf("overs"); + locate(42,22); + printf("Maidens"); + locate(50,22); + printf("Economy"); + locate(58,22); + printf("No balls"); + locate(68,22); + printf("BTICO"); + locate(75,22); + printf("Runs"); + locate(62,8); + printf("_4s"); + locate(72,8); + printf("_6s"); + locate(0,32); + for (i=0; i<79; i++) + printf("%c",205); + locate(61,10); + for(i=0; i<11; i++) + { + printf("%c",179); + locate(61,10+(i+1)); + } + locate(63,9); + for(i=0;i<11;i++) + { + locate(63,9+(i+1)); + printf("%d",teamA[i]._4s); + } + locate(73,9); + for(i=0;i<11;i++) + { + locate(73,9+(i+1)); + printf("%d",teamA[i]._6s); + } + locate(71,10); + for(i=0; i<11; i++) + { + printf("%c",179); + locate(71,10+(i+1)); + } + locate(49,10); + for(i=0; i<11; i++) + { + printf("%c",179); + locate(49,10+(i+1)); + } + locate(38,23); + for(i=0; i<8; i++) + { + locate(38,23+(i+1)); + printf("%d\n",bowlingteamA[i].overs); + } + locate(47,23); + for(i=0; i<8; i++) + { + locate(47,23+(i+1)); + printf("%d\n",bowlingteamA[i].maidens); + } + locate(55,23); + for(i=0; i<8; i++) + { + locate(55,23+(i+1)); + printf("%.2f\n",bowlingteamA[i].average); + } + locate(62,23); + for(i=0; i<8; i++) + { + locate(62,23+(i+1)); + printf("%d\n",bowlingteamA[i].noballs); + } + locate(70,23); + for(i=0; i<8; i++) + { + locate(70,23+(i+1)); + printf("%d\n",bowlingteamA[i].ballthrownincurrentover); + } + locate(78,23); + for(i=0; i<8; i++) + { + locate(78,23+(i+1)); + printf("%d\n",bowlingteamA[i].runs); + } + locate(0,40); + for(i=0;i<79;i++) + { + printf("%c",205); + } + return; + + +} +void filewrite() +{ + fwrite(&gamedetailA,sizeof(gamedetailA),1,newfile); + fwrite(&teamA,sizeof(teamA),11,newfile); + fwrite(&bowlingteamA,sizeof(bowlingteamA),8,newfile); + +} + +void fileopen(char ch1) +{ + int j,ln; + char text[50],ch; + system("cls"); + locate(20,8); + char filename[20],array[50]; + char extension[]=".txt"; + char filenamewithdirectory[]="Files//"; + char filenamecheck[20]; + char filenamecheckvar; + int i=0,flag=1,n=15; + if(ch1=='1') + { + filelist=fopen("Files//filelist.txt","a+"); + if(filelist==NULL) + { + printf(" File Listing Error..."); + exit(1); + } + while(flag==1) + { + if (flag==1) + { + printf("\nPlease enter the new file name:"); + scanf(" %[^\n]",filename); + i=0; + } + rewind(filelist); + while(filenamecheckvar!=EOF) + { + filenamecheckvar=fgetc(filelist); + filenamecheck[i]=filenamecheckvar; + if(filenamecheckvar=='\n') + { + filenamecheck[i]='\0'; + i=-1; + if(strcmp(filenamecheck,filename)==0) + { + printf("Filename already exists.Please give new filename:"); + flag=1; + break; + } + } + i++; + flag=0; + } + } + fseek(filelist,0,SEEK_END); + fprintf(filelist,"%s",filename); + fprintf(filelist,"\n"); + fclose(filelist); + strcat(filename,extension); + strcat(filenamewithdirectory,filename); + newfile=fopen(filenamewithdirectory,"w"); + if(newfile==NULL) + printf("Error..."); + printf("Creating file...\n"); + Sleep(3000); + printf("File Created."); + Sleep(1000); + newscoresheet(); + } + if(ch1=='2') + { + printf("Enter the name of the existing file to open"); + scanf(" %[^\n]",filename); + strcat(filename,extension); + strcat(filenamewithdirectory,filename); + newfile=fopen(filenamewithdirectory,"r"); + if(newfile==NULL) + { + system("cls"); + printf("Error...no such existing file"); + exit(0); + } + system("cls"); + fread(&gamedetailA,sizeof(gamedetailA),1,newfile); + fread(&teamA,sizeof(teamA),11,newfile); + fread(&bowlingteamA,sizeof(bowlingteamA),8,newfile); + printt(); + getch(); + system("cls"); + main(); + } + +} + +void date ( ) +{ + time_t now; + struct tm *tm_now; + char buff[BUFSIZ]; + now = time ( NULL ); + tm_now = localtime ( &now ); + strftime ( buff, sizeof buff, "%a %d %m %Y", tm_now ); + strcpy(gamedetailA.date,buff); + +} +void limitinput(int n) +{ + int i,j; + char array[100]; + for(i=0;; i++) + { + if(i>=n) + array[i]=getch(); + else + array[i]=getche(); + if(array[i]=='\b') + { + if(i>(n-1)) + printf("\b \b"); + else + printf(" \b"); + if(i>=n) + i=n-1-1; + else + { + for(j=1;; j++) + { + if(i==n-j) + { + if(i==0) + i=-1; + else + i=n-(j+1)-1; + break; + } + } + } + } + if(array[i]=='\r') + break; + } + int number=0; + for(i=0; i!=n; i++) + { + if(array[i]=='\r') + { + output[i]='\0'; + break; + } + output[i]=array[i]; + } +} +int limitedinput(int n) +{ + int a,i,j,array[100]; +start: +locate(11,6); + for(i=0;; i++) + { + if(i>=n) + array[i]=getch(); + else + array[i]=getche(); + if(array[i]=='\b') + { + if(i>(n-1)) + printf("\b \b"); + else + printf(" \b"); + if(i>=n) + i=n-1-1; + else + { + for(j=1;; j++) + { + if(i==n-j) + { + if(i==0) + i=-1; + else + i=n-(j+1)-1; + break; + } + } + } + } + if(array[i]=='\r') + break; + } + int number=0; + for(i=0; i!=n; i++) + { + if(array[i]=='\r') + break; + if(isdigit(array[i])!=0) + { + (int) array[i]; + number=number*10+(array[i]-48); + } + else + { + locate(15,6); + printf(" Invalid input."); + goto start; + } + } + locate(15,6); + printf(" "); + return number; +} + diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/obj/Debug/main.o b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/obj/Debug/main.o new file mode 100644 index 0000000..e87c9b6 Binary files /dev/null and b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/obj/Debug/main.o differ diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.cbp b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.cbp new file mode 100644 index 0000000..e557ddb --- /dev/null +++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.cbp @@ -0,0 +1,47 @@ + + + + + + diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.depend b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.depend new file mode 100644 index 0000000..a6bda98 --- /dev/null +++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.depend @@ -0,0 +1,205 @@ +# depslib dependency file v1.0 +1302519416 source:g:\scoresheet\main.c + "declaration.h" + "welcome.h" + "menu.h" + "newscoresheet.h" + "filing.h" + "final.h" + +1302508884 g:\scoresheet\declaration.h + + + + + + + + +1302508152 g:\scoresheet\welcome.h + +1302509138 g:\scoresheet\menu.h + +1302509142 g:\scoresheet\newscoresheet.h + +1302339826 g:\scoresheet\filing.h + +1302508790 g:\scoresheet\final.h + + + + + + + + +1302519416 source:f:\scoresheet\main.c + "declaration.h" + "welcome.h" + "menu.h" + "newscoresheet.h" + "filing.h" + "final.h" + +1302508884 f:\scoresheet\declaration.h + + + + + + + + +1302508152 f:\scoresheet\welcome.h + +1302509138 f:\scoresheet\menu.h + +1302509142 f:\scoresheet\newscoresheet.h + +1302339826 f:\scoresheet\filing.h + +1302508790 f:\scoresheet\final.h + + + + + + + + +1302519416 source:e:\5th semester\projects\c projects\scoresheet\main.c + "declaration.h" + "welcome.h" + "menu.h" + "newscoresheet.h" + "filing.h" + "final.h" + +1302508884 e:\5th semester\projects\c projects\scoresheet\declaration.h + + + + + + + + +1302508152 e:\5th semester\projects\c projects\scoresheet\welcome.h + +1302509138 e:\5th semester\projects\c projects\scoresheet\menu.h + +1302509142 e:\5th semester\projects\c projects\scoresheet\newscoresheet.h + +1302339826 e:\5th semester\projects\c projects\scoresheet\filing.h + +1302508790 e:\5th semester\projects\c projects\scoresheet\final.h + + + + + + + + +1302469916 source:j:\c projects\scoresheet\main.c + "declaration.h" + "welcome.h" + "menu.h" + "newscoresheet.h" + "filing.h" + "final.h" + +1302459384 j:\c projects\scoresheet\declaration.h + + + + + + + + +1302458652 j:\c projects\scoresheet\welcome.h + +1302459638 j:\c projects\scoresheet\menu.h + +1302459642 j:\c projects\scoresheet\newscoresheet.h + +1302290326 j:\c projects\scoresheet\filing.h + +1302459290 j:\c projects\scoresheet\final.h + + + + + + + + +1302469916 source:e:\comproj\c projects\scoresheet\main.c + "declaration.h" + "welcome.h" + "menu.h" + "newscoresheet.h" + "filing.h" + "final.h" + +1400144673 e:\comproj\c projects\scoresheet\declaration.h + + + + + + + + +1400144673 e:\comproj\c projects\scoresheet\welcome.h + +1302459638 e:\comproj\c projects\scoresheet\menu.h + +1400144673 e:\comproj\c projects\scoresheet\newscoresheet.h + +1302290326 e:\comproj\c projects\scoresheet\filing.h + +1302459290 e:\comproj\c projects\scoresheet\final.h + + + + + + + + +1302469916 source:c:\users\rajjjj\desktop\scoresheet\main.c + "declaration.h" + "welcome.h" + "menu.h" + "newscoresheet.h" + "filing.h" + "final.h" + +1400144673 c:\users\rajjjj\desktop\scoresheet\declaration.h + + + + + + + + +1400144673 c:\users\rajjjj\desktop\scoresheet\welcome.h + +1302459638 c:\users\rajjjj\desktop\scoresheet\menu.h + +1400144673 c:\users\rajjjj\desktop\scoresheet\newscoresheet.h + +1302290326 c:\users\rajjjj\desktop\scoresheet\filing.h + +1302459290 c:\users\rajjjj\desktop\scoresheet\final.h + + + + + + + + diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.exe b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.exe new file mode 100644 index 0000000..1ca4b70 Binary files /dev/null and b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.exe differ diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.layout b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.layout new file mode 100644 index 0000000..a79741a --- /dev/null +++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.layout @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/welcome.h b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/welcome.h new file mode 100644 index 0000000..6edcae9 --- /dev/null +++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/welcome.h @@ -0,0 +1,51 @@ +void welcome() +{ + system("color f1"); + int i,y; + locate(26,5); + printf(" _ _ _ _ _ _ _ _ _ _ _ _ _ _ "); + locate(27,7); + printf("*****************************"); + locate(27,9); + printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c" + ,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3); + locate(27,11); + printf(" %c%c%c!!! YOU ARE WELCOME !!!%c%c%c",2,2,2,2,2,2); + locate(39,13); + printf("TO"); + locate(27,15); + printf(" %c%c%c%c Cricket score sheet %c%c%c%c",3,3,3,3,3,3,3,3); + locate(27,17); + printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%" + ,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3); + locate(27,19); + printf("*****************************"); + locate(27,21); + printf("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _"); + Sleep(250); + locate(27,23); + printf(" @Copy righted to:-"); + Sleep(250); + locate(27,25); + SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN | FOREGROUND_INTENSITY | FOREGROUND_BLUE ); + SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN | FOREGROUND_INTENSITY | FOREGROUND_BLUE ); + locate(27,29); + printf("\tcodewitc.c",16); + + for(y=35;y<=58;y++) + { + { + + locate(27,y); + Sleep(400); + } + } + printf("\n"); + +system("color ff"); + } + + + + + diff --git a/projects/Cricket Score Sheet Project in C/Readme.docx b/projects/Cricket Score Sheet Project in C/Readme.docx new file mode 100644 index 0000000..cf11c06 Binary files /dev/null and b/projects/Cricket Score Sheet Project in C/Readme.docx differ diff --git a/projects/Currency Converter Java Project/.gitignore b/projects/Currency Converter Java Project/.gitignore new file mode 100644 index 0000000..d3bae3d --- /dev/null +++ b/projects/Currency Converter Java Project/.gitignore @@ -0,0 +1,3 @@ +/build/ +/dist/ +/nbproject/private/ \ No newline at end of file diff --git a/projects/Currency Converter Java Project/Currency Converter/README b/projects/Currency Converter Java Project/Currency Converter/README new file mode 100644 index 0000000..d0ff720 --- /dev/null +++ b/projects/Currency Converter Java Project/Currency Converter/README @@ -0,0 +1,2 @@ +This is a currency exchange web application developed with ajax,jsp and servlets. +The third version of the converter converts currencies instantly as you type. diff --git a/projects/Currency Converter Java Project/Currency Converter/build.xml b/projects/Currency Converter Java Project/Currency Converter/build.xml new file mode 100644 index 0000000..ab36ef1 --- /dev/null +++ b/projects/Currency Converter Java Project/Currency Converter/build.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + Builds, tests, and runs the project CurrencyExchangeV3. + + + diff --git a/projects/Currency Converter Java Project/Currency Converter/nbproject/ant-deploy.xml b/projects/Currency Converter Java Project/Currency Converter/nbproject/ant-deploy.xml new file mode 100644 index 0000000..cbfe67c --- /dev/null +++ b/projects/Currency Converter Java Project/Currency Converter/nbproject/ant-deploy.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/Currency Converter Java Project/Currency Converter/nbproject/build-impl.xml b/projects/Currency Converter Java Project/Currency Converter/nbproject/build-impl.xml new file mode 100644 index 0000000..65c0f33 --- /dev/null +++ b/projects/Currency Converter Java Project/Currency Converter/nbproject/build-impl.xml @@ -0,0 +1,1071 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set build.web.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.war + + + + + + + + + +The Java EE server classpath is not correctly set up - server home directory is missing. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Dj2ee.server.home=<app_server_installation_directory> + + +The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) +or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + Must select a file in the IDE or set jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. + + + Launching ${browse.url} + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/Currency Converter Java Project/Currency Converter/nbproject/genfiles.properties b/projects/Currency Converter Java Project/Currency Converter/nbproject/genfiles.properties new file mode 100644 index 0000000..6d6a539 --- /dev/null +++ b/projects/Currency Converter Java Project/Currency Converter/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=1286d75a +build.xml.script.CRC32=ec3d8777 +build.xml.stylesheet.CRC32=651128d4@1.33.1.1 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=1286d75a +nbproject/build-impl.xml.script.CRC32=33e33eba +nbproject/build-impl.xml.stylesheet.CRC32=0cbf5bb7@1.33.1.1 diff --git a/projects/Currency Converter Java Project/Currency Converter/nbproject/project.properties b/projects/Currency Converter Java Project/Currency Converter/nbproject/project.properties new file mode 100644 index 0000000..9b3dd1b --- /dev/null +++ b/projects/Currency Converter Java Project/Currency Converter/nbproject/project.properties @@ -0,0 +1,81 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.web.dir}/WEB-INF/classes +build.classes.excludes=**/*.java,**/*.form +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +build.web.dir=${build.dir}/web +build.web.excludes=${build.classes.excludes} +client.urlPart= +compile.jsps=false +conf.dir=${source.root}/conf +debug.classpath=${build.classes.dir}:${javac.classpath} +debug.test.classpath=\ + ${run.test.classpath} +display.browser=true +dist.dir=dist +dist.ear.war=${dist.dir}/${war.ear.name} +dist.javadoc.dir=${dist.dir}/javadoc +dist.war=${dist.dir}/${war.name} +endorsed.classpath=\ + ${libs.javaee-endorsed-api-6.0.classpath} +excludes= +file.reference.gson-2.0_1.jar=build/web/WEB-INF/lib/gson-2.0_1.jar +includes=** +j2ee.compile.on.save=true +j2ee.deploy.on.save=true +j2ee.platform=1.6-web +j2ee.platform.classpath=${j2ee.server.home}/lib/jstl-api-1.2.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/ecj-3.7.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/jstl-impl-1.2.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/annotations-api.jar +j2ee.server.type=Tomcat +jar.compress=false +javac.classpath=\ + ${file.reference.gson-2.0_1.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.debug=true +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.6 +javac.target=1.6 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +lib.dir=${web.docbase.dir}/WEB-INF/lib +persistence.xml.dir=${conf.dir} +platform.active=default_platform +resource.dir=setup +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +# Space-separated list of JVM arguments used when running a class with a main method or a unit test +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.encoding=UTF-8 +source.root=src +src.dir=${source.root}/java +test.src.dir=test +war.content.additional= +war.ear.name=CurrencyExchangeV3.war +war.name=CurrencyExchangeV3.war +web.docbase.dir=web +webinf.dir=web/WEB-INF diff --git a/projects/Currency Converter Java Project/Currency Converter/nbproject/project.xml b/projects/Currency Converter Java Project/Currency Converter/nbproject/project.xml new file mode 100644 index 0000000..d75be13 --- /dev/null +++ b/projects/Currency Converter Java Project/Currency Converter/nbproject/project.xml @@ -0,0 +1,23 @@ + + + org.netbeans.modules.web.project + + + CurrencyExchangeV3 + 1.6.5 + + + ${file.reference.gson-2.0_1.jar} + WEB-INF/lib + + + + + + + + + + + + diff --git a/projects/Currency Converter Java Project/Currency Converter/src/conf/MANIFEST.MF b/projects/Currency Converter Java Project/Currency Converter/src/conf/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/projects/Currency Converter Java Project/Currency Converter/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/projects/Currency Converter Java Project/Currency Converter/src/java/com/exchange/Convert.java b/projects/Currency Converter Java Project/Currency Converter/src/java/com/exchange/Convert.java new file mode 100644 index 0000000..d6435a1 --- /dev/null +++ b/projects/Currency Converter Java Project/Currency Converter/src/java/com/exchange/Convert.java @@ -0,0 +1,143 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.exchange; + +import java.io.*; +import java.net.*; +import java.util.*; +import javax.servlet.*; +import javax.servlet.http.*; +import java.io.InputStream; +import java.net.*; +import com.google.gson.*; + + +/** + * + * @author pakallis + */ +class Recv +{ + private String lhs; + private String rhs; + private String error; + private String icc; + public Recv() + { + + } + public String getLhs() + { + return lhs; + } + public String getRhs() + { + return rhs; + } +} +public class Convert extends HttpServlet { + + /** + * Processes requests for both HTTP GET and POST methods. + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest req, HttpServletResponse resp) + throws ServletException, IOException { + String query = ""; + String amount = ""; + String curTo = ""; + String curFrom = ""; + String submit = ""; + String res = ""; + HttpSession session; + resp.setContentType("text/html;charset=UTF-8"); + PrintWriter out = resp.getWriter(); + + + /*Read request parameters*/ + amount = req.getParameter("amount"); + curTo = req.getParameter("to"); + curFrom = req.getParameter("from"); + + + + /*Open a connection to google and read the result*/ + try { + + query = "http://www.google.com/ig/calculator?hl=en&q=" + amount + curFrom + "=?" + curTo; + URL url = new URL(query); + InputStreamReader stream = new InputStreamReader(url.openStream()); + BufferedReader in = new BufferedReader(stream); + String str = ""; + String temp = ""; + + while ((temp = in.readLine()) != null) { + str = str + temp; + } + + + /*Parse the result which is in json format*/ + Gson gson = new Gson(); + Recv st = gson.fromJson(str, Recv.class); + String rhs = st.getRhs(); + rhs = rhs.replaceAll("�", ""); + + /*we do the check in order to print the additional word(millions,billions etc)*/ + StringTokenizer strto = new StringTokenizer(rhs); + String nextToken; + out.write(strto.nextToken()); + nextToken = strto.nextToken(); + if( nextToken.equals("million") || nextToken.equals("billion") || nextToken.equals("trillion")) + { + out.println(" "+nextToken); + } + + + } catch (NumberFormatException e) { + out.println("The given amount is not a valid number"); + } + + + } + + // + /** + * Handles the HTTP GET method. + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP POST method. + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// +} diff --git a/projects/Currency Converter Java Project/Currency Converter/src/java/com/exchange/HTTPXMLTest.java b/projects/Currency Converter Java Project/Currency Converter/src/java/com/exchange/HTTPXMLTest.java new file mode 100644 index 0000000..ceed5c5 --- /dev/null +++ b/projects/Currency Converter Java Project/Currency Converter/src/java/com/exchange/HTTPXMLTest.java @@ -0,0 +1,59 @@ +package com.exchange; +import java.io.*; +import java.net.URL; +import java.net.URLConnection; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; + +public class HTTPXMLTest +{ + /* public static void main(String[] args) + { + try { + new HTTPXMLTest().start(); + } catch (Exception e) { + e.printStackTrace(); + } + }*/ + String currency[]; + void start() throws Exception + { + URL url = new URL("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"); + URLConnection connection = url.openConnection(); + + Document doc = parseXML(connection.getInputStream()); + NodeList descNodes = doc.getElementsByTagName("Cube"); + for(int i=0; i + diff --git a/projects/Currency Converter Java Project/Currency Converter/web/WEB-INF/web.xml b/projects/Currency Converter Java Project/Currency Converter/web/WEB-INF/web.xml new file mode 100644 index 0000000..abc61f4 --- /dev/null +++ b/projects/Currency Converter Java Project/Currency Converter/web/WEB-INF/web.xml @@ -0,0 +1,16 @@ + + + + Convert + com.exchange.Convert + + + Convert + /Convert + + + + 30 + + + diff --git a/projects/Currency Converter Java Project/Currency Converter/web/css/style.css b/projects/Currency Converter Java Project/Currency Converter/web/css/style.css new file mode 100644 index 0000000..907cc85 --- /dev/null +++ b/projects/Currency Converter Java Project/Currency Converter/web/css/style.css @@ -0,0 +1,17 @@ +/* + Document : style + Created on : Dec 17, 2011, 4:53:06 PM + Author : pakallis + Description: + Purpose of the stylesheet follows. +*/ + +/* + TODO customize this sample style + Syntax recommendation http://www.w3.org/TR/REC-CSS2/ +*/ + +body { + text-align: center; +} + diff --git a/projects/Currency Converter Java Project/Currency Converter/web/index.jsp b/projects/Currency Converter Java Project/Currency Converter/web/index.jsp new file mode 100644 index 0000000..e8e1ca1 --- /dev/null +++ b/projects/Currency Converter Java Project/Currency Converter/web/index.jsp @@ -0,0 +1,187 @@ +<%-- + Document : index + Created on : Dec 15, 2011, 9:56:40 PM + Author : pakallis +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + + + + Currency Exchange Converter + + +

Currency Exchange Converter

+
+ + + + = + + +
+ +
+
+ + diff --git a/projects/Currency Converter Java Project/Currency Converter/web/js/ajax.js b/projects/Currency Converter Java Project/Currency Converter/web/js/ajax.js new file mode 100644 index 0000000..d872058 --- /dev/null +++ b/projects/Currency Converter Java Project/Currency Converter/web/js/ajax.js @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + + +var req; +var where; +function convert(from,to,amount) { + + var url = "/CurrencyExchangeV3/Convert?from="+from+"&to="+to+"&amount="+amount.value; + where = amount; + if (typeof XMLHttpRequest != "undefined") { + req = new XMLHttpRequest(); + } else if (window.ActiveXObject) { + req = new ActiveXObject("Microsoft.XMLHTTP"); + } + req.open("GET", url, true); + req.onreadystatechange = callback; + req.send(null); +} + +function callback() { + if (req.readyState == 4) { + if (req.status == 200) { + if(where != document.getElementById("amount1")) + { + document.getElementById("amount1").value = req.responseText; + } + else + { + document.getElementById("amount2").value = req.responseText; + } + + } + } +} \ No newline at end of file diff --git a/projects/Currency Converter Java Project/Currency Converter/web/js/swap.js b/projects/Currency Converter Java Project/Currency Converter/web/js/swap.js new file mode 100644 index 0000000..ccda419 --- /dev/null +++ b/projects/Currency Converter Java Project/Currency Converter/web/js/swap.js @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + + +function swapElem(from,to) +{ + var temp; + temp = from.value; + from.value = to.value; + to.value = temp; + + temp = document.getElementById("amount1").value; + document.getElementById("amount1").value = document.getElementById("amount2").value; + document.getElementById("amount2").value = temp; +} diff --git a/projects/Currency Converter Java Project/Currency Converter/web/js/validate.js b/projects/Currency Converter Java Project/Currency Converter/web/js/validate.js new file mode 100644 index 0000000..aed31cd --- /dev/null +++ b/projects/Currency Converter Java Project/Currency Converter/web/js/validate.js @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +function validate(input) +{ + if(isNaN(input.value)) + { + return false; + } + convert(document.getElementById('currency2').value,document.getElementById('currency1').value,document.getElementById('amount2').value); + return true; +} diff --git a/projects/Currency Converter Java Project/Readme.docx b/projects/Currency Converter Java Project/Readme.docx new file mode 100644 index 0000000..cf11c06 Binary files /dev/null and b/projects/Currency Converter Java Project/Readme.docx differ diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.css b/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.css new file mode 100644 index 0000000..a14751c --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.css @@ -0,0 +1,9 @@ +.node { + font: 10px sans-serif; +} + +.link { + stroke: steelblue; + stroke-opacity: .4; + fill: none; +} diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.html b/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.html new file mode 100644 index 0000000..923421a --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.html @@ -0,0 +1,15 @@ + + + + + Hierarchical Edge Bundling (Radial Tree) + + + + + + +
+ + + diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.js b/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.js new file mode 100644 index 0000000..94b1ea3 --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.js @@ -0,0 +1,72 @@ +var radius = 960 / 2, + splines = []; + +var cluster = d3.layout.cluster() + .size([360, radius - 120]) + .sort(null) + .value(function(d) { return d.size; }); + +var bundle = d3.layout.bundle(); + +var line = d3.svg.line.radial() + .interpolate("bundle") + .tension(.85) + .radius(function(d) { return d.y; }) + .angle(function(d) { return d.x / 180 * Math.PI; }); + +var vis = d3.select("#chart").append("svg") + .attr("width", radius * 2) + .attr("height", radius * 2) + .append("g") + .attr("transform", "translate(" + radius + "," + radius + ")"); + +d3.json("flare-imports.json", function(classes) { + var raw_nodes = packages.root(classes); +var nodes = cluster.nodes(raw_nodes), + links = packages.imports(nodes); +}); + +d3.json("IntlNodes.json", function(pairs) { + var raw_nodes = preprocess.nodes(pairs); + + var nodes = cluster.nodes(raw_nodes); + + var links = preprocess.links(nodes[0]); + + vis.selectAll("path.link") + .data(splines = bundle(links)) + .enter().append("path") + .attr("class", "link") + .attr("d", line); + +}); + +/* OLD VERSION + d3.json("flare-imports.json", function(classes) { + var nodes = cluster.nodes(packages.root(classes)), + links = packages.imports(nodes); + + vis.selectAll("path.link") + .data(splines = bundle(links)) + .enter().append("path") + .attr("class", "link") + .attr("d", line); + + vis.selectAll("g.node") + .data(nodes.filter(function(n) { return !n.children; })) + .enter().append("g") + .attr("class", "node") + .attr("transform", function(d) { return "rotate(" + (d.x - 90) + ")translate(" + d.y + ")"; }) + .append("text") + .attr("dx", function(d) { return d.x < 180 ? 8 : -8; }) + .attr("dy", ".31em") + .attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; }) + .attr("transform", function(d) { return d.x < 180 ? null : "rotate(180)"; }) + .text(function(d) { return d.key; }); +});*/ + +d3.select(window).on("mousemove", function() { + vis.selectAll("path.link") + .data(splines) + .attr("d", line.tension(Math.min(1, d3.event.clientX / 960))); +}); diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/flare-imports.json b/projects/Data Visualization Software Java Project/Data Visualization/Examples/flare-imports.json new file mode 100644 index 0000000..7b3997f --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/flare-imports.json @@ -0,0 +1,222 @@ +[ +{"name":"flare.analytics.cluster.AgglomerativeCluster","size":3938,"imports":["flare.animate.Transitioner","flare.vis.data.DataList","flare.util.math.IMatrix","flare.analytics.cluster.MergeEdge","flare.analytics.cluster.HierarchicalCluster","flare.vis.data.Data"]}, +{"name":"flare.analytics.cluster.CommunityStructure","size":3812,"imports":["flare.analytics.cluster.HierarchicalCluster","flare.animate.Transitioner","flare.vis.data.DataList","flare.analytics.cluster.MergeEdge","flare.util.math.IMatrix"]}, +{"name":"flare.analytics.cluster.HierarchicalCluster","size":6714,"imports":["flare.vis.data.EdgeSprite","flare.vis.data.NodeSprite","flare.vis.data.DataList","flare.vis.data.Tree","flare.util.Arrays","flare.analytics.cluster.MergeEdge","flare.util.Sort","flare.vis.operator.Operator","flare.util.Property","flare.vis.data.Data"]}, +{"name":"flare.analytics.cluster.MergeEdge","size":743,"imports":[]}, +{"name":"flare.analytics.graph.BetweennessCentrality","size":3534,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.data.DataList","flare.util.Arrays","flare.vis.data.Data","flare.util.Property","flare.vis.operator.Operator"]}, +{"name":"flare.analytics.graph.LinkDistance","size":5731,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.data.EdgeSprite","flare.analytics.graph.ShortestPaths","flare.vis.data.Data","flare.util.Property","flare.vis.operator.Operator"]}, +{"name":"flare.analytics.graph.MaxFlowMinCut","size":7840,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.data.EdgeSprite","flare.vis.data.Data","flare.util.Property","flare.vis.operator.Operator"]}, +{"name":"flare.analytics.graph.ShortestPaths","size":5914,"imports":["flare.vis.data.EdgeSprite","flare.vis.data.NodeSprite","flare.animate.Transitioner","flare.vis.operator.Operator","flare.util.heap.HeapNode","flare.util.heap.FibonacciHeap","flare.util.Property","flare.vis.data.Data"]}, +{"name":"flare.analytics.graph.SpanningTree","size":3416,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.operator.IOperator","flare.vis.Visualization","flare.vis.data.TreeBuilder","flare.vis.operator.Operator"]}, +{"name":"flare.analytics.optimization.AspectRatioBanker","size":7074,"imports":["flare.animate.Transitioner","flare.util.Arrays","flare.vis.data.DataSprite","flare.scale.Scale","flare.vis.axis.CartesianAxes","flare.vis.Visualization","flare.util.Property","flare.vis.operator.Operator"]}, +{"name":"flare.animate.Easing","size":17010,"imports":["flare.animate.Transition"]}, +{"name":"flare.animate.FunctionSequence","size":5842,"imports":["flare.util.Maths","flare.animate.Transition","flare.util.Arrays","flare.animate.Sequence","flare.animate.Transitioner"]}, +{"name":"flare.animate.interpolate.ArrayInterpolator","size":1983,"imports":["flare.util.Arrays","flare.animate.interpolate.Interpolator"]}, +{"name":"flare.animate.interpolate.ColorInterpolator","size":2047,"imports":["flare.animate.interpolate.Interpolator"]}, +{"name":"flare.animate.interpolate.DateInterpolator","size":1375,"imports":["flare.animate.interpolate.Interpolator"]}, +{"name":"flare.animate.interpolate.Interpolator","size":8746,"imports":["flare.animate.interpolate.NumberInterpolator","flare.animate.interpolate.ColorInterpolator","flare.animate.interpolate.PointInterpolator","flare.animate.interpolate.ObjectInterpolator","flare.animate.interpolate.MatrixInterpolator","flare.animate.interpolate.RectangleInterpolator","flare.animate.interpolate.DateInterpolator","flare.util.Property","flare.animate.interpolate.ArrayInterpolator"]}, +{"name":"flare.animate.interpolate.MatrixInterpolator","size":2202,"imports":["flare.animate.interpolate.Interpolator"]}, +{"name":"flare.animate.interpolate.NumberInterpolator","size":1382,"imports":["flare.animate.interpolate.Interpolator"]}, +{"name":"flare.animate.interpolate.ObjectInterpolator","size":1629,"imports":["flare.animate.interpolate.Interpolator"]}, +{"name":"flare.animate.interpolate.PointInterpolator","size":1675,"imports":["flare.animate.interpolate.Interpolator"]}, +{"name":"flare.animate.interpolate.RectangleInterpolator","size":2042,"imports":["flare.animate.interpolate.Interpolator"]}, +{"name":"flare.animate.ISchedulable","size":1041,"imports":["flare.animate.Scheduler"]}, +{"name":"flare.animate.Parallel","size":5176,"imports":["flare.animate.Easing","flare.animate.Transition","flare.util.Arrays"]}, +{"name":"flare.animate.Pause","size":449,"imports":["flare.animate.Transition"]}, +{"name":"flare.animate.Scheduler","size":5593,"imports":["flare.animate.ISchedulable","flare.animate.Pause","flare.animate.Transition"]}, +{"name":"flare.animate.Sequence","size":5534,"imports":["flare.animate.Easing","flare.util.Maths","flare.animate.Transition","flare.util.Arrays"]}, +{"name":"flare.animate.Transition","size":9201,"imports":["flare.animate.Transitioner","flare.animate.TransitionEvent","flare.animate.Scheduler","flare.animate.Pause","flare.animate.Parallel","flare.animate.Easing","flare.animate.Sequence","flare.animate.ISchedulable","flare.util.Maths","flare.animate.Tween"]}, +{"name":"flare.animate.Transitioner","size":19975,"imports":["flare.util.IValueProxy","flare.animate.Parallel","flare.animate.Easing","flare.animate.Sequence","flare.animate.Transition","flare.animate.Tween","flare.util.Property"]}, +{"name":"flare.animate.TransitionEvent","size":1116,"imports":["flare.animate.Transition"]}, +{"name":"flare.animate.Tween","size":6006,"imports":["flare.animate.Transitioner","flare.animate.Transition","flare.animate.interpolate.Interpolator","flare.util.Property"]}, +{"name":"flare.data.converters.Converters","size":721,"imports":["flare.data.converters.IDataConverter","flare.data.converters.GraphMLConverter","flare.data.converters.JSONConverter","flare.data.converters.DelimitedTextConverter"]}, +{"name":"flare.data.converters.DelimitedTextConverter","size":4294,"imports":["flare.data.DataSet","flare.data.DataUtil","flare.data.DataTable","flare.data.converters.IDataConverter","flare.data.DataSchema","flare.data.DataField"]}, +{"name":"flare.data.converters.GraphMLConverter","size":9800,"imports":["flare.data.DataSet","flare.data.DataUtil","flare.data.DataTable","flare.data.converters.IDataConverter","flare.data.DataSchema","flare.data.DataField"]}, +{"name":"flare.data.converters.IDataConverter","size":1314,"imports":["flare.data.DataSet","flare.data.DataSchema"]}, +{"name":"flare.data.converters.JSONConverter","size":2220,"imports":["flare.data.DataSet","flare.data.DataUtil","flare.data.DataTable","flare.data.converters.IDataConverter","flare.data.DataSchema","flare.data.DataField","flare.util.Property"]}, +{"name":"flare.data.DataField","size":1759,"imports":["flare.data.DataUtil"]}, +{"name":"flare.data.DataSchema","size":2165,"imports":["flare.data.DataField","flare.util.Arrays"]}, +{"name":"flare.data.DataSet","size":586,"imports":["flare.data.DataTable"]}, +{"name":"flare.data.DataSource","size":3331,"imports":["flare.data.converters.IDataConverter","flare.data.converters.Converters","flare.data.DataSchema"]}, +{"name":"flare.data.DataTable","size":772,"imports":["flare.data.DataSchema"]}, +{"name":"flare.data.DataUtil","size":3322,"imports":["flare.data.DataField","flare.data.DataSchema"]}, +{"name":"flare.display.DirtySprite","size":8833,"imports":[]}, +{"name":"flare.display.LineSprite","size":1732,"imports":["flare.display.DirtySprite"]}, +{"name":"flare.display.RectSprite","size":3623,"imports":["flare.util.Colors","flare.display.DirtySprite"]}, +{"name":"flare.display.TextSprite","size":10066,"imports":["flare.display.DirtySprite"]}, +{"name":"flare.flex.FlareVis","size":4116,"imports":["flare.display.DirtySprite","flare.data.DataSet","flare.vis.Visualization","flare.vis.axis.CartesianAxes","flare.vis.axis.Axes","flare.vis.data.Data"]}, +{"name":"flare.physics.DragForce","size":1082,"imports":["flare.physics.Simulation","flare.physics.Particle","flare.physics.IForce"]}, +{"name":"flare.physics.GravityForce","size":1336,"imports":["flare.physics.Simulation","flare.physics.Particle","flare.physics.IForce"]}, +{"name":"flare.physics.IForce","size":319,"imports":["flare.physics.Simulation"]}, +{"name":"flare.physics.NBodyForce","size":10498,"imports":["flare.physics.Simulation","flare.physics.Particle","flare.physics.IForce"]}, +{"name":"flare.physics.Particle","size":2822,"imports":[]}, +{"name":"flare.physics.Simulation","size":9983,"imports":["flare.physics.Particle","flare.physics.NBodyForce","flare.physics.DragForce","flare.physics.GravityForce","flare.physics.Spring","flare.physics.SpringForce","flare.physics.IForce"]}, +{"name":"flare.physics.Spring","size":2213,"imports":["flare.physics.Particle"]}, +{"name":"flare.physics.SpringForce","size":1681,"imports":["flare.physics.Simulation","flare.physics.Particle","flare.physics.Spring","flare.physics.IForce"]}, +{"name":"flare.query.AggregateExpression","size":1616,"imports":["flare.query.Expression"]}, +{"name":"flare.query.And","size":1027,"imports":["flare.query.CompositeExpression","flare.query.Expression"]}, +{"name":"flare.query.Arithmetic","size":3891,"imports":["flare.query.BinaryExpression","flare.query.Expression"]}, +{"name":"flare.query.Average","size":891,"imports":["flare.query.Expression","flare.query.AggregateExpression"]}, +{"name":"flare.query.BinaryExpression","size":2893,"imports":["flare.query.Expression"]}, +{"name":"flare.query.Comparison","size":5103,"imports":["flare.query.Not","flare.query.BinaryExpression","flare.query.Expression","flare.query.Or"]}, +{"name":"flare.query.CompositeExpression","size":3677,"imports":["flare.query.Expression","flare.query.If"]}, +{"name":"flare.query.Count","size":781,"imports":["flare.query.Expression","flare.query.AggregateExpression"]}, +{"name":"flare.query.DateUtil","size":4141,"imports":["flare.query.Fn"]}, +{"name":"flare.query.Distinct","size":933,"imports":["flare.query.Expression","flare.query.AggregateExpression"]}, +{"name":"flare.query.Expression","size":5130,"imports":["flare.query.Variable","flare.query.IsA","flare.query.ExpressionIterator","flare.util.IPredicate","flare.query.Literal","flare.util.IEvaluable","flare.query.If"]}, +{"name":"flare.query.ExpressionIterator","size":3617,"imports":["flare.query.Expression"]}, +{"name":"flare.query.Fn","size":3240,"imports":["flare.query.DateUtil","flare.query.CompositeExpression","flare.query.Expression","flare.query.StringUtil"]}, +{"name":"flare.query.If","size":2732,"imports":["flare.query.Expression"]}, +{"name":"flare.query.IsA","size":2039,"imports":["flare.query.Expression","flare.query.If"]}, +{"name":"flare.query.Literal","size":1214,"imports":["flare.query.Expression"]}, +{"name":"flare.query.Match","size":3748,"imports":["flare.query.BinaryExpression","flare.query.Expression","flare.query.StringUtil"]}, +{"name":"flare.query.Maximum","size":843,"imports":["flare.query.Expression","flare.query.AggregateExpression"]}, +{"name":"flare.query.methods.add","size":593,"imports":["flare.query.methods.or","flare.query.Arithmetic"]}, +{"name":"flare.query.methods.and","size":330,"imports":["flare.query.And","flare.query.methods.or"]}, +{"name":"flare.query.methods.average","size":287,"imports":["flare.query.Average","flare.query.methods.or"]}, +{"name":"flare.query.methods.count","size":277,"imports":["flare.query.Count","flare.query.methods.or"]}, +{"name":"flare.query.methods.distinct","size":292,"imports":["flare.query.Distinct","flare.query.methods.or"]}, +{"name":"flare.query.methods.div","size":595,"imports":["flare.query.methods.or","flare.query.Arithmetic"]}, +{"name":"flare.query.methods.eq","size":594,"imports":["flare.query.Comparison","flare.query.methods.or"]}, +{"name":"flare.query.methods.fn","size":460,"imports":["flare.query.methods.or","flare.query.Fn"]}, +{"name":"flare.query.methods.gt","size":603,"imports":["flare.query.Comparison","flare.query.methods.or"]}, +{"name":"flare.query.methods.gte","size":625,"imports":["flare.query.Comparison","flare.query.methods.gt","flare.query.methods.eq","flare.query.methods.or"]}, +{"name":"flare.query.methods.iff","size":748,"imports":["flare.query.methods.or","flare.query.If"]}, +{"name":"flare.query.methods.isa","size":461,"imports":["flare.query.IsA","flare.query.methods.or"]}, +{"name":"flare.query.methods.lt","size":597,"imports":["flare.query.Comparison","flare.query.methods.or"]}, +{"name":"flare.query.methods.lte","size":619,"imports":["flare.query.Comparison","flare.query.methods.lt","flare.query.methods.eq","flare.query.methods.or"]}, +{"name":"flare.query.methods.max","size":283,"imports":["flare.query.Maximum","flare.query.methods.or"]}, +{"name":"flare.query.methods.min","size":283,"imports":["flare.query.Minimum","flare.query.methods.or"]}, +{"name":"flare.query.methods.mod","size":591,"imports":["flare.query.methods.or","flare.query.Arithmetic"]}, +{"name":"flare.query.methods.mul","size":603,"imports":["flare.query.methods.lt","flare.query.methods.or","flare.query.Arithmetic"]}, +{"name":"flare.query.methods.neq","size":599,"imports":["flare.query.Comparison","flare.query.methods.eq","flare.query.methods.or"]}, +{"name":"flare.query.methods.not","size":386,"imports":["flare.query.Not","flare.query.methods.or"]}, +{"name":"flare.query.methods.or","size":323,"imports":["flare.query.Or"]}, +{"name":"flare.query.methods.orderby","size":307,"imports":["flare.query.Query","flare.query.methods.or"]}, +{"name":"flare.query.methods.range","size":772,"imports":["flare.query.methods.max","flare.query.Range","flare.query.methods.or","flare.query.methods.min"]}, +{"name":"flare.query.methods.select","size":296,"imports":["flare.query.Query"]}, +{"name":"flare.query.methods.stddev","size":363,"imports":["flare.query.methods.and","flare.query.Variance","flare.query.methods.or"]}, +{"name":"flare.query.methods.sub","size":600,"imports":["flare.query.methods.or","flare.query.Arithmetic"]}, +{"name":"flare.query.methods.sum","size":280,"imports":["flare.query.Sum","flare.query.methods.or"]}, +{"name":"flare.query.methods.update","size":307,"imports":["flare.query.Query"]}, +{"name":"flare.query.methods.variance","size":335,"imports":["flare.query.Variance","flare.query.methods.or"]}, +{"name":"flare.query.methods.where","size":299,"imports":["flare.query.Query","flare.query.methods.lt","flare.query.methods.lte"]}, +{"name":"flare.query.methods.xor","size":354,"imports":["flare.query.Xor","flare.query.methods.or"]}, +{"name":"flare.query.methods._","size":264,"imports":["flare.query.Literal","flare.query.methods.or"]}, +{"name":"flare.query.Minimum","size":843,"imports":["flare.query.Expression","flare.query.AggregateExpression"]}, +{"name":"flare.query.Not","size":1554,"imports":["flare.query.Expression"]}, +{"name":"flare.query.Or","size":970,"imports":["flare.query.CompositeExpression","flare.query.Expression"]}, +{"name":"flare.query.Query","size":13896,"imports":["flare.query.Variable","flare.query.Sum","flare.query.Expression","flare.util.Sort","flare.query.Not","flare.query.AggregateExpression","flare.query.Literal","flare.util.Filter","flare.util.Property","flare.query.If"]}, +{"name":"flare.query.Range","size":1594,"imports":["flare.query.And","flare.query.Comparison","flare.query.Expression"]}, +{"name":"flare.query.StringUtil","size":4130,"imports":["flare.query.Fn"]}, +{"name":"flare.query.Sum","size":791,"imports":["flare.query.Expression","flare.query.AggregateExpression"]}, +{"name":"flare.query.Variable","size":1124,"imports":["flare.query.Expression","flare.util.Property"]}, +{"name":"flare.query.Variance","size":1876,"imports":["flare.query.Expression","flare.query.AggregateExpression"]}, +{"name":"flare.query.Xor","size":1101,"imports":["flare.query.CompositeExpression","flare.query.Expression"]}, +{"name":"flare.scale.IScaleMap","size":2105,"imports":["flare.scale.Scale"]}, +{"name":"flare.scale.LinearScale","size":1316,"imports":["flare.util.Maths","flare.util.Strings","flare.scale.Scale","flare.scale.QuantitativeScale","flare.scale.ScaleType"]}, +{"name":"flare.scale.LogScale","size":3151,"imports":["flare.util.Maths","flare.util.Strings","flare.scale.Scale","flare.scale.QuantitativeScale","flare.scale.ScaleType"]}, +{"name":"flare.scale.OrdinalScale","size":3770,"imports":["flare.scale.ScaleType","flare.util.Arrays","flare.scale.Scale"]}, +{"name":"flare.scale.QuantileScale","size":2435,"imports":["flare.util.Maths","flare.util.Strings","flare.scale.Scale","flare.scale.ScaleType"]}, +{"name":"flare.scale.QuantitativeScale","size":4839,"imports":["flare.util.Maths","flare.util.Strings","flare.scale.Scale"]}, +{"name":"flare.scale.RootScale","size":1756,"imports":["flare.util.Maths","flare.util.Strings","flare.scale.Scale","flare.scale.QuantitativeScale","flare.scale.ScaleType"]}, +{"name":"flare.scale.Scale","size":4268,"imports":["flare.scale.ScaleType","flare.util.Strings"]}, +{"name":"flare.scale.ScaleType","size":1821,"imports":["flare.scale.Scale"]}, +{"name":"flare.scale.TimeScale","size":5833,"imports":["flare.util.Maths","flare.util.Dates","flare.scale.Scale","flare.scale.ScaleType"]}, +{"name":"flare.util.Arrays","size":8258,"imports":["flare.util.IValueProxy","flare.util.Property","flare.util.IEvaluable"]}, +{"name":"flare.util.Colors","size":10001,"imports":["flare.util.Filter"]}, +{"name":"flare.util.Dates","size":8217,"imports":["flare.util.Maths"]}, +{"name":"flare.util.Displays","size":12555,"imports":["flare.util.IValueProxy","flare.util.Filter","flare.util.Property","flare.util.IEvaluable","flare.util.Sort"]}, +{"name":"flare.util.Filter","size":2324,"imports":["flare.util.IPredicate","flare.util.Property"]}, +{"name":"flare.util.Geometry","size":10993,"imports":[]}, +{"name":"flare.util.heap.FibonacciHeap","size":9354,"imports":["flare.util.heap.HeapNode"]}, +{"name":"flare.util.heap.HeapNode","size":1233,"imports":["flare.util.heap.FibonacciHeap"]}, +{"name":"flare.util.IEvaluable","size":335,"imports":[]}, +{"name":"flare.util.IPredicate","size":383,"imports":[]}, +{"name":"flare.util.IValueProxy","size":874,"imports":[]}, +{"name":"flare.util.math.DenseMatrix","size":3165,"imports":["flare.util.math.IMatrix"]}, +{"name":"flare.util.math.IMatrix","size":2815,"imports":[]}, +{"name":"flare.util.math.SparseMatrix","size":3366,"imports":["flare.util.math.IMatrix"]}, +{"name":"flare.util.Maths","size":17705,"imports":["flare.util.Arrays"]}, +{"name":"flare.util.Orientation","size":1486,"imports":[]}, +{"name":"flare.util.palette.ColorPalette","size":6367,"imports":["flare.util.palette.Palette","flare.util.Colors"]}, +{"name":"flare.util.palette.Palette","size":1229,"imports":[]}, +{"name":"flare.util.palette.ShapePalette","size":2059,"imports":["flare.util.palette.Palette","flare.util.Shapes"]}, +{"name":"flare.util.palette.SizePalette","size":2291,"imports":["flare.util.palette.Palette"]}, +{"name":"flare.util.Property","size":5559,"imports":["flare.util.IPredicate","flare.util.IValueProxy","flare.util.IEvaluable"]}, +{"name":"flare.util.Shapes","size":19118,"imports":["flare.util.Arrays"]}, +{"name":"flare.util.Sort","size":6887,"imports":["flare.util.Arrays","flare.util.Property"]}, +{"name":"flare.util.Stats","size":6557,"imports":["flare.util.Arrays","flare.util.Property"]}, +{"name":"flare.util.Strings","size":22026,"imports":["flare.util.Dates","flare.util.Property"]}, +{"name":"flare.vis.axis.Axes","size":1302,"imports":["flare.animate.Transitioner","flare.vis.Visualization"]}, +{"name":"flare.vis.axis.Axis","size":24593,"imports":["flare.animate.Transitioner","flare.scale.LinearScale","flare.util.Arrays","flare.scale.ScaleType","flare.util.Strings","flare.display.TextSprite","flare.scale.Scale","flare.util.Stats","flare.scale.IScaleMap","flare.vis.axis.AxisLabel","flare.vis.axis.AxisGridLine"]}, +{"name":"flare.vis.axis.AxisGridLine","size":652,"imports":["flare.vis.axis.Axis","flare.display.LineSprite"]}, +{"name":"flare.vis.axis.AxisLabel","size":636,"imports":["flare.vis.axis.Axis","flare.display.TextSprite"]}, +{"name":"flare.vis.axis.CartesianAxes","size":6703,"imports":["flare.animate.Transitioner","flare.display.RectSprite","flare.vis.axis.Axis","flare.display.TextSprite","flare.vis.axis.Axes","flare.vis.Visualization","flare.vis.axis.AxisGridLine"]}, +{"name":"flare.vis.controls.AnchorControl","size":2138,"imports":["flare.vis.controls.Control","flare.vis.Visualization","flare.vis.operator.layout.Layout"]}, +{"name":"flare.vis.controls.ClickControl","size":3824,"imports":["flare.vis.events.SelectionEvent","flare.vis.controls.Control"]}, +{"name":"flare.vis.controls.Control","size":1353,"imports":["flare.vis.controls.IControl","flare.util.Filter"]}, +{"name":"flare.vis.controls.ControlList","size":4665,"imports":["flare.vis.controls.IControl","flare.util.Arrays","flare.vis.Visualization","flare.vis.controls.Control"]}, +{"name":"flare.vis.controls.DragControl","size":2649,"imports":["flare.vis.controls.Control","flare.vis.data.DataSprite"]}, +{"name":"flare.vis.controls.ExpandControl","size":2832,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.controls.Control","flare.vis.Visualization"]}, +{"name":"flare.vis.controls.HoverControl","size":4896,"imports":["flare.vis.events.SelectionEvent","flare.vis.controls.Control"]}, +{"name":"flare.vis.controls.IControl","size":763,"imports":["flare.vis.controls.Control"]}, +{"name":"flare.vis.controls.PanZoomControl","size":5222,"imports":["flare.util.Displays","flare.vis.controls.Control"]}, +{"name":"flare.vis.controls.SelectionControl","size":7862,"imports":["flare.vis.events.SelectionEvent","flare.vis.controls.Control"]}, +{"name":"flare.vis.controls.TooltipControl","size":8435,"imports":["flare.animate.Tween","flare.display.TextSprite","flare.vis.controls.Control","flare.vis.events.TooltipEvent"]}, +{"name":"flare.vis.data.Data","size":20544,"imports":["flare.vis.data.EdgeSprite","flare.vis.data.NodeSprite","flare.util.Arrays","flare.vis.data.DataSprite","flare.vis.data.Tree","flare.vis.events.DataEvent","flare.data.DataSet","flare.vis.data.TreeBuilder","flare.vis.data.DataList","flare.data.DataSchema","flare.util.Sort","flare.data.DataField","flare.util.Property"]}, +{"name":"flare.vis.data.DataList","size":19788,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.util.Arrays","flare.util.math.DenseMatrix","flare.vis.data.DataSprite","flare.vis.data.EdgeSprite","flare.vis.events.DataEvent","flare.util.Stats","flare.util.math.IMatrix","flare.util.Sort","flare.util.Filter","flare.util.Property","flare.util.IEvaluable","flare.vis.data.Data"]}, +{"name":"flare.vis.data.DataSprite","size":10349,"imports":["flare.util.Colors","flare.vis.data.Data","flare.display.DirtySprite","flare.vis.data.render.IRenderer","flare.vis.data.render.ShapeRenderer"]}, +{"name":"flare.vis.data.EdgeSprite","size":3301,"imports":["flare.vis.data.render.EdgeRenderer","flare.vis.data.DataSprite","flare.vis.data.NodeSprite","flare.vis.data.render.ArrowType","flare.vis.data.Data"]}, +{"name":"flare.vis.data.NodeSprite","size":19382,"imports":["flare.animate.Transitioner","flare.util.Arrays","flare.vis.data.DataSprite","flare.vis.data.EdgeSprite","flare.vis.data.Tree","flare.util.Sort","flare.util.Filter","flare.util.IEvaluable","flare.vis.data.Data"]}, +{"name":"flare.vis.data.render.ArrowType","size":698,"imports":[]}, +{"name":"flare.vis.data.render.EdgeRenderer","size":5569,"imports":["flare.vis.data.EdgeSprite","flare.vis.data.NodeSprite","flare.vis.data.DataSprite","flare.vis.data.render.IRenderer","flare.util.Shapes","flare.util.Geometry","flare.vis.data.render.ArrowType"]}, +{"name":"flare.vis.data.render.IRenderer","size":353,"imports":["flare.vis.data.DataSprite"]}, +{"name":"flare.vis.data.render.ShapeRenderer","size":2247,"imports":["flare.util.Shapes","flare.vis.data.render.IRenderer","flare.vis.data.DataSprite"]}, +{"name":"flare.vis.data.ScaleBinding","size":11275,"imports":["flare.scale.TimeScale","flare.scale.ScaleType","flare.scale.LinearScale","flare.scale.LogScale","flare.scale.OrdinalScale","flare.scale.RootScale","flare.scale.Scale","flare.scale.QuantileScale","flare.util.Stats","flare.scale.QuantitativeScale","flare.vis.events.DataEvent","flare.vis.data.Data"]}, +{"name":"flare.vis.data.Tree","size":7147,"imports":["flare.vis.data.EdgeSprite","flare.vis.events.DataEvent","flare.vis.data.NodeSprite","flare.vis.data.Data"]}, +{"name":"flare.vis.data.TreeBuilder","size":9930,"imports":["flare.vis.data.EdgeSprite","flare.vis.data.NodeSprite","flare.vis.data.Tree","flare.util.heap.HeapNode","flare.util.heap.FibonacciHeap","flare.util.Property","flare.util.IEvaluable","flare.vis.data.Data"]}, +{"name":"flare.vis.events.DataEvent","size":2313,"imports":["flare.vis.data.EdgeSprite","flare.vis.data.NodeSprite","flare.vis.data.DataList","flare.vis.data.DataSprite"]}, +{"name":"flare.vis.events.SelectionEvent","size":1880,"imports":["flare.vis.events.DataEvent"]}, +{"name":"flare.vis.events.TooltipEvent","size":1701,"imports":["flare.vis.data.EdgeSprite","flare.vis.data.NodeSprite"]}, +{"name":"flare.vis.events.VisualizationEvent","size":1117,"imports":["flare.animate.Transitioner"]}, +{"name":"flare.vis.legend.Legend","size":20859,"imports":["flare.animate.Transitioner","flare.vis.data.ScaleBinding","flare.util.palette.SizePalette","flare.scale.ScaleType","flare.vis.legend.LegendItem","flare.display.RectSprite","flare.display.TextSprite","flare.scale.Scale","flare.vis.legend.LegendRange","flare.util.Displays","flare.util.Orientation","flare.util.palette.ShapePalette","flare.util.palette.Palette","flare.util.palette.ColorPalette"]}, +{"name":"flare.vis.legend.LegendItem","size":4614,"imports":["flare.util.Shapes","flare.display.TextSprite","flare.vis.legend.Legend","flare.display.RectSprite"]}, +{"name":"flare.vis.legend.LegendRange","size":10530,"imports":["flare.util.Colors","flare.vis.legend.Legend","flare.display.RectSprite","flare.display.TextSprite","flare.scale.Scale","flare.util.Stats","flare.scale.IScaleMap","flare.util.Orientation","flare.util.palette.ColorPalette"]}, +{"name":"flare.vis.operator.distortion.BifocalDistortion","size":4461,"imports":["flare.vis.operator.distortion.Distortion"]}, +{"name":"flare.vis.operator.distortion.Distortion","size":6314,"imports":["flare.animate.Transitioner","flare.vis.data.DataSprite","flare.vis.events.VisualizationEvent","flare.vis.axis.Axis","flare.vis.axis.CartesianAxes","flare.vis.operator.layout.Layout","flare.vis.data.Data"]}, +{"name":"flare.vis.operator.distortion.FisheyeDistortion","size":3444,"imports":["flare.vis.operator.distortion.Distortion"]}, +{"name":"flare.vis.operator.encoder.ColorEncoder","size":3179,"imports":["flare.animate.Transitioner","flare.scale.ScaleType","flare.vis.operator.encoder.Encoder","flare.util.palette.Palette","flare.util.palette.ColorPalette","flare.vis.data.Data"]}, +{"name":"flare.vis.operator.encoder.Encoder","size":4060,"imports":["flare.animate.Transitioner","flare.vis.data.DataSprite","flare.vis.operator.Operator","flare.vis.data.ScaleBinding","flare.util.palette.Palette","flare.util.Filter","flare.util.Property","flare.vis.data.Data"]}, +{"name":"flare.vis.operator.encoder.PropertyEncoder","size":4138,"imports":["flare.animate.Transitioner","flare.vis.data.DataList","flare.vis.data.Data","flare.vis.operator.encoder.Encoder","flare.util.Filter","flare.vis.operator.Operator"]}, +{"name":"flare.vis.operator.encoder.ShapeEncoder","size":1690,"imports":["flare.util.palette.Palette","flare.scale.ScaleType","flare.util.palette.ShapePalette","flare.vis.operator.encoder.Encoder","flare.vis.data.Data"]}, +{"name":"flare.vis.operator.encoder.SizeEncoder","size":1830,"imports":["flare.util.palette.Palette","flare.scale.ScaleType","flare.vis.operator.encoder.Encoder","flare.util.palette.SizePalette","flare.vis.data.Data"]}, +{"name":"flare.vis.operator.filter.FisheyeTreeFilter","size":5219,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.data.DataSprite","flare.vis.data.EdgeSprite","flare.vis.data.Tree","flare.vis.operator.Operator","flare.vis.data.Data"]}, +{"name":"flare.vis.operator.filter.GraphDistanceFilter","size":3165,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.operator.Operator","flare.vis.data.DataSprite","flare.vis.data.EdgeSprite"]}, +{"name":"flare.vis.operator.filter.VisibilityFilter","size":3509,"imports":["flare.vis.operator.Operator","flare.animate.Transitioner","flare.util.Filter","flare.vis.data.DataSprite","flare.vis.data.Data"]}, +{"name":"flare.vis.operator.IOperator","size":1286,"imports":["flare.animate.Transitioner","flare.vis.Visualization","flare.vis.operator.Operator"]}, +{"name":"flare.vis.operator.label.Labeler","size":9956,"imports":["flare.animate.Transitioner","flare.vis.data.DataSprite","flare.display.TextSprite","flare.vis.operator.Operator","flare.util.Shapes","flare.util.Filter","flare.util.Property","flare.util.IEvaluable","flare.vis.data.Data"]}, +{"name":"flare.vis.operator.label.RadialLabeler","size":3899,"imports":["flare.vis.operator.label.Labeler","flare.util.Shapes","flare.display.TextSprite","flare.vis.data.DataSprite","flare.vis.data.Data"]}, +{"name":"flare.vis.operator.label.StackedAreaLabeler","size":3202,"imports":["flare.vis.operator.label.Labeler","flare.display.TextSprite","flare.vis.data.DataSprite","flare.vis.data.Data"]}, +{"name":"flare.vis.operator.layout.AxisLayout","size":6725,"imports":["flare.scale.ScaleType","flare.vis.data.DataSprite","flare.vis.axis.CartesianAxes","flare.vis.data.ScaleBinding","flare.util.Property","flare.vis.operator.layout.Layout","flare.vis.data.Data"]}, +{"name":"flare.vis.operator.layout.BundledEdgeRouter","size":3727,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.util.Arrays","flare.vis.data.DataSprite","flare.vis.data.EdgeSprite","flare.util.Shapes","flare.vis.operator.layout.Layout","flare.vis.operator.Operator"]}, +{"name":"flare.vis.operator.layout.CircleLayout","size":9317,"imports":["flare.vis.data.NodeSprite","flare.vis.data.DataList","flare.vis.data.ScaleBinding","flare.util.Property","flare.vis.operator.layout.Layout","flare.vis.data.Data"]}, +{"name":"flare.vis.operator.layout.CirclePackingLayout","size":12003,"imports":["flare.vis.data.NodeSprite","flare.vis.data.render.ShapeRenderer","flare.util.Shapes","flare.util.Sort","flare.vis.operator.layout.Layout","flare.vis.data.Data"]}, +{"name":"flare.vis.operator.layout.DendrogramLayout","size":4853,"imports":["flare.util.Property","flare.vis.data.NodeSprite","flare.util.Orientation","flare.vis.operator.layout.Layout","flare.vis.data.EdgeSprite"]}, +{"name":"flare.vis.operator.layout.ForceDirectedLayout","size":8411,"imports":["flare.physics.Simulation","flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.data.DataSprite","flare.physics.Particle","flare.physics.Spring","flare.vis.operator.layout.Layout","flare.vis.data.EdgeSprite","flare.vis.data.Data"]}, +{"name":"flare.vis.operator.layout.IcicleTreeLayout","size":4864,"imports":["flare.vis.data.NodeSprite","flare.util.Orientation","flare.vis.operator.layout.Layout"]}, +{"name":"flare.vis.operator.layout.IndentedTreeLayout","size":3174,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.util.Arrays","flare.vis.operator.layout.Layout","flare.vis.data.EdgeSprite"]}, +{"name":"flare.vis.operator.layout.Layout","size":7881,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.data.DataList","flare.vis.data.DataSprite","flare.vis.data.EdgeSprite","flare.vis.Visualization","flare.vis.axis.CartesianAxes","flare.vis.axis.Axes","flare.animate.TransitionEvent","flare.vis.operator.Operator"]}, +{"name":"flare.vis.operator.layout.NodeLinkTreeLayout","size":12870,"imports":["flare.vis.data.NodeSprite","flare.util.Arrays","flare.util.Orientation","flare.vis.operator.layout.Layout"]}, +{"name":"flare.vis.operator.layout.PieLayout","size":2728,"imports":["flare.vis.data.DataList","flare.vis.data.DataSprite","flare.util.Shapes","flare.util.Property","flare.vis.operator.layout.Layout","flare.vis.data.Data"]}, +{"name":"flare.vis.operator.layout.RadialTreeLayout","size":12348,"imports":["flare.vis.data.NodeSprite","flare.util.Arrays","flare.vis.operator.layout.Layout"]}, +{"name":"flare.vis.operator.layout.RandomLayout","size":870,"imports":["flare.vis.operator.layout.Layout","flare.vis.data.DataSprite","flare.vis.data.Data"]}, +{"name":"flare.vis.operator.layout.StackedAreaLayout","size":9121,"imports":["flare.scale.TimeScale","flare.scale.LinearScale","flare.util.Arrays","flare.scale.OrdinalScale","flare.vis.data.NodeSprite","flare.scale.Scale","flare.vis.axis.CartesianAxes","flare.util.Stats","flare.util.Orientation","flare.scale.QuantitativeScale","flare.util.Maths","flare.vis.operator.layout.Layout"]}, +{"name":"flare.vis.operator.layout.TreeMapLayout","size":9191,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.util.Property","flare.vis.operator.layout.Layout"]}, +{"name":"flare.vis.operator.Operator","size":2490,"imports":["flare.animate.Transitioner","flare.vis.operator.IOperator","flare.util.Property","flare.util.IEvaluable","flare.vis.Visualization"]}, +{"name":"flare.vis.operator.OperatorList","size":5248,"imports":["flare.animate.Transitioner","flare.util.Arrays","flare.vis.operator.IOperator","flare.vis.Visualization","flare.vis.operator.Operator"]}, +{"name":"flare.vis.operator.OperatorSequence","size":4190,"imports":["flare.animate.Transitioner","flare.util.Arrays","flare.vis.operator.IOperator","flare.vis.operator.OperatorList","flare.animate.FunctionSequence","flare.vis.operator.Operator"]}, +{"name":"flare.vis.operator.OperatorSwitch","size":2581,"imports":["flare.animate.Transitioner","flare.vis.operator.OperatorList","flare.vis.operator.IOperator","flare.vis.operator.Operator"]}, +{"name":"flare.vis.operator.SortOperator","size":2023,"imports":["flare.vis.operator.Operator","flare.animate.Transitioner","flare.util.Arrays","flare.vis.data.Data"]}, +{"name":"flare.vis.Visualization","size":16540,"imports":["flare.animate.Transitioner","flare.vis.operator.IOperator","flare.animate.Scheduler","flare.vis.events.VisualizationEvent","flare.vis.data.Tree","flare.vis.events.DataEvent","flare.vis.axis.Axes","flare.vis.axis.CartesianAxes","flare.util.Displays","flare.vis.operator.OperatorList","flare.vis.controls.ControlList","flare.animate.ISchedulable","flare.vis.data.Data"]} +] diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/flare.json b/projects/Data Visualization Software Java Project/Data Visualization/Examples/flare.json new file mode 100644 index 0000000..a05a948 --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/flare.json @@ -0,0 +1,380 @@ +{ + "name": "flare", + "children": [ + { + "name": "analytics", + "children": [ + { + "name": "cluster", + "children": [ + {"name": "AgglomerativeCluster", "size": 3938}, + {"name": "CommunityStructure", "size": 3812}, + {"name": "HierarchicalCluster", "size": 6714}, + {"name": "MergeEdge", "size": 743} + ] + }, + { + "name": "graph", + "children": [ + {"name": "BetweennessCentrality", "size": 3534}, + {"name": "LinkDistance", "size": 5731}, + {"name": "MaxFlowMinCut", "size": 7840}, + {"name": "ShortestPaths", "size": 5914}, + {"name": "SpanningTree", "size": 3416} + ] + }, + { + "name": "optimization", + "children": [ + {"name": "AspectRatioBanker", "size": 7074} + ] + } + ] + }, + { + "name": "animate", + "children": [ + {"name": "Easing", "size": 17010}, + {"name": "FunctionSequence", "size": 5842}, + { + "name": "interpolate", + "children": [ + {"name": "ArrayInterpolator", "size": 1983}, + {"name": "ColorInterpolator", "size": 2047}, + {"name": "DateInterpolator", "size": 1375}, + {"name": "Interpolator", "size": 8746}, + {"name": "MatrixInterpolator", "size": 2202}, + {"name": "NumberInterpolator", "size": 1382}, + {"name": "ObjectInterpolator", "size": 1629}, + {"name": "PointInterpolator", "size": 1675}, + {"name": "RectangleInterpolator", "size": 2042} + ] + }, + {"name": "ISchedulable", "size": 1041}, + {"name": "Parallel", "size": 5176}, + {"name": "Pause", "size": 449}, + {"name": "Scheduler", "size": 5593}, + {"name": "Sequence", "size": 5534}, + {"name": "Transition", "size": 9201}, + {"name": "Transitioner", "size": 19975}, + {"name": "TransitionEvent", "size": 1116}, + {"name": "Tween", "size": 6006} + ] + }, + { + "name": "data", + "children": [ + { + "name": "converters", + "children": [ + {"name": "Converters", "size": 721}, + {"name": "DelimitedTextConverter", "size": 4294}, + {"name": "GraphMLConverter", "size": 9800}, + {"name": "IDataConverter", "size": 1314}, + {"name": "JSONConverter", "size": 2220} + ] + }, + {"name": "DataField", "size": 1759}, + {"name": "DataSchema", "size": 2165}, + {"name": "DataSet", "size": 586}, + {"name": "DataSource", "size": 3331}, + {"name": "DataTable", "size": 772}, + {"name": "DataUtil", "size": 3322} + ] + }, + { + "name": "display", + "children": [ + {"name": "DirtySprite", "size": 8833}, + {"name": "LineSprite", "size": 1732}, + {"name": "RectSprite", "size": 3623}, + {"name": "TextSprite", "size": 10066} + ] + }, + { + "name": "flex", + "children": [ + {"name": "FlareVis", "size": 4116} + ] + }, + { + "name": "physics", + "children": [ + {"name": "DragForce", "size": 1082}, + {"name": "GravityForce", "size": 1336}, + {"name": "IForce", "size": 319}, + {"name": "NBodyForce", "size": 10498}, + {"name": "Particle", "size": 2822}, + {"name": "Simulation", "size": 9983}, + {"name": "Spring", "size": 2213}, + {"name": "SpringForce", "size": 1681} + ] + }, + { + "name": "query", + "children": [ + {"name": "AggregateExpression", "size": 1616}, + {"name": "And", "size": 1027}, + {"name": "Arithmetic", "size": 3891}, + {"name": "Average", "size": 891}, + {"name": "BinaryExpression", "size": 2893}, + {"name": "Comparison", "size": 5103}, + {"name": "CompositeExpression", "size": 3677}, + {"name": "Count", "size": 781}, + {"name": "DateUtil", "size": 4141}, + {"name": "Distinct", "size": 933}, + {"name": "Expression", "size": 5130}, + {"name": "ExpressionIterator", "size": 3617}, + {"name": "Fn", "size": 3240}, + {"name": "If", "size": 2732}, + {"name": "IsA", "size": 2039}, + {"name": "Literal", "size": 1214}, + {"name": "Match", "size": 3748}, + {"name": "Maximum", "size": 843}, + { + "name": "methods", + "children": [ + {"name": "add", "size": 593}, + {"name": "and", "size": 330}, + {"name": "average", "size": 287}, + {"name": "count", "size": 277}, + {"name": "distinct", "size": 292}, + {"name": "div", "size": 595}, + {"name": "eq", "size": 594}, + {"name": "fn", "size": 460}, + {"name": "gt", "size": 603}, + {"name": "gte", "size": 625}, + {"name": "iff", "size": 748}, + {"name": "isa", "size": 461}, + {"name": "lt", "size": 597}, + {"name": "lte", "size": 619}, + {"name": "max", "size": 283}, + {"name": "min", "size": 283}, + {"name": "mod", "size": 591}, + {"name": "mul", "size": 603}, + {"name": "neq", "size": 599}, + {"name": "not", "size": 386}, + {"name": "or", "size": 323}, + {"name": "orderby", "size": 307}, + {"name": "range", "size": 772}, + {"name": "select", "size": 296}, + {"name": "stddev", "size": 363}, + {"name": "sub", "size": 600}, + {"name": "sum", "size": 280}, + {"name": "update", "size": 307}, + {"name": "variance", "size": 335}, + {"name": "where", "size": 299}, + {"name": "xor", "size": 354}, + {"name": "_", "size": 264} + ] + }, + {"name": "Minimum", "size": 843}, + {"name": "Not", "size": 1554}, + {"name": "Or", "size": 970}, + {"name": "Query", "size": 13896}, + {"name": "Range", "size": 1594}, + {"name": "StringUtil", "size": 4130}, + {"name": "Sum", "size": 791}, + {"name": "Variable", "size": 1124}, + {"name": "Variance", "size": 1876}, + {"name": "Xor", "size": 1101} + ] + }, + { + "name": "scale", + "children": [ + {"name": "IScaleMap", "size": 2105}, + {"name": "LinearScale", "size": 1316}, + {"name": "LogScale", "size": 3151}, + {"name": "OrdinalScale", "size": 3770}, + {"name": "QuantileScale", "size": 2435}, + {"name": "QuantitativeScale", "size": 4839}, + {"name": "RootScale", "size": 1756}, + {"name": "Scale", "size": 4268}, + {"name": "ScaleType", "size": 1821}, + {"name": "TimeScale", "size": 5833} + ] + }, + { + "name": "util", + "children": [ + {"name": "Arrays", "size": 8258}, + {"name": "Colors", "size": 10001}, + {"name": "Dates", "size": 8217}, + {"name": "Displays", "size": 12555}, + {"name": "Filter", "size": 2324}, + {"name": "Geometry", "size": 10993}, + { + "name": "heap", + "children": [ + {"name": "FibonacciHeap", "size": 9354}, + {"name": "HeapNode", "size": 1233} + ] + }, + {"name": "IEvaluable", "size": 335}, + {"name": "IPredicate", "size": 383}, + {"name": "IValueProxy", "size": 874}, + { + "name": "math", + "children": [ + {"name": "DenseMatrix", "size": 3165}, + {"name": "IMatrix", "size": 2815}, + {"name": "SparseMatrix", "size": 3366} + ] + }, + {"name": "Maths", "size": 17705}, + {"name": "Orientation", "size": 1486}, + { + "name": "palette", + "children": [ + {"name": "ColorPalette", "size": 6367}, + {"name": "Palette", "size": 1229}, + {"name": "ShapePalette", "size": 2059}, + {"name": "SizePalette", "size": 2291} + ] + }, + {"name": "Property", "size": 5559}, + {"name": "Shapes", "size": 19118}, + {"name": "Sort", "size": 6887}, + {"name": "Stats", "size": 6557}, + {"name": "Strings", "size": 22026} + ] + }, + { + "name": "vis", + "children": [ + { + "name": "axis", + "children": [ + {"name": "Axes", "size": 1302}, + {"name": "Axis", "size": 24593}, + {"name": "AxisGridLine", "size": 652}, + {"name": "AxisLabel", "size": 636}, + {"name": "CartesianAxes", "size": 6703} + ] + }, + { + "name": "controls", + "children": [ + {"name": "AnchorControl", "size": 2138}, + {"name": "ClickControl", "size": 3824}, + {"name": "Control", "size": 1353}, + {"name": "ControlList", "size": 4665}, + {"name": "DragControl", "size": 2649}, + {"name": "ExpandControl", "size": 2832}, + {"name": "HoverControl", "size": 4896}, + {"name": "IControl", "size": 763}, + {"name": "PanZoomControl", "size": 5222}, + {"name": "SelectionControl", "size": 7862}, + {"name": "TooltipControl", "size": 8435} + ] + }, + { + "name": "data", + "children": [ + {"name": "Data", "size": 20544}, + {"name": "DataList", "size": 19788}, + {"name": "DataSprite", "size": 10349}, + {"name": "EdgeSprite", "size": 3301}, + {"name": "NodeSprite", "size": 19382}, + { + "name": "render", + "children": [ + {"name": "ArrowType", "size": 698}, + {"name": "EdgeRenderer", "size": 5569}, + {"name": "IRenderer", "size": 353}, + {"name": "ShapeRenderer", "size": 2247} + ] + }, + {"name": "ScaleBinding", "size": 11275}, + {"name": "Tree", "size": 7147}, + {"name": "TreeBuilder", "size": 9930} + ] + }, + { + "name": "events", + "children": [ + {"name": "DataEvent", "size": 2313}, + {"name": "SelectionEvent", "size": 1880}, + {"name": "TooltipEvent", "size": 1701}, + {"name": "VisualizationEvent", "size": 1117} + ] + }, + { + "name": "legend", + "children": [ + {"name": "Legend", "size": 20859}, + {"name": "LegendItem", "size": 4614}, + {"name": "LegendRange", "size": 10530} + ] + }, + { + "name": "operator", + "children": [ + { + "name": "distortion", + "children": [ + {"name": "BifocalDistortion", "size": 4461}, + {"name": "Distortion", "size": 6314}, + {"name": "FisheyeDistortion", "size": 3444} + ] + }, + { + "name": "encoder", + "children": [ + {"name": "ColorEncoder", "size": 3179}, + {"name": "Encoder", "size": 4060}, + {"name": "PropertyEncoder", "size": 4138}, + {"name": "ShapeEncoder", "size": 1690}, + {"name": "SizeEncoder", "size": 1830} + ] + }, + { + "name": "filter", + "children": [ + {"name": "FisheyeTreeFilter", "size": 5219}, + {"name": "GraphDistanceFilter", "size": 3165}, + {"name": "VisibilityFilter", "size": 3509} + ] + }, + {"name": "IOperator", "size": 1286}, + { + "name": "label", + "children": [ + {"name": "Labeler", "size": 9956}, + {"name": "RadialLabeler", "size": 3899}, + {"name": "StackedAreaLabeler", "size": 3202} + ] + }, + { + "name": "layout", + "children": [ + {"name": "AxisLayout", "size": 6725}, + {"name": "BundledEdgeRouter", "size": 3727}, + {"name": "CircleLayout", "size": 9317}, + {"name": "CirclePackingLayout", "size": 12003}, + {"name": "DendrogramLayout", "size": 4853}, + {"name": "ForceDirectedLayout", "size": 8411}, + {"name": "IcicleTreeLayout", "size": 4864}, + {"name": "IndentedTreeLayout", "size": 3174}, + {"name": "Layout", "size": 7881}, + {"name": "NodeLinkTreeLayout", "size": 12870}, + {"name": "PieLayout", "size": 2728}, + {"name": "RadialTreeLayout", "size": 12348}, + {"name": "RandomLayout", "size": 870}, + {"name": "StackedAreaLayout", "size": 9121}, + {"name": "TreeMapLayout", "size": 9191} + ] + }, + {"name": "Operator", "size": 2490}, + {"name": "OperatorList", "size": 5248}, + {"name": "OperatorSequence", "size": 4190}, + {"name": "OperatorSwitch", "size": 2581}, + {"name": "SortOperator", "size": 2023} + ] + }, + {"name": "Visualization", "size": 16540} + ] + } + ] +} \ No newline at end of file diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/force-bounds.html b/projects/Data Visualization Software Java Project/Data Visualization/Examples/force-bounds.html new file mode 100644 index 0000000..d747c61 --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/force-bounds.html @@ -0,0 +1,151 @@ + + + + Force-Directed Layout + + + + + + + + + diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/force-collapsible.html b/projects/Data Visualization Software Java Project/Data Visualization/Examples/force-collapsible.html new file mode 100644 index 0000000..a8502e9 --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/force-collapsible.html @@ -0,0 +1,142 @@ + + + + + Force-Directed Graph + + + + +
+ + + diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/miserables.json b/projects/Data Visualization Software Java Project/Data Visualization/Examples/miserables.json new file mode 100644 index 0000000..8ac8437 --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/miserables.json @@ -0,0 +1 @@ +{"nodes":[{"name":"Myriel","group":1},{"name":"Napoleon","group":1},{"name":"Mlle.Baptistine","group":1},{"name":"Mme.Magloire","group":1},{"name":"CountessdeLo","group":1},{"name":"Geborand","group":1},{"name":"Champtercier","group":1},{"name":"Cravatte","group":1},{"name":"Count","group":1},{"name":"OldMan","group":1},{"name":"Labarre","group":2},{"name":"Valjean","group":2},{"name":"Marguerite","group":3},{"name":"Mme.deR","group":2},{"name":"Isabeau","group":2},{"name":"Gervais","group":2},{"name":"Tholomyes","group":3},{"name":"Listolier","group":3},{"name":"Fameuil","group":3},{"name":"Blacheville","group":3},{"name":"Favourite","group":3},{"name":"Dahlia","group":3},{"name":"Zephine","group":3},{"name":"Fantine","group":3},{"name":"Mme.Thenardier","group":4},{"name":"Thenardier","group":4},{"name":"Cosette","group":5},{"name":"Javert","group":4},{"name":"Fauchelevent","group":0},{"name":"Bamatabois","group":2},{"name":"Perpetue","group":3},{"name":"Simplice","group":2},{"name":"Scaufflaire","group":2},{"name":"Woman1","group":2},{"name":"Judge","group":2},{"name":"Champmathieu","group":2},{"name":"Brevet","group":2},{"name":"Chenildieu","group":2},{"name":"Cochepaille","group":2},{"name":"Pontmercy","group":4},{"name":"Boulatruelle","group":6},{"name":"Eponine","group":4},{"name":"Anzelma","group":4},{"name":"Woman2","group":5},{"name":"MotherInnocent","group":0},{"name":"Gribier","group":0},{"name":"Jondrette","group":7},{"name":"Mme.Burgon","group":7},{"name":"Gavroche","group":8},{"name":"Gillenormand","group":5},{"name":"Magnon","group":5},{"name":"Mlle.Gillenormand","group":5},{"name":"Mme.Pontmercy","group":5},{"name":"Mlle.Vaubois","group":5},{"name":"Lt.Gillenormand","group":5},{"name":"Marius","group":8},{"name":"BaronessT","group":5},{"name":"Mabeuf","group":8},{"name":"Enjolras","group":8},{"name":"Combeferre","group":8},{"name":"Prouvaire","group":8},{"name":"Feuilly","group":8},{"name":"Courfeyrac","group":8},{"name":"Bahorel","group":8},{"name":"Bossuet","group":8},{"name":"Joly","group":8},{"name":"Grantaire","group":8},{"name":"MotherPlutarch","group":9},{"name":"Gueulemer","group":4},{"name":"Babet","group":4},{"name":"Claquesous","group":4},{"name":"Montparnasse","group":4},{"name":"Toussaint","group":5},{"name":"Child1","group":10},{"name":"Child2","group":10},{"name":"Brujon","group":4},{"name":"Mme.Hucheloup","group":8}],"links":[{"source":1,"target":0,"value":1},{"source":2,"target":0,"value":8},{"source":3,"target":0,"value":10},{"source":3,"target":2,"value":6},{"source":4,"target":0,"value":1},{"source":5,"target":0,"value":1},{"source":6,"target":0,"value":1},{"source":7,"target":0,"value":1},{"source":8,"target":0,"value":2},{"source":9,"target":0,"value":1},{"source":11,"target":10,"value":1},{"source":11,"target":3,"value":3},{"source":11,"target":2,"value":3},{"source":11,"target":0,"value":5},{"source":12,"target":11,"value":1},{"source":13,"target":11,"value":1},{"source":14,"target":11,"value":1},{"source":15,"target":11,"value":1},{"source":17,"target":16,"value":4},{"source":18,"target":16,"value":4},{"source":18,"target":17,"value":4},{"source":19,"target":16,"value":4},{"source":19,"target":17,"value":4},{"source":19,"target":18,"value":4},{"source":20,"target":16,"value":3},{"source":20,"target":17,"value":3},{"source":20,"target":18,"value":3},{"source":20,"target":19,"value":4},{"source":21,"target":16,"value":3},{"source":21,"target":17,"value":3},{"source":21,"target":18,"value":3},{"source":21,"target":19,"value":3},{"source":21,"target":20,"value":5},{"source":22,"target":16,"value":3},{"source":22,"target":17,"value":3},{"source":22,"target":18,"value":3},{"source":22,"target":19,"value":3},{"source":22,"target":20,"value":4},{"source":22,"target":21,"value":4},{"source":23,"target":16,"value":3},{"source":23,"target":17,"value":3},{"source":23,"target":18,"value":3},{"source":23,"target":19,"value":3},{"source":23,"target":20,"value":4},{"source":23,"target":21,"value":4},{"source":23,"target":22,"value":4},{"source":23,"target":12,"value":2},{"source":23,"target":11,"value":9},{"source":24,"target":23,"value":2},{"source":24,"target":11,"value":7},{"source":25,"target":24,"value":13},{"source":25,"target":23,"value":1},{"source":25,"target":11,"value":12},{"source":26,"target":24,"value":4},{"source":26,"target":11,"value":31},{"source":26,"target":16,"value":1},{"source":26,"target":25,"value":1},{"source":27,"target":11,"value":17},{"source":27,"target":23,"value":5},{"source":27,"target":25,"value":5},{"source":27,"target":24,"value":1},{"source":27,"target":26,"value":1},{"source":28,"target":11,"value":8},{"source":28,"target":27,"value":1},{"source":29,"target":23,"value":1},{"source":29,"target":27,"value":1},{"source":29,"target":11,"value":2},{"source":30,"target":23,"value":1},{"source":31,"target":30,"value":2},{"source":31,"target":11,"value":3},{"source":31,"target":23,"value":2},{"source":31,"target":27,"value":1},{"source":32,"target":11,"value":1},{"source":33,"target":11,"value":2},{"source":33,"target":27,"value":1},{"source":34,"target":11,"value":3},{"source":34,"target":29,"value":2},{"source":35,"target":11,"value":3},{"source":35,"target":34,"value":3},{"source":35,"target":29,"value":2},{"source":36,"target":34,"value":2},{"source":36,"target":35,"value":2},{"source":36,"target":11,"value":2},{"source":36,"target":29,"value":1},{"source":37,"target":34,"value":2},{"source":37,"target":35,"value":2},{"source":37,"target":36,"value":2},{"source":37,"target":11,"value":2},{"source":37,"target":29,"value":1},{"source":38,"target":34,"value":2},{"source":38,"target":35,"value":2},{"source":38,"target":36,"value":2},{"source":38,"target":37,"value":2},{"source":38,"target":11,"value":2},{"source":38,"target":29,"value":1},{"source":39,"target":25,"value":1},{"source":40,"target":25,"value":1},{"source":41,"target":24,"value":2},{"source":41,"target":25,"value":3},{"source":42,"target":41,"value":2},{"source":42,"target":25,"value":2},{"source":42,"target":24,"value":1},{"source":43,"target":11,"value":3},{"source":43,"target":26,"value":1},{"source":43,"target":27,"value":1},{"source":44,"target":28,"value":3},{"source":44,"target":11,"value":1},{"source":45,"target":28,"value":2},{"source":47,"target":46,"value":1},{"source":48,"target":47,"value":2},{"source":48,"target":25,"value":1},{"source":48,"target":27,"value":1},{"source":48,"target":11,"value":1},{"source":49,"target":26,"value":3},{"source":49,"target":11,"value":2},{"source":50,"target":49,"value":1},{"source":50,"target":24,"value":1},{"source":51,"target":49,"value":9},{"source":51,"target":26,"value":2},{"source":51,"target":11,"value":2},{"source":52,"target":51,"value":1},{"source":52,"target":39,"value":1},{"source":53,"target":51,"value":1},{"source":54,"target":51,"value":2},{"source":54,"target":49,"value":1},{"source":54,"target":26,"value":1},{"source":55,"target":51,"value":6},{"source":55,"target":49,"value":12},{"source":55,"target":39,"value":1},{"source":55,"target":54,"value":1},{"source":55,"target":26,"value":21},{"source":55,"target":11,"value":19},{"source":55,"target":16,"value":1},{"source":55,"target":25,"value":2},{"source":55,"target":41,"value":5},{"source":55,"target":48,"value":4},{"source":56,"target":49,"value":1},{"source":56,"target":55,"value":1},{"source":57,"target":55,"value":1},{"source":57,"target":41,"value":1},{"source":57,"target":48,"value":1},{"source":58,"target":55,"value":7},{"source":58,"target":48,"value":7},{"source":58,"target":27,"value":6},{"source":58,"target":57,"value":1},{"source":58,"target":11,"value":4},{"source":59,"target":58,"value":15},{"source":59,"target":55,"value":5},{"source":59,"target":48,"value":6},{"source":59,"target":57,"value":2},{"source":60,"target":48,"value":1},{"source":60,"target":58,"value":4},{"source":60,"target":59,"value":2},{"source":61,"target":48,"value":2},{"source":61,"target":58,"value":6},{"source":61,"target":60,"value":2},{"source":61,"target":59,"value":5},{"source":61,"target":57,"value":1},{"source":61,"target":55,"value":1},{"source":62,"target":55,"value":9},{"source":62,"target":58,"value":17},{"source":62,"target":59,"value":13},{"source":62,"target":48,"value":7},{"source":62,"target":57,"value":2},{"source":62,"target":41,"value":1},{"source":62,"target":61,"value":6},{"source":62,"target":60,"value":3},{"source":63,"target":59,"value":5},{"source":63,"target":48,"value":5},{"source":63,"target":62,"value":6},{"source":63,"target":57,"value":2},{"source":63,"target":58,"value":4},{"source":63,"target":61,"value":3},{"source":63,"target":60,"value":2},{"source":63,"target":55,"value":1},{"source":64,"target":55,"value":5},{"source":64,"target":62,"value":12},{"source":64,"target":48,"value":5},{"source":64,"target":63,"value":4},{"source":64,"target":58,"value":10},{"source":64,"target":61,"value":6},{"source":64,"target":60,"value":2},{"source":64,"target":59,"value":9},{"source":64,"target":57,"value":1},{"source":64,"target":11,"value":1},{"source":65,"target":63,"value":5},{"source":65,"target":64,"value":7},{"source":65,"target":48,"value":3},{"source":65,"target":62,"value":5},{"source":65,"target":58,"value":5},{"source":65,"target":61,"value":5},{"source":65,"target":60,"value":2},{"source":65,"target":59,"value":5},{"source":65,"target":57,"value":1},{"source":65,"target":55,"value":2},{"source":66,"target":64,"value":3},{"source":66,"target":58,"value":3},{"source":66,"target":59,"value":1},{"source":66,"target":62,"value":2},{"source":66,"target":65,"value":2},{"source":66,"target":48,"value":1},{"source":66,"target":63,"value":1},{"source":66,"target":61,"value":1},{"source":66,"target":60,"value":1},{"source":67,"target":57,"value":3},{"source":68,"target":25,"value":5},{"source":68,"target":11,"value":1},{"source":68,"target":24,"value":1},{"source":68,"target":27,"value":1},{"source":68,"target":48,"value":1},{"source":68,"target":41,"value":1},{"source":69,"target":25,"value":6},{"source":69,"target":68,"value":6},{"source":69,"target":11,"value":1},{"source":69,"target":24,"value":1},{"source":69,"target":27,"value":2},{"source":69,"target":48,"value":1},{"source":69,"target":41,"value":1},{"source":70,"target":25,"value":4},{"source":70,"target":69,"value":4},{"source":70,"target":68,"value":4},{"source":70,"target":11,"value":1},{"source":70,"target":24,"value":1},{"source":70,"target":27,"value":1},{"source":70,"target":41,"value":1},{"source":70,"target":58,"value":1},{"source":71,"target":27,"value":1},{"source":71,"target":69,"value":2},{"source":71,"target":68,"value":2},{"source":71,"target":70,"value":2},{"source":71,"target":11,"value":1},{"source":71,"target":48,"value":1},{"source":71,"target":41,"value":1},{"source":71,"target":25,"value":1},{"source":72,"target":26,"value":2},{"source":72,"target":27,"value":1},{"source":72,"target":11,"value":1},{"source":73,"target":48,"value":2},{"source":74,"target":48,"value":2},{"source":74,"target":73,"value":3},{"source":75,"target":69,"value":3},{"source":75,"target":68,"value":3},{"source":75,"target":25,"value":3},{"source":75,"target":48,"value":1},{"source":75,"target":41,"value":1},{"source":75,"target":70,"value":1},{"source":75,"target":71,"value":1},{"source":76,"target":64,"value":1},{"source":76,"target":65,"value":1},{"source":76,"target":66,"value":1},{"source":76,"target":63,"value":1},{"source":76,"target":62,"value":1},{"source":76,"target":48,"value":1},{"source":76,"target":58,"value":1}]} \ No newline at end of file diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/packages.js b/projects/Data Visualization Software Java Project/Data Visualization/Examples/packages.js new file mode 100644 index 0000000..4bf5c8a --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/packages.js @@ -0,0 +1,49 @@ +(function() { + packages = { + + // Lazily construct the package hierarchy from class names. + root: function(classes) { + var map = {}; + + function find(name, data) { + var node = map[name], i; + if (!node) { + node = map[name] = data || {name: name, children: []}; + if (name.length) { + node.parent = find(name.substring(0, i = name.lastIndexOf("."))); + node.parent.children.push(node); + node.key = name.substring(i + 1); + } + } + return node; + } + + classes.forEach(function(d) { + find(d.name, d); + }); + + return map[""]; + }, + + // Return a list of imports for the given array of nodes. + imports: function(nodes) { + var map = {}, + imports = []; + + // Compute a map from name to node. + nodes.forEach(function(d) { + map[d.name] = d; + }); + + // For each import, construct a link from the source to target node. + nodes.forEach(function(d) { + if (d.imports) d.imports.forEach(function(i) { + imports.push({source: map[d.name], target: map[i]}); + }); + }); + + return imports; + } + + }; +})(); diff --git a/projects/Data Visualization Software Java Project/Data Visualization/IntlNodes.json b/projects/Data Visualization Software Java Project/Data Visualization/IntlNodes.json new file mode 100644 index 0000000..cea2f4e --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/IntlNodes.json @@ -0,0 +1,1994 @@ +[ + { + "source": "Calit2 UCI", + "target": "City of Daegu, Korea", + "DollarValue": "$1,227,668", + "PartnerType": "Academic", + "Country": "Korea", + "ActivityLevel": "b" + }, + { + "source": "Calit2 UCI", + "target": "Embassy of France", + "DollarValue": "$240,000", + "PartnerType": "Government", + "Country": "France", + "ActivityLevel": "b" + }, + { + "source": "Calit2 UCSD", + "target": "Thetis, SPA", + "DollarValue": "$851,850", + "PartnerType": "Academic", + "Country": "Italy", + "ActivityLevel": "c" + }, + { + "source": "Calit2 UCSD", + "target": "King Abdulaziz City for Science and Technology", + "DollarValue": "$3,469,803", + "PartnerType": "Academic", + "Country": "Saudi Arabia", + "ActivityLevel": "a" + }, + { + "source": "Calit2 UCSD", + "target": "King Abdullah University of Science and Technology", + "DollarValue": "$8,463,499", + "PartnerType": "Academic", + "Country": "Saudi Arabia", + "ActivityLevel": "b" + }, + { + "source": "Calit2 UCSD", + "target": "United Kingdom", + "DollarValue": "$8,339", + "PartnerType": "Academic", + "Country": "UK", + "ActivityLevel": "c" + }, + { + "source": "Calit2 UCSD", + "target": "CONACYT", + "DollarValue": "$184,000", + "PartnerType": "Government", + "Country": "Mexoci", + "ActivityLevel": "a" + }, + { + "source": "Calit2 UCSD", + "target": "PRAGMA", + "DollarValue": "$4,205,315", + "PartnerType": "Project", + "Country": "US", + "ActivityLevel": "a" + }, + { + "source": "PRAGMA", + "target": "Cybermedia Center and Research Center for Ultra-high Voltage Electron Microscopy, Osaka University", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Japan", + "ActivityLevel": "a" + }, + { + "source": "PRAGMA", + "target": "Monash University", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Australia", + "ActivityLevel": "a" + }, + { + "source": "PRAGMA", + "target": "National Center for Higher Performance Computing-Taiwan", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Taiwan", + "ActivityLevel": "a" + }, + { + "source": "PRAGMA", + "target": "National Institute of Advanced Industrial Science and Technology-Japan", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Japan", + "ActivityLevel": "a" + }, + { + "source": "PRAGMA", + "target": "UCSD", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "a" + }, + { + "source": "PRAGMA", + "target": "Center for Computational Sciences, University of Tsukuba", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Japan", + "ActivityLevel": "b" + }, + { + "source": "PRAGMA", + "target": "College of Computer Science and Technology, Jilin University", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Canada", + "ActivityLevel": "b" + }, + { + "source": "PRAGMA", + "target": "Computer Network Information Center, Chinese Academy of Sciences", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "China", + "ActivityLevel": "b" + }, + { + "source": "PRAGMA", + "target": "University of Hong Kong", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Hong Kong", + "ActivityLevel": "b" + }, + { + "source": "PRAGMA", + "target": "Kasetsart University", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Thailand", + "ActivityLevel": "b" + }, + { + "source": "PRAGMA", + "target": "Konkuk University", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Korea", + "ActivityLevel": "b" + }, + { + "source": "PRAGMA", + "target": "Korea Institute of Science and Technology Information", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Korea", + "ActivityLevel": "b" + }, + { + "source": "PRAGMA", + "target": "National Electronics and Computer Technology Center-Thailand", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Thailand", + "ActivityLevel": "b" + }, + { + "source": "PRAGMA", + "target": "TransPAC2, Indiana", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "PRAGMA", + "target": "Universiti Sains Malaysia", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Malaysia", + "ActivityLevel": "b" + }, + { + "source": "PRAGMA", + "target": "University of Hyderabad", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "India", + "ActivityLevel": "b" + }, + { + "source": "PRAGMA", + "target": "Malaysian Institute of Microelectronic Systems (MIMOS)", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Malaysia", + "ActivityLevel": "c" + }, + { + "source": "PRAGMA", + "target": "Academia Sinica Grid Computing Center-Taiwan", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Taiwan", + "ActivityLevel": "c" + }, + { + "source": "PRAGMA", + "target": "Advanced Science and Technology Institute-Phillipines", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Phillipines", + "ActivityLevel": "c" + }, + { + "source": "PRAGMA", + "target": "BestGrid New Zealand", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "New Zeland", + "ActivityLevel": "c" + }, + { + "source": "PRAGMA", + "target": "Hanoi University of Technology", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Vietnam", + "ActivityLevel": "c" + }, + { + "source": "PRAGMA", + "target": "Ho Chi Minh City University of Technology", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Vietnam", + "ActivityLevel": "c" + }, + { + "source": "PRAGMA", + "target": "Institue for Information Technology-Vietnam", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Vietnam", + "ActivityLevel": "c" + }, + { + "source": "PRAGMA", + "target": "Star Tap, Translight", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "c" + }, + { + "source": "PRAGMA", + "target": "Asia Pacific Advanced Network-Japan", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Japan", + "ActivityLevel": "d" + }, + { + "source": "PRAGMA", + "target": "Centro de Invertigacion Cientifica y de Educacion Superior de Ensenada (CICESE)", + "DollarValue": "Unkown", + "PartnerType": "Government", + "Country": "Mexico", + "ActivityLevel": "d" + }, + { + "source": "PRAGMA", + "target": "Global Scientific Information and Computing Center, Tokyo Institute of Technology", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Japan", + "ActivityLevel": "d" + }, + { + "source": "PRAGMA", + "target": "Institute for High Performance Computing-Singapore", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Singapore", + "ActivityLevel": "d" + }, + { + "source": "PRAGMA", + "target": "Pacific Northwest Gigapop", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "d" + }, + { + "source": "PRAGMA", + "target": "Bioinformatics Institute Singapore (BII", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Singapore", + "ActivityLevel": "E" + }, + { + "source": "PRAGMA", + "target": "National Agricultural Research Center-Japan", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Japan", + "ActivityLevel": "E" + }, + { + "source": "PRAGMA", + "target": "National Center for Supercomputing Applications-Illinois", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "E" + }, + { + "source": "PRAGMA", + "target": "National Grid Office-Singapore", + "DollarValue": "Unkown", + "PartnerType": "Government", + "Country": "Singapore", + "ActivityLevel": "E" + }, + { + "source": "PRAGMA", + "target": "Computational Science and Engineering Online, University of Utah", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "E" + }, + { + "source": "PRAGMA", + "target": "CRAY", + "DollarValue": "Unkown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "E" + }, + { + "source": "PRAGMA", + "target": "Korea Basic Science Institute", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Korea", + "ActivityLevel": "E" + }, + { + "source": "PRAGMA", + "target": "Thai National Grid Center-Thailand", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Thailand", + "ActivityLevel": "E" + }, + { + "source": "PRAGMA", + "target": "Indiana University", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "PRAGMA", + "target": "University of Florida", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "PRAGMA", + "target": "University of Wisconsin", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "PRAGMA", + "target": "Lan Zhou University", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "China", + "ActivityLevel": "b" + }, + { + "source": "PRAGMA", + "target": "NICT", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Japan", + "ActivityLevel": "b" + }, + { + "source": "PRAGMA", + "target": "Kookmin University", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Korea", + "ActivityLevel": "c" + }, + { + "source": "PRAGMA", + "target": "CeNAT-ITCR", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "CR", + "ActivityLevel": "c" + }, + { + "source": "PRAGMA", + "target": "U Chile", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Chile", + "ActivityLevel": "c" + }, + { + "source": "PRAGMA", + "target": "U Zurich", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Switzerland", + "ActivityLevel": "c" + }, + { + "source": "PRAGMA", + "target": "National Applied Research Laboratories", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Taiwan", + "ActivityLevel": "d" + }, + { + "source": "PRAGMA", + "target": "UCSD: Center for Research in Biological Systems", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "a" + }, + { + "source": "PRAGMA", + "target": "UCSD: National Biomedical Computation Resource", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "a" + }, + { + "source": "PRAGMA", + "target": "UCSD: National Center for Microscopy and Imaging Research", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "a" + }, + { + "source": "PRAGMA", + "target": "UCSD: San Diego Supercomputing Center", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "a" + }, + { + "source": "PRAGMA", + "target": "UCSD: Calit2", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "a" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "AAARNet-Australia", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Australia", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "GLORIAD", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "Pacific Northwest Gigapop", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "AMPATH", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "HEAnet-Ireland", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Ireland", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "Poznan Superocmputing and Networking Center", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Poland", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "ANSP-Brazil", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Brazil", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "I2cat-Spain", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Spain", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "RIPN-Russia", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Russia", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "MCS-Argonnne National Laboratory", + "DollarValue": "Unkown", + "PartnerType": "Government", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "iCAIR", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "RNP-Brazil", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Brazil", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "International Educational Equal Access Foundation", + "DollarValue": "Unkown", + "PartnerType": "Not for Profit", + "Country": "", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "SARA-Norway", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Norway", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "CANARIE-Canada", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "Indiana University", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "StarLight", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "CENIC", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "Internet 2", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "SURA", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "CERN", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "JGN-II-Japan", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Japan", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "SurfNet-Netherlands", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Netherlands", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "CERNET-China", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "China", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "Janet-UK", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "UK", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "TeraGrid-NSF", + "DollarValue": "Unkown", + "PartnerType": "Government", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "CESNET-Czechoslovakia", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Czech", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "Juniper Networks, Inc", + "DollarValue": "Unkown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "TERENA-Europe", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "EU", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "CIENA", + "DollarValue": "Unkown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "King Abdullah University of Science and Technology", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "SA", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "TransLight-NSF", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "CISCO", + "DollarValue": "Unkown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "KRLight-Korea", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Korea", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "TWAREN-Taiwan", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Taiwan", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "CPqD-Brazil", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Brazil", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "MIT", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "University of Amsterdam", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Netherlands", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "CSTNET-China", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "China", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "MCNC-North Carolina", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "EVL-UIUC", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "DFN-Germany", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "Germany", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "MAX-Mid Atlantic", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "University College London", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "UK", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "E-ARENA-Russia", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Russia", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "NLR", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "University of Maryland", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "ESNET", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "Naval Postgraduate School", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "University of Washington", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "Extreme Networks", + "DollarValue": "Unkown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "NorthWestern", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "UltraLight-US/CERN", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "FAST-California Institute of Technology", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "NSF-CISE", + "DollarValue": "Unkown", + "PartnerType": "Government", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "USLHCNet", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "Fermilab", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "NetherLight", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Netherlands", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "WIDE-Japan", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Japan", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "Global Netwave", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Global Lambda Integrated Facility", + "target": "NORDUnet", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Netherlands", + "ActivityLevel": "" + }, + { + "source": "Pacific Northwest Gigapop", + "target": "CENIC", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Pacific Northwest Gigapop", + "target": "CANARIE-Canada", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Canada", + "ActivityLevel": "" + }, + { + "source": "Pacific Northwest Gigapop", + "target": "StarLight", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Pacific Northwest Gigapop", + "target": "Internet 2", + "DollarValue": "Unkown", + "PartnerType": "Organization", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Pacific Northwest Gigapop", + "target": "Indiana University", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Pacific Northwest Gigapop", + "target": "SURA", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Pacific Northwest Gigapop", + "target": "NLR", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "MCS-Argonnne National Laboratory", + "target": "Indiana University", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "MCS-Argonnne National Laboratory", + "target": "StarLight", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "MCS-Argonnne National Laboratory", + "target": "Internet 2", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "MCS-Argonnne National Laboratory", + "target": "NLR", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "MCS-Argonnne National Laboratory", + "target": "TeraGrid-NSF", + "DollarValue": "Unkown", + "PartnerType": "Government", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Pacific Northwest Gigapop", + "target": "TransLight-NSF", + "DollarValue": "Unkown", + "PartnerType": "Government", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "MCS-Argonnne National Laboratory", + "target": "NorthWestern", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "MCS-Argonnne National Laboratory", + "target": "NSF-CISE", + "DollarValue": "Unkown", + "PartnerType": "Government", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "MCS-Argonnne National Laboratory", + "target": "NorthWestern", + "DollarValue": "Unkown", + "PartnerType": "Government", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "MCS-Argonnne National Laboratory", + "target": "Fermilab", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "CANARIE-Canada", + "target": "StarLight", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "CANARIE-Canada", + "target": "CENIC", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "CANARIE-Canada", + "target": "Internet 2", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "CANARIE-Canada", + "target": "CISCO", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "CANARIE-Canada", + "target": "EVL-UIUC", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "MCS-Argonnne National Laboratory", + "target": "EVL-UIUC", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "CANARIE-Canada", + "target": "CENIC", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Canada", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "SARA-Norway", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Netherlands", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "AAARNet-Australia", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Australia", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "GLORIAD", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "SurfNet-Netherlands", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Netherlands", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "CERNET-China", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "China", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "Janet-UK", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "UK", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "TeraGrid-NSF", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "CESNET-Czechoslovakia", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Czech", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "Juniper Networks, Inc", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "TERENA-Europe", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "EU", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "CIENA", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "TransLight-NSF", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "CISCO", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "KRLight-Korea", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Korea", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "FAST-California Institute of Technology", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "NSF-CISE", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "USLHCNet", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "NetherLight", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Netherlands", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "WIDE-Japan", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Japan", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "Global Netwave", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "StarLight", + "target": "NORDUnet", + "DollarValue": "Unkown", + "PartnerType": "Network", + "Country": "Netherlands", + "ActivityLevel": "" + }, + { + "source": "Indiana University", + "target": "NorthWestern", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Indiana University", + "target": "University of Maryland", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Indiana University", + "target": "NLR", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Indiana University", + "target": "NorthWestern", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Indiana University", + "target": "TeraGrid-NSF", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Indiana University", + "target": "NSF-CISE", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Indiana University", + "target": "University of Washington", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Calit2 UCSD", + "target": "University of Maryland", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Calit2 UCSD", + "target": "NLR", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Calit2 UCSD", + "target": "NorthWestern", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Calit2 UCSD", + "target": "TeraGrid-NSF", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Calit2 UCSD", + "target": "NSF-CISE", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Calit2 UCSD", + "target": "University of Washington", + "DollarValue": "Unkown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Calit2 UCSD", + "target": "Cisco", + "DollarValue": "Unkown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Calit2 UCSD", + "target": "Juniper Networks, Inc", + "DollarValue": "Unkown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Calit2 UCSD", + "target": "Cinegrid", + "DollarValue": "Unknown", + "PartnerType": "Organization", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Cinegrid", + "target": "Academy of Motion Picture Arts and Science", + "DollarValue": "Unknown", + "PartnerType": "Not for Profit", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "Cinegrid", + "target": "California Academy of Sciences", + "DollarValue": "Unknown", + "PartnerType": "Not for Profit", + "Country": "US", + "ActivityLevel": "c" + }, + { + "source": "Cinegrid", + "target": "Calit2", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "a" + }, + { + "source": "Cinegrid", + "target": "Cisco", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "Cinegrid", + "target": "CPqD-Brazil", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "Brazil", + "ActivityLevel": "b" + }, + { + "source": "Cinegrid", + "target": "Cyberport", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "c" + }, + { + "source": "Cinegrid", + "target": "Dark Strand", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "d" + }, + { + "source": "Cinegrid", + "target": "Digital Domain", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "d" + }, + { + "source": "Cinegrid", + "target": "EVL-UIUC", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "a" + }, + { + "source": "Cinegrid", + "target": "I2cat-Spain", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "Spain", + "ActivityLevel": "d" + }, + { + "source": "Cinegrid", + "target": "INGI-San Francisco State University", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "d" + }, + { + "source": "Cinegrid", + "target": "IntoPIX", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "Japan", + "ActivityLevel": "b" + }, + { + "source": "Cinegrid", + "target": "JVC America", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "Cinegrid", + "target": "KAIST", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "Korea", + "ActivityLevel": "d" + }, + { + "source": "Cinegrid", + "target": "Keio University DMC", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "Japan", + "ActivityLevel": "a" + }, + { + "source": "Cinegrid", + "target": "King Abdullah University of Science and Technology", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "SA", + "ActivityLevel": "c" + }, + { + "source": "Cinegrid", + "target": "KTH Royal Insitute of Techology", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "Sweden", + "ActivityLevel": "d" + }, + { + "source": "Cinegrid", + "target": "Louisiana State University", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "c" + }, + { + "source": "Cinegrid", + "target": "Lucasfilm", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "Calit2 UCSD", + "target": "Lucasfilm", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "Cinegrid", + "target": "MacKenzie", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "c" + }, + { + "source": "Cinegrid", + "target": "Mechdyne Corporation", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "c" + }, + { + "source": "Cinegrid", + "target": "Meyer Sound Lab", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "c" + }, + { + "source": "Calit2 UCSD", + "target": "Meyer Sound Lab", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "c" + }, + { + "source": "Cinegrid", + "target": "Naval Postgraduate School", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "Calit2 UCSD", + "target": "Naval Postgraduate School", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "Cinegrid", + "target": "NCSA-Illinois", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "Calit2 UCSD", + "target": "NCSA-Illinois", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "Cinegrid", + "target": "NetApp", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "d" + }, + { + "source": "Cinegrid", + "target": "NorthWestern", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "a" + }, + { + "source": "Cinegrid", + "target": "NTT", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "Japan", + "ActivityLevel": "a" + }, + { + "source": "Cinegrid", + "target": "Pacific Interface Inc", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "a" + }, + { + "source": "Cinegrid", + "target": "Poznan Superocmputing and Networking Center", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "Poland", + "ActivityLevel": "d" + }, + { + "source": "Cinegrid", + "target": "Renaissance Center North Carolina", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "d" + }, + { + "source": "Cinegrid", + "target": "Rogers Communications Center-Ryerson University", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "Canada", + "ActivityLevel": "d" + }, + { + "source": "Cinegrid", + "target": "SARA-Norway", + "DollarValue": "Unknown", + "PartnerType": "Network", + "Country": "Netherlands", + "ActivityLevel": "d" + }, + { + "source": "Cinegrid", + "target": "Sharp-Japan", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "Japan", + "ActivityLevel": "b" + }, + { + "source": "Cinegrid", + "target": "Sharp-USA", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "Cinegrid", + "target": "Sony", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "Japan", + "ActivityLevel": "a" + }, + { + "source": "Cinegrid", + "target": "Tohoku University", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "Japan", + "ActivityLevel": "d" + }, + { + "source": "Cinegrid", + "target": "Tulane University", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "d" + }, + { + "source": "Cinegrid", + "target": "University of Amsterdam", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "Netherlands", + "ActivityLevel": "a" + }, + { + "source": "Cinegrid", + "target": "University of Manitoba", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "Canada", + "ActivityLevel": "d" + }, + { + "source": "Cinegrid", + "target": "University of Southern California", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "c" + }, + { + "source": "Calit2 UCSD", + "target": "University of Southern California", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "c" + }, + { + "source": "Cinegrid", + "target": "University of Washington", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "c" + }, + { + "source": "Cinegrid", + "target": "WAAG Society", + "DollarValue": "Unknown", + "PartnerType": "Not for Profit", + "Country": "Netherlands", + "ActivityLevel": "d" + }, + { + "source": "Cinegrid", + "target": "Walt Disney Studios", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "Calit2 UCSD", + "target": "Walt Disney Studios", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "Academy of Motion Picture Arts and Sciences", + "target": "Pacific Interface Inc", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "a" + }, + { + "source": "Academy of Motion Picture Arts and Sciences", + "target": "California Academy of Sciences", + "DollarValue": "Unknown", + "PartnerType": "Not for Profit", + "Country": "US", + "ActivityLevel": "c" + }, + { + "source": "California Academy of Sciences", + "target": "Pacific Interface Inc", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "a" + }, + { + "source": "NTT", + "target": "Cinepost-Prague", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "Czech", + "ActivityLevel": "" + }, + { + "source": "Digital Domain", + "target": "Walt Disney Studios", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "NTT", + "target": "EVL-UIUC", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "a" + }, + { + "source": "EVL-UIUC", + "target": "Mechdyne Corporation", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "NTT", + "target": "Naval Postgraduate School", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "NTT", + "target": "Tohoku University", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "Japan", + "ActivityLevel": "" + }, + { + "source": "NTT", + "target": "Pacific Interface Inc", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "" + }, + { + "source": "Sharp-Japan", + "target": "EVL-UIUC", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "a" + }, + { + "source": "Sharp-USA", + "target": "EVL-UIUC", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "a" + }, + { + "source": "NTT", + "target": "University of Amsterdam", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "Netherlands", + "ActivityLevel": "a" + }, + { + "source": "University of Amsterdam", + "target": "WAAG Society", + "DollarValue": "Unknown", + "PartnerType": "Not for Profit", + "Country": "Netherlands", + "ActivityLevel": "c" + }, + { + "source": "NTT", + "target": "USC", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "US", + "ActivityLevel": "c" + }, + { + "source": "Calit2 UCSD", + "target": "King Abdullah University of Science and Technology", + "DollarValue": "Unknown", + "PartnerType": "Academic", + "Country": "SA", + "ActivityLevel": "c" + }, + { + "source": "Calit2 UCSD", + "target": "Cisco", + "DollarValue": "Unknown", + "PartnerType": "Industry", + "Country": "US", + "ActivityLevel": "b" + }, + { + "source": "Calit2 UCSD", + "target": "Korea Electronics Technology Institute", + "DollarValue": "$1,000,000", + "PartnerType": "Government", + "Country": "Korea", + "ActivityLevel": "a" + } +] \ No newline at end of file diff --git a/projects/Data Visualization Software Java Project/Data Visualization/IntlNodesSimple.json b/projects/Data Visualization Software Java Project/Data Visualization/IntlNodesSimple.json new file mode 100644 index 0000000..df4d5d4 --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/IntlNodesSimple.json @@ -0,0 +1,1247 @@ +[ + { + "name": "Calit2 UCI", + "size": "b", + "imports": "City of Daegu, Korea" + }, + { + "name": "Calit2 UCI", + "size": "b", + "imports": "Embassy of France" + }, + { + "name": "Calit2 UCSD", + "size": "c", + "imports": "Thetis, SPA" + }, + { + "name": "Calit2 UCSD", + "size": "a", + "imports": "King Abdulaziz City for Science and Technology" + }, + { + "name": "Calit2 UCSD", + "size": "b", + "imports": "King Abdullah University of Science and Technology" + }, + { + "name": "Calit2 UCSD", + "size": "c", + "imports": "United Kingdom" + }, + { + "name": "Calit2 UCSD", + "size": "a", + "imports": "CONACYT" + }, + { + "name": "Calit2 UCSD", + "size": "a", + "imports": "PRAGMA" + }, + { + "name": "PRAGMA", + "size": "a", + "imports": "Cybermedia Center and Research Center for Ultra-high Voltage Electron Microscopy, Osaka University" + }, + { + "name": "PRAGMA", + "size": "a", + "imports": "Monash University" + }, + { + "name": "PRAGMA", + "size": "a", + "imports": "National Center for Higher Performance Computing-Taiwan" + }, + { + "name": "PRAGMA", + "size": "a", + "imports": "National Institute of Advanced Industrial Science and Technology-Japan" + }, + { + "name": "PRAGMA", + "size": "a", + "imports": "UCSD" + }, + { + "name": "PRAGMA", + "size": "b", + "imports": "Center for Computational Sciences, University of Tsukuba" + }, + { + "name": "PRAGMA", + "size": "b", + "imports": "College of Computer Science and Technology, Jilin University" + }, + { + "name": "PRAGMA", + "size": "b", + "imports": "Computer Network Information Center, Chinese Academy of Sciences" + }, + { + "name": "PRAGMA", + "size": "b", + "imports": "University of Hong Kong" + }, + { + "name": "PRAGMA", + "size": "b", + "imports": "Kasetsart University" + }, + { + "name": "PRAGMA", + "size": "b", + "imports": "Konkuk University" + }, + { + "name": "PRAGMA", + "size": "b", + "imports": "Korea Institute of Science and Technology Information" + }, + { + "name": "PRAGMA", + "size": "b", + "imports": "National Electronics and Computer Technology Center-Thailand" + }, + { + "name": "PRAGMA", + "size": "b", + "imports": "TransPAC2, Indiana" + }, + { + "name": "PRAGMA", + "size": "b", + "imports": "Universiti Sains Malaysia" + }, + { + "name": "PRAGMA", + "size": "b", + "imports": "University of Hyderabad" + }, + { + "name": "PRAGMA", + "size": "c", + "imports": "Malaysian Institute of Microelectronic Systems (MIMOS)" + }, + { + "name": "PRAGMA", + "size": "c", + "imports": "Academia Sinica Grid Computing Center-Taiwan" + }, + { + "name": "PRAGMA", + "size": "c", + "imports": "Advanced Science and Technology Institute-Phillipines" + }, + { + "name": "PRAGMA", + "size": "c", + "imports": "BestGrid New Zealand" + }, + { + "name": "PRAGMA", + "size": "c", + "imports": "Hanoi University of Technology" + }, + { + "name": "PRAGMA", + "size": "c", + "imports": "Ho Chi Minh City University of Technology" + }, + { + "name": "PRAGMA", + "size": "c", + "imports": "Institue for Information Technology-Vietnam" + }, + { + "name": "PRAGMA", + "size": "c", + "imports": "Star Tap, Translight" + }, + { + "name": "PRAGMA", + "size": "d", + "imports": "Asia Pacific Advanced Network-Japan" + }, + { + "name": "PRAGMA", + "size": "d", + "imports": "Centro de Invertigacion Cientifica y de Educacion Superior de Ensenada (CICESE)" + }, + { + "name": "PRAGMA", + "size": "d", + "imports": "Global Scientific Information and Computing Center, Tokyo Institute of Technology" + }, + { + "name": "PRAGMA", + "size": "d", + "imports": "Institute for High Performance Computing-Singapore" + }, + { + "name": "PRAGMA", + "size": "d", + "imports": "Pacific Northwest Gigapop" + }, + { + "name": "PRAGMA", + "size": "E", + "imports": "Bioinformatics Institute Singapore (BII" + }, + { + "name": "PRAGMA", + "size": "E", + "imports": "National Agricultural Research Center-Japan" + }, + { + "name": "PRAGMA", + "size": "E", + "imports": "National Center for Supercomputing Applications-Illinois" + }, + { + "name": "PRAGMA", + "size": "E", + "imports": "National Grid Office-Singapore" + }, + { + "name": "PRAGMA", + "size": "E", + "imports": "Computational Science and Engineering Online, University of Utah" + }, + { + "name": "PRAGMA", + "size": "E", + "imports": "CRAY" + }, + { + "name": "PRAGMA", + "size": "E", + "imports": "Korea Basic Science Institute" + }, + { + "name": "PRAGMA", + "size": "E", + "imports": "Thai National Grid Center-Thailand" + }, + { + "name": "PRAGMA", + "size": "b", + "imports": "Indiana University" + }, + { + "name": "PRAGMA", + "size": "b", + "imports": "University of Florida" + }, + { + "name": "PRAGMA", + "size": "b", + "imports": "University of Wisconsin" + }, + { + "name": "PRAGMA", + "size": "b", + "imports": "Lan Zhou University" + }, + { + "name": "PRAGMA", + "size": "b", + "imports": "NICT" + }, + { + "name": "PRAGMA", + "size": "c", + "imports": "Kookmin University" + }, + { + "name": "PRAGMA", + "size": "c", + "imports": "CeNAT-ITCR" + }, + { + "name": "PRAGMA", + "size": "c", + "imports": "U Chile" + }, + { + "name": "PRAGMA", + "size": "c", + "imports": "U Zurich" + }, + { + "name": "PRAGMA", + "size": "d", + "imports": "National Applied Research Laboratories" + }, + { + "name": "PRAGMA", + "size": "a", + "imports": "UCSD: Center for Research in Biological Systems" + }, + { + "name": "PRAGMA", + "size": "a", + "imports": "UCSD: National Biomedical Computation Resource" + }, + { + "name": "PRAGMA", + "size": "a", + "imports": "UCSD: National Center for Microscopy and Imaging Research" + }, + { + "name": "PRAGMA", + "size": "a", + "imports": "UCSD: San Diego Supercomputing Center" + }, + { + "name": "PRAGMA", + "size": "a", + "imports": "UCSD: Calit2" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "AAARNet-Australia" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "GLORIAD" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "Pacific Northwest Gigapop" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "AMPATH" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "HEAnet-Ireland" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "Poznan Superocmputing and Networking Center" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "ANSP-Brazil" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "I2cat-Spain" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "RIPN-Russia" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "MCS-Argonnne National Laboratory" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "iCAIR" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "RNP-Brazil" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "International Educational Equal Access Foundation" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "SARA-Norway" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "CANARIE-Canada" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "Indiana University" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "StarLight" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "CENIC" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "Internet 2" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "SURA" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "CERN" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "JGN-II-Japan" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "SurfNet-Netherlands" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "CERNET-China" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "Janet-UK" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "TeraGrid-NSF" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "CESNET-Czechoslovakia" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "Juniper Networks, Inc" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "TERENA-Europe" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "CIENA" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "King Abdullah University of Science and Technology" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "TransLight-NSF" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "CISCO" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "KRLight-Korea" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "TWAREN-Taiwan" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "CPqD-Brazil" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "MIT" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "University of Amsterdam" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "CSTNET-China" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "MCNC-North Carolina" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "EVL-UIUC" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "DFN-Germany" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "MAX-Mid Atlantic" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "University College London" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "E-ARENA-Russia" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "NLR" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "University of Maryland" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "ESNET" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "Naval Postgraduate School" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "University of Washington" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "Extreme Networks" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "NorthWestern" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "UltraLight-US/CERN" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "FAST-California Institute of Technology" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "NSF-CISE" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "USLHCNet" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "Fermilab" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "NetherLight" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "WIDE-Japan" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "Global Netwave" + }, + { + "name": "Global Lambda Integrated Facility", + "size": "", + "imports": "NORDUnet" + }, + { + "name": "Pacific Northwest Gigapop", + "size": "", + "imports": "CENIC" + }, + { + "name": "Pacific Northwest Gigapop", + "size": "", + "imports": "CANARIE-Canada" + }, + { + "name": "Pacific Northwest Gigapop", + "size": "", + "imports": "StarLight" + }, + { + "name": "Pacific Northwest Gigapop", + "size": "", + "imports": "Internet 2" + }, + { + "name": "Pacific Northwest Gigapop", + "size": "", + "imports": "Indiana University" + }, + { + "name": "Pacific Northwest Gigapop", + "size": "", + "imports": "SURA" + }, + { + "name": "Pacific Northwest Gigapop", + "size": "", + "imports": "NLR" + }, + { + "name": "MCS-Argonnne National Laboratory", + "size": "", + "imports": "Indiana University" + }, + { + "name": "MCS-Argonnne National Laboratory", + "size": "", + "imports": "StarLight" + }, + { + "name": "MCS-Argonnne National Laboratory", + "size": "", + "imports": "Internet 2" + }, + { + "name": "MCS-Argonnne National Laboratory", + "size": "", + "imports": "NLR" + }, + { + "name": "MCS-Argonnne National Laboratory", + "size": "", + "imports": "TeraGrid-NSF" + }, + { + "name": "Pacific Northwest Gigapop", + "size": "", + "imports": "TransLight-NSF" + }, + { + "name": "MCS-Argonnne National Laboratory", + "size": "", + "imports": "NorthWestern" + }, + { + "name": "MCS-Argonnne National Laboratory", + "size": "", + "imports": "NSF-CISE" + }, + { + "name": "MCS-Argonnne National Laboratory", + "size": "", + "imports": "NorthWestern" + }, + { + "name": "MCS-Argonnne National Laboratory", + "size": "", + "imports": "Fermilab" + }, + { + "name": "CANARIE-Canada", + "size": "", + "imports": "StarLight" + }, + { + "name": "CANARIE-Canada", + "size": "", + "imports": "CENIC" + }, + { + "name": "CANARIE-Canada", + "size": "", + "imports": "Internet 2" + }, + { + "name": "CANARIE-Canada", + "size": "", + "imports": "CISCO" + }, + { + "name": "CANARIE-Canada", + "size": "", + "imports": "EVL-UIUC" + }, + { + "name": "MCS-Argonnne National Laboratory", + "size": "", + "imports": "EVL-UIUC" + }, + { + "name": "CANARIE-Canada", + "size": "", + "imports": "CENIC" + }, + { + "name": "StarLight", + "size": "", + "imports": "SARA-Norway" + }, + { + "name": "StarLight", + "size": "", + "imports": "AAARNet-Australia" + }, + { + "name": "StarLight", + "size": "", + "imports": "GLORIAD" + }, + { + "name": "StarLight", + "size": "", + "imports": "SurfNet-Netherlands" + }, + { + "name": "StarLight", + "size": "", + "imports": "CERNET-China" + }, + { + "name": "StarLight", + "size": "", + "imports": "Janet-UK" + }, + { + "name": "StarLight", + "size": "", + "imports": "TeraGrid-NSF" + }, + { + "name": "StarLight", + "size": "", + "imports": "CESNET-Czechoslovakia" + }, + { + "name": "StarLight", + "size": "", + "imports": "Juniper Networks, Inc" + }, + { + "name": "StarLight", + "size": "", + "imports": "TERENA-Europe" + }, + { + "name": "StarLight", + "size": "", + "imports": "CIENA" + }, + { + "name": "StarLight", + "size": "", + "imports": "TransLight-NSF" + }, + { + "name": "StarLight", + "size": "", + "imports": "CISCO" + }, + { + "name": "StarLight", + "size": "", + "imports": "KRLight-Korea" + }, + { + "name": "StarLight", + "size": "", + "imports": "FAST-California Institute of Technology" + }, + { + "name": "StarLight", + "size": "", + "imports": "NSF-CISE" + }, + { + "name": "StarLight", + "size": "", + "imports": "USLHCNet" + }, + { + "name": "StarLight", + "size": "", + "imports": "NetherLight" + }, + { + "name": "StarLight", + "size": "", + "imports": "WIDE-Japan" + }, + { + "name": "StarLight", + "size": "", + "imports": "Global Netwave" + }, + { + "name": "StarLight", + "size": "", + "imports": "NORDUnet" + }, + { + "name": "Indiana University", + "size": "", + "imports": "NorthWestern" + }, + { + "name": "Indiana University", + "size": "", + "imports": "University of Maryland" + }, + { + "name": "Indiana University", + "size": "", + "imports": "NLR" + }, + { + "name": "Indiana University", + "size": "", + "imports": "NorthWestern" + }, + { + "name": "Indiana University", + "size": "", + "imports": "TeraGrid-NSF" + }, + { + "name": "Indiana University", + "size": "", + "imports": "NSF-CISE" + }, + { + "name": "Indiana University", + "size": "", + "imports": "University of Washington" + }, + { + "name": "Calit2 UCSD", + "size": "", + "imports": "University of Maryland" + }, + { + "name": "Calit2 UCSD", + "size": "", + "imports": "NLR" + }, + { + "name": "Calit2 UCSD", + "size": "", + "imports": "NorthWestern" + }, + { + "name": "Calit2 UCSD", + "size": "", + "imports": "TeraGrid-NSF" + }, + { + "name": "Calit2 UCSD", + "size": "", + "imports": "NSF-CISE" + }, + { + "name": "Calit2 UCSD", + "size": "", + "imports": "University of Washington" + }, + { + "name": "Calit2 UCSD", + "size": "", + "imports": "Cisco" + }, + { + "name": "Calit2 UCSD", + "size": "", + "imports": "Juniper Networks, Inc" + }, + { + "name": "Calit2 UCSD", + "size": "", + "imports": "Cinegrid" + }, + { + "name": "Cinegrid", + "size": "b", + "imports": "Academy of Motion Picture Arts and Science" + }, + { + "name": "Cinegrid", + "size": "c", + "imports": "California Academy of Sciences" + }, + { + "name": "Cinegrid", + "size": "a", + "imports": "Calit2" + }, + { + "name": "Cinegrid", + "size": "b", + "imports": "Cisco" + }, + { + "name": "Cinegrid", + "size": "b", + "imports": "CPqD-Brazil" + }, + { + "name": "Cinegrid", + "size": "c", + "imports": "Cyberport" + }, + { + "name": "Cinegrid", + "size": "d", + "imports": "Dark Strand" + }, + { + "name": "Cinegrid", + "size": "d", + "imports": "Digital Domain" + }, + { + "name": "Cinegrid", + "size": "a", + "imports": "EVL-UIUC" + }, + { + "name": "Cinegrid", + "size": "d", + "imports": "I2cat-Spain" + }, + { + "name": "Cinegrid", + "size": "d", + "imports": "INGI-San Francisco State University" + }, + { + "name": "Cinegrid", + "size": "b", + "imports": "IntoPIX" + }, + { + "name": "Cinegrid", + "size": "b", + "imports": "JVC America" + }, + { + "name": "Cinegrid", + "size": "d", + "imports": "KAIST" + }, + { + "name": "Cinegrid", + "size": "a", + "imports": "Keio University DMC" + }, + { + "name": "Cinegrid", + "size": "c", + "imports": "King Abdullah University of Science and Technology" + }, + { + "name": "Cinegrid", + "size": "d", + "imports": "KTH Royal Insitute of Techology" + }, + { + "name": "Cinegrid", + "size": "c", + "imports": "Louisiana State University" + }, + { + "name": "Cinegrid", + "size": "b", + "imports": "Lucasfilm" + }, + { + "name": "Calit2 UCSD", + "size": "b", + "imports": "Lucasfilm" + }, + { + "name": "Cinegrid", + "size": "c", + "imports": "MacKenzie" + }, + { + "name": "Cinegrid", + "size": "c", + "imports": "Mechdyne Corporation" + }, + { + "name": "Cinegrid", + "size": "c", + "imports": "Meyer Sound Lab" + }, + { + "name": "Calit2 UCSD", + "size": "c", + "imports": "Meyer Sound Lab" + }, + { + "name": "Cinegrid", + "size": "b", + "imports": "Naval Postgraduate School" + }, + { + "name": "Calit2 UCSD", + "size": "b", + "imports": "Naval Postgraduate School" + }, + { + "name": "Cinegrid", + "size": "b", + "imports": "NCSA-Illinois" + }, + { + "name": "Calit2 UCSD", + "size": "b", + "imports": "NCSA-Illinois" + }, + { + "name": "Cinegrid", + "size": "d", + "imports": "NetApp" + }, + { + "name": "Cinegrid", + "size": "a", + "imports": "NorthWestern" + }, + { + "name": "Cinegrid", + "size": "a", + "imports": "NTT" + }, + { + "name": "Cinegrid", + "size": "a", + "imports": "Pacific Interface Inc" + }, + { + "name": "Cinegrid", + "size": "d", + "imports": "Poznan Superocmputing and Networking Center" + }, + { + "name": "Cinegrid", + "size": "d", + "imports": "Renaissance Center North Carolina" + }, + { + "name": "Cinegrid", + "size": "d", + "imports": "Rogers Communications Center-Ryerson University" + }, + { + "name": "Cinegrid", + "size": "d", + "imports": "SARA-Norway" + }, + { + "name": "Cinegrid", + "size": "b", + "imports": "Sharp-Japan" + }, + { + "name": "Cinegrid", + "size": "b", + "imports": "Sharp-USA" + }, + { + "name": "Cinegrid", + "size": "a", + "imports": "Sony" + }, + { + "name": "Cinegrid", + "size": "d", + "imports": "Tohoku University" + }, + { + "name": "Cinegrid", + "size": "d", + "imports": "Tulane University" + }, + { + "name": "Cinegrid", + "size": "a", + "imports": "University of Amsterdam" + }, + { + "name": "Cinegrid", + "size": "d", + "imports": "University of Manitoba" + }, + { + "name": "Cinegrid", + "size": "c", + "imports": "University of Southern California" + }, + { + "name": "Calit2 UCSD", + "size": "c", + "imports": "University of Southern California" + }, + { + "name": "Cinegrid", + "size": "c", + "imports": "University of Washington" + }, + { + "name": "Cinegrid", + "size": "d", + "imports": "WAAG Society" + }, + { + "name": "Cinegrid", + "size": "b", + "imports": "Walt Disney Studios" + }, + { + "name": "Calit2 UCSD", + "size": "b", + "imports": "Walt Disney Studios" + }, + { + "name": "Academy of Motion Picture Arts and Sciences", + "size": "a", + "imports": "Pacific Interface Inc" + }, + { + "name": "Academy of Motion Picture Arts and Sciences", + "size": "c", + "imports": "California Academy of Sciences" + }, + { + "name": "California Academy of Sciences", + "size": "a", + "imports": "Pacific Interface Inc" + }, + { + "name": "NTT", + "size": "", + "imports": "Cinepost-Prague" + }, + { + "name": "Digital Domain", + "size": "", + "imports": "Walt Disney Studios" + }, + { + "name": "NTT", + "size": "a", + "imports": "EVL-UIUC" + }, + { + "name": "EVL-UIUC", + "size": "", + "imports": "Mechdyne Corporation" + }, + { + "name": "NTT", + "size": "b", + "imports": "Naval Postgraduate School" + }, + { + "name": "NTT", + "size": "", + "imports": "Tohoku University" + }, + { + "name": "NTT", + "size": "", + "imports": "Pacific Interface Inc" + }, + { + "name": "Sharp-Japan", + "size": "a", + "imports": "EVL-UIUC" + }, + { + "name": "Sharp-USA", + "size": "a", + "imports": "EVL-UIUC" + }, + { + "name": "NTT", + "size": "a", + "imports": "University of Amsterdam" + }, + { + "name": "University of Amsterdam", + "size": "c", + "imports": "WAAG Society" + }, + { + "name": "NTT", + "size": "c", + "imports": "USC" + }, + { + "name": "Calit2 UCSD", + "size": "c", + "imports": "King Abdullah University of Science and Technology" + }, + { + "name": "Calit2 UCSD", + "size": "b", + "imports": "Cisco" + }, + { + "name": "Calit2 UCSD", + "size": "a", + "imports": "Korea Electronics Technology Institute" + } +] \ No newline at end of file diff --git a/projects/Data Visualization Software Java Project/Data Visualization/d3.chart.js b/projects/Data Visualization Software Java Project/Data Visualization/d3.chart.js new file mode 100644 index 0000000..281d007 --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/d3.chart.js @@ -0,0 +1,984 @@ +(function(){d3.chart = {}; +// Inspired by http://informationandvisualization.de/blog/box-plot +d3.chart.box = function() { + var width = 1, + height = 1, + duration = 0, + domain = null, + value = Number, + whiskers = d3_chart_boxWhiskers, + quartiles = d3_chart_boxQuartiles, + tickFormat = null; + + // For each small multiple… + function box(g) { + g.each(function(d, i) { + d = d.map(value).sort(d3.ascending); + var g = d3.select(this), + n = d.length, + min = d[0], + max = d[n - 1]; + + // Compute quartiles. Must return exactly 3 elements. + var quartileData = d.quartiles = quartiles(d); + + // Compute whiskers. Must return exactly 2 elements, or null. + var whiskerIndices = whiskers && whiskers.call(this, d, i), + whiskerData = whiskerIndices && whiskerIndices.map(function(i) { return d[i]; }); + + // Compute outliers. If no whiskers are specified, all data are "outliers". + // We compute the outliers as indices, so that we can join across transitions! + var outlierIndices = whiskerIndices + ? d3.range(0, whiskerIndices[0]).concat(d3.range(whiskerIndices[1] + 1, n)) + : d3.range(n); + + // Compute the new x-scale. + var x1 = d3.scale.linear() + .domain(domain && domain.call(this, d, i) || [min, max]) + .range([height, 0]); + + // Retrieve the old x-scale, if this is an update. + var x0 = this.__chart__ || d3.scale.linear() + .domain([0, Infinity]) + .range(x1.range()); + + // Stash the new scale. + this.__chart__ = x1; + + // Note: the box, median, and box tick elements are fixed in number, + // so we only have to handle enter and update. In contrast, the outliers + // and other elements are variable, so we need to exit them! Variable + // elements also fade in and out. + + // Update center line: the vertical line spanning the whiskers. + var center = g.selectAll("line.center") + .data(whiskerData ? [whiskerData] : []); + + center.enter().insert("svg:line", "rect") + .attr("class", "center") + .attr("x1", width / 2) + .attr("y1", function(d) { return x0(d[0]); }) + .attr("x2", width / 2) + .attr("y2", function(d) { return x0(d[1]); }) + .style("opacity", 1e-6) + .transition() + .duration(duration) + .style("opacity", 1) + .attr("y1", function(d) { return x1(d[0]); }) + .attr("y2", function(d) { return x1(d[1]); }); + + center.transition() + .duration(duration) + .style("opacity", 1) + .attr("y1", function(d) { return x1(d[0]); }) + .attr("y2", function(d) { return x1(d[1]); }); + + center.exit().transition() + .duration(duration) + .style("opacity", 1e-6) + .attr("y1", function(d) { return x1(d[0]); }) + .attr("y2", function(d) { return x1(d[1]); }) + .remove(); + + // Update innerquartile box. + var box = g.selectAll("rect.box") + .data([quartileData]); + + box.enter().append("svg:rect") + .attr("class", "box") + .attr("x", 0) + .attr("y", function(d) { return x0(d[2]); }) + .attr("width", width) + .attr("height", function(d) { return x0(d[0]) - x0(d[2]); }) + .transition() + .duration(duration) + .attr("y", function(d) { return x1(d[2]); }) + .attr("height", function(d) { return x1(d[0]) - x1(d[2]); }); + + box.transition() + .duration(duration) + .attr("y", function(d) { return x1(d[2]); }) + .attr("height", function(d) { return x1(d[0]) - x1(d[2]); }); + + // Update median line. + var medianLine = g.selectAll("line.median") + .data([quartileData[1]]); + + medianLine.enter().append("svg:line") + .attr("class", "median") + .attr("x1", 0) + .attr("y1", x0) + .attr("x2", width) + .attr("y2", x0) + .transition() + .duration(duration) + .attr("y1", x1) + .attr("y2", x1); + + medianLine.transition() + .duration(duration) + .attr("y1", x1) + .attr("y2", x1); + + // Update whiskers. + var whisker = g.selectAll("line.whisker") + .data(whiskerData || []); + + whisker.enter().insert("svg:line", "circle, text") + .attr("class", "whisker") + .attr("x1", 0) + .attr("y1", x0) + .attr("x2", width) + .attr("y2", x0) + .style("opacity", 1e-6) + .transition() + .duration(duration) + .attr("y1", x1) + .attr("y2", x1) + .style("opacity", 1); + + whisker.transition() + .duration(duration) + .attr("y1", x1) + .attr("y2", x1) + .style("opacity", 1); + + whisker.exit().transition() + .duration(duration) + .attr("y1", x1) + .attr("y2", x1) + .style("opacity", 1e-6) + .remove(); + + // Update outliers. + var outlier = g.selectAll("circle.outlier") + .data(outlierIndices, Number); + + outlier.enter().insert("svg:circle", "text") + .attr("class", "outlier") + .attr("r", 5) + .attr("cx", width / 2) + .attr("cy", function(i) { return x0(d[i]); }) + .style("opacity", 1e-6) + .transition() + .duration(duration) + .attr("cy", function(i) { return x1(d[i]); }) + .style("opacity", 1); + + outlier.transition() + .duration(duration) + .attr("cy", function(i) { return x1(d[i]); }) + .style("opacity", 1); + + outlier.exit().transition() + .duration(duration) + .attr("cy", function(i) { return x1(d[i]); }) + .style("opacity", 1e-6) + .remove(); + + // Compute the tick format. + var format = tickFormat || x1.tickFormat(8); + + // Update box ticks. + var boxTick = g.selectAll("text.box") + .data(quartileData); + + boxTick.enter().append("svg:text") + .attr("class", "box") + .attr("dy", ".3em") + .attr("dx", function(d, i) { return i & 1 ? 6 : -6 }) + .attr("x", function(d, i) { return i & 1 ? width : 0 }) + .attr("y", x0) + .attr("text-anchor", function(d, i) { return i & 1 ? "start" : "end"; }) + .text(format) + .transition() + .duration(duration) + .attr("y", x1); + + boxTick.transition() + .duration(duration) + .text(format) + .attr("y", x1); + + // Update whisker ticks. These are handled separately from the box + // ticks because they may or may not exist, and we want don't want + // to join box ticks pre-transition with whisker ticks post-. + var whiskerTick = g.selectAll("text.whisker") + .data(whiskerData || []); + + whiskerTick.enter().append("svg:text") + .attr("class", "whisker") + .attr("dy", ".3em") + .attr("dx", 6) + .attr("x", width) + .attr("y", x0) + .text(format) + .style("opacity", 1e-6) + .transition() + .duration(duration) + .attr("y", x1) + .style("opacity", 1); + + whiskerTick.transition() + .duration(duration) + .text(format) + .attr("y", x1) + .style("opacity", 1); + + whiskerTick.exit().transition() + .duration(duration) + .attr("y", x1) + .style("opacity", 1e-6) + .remove(); + }); + d3.timer.flush(); + } + + box.width = function(x) { + if (!arguments.length) return width; + width = x; + return box; + }; + + box.height = function(x) { + if (!arguments.length) return height; + height = x; + return box; + }; + + box.tickFormat = function(x) { + if (!arguments.length) return tickFormat; + tickFormat = x; + return box; + }; + + box.duration = function(x) { + if (!arguments.length) return duration; + duration = x; + return box; + }; + + box.domain = function(x) { + if (!arguments.length) return domain; + domain = x == null ? x : d3.functor(x); + return box; + }; + + box.value = function(x) { + if (!arguments.length) return value; + value = x; + return box; + }; + + box.whiskers = function(x) { + if (!arguments.length) return whiskers; + whiskers = x; + return box; + }; + + box.quartiles = function(x) { + if (!arguments.length) return quartiles; + quartiles = x; + return box; + }; + + return box; +}; + +function d3_chart_boxWhiskers(d) { + return [0, d.length - 1]; +} + +function d3_chart_boxQuartiles(d) { + return [ + d3.quantile(d, .25), + d3.quantile(d, .5), + d3.quantile(d, .75) + ]; +} +// Chart design based on the recommendations of Stephen Few. Implementation +// based on the work of Clint Ivy, Jamie Love, and Jason Davies. +// http://projects.instantcognition.com/protovis/bulletchart/ +d3.chart.bullet = function() { + var orient = "left", // TODO top & bottom + reverse = false, + duration = 0, + ranges = d3_chart_bulletRanges, + markers = d3_chart_bulletMarkers, + measures = d3_chart_bulletMeasures, + width = 380, + height = 30, + tickFormat = null; + + // For each small multiple… + function bullet(g) { + g.each(function(d, i) { + var rangez = ranges.call(this, d, i).slice().sort(d3.descending), + markerz = markers.call(this, d, i).slice().sort(d3.descending), + measurez = measures.call(this, d, i).slice().sort(d3.descending), + g = d3.select(this); + + // Compute the new x-scale. + var x1 = d3.scale.linear() + .domain([0, Math.max(rangez[0], markerz[0], measurez[0])]) + .range(reverse ? [width, 0] : [0, width]); + + // Retrieve the old x-scale, if this is an update. + var x0 = this.__chart__ || d3.scale.linear() + .domain([0, Infinity]) + .range(x1.range()); + + // Stash the new scale. + this.__chart__ = x1; + + // Derive width-scales from the x-scales. + var w0 = d3_chart_bulletWidth(x0), + w1 = d3_chart_bulletWidth(x1); + + // Update the range rects. + var range = g.selectAll("rect.range") + .data(rangez); + + range.enter().append("svg:rect") + .attr("class", function(d, i) { return "range s" + i; }) + .attr("width", w0) + .attr("height", height) + .attr("x", reverse ? x0 : 0) + .transition() + .duration(duration) + .attr("width", w1) + .attr("x", reverse ? x1 : 0); + + range.transition() + .duration(duration) + .attr("x", reverse ? x1 : 0) + .attr("width", w1) + .attr("height", height); + + // Update the measure rects. + var measure = g.selectAll("rect.measure") + .data(measurez); + + measure.enter().append("svg:rect") + .attr("class", function(d, i) { return "measure s" + i; }) + .attr("width", w0) + .attr("height", height / 3) + .attr("x", reverse ? x0 : 0) + .attr("y", height / 3) + .transition() + .duration(duration) + .attr("width", w1) + .attr("x", reverse ? x1 : 0); + + measure.transition() + .duration(duration) + .attr("width", w1) + .attr("height", height / 3) + .attr("x", reverse ? x1 : 0) + .attr("y", height / 3); + + // Update the marker lines. + var marker = g.selectAll("line.marker") + .data(markerz); + + marker.enter().append("svg:line") + .attr("class", "marker") + .attr("x1", x0) + .attr("x2", x0) + .attr("y1", height / 6) + .attr("y2", height * 5 / 6) + .transition() + .duration(duration) + .attr("x1", x1) + .attr("x2", x1); + + marker.transition() + .duration(duration) + .attr("x1", x1) + .attr("x2", x1) + .attr("y1", height / 6) + .attr("y2", height * 5 / 6); + + // Compute the tick format. + var format = tickFormat || x1.tickFormat(8); + + // Update the tick groups. + var tick = g.selectAll("g.tick") + .data(x1.ticks(8), function(d) { + return this.textContent || format(d); + }); + + // Initialize the ticks with the old scale, x0. + var tickEnter = tick.enter().append("svg:g") + .attr("class", "tick") + .attr("transform", d3_chart_bulletTranslate(x0)) + .style("opacity", 1e-6); + + tickEnter.append("svg:line") + .attr("y1", height) + .attr("y2", height * 7 / 6); + + tickEnter.append("svg:text") + .attr("text-anchor", "middle") + .attr("dy", "1em") + .attr("y", height * 7 / 6) + .text(format); + + // Transition the entering ticks to the new scale, x1. + tickEnter.transition() + .duration(duration) + .attr("transform", d3_chart_bulletTranslate(x1)) + .style("opacity", 1); + + // Transition the updating ticks to the new scale, x1. + var tickUpdate = tick.transition() + .duration(duration) + .attr("transform", d3_chart_bulletTranslate(x1)) + .style("opacity", 1); + + tickUpdate.select("line") + .attr("y1", height) + .attr("y2", height * 7 / 6); + + tickUpdate.select("text") + .attr("y", height * 7 / 6); + + // Transition the exiting ticks to the new scale, x1. + tick.exit().transition() + .duration(duration) + .attr("transform", d3_chart_bulletTranslate(x1)) + .style("opacity", 1e-6) + .remove(); + }); + d3.timer.flush(); + } + + // left, right, top, bottom + bullet.orient = function(x) { + if (!arguments.length) return orient; + orient = x; + reverse = orient == "right" || orient == "bottom"; + return bullet; + }; + + // ranges (bad, satisfactory, good) + bullet.ranges = function(x) { + if (!arguments.length) return ranges; + ranges = x; + return bullet; + }; + + // markers (previous, goal) + bullet.markers = function(x) { + if (!arguments.length) return markers; + markers = x; + return bullet; + }; + + // measures (actual, forecast) + bullet.measures = function(x) { + if (!arguments.length) return measures; + measures = x; + return bullet; + }; + + bullet.width = function(x) { + if (!arguments.length) return width; + width = x; + return bullet; + }; + + bullet.height = function(x) { + if (!arguments.length) return height; + height = x; + return bullet; + }; + + bullet.tickFormat = function(x) { + if (!arguments.length) return tickFormat; + tickFormat = x; + return bullet; + }; + + bullet.duration = function(x) { + if (!arguments.length) return duration; + duration = x; + return bullet; + }; + + return bullet; +}; + +function d3_chart_bulletRanges(d) { + return d.ranges; +} + +function d3_chart_bulletMarkers(d) { + return d.markers; +} + +function d3_chart_bulletMeasures(d) { + return d.measures; +} + +function d3_chart_bulletTranslate(x) { + return function(d) { + return "translate(" + x(d) + ",0)"; + }; +} + +function d3_chart_bulletWidth(x) { + var x0 = x(0); + return function(d) { + return Math.abs(x(d) - x0); + }; +} +// Implements a horizon layout, which is a variation of a single-series +// area chart where the area is folded into multiple bands. Color is used to +// encode band, allowing the size of the chart to be reduced significantly +// without impeding readability. This layout algorithm is based on the work of +// J. Heer, N. Kong and M. Agrawala in "Sizing the Horizon: The Effects of Chart +// Size and Layering on the Graphical Perception of Time Series Visualizations", +// CHI 2009. http://hci.stanford.edu/publications/2009/heer-horizon-chi09.pdf +d3.chart.horizon = function() { + var bands = 1, // between 1 and 5, typically + mode = "offset", // or mirror + interpolate = "linear", // or basis, monotone, step-before, etc. + x = d3_chart_horizonX, + y = d3_chart_horizonY, + w = 960, + h = 40, + duration = 0; + + var color = d3.scale.linear() + .domain([-1, 0, 1]) + .range(["#d62728", "#fff", "#1f77b4"]); + + // For each small multiple… + function horizon(g) { + g.each(function(d, i) { + var g = d3.select(this), + n = 2 * bands + 1, + xMin = Infinity, + xMax = -Infinity, + yMax = -Infinity, + x0, // old x-scale + y0, // old y-scale + id; // unique id for paths + + // Compute x- and y-values along with extents. + var data = d.map(function(d, i) { + var xv = x.call(this, d, i), + yv = y.call(this, d, i); + if (xv < xMin) xMin = xv; + if (xv > xMax) xMax = xv; + if (-yv > yMax) yMax = -yv; + if (yv > yMax) yMax = yv; + return [xv, yv]; + }); + + // Compute the new x- and y-scales. + var x1 = d3.scale.linear().domain([xMin, xMax]).range([0, w]), + y1 = d3.scale.linear().domain([0, yMax]).range([0, h * bands]); + + // Retrieve the old scales, if this is an update. + if (this.__chart__) { + x0 = this.__chart__.x; + y0 = this.__chart__.y; + id = this.__chart__.id; + } else { + x0 = d3.scale.linear().domain([0, Infinity]).range(x1.range()); + y0 = d3.scale.linear().domain([0, Infinity]).range(y1.range()); + id = ++d3_chart_horizonId; + } + + // We'll use a defs to store the area path and the clip path. + var defs = g.selectAll("defs") + .data([data]); + + var defsEnter = defs.enter().append("svg:defs"); + + // The clip path is a simple rect. + defsEnter.append("svg:clipPath") + .attr("id", "d3_chart_horizon_clip" + id) + .append("svg:rect") + .attr("width", w) + .attr("height", h); + + defs.select("rect").transition() + .duration(duration) + .attr("width", w) + .attr("height", h); + + // The area path is rendered with our resuable d3.svg.area. + defsEnter.append("svg:path") + .attr("id", "d3_chart_horizon_path" + id) + .attr("d", d3_chart_horizonArea + .interpolate(interpolate) + .x(function(d) { return x0(d[0]); }) + .y0(h * bands) + .y1(function(d) { return h * bands - y0(d[1]); })) + .transition() + .duration(duration) + .attr("d", d3_chart_horizonArea + .x(function(d) { return x1(d[0]); }) + .y1(function(d) { return h * bands - y1(d[1]); })); + + defs.select("path").transition() + .duration(duration) + .attr("d", d3_chart_horizonArea); + + // We'll use a container to clip all horizon layers at once. + g.selectAll("g") + .data([null]) + .enter().append("svg:g") + .attr("clip-path", "url(#d3_chart_horizon_clip" + id + ")"); + + // Define the transform function based on the mode. + var transform = mode == "offset" + ? function(d) { return "translate(0," + (d + (d < 0) - bands) * h + ")"; } + : function(d) { return (d < 0 ? "scale(1,-1)" : "") + "translate(0," + (d - bands) * h + ")"; }; + + // Instantiate each copy of the path with different transforms. + var u = g.select("g").selectAll("use") + .data(d3.range(-1, -bands - 1, -1).concat(d3.range(1, bands + 1)), Number); + + // TODO don't fudge the enter transition + u.enter().append("svg:use") + .attr("xlink:href", "#d3_chart_horizon_path" + id) + .attr("transform", function(d) { return transform(d + (d > 0 ? 1 : -1)); }) + .style("fill", color) + .transition() + .duration(duration) + .attr("transform", transform); + + u.transition() + .duration(duration) + .attr("transform", transform) + .style("fill", color); + + u.exit().transition() + .duration(duration) + .attr("transform", transform) + .remove(); + + // Stash the new scales. + this.__chart__ = {x: x1, y: y1, id: id}; + }); + d3.timer.flush(); + } + + horizon.duration = function(x) { + if (!arguments.length) return duration; + duration = +x; + return horizon; + }; + + horizon.bands = function(x) { + if (!arguments.length) return bands; + bands = +x; + color.domain([-bands, 0, bands]); + return horizon; + }; + + horizon.mode = function(x) { + if (!arguments.length) return mode; + mode = x + ""; + return horizon; + }; + + horizon.colors = function(x) { + if (!arguments.length) return color.range(); + color.range(x); + return horizon; + }; + + horizon.interpolate = function(x) { + if (!arguments.length) return interpolate; + interpolate = x + ""; + return horizon; + }; + + horizon.x = function(z) { + if (!arguments.length) return x; + x = z; + return horizon; + }; + + horizon.y = function(z) { + if (!arguments.length) return y; + y = z; + return horizon; + }; + + horizon.width = function(x) { + if (!arguments.length) return w; + w = +x; + return horizon; + }; + + horizon.height = function(x) { + if (!arguments.length) return h; + h = +x; + return horizon; + }; + + return horizon; +}; + +var d3_chart_horizonArea = d3.svg.area(), + d3_chart_horizonId = 0; + +function d3_chart_horizonX(d) { + return d[0]; +} + +function d3_chart_horizonY(d) { + return d[1]; +} +// Based on http://vis.stanford.edu/protovis/ex/qqplot.html +d3.chart.qq = function() { + var width = 1, + height = 1, + duration = 0, + domain = null, + tickFormat = null, + n = 100, + x = d3_chart_qqX, + y = d3_chart_qqY; + + // For each small multiple… + function qq(g) { + g.each(function(d, i) { + var g = d3.select(this), + qx = d3_chart_qqQuantiles(n, x.call(this, d, i)), + qy = d3_chart_qqQuantiles(n, y.call(this, d, i)), + xd = domain && domain.call(this, d, i) || [d3.min(qx), d3.max(qx)], // new x-domain + yd = domain && domain.call(this, d, i) || [d3.min(qy), d3.max(qy)], // new y-domain + x0, // old x-scale + y0; // old y-scale + + // Compute the new x-scale. + var x1 = d3.scale.linear() + .domain(xd) + .range([0, width]); + + // Compute the new y-scale. + var y1 = d3.scale.linear() + .domain(yd) + .range([height, 0]); + + // Retrieve the old scales, if this is an update. + if (this.__chart__) { + x0 = this.__chart__.x; + y0 = this.__chart__.y; + } else { + x0 = d3.scale.linear().domain([0, Infinity]).range(x1.range()); + y0 = d3.scale.linear().domain([0, Infinity]).range(y1.range()); + } + + // Stash the new scales. + this.__chart__ = {x: x1, y: y1}; + + // Update diagonal line. + var diagonal = g.selectAll("line.diagonal") + .data([null]); + + diagonal.enter().append("svg:line") + .attr("class", "diagonal") + .attr("x1", x1(yd[0])) + .attr("y1", y1(xd[0])) + .attr("x2", x1(yd[1])) + .attr("y2", y1(xd[1])); + + diagonal.transition() + .duration(duration) + .attr("x1", x1(yd[0])) + .attr("y1", y1(xd[0])) + .attr("x2", x1(yd[1])) + .attr("y2", y1(xd[1])); + + // Update quantile plots. + var circle = g.selectAll("circle") + .data(d3.range(n).map(function(i) { + return {x: qx[i], y: qy[i]}; + })); + + circle.enter().append("svg:circle") + .attr("class", "quantile") + .attr("r", 4.5) + .attr("cx", function(d) { return x0(d.x); }) + .attr("cy", function(d) { return y0(d.y); }) + .style("opacity", 1e-6) + .transition() + .duration(duration) + .attr("cx", function(d) { return x1(d.x); }) + .attr("cy", function(d) { return y1(d.y); }) + .style("opacity", 1); + + circle.transition() + .duration(duration) + .attr("cx", function(d) { return x1(d.x); }) + .attr("cy", function(d) { return y1(d.y); }) + .style("opacity", 1); + + circle.exit().transition() + .duration(duration) + .attr("cx", function(d) { return x1(d.x); }) + .attr("cy", function(d) { return y1(d.y); }) + .style("opacity", 1e-6) + .remove(); + + var xformat = tickFormat || x1.tickFormat(4), + yformat = tickFormat || y1.tickFormat(4), + tx = function(d) { return "translate(" + x1(d) + "," + height + ")"; }, + ty = function(d) { return "translate(0," + y1(d) + ")"; }; + + // Update x-ticks. + var xtick = g.selectAll("g.x.tick") + .data(x1.ticks(4), function(d) { + return this.textContent || xformat(d); + }); + + var xtickEnter = xtick.enter().append("svg:g") + .attr("class", "x tick") + .attr("transform", function(d) { return "translate(" + x0(d) + "," + height + ")"; }) + .style("opacity", 1e-6); + + xtickEnter.append("svg:line") + .attr("y1", 0) + .attr("y2", -6); + + xtickEnter.append("svg:text") + .attr("text-anchor", "middle") + .attr("dy", "1em") + .text(xformat); + + // Transition the entering ticks to the new scale, x1. + xtickEnter.transition() + .duration(duration) + .attr("transform", tx) + .style("opacity", 1); + + // Transition the updating ticks to the new scale, x1. + xtick.transition() + .duration(duration) + .attr("transform", tx) + .style("opacity", 1); + + // Transition the exiting ticks to the new scale, x1. + xtick.exit().transition() + .duration(duration) + .attr("transform", tx) + .style("opacity", 1e-6) + .remove(); + + // Update ticks. + var ytick = g.selectAll("g.y.tick") + .data(y1.ticks(4), function(d) { + return this.textContent || yformat(d); + }); + + var ytickEnter = ytick.enter().append("svg:g") + .attr("class", "y tick") + .attr("transform", function(d) { return "translate(0," + y0(d) + ")"; }) + .style("opacity", 1e-6); + + ytickEnter.append("svg:line") + .attr("x1", 0) + .attr("x2", 6); + + ytickEnter.append("svg:text") + .attr("text-anchor", "end") + .attr("dx", "-.5em") + .attr("dy", ".3em") + .text(yformat); + + // Transition the entering ticks to the new scale, y1. + ytickEnter.transition() + .duration(duration) + .attr("transform", ty) + .style("opacity", 1); + + // Transition the updating ticks to the new scale, y1. + ytick.transition() + .duration(duration) + .attr("transform", ty) + .style("opacity", 1); + + // Transition the exiting ticks to the new scale, y1. + ytick.exit().transition() + .duration(duration) + .attr("transform", ty) + .style("opacity", 1e-6) + .remove(); + }); + } + + qq.width = function(x) { + if (!arguments.length) return width; + width = x; + return qq; + }; + + qq.height = function(x) { + if (!arguments.length) return height; + height = x; + return qq; + }; + + qq.duration = function(x) { + if (!arguments.length) return duration; + duration = x; + return qq; + }; + + qq.domain = function(x) { + if (!arguments.length) return domain; + domain = x == null ? x : d3.functor(x); + return qq; + }; + + qq.count = function(z) { + if (!arguments.length) return n; + n = z; + return qq; + }; + + qq.x = function(z) { + if (!arguments.length) return x; + x = z; + return qq; + }; + + qq.y = function(z) { + if (!arguments.length) return y; + y = z; + return qq; + }; + + qq.tickFormat = function(x) { + if (!arguments.length) return tickFormat; + tickFormat = x; + return qq; + }; + + return qq; +}; + +function d3_chart_qqQuantiles(n, values) { + var m = values.length - 1; + values = values.slice().sort(d3.ascending); + return d3.range(n).map(function(i) { + return values[~~(i * m / n)]; + }); +} + +function d3_chart_qqX(d) { + return d.x; +} + +function d3_chart_qqY(d) { + return d.y; +} +})(); diff --git a/projects/Data Visualization Software Java Project/Data Visualization/d3.csv.js b/projects/Data Visualization Software Java Project/Data Visualization/d3.csv.js new file mode 100644 index 0000000..7565b83 --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/d3.csv.js @@ -0,0 +1,92 @@ +(function(){d3.csv = function(url, callback) { + d3.text(url, "text/csv", function(text) { + callback(text && d3.csv.parse(text)); + }); +}; +d3.csv.parse = function(text) { + var header; + return d3.csv.parseRows(text, function(row, i) { + if (i) { + var o = {}, j = -1, m = header.length; + while (++j < m) o[header[j]] = row[j]; + return o; + } else { + header = row; + return null; + } + }); +}; + +d3.csv.parseRows = function(text, f) { + var EOL = {}, // sentinel value for end-of-line + EOF = {}, // sentinel value for end-of-file + rows = [], // output rows + re = /\r\n|[,\r\n]/g, // field separator regex + n = 0, // the current line number + t, // the current token + eol; // is the current token followed by EOL? + + re.lastIndex = 0; // work-around bug in FF 3.6 + + /** @private Returns the next token. */ + function token() { + if (re.lastIndex >= text.length) return EOF; // special case: end of file + if (eol) { eol = false; return EOL; } // special case: end of line + + // special case: quotes + var j = re.lastIndex; + if (text.charCodeAt(j) === 34) { + var i = j; + while (i++ < text.length) { + if (text.charCodeAt(i) === 34) { + if (text.charCodeAt(i + 1) !== 34) break; + i++; + } + } + re.lastIndex = i + 2; + var c = text.charCodeAt(i + 1); + if (c === 13) { + eol = true; + if (text.charCodeAt(i + 2) === 10) re.lastIndex++; + } else if (c === 10) { + eol = true; + } + return text.substring(j + 1, i).replace(/""/g, "\""); + } + + // common case + var m = re.exec(text); + if (m) { + eol = m[0].charCodeAt(0) !== 44; + return text.substring(j, m.index); + } + re.lastIndex = text.length; + return text.substring(j); + } + + while ((t = token()) !== EOF) { + var a = []; + while ((t !== EOL) && (t !== EOF)) { + a.push(t); + t = token(); + } + if (f && !(a = f(a, n++))) continue; + rows.push(a); + } + + return rows; +}; +d3.csv.format = function(rows) { + return rows.map(d3_csv_formatRow).join("\n"); +}; + +function d3_csv_formatRow(row) { + return row.map(d3_csv_formatValue).join(","); +} + +function d3_csv_formatValue(text) { + return /[",\n]/.test(text) + ? "\"" + text.replace(/\"/g, "\"\"") + "\"" + : text; +} +})(); diff --git a/projects/Data Visualization Software Java Project/Data Visualization/d3.geom.js b/projects/Data Visualization Software Java Project/Data Visualization/d3.geom.js new file mode 100644 index 0000000..d860c2b --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/d3.geom.js @@ -0,0 +1,835 @@ +(function(){d3.geom = {}; +/** + * Computes a contour for a given input grid function using the marching + * squares algorithm. Returns the contour polygon as an array of points. + * + * @param grid a two-input function(x, y) that returns true for values + * inside the contour and false for values outside the contour. + * @param start an optional starting point [x, y] on the grid. + * @returns polygon [[x1, y1], [x2, y2], …] + */ +d3.geom.contour = function(grid, start) { + var s = start || d3_geom_contourStart(grid), // starting point + c = [], // contour polygon + x = s[0], // current x position + y = s[1], // current y position + dx = 0, // next x direction + dy = 0, // next y direction + pdx = NaN, // previous x direction + pdy = NaN, // previous y direction + i = 0; + + do { + // determine marching squares index + i = 0; + if (grid(x-1, y-1)) i += 1; + if (grid(x, y-1)) i += 2; + if (grid(x-1, y )) i += 4; + if (grid(x, y )) i += 8; + + // determine next direction + if (i === 6) { + dx = pdy === -1 ? -1 : 1; + dy = 0; + } else if (i === 9) { + dx = 0; + dy = pdx === 1 ? -1 : 1; + } else { + dx = d3_geom_contourDx[i]; + dy = d3_geom_contourDy[i]; + } + + // update contour polygon + if (dx != pdx && dy != pdy) { + c.push([x, y]); + pdx = dx; + pdy = dy; + } + + x += dx; + y += dy; + } while (s[0] != x || s[1] != y); + + return c; +}; + +// lookup tables for marching directions +var d3_geom_contourDx = [1, 0, 1, 1,-1, 0,-1, 1,0, 0,0,0,-1, 0,-1,NaN], + d3_geom_contourDy = [0,-1, 0, 0, 0,-1, 0, 0,1,-1,1,1, 0,-1, 0,NaN]; + +function d3_geom_contourStart(grid) { + var x = 0, + y = 0; + + // search for a starting point; begin at origin + // and proceed along outward-expanding diagonals + while (true) { + if (grid(x,y)) { + return [x,y]; + } + if (x === 0) { + x = y + 1; + y = 0; + } else { + x = x - 1; + y = y + 1; + } + } +} +/** + * Computes the 2D convex hull of a set of points using Graham's scanning + * algorithm. The algorithm has been implemented as described in Cormen, + * Leiserson, and Rivest's Introduction to Algorithms. The running time of + * this algorithm is O(n log n), where n is the number of input points. + * + * @param vertices [[x1, y1], [x2, y2], …] + * @returns polygon [[x1, y1], [x2, y2], …] + */ +d3.geom.hull = function(vertices) { + if (vertices.length < 3) return []; + + var len = vertices.length, + plen = len - 1, + points = [], + stack = [], + i, j, h = 0, x1, y1, x2, y2, u, v, a, sp; + + // find the starting ref point: leftmost point with the minimum y coord + for (i=1; i= (x2*x2 + y2*y2)) { + points[i].index = -1; + } else { + points[u].index = -1; + a = points[i].angle; + u = i; + v = j; + } + } else { + a = points[i].angle; + u = i; + v = j; + } + } + + // initialize the stack + stack.push(h); + for (i=0, j=0; i<2; ++j) { + if (points[j].index !== -1) { + stack.push(points[j].index); + i++; + } + } + sp = stack.length; + + // do graham's scan + for (; j 0; +} +// Note: requires coordinates to be counterclockwise and convex! +d3.geom.polygon = function(coordinates) { + + coordinates.area = function() { + var i = 0, + n = coordinates.length, + a = coordinates[n - 1][0] * coordinates[0][1], + b = coordinates[n - 1][1] * coordinates[0][0]; + while (++i < n) { + a += coordinates[i - 1][0] * coordinates[i][1]; + b += coordinates[i - 1][1] * coordinates[i][0]; + } + return (b - a) * .5; + }; + + coordinates.centroid = function(k) { + var i = -1, + n = coordinates.length - 1, + x = 0, + y = 0, + a, + b, + c; + if (!arguments.length) k = -1 / (6 * coordinates.area()); + while (++i < n) { + a = coordinates[i]; + b = coordinates[i + 1]; + c = a[0] * b[1] - b[0] * a[1]; + x += (a[0] + b[0]) * c; + y += (a[1] + b[1]) * c; + } + return [x * k, y * k]; + }; + + // The Sutherland-Hodgman clipping algorithm. + coordinates.clip = function(subject) { + var input, + i = -1, + n = coordinates.length, + j, + m, + a = coordinates[n - 1], + b, + c, + d; + while (++i < n) { + input = subject.slice(); + subject.length = 0; + b = coordinates[i]; + c = input[(m = input.length) - 1]; + j = -1; + while (++j < m) { + d = input[j]; + if (d3_geom_polygonInside(d, a, b)) { + if (!d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + subject.push(d); + } else if (d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + c = d; + } + a = b; + } + return subject; + }; + + return coordinates; +}; + +function d3_geom_polygonInside(p, a, b) { + return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); +} + +// Intersect two infinite lines cd and ab. +function d3_geom_polygonIntersect(c, d, a, b) { + var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0], + y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1], + x13 = x1 - x3, + x21 = x2 - x1, + x43 = x4 - x3, + y13 = y1 - y3, + y21 = y2 - y1, + y43 = y4 - y3, + ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21); + return [x1 + ua * x21, y1 + ua * y21]; +} +// Adapted from Nicolas Garcia Belmonte's JIT implementation: +// http://blog.thejit.org/2010/02/12/voronoi-tessellation/ +// http://blog.thejit.org/assets/voronoijs/voronoi.js +// See lib/jit/LICENSE for details. + +// Notes: +// +// This implementation does not clip the returned polygons, so if you want to +// clip them to a particular shape you will need to do that either in SVG or by +// post-processing with d3.geom.polygon's clip method. +// +// If any vertices are coincident or have NaN positions, the behavior of this +// method is undefined. Most likely invalid polygons will be returned. You +// should filter invalid points, and consolidate coincident points, before +// computing the tessellation. + +/** + * @param vertices [[x1, y1], [x2, y2], …] + * @returns polygons [[[x1, y1], [x2, y2], …], …] + */ +d3.geom.voronoi = function(vertices) { + var polygons = vertices.map(function() { return []; }); + + d3_voronoi_tessellate(vertices, function(e) { + var s1, + s2, + x1, + x2, + y1, + y2; + if (e.a === 1 && e.b >= 0) { + s1 = e.ep.r; + s2 = e.ep.l; + } else { + s1 = e.ep.l; + s2 = e.ep.r; + } + if (e.a === 1) { + y1 = s1 ? s1.y : -1e6; + x1 = e.c - e.b * y1; + y2 = s2 ? s2.y : 1e6; + x2 = e.c - e.b * y2; + } else { + x1 = s1 ? s1.x : -1e6; + y1 = e.c - e.a * x1; + x2 = s2 ? s2.x : 1e6; + y2 = e.c - e.a * x2; + } + var v1 = [x1, y1], + v2 = [x2, y2]; + polygons[e.region.l.index].push(v1, v2); + polygons[e.region.r.index].push(v1, v2); + }); + + // Reconnect the polygon segments into counterclockwise loops. + return polygons.map(function(polygon, i) { + var cx = vertices[i][0], + cy = vertices[i][1]; + polygon.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + return polygon.sort(function(a, b) { + return a.angle - b.angle; + }).filter(function(d, i) { + return !i || (d.angle - polygon[i - 1].angle > 1e-10); + }); + }); +}; + +var d3_voronoi_opposite = {"l": "r", "r": "l"}; + +function d3_voronoi_tessellate(vertices, callback) { + + var Sites = { + list: vertices + .map(function(v, i) { + return { + index: i, + x: v[0], + y: v[1] + }; + }) + .sort(function(a, b) { + return a.y < b.y ? -1 + : a.y > b.y ? 1 + : a.x < b.x ? -1 + : a.x > b.x ? 1 + : 0; + }), + bottomSite: null + }; + + var EdgeList = { + list: [], + leftEnd: null, + rightEnd: null, + + init: function() { + EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.leftEnd.r = EdgeList.rightEnd; + EdgeList.rightEnd.l = EdgeList.leftEnd; + EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd); + }, + + createHalfEdge: function(edge, side) { + return { + edge: edge, + side: side, + vertex: null, + "l": null, + "r": null + }; + }, + + insert: function(lb, he) { + he.l = lb; + he.r = lb.r; + lb.r.l = he; + lb.r = he; + }, + + leftBound: function(p) { + var he = EdgeList.leftEnd; + do { + he = he.r; + } while (he != EdgeList.rightEnd && Geom.rightOf(he, p)); + he = he.l; + return he; + }, + + del: function(he) { + he.l.r = he.r; + he.r.l = he.l; + he.edge = null; + }, + + right: function(he) { + return he.r; + }, + + left: function(he) { + return he.l; + }, + + leftRegion: function(he) { + return he.edge == null + ? Sites.bottomSite + : he.edge.region[he.side]; + }, + + rightRegion: function(he) { + return he.edge == null + ? Sites.bottomSite + : he.edge.region[d3_voronoi_opposite[he.side]]; + } + }; + + var Geom = { + + bisect: function(s1, s2) { + var newEdge = { + region: {"l": s1, "r": s2}, + ep: {"l": null, "r": null} + }; + + var dx = s2.x - s1.x, + dy = s2.y - s1.y, + adx = dx > 0 ? dx : -dx, + ady = dy > 0 ? dy : -dy; + + newEdge.c = s1.x * dx + s1.y * dy + + (dx * dx + dy * dy) * .5; + + if (adx > ady) { + newEdge.a = 1; + newEdge.b = dy / dx; + newEdge.c /= dx; + } else { + newEdge.b = 1; + newEdge.a = dx / dy; + newEdge.c /= dy; + } + + return newEdge; + }, + + intersect: function(el1, el2) { + var e1 = el1.edge, + e2 = el2.edge; + if (!e1 || !e2 || (e1.region.r == e2.region.r)) { + return null; + } + var d = (e1.a * e2.b) - (e1.b * e2.a); + if (Math.abs(d) < 1e-10) { + return null; + } + var xint = (e1.c * e2.b - e2.c * e1.b) / d, + yint = (e2.c * e1.a - e1.c * e2.a) / d, + e1r = e1.region.r, + e2r = e2.region.r, + el, + e; + if ((e1r.y < e2r.y) || + (e1r.y == e2r.y && e1r.x < e2r.x)) { + el = el1; + e = e1; + } else { + el = el2; + e = e2; + } + var rightOfSite = (xint >= e.region.r.x); + if ((rightOfSite && (el.side === "l")) || + (!rightOfSite && (el.side === "r"))) { + return null; + } + return { + x: xint, + y: yint + }; + }, + + rightOf: function(he, p) { + var e = he.edge, + topsite = e.region.r, + rightOfSite = (p.x > topsite.x); + + if (rightOfSite && (he.side === "l")) { + return 1; + } + if (!rightOfSite && (he.side === "r")) { + return 0; + } + if (e.a === 1) { + var dyp = p.y - topsite.y, + dxp = p.x - topsite.x, + fast = 0, + above = 0; + + if ((!rightOfSite && (e.b < 0)) || + (rightOfSite && (e.b >= 0))) { + above = fast = (dyp >= e.b * dxp); + } else { + above = ((p.x + p.y * e.b) > e.c); + if (e.b < 0) { + above = !above; + } + if (!above) { + fast = 1; + } + } + if (!fast) { + var dxs = topsite.x - e.region.l.x; + above = (e.b * (dxp * dxp - dyp * dyp)) < + (dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b)); + + if (e.b < 0) { + above = !above; + } + } + } else /* e.b == 1 */ { + var yl = e.c - e.a * p.x, + t1 = p.y - yl, + t2 = p.x - topsite.x, + t3 = yl - topsite.y; + + above = (t1 * t1) > (t2 * t2 + t3 * t3); + } + return he.side === "l" ? above : !above; + }, + + endPoint: function(edge, side, site) { + edge.ep[side] = site; + if (!edge.ep[d3_voronoi_opposite[side]]) return; + callback(edge); + }, + + distance: function(s, t) { + var dx = s.x - t.x, + dy = s.y - t.y; + return Math.sqrt(dx * dx + dy * dy); + } + }; + + var EventQueue = { + list: [], + + insert: function(he, site, offset) { + he.vertex = site; + he.ystar = site.y + offset; + for (var i=0, list=EventQueue.list, l=list.length; i next.ystar || + (he.ystar == next.ystar && + site.x > next.vertex.x)) { + continue; + } else { + break; + } + } + list.splice(i, 0, he); + }, + + del: function(he) { + for (var i=0, ls=EventQueue.list, l=ls.length; i top.y) { + temp = bot; + bot = top; + top = temp; + pm = "r"; + } + e = Geom.bisect(bot, top); + bisector = EdgeList.createHalfEdge(e, pm); + EdgeList.insert(llbnd, bisector); + Geom.endPoint(e, d3_voronoi_opposite[pm], v); + p = Geom.intersect(llbnd, bisector); + if (p) { + EventQueue.del(llbnd); + EventQueue.insert(llbnd, p, Geom.distance(p, bot)); + } + p = Geom.intersect(bisector, rrbnd); + if (p) { + EventQueue.insert(bisector, p, Geom.distance(p, bot)); + } + } else { + break; + } + }//end while + + for (lbnd = EdgeList.right(EdgeList.leftEnd); + lbnd != EdgeList.rightEnd; + lbnd = EdgeList.right(lbnd)) { + callback(lbnd.edge); + } +} +/** +* @param vertices [[x1, y1], [x2, y2], …] +* @returns triangles [[[x1, y1], [x2, y2], [x3, y3]], …] + */ +d3.geom.delaunay = function(vertices) { + var edges = vertices.map(function() { return []; }), + triangles = []; + + // Use the Voronoi tessellation to determine Delaunay edges. + d3_voronoi_tessellate(vertices, function(e) { + edges[e.region.l.index].push(vertices[e.region.r.index]); + }); + + // Reconnect the edges into counterclockwise triangles. + edges.forEach(function(edge, i) { + var v = vertices[i], + cx = v[0], + cy = v[1]; + edge.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + edge.sort(function(a, b) { + return a.angle - b.angle; + }); + for (var j = 0, m = edge.length - 1; j < m; j++) { + triangles.push([v, edge[j], edge[j + 1]]); + } + }); + + return triangles; +}; +// Constructs a new quadtree for the specified array of points. A quadtree is a +// two-dimensional recursive spatial subdivision. This implementation uses +// square partitions, dividing each square into four equally-sized squares. Each +// point exists in a unique node; if multiple points are in the same position, +// some points may be stored on internal nodes rather than leaf nodes. Quadtrees +// can be used to accelerate various spatial operations, such as the Barnes-Hut +// approximation for computing n-body forces, or collision detection. +d3.geom.quadtree = function(points, x1, y1, x2, y2) { + var p, + i = -1, + n = points.length; + + // Type conversion for deprecated API. + if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint); + + // Allow bounds to be specified explicitly. + if (arguments.length < 5) { + if (arguments.length === 3) { + y2 = x2 = y1; + y1 = x1; + } else { + x1 = y1 = Infinity; + x2 = y2 = -Infinity; + + // Compute bounds. + while (++i < n) { + p = points[i]; + if (p.x < x1) x1 = p.x; + if (p.y < y1) y1 = p.y; + if (p.x > x2) x2 = p.x; + if (p.y > y2) y2 = p.y; + } + + // Squarify the bounds. + var dx = x2 - x1, + dy = y2 - y1; + if (dx > dy) y2 = y1 + dx; + else x2 = x1 + dy; + } + } + + // Recursively inserts the specified point p at the node n or one of its + // descendants. The bounds are defined by [x1, x2] and [y1, y2]. + function insert(n, p, x1, y1, x2, y2) { + if (isNaN(p.x) || isNaN(p.y)) return; // ignore invalid points + if (n.leaf) { + var v = n.point; + if (v) { + // If the point at this leaf node is at the same position as the new + // point we are adding, we leave the point associated with the + // internal node while adding the new point to a child node. This + // avoids infinite recursion. + if ((Math.abs(v.x - p.x) + Math.abs(v.y - p.y)) < .01) { + insertChild(n, p, x1, y1, x2, y2); + } else { + n.point = null; + insertChild(n, v, x1, y1, x2, y2); + insertChild(n, p, x1, y1, x2, y2); + } + } else { + n.point = p; + } + } else { + insertChild(n, p, x1, y1, x2, y2); + } + } + + // Recursively inserts the specified point p into a descendant of node n. The + // bounds are defined by [x1, x2] and [y1, y2]. + function insertChild(n, p, x1, y1, x2, y2) { + // Compute the split point, and the quadrant in which to insert p. + var sx = (x1 + x2) * .5, + sy = (y1 + y2) * .5, + right = p.x >= sx, + bottom = p.y >= sy, + i = (bottom << 1) + right; + + // Recursively insert into the child node. + n.leaf = false; + n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); + + // Update the bounds as we recurse. + if (right) x1 = sx; else x2 = sx; + if (bottom) y1 = sy; else y2 = sy; + insert(n, p, x1, y1, x2, y2); + } + + // Create the root node. + var root = d3_geom_quadtreeNode(); + + root.add = function(p) { + insert(root, p, x1, y1, x2, y2); + }; + + root.visit = function(f) { + d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2); + }; + + // Insert all points. + points.forEach(root.add); + return root; +}; + +function d3_geom_quadtreeNode() { + return { + leaf: true, + nodes: [], + point: null + }; +} + +function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { + if (!f(node, x1, y1, x2, y2)) { + var sx = (x1 + x2) * .5, + sy = (y1 + y2) * .5, + children = node.nodes; + if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); + if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); + if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); + if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); + } +} + +function d3_geom_quadtreePoint(p) { + return { + x: p[0], + y: p[1] + }; +} +})(); diff --git a/projects/Data Visualization Software Java Project/Data Visualization/d3.js b/projects/Data Visualization Software Java Project/Data Visualization/d3.js new file mode 100644 index 0000000..9042897 --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/d3.js @@ -0,0 +1,4707 @@ +(function(){if (!Date.now) Date.now = function() { + return +new Date; +}; +try { + document.createElement("div").style.setProperty("opacity", 0, ""); +} catch (error) { + var d3_style_prototype = CSSStyleDeclaration.prototype, + d3_style_setProperty = d3_style_prototype.setProperty; + d3_style_prototype.setProperty = function(name, value, priority) { + d3_style_setProperty.call(this, name, value + "", priority); + }; +} +d3 = {version: "2.7.2"}; // semver +var d3_array = d3_arraySlice; // conversion for NodeLists + +function d3_arrayCopy(pseudoarray) { + var i = -1, n = pseudoarray.length, array = []; + while (++i < n) array.push(pseudoarray[i]); + return array; +} + +function d3_arraySlice(pseudoarray) { + return Array.prototype.slice.call(pseudoarray); +} + +try { + d3_array(document.documentElement.childNodes)[0].nodeType; +} catch(e) { + d3_array = d3_arrayCopy; +} + +var d3_arraySubclass = [].__proto__? + +// Until ECMAScript supports array subclassing, prototype injection works well. +function(array, prototype) { + array.__proto__ = prototype; +}: + +// And if your browser doesn't support __proto__, we'll use direct extension. +function(array, prototype) { + for (var property in prototype) array[property] = prototype[property]; +}; +function d3_this() { + return this; +} +d3.functor = function(v) { + return typeof v === "function" ? v : function() { return v; }; +}; +// Copies a variable number of methods from source to target. +d3.rebind = function(target, source) { + var i = 1, n = arguments.length, method; + while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]); + return target; +}; + +// Method is assumed to be a standard D3 getter-setter: +// If passed with no arguments, gets the value. +// If passed with arguments, sets the value and returns the target. +function d3_rebind(target, source, method) { + return function() { + var value = method.apply(source, arguments); + return arguments.length ? target : value; + }; +} +d3.ascending = function(a, b) { + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; +}; +d3.descending = function(a, b) { + return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; +}; +d3.mean = function(array, f) { + var n = array.length, + a, + m = 0, + i = -1, + j = 0; + if (arguments.length === 1) { + while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j; + } else { + while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j; + } + return j ? m : undefined; +}; +d3.median = function(array, f) { + if (arguments.length > 1) array = array.map(f); + array = array.filter(d3_number); + return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined; +}; +d3.min = function(array, f) { + var i = -1, + n = array.length, + a, + b; + if (arguments.length === 1) { + while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; + while (++i < n) if ((b = array[i]) != null && a > b) a = b; + } else { + while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; + } + return a; +}; +d3.max = function(array, f) { + var i = -1, + n = array.length, + a, + b; + if (arguments.length === 1) { + while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; + while (++i < n) if ((b = array[i]) != null && b > a) a = b; + } else { + while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; + } + return a; +}; +d3.extent = function(array, f) { + var i = -1, + n = array.length, + a, + b, + c; + if (arguments.length === 1) { + while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined; + while (++i < n) if ((b = array[i]) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } else { + while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } + return [a, c]; +}; +d3.random = { + normal: function(mean, deviation) { + if (arguments.length < 2) deviation = 1; + if (arguments.length < 1) mean = 0; + return function() { + var x, y, r; + do { + x = Math.random() * 2 - 1; + y = Math.random() * 2 - 1; + r = x * x + y * y; + } while (!r || r > 1); + return mean + deviation * x * Math.sqrt(-2 * Math.log(r) / r); + }; + } +}; +function d3_number(x) { + return x != null && !isNaN(x); +} +d3.sum = function(array, f) { + var s = 0, + n = array.length, + a, + i = -1; + + if (arguments.length === 1) { + while (++i < n) if (!isNaN(a = +array[i])) s += a; + } else { + while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a; + } + + return s; +}; +// R-7 per +d3.quantile = function(values, p) { + var H = (values.length - 1) * p + 1, + h = Math.floor(H), + v = values[h - 1], + e = H - h; + return e ? v + e * (values[h] - v) : v; +}; +d3.transpose = function(matrix) { + return d3.zip.apply(d3, matrix); +}; +d3.zip = function() { + if (!(n = arguments.length)) return []; + for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m;) { + for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n;) { + zip[j] = arguments[j][i]; + } + } + return zips; +}; + +function d3_zipLength(d) { + return d.length; +} +// Locate the insertion point for x in a to maintain sorted order. The +// arguments lo and hi may be used to specify a subset of the array which should +// be considered; by default the entire array is used. If x is already present +// in a, the insertion point will be before (to the left of) any existing +// entries. The return value is suitable for use as the first argument to +// `array.splice` assuming that a is already sorted. +// +// The returned insertion point i partitions the array a into two halves so that +// all v < x for v in a[lo:i] for the left side and all v >= x for v in a[i:hi] +// for the right side. +d3.bisectLeft = function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = (lo + hi) >> 1; + if (a[mid] < x) lo = mid + 1; + else hi = mid; + } + return lo; +}; + +// Similar to bisectLeft, but returns an insertion point which comes after (to +// the right of) any existing entries of x in a. +// +// The returned insertion point i partitions the array into two halves so that +// all v <= x for v in a[lo:i] for the left side and all v > x for v in a[i:hi] +// for the right side. +d3.bisect = +d3.bisectRight = function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = (lo + hi) >> 1; + if (x < a[mid]) hi = mid; + else lo = mid + 1; + } + return lo; +}; +d3.first = function(array, f) { + var i = 0, + n = array.length, + a = array[0], + b; + if (arguments.length === 1) f = d3.ascending; + while (++i < n) { + if (f.call(array, a, b = array[i]) > 0) { + a = b; + } + } + return a; +}; +d3.last = function(array, f) { + var i = 0, + n = array.length, + a = array[0], + b; + if (arguments.length === 1) f = d3.ascending; + while (++i < n) { + if (f.call(array, a, b = array[i]) <= 0) { + a = b; + } + } + return a; +}; +d3.nest = function() { + var nest = {}, + keys = [], + sortKeys = [], + sortValues, + rollup; + + function map(array, depth) { + if (depth >= keys.length) return rollup + ? rollup.call(nest, array) : (sortValues + ? array.sort(sortValues) + : array); + + var i = -1, + n = array.length, + key = keys[depth++], + keyValue, + object, + o = {}; + + while (++i < n) { + if ((keyValue = key(object = array[i])) in o) { + o[keyValue].push(object); + } else { + o[keyValue] = [object]; + } + } + + for (keyValue in o) { + o[keyValue] = map(o[keyValue], depth); + } + + return o; + } + + function entries(map, depth) { + if (depth >= keys.length) return map; + + var a = [], + sortKey = sortKeys[depth++], + key; + + for (key in map) { + a.push({key: key, values: entries(map[key], depth)}); + } + + if (sortKey) a.sort(function(a, b) { + return sortKey(a.key, b.key); + }); + + return a; + } + + nest.map = function(array) { + return map(array, 0); + }; + + nest.entries = function(array) { + return entries(map(array, 0), 0); + }; + + nest.key = function(d) { + keys.push(d); + return nest; + }; + + // Specifies the order for the most-recently specified key. + // Note: only applies to entries. Map keys are unordered! + nest.sortKeys = function(order) { + sortKeys[keys.length - 1] = order; + return nest; + }; + + // Specifies the order for leaf values. + // Applies to both maps and entries array. + nest.sortValues = function(order) { + sortValues = order; + return nest; + }; + + nest.rollup = function(f) { + rollup = f; + return nest; + }; + + return nest; +}; +d3.keys = function(map) { + var keys = []; + for (var key in map) keys.push(key); + return keys; +}; +d3.values = function(map) { + var values = []; + for (var key in map) values.push(map[key]); + return values; +}; +d3.entries = function(map) { + var entries = []; + for (var key in map) entries.push({key: key, value: map[key]}); + return entries; +}; +d3.permute = function(array, indexes) { + var permutes = [], + i = -1, + n = indexes.length; + while (++i < n) permutes[i] = array[indexes[i]]; + return permutes; +}; +d3.merge = function(arrays) { + return Array.prototype.concat.apply([], arrays); +}; +d3.split = function(array, f) { + var arrays = [], + values = [], + value, + i = -1, + n = array.length; + if (arguments.length < 2) f = d3_splitter; + while (++i < n) { + if (f.call(values, value = array[i], i)) { + values = []; + } else { + if (!values.length) arrays.push(values); + values.push(value); + } + } + return arrays; +}; + +function d3_splitter(d) { + return d == null; +} +function d3_collapse(s) { + return s.replace(/(^\s+)|(\s+$)/g, "").replace(/\s+/g, " "); +} +/** + * @param {number} start + * @param {number=} stop + * @param {number=} step + */ +d3.range = function(start, stop, step) { + if (arguments.length < 3) { + step = 1; + if (arguments.length < 2) { + stop = start; + start = 0; + } + } + if ((stop - start) / step == Infinity) throw new Error("infinite range"); + var range = [], + i = -1, + j; + if (step < 0) while ((j = start + step * ++i) > stop) range.push(j); + else while ((j = start + step * ++i) < stop) range.push(j); + return range; +}; +d3.requote = function(s) { + return s.replace(d3_requote_re, "\\$&"); +}; + +var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; +d3.round = function(x, n) { + return n + ? Math.round(x * Math.pow(10, n)) * Math.pow(10, -n) + : Math.round(x); +}; +d3.xhr = function(url, mime, callback) { + var req = new XMLHttpRequest; + if (arguments.length < 3) callback = mime, mime = null; + else if (mime && req.overrideMimeType) req.overrideMimeType(mime); + req.open("GET", url, true); + if (mime) req.setRequestHeader("Accept", mime); + req.onreadystatechange = function() { + if (req.readyState === 4) callback(req.status < 300 ? req : null); + }; + req.send(null); +}; +d3.text = function(url, mime, callback) { + function ready(req) { + callback(req && req.responseText); + } + if (arguments.length < 3) { + callback = mime; + mime = null; + } + d3.xhr(url, mime, ready); +}; +d3.json = function(url, callback) { + d3.text(url, "application/json", function(text) { + callback(text ? JSON.parse(text) : null); + }); +}; +d3.html = function(url, callback) { + d3.text(url, "text/html", function(text) { + if (text != null) { // Treat empty string as valid HTML. + var range = document.createRange(); + range.selectNode(document.body); + text = range.createContextualFragment(text); + } + callback(text); + }); +}; +d3.xml = function(url, mime, callback) { + function ready(req) { + callback(req && req.responseXML); + } + if (arguments.length < 3) { + callback = mime; + mime = null; + } + d3.xhr(url, mime, ready); +}; +var d3_nsPrefix = { + svg: "http://www.w3.org/2000/svg", + xhtml: "http://www.w3.org/1999/xhtml", + xlink: "http://www.w3.org/1999/xlink", + xml: "http://www.w3.org/XML/1998/namespace", + xmlns: "http://www.w3.org/2000/xmlns/" +}; + +d3.ns = { + prefix: d3_nsPrefix, + qualify: function(name) { + var i = name.indexOf(":"); + return i < 0 ? (name in d3_nsPrefix + ? {space: d3_nsPrefix[name], local: name} : name) + : {space: d3_nsPrefix[name.substring(0, i)], local: name.substring(i + 1)}; + } +}; +d3.dispatch = function() { + var dispatch = new d3_dispatch(), + i = -1, + n = arguments.length; + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(); + return dispatch; +}; + +function d3_dispatch() {} + +d3_dispatch.prototype.on = function(type, listener) { + var i = type.indexOf("."), + name = ""; + + // Extract optional namespace, e.g., "click.foo" + if (i > 0) { + name = type.substring(i + 1); + type = type.substring(0, i); + } + + return arguments.length < 2 + ? this[type].on(name) + : (this[type].on(name, listener), this); +}; + +function d3_dispatch_event() { + var listeners = [], + listenerByName = {}; + + function dispatch() { + var z = listeners, // defensive reference + i = -1, + n = z.length, + l; + while (++i < n) if (l = z[i].on) l.apply(this, arguments); + } + + dispatch.on = function(name, listener) { + var l, i; + + // return the current listener, if any + if (arguments.length < 2) return (l = listenerByName[name]) && l.on; + + // remove the old listener, if any (with copy-on-write) + if (l = listenerByName[name]) { + l.on = null; + listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); + delete listenerByName[name]; + } + + // add the new listener, if any + if (listener) { + listeners.push(listenerByName[name] = {on: listener}); + } + + return dispatch; + }; + + return dispatch; +}; +// TODO align +d3.format = function(specifier) { + var match = d3_format_re.exec(specifier), + fill = match[1] || " ", + sign = match[3] || "", + zfill = match[5], + width = +match[6], + comma = match[7], + precision = match[8], + type = match[9], + scale = 1, + suffix = "", + integer = false; + + if (precision) precision = +precision.substring(1); + + if (zfill) { + fill = "0"; // TODO align = "="; + if (comma) width -= Math.floor((width - 1) / 4); + } + + switch (type) { + case "n": comma = true; type = "g"; break; + case "%": scale = 100; suffix = "%"; type = "f"; break; + case "p": scale = 100; suffix = "%"; type = "r"; break; + case "d": integer = true; precision = 0; break; + case "s": scale = -1; type = "r"; break; + } + + // If no precision is specified for r, fallback to general notation. + if (type == "r" && !precision) type = "g"; + + type = d3_format_types[type] || d3_format_typeDefault; + + return function(value) { + + // Return the empty string for floats formatted as ints. + if (integer && (value % 1)) return ""; + + // Convert negative to positive, and record the sign prefix. + var negative = (value < 0) && (value = -value) ? "\u2212" : sign; + + // Apply the scale, computing it from the value's exponent for si format. + if (scale < 0) { + var prefix = d3.formatPrefix(value, precision); + value *= prefix.scale; + suffix = prefix.symbol; + } else { + value *= scale; + } + + // Convert to the desired precision. + value = type(value, precision); + + // If the fill character is 0, the sign and group is applied after the fill. + if (zfill) { + var length = value.length + negative.length; + if (length < width) value = new Array(width - length + 1).join(fill) + value; + if (comma) value = d3_format_group(value); + value = negative + value; + } + + // Otherwise (e.g., space-filling), the sign and group is applied before. + else { + if (comma) value = d3_format_group(value); + value = negative + value; + var length = value.length; + if (length < width) value = new Array(width - length + 1).join(fill) + value; + } + + return value + suffix; + }; +}; + +// [[fill]align][sign][#][0][width][,][.precision][type] +var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/; + +var d3_format_types = { + g: function(x, p) { return x.toPrecision(p); }, + e: function(x, p) { return x.toExponential(p); }, + f: function(x, p) { return x.toFixed(p); }, + r: function(x, p) { return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p))); } +}; + +function d3_format_precision(x, p) { + return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1); +} + +function d3_format_typeDefault(x) { + return x + ""; +} + +// Apply comma grouping for thousands. +function d3_format_group(value) { + var i = value.lastIndexOf("."), + f = i >= 0 ? value.substring(i) : (i = value.length, ""), + t = []; + while (i > 0) t.push(value.substring(i -= 3, i + 3)); + return t.reverse().join(",") + f; +} +var d3_formatPrefixes = ["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix); + +d3.formatPrefix = function(value, precision) { + var i = 0; + if (value) { + if (value < 0) value *= -1; + if (precision) value = d3.round(value, d3_format_precision(value, precision)); + i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10); + i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3)); + } + return d3_formatPrefixes[8 + i / 3]; +}; + +function d3_formatPrefix(d, i) { + return { + scale: Math.pow(10, (8 - i) * 3), + symbol: d + }; +} + +/* + * TERMS OF USE - EASING EQUATIONS + * + * Open source under the BSD License. + * + * Copyright 2001 Robert Penner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * - Neither the name of the author nor the names of contributors may be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +var d3_ease_quad = d3_ease_poly(2), + d3_ease_cubic = d3_ease_poly(3); + +var d3_ease = { + linear: function() { return d3_ease_linear; }, + poly: d3_ease_poly, + quad: function() { return d3_ease_quad; }, + cubic: function() { return d3_ease_cubic; }, + sin: function() { return d3_ease_sin; }, + exp: function() { return d3_ease_exp; }, + circle: function() { return d3_ease_circle; }, + elastic: d3_ease_elastic, + back: d3_ease_back, + bounce: function() { return d3_ease_bounce; } +}; + +var d3_ease_mode = { + "in": function(f) { return f; }, + "out": d3_ease_reverse, + "in-out": d3_ease_reflect, + "out-in": function(f) { return d3_ease_reflect(d3_ease_reverse(f)); } +}; + +d3.ease = function(name) { + var i = name.indexOf("-"), + t = i >= 0 ? name.substring(0, i) : name, + m = i >= 0 ? name.substring(i + 1) : "in"; + return d3_ease_clamp(d3_ease_mode[m](d3_ease[t].apply(null, Array.prototype.slice.call(arguments, 1)))); +}; + +function d3_ease_clamp(f) { + return function(t) { + return t <= 0 ? 0 : t >= 1 ? 1 : f(t); + }; +} + +function d3_ease_reverse(f) { + return function(t) { + return 1 - f(1 - t); + }; +} + +function d3_ease_reflect(f) { + return function(t) { + return .5 * (t < .5 ? f(2 * t) : (2 - f(2 - 2 * t))); + }; +} + +function d3_ease_linear(t) { + return t; +} + +function d3_ease_poly(e) { + return function(t) { + return Math.pow(t, e); + } +} + +function d3_ease_sin(t) { + return 1 - Math.cos(t * Math.PI / 2); +} + +function d3_ease_exp(t) { + return Math.pow(2, 10 * (t - 1)); +} + +function d3_ease_circle(t) { + return 1 - Math.sqrt(1 - t * t); +} + +function d3_ease_elastic(a, p) { + var s; + if (arguments.length < 2) p = 0.45; + if (arguments.length < 1) { a = 1; s = p / 4; } + else s = p / (2 * Math.PI) * Math.asin(1 / a); + return function(t) { + return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p); + }; +} + +function d3_ease_back(s) { + if (!s) s = 1.70158; + return function(t) { + return t * t * ((s + 1) * t - s); + }; +} + +function d3_ease_bounce(t) { + return t < 1 / 2.75 ? 7.5625 * t * t + : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 + : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 + : 7.5625 * (t -= 2.625 / 2.75) * t + .984375; +} +d3.event = null; + +function d3_eventCancel() { + d3.event.stopPropagation(); + d3.event.preventDefault(); +} +d3.interpolate = function(a, b) { + var i = d3.interpolators.length, f; + while (--i >= 0 && !(f = d3.interpolators[i](a, b))); + return f; +}; + +d3.interpolateNumber = function(a, b) { + b -= a; + return function(t) { return a + b * t; }; +}; + +d3.interpolateRound = function(a, b) { + b -= a; + return function(t) { return Math.round(a + b * t); }; +}; + +d3.interpolateString = function(a, b) { + var m, // current match + i, // current index + j, // current index (for coallescing) + s0 = 0, // start index of current string prefix + s1 = 0, // end index of current string prefix + s = [], // string constants and placeholders + q = [], // number interpolators + n, // q.length + o; + + // Reset our regular expression! + d3_interpolate_number.lastIndex = 0; + + // Find all numbers in b. + for (i = 0; m = d3_interpolate_number.exec(b); ++i) { + if (m.index) s.push(b.substring(s0, s1 = m.index)); + q.push({i: s.length, x: m[0]}); + s.push(null); + s0 = d3_interpolate_number.lastIndex; + } + if (s0 < b.length) s.push(b.substring(s0)); + + // Find all numbers in a. + for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) { + o = q[i]; + if (o.x == m[0]) { // The numbers match, so coallesce. + if (o.i) { + if (s[o.i + 1] == null) { // This match is followed by another number. + s[o.i - 1] += o.x; + s.splice(o.i, 1); + for (j = i + 1; j < n; ++j) q[j].i--; + } else { // This match is followed by a string, so coallesce twice. + s[o.i - 1] += o.x + s[o.i + 1]; + s.splice(o.i, 2); + for (j = i + 1; j < n; ++j) q[j].i -= 2; + } + } else { + if (s[o.i + 1] == null) { // This match is followed by another number. + s[o.i] = o.x; + } else { // This match is followed by a string, so coallesce twice. + s[o.i] = o.x + s[o.i + 1]; + s.splice(o.i + 1, 1); + for (j = i + 1; j < n; ++j) q[j].i--; + } + } + q.splice(i, 1); + n--; + i--; + } else { + o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x)); + } + } + + // Remove any numbers in b not found in a. + while (i < n) { + o = q.pop(); + if (s[o.i + 1] == null) { // This match is followed by another number. + s[o.i] = o.x; + } else { // This match is followed by a string, so coallesce twice. + s[o.i] = o.x + s[o.i + 1]; + s.splice(o.i + 1, 1); + } + n--; + } + + // Special optimization for only a single match. + if (s.length === 1) { + return s[0] == null ? q[0].x : function() { return b; }; + } + + // Otherwise, interpolate each of the numbers and rejoin the string. + return function(t) { + for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; +}; + +d3.interpolateTransform = function(a, b) { + return d3.interpolateString(d3.transform(a) + "", d3.transform(b) + ""); +}; + +d3.interpolateRgb = function(a, b) { + a = d3.rgb(a); + b = d3.rgb(b); + var ar = a.r, + ag = a.g, + ab = a.b, + br = b.r - ar, + bg = b.g - ag, + bb = b.b - ab; + return function(t) { + return "#" + + d3_rgb_hex(Math.round(ar + br * t)) + + d3_rgb_hex(Math.round(ag + bg * t)) + + d3_rgb_hex(Math.round(ab + bb * t)); + }; +}; + +// interpolates HSL space, but outputs RGB string (for compatibility) +d3.interpolateHsl = function(a, b) { + a = d3.hsl(a); + b = d3.hsl(b); + var h0 = a.h, + s0 = a.s, + l0 = a.l, + h1 = b.h - h0, + s1 = b.s - s0, + l1 = b.l - l0; + return function(t) { + return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t).toString(); + }; +}; + +d3.interpolateArray = function(a, b) { + var x = [], + c = [], + na = a.length, + nb = b.length, + n0 = Math.min(a.length, b.length), + i; + for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i])); + for (; i < na; ++i) c[i] = a[i]; + for (; i < nb; ++i) c[i] = b[i]; + return function(t) { + for (i = 0; i < n0; ++i) c[i] = x[i](t); + return c; + }; +}; + +d3.interpolateObject = function(a, b) { + var i = {}, + c = {}, + k; + for (k in a) { + if (k in b) { + i[k] = d3_interpolateByName(k)(a[k], b[k]); + } else { + c[k] = a[k]; + } + } + for (k in b) { + if (!(k in a)) { + c[k] = b[k]; + } + } + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; +} + +var d3_interpolate_number = /[-+]?(?:\d*\.?\d+)(?:[eE][-+]?\d+)?/g; + +function d3_interpolateByName(n) { + return n == "transform" + ? d3.interpolateTransform + : d3.interpolate; +} + +d3.interpolators = [ + d3.interpolateObject, + function(a, b) { return (b instanceof Array) && d3.interpolateArray(a, b); }, + function(a, b) { return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + ""); }, + function(a, b) { return (typeof b === "string" ? b in d3_rgb_names || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b); }, + function(a, b) { return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b); } +]; +function d3_uninterpolateNumber(a, b) { + b = b - (a = +a) ? 1 / (b - a) : 0; + return function(x) { return (x - a) * b; }; +} + +function d3_uninterpolateClamp(a, b) { + b = b - (a = +a) ? 1 / (b - a) : 0; + return function(x) { return Math.max(0, Math.min(1, (x - a) * b)); }; +} +d3.rgb = function(r, g, b) { + return arguments.length === 1 + ? (r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) + : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb)) + : d3_rgb(~~r, ~~g, ~~b); +}; + +function d3_rgb(r, g, b) { + return new d3_Rgb(r, g, b); +} + +function d3_Rgb(r, g, b) { + this.r = r; + this.g = g; + this.b = b; +} + +d3_Rgb.prototype.brighter = function(k) { + k = Math.pow(0.7, arguments.length ? k : 1); + var r = this.r, + g = this.g, + b = this.b, + i = 30; + if (!r && !g && !b) return d3_rgb(i, i, i); + if (r && r < i) r = i; + if (g && g < i) g = i; + if (b && b < i) b = i; + return d3_rgb( + Math.min(255, Math.floor(r / k)), + Math.min(255, Math.floor(g / k)), + Math.min(255, Math.floor(b / k))); +}; + +d3_Rgb.prototype.darker = function(k) { + k = Math.pow(0.7, arguments.length ? k : 1); + return d3_rgb( + Math.floor(k * this.r), + Math.floor(k * this.g), + Math.floor(k * this.b)); +}; + +d3_Rgb.prototype.hsl = function() { + return d3_rgb_hsl(this.r, this.g, this.b); +}; + +d3_Rgb.prototype.toString = function() { + return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b); +}; + +function d3_rgb_hex(v) { + return v < 0x10 + ? "0" + Math.max(0, v).toString(16) + : Math.min(255, v).toString(16); +} + +function d3_rgb_parse(format, rgb, hsl) { + var r = 0, // red channel; int in [0, 255] + g = 0, // green channel; int in [0, 255] + b = 0, // blue channel; int in [0, 255] + m1, // CSS color specification match + m2, // CSS color specification type (e.g., rgb) + name; + + /* Handle hsl, rgb. */ + m1 = /([a-z]+)\((.*)\)/i.exec(format); + if (m1) { + m2 = m1[2].split(","); + switch (m1[1]) { + case "hsl": { + return hsl( + parseFloat(m2[0]), // degrees + parseFloat(m2[1]) / 100, // percentage + parseFloat(m2[2]) / 100 // percentage + ); + } + case "rgb": { + return rgb( + d3_rgb_parseNumber(m2[0]), + d3_rgb_parseNumber(m2[1]), + d3_rgb_parseNumber(m2[2]) + ); + } + } + } + + /* Named colors. */ + if (name = d3_rgb_names[format]) return rgb(name.r, name.g, name.b); + + /* Hexadecimal colors: #rgb and #rrggbb. */ + if (format != null && format.charAt(0) === "#") { + if (format.length === 4) { + r = format.charAt(1); r += r; + g = format.charAt(2); g += g; + b = format.charAt(3); b += b; + } else if (format.length === 7) { + r = format.substring(1, 3); + g = format.substring(3, 5); + b = format.substring(5, 7); + } + r = parseInt(r, 16); + g = parseInt(g, 16); + b = parseInt(b, 16); + } + + return rgb(r, g, b); +} + +function d3_rgb_hsl(r, g, b) { + var min = Math.min(r /= 255, g /= 255, b /= 255), + max = Math.max(r, g, b), + d = max - min, + h, + s, + l = (max + min) / 2; + if (d) { + s = l < .5 ? d / (max + min) : d / (2 - max - min); + if (r == max) h = (g - b) / d + (g < b ? 6 : 0); + else if (g == max) h = (b - r) / d + 2; + else h = (r - g) / d + 4; + h *= 60; + } else { + s = h = 0; + } + return d3_hsl(h, s, l); +} + +function d3_rgb_parseNumber(c) { // either integer or percentage + var f = parseFloat(c); + return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f; +} + +var d3_rgb_names = { + aliceblue: "#f0f8ff", + antiquewhite: "#faebd7", + aqua: "#00ffff", + aquamarine: "#7fffd4", + azure: "#f0ffff", + beige: "#f5f5dc", + bisque: "#ffe4c4", + black: "#000000", + blanchedalmond: "#ffebcd", + blue: "#0000ff", + blueviolet: "#8a2be2", + brown: "#a52a2a", + burlywood: "#deb887", + cadetblue: "#5f9ea0", + chartreuse: "#7fff00", + chocolate: "#d2691e", + coral: "#ff7f50", + cornflowerblue: "#6495ed", + cornsilk: "#fff8dc", + crimson: "#dc143c", + cyan: "#00ffff", + darkblue: "#00008b", + darkcyan: "#008b8b", + darkgoldenrod: "#b8860b", + darkgray: "#a9a9a9", + darkgreen: "#006400", + darkgrey: "#a9a9a9", + darkkhaki: "#bdb76b", + darkmagenta: "#8b008b", + darkolivegreen: "#556b2f", + darkorange: "#ff8c00", + darkorchid: "#9932cc", + darkred: "#8b0000", + darksalmon: "#e9967a", + darkseagreen: "#8fbc8f", + darkslateblue: "#483d8b", + darkslategray: "#2f4f4f", + darkslategrey: "#2f4f4f", + darkturquoise: "#00ced1", + darkviolet: "#9400d3", + deeppink: "#ff1493", + deepskyblue: "#00bfff", + dimgray: "#696969", + dimgrey: "#696969", + dodgerblue: "#1e90ff", + firebrick: "#b22222", + floralwhite: "#fffaf0", + forestgreen: "#228b22", + fuchsia: "#ff00ff", + gainsboro: "#dcdcdc", + ghostwhite: "#f8f8ff", + gold: "#ffd700", + goldenrod: "#daa520", + gray: "#808080", + green: "#008000", + greenyellow: "#adff2f", + grey: "#808080", + honeydew: "#f0fff0", + hotpink: "#ff69b4", + indianred: "#cd5c5c", + indigo: "#4b0082", + ivory: "#fffff0", + khaki: "#f0e68c", + lavender: "#e6e6fa", + lavenderblush: "#fff0f5", + lawngreen: "#7cfc00", + lemonchiffon: "#fffacd", + lightblue: "#add8e6", + lightcoral: "#f08080", + lightcyan: "#e0ffff", + lightgoldenrodyellow: "#fafad2", + lightgray: "#d3d3d3", + lightgreen: "#90ee90", + lightgrey: "#d3d3d3", + lightpink: "#ffb6c1", + lightsalmon: "#ffa07a", + lightseagreen: "#20b2aa", + lightskyblue: "#87cefa", + lightslategray: "#778899", + lightslategrey: "#778899", + lightsteelblue: "#b0c4de", + lightyellow: "#ffffe0", + lime: "#00ff00", + limegreen: "#32cd32", + linen: "#faf0e6", + magenta: "#ff00ff", + maroon: "#800000", + mediumaquamarine: "#66cdaa", + mediumblue: "#0000cd", + mediumorchid: "#ba55d3", + mediumpurple: "#9370db", + mediumseagreen: "#3cb371", + mediumslateblue: "#7b68ee", + mediumspringgreen: "#00fa9a", + mediumturquoise: "#48d1cc", + mediumvioletred: "#c71585", + midnightblue: "#191970", + mintcream: "#f5fffa", + mistyrose: "#ffe4e1", + moccasin: "#ffe4b5", + navajowhite: "#ffdead", + navy: "#000080", + oldlace: "#fdf5e6", + olive: "#808000", + olivedrab: "#6b8e23", + orange: "#ffa500", + orangered: "#ff4500", + orchid: "#da70d6", + palegoldenrod: "#eee8aa", + palegreen: "#98fb98", + paleturquoise: "#afeeee", + palevioletred: "#db7093", + papayawhip: "#ffefd5", + peachpuff: "#ffdab9", + peru: "#cd853f", + pink: "#ffc0cb", + plum: "#dda0dd", + powderblue: "#b0e0e6", + purple: "#800080", + red: "#ff0000", + rosybrown: "#bc8f8f", + royalblue: "#4169e1", + saddlebrown: "#8b4513", + salmon: "#fa8072", + sandybrown: "#f4a460", + seagreen: "#2e8b57", + seashell: "#fff5ee", + sienna: "#a0522d", + silver: "#c0c0c0", + skyblue: "#87ceeb", + slateblue: "#6a5acd", + slategray: "#708090", + slategrey: "#708090", + snow: "#fffafa", + springgreen: "#00ff7f", + steelblue: "#4682b4", + tan: "#d2b48c", + teal: "#008080", + thistle: "#d8bfd8", + tomato: "#ff6347", + turquoise: "#40e0d0", + violet: "#ee82ee", + wheat: "#f5deb3", + white: "#ffffff", + whitesmoke: "#f5f5f5", + yellow: "#ffff00", + yellowgreen: "#9acd32" +}; + +for (var d3_rgb_name in d3_rgb_names) { + d3_rgb_names[d3_rgb_name] = d3_rgb_parse( + d3_rgb_names[d3_rgb_name], + d3_rgb, + d3_hsl_rgb); +} +d3.hsl = function(h, s, l) { + return arguments.length === 1 + ? (h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) + : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl)) + : d3_hsl(+h, +s, +l); +}; + +function d3_hsl(h, s, l) { + return new d3_Hsl(h, s, l); +} + +function d3_Hsl(h, s, l) { + this.h = h; + this.s = s; + this.l = l; +} + +d3_Hsl.prototype.brighter = function(k) { + k = Math.pow(0.7, arguments.length ? k : 1); + return d3_hsl(this.h, this.s, this.l / k); +}; + +d3_Hsl.prototype.darker = function(k) { + k = Math.pow(0.7, arguments.length ? k : 1); + return d3_hsl(this.h, this.s, k * this.l); +}; + +d3_Hsl.prototype.rgb = function() { + return d3_hsl_rgb(this.h, this.s, this.l); +}; + +d3_Hsl.prototype.toString = function() { + return this.rgb().toString(); +}; + +function d3_hsl_rgb(h, s, l) { + var m1, + m2; + + /* Some simple corrections for h, s and l. */ + h = h % 360; if (h < 0) h += 360; + s = s < 0 ? 0 : s > 1 ? 1 : s; + l = l < 0 ? 0 : l > 1 ? 1 : l; + + /* From FvD 13.37, CSS Color Module Level 3 */ + m2 = l <= .5 ? l * (1 + s) : l + s - l * s; + m1 = 2 * l - m2; + + function v(h) { + if (h > 360) h -= 360; + else if (h < 0) h += 360; + if (h < 60) return m1 + (m2 - m1) * h / 60; + if (h < 180) return m2; + if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; + return m1; + } + + function vv(h) { + return Math.round(v(h) * 255); + } + + return d3_rgb(vv(h + 120), vv(h), vv(h - 120)); +} +function d3_selection(groups) { + d3_arraySubclass(groups, d3_selectionPrototype); + return groups; +} + +var d3_select = function(s, n) { return n.querySelector(s); }, + d3_selectAll = function(s, n) { return n.querySelectorAll(s); }, + d3_selectRoot = document.documentElement, + d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, + d3_selectMatches = function(n, s) { return d3_selectMatcher.call(n, s); }; + +// Prefer Sizzle, if available. +if (typeof Sizzle === "function") { + d3_select = function(s, n) { return Sizzle(s, n)[0]; }; + d3_selectAll = function(s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); }; + d3_selectMatches = Sizzle.matchesSelector; +} + +var d3_selectionPrototype = []; + +d3.selection = function() { + return d3_selectionRoot; +}; + +d3.selection.prototype = d3_selectionPrototype; +d3_selectionPrototype.select = function(selector) { + var subgroups = [], + subgroup, + subnode, + group, + node; + + if (typeof selector !== "function") selector = d3_selection_selector(selector); + + for (var j = -1, m = this.length; ++j < m;) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = -1, n = group.length; ++i < n;) { + if (node = group[i]) { + subgroup.push(subnode = selector.call(node, node.__data__, i)); + if (subnode && "__data__" in node) subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + + return d3_selection(subgroups); +}; + +function d3_selection_selector(selector) { + return function() { + return d3_select(selector, this); + }; +} +d3_selectionPrototype.selectAll = function(selector) { + var subgroups = [], + subgroup, + node; + + if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); + + for (var j = -1, m = this.length; ++j < m;) { + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + if (node = group[i]) { + subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i))); + subgroup.parentNode = node; + } + } + } + + return d3_selection(subgroups); +}; + +function d3_selection_selectorAll(selector) { + return function() { + return d3_selectAll(selector, this); + }; +} +d3_selectionPrototype.attr = function(name, value) { + name = d3.ns.qualify(name); + + // If no value is specified, return the first value. + if (arguments.length < 2) { + var node = this.node(); + return name.local + ? node.getAttributeNS(name.space, name.local) + : node.getAttribute(name); + } + + function attrNull() { + this.removeAttribute(name); + } + + function attrNullNS() { + this.removeAttributeNS(name.space, name.local); + } + + function attrConstant() { + this.setAttribute(name, value); + } + + function attrConstantNS() { + this.setAttributeNS(name.space, name.local, value); + } + + function attrFunction() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttribute(name); + else this.setAttribute(name, x); + } + + function attrFunctionNS() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttributeNS(name.space, name.local); + else this.setAttributeNS(name.space, name.local, x); + } + + return this.each(value == null + ? (name.local ? attrNullNS : attrNull) : (typeof value === "function" + ? (name.local ? attrFunctionNS : attrFunction) + : (name.local ? attrConstantNS : attrConstant))); +}; +d3_selectionPrototype.classed = function(name, value) { + var names = name.split(d3_selection_classedWhitespace), + n = names.length, + i = -1; + if (arguments.length > 1) { + while (++i < n) d3_selection_classed.call(this, names[i], value); + return this; + } else { + while (++i < n) if (!d3_selection_classed.call(this, names[i])) return false; + return true; + } +}; + +var d3_selection_classedWhitespace = /\s+/g; + +function d3_selection_classed(name, value) { + var re = new RegExp("(^|\\s+)" + d3.requote(name) + "(\\s+|$)", "g"); + + // If no value is specified, return the first value. + if (arguments.length < 2) { + var node = this.node(); + if (c = node.classList) return c.contains(name); + var c = node.className; + re.lastIndex = 0; + return re.test(c.baseVal != null ? c.baseVal : c); + } + + function classedAdd() { + if (c = this.classList) return c.add(name); + var c = this.className, + cb = c.baseVal != null, + cv = cb ? c.baseVal : c; + re.lastIndex = 0; + if (!re.test(cv)) { + cv = d3_collapse(cv + " " + name); + if (cb) c.baseVal = cv; + else this.className = cv; + } + } + + function classedRemove() { + if (c = this.classList) return c.remove(name); + var c = this.className, + cb = c.baseVal != null, + cv = cb ? c.baseVal : c; + cv = d3_collapse(cv.replace(re, " ")); + if (cb) c.baseVal = cv; + else this.className = cv; + } + + function classedFunction() { + (value.apply(this, arguments) + ? classedAdd + : classedRemove).call(this); + } + + return this.each(typeof value === "function" + ? classedFunction : value + ? classedAdd + : classedRemove); +} +d3_selectionPrototype.style = function(name, value, priority) { + if (arguments.length < 3) priority = ""; + + // If no value is specified, return the first value. + if (arguments.length < 2) return window + .getComputedStyle(this.node(), null) + .getPropertyValue(name); + + function styleNull() { + this.style.removeProperty(name); + } + + function styleConstant() { + this.style.setProperty(name, value, priority); + } + + function styleFunction() { + var x = value.apply(this, arguments); + if (x == null) this.style.removeProperty(name); + else this.style.setProperty(name, x, priority); + } + + return this.each(value == null + ? styleNull : (typeof value === "function" + ? styleFunction : styleConstant)); +}; +d3_selectionPrototype.property = function(name, value) { + + // If no value is specified, return the first value. + if (arguments.length < 2) return this.node()[name]; + + function propertyNull() { + delete this[name]; + } + + function propertyConstant() { + this[name] = value; + } + + function propertyFunction() { + var x = value.apply(this, arguments); + if (x == null) delete this[name]; + else this[name] = x; + } + + return this.each(value == null + ? propertyNull : (typeof value === "function" + ? propertyFunction : propertyConstant)); +}; +d3_selectionPrototype.text = function(value) { + return arguments.length < 1 + ? this.node().textContent : this.each(typeof value === "function" + ? function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; } : value == null + ? function() { this.textContent = ""; } + : function() { this.textContent = value; }); +}; +d3_selectionPrototype.html = function(value) { + return arguments.length < 1 + ? this.node().innerHTML : this.each(typeof value === "function" + ? function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; } : value == null + ? function() { this.innerHTML = ""; } + : function() { this.innerHTML = value; }); +}; +// TODO append(node)? +// TODO append(function)? +d3_selectionPrototype.append = function(name) { + name = d3.ns.qualify(name); + + function append() { + return this.appendChild(document.createElementNS(this.namespaceURI, name)); + } + + function appendNS() { + return this.appendChild(document.createElementNS(name.space, name.local)); + } + + return this.select(name.local ? appendNS : append); +}; +// TODO insert(node, function)? +// TODO insert(function, string)? +// TODO insert(function, function)? +d3_selectionPrototype.insert = function(name, before) { + name = d3.ns.qualify(name); + + function insert() { + return this.insertBefore( + document.createElementNS(this.namespaceURI, name), + d3_select(before, this)); + } + + function insertNS() { + return this.insertBefore( + document.createElementNS(name.space, name.local), + d3_select(before, this)); + } + + return this.select(name.local ? insertNS : insert); +}; +// TODO remove(selector)? +// TODO remove(node)? +// TODO remove(function)? +d3_selectionPrototype.remove = function() { + return this.each(function() { + var parent = this.parentNode; + if (parent) parent.removeChild(this); + }); +}; +// TODO data(null) for clearing data? +d3_selectionPrototype.data = function(data, join) { + var enter = [], + update = [], + exit = []; + + function bind(group, groupData) { + var i, + n = group.length, + m = groupData.length, + n0 = Math.min(n, m), + n1 = Math.max(n, m), + updateNodes = [], + enterNodes = [], + exitNodes = [], + node, + nodeData; + + if (join) { + var nodeByKey = {}, + keys = [], + key, + j = groupData.length; + + for (i = -1; ++i < n;) { + key = join.call(node = group[i], node.__data__, i); + if (key in nodeByKey) { + exitNodes[j++] = node; // duplicate key + } else { + nodeByKey[key] = node; + } + keys.push(key); + } + + for (i = -1; ++i < m;) { + node = nodeByKey[key = join.call(groupData, nodeData = groupData[i], i)]; + if (node) { + node.__data__ = nodeData; + updateNodes[i] = node; + enterNodes[i] = exitNodes[i] = null; + } else { + enterNodes[i] = d3_selection_dataNode(nodeData); + updateNodes[i] = exitNodes[i] = null; + } + delete nodeByKey[key]; + } + + for (i = -1; ++i < n;) { + if (keys[i] in nodeByKey) { + exitNodes[i] = group[i]; + } + } + } else { + for (i = -1; ++i < n0;) { + node = group[i]; + nodeData = groupData[i]; + if (node) { + node.__data__ = nodeData; + updateNodes[i] = node; + enterNodes[i] = exitNodes[i] = null; + } else { + enterNodes[i] = d3_selection_dataNode(nodeData); + updateNodes[i] = exitNodes[i] = null; + } + } + for (; i < m; ++i) { + enterNodes[i] = d3_selection_dataNode(groupData[i]); + updateNodes[i] = exitNodes[i] = null; + } + for (; i < n1; ++i) { + exitNodes[i] = group[i]; + enterNodes[i] = updateNodes[i] = null; + } + } + + enterNodes.update + = updateNodes; + + enterNodes.parentNode + = updateNodes.parentNode + = exitNodes.parentNode + = group.parentNode; + + enter.push(enterNodes); + update.push(updateNodes); + exit.push(exitNodes); + } + + var i = -1, + n = this.length, + group; + if (typeof data === "function") { + while (++i < n) { + bind(group = this[i], data.call(group, group.parentNode.__data__, i)); + } + } else { + while (++i < n) { + bind(group = this[i], data); + } + } + + var selection = d3_selection(update); + selection.enter = function() { return d3_selection_enter(enter); }; + selection.exit = function() { return d3_selection(exit); }; + return selection; +}; + +function d3_selection_dataNode(data) { + return {__data__: data}; +} +d3_selectionPrototype.filter = function(filter) { + var subgroups = [], + subgroup, + group, + node; + + if (typeof filter !== "function") filter = d3_selection_filter(filter); + + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = 0, n = group.length; i < n; i++) { + if ((node = group[i]) && filter.call(node, node.__data__, i)) { + subgroup.push(node); + } + } + } + + return d3_selection(subgroups); +}; + +function d3_selection_filter(selector) { + return function() { + return d3_selectMatches(this, selector); + }; +} +d3_selectionPrototype.map = function(map) { + return this.each(function() { + this.__data__ = map.apply(this, arguments); + }); +}; +d3_selectionPrototype.order = function() { + for (var j = -1, m = this.length; ++j < m;) { + for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0;) { + if (node = group[i]) { + if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next); + next = node; + } + } + } + return this; +}; +d3_selectionPrototype.sort = function(comparator) { + comparator = d3_selection_sortComparator.apply(this, arguments); + for (var j = -1, m = this.length; ++j < m;) this[j].sort(comparator); + return this.order(); +}; + +function d3_selection_sortComparator(comparator) { + if (!arguments.length) comparator = d3.ascending; + return function(a, b) { + return comparator(a && a.__data__, b && b.__data__); + }; +} +// type can be namespaced, e.g., "click.foo" +// listener can be null for removal +d3_selectionPrototype.on = function(type, listener, capture) { + if (arguments.length < 3) capture = false; + + // parse the type specifier + var name = "__on" + type, i = type.indexOf("."); + if (i > 0) type = type.substring(0, i); + + // if called with only one argument, return the current listener + if (arguments.length < 2) return (i = this.node()[name]) && i._; + + // remove the old event listener, and add the new event listener + return this.each(function(d, i) { + var node = this; + + if (node[name]) node.removeEventListener(type, node[name], capture); + if (listener) node.addEventListener(type, node[name] = l, capture); + + // wrapped event listener that preserves i + function l(e) { + var o = d3.event; // Events can be reentrant (e.g., focus). + d3.event = e; + try { + listener.call(node, node.__data__, i); + } finally { + d3.event = o; + } + } + + // stash the unwrapped listener for retrieval + l._ = listener; + }); +}; +d3_selectionPrototype.each = function(callback) { + for (var j = -1, m = this.length; ++j < m;) { + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + var node = group[i]; + if (node) callback.call(node, node.__data__, i, j); + } + } + return this; +}; +// +// Note: assigning to the arguments array simultaneously changes the value of +// the corresponding argument! +// +// TODO The `this` argument probably shouldn't be the first argument to the +// callback, anyway, since it's redundant. However, that will require a major +// version bump due to backwards compatibility, so I'm not changing it right +// away. +// +d3_selectionPrototype.call = function(callback) { + callback.apply(this, (arguments[0] = this, arguments)); + return this; +}; +d3_selectionPrototype.empty = function() { + return !this.node(); +}; +d3_selectionPrototype.node = function(callback) { + for (var j = 0, m = this.length; j < m; j++) { + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + var node = group[i]; + if (node) return node; + } + } + return null; +}; +d3_selectionPrototype.transition = function() { + var subgroups = [], + subgroup, + node; + + for (var j = -1, m = this.length; ++j < m;) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + subgroup.push((node = group[i]) ? {node: node, delay: 0, duration: 250} : null); + } + } + + return d3_transition(subgroups, d3_transitionInheritId || ++d3_transitionId, Date.now()); +}; +var d3_selectionRoot = d3_selection([[document]]); + +d3_selectionRoot[0].parentNode = d3_selectRoot; + +// TODO fast singleton implementation! +// TODO select(function) +d3.select = function(selector) { + return typeof selector === "string" + ? d3_selectionRoot.select(selector) + : d3_selection([[selector]]); // assume node +}; + +// TODO selectAll(function) +d3.selectAll = function(selector) { + return typeof selector === "string" + ? d3_selectionRoot.selectAll(selector) + : d3_selection([d3_array(selector)]); // assume node[] +}; +function d3_selection_enter(selection) { + d3_arraySubclass(selection, d3_selection_enterPrototype); + return selection; +} + +var d3_selection_enterPrototype = []; + +d3_selection_enterPrototype.append = d3_selectionPrototype.append; +d3_selection_enterPrototype.insert = d3_selectionPrototype.insert; +d3_selection_enterPrototype.empty = d3_selectionPrototype.empty; +d3_selection_enterPrototype.node = d3_selectionPrototype.node; +d3_selection_enterPrototype.select = function(selector) { + var subgroups = [], + subgroup, + subnode, + upgroup, + group, + node; + + for (var j = -1, m = this.length; ++j < m;) { + upgroup = (group = this[j]).update; + subgroups.push(subgroup = []); + subgroup.parentNode = group.parentNode; + for (var i = -1, n = group.length; ++i < n;) { + if (node = group[i]) { + subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i)); + subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + + return d3_selection(subgroups); +}; +function d3_transition(groups, id, time) { + d3_arraySubclass(groups, d3_transitionPrototype); + + var tweens = {}, + event = d3.dispatch("start", "end"), + ease = d3_transitionEase; + + groups.id = id; + + groups.time = time; + + groups.tween = function(name, tween) { + if (arguments.length < 2) return tweens[name]; + if (tween == null) delete tweens[name]; + else tweens[name] = tween; + return groups; + }; + + groups.ease = function(value) { + if (!arguments.length) return ease; + ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments); + return groups; + }; + + groups.each = function(type, listener) { + if (arguments.length < 2) return d3_transition_each.call(groups, type); + event.on(type, listener); + return groups; + }; + + d3.timer(function(elapsed) { + groups.each(function(d, i, j) { + var tweened = [], + node = this, + delay = groups[j][i].delay, + duration = groups[j][i].duration, + lock = node.__transition__ || (node.__transition__ = {active: 0, count: 0}); + + ++lock.count; + + delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time); + + function start(elapsed) { + if (lock.active > id) return stop(); + lock.active = id; + + for (var tween in tweens) { + if (tween = tweens[tween].call(node, d, i)) { + tweened.push(tween); + } + } + + event.start.call(node, d, i); + if (!tick(elapsed)) d3.timer(tick, 0, time); + return 1; + } + + function tick(elapsed) { + if (lock.active !== id) return stop(); + + var t = (elapsed - delay) / duration, + e = ease(t), + n = tweened.length; + + while (n > 0) { + tweened[--n].call(node, e); + } + + if (t >= 1) { + stop(); + d3_transitionInheritId = id; + event.end.call(node, d, i); + d3_transitionInheritId = 0; + return 1; + } + } + + function stop() { + if (!--lock.count) delete node.__transition__; + return 1; + } + }); + return 1; + }, 0, time); + + return groups; +} + +var d3_transitionRemove = {}; + +function d3_transitionNull(d, i, a) { + return a != "" && d3_transitionRemove; +} + +function d3_transitionTween(name, b) { + var interpolate = d3_interpolateByName(name); + + function transitionFunction(d, i, a) { + var v = b.call(this, d, i); + return v == null + ? a != "" && d3_transitionRemove + : a != v && interpolate(a, v); + } + + function transitionString(d, i, a) { + return a != b && interpolate(a, b); + } + + return typeof b === "function" ? transitionFunction + : b == null ? d3_transitionNull + : (b += "", transitionString); +} + +var d3_transitionPrototype = [], + d3_transitionId = 0, + d3_transitionInheritId = 0, + d3_transitionEase = d3.ease("cubic-in-out"); + +d3_transitionPrototype.call = d3_selectionPrototype.call; + +d3.transition = function() { + return d3_selectionRoot.transition(); +}; + +d3.transition.prototype = d3_transitionPrototype; +d3_transitionPrototype.select = function(selector) { + var subgroups = [], + subgroup, + subnode, + node; + + if (typeof selector !== "function") selector = d3_selection_selector(selector); + + for (var j = -1, m = this.length; ++j < m;) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) { + if ("__data__" in node.node) subnode.__data__ = node.node.__data__; + subgroup.push({node: subnode, delay: node.delay, duration: node.duration}); + } else { + subgroup.push(null); + } + } + } + + return d3_transition(subgroups, this.id, this.time).ease(this.ease()); +}; +d3_transitionPrototype.selectAll = function(selector) { + var subgroups = [], + subgroup, + subnodes, + node; + + if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); + + for (var j = -1, m = this.length; ++j < m;) { + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + if (node = group[i]) { + subnodes = selector.call(node.node, node.node.__data__, i); + subgroups.push(subgroup = []); + for (var k = -1, o = subnodes.length; ++k < o;) { + subgroup.push({node: subnodes[k], delay: node.delay, duration: node.duration}); + } + } + } + } + + return d3_transition(subgroups, this.id, this.time).ease(this.ease()); +}; +d3_transitionPrototype.attr = function(name, value) { + return this.attrTween(name, d3_transitionTween(name, value)); +}; + +d3_transitionPrototype.attrTween = function(nameNS, tween) { + var name = d3.ns.qualify(nameNS); + + function attrTween(d, i) { + var f = tween.call(this, d, i, this.getAttribute(name)); + return f === d3_transitionRemove + ? (this.removeAttribute(name), null) + : f && function(t) { this.setAttribute(name, f(t)); }; + } + + function attrTweenNS(d, i) { + var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local)); + return f === d3_transitionRemove + ? (this.removeAttributeNS(name.space, name.local), null) + : f && function(t) { this.setAttributeNS(name.space, name.local, f(t)); }; + } + + return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween); +}; +d3_transitionPrototype.style = function(name, value, priority) { + if (arguments.length < 3) priority = ""; + return this.styleTween(name, d3_transitionTween(name, value), priority); +}; + +d3_transitionPrototype.styleTween = function(name, tween, priority) { + if (arguments.length < 3) priority = ""; + return this.tween("style." + name, function(d, i) { + var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name)); + return f === d3_transitionRemove + ? (this.style.removeProperty(name), null) + : f && function(t) { this.style.setProperty(name, f(t), priority); }; + }); +}; +d3_transitionPrototype.text = function(value) { + return this.tween("text", function(d, i) { + this.textContent = typeof value === "function" + ? value.call(this, d, i) + : value; + }); +}; +d3_transitionPrototype.remove = function() { + return this.each("end", function() { + var p; + if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this); + }); +}; +d3_transitionPrototype.delay = function(value) { + var groups = this; + return groups.each(typeof value === "function" + ? function(d, i, j) { groups[j][i].delay = +value.apply(this, arguments); } + : (value = +value, function(d, i, j) { groups[j][i].delay = value; })); +}; +d3_transitionPrototype.duration = function(value) { + var groups = this; + return groups.each(typeof value === "function" + ? function(d, i, j) { groups[j][i].duration = +value.apply(this, arguments); } + : (value = +value, function(d, i, j) { groups[j][i].duration = value; })); +}; +function d3_transition_each(callback) { + for (var j = 0, m = this.length; j < m; j++) { + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + var node = group[i]; + if (node) callback.call(node = node.node, node.__data__, i, j); + } + } + return this; +} +d3_transitionPrototype.transition = function() { + return this.select(d3_this); +}; +var d3_timer_queue = null, + d3_timer_interval, // is an interval (or frame) active? + d3_timer_timeout; // is a timeout active? + +// The timer will continue to fire until callback returns true. +d3.timer = function(callback, delay, then) { + var found = false, + t0, + t1 = d3_timer_queue; + + if (arguments.length < 3) { + if (arguments.length < 2) delay = 0; + else if (!isFinite(delay)) return; + then = Date.now(); + } + + // See if the callback's already in the queue. + while (t1) { + if (t1.callback === callback) { + t1.then = then; + t1.delay = delay; + found = true; + break; + } + t0 = t1; + t1 = t1.next; + } + + // Otherwise, add the callback to the queue. + if (!found) d3_timer_queue = { + callback: callback, + then: then, + delay: delay, + next: d3_timer_queue + }; + + // Start animatin'! + if (!d3_timer_interval) { + d3_timer_timeout = clearTimeout(d3_timer_timeout); + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } +} + +function d3_timer_step() { + var elapsed, + now = Date.now(), + t1 = d3_timer_queue; + + while (t1) { + elapsed = now - t1.then; + if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed); + t1 = t1.next; + } + + var delay = d3_timer_flush() - now; + if (delay > 24) { + if (isFinite(delay)) { + clearTimeout(d3_timer_timeout); + d3_timer_timeout = setTimeout(d3_timer_step, delay); + } + d3_timer_interval = 0; + } else { + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } +} + +d3.timer.flush = function() { + var elapsed, + now = Date.now(), + t1 = d3_timer_queue; + + while (t1) { + elapsed = now - t1.then; + if (!t1.delay) t1.flush = t1.callback(elapsed); + t1 = t1.next; + } + + d3_timer_flush(); +}; + +// Flush after callbacks, to avoid concurrent queue modification. +function d3_timer_flush() { + var t0 = null, + t1 = d3_timer_queue, + then = Infinity; + while (t1) { + if (t1.flush) { + t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next; + } else { + then = Math.min(then, t1.then + t1.delay); + t1 = (t0 = t1).next; + } + } + return then; +} + +var d3_timer_frame = window.requestAnimationFrame + || window.webkitRequestAnimationFrame + || window.mozRequestAnimationFrame + || window.oRequestAnimationFrame + || window.msRequestAnimationFrame + || function(callback) { setTimeout(callback, 17); }; +d3.transform = function(string) { + var g = document.createElementNS(d3.ns.prefix.svg, "g"), + identity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0}; + return (d3.transform = function(string) { + g.setAttribute("transform", string); + var t = g.transform.baseVal.consolidate(); + return new d3_transform(t ? t.matrix : identity); + })(string); +}; + +// Compute x-scale and normalize the first row. +// Compute shear and make second row orthogonal to first. +// Compute y-scale and normalize the second row. +// Finally, compute the rotation. +function d3_transform(m) { + var r0 = [m.a, m.b], + r1 = [m.c, m.d], + kx = d3_transformNormalize(r0), + kz = d3_transformDot(r0, r1), + ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0; + if (r0[0] * r1[1] < r1[0] * r0[1]) { + r0[0] *= -1; + r0[1] *= -1; + kx *= -1; + kz *= -1; + } + this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees; + this.translate = [m.e, m.f]; + this.scale = [kx, ky]; + this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0; +}; + +d3_transform.prototype.toString = function() { + return "translate(" + this.translate + + ")rotate(" + this.rotate + + ")skewX(" + this.skew + + ")scale(" + this.scale + + ")"; +}; + +function d3_transformDot(a, b) { + return a[0] * b[0] + a[1] * b[1]; +} + +function d3_transformNormalize(a) { + var k = Math.sqrt(d3_transformDot(a, a)); + if (k) { + a[0] /= k; + a[1] /= k; + } + return k; +} + +function d3_transformCombine(a, b, k) { + a[0] += k * b[0]; + a[1] += k * b[1]; + return a; +} + +var d3_transformDegrees = 180 / Math.PI; +function d3_noop() {} +d3.scale = {}; + +function d3_scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [start, stop] : [stop, start]; +} + +function d3_scaleRange(scale) { + return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range()); +} +function d3_scale_nice(domain, nice) { + var i0 = 0, + i1 = domain.length - 1, + x0 = domain[i0], + x1 = domain[i1], + dx; + + if (x1 < x0) { + dx = i0; i0 = i1; i1 = dx; + dx = x0; x0 = x1; x1 = dx; + } + + if (dx = x1 - x0) { + nice = nice(dx); + domain[i0] = nice.floor(x0); + domain[i1] = nice.ceil(x1); + } + + return domain; +} + +function d3_scale_niceDefault() { + return Math; +} +d3.scale.linear = function() { + return d3_scale_linear([0, 1], [0, 1], d3.interpolate, false); +}; + +function d3_scale_linear(domain, range, interpolate, clamp) { + var output, + input; + + function rescale() { + var linear = domain.length == 2 ? d3_scale_bilinear : d3_scale_polylinear, + uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber; + output = linear(domain, range, uninterpolate, interpolate); + input = linear(range, domain, uninterpolate, d3.interpolate); + return scale; + } + + function scale(x) { + return output(x); + } + + // Note: requires range is coercible to number! + scale.invert = function(y) { + return input(y); + }; + + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.map(Number); + return rescale(); + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + + scale.rangeRound = function(x) { + return scale.range(x).interpolate(d3.interpolateRound); + }; + + scale.clamp = function(x) { + if (!arguments.length) return clamp; + clamp = x; + return rescale(); + }; + + scale.interpolate = function(x) { + if (!arguments.length) return interpolate; + interpolate = x; + return rescale(); + }; + + scale.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + + scale.tickFormat = function(m) { + return d3_scale_linearTickFormat(domain, m); + }; + + scale.nice = function() { + d3_scale_nice(domain, d3_scale_linearNice); + return rescale(); + }; + + scale.copy = function() { + return d3_scale_linear(domain, range, interpolate, clamp); + }; + + return rescale(); +}; + +function d3_scale_linearRebind(scale, linear) { + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); +} + +function d3_scale_linearNice(dx) { + dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1); + return { + floor: function(x) { return Math.floor(x / dx) * dx; }, + ceil: function(x) { return Math.ceil(x / dx) * dx; } + }; +} + +// TODO Dates? Ugh. +function d3_scale_linearTickRange(domain, m) { + var extent = d3_scaleExtent(domain), + span = extent[1] - extent[0], + step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), + err = m / span * step; + + // Filter ticks to get closer to the desired count. + if (err <= .15) step *= 10; + else if (err <= .35) step *= 5; + else if (err <= .75) step *= 2; + + // Round start and stop values to step interval. + extent[0] = Math.ceil(extent[0] / step) * step; + extent[1] = Math.floor(extent[1] / step) * step + step * .5; // inclusive + extent[2] = step; + return extent; +} + +function d3_scale_linearTicks(domain, m) { + return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); +} + +function d3_scale_linearTickFormat(domain, m) { + return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f"); +} +function d3_scale_bilinear(domain, range, uninterpolate, interpolate) { + var u = uninterpolate(domain[0], domain[1]), + i = interpolate(range[0], range[1]); + return function(x) { + return i(u(x)); + }; +} +function d3_scale_polylinear(domain, range, uninterpolate, interpolate) { + var u = [], + i = [], + j = 0, + n = domain.length; + + while (++j < n) { + u.push(uninterpolate(domain[j - 1], domain[j])); + i.push(interpolate(range[j - 1], range[j])); + } + + return function(x) { + var j = d3.bisect(domain, x, 1, domain.length - 1) - 1; + return i[j](u[j](x)); + }; +} +d3.scale.log = function() { + return d3_scale_log(d3.scale.linear(), d3_scale_logp); +}; + +function d3_scale_log(linear, log) { + var pow = log.pow; + + function scale(x) { + return linear(log(x)); + } + + scale.invert = function(x) { + return pow(linear.invert(x)); + }; + + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(pow); + log = x[0] < 0 ? d3_scale_logn : d3_scale_logp; + pow = log.pow; + linear.domain(x.map(log)); + return scale; + }; + + scale.nice = function() { + linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault)); + return scale; + }; + + scale.ticks = function() { + var extent = d3_scaleExtent(linear.domain()), + ticks = []; + if (extent.every(isFinite)) { + var i = Math.floor(extent[0]), + j = Math.ceil(extent[1]), + u = pow(extent[0]), + v = pow(extent[1]); + if (log === d3_scale_logn) { + ticks.push(pow(i)); + for (; i++ < j;) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k); + } else { + for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k); + ticks.push(pow(i)); + } + for (i = 0; ticks[i] < u; i++) {} // strip small values + for (j = ticks.length; ticks[j - 1] > v; j--) {} // strip big values + ticks = ticks.slice(i, j); + } + return ticks; + }; + + scale.tickFormat = function(n, format) { + if (arguments.length < 2) format = d3_scale_logFormat; + if (arguments.length < 1) return format; + var k = n / scale.ticks().length, + f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), + e; + return function(d) { + return d / pow(f(log(d) + e)) < k ? format(d) : ""; + }; + }; + + scale.copy = function() { + return d3_scale_log(linear.copy(), log); + }; + + return d3_scale_linearRebind(scale, linear); +}; + +var d3_scale_logFormat = d3.format(".0e"); + +function d3_scale_logp(x) { + return Math.log(x < 0 ? 0 : x) / Math.LN10; +} + +function d3_scale_logn(x) { + return -Math.log(x > 0 ? 0 : -x) / Math.LN10; +} + +d3_scale_logp.pow = function(x) { + return Math.pow(10, x); +}; + +d3_scale_logn.pow = function(x) { + return -Math.pow(10, -x); +}; +d3.scale.pow = function() { + return d3_scale_pow(d3.scale.linear(), 1); +}; + +function d3_scale_pow(linear, exponent) { + var powp = d3_scale_powPow(exponent), + powb = d3_scale_powPow(1 / exponent); + + function scale(x) { + return linear(powp(x)); + } + + scale.invert = function(x) { + return powb(linear.invert(x)); + }; + + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(powb); + linear.domain(x.map(powp)); + return scale; + }; + + scale.ticks = function(m) { + return d3_scale_linearTicks(scale.domain(), m); + }; + + scale.tickFormat = function(m) { + return d3_scale_linearTickFormat(scale.domain(), m); + }; + + scale.nice = function() { + return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice)); + }; + + scale.exponent = function(x) { + if (!arguments.length) return exponent; + var domain = scale.domain(); + powp = d3_scale_powPow(exponent = x); + powb = d3_scale_powPow(1 / exponent); + return scale.domain(domain); + }; + + scale.copy = function() { + return d3_scale_pow(linear.copy(), exponent); + }; + + return d3_scale_linearRebind(scale, linear); +}; + +function d3_scale_powPow(e) { + return function(x) { + return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); + }; +} +d3.scale.sqrt = function() { + return d3.scale.pow().exponent(.5); +}; +d3.scale.ordinal = function() { + return d3_scale_ordinal([], {t: "range", x: []}); +}; + +function d3_scale_ordinal(domain, ranger) { + var index, + range, + rangeBand; + + function scale(x) { + return range[((index[x] || (index[x] = domain.push(x))) - 1) % range.length]; + } + + function steps(start, step) { + return d3.range(domain.length).map(function(i) { return start + step * i; }); + } + + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = []; + index = {}; + var i = -1, n = x.length, xi; + while (++i < n) if (!index[xi = x[i]]) index[xi] = domain.push(xi); + return scale[ranger.t](ranger.x, ranger.p); + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + rangeBand = 0; + ranger = {t: "range", x: x}; + return scale; + }; + + scale.rangePoints = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], + stop = x[1], + step = (stop - start) / (domain.length - 1 + padding); + range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step); + rangeBand = 0; + ranger = {t: "rangePoints", x: x, p: padding}; + return scale; + }; + + scale.rangeBands = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], + stop = x[1], + step = (stop - start) / (domain.length + padding); + range = steps(start + step * padding, step); + rangeBand = step * (1 - padding); + ranger = {t: "rangeBands", x: x, p: padding}; + return scale; + }; + + scale.rangeRoundBands = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], + stop = x[1], + step = Math.floor((stop - start) / (domain.length + padding)); + range = steps(start + Math.round((stop - start - (domain.length - padding) * step) / 2), step); + rangeBand = Math.round(step * (1 - padding)); + ranger = {t: "rangeRoundBands", x: x, p: padding}; + return scale; + }; + + scale.rangeBand = function() { + return rangeBand; + }; + + scale.rangeExtent = function() { + return ranger.t === "range" ? d3_scaleExtent(ranger.x) : ranger.x; + }; + + scale.copy = function() { + return d3_scale_ordinal(domain, ranger); + }; + + return scale.domain(domain); +}; +/* + * This product includes color specifications and designs developed by Cynthia + * Brewer (http://colorbrewer.org/). See lib/colorbrewer for more information. + */ + +d3.scale.category10 = function() { + return d3.scale.ordinal().range(d3_category10); +}; + +d3.scale.category20 = function() { + return d3.scale.ordinal().range(d3_category20); +}; + +d3.scale.category20b = function() { + return d3.scale.ordinal().range(d3_category20b); +}; + +d3.scale.category20c = function() { + return d3.scale.ordinal().range(d3_category20c); +}; + +var d3_category10 = [ + "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", + "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" +]; + +var d3_category20 = [ + "#1f77b4", "#aec7e8", + "#ff7f0e", "#ffbb78", + "#2ca02c", "#98df8a", + "#d62728", "#ff9896", + "#9467bd", "#c5b0d5", + "#8c564b", "#c49c94", + "#e377c2", "#f7b6d2", + "#7f7f7f", "#c7c7c7", + "#bcbd22", "#dbdb8d", + "#17becf", "#9edae5" +]; + +var d3_category20b = [ + "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", + "#637939", "#8ca252", "#b5cf6b", "#cedb9c", + "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", + "#843c39", "#ad494a", "#d6616b", "#e7969c", + "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" +]; + +var d3_category20c = [ + "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", + "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", + "#31a354", "#74c476", "#a1d99b", "#c7e9c0", + "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", + "#636363", "#969696", "#bdbdbd", "#d9d9d9" +]; +d3.scale.quantile = function() { + return d3_scale_quantile([], []); +}; + +function d3_scale_quantile(domain, range) { + var thresholds; + + function rescale() { + var k = 0, + n = domain.length, + q = range.length; + thresholds = []; + while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q); + return scale; + } + + function scale(x) { + if (isNaN(x = +x)) return NaN; + return range[d3.bisect(thresholds, x)]; + } + + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending); + return rescale(); + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + + scale.quantiles = function() { + return thresholds; + }; + + scale.copy = function() { + return d3_scale_quantile(domain, range); // copy on write! + }; + + return rescale(); +}; +d3.scale.quantize = function() { + return d3_scale_quantize(0, 1, [0, 1]); +}; + +function d3_scale_quantize(x0, x1, range) { + var kx, i; + + function scale(x) { + return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; + } + + function rescale() { + kx = range.length / (x1 - x0); + i = range.length - 1; + return scale; + } + + scale.domain = function(x) { + if (!arguments.length) return [x0, x1]; + x0 = +x[0]; + x1 = +x[x.length - 1]; + return rescale(); + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + + scale.copy = function() { + return d3_scale_quantize(x0, x1, range); // copy on write + }; + + return rescale(); +}; +d3.svg = {}; +d3.svg.arc = function() { + var innerRadius = d3_svg_arcInnerRadius, + outerRadius = d3_svg_arcOuterRadius, + startAngle = d3_svg_arcStartAngle, + endAngle = d3_svg_arcEndAngle; + + function arc() { + var r0 = innerRadius.apply(this, arguments), + r1 = outerRadius.apply(this, arguments), + a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, + a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, + da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0), + df = da < Math.PI ? "0" : "1", + c0 = Math.cos(a0), + s0 = Math.sin(a0), + c1 = Math.cos(a1), + s1 = Math.sin(a1); + return da >= d3_svg_arcMax + ? (r0 + ? "M0," + r1 + + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) + + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + + "M0," + r0 + + "A" + r0 + "," + r0 + " 0 1,0 0," + (-r0) + + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + + "Z" + : "M0," + r1 + + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) + + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + + "Z") + : (r0 + ? "M" + r1 * c0 + "," + r1 * s0 + + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + + "L" + r0 * c1 + "," + r0 * s1 + + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + + "Z" + : "M" + r1 * c0 + "," + r1 * s0 + + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + + "L0,0" + + "Z"); + } + + arc.innerRadius = function(v) { + if (!arguments.length) return innerRadius; + innerRadius = d3.functor(v); + return arc; + }; + + arc.outerRadius = function(v) { + if (!arguments.length) return outerRadius; + outerRadius = d3.functor(v); + return arc; + }; + + arc.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3.functor(v); + return arc; + }; + + arc.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3.functor(v); + return arc; + }; + + arc.centroid = function() { + var r = (innerRadius.apply(this, arguments) + + outerRadius.apply(this, arguments)) / 2, + a = (startAngle.apply(this, arguments) + + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset; + return [Math.cos(a) * r, Math.sin(a) * r]; + }; + + return arc; +}; + +var d3_svg_arcOffset = -Math.PI / 2, + d3_svg_arcMax = 2 * Math.PI - 1e-6; + +function d3_svg_arcInnerRadius(d) { + return d.innerRadius; +} + +function d3_svg_arcOuterRadius(d) { + return d.outerRadius; +} + +function d3_svg_arcStartAngle(d) { + return d.startAngle; +} + +function d3_svg_arcEndAngle(d) { + return d.endAngle; +} +function d3_svg_line(projection) { + var x = d3_svg_lineX, + y = d3_svg_lineY, + interpolate = "linear", + interpolator = d3_svg_lineInterpolators[interpolate], + tension = .7; + + function line(d) { + return d.length < 1 ? null : "M" + interpolator(projection(d3_svg_linePoints(this, d, x, y)), tension); + } + + line.x = function(v) { + if (!arguments.length) return x; + x = v; + return line; + }; + + line.y = function(v) { + if (!arguments.length) return y; + y = v; + return line; + }; + + line.interpolate = function(v) { + if (!arguments.length) return interpolate; + interpolator = d3_svg_lineInterpolators[interpolate = v]; + return line; + }; + + line.tension = function(v) { + if (!arguments.length) return tension; + tension = v; + return line; + }; + + return line; +} + +d3.svg.line = function() { + return d3_svg_line(Object); +}; + +// Converts the specified array of data into an array of points +// (x-y tuples), by evaluating the specified `x` and `y` functions on each +// data point. The `this` context of the evaluated functions is the specified +// "self" object; each function is passed the current datum and index. +function d3_svg_linePoints(self, d, x, y) { + var points = [], + i = -1, + n = d.length, + fx = typeof x === "function", + fy = typeof y === "function", + value; + if (fx && fy) { + while (++i < n) points.push([ + x.call(self, value = d[i], i), + y.call(self, value, i) + ]); + } else if (fx) { + while (++i < n) points.push([x.call(self, d[i], i), y]); + } else if (fy) { + while (++i < n) points.push([x, y.call(self, d[i], i)]); + } else { + while (++i < n) points.push([x, y]); + } + return points; +} + +// The default `x` property, which references d[0]. +function d3_svg_lineX(d) { + return d[0]; +} + +// The default `y` property, which references d[1]. +function d3_svg_lineY(d) { + return d[1]; +} + +// The various interpolators supported by the `line` class. +var d3_svg_lineInterpolators = { + "linear": d3_svg_lineLinear, + "step-before": d3_svg_lineStepBefore, + "step-after": d3_svg_lineStepAfter, + "basis": d3_svg_lineBasis, + "basis-open": d3_svg_lineBasisOpen, + "basis-closed": d3_svg_lineBasisClosed, + "bundle": d3_svg_lineBundle, + "cardinal": d3_svg_lineCardinal, + "cardinal-open": d3_svg_lineCardinalOpen, + "cardinal-closed": d3_svg_lineCardinalClosed, + "monotone": d3_svg_lineMonotone +}; + +// Linear interpolation; generates "L" commands. +function d3_svg_lineLinear(points) { + var i = 0, + n = points.length, + p = points[0], + path = [p[0], ",", p[1]]; + while (++i < n) path.push("L", (p = points[i])[0], ",", p[1]); + return path.join(""); +} + +// Step interpolation; generates "H" and "V" commands. +function d3_svg_lineStepBefore(points) { + var i = 0, + n = points.length, + p = points[0], + path = [p[0], ",", p[1]]; + while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]); + return path.join(""); +} + +// Step interpolation; generates "H" and "V" commands. +function d3_svg_lineStepAfter(points) { + var i = 0, + n = points.length, + p = points[0], + path = [p[0], ",", p[1]]; + while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]); + return path.join(""); +} + +// Open cardinal spline interpolation; generates "C" commands. +function d3_svg_lineCardinalOpen(points, tension) { + return points.length < 4 + ? d3_svg_lineLinear(points) + : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), + d3_svg_lineCardinalTangents(points, tension)); +} + +// Closed cardinal spline interpolation; generates "C" commands. +function d3_svg_lineCardinalClosed(points, tension) { + return points.length < 3 + ? d3_svg_lineLinear(points) + : points[0] + d3_svg_lineHermite((points.push(points[0]), points), + d3_svg_lineCardinalTangents([points[points.length - 2]] + .concat(points, [points[1]]), tension)); +} + +// Cardinal spline interpolation; generates "C" commands. +function d3_svg_lineCardinal(points, tension, closed) { + return points.length < 3 + ? d3_svg_lineLinear(points) + : points[0] + d3_svg_lineHermite(points, + d3_svg_lineCardinalTangents(points, tension)); +} + +// Hermite spline construction; generates "C" commands. +function d3_svg_lineHermite(points, tangents) { + if (tangents.length < 1 + || (points.length != tangents.length + && points.length != tangents.length + 2)) { + return d3_svg_lineLinear(points); + } + + var quad = points.length != tangents.length, + path = "", + p0 = points[0], + p = points[1], + t0 = tangents[0], + t = t0, + pi = 1; + + if (quad) { + path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + + "," + p[0] + "," + p[1]; + p0 = points[1]; + pi = 2; + } + + if (tangents.length > 1) { + t = tangents[1]; + p = points[pi]; + pi++; + path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + + "," + p[0] + "," + p[1]; + for (var i = 2; i < tangents.length; i++, pi++) { + p = points[pi]; + t = tangents[i]; + path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + + "," + p[0] + "," + p[1]; + } + } + + if (quad) { + var lp = points[pi]; + path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + + "," + lp[0] + "," + lp[1]; + } + + return path; +} + +// Generates tangents for a cardinal spline. +function d3_svg_lineCardinalTangents(points, tension) { + var tangents = [], + a = (1 - tension) / 2, + p0, + p1 = points[0], + p2 = points[1], + i = 1, + n = points.length; + while (++i < n) { + p0 = p1; + p1 = p2; + p2 = points[i]; + tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]); + } + return tangents; +} + +// B-spline interpolation; generates "C" commands. +function d3_svg_lineBasis(points) { + if (points.length < 3) return d3_svg_lineLinear(points); + var i = 1, + n = points.length, + pi = points[0], + x0 = pi[0], + y0 = pi[1], + px = [x0, x0, x0, (pi = points[1])[0]], + py = [y0, y0, y0, pi[1]], + path = [x0, ",", y0]; + d3_svg_lineBasisBezier(path, px, py); + while (++i < n) { + pi = points[i]; + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + i = -1; + while (++i < 2) { + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); +} + +// Open B-spline interpolation; generates "C" commands. +function d3_svg_lineBasisOpen(points) { + if (points.length < 4) return d3_svg_lineLinear(points); + var path = [], + i = -1, + n = points.length, + pi, + px = [0], + py = [0]; + while (++i < 3) { + pi = points[i]; + px.push(pi[0]); + py.push(pi[1]); + } + path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); + --i; while (++i < n) { + pi = points[i]; + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); +} + +// Closed B-spline interpolation; generates "C" commands. +function d3_svg_lineBasisClosed(points) { + var path, + i = -1, + n = points.length, + m = n + 4, + pi, + px = [], + py = []; + while (++i < 4) { + pi = points[i % n]; + px.push(pi[0]); + py.push(pi[1]); + } + path = [ + d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) + ]; + --i; while (++i < m) { + pi = points[i % n]; + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); +} + +function d3_svg_lineBundle(points, tension) { + var n = points.length - 1, + x0 = points[0][0], + y0 = points[0][1], + dx = points[n][0] - x0, + dy = points[n][1] - y0, + i = -1, + p, + t; + while (++i <= n) { + p = points[i]; + t = i / n; + p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); + p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); + } + return d3_svg_lineBasis(points); +} + +// Returns the dot product of the given four-element vectors. +function d3_svg_lineDot4(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; +} + +// Matrix to transform basis (b-spline) control points to bezier +// control points. Derived from FvD 11.2.8. +var d3_svg_lineBasisBezier1 = [0, 2/3, 1/3, 0], + d3_svg_lineBasisBezier2 = [0, 1/3, 2/3, 0], + d3_svg_lineBasisBezier3 = [0, 1/6, 2/3, 1/6]; + +// Pushes a "C" Bézier curve onto the specified path array, given the +// two specified four-element arrays which define the control points. +function d3_svg_lineBasisBezier(path, x, y) { + path.push( + "C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y)); +} + +// Computes the slope from points p0 to p1. +function d3_svg_lineSlope(p0, p1) { + return (p1[1] - p0[1]) / (p1[0] - p0[0]); +} + +// Compute three-point differences for the given points. +// http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Finite_difference +function d3_svg_lineFiniteDifferences(points) { + var i = 0, + j = points.length - 1, + m = [], + p0 = points[0], + p1 = points[1], + d = m[0] = d3_svg_lineSlope(p0, p1); + while (++i < j) { + m[i] = d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1])); + } + m[i] = d; + return m; +} + +// Interpolates the given points using Fritsch-Carlson Monotone cubic Hermite +// interpolation. Returns an array of tangent vectors. For details, see +// http://en.wikipedia.org/wiki/Monotone_cubic_interpolation +function d3_svg_lineMonotoneTangents(points) { + var tangents = [], + d, + a, + b, + s, + m = d3_svg_lineFiniteDifferences(points), + i = -1, + j = points.length - 1; + + // The first two steps are done by computing finite-differences: + // 1. Compute the slopes of the secant lines between successive points. + // 2. Initialize the tangents at every point as the average of the secants. + + // Then, for each segment… + while (++i < j) { + d = d3_svg_lineSlope(points[i], points[i + 1]); + + // 3. If two successive yk = y{k + 1} are equal (i.e., d is zero), then set + // mk = m{k + 1} = 0 as the spline connecting these points must be flat to + // preserve monotonicity. Ignore step 4 and 5 for those k. + + if (Math.abs(d) < 1e-6) { + m[i] = m[i + 1] = 0; + } else { + // 4. Let ak = mk / dk and bk = m{k + 1} / dk. + a = m[i] / d; + b = m[i + 1] / d; + + // 5. Prevent overshoot and ensure monotonicity by restricting the + // magnitude of vector to a circle of radius 3. + s = a * a + b * b; + if (s > 9) { + s = d * 3 / Math.sqrt(s); + m[i] = s * a; + m[i + 1] = s * b; + } + } + } + + // Compute the normalized tangent vector from the slopes. Note that if x is + // not monotonic, it's possible that the slope will be infinite, so we protect + // against NaN by setting the coordinate to zero. + i = -1; while (++i <= j) { + s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) + / (6 * (1 + m[i] * m[i])); + tangents.push([s || 0, m[i] * s || 0]); + } + + return tangents; +} + +function d3_svg_lineMonotone(points) { + return points.length < 3 + ? d3_svg_lineLinear(points) + : points[0] + + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points)); +} +d3.svg.line.radial = function() { + var line = d3_svg_line(d3_svg_lineRadial); + line.radius = line.x, delete line.x; + line.angle = line.y, delete line.y; + return line; +}; + +function d3_svg_lineRadial(points) { + var point, + i = -1, + n = points.length, + r, + a; + while (++i < n) { + point = points[i]; + r = point[0]; + a = point[1] + d3_svg_arcOffset; + point[0] = r * Math.cos(a); + point[1] = r * Math.sin(a); + } + return points; +} +function d3_svg_area(projection) { + var x0 = d3_svg_lineX, + x1 = d3_svg_lineX, + y0 = 0, + y1 = d3_svg_lineY, + interpolate, + i0, + i1, + tension = .7; + + function area(d) { + if (d.length < 1) return null; + var points0 = d3_svg_linePoints(this, d, x0, y0), + points1 = d3_svg_linePoints(this, d, x0 === x1 ? d3_svg_areaX(points0) : x1, y0 === y1 ? d3_svg_areaY(points0) : y1); + return "M" + i0(projection(points1), tension) + + "L" + i1(projection(points0.reverse()), tension) + + "Z"; + } + + area.x = function(x) { + if (!arguments.length) return x1; + x0 = x1 = x; + return area; + }; + + area.x0 = function(x) { + if (!arguments.length) return x0; + x0 = x; + return area; + }; + + area.x1 = function(x) { + if (!arguments.length) return x1; + x1 = x; + return area; + }; + + area.y = function(y) { + if (!arguments.length) return y1; + y0 = y1 = y; + return area; + }; + + area.y0 = function(y) { + if (!arguments.length) return y0; + y0 = y; + return area; + }; + + area.y1 = function(y) { + if (!arguments.length) return y1; + y1 = y; + return area; + }; + + area.interpolate = function(x) { + if (!arguments.length) return interpolate; + i0 = d3_svg_lineInterpolators[interpolate = x]; + i1 = i0.reverse || i0; + return area; + }; + + area.tension = function(x) { + if (!arguments.length) return tension; + tension = x; + return area; + }; + + return area.interpolate("linear"); +} + +d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter; +d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore; + +d3.svg.area = function() { + return d3_svg_area(Object); +}; + +function d3_svg_areaX(points) { + return function(d, i) { + return points[i][0]; + }; +} + +function d3_svg_areaY(points) { + return function(d, i) { + return points[i][1]; + }; +} +d3.svg.area.radial = function() { + var area = d3_svg_area(d3_svg_lineRadial); + area.radius = area.x, delete area.x; + area.innerRadius = area.x0, delete area.x0; + area.outerRadius = area.x1, delete area.x1; + area.angle = area.y, delete area.y; + area.startAngle = area.y0, delete area.y0; + area.endAngle = area.y1, delete area.y1; + return area; +}; +d3.svg.chord = function() { + var source = d3_svg_chordSource, + target = d3_svg_chordTarget, + radius = d3_svg_chordRadius, + startAngle = d3_svg_arcStartAngle, + endAngle = d3_svg_arcEndAngle; + + // TODO Allow control point to be customized. + + function chord(d, i) { + var s = subgroup(this, source, d, i), + t = subgroup(this, target, d, i); + return "M" + s.p0 + + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) + ? curve(s.r, s.p1, s.r, s.p0) + : curve(s.r, s.p1, t.r, t.p0) + + arc(t.r, t.p1, t.a1 - t.a0) + + curve(t.r, t.p1, s.r, s.p0)) + + "Z"; + } + + function subgroup(self, f, d, i) { + var subgroup = f.call(self, d, i), + r = radius.call(self, subgroup, i), + a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, + a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset; + return { + r: r, + a0: a0, + a1: a1, + p0: [r * Math.cos(a0), r * Math.sin(a0)], + p1: [r * Math.cos(a1), r * Math.sin(a1)] + }; + } + + function equals(a, b) { + return a.a0 == b.a0 && a.a1 == b.a1; + } + + function arc(r, p, a) { + return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p; + } + + function curve(r0, p0, r1, p1) { + return "Q 0,0 " + p1; + } + + chord.radius = function(v) { + if (!arguments.length) return radius; + radius = d3.functor(v); + return chord; + }; + + chord.source = function(v) { + if (!arguments.length) return source; + source = d3.functor(v); + return chord; + }; + + chord.target = function(v) { + if (!arguments.length) return target; + target = d3.functor(v); + return chord; + }; + + chord.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3.functor(v); + return chord; + }; + + chord.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3.functor(v); + return chord; + }; + + return chord; +}; + +function d3_svg_chordSource(d) { + return d.source; +} + +function d3_svg_chordTarget(d) { + return d.target; +} + +function d3_svg_chordRadius(d) { + return d.radius; +} + +function d3_svg_chordStartAngle(d) { + return d.startAngle; +} + +function d3_svg_chordEndAngle(d) { + return d.endAngle; +} +d3.svg.diagonal = function() { + var source = d3_svg_chordSource, + target = d3_svg_chordTarget, + projection = d3_svg_diagonalProjection; + + function diagonal(d, i) { + var p0 = source.call(this, d, i), + p3 = target.call(this, d, i), + m = (p0.y + p3.y) / 2, + p = [p0, {x: p0.x, y: m}, {x: p3.x, y: m}, p3]; + p = p.map(projection); + return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; + } + + diagonal.source = function(x) { + if (!arguments.length) return source; + source = d3.functor(x); + return diagonal; + }; + + diagonal.target = function(x) { + if (!arguments.length) return target; + target = d3.functor(x); + return diagonal; + }; + + diagonal.projection = function(x) { + if (!arguments.length) return projection; + projection = x; + return diagonal; + }; + + return diagonal; +}; + +function d3_svg_diagonalProjection(d) { + return [d.x, d.y]; +} +d3.svg.diagonal.radial = function() { + var diagonal = d3.svg.diagonal(), + projection = d3_svg_diagonalProjection, + projection_ = diagonal.projection; + + diagonal.projection = function(x) { + return arguments.length + ? projection_(d3_svg_diagonalRadialProjection(projection = x)) + : projection; + }; + + return diagonal; +}; + +function d3_svg_diagonalRadialProjection(projection) { + return function() { + var d = projection.apply(this, arguments), + r = d[0], + a = d[1] + d3_svg_arcOffset; + return [r * Math.cos(a), r * Math.sin(a)]; + }; +} +d3.svg.mouse = function(container) { + return d3_svg_mousePoint(container, d3.event); +}; + +// https://bugs.webkit.org/show_bug.cgi?id=44083 +var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0; + +function d3_svg_mousePoint(container, e) { + var point = (container.ownerSVGElement || container).createSVGPoint(); + if ((d3_mouse_bug44083 < 0) && (window.scrollX || window.scrollY)) { + var svg = d3.select(document.body) + .append("svg") + .style("position", "absolute") + .style("top", 0) + .style("left", 0); + var ctm = svg[0][0].getScreenCTM(); + d3_mouse_bug44083 = !(ctm.f || ctm.e); + svg.remove(); + } + if (d3_mouse_bug44083) { + point.x = e.pageX; + point.y = e.pageY; + } else { + point.x = e.clientX; + point.y = e.clientY; + } + point = point.matrixTransform(container.getScreenCTM().inverse()); + return [point.x, point.y]; +}; +d3.svg.touches = function(container, touches) { + if (arguments.length < 2) touches = d3.event.touches; + + return touches ? d3_array(touches).map(function(touch) { + var point = d3_svg_mousePoint(container, touch); + point.identifier = touch.identifier; + return point; + }) : []; +}; +d3.svg.symbol = function() { + var type = d3_svg_symbolType, + size = d3_svg_symbolSize; + + function symbol(d, i) { + return (d3_svg_symbols[type.call(this, d, i)] + || d3_svg_symbols.circle) + (size.call(this, d, i)); + } + + symbol.type = function(x) { + if (!arguments.length) return type; + type = d3.functor(x); + return symbol; + }; + + // size of symbol in square pixels + symbol.size = function(x) { + if (!arguments.length) return size; + size = d3.functor(x); + return symbol; + }; + + return symbol; +}; + +function d3_svg_symbolSize() { + return 64; +} + +function d3_svg_symbolType() { + return "circle"; +} + +// TODO cross-diagonal? +var d3_svg_symbols = { + "circle": function(size) { + var r = Math.sqrt(size / Math.PI); + return "M0," + r + + "A" + r + "," + r + " 0 1,1 0," + (-r) + + "A" + r + "," + r + " 0 1,1 0," + r + + "Z"; + }, + "cross": function(size) { + var r = Math.sqrt(size / 5) / 2; + return "M" + -3 * r + "," + -r + + "H" + -r + + "V" + -3 * r + + "H" + r + + "V" + -r + + "H" + 3 * r + + "V" + r + + "H" + r + + "V" + 3 * r + + "H" + -r + + "V" + r + + "H" + -3 * r + + "Z"; + }, + "diamond": function(size) { + var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), + rx = ry * d3_svg_symbolTan30; + return "M0," + -ry + + "L" + rx + ",0" + + " 0," + ry + + " " + -rx + ",0" + + "Z"; + }, + "square": function(size) { + var r = Math.sqrt(size) / 2; + return "M" + -r + "," + -r + + "L" + r + "," + -r + + " " + r + "," + r + + " " + -r + "," + r + + "Z"; + }, + "triangle-down": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), + ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + ry + + "L" + rx +"," + -ry + + " " + -rx + "," + -ry + + "Z"; + }, + "triangle-up": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), + ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + -ry + + "L" + rx +"," + ry + + " " + -rx + "," + ry + + "Z"; + } +}; + +d3.svg.symbolTypes = d3.keys(d3_svg_symbols); + +var d3_svg_symbolSqrt3 = Math.sqrt(3), + d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180); +d3.svg.axis = function() { + var scale = d3.scale.linear(), + orient = "bottom", + tickMajorSize = 6, + tickMinorSize = 6, + tickEndSize = 6, + tickPadding = 3, + tickArguments_ = [10], + tickFormat_, + tickSubdivide = 0; + + function axis(selection) { + selection.each(function(d, i, j) { + var g = d3.select(this); + + // If selection is a transition, create subtransitions. + var transition = selection.delay ? function(o) { + var id = d3_transitionInheritId; + try { + d3_transitionInheritId = selection.id; + return o.transition() + .delay(selection[j][i].delay) + .duration(selection[j][i].duration) + .ease(selection.ease()); + } finally { + d3_transitionInheritId = id; + } + } : Object; + + // Ticks, or domain values for ordinal scales. + var ticks = scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain(), + tickFormat = tickFormat_ == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String) : tickFormat_; + + // Minor ticks. + var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), + subtick = g.selectAll(".minor").data(subticks, String), + subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6), + subtickExit = transition(subtick.exit()).style("opacity", 1e-6).remove(), + subtickUpdate = transition(subtick).style("opacity", 1); + + // Major ticks. + var tick = g.selectAll("g").data(ticks, String), + tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6), + tickExit = transition(tick.exit()).style("opacity", 1e-6).remove(), + tickUpdate = transition(tick).style("opacity", 1), + tickTransform; + + // Domain. + var range = d3_scaleRange(scale), + path = g.selectAll(".domain").data([0]), + pathEnter = path.enter().append("path").attr("class", "domain"), + pathUpdate = transition(path); + + // Stash a snapshot of the new scale, and retrieve the old snapshot. + var scale1 = scale.copy(), + scale0 = this.__chart__ || scale1; + this.__chart__ = scale1; + + tickEnter.append("line").attr("class", "tick"); + tickEnter.append("text"); + tickUpdate.select("text").text(tickFormat); + + switch (orient) { + case "bottom": { + tickTransform = d3_svg_axisX; + subtickEnter.attr("y2", tickMinorSize); + subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize); + tickEnter.select("line").attr("y2", tickMajorSize); + tickEnter.select("text").attr("y", Math.max(tickMajorSize, 0) + tickPadding); + tickUpdate.select("line").attr("x2", 0).attr("y2", tickMajorSize); + tickUpdate.select("text").attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding).attr("dy", ".71em").attr("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize); + break; + } + case "top": { + tickTransform = d3_svg_axisX; + subtickEnter.attr("y2", -tickMinorSize); + subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize); + tickEnter.select("line").attr("y2", -tickMajorSize); + tickEnter.select("text").attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)); + tickUpdate.select("line").attr("x2", 0).attr("y2", -tickMajorSize); + tickUpdate.select("text").attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("dy", "0em").attr("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize); + break; + } + case "left": { + tickTransform = d3_svg_axisY; + subtickEnter.attr("x2", -tickMinorSize); + subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0); + tickEnter.select("line").attr("x2", -tickMajorSize); + tickEnter.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)); + tickUpdate.select("line").attr("x2", -tickMajorSize).attr("y2", 0); + tickUpdate.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "end"); + pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize); + break; + } + case "right": { + tickTransform = d3_svg_axisY; + subtickEnter.attr("x2", tickMinorSize); + subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0); + tickEnter.select("line").attr("x2", tickMajorSize); + tickEnter.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding); + tickUpdate.select("line").attr("x2", tickMajorSize).attr("y2", 0); + tickUpdate.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "start"); + pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize); + break; + } + } + + // For quantitative scales: + // - enter new ticks from the old scale + // - exit old ticks to the new scale + if (scale.ticks) { + tickEnter.call(tickTransform, scale0); + tickUpdate.call(tickTransform, scale1); + tickExit.call(tickTransform, scale1); + subtickEnter.call(tickTransform, scale0); + subtickUpdate.call(tickTransform, scale1); + subtickExit.call(tickTransform, scale1); + } + + // For ordinal scales: + // - any entering ticks are undefined in the old scale + // - any exiting ticks are undefined in the new scale + // Therefore, we only need to transition updating ticks. + else { + var dx = scale1.rangeBand() / 2, x = function(d) { return scale1(d) + dx; }; + tickEnter.call(tickTransform, x); + tickUpdate.call(tickTransform, x); + } + }); + } + + axis.scale = function(x) { + if (!arguments.length) return scale; + scale = x; + return axis; + }; + + axis.orient = function(x) { + if (!arguments.length) return orient; + orient = x; + return axis; + }; + + axis.ticks = function() { + if (!arguments.length) return tickArguments_; + tickArguments_ = arguments; + return axis; + }; + + axis.tickFormat = function(x) { + if (!arguments.length) return tickFormat_; + tickFormat_ = x; + return axis; + }; + + axis.tickSize = function(x, y, z) { + if (!arguments.length) return tickMajorSize; + var n = arguments.length - 1; + tickMajorSize = +x; + tickMinorSize = n > 1 ? +y : tickMajorSize; + tickEndSize = n > 0 ? +arguments[n] : tickMajorSize; + return axis; + }; + + axis.tickPadding = function(x) { + if (!arguments.length) return tickPadding; + tickPadding = +x; + return axis; + }; + + axis.tickSubdivide = function(x) { + if (!arguments.length) return tickSubdivide; + tickSubdivide = +x; + return axis; + }; + + return axis; +}; + +function d3_svg_axisX(selection, x) { + selection.attr("transform", function(d) { return "translate(" + x(d) + ",0)"; }); +} + +function d3_svg_axisY(selection, y) { + selection.attr("transform", function(d) { return "translate(0," + y(d) + ")"; }); +} + +function d3_svg_axisSubdivide(scale, ticks, m) { + subticks = []; + if (m && ticks.length > 1) { + var extent = d3_scaleExtent(scale.domain()), + subticks, + i = -1, + n = ticks.length, + d = (ticks[1] - ticks[0]) / ++m, + j, + v; + while (++i < n) { + for (j = m; --j > 0;) { + if ((v = +ticks[i] - j * d) >= extent[0]) { + subticks.push(v); + } + } + } + for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1];) { + subticks.push(v); + } + } + return subticks; +} +d3.svg.brush = function() { + var event = d3.dispatch("brushstart", "brush", "brushend"), + x, // x-scale, optional + y, // y-scale, optional + extent = [[0, 0], [0, 0]]; // [x0, y0], [x1, y1] + + function brush(g) { + var resizes = x && y ? ["n", "e", "s", "w", "nw", "ne", "se", "sw"] + : x ? ["e", "w"] + : y ? ["n", "s"] + : []; + + g.each(function() { + var g = d3.select(this).on("mousedown.brush", down), + bg = g.selectAll(".background").data([,]), + fg = g.selectAll(".extent").data([,]), + tz = g.selectAll(".resize").data(resizes, String), + e; + + // An invisible, mouseable area for starting a new brush. + bg.enter().append("rect") + .attr("class", "background") + .style("visibility", "hidden") + .style("pointer-events", "all") + .style("cursor", "crosshair"); + + // The visible brush extent; style this as you like! + fg.enter().append("rect") + .attr("class", "extent") + .style("cursor", "move"); + + // More invisible rects for resizing the extent. + tz.enter().append("rect") + .attr("class", function(d) { return "resize " + d; }) + .attr("width", 6) + .attr("height", 6) + .style("visibility", "hidden") + .style("pointer-events", brush.empty() ? "none" : "all") + .style("cursor", function(d) { return d3_svg_brushCursor[d]; }); + + // Remove any superfluous resizers. + tz.exit().remove(); + + // Initialize the background to fill the defined range. + // If the range isn't defined, you can post-process. + if (x) { + e = d3_scaleRange(x); + bg.attr("x", e[0]).attr("width", e[1] - e[0]); + d3_svg_brushRedrawX(g, extent); + } + if (y) { + e = d3_scaleRange(y); + bg.attr("y", e[0]).attr("height", e[1] - e[0]); + d3_svg_brushRedrawY(g, extent); + } + }); + } + + function down() { + var target = d3.select(d3.event.target); + + // Store some global state for the duration of the brush gesture. + d3_svg_brush = brush; + d3_svg_brushTarget = this; + d3_svg_brushExtent = extent; + d3_svg_brushOffset = d3.svg.mouse(d3_svg_brushTarget); + + // If the extent was clicked on, drag rather than brush; + // store the offset between the mouse and extent origin instead. + if (d3_svg_brushDrag = target.classed("extent")) { + d3_svg_brushOffset[0] = extent[0][0] - d3_svg_brushOffset[0]; + d3_svg_brushOffset[1] = extent[0][1] - d3_svg_brushOffset[1]; + } + + // If a resizer was clicked on, record which side is to be resized. + // Also, set the offset to the opposite side. + else if (target.classed("resize")) { + d3_svg_brushResize = d3.event.target.__data__; + d3_svg_brushOffset[0] = extent[+/w$/.test(d3_svg_brushResize)][0]; + d3_svg_brushOffset[1] = extent[+/^n/.test(d3_svg_brushResize)][1]; + } + + // If the ALT key is down when starting a brush, the center is at the mouse. + else if (d3.event.altKey) { + d3_svg_brushCenter = d3_svg_brushOffset.slice(); + } + + // Restrict which dimensions are resized. + d3_svg_brushX = !/^(n|s)$/.test(d3_svg_brushResize) && x; + d3_svg_brushY = !/^(e|w)$/.test(d3_svg_brushResize) && y; + + // Notify listeners. + d3_svg_brushDispatch = dispatcher(this, arguments); + d3_svg_brushDispatch("brushstart"); + d3_svg_brushMove(); + d3_eventCancel(); + } + + function dispatcher(that, argumentz) { + return function(type) { + var e = d3.event; + try { + d3.event = {type: type, target: brush}; + event[type].apply(that, argumentz); + } finally { + d3.event = e; + } + }; + } + + brush.x = function(z) { + if (!arguments.length) return x; + x = z; + return brush; + }; + + brush.y = function(z) { + if (!arguments.length) return y; + y = z; + return brush; + }; + + brush.extent = function(z) { + var x0, x1, y0, y1, t; + + // Invert the pixel extent to data-space. + if (!arguments.length) { + if (x) { + x0 = extent[0][0], x1 = extent[1][0]; + if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + } + if (y) { + y0 = extent[0][1], y1 = extent[1][1]; + if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + } + return x && y ? [[x0, y0], [x1, y1]] : x ? [x0, x1] : y && [y0, y1]; + } + + // Scale the data-space extent to pixels. + if (x) { + x0 = z[0], x1 = z[1]; + if (y) x0 = x0[0], x1 = x1[0]; + if (x.invert) x0 = x(x0), x1 = x(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + extent[0][0] = x0, extent[1][0] = x1; + } + if (y) { + y0 = z[0], y1 = z[1]; + if (x) y0 = y0[1], y1 = y1[1]; + if (y.invert) y0 = y(y0), y1 = y(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + extent[0][1] = y0, extent[1][1] = y1; + } + + return brush; + }; + + brush.clear = function() { + extent[0][0] = + extent[0][1] = + extent[1][0] = + extent[1][1] = 0; + return brush; + }; + + brush.empty = function() { + return (x && extent[0][0] === extent[1][0]) + || (y && extent[0][1] === extent[1][1]); + }; + + d3.select(window) + .on("mousemove.brush", d3_svg_brushMove) + .on("mouseup.brush", d3_svg_brushUp) + .on("keydown.brush", d3_svg_brushKeydown) + .on("keyup.brush", d3_svg_brushKeyup); + + return d3.rebind(brush, event, "on"); +}; + +var d3_svg_brush, + d3_svg_brushDispatch, + d3_svg_brushTarget, + d3_svg_brushX, + d3_svg_brushY, + d3_svg_brushExtent, + d3_svg_brushDrag, + d3_svg_brushResize, + d3_svg_brushCenter, + d3_svg_brushOffset; + +function d3_svg_brushRedrawX(g, extent) { + g.select(".extent").attr("x", extent[0][0]); + g.selectAll(".n,.s,.w,.nw,.sw").attr("x", extent[0][0] - 2); + g.selectAll(".e,.ne,.se").attr("x", extent[1][0] - 3); + g.selectAll(".extent,.n,.s").attr("width", extent[1][0] - extent[0][0]); +} + +function d3_svg_brushRedrawY(g, extent) { + g.select(".extent").attr("y", extent[0][1]); + g.selectAll(".n,.e,.w,.nw,.ne").attr("y", extent[0][1] - 3); + g.selectAll(".s,.se,.sw").attr("y", extent[1][1] - 4); + g.selectAll(".extent,.e,.w").attr("height", extent[1][1] - extent[0][1]); +} + +function d3_svg_brushKeydown() { + if (d3.event.keyCode == 32 && d3_svg_brushTarget && !d3_svg_brushDrag) { + d3_svg_brushCenter = null; + d3_svg_brushOffset[0] -= d3_svg_brushExtent[1][0]; + d3_svg_brushOffset[1] -= d3_svg_brushExtent[1][1]; + d3_svg_brushDrag = 2; + d3_eventCancel(); + } +} + +function d3_svg_brushKeyup() { + if (d3.event.keyCode == 32 && d3_svg_brushDrag == 2) { + d3_svg_brushOffset[0] += d3_svg_brushExtent[1][0]; + d3_svg_brushOffset[1] += d3_svg_brushExtent[1][1]; + d3_svg_brushDrag = 0; + d3_eventCancel(); + } +} + +function d3_svg_brushMove() { + if (d3_svg_brushOffset) { + var mouse = d3.svg.mouse(d3_svg_brushTarget), + g = d3.select(d3_svg_brushTarget); + + if (!d3_svg_brushDrag) { + + // If needed, determine the center from the current extent. + if (d3.event.altKey) { + if (!d3_svg_brushCenter) { + d3_svg_brushCenter = [ + (d3_svg_brushExtent[0][0] + d3_svg_brushExtent[1][0]) / 2, + (d3_svg_brushExtent[0][1] + d3_svg_brushExtent[1][1]) / 2 + ]; + } + + // Update the offset, for when the ALT key is released. + d3_svg_brushOffset[0] = d3_svg_brushExtent[+(mouse[0] < d3_svg_brushCenter[0])][0]; + d3_svg_brushOffset[1] = d3_svg_brushExtent[+(mouse[1] < d3_svg_brushCenter[1])][1]; + } + + // When the ALT key is released, we clear the center. + else d3_svg_brushCenter = null; + } + + // Update the brush extent for each dimension. + if (d3_svg_brushX) { + d3_svg_brushMove1(mouse, d3_svg_brushX, 0); + d3_svg_brushRedrawX(g, d3_svg_brushExtent); + } + if (d3_svg_brushY) { + d3_svg_brushMove1(mouse, d3_svg_brushY, 1); + d3_svg_brushRedrawY(g, d3_svg_brushExtent); + } + + // Notify listeners. + d3_svg_brushDispatch("brush"); + } +} + +function d3_svg_brushMove1(mouse, scale, i) { + var range = d3_scaleRange(scale), + r0 = range[0], + r1 = range[1], + offset = d3_svg_brushOffset[i], + size = d3_svg_brushExtent[1][i] - d3_svg_brushExtent[0][i], + min, + max; + + // When dragging, reduce the range by the extent size and offset. + if (d3_svg_brushDrag) { + r0 -= offset; + r1 -= size + offset; + } + + // Clamp the mouse so that the extent fits within the range extent. + min = Math.max(r0, Math.min(r1, mouse[i])); + + // Compute the new extent bounds. + if (d3_svg_brushDrag) { + max = (min += offset) + size; + } else { + + // If the ALT key is pressed, then preserve the center of the extent. + if (d3_svg_brushCenter) offset = Math.max(r0, Math.min(r1, 2 * d3_svg_brushCenter[i] - min)); + + // Compute the min and max of the offset and mouse. + if (offset < min) { + max = min; + min = offset; + } else { + max = offset; + } + } + + // Update the stored bounds. + d3_svg_brushExtent[0][i] = min; + d3_svg_brushExtent[1][i] = max; +} + +function d3_svg_brushUp() { + if (d3_svg_brushOffset) { + d3_svg_brushMove(); + d3.select(d3_svg_brushTarget).selectAll(".resize").style("pointer-events", d3_svg_brush.empty() ? "none" : "all"); + d3_svg_brushDispatch("brushend"); + d3_svg_brush = + d3_svg_brushDispatch = + d3_svg_brushTarget = + d3_svg_brushX = + d3_svg_brushY = + d3_svg_brushExtent = + d3_svg_brushDrag = + d3_svg_brushResize = + d3_svg_brushCenter = + d3_svg_brushOffset = null; + d3_eventCancel(); + } +} + +var d3_svg_brushCursor = { + n: "ns-resize", + e: "ew-resize", + s: "ns-resize", + w: "ew-resize", + nw: "nwse-resize", + ne: "nesw-resize", + se: "nwse-resize", + sw: "nesw-resize" +}; +d3.behavior = {}; +// TODO Track touch points by identifier. + +d3.behavior.drag = function() { + var event = d3.dispatch("drag", "dragstart", "dragend"), + origin = null; + + function drag() { + this + .on("mousedown.drag", mousedown) + .on("touchstart.drag", mousedown); + + d3.select(window) + .on("mousemove.drag", d3_behavior_dragMove) + .on("touchmove.drag", d3_behavior_dragMove) + .on("mouseup.drag", d3_behavior_dragUp, true) + .on("touchend.drag", d3_behavior_dragUp, true) + .on("click.drag", d3_behavior_dragClick, true); + } + + // snapshot the local context for subsequent dispatch + function start() { + d3_behavior_dragEvent = event; + d3_behavior_dragEventTarget = d3.event.target; + d3_behavior_dragTarget = this; + d3_behavior_dragArguments = arguments; + d3_behavior_dragOrigin = d3_behavior_dragPoint(); + if (origin) { + d3_behavior_dragOffset = origin.apply(d3_behavior_dragTarget, d3_behavior_dragArguments); + d3_behavior_dragOffset = [d3_behavior_dragOffset.x - d3_behavior_dragOrigin[0], d3_behavior_dragOffset.y - d3_behavior_dragOrigin[1]]; + } else { + d3_behavior_dragOffset = [0, 0]; + } + d3_behavior_dragMoved = 0; + } + + function mousedown() { + start.apply(this, arguments); + d3_behavior_dragDispatch("dragstart"); + } + + drag.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return drag; + }; + + return d3.rebind(drag, event, "on"); +}; + +var d3_behavior_dragEvent, + d3_behavior_dragEventTarget, + d3_behavior_dragTarget, + d3_behavior_dragArguments, + d3_behavior_dragOffset, + d3_behavior_dragOrigin, + d3_behavior_dragMoved; + +function d3_behavior_dragDispatch(type) { + var p = d3_behavior_dragPoint(), + o = d3.event, + e = d3.event = {type: type}; + + if (p) { + e.x = p[0] + d3_behavior_dragOffset[0]; + e.y = p[1] + d3_behavior_dragOffset[1]; + e.dx = p[0] - d3_behavior_dragOrigin[0]; + e.dy = p[1] - d3_behavior_dragOrigin[1]; + d3_behavior_dragMoved |= e.dx | e.dy; + d3_behavior_dragOrigin = p; + } + + try { + d3_behavior_dragEvent[type].apply(d3_behavior_dragTarget, d3_behavior_dragArguments); + } finally { + d3.event = o; + } + + o.stopPropagation(); + o.preventDefault(); +} + +function d3_behavior_dragPoint() { + var p = d3_behavior_dragTarget.parentNode, + t = d3.event.changedTouches; + return p && (t + ? d3.svg.touches(p, t)[0] + : d3.svg.mouse(p)); +} + +function d3_behavior_dragMove() { + if (!d3_behavior_dragTarget) return; + var parent = d3_behavior_dragTarget.parentNode; + + // O NOES! The drag element was removed from the DOM. + if (!parent) return d3_behavior_dragUp(); + + d3_behavior_dragDispatch("drag"); + d3_eventCancel(); +} + +function d3_behavior_dragUp() { + if (!d3_behavior_dragTarget) return; + d3_behavior_dragDispatch("dragend"); + + // If the node was moved, prevent the mouseup from propagating. + // Also prevent the subsequent click from propagating (e.g., for anchors). + if (d3_behavior_dragMoved) { + d3_eventCancel(); + d3_behavior_dragMoved = d3.event.target === d3_behavior_dragEventTarget; + } + + d3_behavior_dragEvent = + d3_behavior_dragEventTarget = + d3_behavior_dragTarget = + d3_behavior_dragArguments = + d3_behavior_dragOffset = + d3_behavior_dragOrigin = null; +} + +function d3_behavior_dragClick() { + if (d3_behavior_dragMoved) { + d3_eventCancel(); + d3_behavior_dragMoved = 0; + } +} +// TODO unbind zoom behavior? +d3.behavior.zoom = function() { + var xyz = [0, 0, 0], + event = d3.dispatch("zoom"), + extent = d3_behavior_zoomInfiniteExtent; + + function zoom() { + this + .on("mousedown.zoom", mousedown) + .on("mousewheel.zoom", mousewheel) + .on("DOMMouseScroll.zoom", mousewheel) + .on("dblclick.zoom", dblclick) + .on("touchstart.zoom", touchstart); + + d3.select(window) + .on("mousemove.zoom", d3_behavior_zoomMousemove) + .on("mouseup.zoom", d3_behavior_zoomMouseup) + .on("touchmove.zoom", d3_behavior_zoomTouchmove) + .on("touchend.zoom", d3_behavior_zoomTouchup) + .on("click.zoom", d3_behavior_zoomClick, true); + } + + // snapshot the local context for subsequent dispatch + function start() { + d3_behavior_zoomXyz = xyz; + d3_behavior_zoomExtent = extent; + d3_behavior_zoomDispatch = event.zoom; + d3_behavior_zoomEventTarget = d3.event.target; + d3_behavior_zoomTarget = this; + d3_behavior_zoomArguments = arguments; + } + + function mousedown() { + start.apply(this, arguments); + d3_behavior_zoomPanning = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget)); + d3_behavior_zoomMoved = 0; + d3.event.preventDefault(); + window.focus(); + } + + // store starting mouse location + function mousewheel() { + start.apply(this, arguments); + if (!d3_behavior_zoomZooming) d3_behavior_zoomZooming = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget)); + d3_behavior_zoomTo(d3_behavior_zoomDelta() + xyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomZooming); + } + + function dblclick() { + start.apply(this, arguments); + var mouse = d3.svg.mouse(d3_behavior_zoomTarget); + d3_behavior_zoomTo(d3.event.shiftKey ? Math.ceil(xyz[2] - 1) : Math.floor(xyz[2] + 1), mouse, d3_behavior_zoomLocation(mouse)); + } + + // doubletap detection + function touchstart() { + start.apply(this, arguments); + var touches = d3_behavior_zoomTouchup(), + touch, + now = Date.now(); + if ((touches.length === 1) && (now - d3_behavior_zoomLast < 300)) { + d3_behavior_zoomTo(1 + Math.floor(xyz[2]), touch = touches[0], d3_behavior_zoomLocations[touch.identifier]); + } + d3_behavior_zoomLast = now; + } + + zoom.extent = function(x) { + if (!arguments.length) return extent; + extent = x == null ? d3_behavior_zoomInfiniteExtent : x; + return zoom; + }; + + return d3.rebind(zoom, event, "on"); +}; + +var d3_behavior_zoomDiv, + d3_behavior_zoomPanning, + d3_behavior_zoomZooming, + d3_behavior_zoomLocations = {}, // identifier -> location + d3_behavior_zoomLast = 0, + d3_behavior_zoomXyz, + d3_behavior_zoomExtent, + d3_behavior_zoomDispatch, + d3_behavior_zoomEventTarget, + d3_behavior_zoomTarget, + d3_behavior_zoomArguments, + d3_behavior_zoomMoved; + +function d3_behavior_zoomLocation(point) { + return [ + point[0] - d3_behavior_zoomXyz[0], + point[1] - d3_behavior_zoomXyz[1], + d3_behavior_zoomXyz[2] + ]; +} + +// detect the pixels that would be scrolled by this wheel event +function d3_behavior_zoomDelta() { + + // mousewheel events are totally broken! + // https://bugs.webkit.org/show_bug.cgi?id=40441 + // not only that, but Chrome and Safari differ in re. to acceleration! + if (!d3_behavior_zoomDiv) { + d3_behavior_zoomDiv = d3.select("body").append("div") + .style("visibility", "hidden") + .style("top", 0) + .style("height", 0) + .style("width", 0) + .style("overflow-y", "scroll") + .append("div") + .style("height", "2000px") + .node().parentNode; + } + + var e = d3.event, delta; + try { + d3_behavior_zoomDiv.scrollTop = 1000; + d3_behavior_zoomDiv.dispatchEvent(e); + delta = 1000 - d3_behavior_zoomDiv.scrollTop; + } catch (error) { + delta = e.wheelDelta || (-e.detail * 5); + } + + return delta * .005; +} + +// Note: Since we don't rotate, it's possible for the touches to become +// slightly detached from their original positions. Thus, we recompute the +// touch points on touchend as well as touchstart! +function d3_behavior_zoomTouchup() { + var touches = d3.svg.touches(d3_behavior_zoomTarget), + i = -1, + n = touches.length, + touch; + while (++i < n) d3_behavior_zoomLocations[(touch = touches[i]).identifier] = d3_behavior_zoomLocation(touch); + return touches; +} + +function d3_behavior_zoomTouchmove() { + var touches = d3.svg.touches(d3_behavior_zoomTarget); + switch (touches.length) { + + // single-touch pan + case 1: { + var touch = touches[0]; + d3_behavior_zoomTo(d3_behavior_zoomXyz[2], touch, d3_behavior_zoomLocations[touch.identifier]); + break; + } + + // double-touch pan + zoom + case 2: { + var p0 = touches[0], + p1 = touches[1], + p2 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2], + l0 = d3_behavior_zoomLocations[p0.identifier], + l1 = d3_behavior_zoomLocations[p1.identifier], + l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2, l0[2]]; + d3_behavior_zoomTo(Math.log(d3.event.scale) / Math.LN2 + l0[2], p2, l2); + break; + } + } +} + +function d3_behavior_zoomMousemove() { + d3_behavior_zoomZooming = null; + if (d3_behavior_zoomPanning) { + d3_behavior_zoomMoved = 1; + d3_behavior_zoomTo(d3_behavior_zoomXyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomPanning); + } +} + +function d3_behavior_zoomMouseup() { + if (d3_behavior_zoomPanning) { + if (d3_behavior_zoomMoved) { + d3_eventCancel(); + d3_behavior_zoomMoved = d3_behavior_zoomEventTarget === d3.event.target; + } + + d3_behavior_zoomXyz = + d3_behavior_zoomExtent = + d3_behavior_zoomDispatch = + d3_behavior_zoomEventTarget = + d3_behavior_zoomTarget = + d3_behavior_zoomArguments = + d3_behavior_zoomPanning = null; + } +} + +function d3_behavior_zoomClick() { + if (d3_behavior_zoomMoved) { + d3_eventCancel(); + d3_behavior_zoomMoved = 0; + } +} + +function d3_behavior_zoomTo(z, x0, x1) { + z = d3_behavior_zoomExtentClamp(z, 2); + var j = Math.pow(2, d3_behavior_zoomXyz[2]), + k = Math.pow(2, z), + K = Math.pow(2, (d3_behavior_zoomXyz[2] = z) - x1[2]), + x_ = d3_behavior_zoomXyz[0], + y_ = d3_behavior_zoomXyz[1], + x = d3_behavior_zoomXyz[0] = d3_behavior_zoomExtentClamp((x0[0] - x1[0] * K), 0, k), + y = d3_behavior_zoomXyz[1] = d3_behavior_zoomExtentClamp((x0[1] - x1[1] * K), 1, k), + o = d3.event; // Events can be reentrant (e.g., focus). + + d3.event = { + scale: k, + translate: [x, y], + transform: function(sx, sy) { + if (sx) transform(sx, x_, x); + if (sy) transform(sy, y_, y); + } + }; + + function transform(scale, a, b) { + scale.domain(scale.range().map(function(v) { return scale.invert(((v - b) * j) / k + a); })); + } + + try { + d3_behavior_zoomDispatch.apply(d3_behavior_zoomTarget, d3_behavior_zoomArguments); + } finally { + d3.event = o; + } + + o.preventDefault(); +} + +var d3_behavior_zoomInfiniteExtent = [ + [-Infinity, Infinity], + [-Infinity, Infinity], + [-Infinity, Infinity] +]; + +function d3_behavior_zoomExtentClamp(x, i, k) { + var range = d3_behavior_zoomExtent[i], + r0 = range[0], + r1 = range[1]; + return arguments.length === 3 + ? Math.max(r1 * (r1 === Infinity ? -Infinity : 1 / k - 1), + Math.min(r0 === -Infinity ? Infinity : r0, x / k)) * k + : Math.max(r0, Math.min(r1, x)); +} +})(); diff --git a/projects/Data Visualization Software Java Project/Data Visualization/d3.layout.js b/projects/Data Visualization Software Java Project/Data Visualization/d3.layout.js new file mode 100644 index 0000000..d93fbe5 --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/d3.layout.js @@ -0,0 +1,1881 @@ +(function(){d3.layout = {}; +// Implements hierarchical edge bundling using Holten's algorithm. For each +// input link, a path is computed that travels through the tree, up the parent +// hierarchy to the least common ancestor, and then back down to the destination +// node. Each path is simply an array of nodes. +d3.layout.bundle = function() { + return function(links) { + var paths = [], + i = -1, + n = links.length; + while (++i < n) paths.push(d3_layout_bundlePath(links[i])); + return paths; + }; +}; + +function d3_layout_bundlePath(link) { + var start = link.source, + end = link.target, + lca = d3_layout_bundleLeastCommonAncestor(start, end), + points = [start]; + while (start !== lca) { + start = start.parent; + points.push(start); + } + var k = points.length; + while (end !== lca) { + points.splice(k, 0, end); + end = end.parent; + } + return points; +} + +function d3_layout_bundleAncestors(node) { + var ancestors = [], + parent = node.parent; + while (parent != null) { + ancestors.push(node); + node = parent; + parent = parent.parent; + } + ancestors.push(node); + return ancestors; +} + +function d3_layout_bundleLeastCommonAncestor(a, b) { + if (a === b) return a; + var aNodes = d3_layout_bundleAncestors(a), + bNodes = d3_layout_bundleAncestors(b), + aNode = aNodes.pop(), + bNode = bNodes.pop(), + sharedNode = null; + while (aNode === bNode) { + sharedNode = aNode; + aNode = aNodes.pop(); + bNode = bNodes.pop(); + } + return sharedNode; +} +d3.layout.chord = function() { + var chord = {}, + chords, + groups, + matrix, + n, + padding = 0, + sortGroups, + sortSubgroups, + sortChords; + + function relayout() { + var subgroups = {}, + groupSums = [], + groupIndex = d3.range(n), + subgroupIndex = [], + k, + x, + x0, + i, + j; + + chords = []; + groups = []; + + // Compute the sum. + k = 0, i = -1; while (++i < n) { + x = 0, j = -1; while (++j < n) { + x += matrix[i][j]; + } + groupSums.push(x); + subgroupIndex.push(d3.range(n)); + k += x; + } + + // Sort groups… + if (sortGroups) { + groupIndex.sort(function(a, b) { + return sortGroups(groupSums[a], groupSums[b]); + }); + } + + // Sort subgroups… + if (sortSubgroups) { + subgroupIndex.forEach(function(d, i) { + d.sort(function(a, b) { + return sortSubgroups(matrix[i][a], matrix[i][b]); + }); + }); + } + + // Convert the sum to scaling factor for [0, 2pi]. + // TODO Allow start and end angle to be specified. + // TODO Allow padding to be specified as percentage? + k = (2 * Math.PI - padding * n) / k; + + // Compute the start and end angle for each group and subgroup. + // Note: Opera has a bug reordering object literal properties! + x = 0, i = -1; while (++i < n) { + x0 = x, j = -1; while (++j < n) { + var di = groupIndex[i], + dj = subgroupIndex[di][j], + v = matrix[di][dj], + a0 = x, + a1 = x += v * k; + subgroups[di + "-" + dj] = { + index: di, + subindex: dj, + startAngle: a0, + endAngle: a1, + value: v + }; + } + groups.push({ + index: di, + startAngle: x0, + endAngle: x, + value: (x - x0) / k + }); + x += padding; + } + + // Generate chords for each (non-empty) subgroup-subgroup link. + i = -1; while (++i < n) { + j = i - 1; while (++j < n) { + var source = subgroups[i + "-" + j], + target = subgroups[j + "-" + i]; + if (source.value || target.value) { + chords.push(source.value < target.value + ? {source: target, target: source} + : {source: source, target: target}); + } + } + } + + if (sortChords) resort(); + } + + function resort() { + chords.sort(function(a, b) { + return sortChords( + (a.source.value + a.target.value) / 2, + (b.source.value + b.target.value) / 2); + }); + } + + chord.matrix = function(x) { + if (!arguments.length) return matrix; + n = (matrix = x) && matrix.length; + chords = groups = null; + return chord; + }; + + chord.padding = function(x) { + if (!arguments.length) return padding; + padding = x; + chords = groups = null; + return chord; + }; + + chord.sortGroups = function(x) { + if (!arguments.length) return sortGroups; + sortGroups = x; + chords = groups = null; + return chord; + }; + + chord.sortSubgroups = function(x) { + if (!arguments.length) return sortSubgroups; + sortSubgroups = x; + chords = null; + return chord; + }; + + chord.sortChords = function(x) { + if (!arguments.length) return sortChords; + sortChords = x; + if (chords) resort(); + return chord; + }; + + chord.chords = function() { + if (!chords) relayout(); + return chords; + }; + + chord.groups = function() { + if (!groups) relayout(); + return groups; + }; + + return chord; +}; +// A rudimentary force layout using Gauss-Seidel. +d3.layout.force = function() { + var force = {}, + event = d3.dispatch("tick"), + size = [1, 1], + drag, + alpha, + friction = .9, + linkDistance = d3_layout_forceLinkDistance, + linkStrength = d3_layout_forceLinkStrength, + charge = -30, + gravity = .1, + theta = .8, + interval, + nodes = [], + links = [], + distances, + strengths, + charges; + + function repulse(node) { + return function(quad, x1, y1, x2, y2) { + if (quad.point !== node) { + var dx = quad.cx - node.x, + dy = quad.cy - node.y, + dn = 1 / Math.sqrt(dx * dx + dy * dy); + + /* Barnes-Hut criterion. */ + if ((x2 - x1) * dn < theta) { + var k = quad.charge * dn * dn; + node.px -= dx * k; + node.py -= dy * k; + return true; + } + + if (quad.point && isFinite(dn)) { + var k = quad.pointCharge * dn * dn; + node.px -= dx * k; + node.py -= dy * k; + } + } + return !quad.charge; + }; + } + + function tick() { + var n = nodes.length, + m = links.length, + q, + i, // current index + o, // current object + s, // current source + t, // current target + l, // current distance + k, // current force + x, // x-distance + y; // y-distance + + // gauss-seidel relaxation for links + for (i = 0; i < m; ++i) { + o = links[i]; + s = o.source; + t = o.target; + x = t.x - s.x; + y = t.y - s.y; + if (l = (x * x + y * y)) { + l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l; + x *= l; + y *= l; + t.x -= x * (k = s.weight / (t.weight + s.weight)); + t.y -= y * k; + s.x += x * (k = 1 - k); + s.y += y * k; + } + } + + // apply gravity forces + if (k = alpha * gravity) { + x = size[0] / 2; + y = size[1] / 2; + i = -1; if (k) while (++i < n) { + o = nodes[i]; + o.x += (x - o.x) * k; + o.y += (y - o.y) * k; + } + } + + // compute quadtree center of mass and apply charge forces + if (charge) { + d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges); + i = -1; while (++i < n) { + if (!(o = nodes[i]).fixed) { + q.visit(repulse(o)); + } + } + } + + // position verlet integration + i = -1; while (++i < n) { + o = nodes[i]; + if (o.fixed) { + o.x = o.px; + o.y = o.py; + } else { + o.x -= (o.px - (o.px = o.x)) * friction; + o.y -= (o.py - (o.py = o.y)) * friction; + } + } + + event.tick({type: "tick", alpha: alpha}); + + // simulated annealing, basically + return (alpha *= .99) < .005; + } + + force.nodes = function(x) { + if (!arguments.length) return nodes; + nodes = x; + return force; + }; + + force.links = function(x) { + if (!arguments.length) return links; + links = x; + return force; + }; + + force.size = function(x) { + if (!arguments.length) return size; + size = x; + return force; + }; + + force.linkDistance = function(x) { + if (!arguments.length) return linkDistance; + linkDistance = d3.functor(x); + return force; + }; + + // For backwards-compatibility. + force.distance = force.linkDistance; + + force.linkStrength = function(x) { + if (!arguments.length) return linkStrength; + linkStrength = d3.functor(x); + return force; + }; + + force.friction = function(x) { + if (!arguments.length) return friction; + friction = x; + return force; + }; + + force.charge = function(x) { + if (!arguments.length) return charge; + charge = typeof x === "function" ? x : +x; + return force; + }; + + force.gravity = function(x) { + if (!arguments.length) return gravity; + gravity = x; + return force; + }; + + force.theta = function(x) { + if (!arguments.length) return theta; + theta = x; + return force; + }; + + force.start = function() { + var i, + j, + n = nodes.length, + m = links.length, + w = size[0], + h = size[1], + neighbors, + o; + + for (i = 0; i < n; ++i) { + (o = nodes[i]).index = i; + o.weight = 0; + } + + distances = []; + strengths = []; + for (i = 0; i < m; ++i) { + o = links[i]; + if (typeof o.source == "number") o.source = nodes[o.source]; + if (typeof o.target == "number") o.target = nodes[o.target]; + distances[i] = linkDistance.call(this, o, i); + strengths[i] = linkStrength.call(this, o, i); + ++o.source.weight; + ++o.target.weight; + } + + for (i = 0; i < n; ++i) { + o = nodes[i]; + if (isNaN(o.x)) o.x = position("x", w); + if (isNaN(o.y)) o.y = position("y", h); + if (isNaN(o.px)) o.px = o.x; + if (isNaN(o.py)) o.py = o.y; + } + + charges = []; + if (typeof charge === "function") { + for (i = 0; i < n; ++i) { + charges[i] = +charge.call(this, nodes[i], i); + } + } else { + for (i = 0; i < n; ++i) { + charges[i] = charge; + } + } + + // initialize node position based on first neighbor + function position(dimension, size) { + var neighbors = neighbor(i), + j = -1, + m = neighbors.length, + x; + while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x; + return Math.random() * size; + } + + // initialize neighbors lazily + function neighbor() { + if (!neighbors) { + neighbors = []; + for (j = 0; j < n; ++j) { + neighbors[j] = []; + } + for (j = 0; j < m; ++j) { + var o = links[j]; + neighbors[o.source.index].push(o.target); + neighbors[o.target.index].push(o.source); + } + } + return neighbors[i]; + } + + return force.resume(); + }; + + force.resume = function() { + alpha = .1; + d3.timer(tick); + return force; + }; + + force.stop = function() { + alpha = 0; + return force; + }; + + // use `node.call(force.drag)` to make nodes draggable + force.drag = function() { + if (!drag) drag = d3.behavior.drag() + .origin(Object) + .on("dragstart", dragstart) + .on("drag", d3_layout_forceDrag) + .on("dragend", d3_layout_forceDragEnd); + + this.on("mouseover.force", d3_layout_forceDragOver) + .on("mouseout.force", d3_layout_forceDragOut) + .call(drag); + }; + + function dragstart(d) { + d3_layout_forceDragOver(d3_layout_forceDragNode = d); + d3_layout_forceDragForce = force; + } + + return d3.rebind(force, event, "on"); +}; + +var d3_layout_forceDragForce, + d3_layout_forceDragNode; + +function d3_layout_forceDragOver(d) { + d.fixed |= 2; +} + +function d3_layout_forceDragOut(d) { + if (d !== d3_layout_forceDragNode) d.fixed &= 1; +} + +function d3_layout_forceDragEnd() { + d3_layout_forceDrag(); + d3_layout_forceDragNode.fixed &= 1; + d3_layout_forceDragForce = d3_layout_forceDragNode = null; +} + +function d3_layout_forceDrag() { + d3_layout_forceDragNode.px = d3.event.x; + d3_layout_forceDragNode.py = d3.event.y; + d3_layout_forceDragForce.resume(); // restart annealing +} + +function d3_layout_forceAccumulate(quad, alpha, charges) { + var cx = 0, + cy = 0; + quad.charge = 0; + if (!quad.leaf) { + var nodes = quad.nodes, + n = nodes.length, + i = -1, + c; + while (++i < n) { + c = nodes[i]; + if (c == null) continue; + d3_layout_forceAccumulate(c, alpha, charges); + quad.charge += c.charge; + cx += c.charge * c.cx; + cy += c.charge * c.cy; + } + } + if (quad.point) { + // jitter internal nodes that are coincident + if (!quad.leaf) { + quad.point.x += Math.random() - .5; + quad.point.y += Math.random() - .5; + } + var k = alpha * charges[quad.point.index]; + quad.charge += quad.pointCharge = k; + cx += k * quad.point.x; + cy += k * quad.point.y; + } + quad.cx = cx / quad.charge; + quad.cy = cy / quad.charge; +} + +function d3_layout_forceLinkDistance(link) { + return 20; +} + +function d3_layout_forceLinkStrength(link) { + return 1; +} +d3.layout.partition = function() { + var hierarchy = d3.layout.hierarchy(), + size = [1, 1]; // width, height + + function position(node, x, dx, dy) { + var children = node.children; + node.x = x; + node.y = node.depth * dy; + node.dx = dx; + node.dy = dy; + if (children && (n = children.length)) { + var i = -1, + n, + c, + d; + dx = node.value ? dx / node.value : 0; + while (++i < n) { + position(c = children[i], x, d = c.value * dx, dy); + x += d; + } + } + } + + function depth(node) { + var children = node.children, + d = 0; + if (children && (n = children.length)) { + var i = -1, + n; + while (++i < n) d = Math.max(d, depth(children[i])); + } + return 1 + d; + } + + function partition(d, i) { + var nodes = hierarchy.call(this, d, i); + position(nodes[0], 0, size[0], size[1] / depth(nodes[0])); + return nodes; + } + + partition.size = function(x) { + if (!arguments.length) return size; + size = x; + return partition; + }; + + return d3_layout_hierarchyRebind(partition, hierarchy); +}; +d3.layout.pie = function() { + var value = Number, + sort = d3_layout_pieSortByValue, + startAngle = 0, + endAngle = 2 * Math.PI; + + function pie(data, i) { + + // Compute the numeric values for each data element. + var values = data.map(function(d, i) { return +value.call(pie, d, i); }); + + // Compute the start angle. + var a = +(typeof startAngle === "function" + ? startAngle.apply(this, arguments) + : startAngle); + + // Compute the angular scale factor: from value to radians. + var k = ((typeof endAngle === "function" + ? endAngle.apply(this, arguments) + : endAngle) - startAngle) + / d3.sum(values); + + // Optionally sort the data. + var index = d3.range(data.length); + if (sort != null) index.sort(sort === d3_layout_pieSortByValue + ? function(i, j) { return values[j] - values[i]; } + : function(i, j) { return sort(data[i], data[j]); }); + + // Compute the arcs! + // They are stored in the original data's order. + var arcs = []; + index.forEach(function(i) { + arcs[i] = { + data: data[i], + value: d = values[i], + startAngle: a, + endAngle: a += d * k + }; + }); + return arcs; + } + + /** + * Specifies the value function *x*, which returns a nonnegative numeric value + * for each datum. The default value function is `Number`. The value function + * is passed two arguments: the current datum and the current index. + */ + pie.value = function(x) { + if (!arguments.length) return value; + value = x; + return pie; + }; + + /** + * Specifies a sort comparison operator *x*. The comparator is passed two data + * elements from the data array, a and b; it returns a negative value if a is + * less than b, a positive value if a is greater than b, and zero if a equals + * b. + */ + pie.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return pie; + }; + + /** + * Specifies the overall start angle of the pie chart. Defaults to 0. The + * start angle can be specified either as a constant or as a function; in the + * case of a function, it is evaluated once per array (as opposed to per + * element). + */ + pie.startAngle = function(x) { + if (!arguments.length) return startAngle; + startAngle = x; + return pie; + }; + + /** + * Specifies the overall end angle of the pie chart. Defaults to 2π. The + * end angle can be specified either as a constant or as a function; in the + * case of a function, it is evaluated once per array (as opposed to per + * element). + */ + pie.endAngle = function(x) { + if (!arguments.length) return endAngle; + endAngle = x; + return pie; + }; + + return pie; +}; + +var d3_layout_pieSortByValue = {}; +// data is two-dimensional array of x,y; we populate y0 +d3.layout.stack = function() { + var values = Object, + order = d3_layout_stackOrders["default"], + offset = d3_layout_stackOffsets["zero"], + out = d3_layout_stackOut, + x = d3_layout_stackX, + y = d3_layout_stackY; + + function stack(data, index) { + + // Convert series to canonical two-dimensional representation. + var series = data.map(function(d, i) { + return values.call(stack, d, i); + }); + + // Convert each series to canonical [[x,y]] representation. + var points = series.map(function(d, i) { + return d.map(function(v, i) { + return [x.call(stack, v, i), y.call(stack, v, i)]; + }); + }); + + // Compute the order of series, and permute them. + var orders = order.call(stack, points, index); + series = d3.permute(series, orders); + points = d3.permute(points, orders); + + // Compute the baseline… + var offsets = offset.call(stack, points, index); + + // And propagate it to other series. + var n = series.length, + m = series[0].length, + i, + j, + o; + for (j = 0; j < m; ++j) { + out.call(stack, series[0][j], o = offsets[j], points[0][j][1]); + for (i = 1; i < n; ++i) { + out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]); + } + } + + return data; + } + + stack.values = function(x) { + if (!arguments.length) return values; + values = x; + return stack; + }; + + stack.order = function(x) { + if (!arguments.length) return order; + order = typeof x === "function" ? x : d3_layout_stackOrders[x]; + return stack; + }; + + stack.offset = function(x) { + if (!arguments.length) return offset; + offset = typeof x === "function" ? x : d3_layout_stackOffsets[x]; + return stack; + }; + + stack.x = function(z) { + if (!arguments.length) return x; + x = z; + return stack; + }; + + stack.y = function(z) { + if (!arguments.length) return y; + y = z; + return stack; + }; + + stack.out = function(z) { + if (!arguments.length) return out; + out = z; + return stack; + }; + + return stack; +} + +function d3_layout_stackX(d) { + return d.x; +} + +function d3_layout_stackY(d) { + return d.y; +} + +function d3_layout_stackOut(d, y0, y) { + d.y0 = y0; + d.y = y; +} + +var d3_layout_stackOrders = { + + "inside-out": function(data) { + var n = data.length, + i, + j, + max = data.map(d3_layout_stackMaxIndex), + sums = data.map(d3_layout_stackReduceSum), + index = d3.range(n).sort(function(a, b) { return max[a] - max[b]; }), + top = 0, + bottom = 0, + tops = [], + bottoms = []; + for (i = 0; i < n; ++i) { + j = index[i]; + if (top < bottom) { + top += sums[j]; + tops.push(j); + } else { + bottom += sums[j]; + bottoms.push(j); + } + } + return bottoms.reverse().concat(tops); + }, + + "reverse": function(data) { + return d3.range(data.length).reverse(); + }, + + "default": function(data) { + return d3.range(data.length); + } + +}; + +var d3_layout_stackOffsets = { + + "silhouette": function(data) { + var n = data.length, + m = data[0].length, + sums = [], + max = 0, + i, + j, + o, + y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o > max) max = o; + sums.push(o); + } + for (j = 0; j < m; ++j) { + y0[j] = (max - sums[j]) / 2; + } + return y0; + }, + + "wiggle": function(data) { + var n = data.length, + x = data[0], + m = x.length, + max = 0, + i, + j, + k, + s1, + s2, + s3, + dx, + o, + o0, + y0 = []; + y0[0] = o = o0 = 0; + for (j = 1; j < m; ++j) { + for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1]; + for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) { + for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) { + s3 += (data[k][j][1] - data[k][j - 1][1]) / dx; + } + s2 += s3 * data[i][j][1]; + } + y0[j] = o -= s1 ? s2 / s1 * dx : 0; + if (o < o0) o0 = o; + } + for (j = 0; j < m; ++j) y0[j] -= o0; + return y0; + }, + + "expand": function(data) { + var n = data.length, + m = data[0].length, + k = 1 / n, + i, + j, + o, + y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; + else for (i = 0; i < n; i++) data[i][j][1] = k; + } + for (j = 0; j < m; ++j) y0[j] = 0; + return y0; + }, + + "zero": function(data) { + var j = -1, + m = data[0].length, + y0 = []; + while (++j < m) y0[j] = 0; + return y0; + } + +}; + +function d3_layout_stackMaxIndex(array) { + var i = 1, + j = 0, + v = array[0][1], + k, + n = array.length; + for (; i < n; ++i) { + if ((k = array[i][1]) > v) { + j = i; + v = k; + } + } + return j; +} + +function d3_layout_stackReduceSum(d) { + return d.reduce(d3_layout_stackSum, 0); +} + +function d3_layout_stackSum(p, d) { + return p + d[1]; +} +d3.layout.histogram = function() { + var frequency = true, + valuer = Number, + ranger = d3_layout_histogramRange, + binner = d3_layout_histogramBinSturges; + + function histogram(data, i) { + var bins = [], + values = data.map(valuer, this), + range = ranger.call(this, values, i), + thresholds = binner.call(this, range, values, i), + bin, + i = -1, + n = values.length, + m = thresholds.length - 1, + k = frequency ? 1 : 1 / n, + x; + + // Initialize the bins. + while (++i < m) { + bin = bins[i] = []; + bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]); + bin.y = 0; + } + + // Fill the bins, ignoring values outside the range. + i = -1; while(++i < n) { + x = values[i]; + if ((x >= range[0]) && (x <= range[1])) { + bin = bins[d3.bisect(thresholds, x, 1, m) - 1]; + bin.y += k; + bin.push(data[i]); + } + } + + return bins; + } + + // Specifies how to extract a value from the associated data. The default + // value function is `Number`, which is equivalent to the identity function. + histogram.value = function(x) { + if (!arguments.length) return valuer; + valuer = x; + return histogram; + }; + + // Specifies the range of the histogram. Values outside the specified range + // will be ignored. The argument `x` may be specified either as a two-element + // array representing the minimum and maximum value of the range, or as a + // function that returns the range given the array of values and the current + // index `i`. The default range is the extent (minimum and maximum) of the + // values. + histogram.range = function(x) { + if (!arguments.length) return ranger; + ranger = d3.functor(x); + return histogram; + }; + + // Specifies how to bin values in the histogram. The argument `x` may be + // specified as a number, in which case the range of values will be split + // uniformly into the given number of bins. Or, `x` may be an array of + // threshold values, defining the bins; the specified array must contain the + // rightmost (upper) value, thus specifying n + 1 values for n bins. Or, `x` + // may be a function which is evaluated, being passed the range, the array of + // values, and the current index `i`, returning an array of thresholds. The + // default bin function will divide the values into uniform bins using + // Sturges' formula. + histogram.bins = function(x) { + if (!arguments.length) return binner; + binner = typeof x === "number" + ? function(range) { return d3_layout_histogramBinFixed(range, x); } + : d3.functor(x); + return histogram; + }; + + // Specifies whether the histogram's `y` value is a count (frequency) or a + // probability (density). The default value is true. + histogram.frequency = function(x) { + if (!arguments.length) return frequency; + frequency = !!x; + return histogram; + }; + + return histogram; +}; + +function d3_layout_histogramBinSturges(range, values) { + return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1)); +} + +function d3_layout_histogramBinFixed(range, n) { + var x = -1, + b = +range[0], + m = (range[1] - b) / n, + f = []; + while (++x <= n) f[x] = m * x + b; + return f; +} + +function d3_layout_histogramRange(values) { + return [d3.min(values), d3.max(values)]; +} +d3.layout.hierarchy = function() { + var sort = d3_layout_hierarchySort, + children = d3_layout_hierarchyChildren, + value = d3_layout_hierarchyValue; + + // Recursively compute the node depth and value. + // Also converts the data representation into a standard hierarchy structure. + function recurse(data, depth, nodes) { + var childs = children.call(hierarchy, data, depth), + node = d3_layout_hierarchyInline ? data : {data: data}; + node.depth = depth; + nodes.push(node); + if (childs && (n = childs.length)) { + var i = -1, + n, + c = node.children = [], + v = 0, + j = depth + 1; + while (++i < n) { + d = recurse(childs[i], j, nodes); + d.parent = node; + c.push(d); + v += d.value; + } + if (sort) c.sort(sort); + if (value) node.value = v; + } else if (value) { + node.value = +value.call(hierarchy, data, depth) || 0; + } + return node; + } + + // Recursively re-evaluates the node value. + function revalue(node, depth) { + var children = node.children, + v = 0; + if (children && (n = children.length)) { + var i = -1, + n, + j = depth + 1; + while (++i < n) v += revalue(children[i], j); + } else if (value) { + v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0; + } + if (value) node.value = v; + return v; + } + + function hierarchy(d) { + var nodes = []; + recurse(d, 0, nodes); + return nodes; + } + + hierarchy.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return hierarchy; + }; + + hierarchy.children = function(x) { + if (!arguments.length) return children; + children = x; + return hierarchy; + }; + + hierarchy.value = function(x) { + if (!arguments.length) return value; + value = x; + return hierarchy; + }; + + // Re-evaluates the `value` property for the specified hierarchy. + hierarchy.revalue = function(root) { + revalue(root, 0); + return root; + }; + + return hierarchy; +}; + +// A method assignment helper for hierarchy subclasses. +function d3_layout_hierarchyRebind(object, hierarchy) { + d3.rebind(object, hierarchy, "sort", "children", "value"); + + // Add an alias for links, for convenience. + object.links = d3_layout_hierarchyLinks; + + // If the new API is used, enabling inlining. + object.nodes = function(d) { + d3_layout_hierarchyInline = true; + return (object.nodes = object)(d); + }; + + return object; +} + +function d3_layout_hierarchyChildren(d) { + return d.children; +} + +function d3_layout_hierarchyValue(d) { + return d.value; +} + +function d3_layout_hierarchySort(a, b) { + return b.value - a.value; +} + +// Returns an array source+target objects for the specified nodes. +function d3_layout_hierarchyLinks(nodes) { + return d3.merge(nodes.map(function(parent) { + return (parent.children || []).map(function(child) { + return {source: parent, target: child}; + }); + })); +} + +// For backwards-compatibility, don't enable inlining by default. +var d3_layout_hierarchyInline = false; +d3.layout.pack = function() { + var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), + size = [1, 1]; + + function pack(d, i) { + var nodes = hierarchy.call(this, d, i), + root = nodes[0]; + + // Recursively compute the layout. + root.x = 0; + root.y = 0; + d3_layout_packTree(root); + + // Scale the layout to fit the requested size. + var w = size[0], + h = size[1], + k = 1 / Math.max(2 * root.r / w, 2 * root.r / h); + d3_layout_packTransform(root, w / 2, h / 2, k); + + return nodes; + } + + pack.size = function(x) { + if (!arguments.length) return size; + size = x; + return pack; + }; + + return d3_layout_hierarchyRebind(pack, hierarchy); +}; + +function d3_layout_packSort(a, b) { + return a.value - b.value; +} + +function d3_layout_packInsert(a, b) { + var c = a._pack_next; + a._pack_next = b; + b._pack_prev = a; + b._pack_next = c; + c._pack_prev = b; +} + +function d3_layout_packSplice(a, b) { + a._pack_next = b; + b._pack_prev = a; +} + +function d3_layout_packIntersects(a, b) { + var dx = b.x - a.x, + dy = b.y - a.y, + dr = a.r + b.r; + return dr * dr - dx * dx - dy * dy > .001; // within epsilon +} + +function d3_layout_packCircle(nodes) { + var xMin = Infinity, + xMax = -Infinity, + yMin = Infinity, + yMax = -Infinity, + n = nodes.length, + a, b, c, j, k; + + function bound(node) { + xMin = Math.min(node.x - node.r, xMin); + xMax = Math.max(node.x + node.r, xMax); + yMin = Math.min(node.y - node.r, yMin); + yMax = Math.max(node.y + node.r, yMax); + } + + // Create node links. + nodes.forEach(d3_layout_packLink); + + // Create first node. + a = nodes[0]; + a.x = -a.r; + a.y = 0; + bound(a); + + // Create second node. + if (n > 1) { + b = nodes[1]; + b.x = b.r; + b.y = 0; + bound(b); + + // Create third node and build chain. + if (n > 2) { + c = nodes[2]; + d3_layout_packPlace(a, b, c); + bound(c); + d3_layout_packInsert(a, c); + a._pack_prev = c; + d3_layout_packInsert(c, b); + b = a._pack_next; + + // Now iterate through the rest. + for (var i = 3; i < n; i++) { + d3_layout_packPlace(a, b, c = nodes[i]); + + // Search for the closest intersection. + var isect = 0, s1 = 1, s2 = 1; + for (j = b._pack_next; j !== b; j = j._pack_next, s1++) { + if (d3_layout_packIntersects(j, c)) { + isect = 1; + break; + } + } + if (isect == 1) { + for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) { + if (d3_layout_packIntersects(k, c)) { + break; + } + } + } + + // Update node chain. + if (isect) { + if (s1 < s2 || (s1 == s2 && b.r < a.r)) d3_layout_packSplice(a, b = j); + else d3_layout_packSplice(a = k, b); + i--; + } else { + d3_layout_packInsert(a, c); + b = c; + bound(c); + } + } + } + } + + // Re-center the circles and return the encompassing radius. + var cx = (xMin + xMax) / 2, + cy = (yMin + yMax) / 2, + cr = 0; + for (var i = 0; i < n; i++) { + var node = nodes[i]; + node.x -= cx; + node.y -= cy; + cr = Math.max(cr, node.r + Math.sqrt(node.x * node.x + node.y * node.y)); + } + + // Remove node links. + nodes.forEach(d3_layout_packUnlink); + + return cr; +} + +function d3_layout_packLink(node) { + node._pack_next = node._pack_prev = node; +} + +function d3_layout_packUnlink(node) { + delete node._pack_next; + delete node._pack_prev; +} + +function d3_layout_packTree(node) { + var children = node.children; + if (children && children.length) { + children.forEach(d3_layout_packTree); + node.r = d3_layout_packCircle(children); + } else { + node.r = Math.sqrt(node.value); + } +} + +function d3_layout_packTransform(node, x, y, k) { + var children = node.children; + node.x = (x += k * node.x); + node.y = (y += k * node.y); + node.r *= k; + if (children) { + var i = -1, n = children.length; + while (++i < n) d3_layout_packTransform(children[i], x, y, k); + } +} + +function d3_layout_packPlace(a, b, c) { + var db = a.r + c.r, + dx = b.x - a.x, + dy = b.y - a.y; + if (db && (dx || dy)) { + var da = b.r + c.r, + dc = Math.sqrt(dx * dx + dy * dy), + cos = Math.max(-1, Math.min(1, (db * db + dc * dc - da * da) / (2 * db * dc))), + theta = Math.acos(cos), + x = cos * (db /= dc), + y = Math.sin(theta) * db; + c.x = a.x + x * dx + y * dy; + c.y = a.y + x * dy - y * dx; + } else { + c.x = a.x + db; + c.y = a.y; + } +} +// Implements a hierarchical layout using the cluster (or dendogram) algorithm. +d3.layout.cluster = function() { + var hierarchy = d3.layout.hierarchy().sort(null).value(null), + separation = d3_layout_treeSeparation, + size = [1, 1]; // width, height + + function cluster(d, i) { + var nodes = hierarchy.call(this, d, i), + root = nodes[0], + previousNode, + x = 0, + kx, + ky; + + // First walk, computing the initial x & y values. + d3_layout_treeVisitAfter(root, function(node) { + var children = node.children; + if (children && children.length) { + node.x = d3_layout_clusterX(children); + node.y = d3_layout_clusterY(children); + } else { + node.x = previousNode ? x += separation(node, previousNode) : 0; + node.y = 0; + previousNode = node; + } + }); + + // Compute the left-most, right-most, and depth-most nodes for extents. + var left = d3_layout_clusterLeft(root), + right = d3_layout_clusterRight(root), + x0 = left.x - separation(left, right) / 2, + x1 = right.x + separation(right, left) / 2; + + // Second walk, normalizing x & y to the desired size. + d3_layout_treeVisitAfter(root, function(node) { + node.x = (node.x - x0) / (x1 - x0) * size[0]; + node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1]; + }); + + return nodes; + } + + cluster.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return cluster; + }; + + cluster.size = function(x) { + if (!arguments.length) return size; + size = x; + return cluster; + }; + + return d3_layout_hierarchyRebind(cluster, hierarchy); +}; + +function d3_layout_clusterY(children) { + return 1 + d3.max(children, function(child) { + return child.y; + }); +} + +function d3_layout_clusterX(children) { + return children.reduce(function(x, child) { + return x + child.x; + }, 0) / children.length; +} + +function d3_layout_clusterLeft(node) { + var children = node.children; + return children && children.length ? d3_layout_clusterLeft(children[0]) : node; +} + +function d3_layout_clusterRight(node) { + var children = node.children, n; + return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node; +} +// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm +d3.layout.tree = function() { + var hierarchy = d3.layout.hierarchy().sort(null).value(null), + separation = d3_layout_treeSeparation, + size = [1, 1]; // width, height + + function tree(d, i) { + var nodes = hierarchy.call(this, d, i), + root = nodes[0]; + + function firstWalk(node, previousSibling) { + var children = node.children, + layout = node._tree; + if (children && (n = children.length)) { + var n, + firstChild = children[0], + previousChild, + ancestor = firstChild, + child, + i = -1; + while (++i < n) { + child = children[i]; + firstWalk(child, previousChild); + ancestor = apportion(child, previousChild, ancestor); + previousChild = child; + } + d3_layout_treeShift(node); + var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim); + if (previousSibling) { + layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); + layout.mod = layout.prelim - midpoint; + } else { + layout.prelim = midpoint; + } + } else { + if (previousSibling) { + layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); + } + } + } + + function secondWalk(node, x) { + node.x = node._tree.prelim + x; + var children = node.children; + if (children && (n = children.length)) { + var i = -1, + n; + x += node._tree.mod; + while (++i < n) { + secondWalk(children[i], x); + } + } + } + + function apportion(node, previousSibling, ancestor) { + if (previousSibling) { + var vip = node, + vop = node, + vim = previousSibling, + vom = node.parent.children[0], + sip = vip._tree.mod, + sop = vop._tree.mod, + sim = vim._tree.mod, + som = vom._tree.mod, + shift; + while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) { + vom = d3_layout_treeLeft(vom); + vop = d3_layout_treeRight(vop); + vop._tree.ancestor = node; + shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip); + if (shift > 0) { + d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift); + sip += shift; + sop += shift; + } + sim += vim._tree.mod; + sip += vip._tree.mod; + som += vom._tree.mod; + sop += vop._tree.mod; + } + if (vim && !d3_layout_treeRight(vop)) { + vop._tree.thread = vim; + vop._tree.mod += sim - sop; + } + if (vip && !d3_layout_treeLeft(vom)) { + vom._tree.thread = vip; + vom._tree.mod += sip - som; + ancestor = node; + } + } + return ancestor; + } + + // Initialize temporary layout variables. + d3_layout_treeVisitAfter(root, function(node, previousSibling) { + node._tree = { + ancestor: node, + prelim: 0, + mod: 0, + change: 0, + shift: 0, + number: previousSibling ? previousSibling._tree.number + 1 : 0 + }; + }); + + // Compute the layout using Buchheim et al.'s algorithm. + firstWalk(root); + secondWalk(root, -root._tree.prelim); + + // Compute the left-most, right-most, and depth-most nodes for extents. + var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), + right = d3_layout_treeSearch(root, d3_layout_treeRightmost), + deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), + x0 = left.x - separation(left, right) / 2, + x1 = right.x + separation(right, left) / 2, + y1 = deep.depth || 1; + + // Clear temporary layout variables; transform x and y. + d3_layout_treeVisitAfter(root, function(node) { + node.x = (node.x - x0) / (x1 - x0) * size[0]; + node.y = node.depth / y1 * size[1]; + delete node._tree; + }); + + return nodes; + } + + tree.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return tree; + }; + + tree.size = function(x) { + if (!arguments.length) return size; + size = x; + return tree; + }; + + return d3_layout_hierarchyRebind(tree, hierarchy); +}; + +function d3_layout_treeSeparation(a, b) { + return a.parent == b.parent ? 1 : 2; +} + +// function d3_layout_treeSeparationRadial(a, b) { +// return (a.parent == b.parent ? 1 : 2) / a.depth; +// } + +function d3_layout_treeLeft(node) { + var children = node.children; + return children && children.length ? children[0] : node._tree.thread; +} + +function d3_layout_treeRight(node) { + var children = node.children, + n; + return children && (n = children.length) ? children[n - 1] : node._tree.thread; +} + +function d3_layout_treeSearch(node, compare) { + var children = node.children; + if (children && (n = children.length)) { + var child, + n, + i = -1; + while (++i < n) { + if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) { + node = child; + } + } + } + return node; +} + +function d3_layout_treeRightmost(a, b) { + return a.x - b.x; +} + +function d3_layout_treeLeftmost(a, b) { + return b.x - a.x; +} + +function d3_layout_treeDeepest(a, b) { + return a.depth - b.depth; +} + +function d3_layout_treeVisitAfter(node, callback) { + function visit(node, previousSibling) { + var children = node.children; + if (children && (n = children.length)) { + var child, + previousChild = null, + i = -1, + n; + while (++i < n) { + child = children[i]; + visit(child, previousChild); + previousChild = child; + } + } + callback(node, previousSibling); + } + visit(node, null); +} + +function d3_layout_treeShift(node) { + var shift = 0, + change = 0, + children = node.children, + i = children.length, + child; + while (--i >= 0) { + child = children[i]._tree; + child.prelim += shift; + child.mod += shift; + shift += child.shift + (change += child.change); + } +} + +function d3_layout_treeMove(ancestor, node, shift) { + ancestor = ancestor._tree; + node = node._tree; + var change = shift / (node.number - ancestor.number); + ancestor.change += change; + node.change -= change; + node.shift += shift; + node.prelim += shift; + node.mod += shift; +} + +function d3_layout_treeAncestor(vim, node, ancestor) { + return vim._tree.ancestor.parent == node.parent + ? vim._tree.ancestor + : ancestor; +} +// Squarified Treemaps by Mark Bruls, Kees Huizing, and Jarke J. van Wijk +// Modified to support a target aspect ratio by Jeff Heer +d3.layout.treemap = function() { + var hierarchy = d3.layout.hierarchy(), + round = Math.round, + size = [1, 1], // width, height + padding = null, + pad = d3_layout_treemapPadNull, + sticky = false, + stickies, + ratio = 0.5 * (1 + Math.sqrt(5)); // golden ratio + + // Compute the area for each child based on value & scale. + function scale(children, k) { + var i = -1, + n = children.length, + child, + area; + while (++i < n) { + area = (child = children[i]).value * (k < 0 ? 0 : k); + child.area = isNaN(area) || area <= 0 ? 0 : area; + } + } + + // Recursively arranges the specified node's children into squarified rows. + function squarify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), + row = [], + remaining = children.slice(), // copy-on-write + child, + best = Infinity, // the best row score so far + score, // the current row score + u = Math.min(rect.dx, rect.dy), // initial orientation + n; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while ((n = remaining.length) > 0) { + row.push(child = remaining[n - 1]); + row.area += child.area; + if ((score = worst(row, u)) <= best) { // continue with this orientation + remaining.pop(); + best = score; + } else { // abort, and try a different orientation + row.area -= row.pop().area; + position(row, u, rect, false); + u = Math.min(rect.dx, rect.dy); + row.length = row.area = 0; + best = Infinity; + } + } + if (row.length) { + position(row, u, rect, true); + row.length = row.area = 0; + } + children.forEach(squarify); + } + } + + // Recursively resizes the specified node's children into existing rows. + // Preserves the existing layout! + function stickify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), + remaining = children.slice(), // copy-on-write + child, + row = []; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while (child = remaining.pop()) { + row.push(child); + row.area += child.area; + if (child.z != null) { + position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length); + row.length = row.area = 0; + } + } + children.forEach(stickify); + } + } + + // Computes the score for the specified row, as the worst aspect ratio. + function worst(row, u) { + var s = row.area, + r, + rmax = 0, + rmin = Infinity, + i = -1, + n = row.length; + while (++i < n) { + if (!(r = row[i].area)) continue; + if (r < rmin) rmin = r; + if (r > rmax) rmax = r; + } + s *= s; + u *= u; + return s + ? Math.max((u * rmax * ratio) / s, s / (u * rmin * ratio)) + : Infinity; + } + + // Positions the specified row of nodes. Modifies `rect`. + function position(row, u, rect, flush) { + var i = -1, + n = row.length, + x = rect.x, + y = rect.y, + v = u ? round(row.area / u) : 0, + o; + if (u == rect.dx) { // horizontal subdivision + if (flush || v > rect.dy) v = v ? rect.dy : 0; // over+underflow + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dy = v; + x += o.dx = v ? round(o.area / v) : 0; + } + o.z = true; + o.dx += rect.x + rect.dx - x; // rounding error + rect.y += v; + rect.dy -= v; + } else { // vertical subdivision + if (flush || v > rect.dx) v = v ? rect.dx : 0; // over+underflow + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dx = v; + y += o.dy = v ? round(o.area / v) : 0; + } + o.z = false; + o.dy += rect.y + rect.dy - y; // rounding error + rect.x += v; + rect.dx -= v; + } + } + + function treemap(d) { + var nodes = stickies || hierarchy(d), + root = nodes[0]; + root.x = 0; + root.y = 0; + root.dx = size[0]; + root.dy = size[1]; + if (stickies) hierarchy.revalue(root); + scale([root], root.dx * root.dy / root.value); + (stickies ? stickify : squarify)(root); + if (sticky) stickies = nodes; + return nodes; + } + + treemap.size = function(x) { + if (!arguments.length) return size; + size = x; + return treemap; + }; + + treemap.padding = function(x) { + if (!arguments.length) return padding; + + function padFunction(node) { + var p = x.call(treemap, node, node.depth); + return p == null + ? d3_layout_treemapPadNull(node) + : d3_layout_treemapPad(node, typeof p === "number" ? [p, p, p, p] : p); + } + + function padConstant(node) { + return d3_layout_treemapPad(node, x); + } + + var type; + pad = (padding = x) == null ? d3_layout_treemapPadNull + : (type = typeof x) === "function" ? padFunction + : type === "number" ? (x = [x, x, x, x], padConstant) + : padConstant; + return treemap; + }; + + treemap.round = function(x) { + if (!arguments.length) return round != Number; + round = x ? Math.round : Number; + return treemap; + }; + + treemap.sticky = function(x) { + if (!arguments.length) return sticky; + sticky = x; + stickies = null; + return treemap; + }; + + treemap.ratio = function(x) { + if (!arguments.length) return ratio; + ratio = x; + return treemap; + }; + + return d3_layout_hierarchyRebind(treemap, hierarchy); +}; + +function d3_layout_treemapPadNull(node) { + return {x: node.x, y: node.y, dx: node.dx, dy: node.dy}; +} + +function d3_layout_treemapPad(node, padding) { + var x = node.x + padding[3], + y = node.y + padding[0], + dx = node.dx - padding[1] - padding[3], + dy = node.dy - padding[0] - padding[2]; + if (dx < 0) { x += dx / 2; dx = 0; } + if (dy < 0) { y += dy / 2; dy = 0; } + return {x: x, y: y, dx: dx, dy: dy}; +} +})(); diff --git a/projects/Data Visualization Software Java Project/Data Visualization/d3.time.js b/projects/Data Visualization Software Java Project/Data Visualization/d3.time.js new file mode 100644 index 0000000..4c1cda4 --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/d3.time.js @@ -0,0 +1,687 @@ +(function(){d3.time = {}; + +var d3_time = Date; +d3.time.format = function(template) { + var n = template.length; + + function format(date) { + var string = [], + i = -1, + j = 0, + c, + f; + while (++i < n) { + if (template.charCodeAt(i) == 37) { + string.push( + template.substring(j, i), + (f = d3_time_formats[c = template.charAt(++i)]) + ? f(date) : c); + j = i + 1; + } + } + string.push(template.substring(j, i)); + return string.join(""); + } + + format.parse = function(string) { + var date = new d3_time(1900, 0, 1), + i = d3_time_parse(date, template, string, 0); + if (i != string.length) return null; + if (date.hour12) { + var hours = date.getHours() % 12; + date.setHours(date.hour12pm ? hours + 12 : hours); + } + delete date.hour12; + delete date.hour12pm; + return date; + }; + + format.toString = function() { + return template; + }; + + return format; +}; + +function d3_time_parse(date, template, string, j) { + var c, + p, + i = 0, + n = template.length, + m = string.length; + while (i < n) { + if (j >= m) return -1; + c = template.charCodeAt(i++); + if (c == 37) { + p = d3_time_parsers[template.charAt(i++)]; + if (!p || ((j = p(date, string, j)) < 0)) return -1; + } else if (c != string.charCodeAt(j++)) { + return -1; + } + } + return j; +} + +var d3_time_zfill2 = d3.format("02d"), + d3_time_zfill3 = d3.format("03d"), + d3_time_zfill4 = d3.format("04d"), + d3_time_sfill2 = d3.format("2d"); + +var d3_time_formats = { + a: function(d) { return d3_time_weekdays[d.getDay()].substring(0, 3); }, + A: function(d) { return d3_time_weekdays[d.getDay()]; }, + b: function(d) { return d3_time_months[d.getMonth()].substring(0, 3); }, + B: function(d) { return d3_time_months[d.getMonth()]; }, + c: d3.time.format("%a %b %e %H:%M:%S %Y"), + d: function(d) { return d3_time_zfill2(d.getDate()); }, + e: function(d) { return d3_time_sfill2(d.getDate()); }, + H: function(d) { return d3_time_zfill2(d.getHours()); }, + I: function(d) { return d3_time_zfill2(d.getHours() % 12 || 12); }, + j: d3_time_dayOfYear, + L: function(d) { return d3_time_zfill3(d.getMilliseconds()); }, + m: function(d) { return d3_time_zfill2(d.getMonth() + 1); }, + M: function(d) { return d3_time_zfill2(d.getMinutes()); }, + p: function(d) { return d.getHours() >= 12 ? "PM" : "AM"; }, + S: function(d) { return d3_time_zfill2(d.getSeconds()); }, + U: d3_time_weekNumberSunday, + w: function(d) { return d.getDay(); }, + W: d3_time_weekNumberMonday, + x: d3.time.format("%m/%d/%y"), + X: d3.time.format("%H:%M:%S"), + y: function(d) { return d3_time_zfill2(d.getFullYear() % 100); }, + Y: function(d) { return d3_time_zfill4(d.getFullYear() % 10000); }, + Z: d3_time_zone, + "%": function(d) { return "%"; } +}; + +var d3_time_parsers = { + a: d3_time_parseWeekdayAbbrev, + A: d3_time_parseWeekday, + b: d3_time_parseMonthAbbrev, + B: d3_time_parseMonth, + c: d3_time_parseLocaleFull, + d: d3_time_parseDay, + e: d3_time_parseDay, + H: d3_time_parseHour24, + I: d3_time_parseHour12, + // j: function(d, s, i) { /*TODO day of year [001,366] */ return i; }, + L: d3_time_parseMilliseconds, + m: d3_time_parseMonthNumber, + M: d3_time_parseMinutes, + p: d3_time_parseAmPm, + S: d3_time_parseSeconds, + // U: function(d, s, i) { /*TODO week number (sunday) [00,53] */ return i; }, + // w: function(d, s, i) { /*TODO weekday [0,6] */ return i; }, + // W: function(d, s, i) { /*TODO week number (monday) [00,53] */ return i; }, + x: d3_time_parseLocaleDate, + X: d3_time_parseLocaleTime, + y: d3_time_parseYear, + Y: d3_time_parseFullYear + // , + // Z: function(d, s, i) { /*TODO time zone */ return i; }, + // "%": function(d, s, i) { /*TODO literal % */ return i; } +}; + +// Note: weekday is validated, but does not set the date. +function d3_time_parseWeekdayAbbrev(date, string, i) { + return string.substring(i, i += 3).toLowerCase() in d3_time_weekdayAbbrevLookup ? i : -1; +} + +var d3_time_weekdayAbbrevLookup = { + sun: 3, + mon: 3, + tue: 3, + wed: 3, + thu: 3, + fri: 3, + sat: 3 +}; + +// Note: weekday is validated, but does not set the date. +function d3_time_parseWeekday(date, string, i) { + d3_time_weekdayRe.lastIndex = 0; + var n = d3_time_weekdayRe.exec(string.substring(i, i + 10)); + return n ? i += n[0].length : -1; +} + +var d3_time_weekdayRe = /^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/ig; + +var d3_time_weekdays = [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" +]; + +function d3_time_parseMonthAbbrev(date, string, i) { + var n = d3_time_monthAbbrevLookup[string.substring(i, i += 3).toLowerCase()]; + return n == null ? -1 : (date.setMonth(n), i); +} + +var d3_time_monthAbbrevLookup = { + jan: 0, + feb: 1, + mar: 2, + apr: 3, + may: 4, + jun: 5, + jul: 6, + aug: 7, + sep: 8, + oct: 9, + nov: 10, + dec: 11 +}; + +function d3_time_parseMonth(date, string, i) { + d3_time_monthRe.lastIndex = 0; + var n = d3_time_monthRe.exec(string.substring(i, i + 12)); + return n ? (date.setMonth(d3_time_monthLookup[n[0].toLowerCase()]), i += n[0].length) : -1; +} + +var d3_time_monthRe = /^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig; + +var d3_time_monthLookup = { + january: 0, + february: 1, + march: 2, + april: 3, + may: 4, + june: 5, + july: 6, + august: 7, + september: 8, + october: 9, + november: 10, + december: 11 +}; + +var d3_time_months = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" +]; + +function d3_time_parseLocaleFull(date, string, i) { + return d3_time_parse(date, d3_time_formats.c.toString(), string, i); +} + +function d3_time_parseLocaleDate(date, string, i) { + return d3_time_parse(date, d3_time_formats.x.toString(), string, i); +} + +function d3_time_parseLocaleTime(date, string, i) { + return d3_time_parse(date, d3_time_formats.X.toString(), string, i); +} + +function d3_time_parseFullYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 4)); + return n ? (date.setFullYear(n[0]), i += n[0].length) : -1; +} + +function d3_time_parseYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.setFullYear(d3_time_century() + +n[0]), i += n[0].length) : -1; +} + +function d3_time_century() { + return ~~(new Date().getFullYear() / 1000) * 1000; +} + +function d3_time_parseMonthNumber(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.setMonth(n[0] - 1), i += n[0].length) : -1; +} + +function d3_time_parseDay(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.setDate(+n[0]), i += n[0].length) : -1; +} + +// Note: we don't validate that the hour is in the range [0,23]. +function d3_time_parseHour24(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.setHours(+n[0]), i += n[0].length) : -1; +} + +// Note: we don't validate that the hour is in the range [1,12]. +function d3_time_parseHour12(date, string, i) { + date.hour12 = true; + return d3_time_parseHour24(date, string, i); +} + +function d3_time_parseMinutes(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.setMinutes(+n[0]), i += n[0].length) : -1; +} + +function d3_time_parseSeconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.setSeconds(+n[0]), i += n[0].length) : -1; +} + +function d3_time_parseMilliseconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 3)); + return n ? (date.setMilliseconds(+n[0]), i += n[0].length) : -1; +} + +// Note: we don't look at the next directive. +var d3_time_numberRe = /\s*\d+/; + +function d3_time_parseAmPm(date, string, i) { + var n = d3_time_amPmLookup[string.substring(i, i += 2).toLowerCase()]; + return n == null ? -1 : (date.hour12pm = n, i); +} + +var d3_time_amPmLookup = { + am: 0, + pm: 1 +}; + +function d3_time_year(d) { + return new d3_time(d.getFullYear(), 0, 1); +} + +function d3_time_daysElapsed(d0, d1) { + return ~~((d1 - d0) / 864e5 - (d1.getTimezoneOffset() - d0.getTimezoneOffset()) / 1440); +} + +function d3_time_dayOfYear(d) { + return d3_time_zfill3(1 + d3_time_daysElapsed(d3_time_year(d), d)); +} + +function d3_time_weekNumberSunday(d) { + var d0 = d3_time_year(d); + return d3_time_zfill2(~~((d3_time_daysElapsed(d0, d) + d0.getDay()) / 7)); +} + +function d3_time_weekNumberMonday(d) { + var d0 = d3_time_year(d); + return d3_time_zfill2(~~((d3_time_daysElapsed(d0, d) + (d0.getDay() + 6) % 7) / 7)); +} + +// TODO table of time zone offset names? +function d3_time_zone(d) { + var z = d.getTimezoneOffset(), + zs = z > 0 ? "-" : "+", + zh = ~~(Math.abs(z) / 60), + zm = Math.abs(z) % 60; + return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm); +} +d3.time.format.utc = function(template) { + var local = d3.time.format(template); + + function format(date) { + try { + d3_time = d3_time_format_utc; + var utc = new d3_time(); + utc._ = date; + return local(utc); + } finally { + d3_time = Date; + } + } + + format.parse = function(string) { + try { + d3_time = d3_time_format_utc; + var date = local.parse(string); + return date && date._; + } finally { + d3_time = Date; + } + }; + + format.toString = local.toString; + + return format; +}; + +function d3_time_format_utc() { + this._ = new Date(Date.UTC.apply(this, arguments)); +} + +d3_time_format_utc.prototype = { + getDate: function() { return this._.getUTCDate(); }, + getDay: function() { return this._.getUTCDay(); }, + getFullYear: function() { return this._.getUTCFullYear(); }, + getHours: function() { return this._.getUTCHours(); }, + getMilliseconds: function() { return this._.getUTCMilliseconds(); }, + getMinutes: function() { return this._.getUTCMinutes(); }, + getMonth: function() { return this._.getUTCMonth(); }, + getSeconds: function() { return this._.getUTCSeconds(); }, + getTimezoneOffset: function() { return 0; }, + valueOf: function() { return this._.getTime(); }, + setDate: function(x) { this._.setUTCDate(x); }, + setDay: function(x) { this._.setUTCDay(x); }, + setFullYear: function(x) { this._.setUTCFullYear(x); }, + setHours: function(x) { this._.setUTCHours(x); }, + setMilliseconds: function(x) { this._.setUTCMilliseconds(x); }, + setMinutes: function(x) { this._.setUTCMinutes(x); }, + setMonth: function(x) { this._.setUTCMonth(x); }, + setSeconds: function(x) { this._.setUTCSeconds(x); } +}; +var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ"); + +d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso; + +function d3_time_formatIsoNative(date) { + return date.toISOString(); +} + +d3_time_formatIsoNative.parse = function(string) { + return new Date(string); +}; + +d3_time_formatIsoNative.toString = d3_time_formatIso.toString; +function d3_time_range(floor, step, number) { + return function(t0, t1, dt) { + var time = floor(t0), times = []; + if (time < t0) step(time); + if (dt > 1) { + while (time < t1) { + var date = new Date(+time); + if (!(number(date) % dt)) times.push(date); + step(time); + } + } else { + while (time < t1) times.push(new Date(+time)), step(time); + } + return times; + }; +} +d3.time.second = function(date) { + return new Date(~~(date / 1e3) * 1e3); +}; + +d3.time.second.utc = d3.time.second; +d3.time.seconds = d3_time_range(d3.time.second, function(date) { + date.setTime(date.getTime() + 1e3); +}, function(date) { + return date.getSeconds(); +}); + +d3.time.seconds.utc = d3.time.seconds; +d3.time.minute = function(date) { + return new Date(~~(date / 6e4) * 6e4); +}; + +d3.time.minute.utc = d3.time.minute;d3.time.minutes = d3_time_range(d3.time.minute, d3_time_minutesStep, function(date) { + return date.getMinutes(); +}); + +d3.time.minutes.utc = d3_time_range(d3.time.minute, d3_time_minutesStep, function(date) { + return date.getUTCMinutes(); +}); + +function d3_time_minutesStep(date) { + date.setTime(date.getTime() + 6e4); // assumes no leap seconds +} +d3.time.hour = function(date) { + var offset = date.getTimezoneOffset() / 60; + return new Date((~~(date / 36e5 - offset) + offset) * 36e5); +}; + +d3.time.hour.utc = function(date) { + return new Date(~~(date / 36e5) * 36e5); +}; +d3.time.hours = d3_time_range(d3.time.hour, d3_time_hoursStep, function(date) { + return date.getHours(); +}); + +d3.time.hours.utc = d3_time_range(d3.time.hour.utc, d3_time_hoursStep, function(date) { + return date.getUTCHours(); +}); + +function d3_time_hoursStep(date) { + date.setTime(date.getTime() + 36e5); +} +d3.time.day = function(date) { + return new Date(date.getFullYear(), date.getMonth(), date.getDate()); +}; + +d3.time.day.utc = function(date) { + return new Date(~~(date / 864e5) * 864e5); +}; +d3.time.days = d3_time_range(d3.time.day, function(date) { + date.setDate(date.getDate() + 1); +}, function(date) { + return date.getDate() - 1; +}); + +d3.time.days.utc = d3_time_range(d3.time.day.utc, function(date) { + date.setUTCDate(date.getUTCDate() + 1); +}, function(date) { + return date.getUTCDate() - 1; +}); +d3.time.week = function(date) { + (date = d3.time.day(date)).setDate(date.getDate() - date.getDay()); + return date; +}; + +d3.time.week.utc = function(date) { + (date = d3.time.day.utc(date)).setUTCDate(date.getUTCDate() - date.getUTCDay()); + return date; +}; +d3.time.weeks = d3_time_range(d3.time.week, function(date) { + date.setDate(date.getDate() + 7); +}, function(date) { + return ~~((date - new Date(date.getFullYear(), 0, 1)) / 6048e5); +}); + +d3.time.weeks.utc = d3_time_range(d3.time.week.utc, function(date) { + date.setUTCDate(date.getUTCDate() + 7); +}, function(date) { + return ~~((date - Date.UTC(date.getUTCFullYear(), 0, 1)) / 6048e5); +}); +d3.time.month = function(date) { + return new Date(date.getFullYear(), date.getMonth(), 1); +}; + +d3.time.month.utc = function(date) { + return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1)); +}; +d3.time.months = d3_time_range(d3.time.month, function(date) { + date.setMonth(date.getMonth() + 1); +}, function(date) { + return date.getMonth(); +}); + +d3.time.months.utc = d3_time_range(d3.time.month.utc, function(date) { + date.setUTCMonth(date.getUTCMonth() + 1); +}, function(date) { + return date.getUTCMonth(); +}); +d3.time.year = function(date) { + return new Date(date.getFullYear(), 0, 1); +}; + +d3.time.year.utc = function(date) { + return new Date(Date.UTC(date.getUTCFullYear(), 0, 1)); +}; +d3.time.years = d3_time_range(d3.time.year, function(date) { + date.setFullYear(date.getFullYear() + 1); +}, function(date) { + return date.getFullYear(); +}); + +d3.time.years.utc = d3_time_range(d3.time.year.utc, function(date) { + date.setUTCFullYear(date.getUTCFullYear() + 1); +}, function(date) { + return date.getUTCFullYear(); +}); +// TODO nice +function d3_time_scale(linear, methods, format) { + + function scale(x) { + return linear(x); + } + + scale.invert = function(x) { + return d3_time_scaleDate(linear.invert(x)); + }; + + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(d3_time_scaleDate); + linear.domain(x); + return scale; + }; + + scale.ticks = function(m, k) { + var extent = d3_time_scaleExtent(scale.domain()); + if (typeof m !== "function") { + var span = extent[1] - extent[0], + target = span / m, + i = d3.bisect(d3_time_scaleSteps, target, 1, d3_time_scaleSteps.length - 1); + if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i; + m = methods[i]; + k = m[1]; + m = m[0]; + } + return m(extent[0], extent[1], k); + }; + + scale.tickFormat = function() { + return format; + }; + + scale.copy = function() { + return d3_time_scale(linear.copy(), methods, format); + }; + + // TOOD expose d3_scale_linear_rebind? + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); +} + +// TODO expose d3_scaleExtent? +function d3_time_scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [start, stop] : [stop, start]; +} + +function d3_time_scaleDate(t) { + return new Date(t); +} + +function d3_time_scaleFormat(formats) { + return function(date) { + var i = formats.length - 1, f = formats[i]; + while (!f[1](date)) f = formats[--i]; + return f[0](date); + }; +} + +var d3_time_scaleSteps = [ + 1e3, // 1-second + 5e3, // 5-second + 15e3, // 15-second + 3e4, // 30-second + 6e4, // 1-minute + 3e5, // 5-minute + 9e5, // 15-minute + 18e5, // 30-minute + 36e5, // 1-hour + 108e5, // 3-hour + 216e5, // 6-hour + 432e5, // 12-hour + 864e5, // 1-day + 1728e5, // 2-day + 6048e5, // 1-week + 1728e6, // 1-month + 7776e6, // 3-month + 31536e6 // 1-year +]; + +var d3_time_scaleLocalMethods = [ + [d3.time.seconds, 1], + [d3.time.seconds, 5], + [d3.time.seconds, 15], + [d3.time.seconds, 30], + [d3.time.minutes, 1], + [d3.time.minutes, 5], + [d3.time.minutes, 15], + [d3.time.minutes, 30], + [d3.time.hours, 1], + [d3.time.hours, 3], + [d3.time.hours, 6], + [d3.time.hours, 12], + [d3.time.days, 1], + [d3.time.days, 2], + [d3.time.weeks, 1], + [d3.time.months, 1], + [d3.time.months, 3], + [d3.time.years, 1] +]; + +var d3_time_scaleLocalFormats = [ + [d3.time.format("%Y"), function(d) { return true; }], + [d3.time.format("%B"), function(d) { return d.getMonth(); }], + [d3.time.format("%b %d"), function(d) { return d.getDate() != 1; }], + [d3.time.format("%a %d"), function(d) { return d.getDay() && d.getDate() != 1; }], + [d3.time.format("%I %p"), function(d) { return d.getHours(); }], + [d3.time.format("%I:%M"), function(d) { return d.getMinutes(); }], + [d3.time.format(":%S"), function(d) { return d.getSeconds() || d.getMilliseconds(); }] +]; + +var d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats); + +d3.time.scale = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat); +}; +var d3_time_scaleUTCMethods = [ + [d3.time.seconds.utc, 1], + [d3.time.seconds.utc, 5], + [d3.time.seconds.utc, 15], + [d3.time.seconds.utc, 30], + [d3.time.minutes.utc, 1], + [d3.time.minutes.utc, 5], + [d3.time.minutes.utc, 15], + [d3.time.minutes.utc, 30], + [d3.time.hours.utc, 1], + [d3.time.hours.utc, 3], + [d3.time.hours.utc, 6], + [d3.time.hours.utc, 12], + [d3.time.days.utc, 1], + [d3.time.days.utc, 2], + [d3.time.weeks.utc, 1], + [d3.time.months.utc, 1], + [d3.time.months.utc, 3], + [d3.time.years.utc, 1] +]; + +var d3_time_scaleUTCFormats = [ + [d3.time.format.utc("%Y"), function(d) { return true; }], + [d3.time.format.utc("%B"), function(d) { return d.getUTCMonth(); }], + [d3.time.format.utc("%b %d"), function(d) { return d.getUTCDate() != 1; }], + [d3.time.format.utc("%a %d"), function(d) { return d.getUTCDay() && d.getUTCDate() != 1; }], + [d3.time.format.utc("%I %p"), function(d) { return d.getUTCHours(); }], + [d3.time.format.utc("%I:%M"), function(d) { return d.getUTCMinutes(); }], + [d3.time.format.utc(":%S"), function(d) { return d.getUTCSeconds() || d.getUTCMilliseconds(); }] +]; + +var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats); + +d3.time.scale.utc = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat); +}; +})(); diff --git a/projects/Data Visualization Software Java Project/Data Visualization/d3.v2.js b/projects/Data Visualization Software Java Project/Data Visualization/d3.v2.js new file mode 100644 index 0000000..c12d412 --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/d3.v2.js @@ -0,0 +1,9387 @@ +(function(){if (!Date.now) Date.now = function() { + return +new Date; +}; +try { + document.createElement("div").style.setProperty("opacity", 0, ""); +} catch (error) { + var d3_style_prototype = CSSStyleDeclaration.prototype, + d3_style_setProperty = d3_style_prototype.setProperty; + d3_style_prototype.setProperty = function(name, value, priority) { + d3_style_setProperty.call(this, name, value + "", priority); + }; +} +d3 = {version: "2.9.4"}; // semver +function d3_class(ctor, properties) { + try { + for (var key in properties) { + Object.defineProperty(ctor.prototype, key, { + value: properties[key], + enumerable: false + }); + } + } catch (e) { + ctor.prototype = properties; + } +} +var d3_array = d3_arraySlice; // conversion for NodeLists + +function d3_arrayCopy(pseudoarray) { + var i = -1, n = pseudoarray.length, array = []; + while (++i < n) array.push(pseudoarray[i]); + return array; +} + +function d3_arraySlice(pseudoarray) { + return Array.prototype.slice.call(pseudoarray); +} + +try { + d3_array(document.documentElement.childNodes)[0].nodeType; +} catch(e) { + d3_array = d3_arrayCopy; +} + +var d3_arraySubclass = [].__proto__? + +// Until ECMAScript supports array subclassing, prototype injection works well. +function(array, prototype) { + array.__proto__ = prototype; +}: + +// And if your browser doesn't support __proto__, we'll use direct extension. +function(array, prototype) { + for (var property in prototype) array[property] = prototype[property]; +}; +d3.map = function(object) { + var map = new d3_Map; + for (var key in object) map.set(key, object[key]); + return map; +}; + +function d3_Map() {} + +d3_class(d3_Map, { + has: function(key) { + return d3_map_prefix + key in this; + }, + get: function(key) { + return this[d3_map_prefix + key]; + }, + set: function(key, value) { + return this[d3_map_prefix + key] = value; + }, + remove: function(key) { + key = d3_map_prefix + key; + return key in this && delete this[key]; + }, + keys: function() { + var keys = []; + this.forEach(function(key) { keys.push(key); }); + return keys; + }, + values: function() { + var values = []; + this.forEach(function(key, value) { values.push(value); }); + return values; + }, + entries: function() { + var entries = []; + this.forEach(function(key, value) { entries.push({key: key, value: value}); }); + return entries; + }, + forEach: function(f) { + for (var key in this) { + if (key.charCodeAt(0) === d3_map_prefixCode) { + f.call(this, key.substring(1), this[key]); + } + } + } +}); + +var d3_map_prefix = "\0", // prevent collision with built-ins + d3_map_prefixCode = d3_map_prefix.charCodeAt(0); +function d3_identity(d) { + return d; +} +function d3_this() { + return this; +} +function d3_true() { + return true; +} +function d3_functor(v) { + return typeof v === "function" ? v : function() { return v; }; +} + +d3.functor = d3_functor; +// Copies a variable number of methods from source to target. +d3.rebind = function(target, source) { + var i = 1, n = arguments.length, method; + while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]); + return target; +}; + +// Method is assumed to be a standard D3 getter-setter: +// If passed with no arguments, gets the value. +// If passed with arguments, sets the value and returns the target. +function d3_rebind(target, source, method) { + return function() { + var value = method.apply(source, arguments); + return arguments.length ? target : value; + }; +} +d3.ascending = function(a, b) { + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; +}; +d3.descending = function(a, b) { + return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; +}; +d3.mean = function(array, f) { + var n = array.length, + a, + m = 0, + i = -1, + j = 0; + if (arguments.length === 1) { + while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j; + } else { + while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j; + } + return j ? m : undefined; +}; +d3.median = function(array, f) { + if (arguments.length > 1) array = array.map(f); + array = array.filter(d3_number); + return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined; +}; +d3.min = function(array, f) { + var i = -1, + n = array.length, + a, + b; + if (arguments.length === 1) { + while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; + while (++i < n) if ((b = array[i]) != null && a > b) a = b; + } else { + while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; + } + return a; +}; +d3.max = function(array, f) { + var i = -1, + n = array.length, + a, + b; + if (arguments.length === 1) { + while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; + while (++i < n) if ((b = array[i]) != null && b > a) a = b; + } else { + while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; + } + return a; +}; +d3.extent = function(array, f) { + var i = -1, + n = array.length, + a, + b, + c; + if (arguments.length === 1) { + while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined; + while (++i < n) if ((b = array[i]) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } else { + while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } + return [a, c]; +}; +d3.random = { + normal: function(mean, deviation) { + if (arguments.length < 2) deviation = 1; + if (arguments.length < 1) mean = 0; + return function() { + var x, y, r; + do { + x = Math.random() * 2 - 1; + y = Math.random() * 2 - 1; + r = x * x + y * y; + } while (!r || r > 1); + return mean + deviation * x * Math.sqrt(-2 * Math.log(r) / r); + }; + } +}; +function d3_number(x) { + return x != null && !isNaN(x); +} +d3.sum = function(array, f) { + var s = 0, + n = array.length, + a, + i = -1; + + if (arguments.length === 1) { + while (++i < n) if (!isNaN(a = +array[i])) s += a; + } else { + while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a; + } + + return s; +}; +// R-7 per +d3.quantile = function(values, p) { + var H = (values.length - 1) * p + 1, + h = Math.floor(H), + v = values[h - 1], + e = H - h; + return e ? v + e * (values[h] - v) : v; +}; +d3.transpose = function(matrix) { + return d3.zip.apply(d3, matrix); +}; +d3.zip = function() { + if (!(n = arguments.length)) return []; + for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m;) { + for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n;) { + zip[j] = arguments[j][i]; + } + } + return zips; +}; + +function d3_zipLength(d) { + return d.length; +} +d3.bisector = function(f) { + return { + left: function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = lo + hi >> 1; + if (f.call(a, a[mid], mid) < x) lo = mid + 1; + else hi = mid; + } + return lo; + }, + right: function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = lo + hi >> 1; + if (x < f.call(a, a[mid], mid)) hi = mid; + else lo = mid + 1; + } + return lo; + } + }; +}; + +var d3_bisector = d3.bisector(function(d) { return d; }); +d3.bisectLeft = d3_bisector.left; +d3.bisect = d3.bisectRight = d3_bisector.right; +d3.first = function(array, f) { + var i = 0, + n = array.length, + a = array[0], + b; + if (arguments.length === 1) f = d3.ascending; + while (++i < n) { + if (f.call(array, a, b = array[i]) > 0) { + a = b; + } + } + return a; +}; +d3.last = function(array, f) { + var i = 0, + n = array.length, + a = array[0], + b; + if (arguments.length === 1) f = d3.ascending; + while (++i < n) { + if (f.call(array, a, b = array[i]) <= 0) { + a = b; + } + } + return a; +}; +d3.nest = function() { + var nest = {}, + keys = [], + sortKeys = [], + sortValues, + rollup; + + function map(array, depth) { + if (depth >= keys.length) return rollup + ? rollup.call(nest, array) : (sortValues + ? array.sort(sortValues) + : array); + + var i = -1, + n = array.length, + key = keys[depth++], + keyValue, + object, + valuesByKey = new d3_Map, + values, + o = {}; + + while (++i < n) { + if (values = valuesByKey.get(keyValue = key(object = array[i]))) { + values.push(object); + } else { + valuesByKey.set(keyValue, [object]); + } + } + + valuesByKey.forEach(function(keyValue) { + o[keyValue] = map(valuesByKey.get(keyValue), depth); + }); + + return o; + } + + function entries(map, depth) { + if (depth >= keys.length) return map; + + var a = [], + sortKey = sortKeys[depth++], + key; + + for (key in map) { + a.push({key: key, values: entries(map[key], depth)}); + } + + if (sortKey) a.sort(function(a, b) { + return sortKey(a.key, b.key); + }); + + return a; + } + + nest.map = function(array) { + return map(array, 0); + }; + + nest.entries = function(array) { + return entries(map(array, 0), 0); + }; + + nest.key = function(d) { + keys.push(d); + return nest; + }; + + // Specifies the order for the most-recently specified key. + // Note: only applies to entries. Map keys are unordered! + nest.sortKeys = function(order) { + sortKeys[keys.length - 1] = order; + return nest; + }; + + // Specifies the order for leaf values. + // Applies to both maps and entries array. + nest.sortValues = function(order) { + sortValues = order; + return nest; + }; + + nest.rollup = function(f) { + rollup = f; + return nest; + }; + + return nest; +}; +d3.keys = function(map) { + var keys = []; + for (var key in map) keys.push(key); + return keys; +}; +d3.values = function(map) { + var values = []; + for (var key in map) values.push(map[key]); + return values; +}; +d3.entries = function(map) { + var entries = []; + for (var key in map) entries.push({key: key, value: map[key]}); + return entries; +}; +d3.permute = function(array, indexes) { + var permutes = [], + i = -1, + n = indexes.length; + while (++i < n) permutes[i] = array[indexes[i]]; + return permutes; +}; +d3.merge = function(arrays) { + return Array.prototype.concat.apply([], arrays); +}; +d3.split = function(array, f) { + var arrays = [], + values = [], + value, + i = -1, + n = array.length; + if (arguments.length < 2) f = d3_splitter; + while (++i < n) { + if (f.call(values, value = array[i], i)) { + values = []; + } else { + if (!values.length) arrays.push(values); + values.push(value); + } + } + return arrays; +}; + +function d3_splitter(d) { + return d == null; +} +function d3_collapse(s) { + return s.replace(/(^\s+)|(\s+$)/g, "").replace(/\s+/g, " "); +} +d3.range = function(start, stop, step) { + if (arguments.length < 3) { + step = 1; + if (arguments.length < 2) { + stop = start; + start = 0; + } + } + if ((stop - start) / step === Infinity) throw new Error("infinite range"); + var range = [], + k = d3_range_integerScale(Math.abs(step)), + i = -1, + j; + start *= k, stop *= k, step *= k; + if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); + else while ((j = start + step * ++i) < stop) range.push(j / k); + return range; +}; + +function d3_range_integerScale(x) { + var k = 1; + while (x * k % 1) k *= 10; + return k; +} +d3.requote = function(s) { + return s.replace(d3_requote_re, "\\$&"); +}; + +var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; +d3.round = function(x, n) { + return n + ? Math.round(x * (n = Math.pow(10, n))) / n + : Math.round(x); +}; +d3.xhr = function(url, mime, callback) { + var req = new XMLHttpRequest; + if (arguments.length < 3) callback = mime, mime = null; + else if (mime && req.overrideMimeType) req.overrideMimeType(mime); + req.open("GET", url, true); + if (mime) req.setRequestHeader("Accept", mime); + req.onreadystatechange = function() { + if (req.readyState === 4) { + var s = req.status; + callback(!s && req.response || s >= 200 && s < 300 || s === 304 ? req : null); + } + }; + req.send(null); +}; +d3.text = function(url, mime, callback) { + function ready(req) { + callback(req && req.responseText); + } + if (arguments.length < 3) { + callback = mime; + mime = null; + } + d3.xhr(url, mime, ready); +}; +d3.json = function(url, callback) { + d3.text(url, "application/json", function(text) { + callback(text ? JSON.parse(text) : null); + }); +}; +d3.html = function(url, callback) { + d3.text(url, "text/html", function(text) { + if (text != null) { // Treat empty string as valid HTML. + var range = document.createRange(); + range.selectNode(document.body); + text = range.createContextualFragment(text); + } + callback(text); + }); +}; +d3.xml = function(url, mime, callback) { + function ready(req) { + callback(req && req.responseXML); + } + if (arguments.length < 3) { + callback = mime; + mime = null; + } + d3.xhr(url, mime, ready); +}; +var d3_nsPrefix = { + svg: "http://www.w3.org/2000/svg", + xhtml: "http://www.w3.org/1999/xhtml", + xlink: "http://www.w3.org/1999/xlink", + xml: "http://www.w3.org/XML/1998/namespace", + xmlns: "http://www.w3.org/2000/xmlns/" +}; + +d3.ns = { + prefix: d3_nsPrefix, + qualify: function(name) { + var i = name.indexOf(":"), + prefix = name; + if (i >= 0) { + prefix = name.substring(0, i); + name = name.substring(i + 1); + } + return d3_nsPrefix.hasOwnProperty(prefix) + ? {space: d3_nsPrefix[prefix], local: name} + : name; + } +}; +d3.dispatch = function() { + var dispatch = new d3_dispatch, + i = -1, + n = arguments.length; + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); + return dispatch; +}; + +function d3_dispatch() {} + +d3_dispatch.prototype.on = function(type, listener) { + var i = type.indexOf("."), + name = ""; + + // Extract optional namespace, e.g., "click.foo" + if (i > 0) { + name = type.substring(i + 1); + type = type.substring(0, i); + } + + return arguments.length < 2 + ? this[type].on(name) + : this[type].on(name, listener); +}; + +function d3_dispatch_event(dispatch) { + var listeners = [], + listenerByName = new d3_Map; + + function event() { + var z = listeners, // defensive reference + i = -1, + n = z.length, + l; + while (++i < n) if (l = z[i].on) l.apply(this, arguments); + return dispatch; + } + + event.on = function(name, listener) { + var l = listenerByName.get(name), + i; + + // return the current listener, if any + if (arguments.length < 2) return l && l.on; + + // remove the old listener, if any (with copy-on-write) + if (l) { + l.on = null; + listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); + listenerByName.remove(name); + } + + // add the new listener, if any + if (listener) listeners.push(listenerByName.set(name, {on: listener})); + + return dispatch; + }; + + return event; +} +// TODO align +d3.format = function(specifier) { + var match = d3_format_re.exec(specifier), + fill = match[1] || " ", + sign = match[3] || "", + zfill = match[5], + width = +match[6], + comma = match[7], + precision = match[8], + type = match[9], + scale = 1, + suffix = "", + integer = false; + + if (precision) precision = +precision.substring(1); + + if (zfill) { + fill = "0"; // TODO align = "="; + if (comma) width -= Math.floor((width - 1) / 4); + } + + switch (type) { + case "n": comma = true; type = "g"; break; + case "%": scale = 100; suffix = "%"; type = "f"; break; + case "p": scale = 100; suffix = "%"; type = "r"; break; + case "d": integer = true; precision = 0; break; + case "s": scale = -1; type = "r"; break; + } + + // If no precision is specified for r, fallback to general notation. + if (type == "r" && !precision) type = "g"; + + type = d3_format_types.get(type) || d3_format_typeDefault; + + return function(value) { + + // Return the empty string for floats formatted as ints. + if (integer && (value % 1)) return ""; + + // Convert negative to positive, and record the sign prefix. + var negative = (value < 0) && (value = -value) ? "\u2212" : sign; + + // Apply the scale, computing it from the value's exponent for si format. + if (scale < 0) { + var prefix = d3.formatPrefix(value, precision); + value = prefix.scale(value); + suffix = prefix.symbol; + } else { + value *= scale; + } + + // Convert to the desired precision. + value = type(value, precision); + + // If the fill character is 0, the sign and group is applied after the fill. + if (zfill) { + var length = value.length + negative.length; + if (length < width) value = new Array(width - length + 1).join(fill) + value; + if (comma) value = d3_format_group(value); + value = negative + value; + } + + // Otherwise (e.g., space-filling), the sign and group is applied before. + else { + if (comma) value = d3_format_group(value); + value = negative + value; + var length = value.length; + if (length < width) value = new Array(width - length + 1).join(fill) + value; + } + + return value + suffix; + }; +}; + +// [[fill]align][sign][#][0][width][,][.precision][type] +var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/; + +var d3_format_types = d3.map({ + g: function(x, p) { return x.toPrecision(p); }, + e: function(x, p) { return x.toExponential(p); }, + f: function(x, p) { return x.toFixed(p); }, + r: function(x, p) { return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p))); } +}); + +function d3_format_precision(x, p) { + return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1); +} + +function d3_format_typeDefault(x) { + return x + ""; +} + +// Apply comma grouping for thousands. +function d3_format_group(value) { + var i = value.lastIndexOf("."), + f = i >= 0 ? value.substring(i) : (i = value.length, ""), + t = []; + while (i > 0) t.push(value.substring(i -= 3, i + 3)); + return t.reverse().join(",") + f; +} +var d3_formatPrefixes = ["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix); + +d3.formatPrefix = function(value, precision) { + var i = 0; + if (value) { + if (value < 0) value *= -1; + if (precision) value = d3.round(value, d3_format_precision(value, precision)); + i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10); + i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3)); + } + return d3_formatPrefixes[8 + i / 3]; +}; + +function d3_formatPrefix(d, i) { + var k = Math.pow(10, Math.abs(8 - i) * 3); + return { + scale: i > 8 ? function(d) { return d / k; } : function(d) { return d * k; }, + symbol: d + }; +} +/* + * TERMS OF USE - EASING EQUATIONS + * + * Open source under the BSD License. + * + * Copyright 2001 Robert Penner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * - Neither the name of the author nor the names of contributors may be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +var d3_ease_quad = d3_ease_poly(2), + d3_ease_cubic = d3_ease_poly(3), + d3_ease_default = function() { return d3_ease_identity; }; + +var d3_ease = d3.map({ + linear: d3_ease_default, + poly: d3_ease_poly, + quad: function() { return d3_ease_quad; }, + cubic: function() { return d3_ease_cubic; }, + sin: function() { return d3_ease_sin; }, + exp: function() { return d3_ease_exp; }, + circle: function() { return d3_ease_circle; }, + elastic: d3_ease_elastic, + back: d3_ease_back, + bounce: function() { return d3_ease_bounce; } +}); + +var d3_ease_mode = d3.map({ + "in": d3_ease_identity, + "out": d3_ease_reverse, + "in-out": d3_ease_reflect, + "out-in": function(f) { return d3_ease_reflect(d3_ease_reverse(f)); } +}); + +d3.ease = function(name) { + var i = name.indexOf("-"), + t = i >= 0 ? name.substring(0, i) : name, + m = i >= 0 ? name.substring(i + 1) : "in"; + t = d3_ease.get(t) || d3_ease_default; + m = d3_ease_mode.get(m) || d3_ease_identity; + return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1)))); +}; + +function d3_ease_clamp(f) { + return function(t) { + return t <= 0 ? 0 : t >= 1 ? 1 : f(t); + }; +} + +function d3_ease_reverse(f) { + return function(t) { + return 1 - f(1 - t); + }; +} + +function d3_ease_reflect(f) { + return function(t) { + return .5 * (t < .5 ? f(2 * t) : (2 - f(2 - 2 * t))); + }; +} + +function d3_ease_identity(t) { + return t; +} + +function d3_ease_poly(e) { + return function(t) { + return Math.pow(t, e); + }; +} + +function d3_ease_sin(t) { + return 1 - Math.cos(t * Math.PI / 2); +} + +function d3_ease_exp(t) { + return Math.pow(2, 10 * (t - 1)); +} + +function d3_ease_circle(t) { + return 1 - Math.sqrt(1 - t * t); +} + +function d3_ease_elastic(a, p) { + var s; + if (arguments.length < 2) p = 0.45; + if (arguments.length < 1) { a = 1; s = p / 4; } + else s = p / (2 * Math.PI) * Math.asin(1 / a); + return function(t) { + return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p); + }; +} + +function d3_ease_back(s) { + if (!s) s = 1.70158; + return function(t) { + return t * t * ((s + 1) * t - s); + }; +} + +function d3_ease_bounce(t) { + return t < 1 / 2.75 ? 7.5625 * t * t + : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 + : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 + : 7.5625 * (t -= 2.625 / 2.75) * t + .984375; +} +d3.event = null; + +function d3_eventCancel() { + d3.event.stopPropagation(); + d3.event.preventDefault(); +} + +function d3_eventSource() { + var e = d3.event, s; + while (s = e.sourceEvent) e = s; + return e; +} + +// Like d3.dispatch, but for custom events abstracting native UI events. These +// events have a target component (such as a brush), a target element (such as +// the svg:g element containing the brush) and the standard arguments `d` (the +// target element's data) and `i` (the selection index of the target element). +function d3_eventDispatch(target) { + var dispatch = new d3_dispatch, + i = 0, + n = arguments.length; + + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); + + // Creates a dispatch context for the specified `thiz` (typically, the target + // DOM element that received the source event) and `argumentz` (typically, the + // data `d` and index `i` of the target element). The returned function can be + // used to dispatch an event to any registered listeners; the function takes a + // single argument as input, being the event to dispatch. The event must have + // a "type" attribute which corresponds to a type registered in the + // constructor. This context will automatically populate the "sourceEvent" and + // "target" attributes of the event, as well as setting the `d3.event` global + // for the duration of the notification. + dispatch.of = function(thiz, argumentz) { + return function(e1) { + try { + var e0 = + e1.sourceEvent = d3.event; + e1.target = target; + d3.event = e1; + dispatch[e1.type].apply(thiz, argumentz); + } finally { + d3.event = e0; + } + }; + }; + + return dispatch; +} +d3.interpolate = function(a, b) { + var i = d3.interpolators.length, f; + while (--i >= 0 && !(f = d3.interpolators[i](a, b))); + return f; +}; + +d3.interpolateNumber = function(a, b) { + b -= a; + return function(t) { return a + b * t; }; +}; + +d3.interpolateRound = function(a, b) { + b -= a; + return function(t) { return Math.round(a + b * t); }; +}; + +d3.interpolateString = function(a, b) { + var m, // current match + i, // current index + j, // current index (for coallescing) + s0 = 0, // start index of current string prefix + s1 = 0, // end index of current string prefix + s = [], // string constants and placeholders + q = [], // number interpolators + n, // q.length + o; + + // Reset our regular expression! + d3_interpolate_number.lastIndex = 0; + + // Find all numbers in b. + for (i = 0; m = d3_interpolate_number.exec(b); ++i) { + if (m.index) s.push(b.substring(s0, s1 = m.index)); + q.push({i: s.length, x: m[0]}); + s.push(null); + s0 = d3_interpolate_number.lastIndex; + } + if (s0 < b.length) s.push(b.substring(s0)); + + // Find all numbers in a. + for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) { + o = q[i]; + if (o.x == m[0]) { // The numbers match, so coallesce. + if (o.i) { + if (s[o.i + 1] == null) { // This match is followed by another number. + s[o.i - 1] += o.x; + s.splice(o.i, 1); + for (j = i + 1; j < n; ++j) q[j].i--; + } else { // This match is followed by a string, so coallesce twice. + s[o.i - 1] += o.x + s[o.i + 1]; + s.splice(o.i, 2); + for (j = i + 1; j < n; ++j) q[j].i -= 2; + } + } else { + if (s[o.i + 1] == null) { // This match is followed by another number. + s[o.i] = o.x; + } else { // This match is followed by a string, so coallesce twice. + s[o.i] = o.x + s[o.i + 1]; + s.splice(o.i + 1, 1); + for (j = i + 1; j < n; ++j) q[j].i--; + } + } + q.splice(i, 1); + n--; + i--; + } else { + o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x)); + } + } + + // Remove any numbers in b not found in a. + while (i < n) { + o = q.pop(); + if (s[o.i + 1] == null) { // This match is followed by another number. + s[o.i] = o.x; + } else { // This match is followed by a string, so coallesce twice. + s[o.i] = o.x + s[o.i + 1]; + s.splice(o.i + 1, 1); + } + n--; + } + + // Special optimization for only a single match. + if (s.length === 1) { + return s[0] == null ? q[0].x : function() { return b; }; + } + + // Otherwise, interpolate each of the numbers and rejoin the string. + return function(t) { + for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; +}; + +d3.interpolateTransform = function(a, b) { + var s = [], // string constants and placeholders + q = [], // number interpolators + n, + A = d3.transform(a), + B = d3.transform(b), + ta = A.translate, + tb = B.translate, + ra = A.rotate, + rb = B.rotate, + wa = A.skew, + wb = B.skew, + ka = A.scale, + kb = B.scale; + + if (ta[0] != tb[0] || ta[1] != tb[1]) { + s.push("translate(", null, ",", null, ")"); + q.push({i: 1, x: d3.interpolateNumber(ta[0], tb[0])}, {i: 3, x: d3.interpolateNumber(ta[1], tb[1])}); + } else if (tb[0] || tb[1]) { + s.push("translate(" + tb + ")"); + } else { + s.push(""); + } + + if (ra != rb) { + q.push({i: s.push(s.pop() + "rotate(", null, ")") - 2, x: d3.interpolateNumber(ra, rb)}); + } else if (rb) { + s.push(s.pop() + "rotate(" + rb + ")"); + } + + if (wa != wb) { + q.push({i: s.push(s.pop() + "skewX(", null, ")") - 2, x: d3.interpolateNumber(wa, wb)}); + } else if (wb) { + s.push(s.pop() + "skewX(" + wb + ")"); + } + + if (ka[0] != kb[0] || ka[1] != kb[1]) { + n = s.push(s.pop() + "scale(", null, ",", null, ")"); + q.push({i: n - 4, x: d3.interpolateNumber(ka[0], kb[0])}, {i: n - 2, x: d3.interpolateNumber(ka[1], kb[1])}); + } else if (kb[0] != 1 || kb[1] != 1) { + s.push(s.pop() + "scale(" + kb + ")"); + } + + n = q.length; + return function(t) { + var i = -1, o; + while (++i < n) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; +}; + +d3.interpolateRgb = function(a, b) { + a = d3.rgb(a); + b = d3.rgb(b); + var ar = a.r, + ag = a.g, + ab = a.b, + br = b.r - ar, + bg = b.g - ag, + bb = b.b - ab; + return function(t) { + return "#" + + d3_rgb_hex(Math.round(ar + br * t)) + + d3_rgb_hex(Math.round(ag + bg * t)) + + d3_rgb_hex(Math.round(ab + bb * t)); + }; +}; + +// interpolates HSL space, but outputs RGB string (for compatibility) +d3.interpolateHsl = function(a, b) { + a = d3.hsl(a); + b = d3.hsl(b); + var h0 = a.h, + s0 = a.s, + l0 = a.l, + h1 = b.h - h0, + s1 = b.s - s0, + l1 = b.l - l0; + return function(t) { + return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t).toString(); + }; +}; + +d3.interpolateArray = function(a, b) { + var x = [], + c = [], + na = a.length, + nb = b.length, + n0 = Math.min(a.length, b.length), + i; + for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i])); + for (; i < na; ++i) c[i] = a[i]; + for (; i < nb; ++i) c[i] = b[i]; + return function(t) { + for (i = 0; i < n0; ++i) c[i] = x[i](t); + return c; + }; +}; + +d3.interpolateObject = function(a, b) { + var i = {}, + c = {}, + k; + for (k in a) { + if (k in b) { + i[k] = d3_interpolateByName(k)(a[k], b[k]); + } else { + c[k] = a[k]; + } + } + for (k in b) { + if (!(k in a)) { + c[k] = b[k]; + } + } + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; +} + +var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g; + +function d3_interpolateByName(n) { + return n == "transform" + ? d3.interpolateTransform + : d3.interpolate; +} + +d3.interpolators = [ + d3.interpolateObject, + function(a, b) { return (b instanceof Array) && d3.interpolateArray(a, b); }, + function(a, b) { return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + ""); }, + function(a, b) { return (typeof b === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b); }, + function(a, b) { return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b); } +]; +function d3_uninterpolateNumber(a, b) { + b = b - (a = +a) ? 1 / (b - a) : 0; + return function(x) { return (x - a) * b; }; +} + +function d3_uninterpolateClamp(a, b) { + b = b - (a = +a) ? 1 / (b - a) : 0; + return function(x) { return Math.max(0, Math.min(1, (x - a) * b)); }; +} +d3.rgb = function(r, g, b) { + return arguments.length === 1 + ? (r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) + : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb)) + : d3_rgb(~~r, ~~g, ~~b); +}; + +function d3_rgb(r, g, b) { + return new d3_Rgb(r, g, b); +} + +function d3_Rgb(r, g, b) { + this.r = r; + this.g = g; + this.b = b; +} + +d3_Rgb.prototype.brighter = function(k) { + k = Math.pow(0.7, arguments.length ? k : 1); + var r = this.r, + g = this.g, + b = this.b, + i = 30; + if (!r && !g && !b) return d3_rgb(i, i, i); + if (r && r < i) r = i; + if (g && g < i) g = i; + if (b && b < i) b = i; + return d3_rgb( + Math.min(255, Math.floor(r / k)), + Math.min(255, Math.floor(g / k)), + Math.min(255, Math.floor(b / k))); +}; + +d3_Rgb.prototype.darker = function(k) { + k = Math.pow(0.7, arguments.length ? k : 1); + return d3_rgb( + Math.floor(k * this.r), + Math.floor(k * this.g), + Math.floor(k * this.b)); +}; + +d3_Rgb.prototype.hsl = function() { + return d3_rgb_hsl(this.r, this.g, this.b); +}; + +d3_Rgb.prototype.toString = function() { + return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b); +}; + +function d3_rgb_hex(v) { + return v < 0x10 + ? "0" + Math.max(0, v).toString(16) + : Math.min(255, v).toString(16); +} + +function d3_rgb_parse(format, rgb, hsl) { + var r = 0, // red channel; int in [0, 255] + g = 0, // green channel; int in [0, 255] + b = 0, // blue channel; int in [0, 255] + m1, // CSS color specification match + m2, // CSS color specification type (e.g., rgb) + name; + + /* Handle hsl, rgb. */ + m1 = /([a-z]+)\((.*)\)/i.exec(format); + if (m1) { + m2 = m1[2].split(","); + switch (m1[1]) { + case "hsl": { + return hsl( + parseFloat(m2[0]), // degrees + parseFloat(m2[1]) / 100, // percentage + parseFloat(m2[2]) / 100 // percentage + ); + } + case "rgb": { + return rgb( + d3_rgb_parseNumber(m2[0]), + d3_rgb_parseNumber(m2[1]), + d3_rgb_parseNumber(m2[2]) + ); + } + } + } + + /* Named colors. */ + if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b); + + /* Hexadecimal colors: #rgb and #rrggbb. */ + if (format != null && format.charAt(0) === "#") { + if (format.length === 4) { + r = format.charAt(1); r += r; + g = format.charAt(2); g += g; + b = format.charAt(3); b += b; + } else if (format.length === 7) { + r = format.substring(1, 3); + g = format.substring(3, 5); + b = format.substring(5, 7); + } + r = parseInt(r, 16); + g = parseInt(g, 16); + b = parseInt(b, 16); + } + + return rgb(r, g, b); +} + +function d3_rgb_hsl(r, g, b) { + var min = Math.min(r /= 255, g /= 255, b /= 255), + max = Math.max(r, g, b), + d = max - min, + h, + s, + l = (max + min) / 2; + if (d) { + s = l < .5 ? d / (max + min) : d / (2 - max - min); + if (r == max) h = (g - b) / d + (g < b ? 6 : 0); + else if (g == max) h = (b - r) / d + 2; + else h = (r - g) / d + 4; + h *= 60; + } else { + s = h = 0; + } + return d3_hsl(h, s, l); +} + +function d3_rgb_parseNumber(c) { // either integer or percentage + var f = parseFloat(c); + return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f; +} + +var d3_rgb_names = d3.map({ + aliceblue: "#f0f8ff", + antiquewhite: "#faebd7", + aqua: "#00ffff", + aquamarine: "#7fffd4", + azure: "#f0ffff", + beige: "#f5f5dc", + bisque: "#ffe4c4", + black: "#000000", + blanchedalmond: "#ffebcd", + blue: "#0000ff", + blueviolet: "#8a2be2", + brown: "#a52a2a", + burlywood: "#deb887", + cadetblue: "#5f9ea0", + chartreuse: "#7fff00", + chocolate: "#d2691e", + coral: "#ff7f50", + cornflowerblue: "#6495ed", + cornsilk: "#fff8dc", + crimson: "#dc143c", + cyan: "#00ffff", + darkblue: "#00008b", + darkcyan: "#008b8b", + darkgoldenrod: "#b8860b", + darkgray: "#a9a9a9", + darkgreen: "#006400", + darkgrey: "#a9a9a9", + darkkhaki: "#bdb76b", + darkmagenta: "#8b008b", + darkolivegreen: "#556b2f", + darkorange: "#ff8c00", + darkorchid: "#9932cc", + darkred: "#8b0000", + darksalmon: "#e9967a", + darkseagreen: "#8fbc8f", + darkslateblue: "#483d8b", + darkslategray: "#2f4f4f", + darkslategrey: "#2f4f4f", + darkturquoise: "#00ced1", + darkviolet: "#9400d3", + deeppink: "#ff1493", + deepskyblue: "#00bfff", + dimgray: "#696969", + dimgrey: "#696969", + dodgerblue: "#1e90ff", + firebrick: "#b22222", + floralwhite: "#fffaf0", + forestgreen: "#228b22", + fuchsia: "#ff00ff", + gainsboro: "#dcdcdc", + ghostwhite: "#f8f8ff", + gold: "#ffd700", + goldenrod: "#daa520", + gray: "#808080", + green: "#008000", + greenyellow: "#adff2f", + grey: "#808080", + honeydew: "#f0fff0", + hotpink: "#ff69b4", + indianred: "#cd5c5c", + indigo: "#4b0082", + ivory: "#fffff0", + khaki: "#f0e68c", + lavender: "#e6e6fa", + lavenderblush: "#fff0f5", + lawngreen: "#7cfc00", + lemonchiffon: "#fffacd", + lightblue: "#add8e6", + lightcoral: "#f08080", + lightcyan: "#e0ffff", + lightgoldenrodyellow: "#fafad2", + lightgray: "#d3d3d3", + lightgreen: "#90ee90", + lightgrey: "#d3d3d3", + lightpink: "#ffb6c1", + lightsalmon: "#ffa07a", + lightseagreen: "#20b2aa", + lightskyblue: "#87cefa", + lightslategray: "#778899", + lightslategrey: "#778899", + lightsteelblue: "#b0c4de", + lightyellow: "#ffffe0", + lime: "#00ff00", + limegreen: "#32cd32", + linen: "#faf0e6", + magenta: "#ff00ff", + maroon: "#800000", + mediumaquamarine: "#66cdaa", + mediumblue: "#0000cd", + mediumorchid: "#ba55d3", + mediumpurple: "#9370db", + mediumseagreen: "#3cb371", + mediumslateblue: "#7b68ee", + mediumspringgreen: "#00fa9a", + mediumturquoise: "#48d1cc", + mediumvioletred: "#c71585", + midnightblue: "#191970", + mintcream: "#f5fffa", + mistyrose: "#ffe4e1", + moccasin: "#ffe4b5", + navajowhite: "#ffdead", + navy: "#000080", + oldlace: "#fdf5e6", + olive: "#808000", + olivedrab: "#6b8e23", + orange: "#ffa500", + orangered: "#ff4500", + orchid: "#da70d6", + palegoldenrod: "#eee8aa", + palegreen: "#98fb98", + paleturquoise: "#afeeee", + palevioletred: "#db7093", + papayawhip: "#ffefd5", + peachpuff: "#ffdab9", + peru: "#cd853f", + pink: "#ffc0cb", + plum: "#dda0dd", + powderblue: "#b0e0e6", + purple: "#800080", + red: "#ff0000", + rosybrown: "#bc8f8f", + royalblue: "#4169e1", + saddlebrown: "#8b4513", + salmon: "#fa8072", + sandybrown: "#f4a460", + seagreen: "#2e8b57", + seashell: "#fff5ee", + sienna: "#a0522d", + silver: "#c0c0c0", + skyblue: "#87ceeb", + slateblue: "#6a5acd", + slategray: "#708090", + slategrey: "#708090", + snow: "#fffafa", + springgreen: "#00ff7f", + steelblue: "#4682b4", + tan: "#d2b48c", + teal: "#008080", + thistle: "#d8bfd8", + tomato: "#ff6347", + turquoise: "#40e0d0", + violet: "#ee82ee", + wheat: "#f5deb3", + white: "#ffffff", + whitesmoke: "#f5f5f5", + yellow: "#ffff00", + yellowgreen: "#9acd32" +}); + +d3_rgb_names.forEach(function(key, value) { + d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb)); +}); +d3.hsl = function(h, s, l) { + return arguments.length === 1 + ? (h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) + : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl)) + : d3_hsl(+h, +s, +l); +}; + +function d3_hsl(h, s, l) { + return new d3_Hsl(h, s, l); +} + +function d3_Hsl(h, s, l) { + this.h = h; + this.s = s; + this.l = l; +} + +d3_Hsl.prototype.brighter = function(k) { + k = Math.pow(0.7, arguments.length ? k : 1); + return d3_hsl(this.h, this.s, this.l / k); +}; + +d3_Hsl.prototype.darker = function(k) { + k = Math.pow(0.7, arguments.length ? k : 1); + return d3_hsl(this.h, this.s, k * this.l); +}; + +d3_Hsl.prototype.rgb = function() { + return d3_hsl_rgb(this.h, this.s, this.l); +}; + +d3_Hsl.prototype.toString = function() { + return this.rgb().toString(); +}; + +function d3_hsl_rgb(h, s, l) { + var m1, + m2; + + /* Some simple corrections for h, s and l. */ + h = h % 360; if (h < 0) h += 360; + s = s < 0 ? 0 : s > 1 ? 1 : s; + l = l < 0 ? 0 : l > 1 ? 1 : l; + + /* From FvD 13.37, CSS Color Module Level 3 */ + m2 = l <= .5 ? l * (1 + s) : l + s - l * s; + m1 = 2 * l - m2; + + function v(h) { + if (h > 360) h -= 360; + else if (h < 0) h += 360; + if (h < 60) return m1 + (m2 - m1) * h / 60; + if (h < 180) return m2; + if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; + return m1; + } + + function vv(h) { + return Math.round(v(h) * 255); + } + + return d3_rgb(vv(h + 120), vv(h), vv(h - 120)); +} +function d3_selection(groups) { + d3_arraySubclass(groups, d3_selectionPrototype); + return groups; +} + +var d3_select = function(s, n) { return n.querySelector(s); }, + d3_selectAll = function(s, n) { return n.querySelectorAll(s); }, + d3_selectRoot = document.documentElement, + d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, + d3_selectMatches = function(n, s) { return d3_selectMatcher.call(n, s); }; + +// Prefer Sizzle, if available. +if (typeof Sizzle === "function") { + d3_select = function(s, n) { return Sizzle(s, n)[0] || null; }; + d3_selectAll = function(s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); }; + d3_selectMatches = Sizzle.matchesSelector; +} + +var d3_selectionPrototype = []; + +d3.selection = function() { + return d3_selectionRoot; +}; + +d3.selection.prototype = d3_selectionPrototype; +d3_selectionPrototype.select = function(selector) { + var subgroups = [], + subgroup, + subnode, + group, + node; + + if (typeof selector !== "function") selector = d3_selection_selector(selector); + + for (var j = -1, m = this.length; ++j < m;) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = -1, n = group.length; ++i < n;) { + if (node = group[i]) { + subgroup.push(subnode = selector.call(node, node.__data__, i)); + if (subnode && "__data__" in node) subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + + return d3_selection(subgroups); +}; + +function d3_selection_selector(selector) { + return function() { + return d3_select(selector, this); + }; +} +d3_selectionPrototype.selectAll = function(selector) { + var subgroups = [], + subgroup, + node; + + if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); + + for (var j = -1, m = this.length; ++j < m;) { + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + if (node = group[i]) { + subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i))); + subgroup.parentNode = node; + } + } + } + + return d3_selection(subgroups); +}; + +function d3_selection_selectorAll(selector) { + return function() { + return d3_selectAll(selector, this); + }; +} +d3_selectionPrototype.attr = function(name, value) { + name = d3.ns.qualify(name); + + // If no value is specified, return the first value. + if (arguments.length < 2) { + var node = this.node(); + return name.local + ? node.getAttributeNS(name.space, name.local) + : node.getAttribute(name); + } + + function attrNull() { + this.removeAttribute(name); + } + + function attrNullNS() { + this.removeAttributeNS(name.space, name.local); + } + + function attrConstant() { + this.setAttribute(name, value); + } + + function attrConstantNS() { + this.setAttributeNS(name.space, name.local, value); + } + + function attrFunction() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttribute(name); + else this.setAttribute(name, x); + } + + function attrFunctionNS() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttributeNS(name.space, name.local); + else this.setAttributeNS(name.space, name.local, x); + } + + return this.each(value == null + ? (name.local ? attrNullNS : attrNull) : (typeof value === "function" + ? (name.local ? attrFunctionNS : attrFunction) + : (name.local ? attrConstantNS : attrConstant))); +}; +d3_selectionPrototype.classed = function(name, value) { + var names = name.split(d3_selection_classedWhitespace), + n = names.length, + i = -1; + if (arguments.length > 1) { + while (++i < n) d3_selection_classed.call(this, names[i], value); + return this; + } else { + while (++i < n) if (!d3_selection_classed.call(this, names[i])) return false; + return true; + } +}; + +var d3_selection_classedWhitespace = /\s+/g; + +function d3_selection_classed(name, value) { + var re = new RegExp("(^|\\s+)" + d3.requote(name) + "(\\s+|$)", "g"); + + // If no value is specified, return the first value. + if (arguments.length < 2) { + var node = this.node(); + if (c = node.classList) return c.contains(name); + var c = node.className; + re.lastIndex = 0; + return re.test(c.baseVal != null ? c.baseVal : c); + } + + function classedAdd() { + if (c = this.classList) return c.add(name); + var c = this.className, + cb = c.baseVal != null, + cv = cb ? c.baseVal : c; + re.lastIndex = 0; + if (!re.test(cv)) { + cv = d3_collapse(cv + " " + name); + if (cb) c.baseVal = cv; + else this.className = cv; + } + } + + function classedRemove() { + if (c = this.classList) return c.remove(name); + var c = this.className, + cb = c.baseVal != null, + cv = cb ? c.baseVal : c; + cv = d3_collapse(cv.replace(re, " ")); + if (cb) c.baseVal = cv; + else this.className = cv; + } + + function classedFunction() { + (value.apply(this, arguments) + ? classedAdd + : classedRemove).call(this); + } + + return this.each(typeof value === "function" + ? classedFunction : value + ? classedAdd + : classedRemove); +} +d3_selectionPrototype.style = function(name, value, priority) { + if (arguments.length < 3) priority = ""; + + // If no value is specified, return the first value. + if (arguments.length < 2) return window + .getComputedStyle(this.node(), null) + .getPropertyValue(name); + + function styleNull() { + this.style.removeProperty(name); + } + + function styleConstant() { + this.style.setProperty(name, value, priority); + } + + function styleFunction() { + var x = value.apply(this, arguments); + if (x == null) this.style.removeProperty(name); + else this.style.setProperty(name, x, priority); + } + + return this.each(value == null + ? styleNull : (typeof value === "function" + ? styleFunction : styleConstant)); +}; +d3_selectionPrototype.property = function(name, value) { + + // If no value is specified, return the first value. + if (arguments.length < 2) return this.node()[name]; + + function propertyNull() { + delete this[name]; + } + + function propertyConstant() { + this[name] = value; + } + + function propertyFunction() { + var x = value.apply(this, arguments); + if (x == null) delete this[name]; + else this[name] = x; + } + + return this.each(value == null + ? propertyNull : (typeof value === "function" + ? propertyFunction : propertyConstant)); +}; +d3_selectionPrototype.text = function(value) { + return arguments.length < 1 + ? this.node().textContent : this.each(typeof value === "function" + ? function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; } : value == null + ? function() { this.textContent = ""; } + : function() { this.textContent = value; }); +}; +d3_selectionPrototype.html = function(value) { + return arguments.length < 1 + ? this.node().innerHTML : this.each(typeof value === "function" + ? function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; } : value == null + ? function() { this.innerHTML = ""; } + : function() { this.innerHTML = value; }); +}; +// TODO append(node)? +// TODO append(function)? +d3_selectionPrototype.append = function(name) { + name = d3.ns.qualify(name); + + function append() { + return this.appendChild(document.createElementNS(this.namespaceURI, name)); + } + + function appendNS() { + return this.appendChild(document.createElementNS(name.space, name.local)); + } + + return this.select(name.local ? appendNS : append); +}; +// TODO insert(node, function)? +// TODO insert(function, string)? +// TODO insert(function, function)? +d3_selectionPrototype.insert = function(name, before) { + name = d3.ns.qualify(name); + + function insert() { + return this.insertBefore( + document.createElementNS(this.namespaceURI, name), + d3_select(before, this)); + } + + function insertNS() { + return this.insertBefore( + document.createElementNS(name.space, name.local), + d3_select(before, this)); + } + + return this.select(name.local ? insertNS : insert); +}; +// TODO remove(selector)? +// TODO remove(node)? +// TODO remove(function)? +d3_selectionPrototype.remove = function() { + return this.each(function() { + var parent = this.parentNode; + if (parent) parent.removeChild(this); + }); +}; +d3_selectionPrototype.data = function(value, key) { + var i = -1, + n = this.length, + group, + node; + + // If no value is specified, return the first value. + if (!arguments.length) { + value = new Array(n = (group = this[0]).length); + while (++i < n) { + if (node = group[i]) { + value[i] = node.__data__; + } + } + return value; + } + + function bind(group, groupData) { + var i, + n = group.length, + m = groupData.length, + n0 = Math.min(n, m), + n1 = Math.max(n, m), + updateNodes = [], + enterNodes = [], + exitNodes = [], + node, + nodeData; + + if (key) { + var nodeByKeyValue = new d3_Map, + keyValues = [], + keyValue, + j = groupData.length; + + for (i = -1; ++i < n;) { + keyValue = key.call(node = group[i], node.__data__, i); + if (nodeByKeyValue.has(keyValue)) { + exitNodes[j++] = node; // duplicate key + } else { + nodeByKeyValue.set(keyValue, node); + } + keyValues.push(keyValue); + } + + for (i = -1; ++i < m;) { + keyValue = key.call(groupData, nodeData = groupData[i], i) + if (nodeByKeyValue.has(keyValue)) { + updateNodes[i] = node = nodeByKeyValue.get(keyValue); + node.__data__ = nodeData; + enterNodes[i] = exitNodes[i] = null; + } else { + enterNodes[i] = d3_selection_dataNode(nodeData); + updateNodes[i] = exitNodes[i] = null; + } + nodeByKeyValue.remove(keyValue); + } + + for (i = -1; ++i < n;) { + if (nodeByKeyValue.has(keyValues[i])) { + exitNodes[i] = group[i]; + } + } + } else { + for (i = -1; ++i < n0;) { + node = group[i]; + nodeData = groupData[i]; + if (node) { + node.__data__ = nodeData; + updateNodes[i] = node; + enterNodes[i] = exitNodes[i] = null; + } else { + enterNodes[i] = d3_selection_dataNode(nodeData); + updateNodes[i] = exitNodes[i] = null; + } + } + for (; i < m; ++i) { + enterNodes[i] = d3_selection_dataNode(groupData[i]); + updateNodes[i] = exitNodes[i] = null; + } + for (; i < n1; ++i) { + exitNodes[i] = group[i]; + enterNodes[i] = updateNodes[i] = null; + } + } + + enterNodes.update + = updateNodes; + + enterNodes.parentNode + = updateNodes.parentNode + = exitNodes.parentNode + = group.parentNode; + + enter.push(enterNodes); + update.push(updateNodes); + exit.push(exitNodes); + } + + var enter = d3_selection_enter([]), + update = d3_selection([]), + exit = d3_selection([]); + + if (typeof value === "function") { + while (++i < n) { + bind(group = this[i], value.call(group, group.parentNode.__data__, i)); + } + } else { + while (++i < n) { + bind(group = this[i], value); + } + } + + update.enter = function() { return enter; }; + update.exit = function() { return exit; }; + return update; +}; + +function d3_selection_dataNode(data) { + return {__data__: data}; +} +d3_selectionPrototype.datum = +d3_selectionPrototype.map = function(value) { + return arguments.length < 1 + ? this.property("__data__") + : this.property("__data__", value); +}; +d3_selectionPrototype.filter = function(filter) { + var subgroups = [], + subgroup, + group, + node; + + if (typeof filter !== "function") filter = d3_selection_filter(filter); + + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = 0, n = group.length; i < n; i++) { + if ((node = group[i]) && filter.call(node, node.__data__, i)) { + subgroup.push(node); + } + } + } + + return d3_selection(subgroups); +}; + +function d3_selection_filter(selector) { + return function() { + return d3_selectMatches(this, selector); + }; +} +d3_selectionPrototype.order = function() { + for (var j = -1, m = this.length; ++j < m;) { + for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0;) { + if (node = group[i]) { + if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next); + next = node; + } + } + } + return this; +}; +d3_selectionPrototype.sort = function(comparator) { + comparator = d3_selection_sortComparator.apply(this, arguments); + for (var j = -1, m = this.length; ++j < m;) this[j].sort(comparator); + return this.order(); +}; + +function d3_selection_sortComparator(comparator) { + if (!arguments.length) comparator = d3.ascending; + return function(a, b) { + return comparator(a && a.__data__, b && b.__data__); + }; +} +// type can be namespaced, e.g., "click.foo" +// listener can be null for removal +d3_selectionPrototype.on = function(type, listener, capture) { + if (arguments.length < 3) capture = false; + + // parse the type specifier + var name = "__on" + type, i = type.indexOf("."); + if (i > 0) type = type.substring(0, i); + + // if called with only one argument, return the current listener + if (arguments.length < 2) return (i = this.node()[name]) && i._; + + // remove the old event listener, and add the new event listener + return this.each(function(d, i) { + var node = this, + o = node[name]; + + // remove the old listener, if any (using the previously-set capture) + if (o) { + node.removeEventListener(type, o, o.$); + delete node[name]; + } + + // add the new listener, if any (remembering the capture flag) + if (listener) { + node.addEventListener(type, node[name] = l, l.$ = capture); + l._ = listener; // stash the unwrapped listener for get + } + + // wrapped event listener that preserves i + function l(e) { + var o = d3.event; // Events can be reentrant (e.g., focus). + d3.event = e; + try { + listener.call(node, node.__data__, i); + } finally { + d3.event = o; + } + } + }); +}; +d3_selectionPrototype.each = function(callback) { + for (var j = -1, m = this.length; ++j < m;) { + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + var node = group[i]; + if (node) callback.call(node, node.__data__, i, j); + } + } + return this; +}; +// +// Note: assigning to the arguments array simultaneously changes the value of +// the corresponding argument! +// +// TODO The `this` argument probably shouldn't be the first argument to the +// callback, anyway, since it's redundant. However, that will require a major +// version bump due to backwards compatibility, so I'm not changing it right +// away. +// +d3_selectionPrototype.call = function(callback) { + callback.apply(this, (arguments[0] = this, arguments)); + return this; +}; +d3_selectionPrototype.empty = function() { + return !this.node(); +}; +d3_selectionPrototype.node = function(callback) { + for (var j = 0, m = this.length; j < m; j++) { + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + var node = group[i]; + if (node) return node; + } + } + return null; +}; +d3_selectionPrototype.transition = function() { + var subgroups = [], + subgroup, + node; + + for (var j = -1, m = this.length; ++j < m;) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + subgroup.push((node = group[i]) ? {node: node, delay: d3_transitionDelay, duration: d3_transitionDuration} : null); + } + } + + return d3_transition(subgroups, d3_transitionId || ++d3_transitionNextId, Date.now()); +}; +var d3_selectionRoot = d3_selection([[document]]); + +d3_selectionRoot[0].parentNode = d3_selectRoot; + +// TODO fast singleton implementation! +// TODO select(function) +d3.select = function(selector) { + return typeof selector === "string" + ? d3_selectionRoot.select(selector) + : d3_selection([[selector]]); // assume node +}; + +// TODO selectAll(function) +d3.selectAll = function(selector) { + return typeof selector === "string" + ? d3_selectionRoot.selectAll(selector) + : d3_selection([d3_array(selector)]); // assume node[] +}; +function d3_selection_enter(selection) { + d3_arraySubclass(selection, d3_selection_enterPrototype); + return selection; +} + +var d3_selection_enterPrototype = []; + +d3.selection.enter = d3_selection_enter; +d3.selection.enter.prototype = d3_selection_enterPrototype; + +d3_selection_enterPrototype.append = d3_selectionPrototype.append; +d3_selection_enterPrototype.insert = d3_selectionPrototype.insert; +d3_selection_enterPrototype.empty = d3_selectionPrototype.empty; +d3_selection_enterPrototype.node = d3_selectionPrototype.node; +d3_selection_enterPrototype.select = function(selector) { + var subgroups = [], + subgroup, + subnode, + upgroup, + group, + node; + + for (var j = -1, m = this.length; ++j < m;) { + upgroup = (group = this[j]).update; + subgroups.push(subgroup = []); + subgroup.parentNode = group.parentNode; + for (var i = -1, n = group.length; ++i < n;) { + if (node = group[i]) { + subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i)); + subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + + return d3_selection(subgroups); +}; +function d3_transition(groups, id, time) { + d3_arraySubclass(groups, d3_transitionPrototype); + + var tweens = new d3_Map, + event = d3.dispatch("start", "end"), + ease = d3_transitionEase; + + groups.id = id; + + groups.time = time; + + groups.tween = function(name, tween) { + if (arguments.length < 2) return tweens.get(name); + if (tween == null) tweens.remove(name); + else tweens.set(name, tween); + return groups; + }; + + groups.ease = function(value) { + if (!arguments.length) return ease; + ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments); + return groups; + }; + + groups.each = function(type, listener) { + if (arguments.length < 2) return d3_transition_each.call(groups, type); + event.on(type, listener); + return groups; + }; + + d3.timer(function(elapsed) { + groups.each(function(d, i, j) { + var tweened = [], + node = this, + delay = groups[j][i].delay, + duration = groups[j][i].duration, + lock = node.__transition__ || (node.__transition__ = {active: 0, count: 0}); + + ++lock.count; + + delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time); + + function start(elapsed) { + if (lock.active > id) return stop(); + lock.active = id; + + tweens.forEach(function(key, value) { + if (value = value.call(node, d, i)) { + tweened.push(value); + } + }); + + event.start.call(node, d, i); + if (!tick(elapsed)) d3.timer(tick, 0, time); + return 1; + } + + function tick(elapsed) { + if (lock.active !== id) return stop(); + + var t = (elapsed - delay) / duration, + e = ease(t), + n = tweened.length; + + while (n > 0) { + tweened[--n].call(node, e); + } + + if (t >= 1) { + stop(); + d3_transitionId = id; + event.end.call(node, d, i); + d3_transitionId = 0; + return 1; + } + } + + function stop() { + if (!--lock.count) delete node.__transition__; + return 1; + } + }); + return 1; + }, 0, time); + + return groups; +} + +var d3_transitionRemove = {}; + +function d3_transitionNull(d, i, a) { + return a != "" && d3_transitionRemove; +} + +function d3_transitionTween(name, b) { + var interpolate = d3_interpolateByName(name); + + function transitionFunction(d, i, a) { + var v = b.call(this, d, i); + return v == null + ? a != "" && d3_transitionRemove + : a != v && interpolate(a, v); + } + + function transitionString(d, i, a) { + return a != b && interpolate(a, b); + } + + return typeof b === "function" ? transitionFunction + : b == null ? d3_transitionNull + : (b += "", transitionString); +} + +var d3_transitionPrototype = [], + d3_transitionNextId = 0, + d3_transitionId = 0, + d3_transitionDefaultDelay = 0, + d3_transitionDefaultDuration = 250, + d3_transitionDefaultEase = d3.ease("cubic-in-out"), + d3_transitionDelay = d3_transitionDefaultDelay, + d3_transitionDuration = d3_transitionDefaultDuration, + d3_transitionEase = d3_transitionDefaultEase; + +d3_transitionPrototype.call = d3_selectionPrototype.call; + +d3.transition = function(selection) { + return arguments.length + ? (d3_transitionId ? selection.transition() : selection) + : d3_selectionRoot.transition(); +}; + +d3.transition.prototype = d3_transitionPrototype; +d3_transitionPrototype.select = function(selector) { + var subgroups = [], + subgroup, + subnode, + node; + + if (typeof selector !== "function") selector = d3_selection_selector(selector); + + for (var j = -1, m = this.length; ++j < m;) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) { + if ("__data__" in node.node) subnode.__data__ = node.node.__data__; + subgroup.push({node: subnode, delay: node.delay, duration: node.duration}); + } else { + subgroup.push(null); + } + } + } + + return d3_transition(subgroups, this.id, this.time).ease(this.ease()); +}; +d3_transitionPrototype.selectAll = function(selector) { + var subgroups = [], + subgroup, + subnodes, + node; + + if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); + + for (var j = -1, m = this.length; ++j < m;) { + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + if (node = group[i]) { + subnodes = selector.call(node.node, node.node.__data__, i); + subgroups.push(subgroup = []); + for (var k = -1, o = subnodes.length; ++k < o;) { + subgroup.push({node: subnodes[k], delay: node.delay, duration: node.duration}); + } + } + } + } + + return d3_transition(subgroups, this.id, this.time).ease(this.ease()); +}; +d3_transitionPrototype.attr = function(name, value) { + return this.attrTween(name, d3_transitionTween(name, value)); +}; + +d3_transitionPrototype.attrTween = function(nameNS, tween) { + var name = d3.ns.qualify(nameNS); + + function attrTween(d, i) { + var f = tween.call(this, d, i, this.getAttribute(name)); + return f === d3_transitionRemove + ? (this.removeAttribute(name), null) + : f && function(t) { this.setAttribute(name, f(t)); }; + } + + function attrTweenNS(d, i) { + var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local)); + return f === d3_transitionRemove + ? (this.removeAttributeNS(name.space, name.local), null) + : f && function(t) { this.setAttributeNS(name.space, name.local, f(t)); }; + } + + return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween); +}; +d3_transitionPrototype.style = function(name, value, priority) { + if (arguments.length < 3) priority = ""; + return this.styleTween(name, d3_transitionTween(name, value), priority); +}; + +d3_transitionPrototype.styleTween = function(name, tween, priority) { + if (arguments.length < 3) priority = ""; + return this.tween("style." + name, function(d, i) { + var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name)); + return f === d3_transitionRemove + ? (this.style.removeProperty(name), null) + : f && function(t) { this.style.setProperty(name, f(t), priority); }; + }); +}; +d3_transitionPrototype.text = function(value) { + return this.tween("text", function(d, i) { + this.textContent = typeof value === "function" + ? value.call(this, d, i) + : value; + }); +}; +d3_transitionPrototype.remove = function() { + return this.each("end.transition", function() { + var p; + if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this); + }); +}; +d3_transitionPrototype.delay = function(value) { + var groups = this; + return groups.each(typeof value === "function" + ? function(d, i, j) { groups[j][i].delay = value.apply(this, arguments) | 0; } + : (value = value | 0, function(d, i, j) { groups[j][i].delay = value; })); +}; +d3_transitionPrototype.duration = function(value) { + var groups = this; + return groups.each(typeof value === "function" + ? function(d, i, j) { groups[j][i].duration = Math.max(1, value.apply(this, arguments) | 0); } + : (value = Math.max(1, value | 0), function(d, i, j) { groups[j][i].duration = value; })); +}; +function d3_transition_each(callback) { + var id = d3_transitionId, + ease = d3_transitionEase, + delay = d3_transitionDelay, + duration = d3_transitionDuration; + + d3_transitionId = this.id; + d3_transitionEase = this.ease(); + for (var j = 0, m = this.length; j < m; j++) { + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + var node = group[i]; + if (node) { + d3_transitionDelay = this[j][i].delay; + d3_transitionDuration = this[j][i].duration; + callback.call(node = node.node, node.__data__, i, j); + } + } + } + + d3_transitionId = id; + d3_transitionEase = ease; + d3_transitionDelay = delay; + d3_transitionDuration = duration; + return this; +} +d3_transitionPrototype.transition = function() { + return this.select(d3_this); +}; +var d3_timer_queue = null, + d3_timer_interval, // is an interval (or frame) active? + d3_timer_timeout; // is a timeout active? + +// The timer will continue to fire until callback returns true. +d3.timer = function(callback, delay, then) { + var found = false, + t0, + t1 = d3_timer_queue; + + if (arguments.length < 3) { + if (arguments.length < 2) delay = 0; + else if (!isFinite(delay)) return; + then = Date.now(); + } + + // See if the callback's already in the queue. + while (t1) { + if (t1.callback === callback) { + t1.then = then; + t1.delay = delay; + found = true; + break; + } + t0 = t1; + t1 = t1.next; + } + + // Otherwise, add the callback to the queue. + if (!found) d3_timer_queue = { + callback: callback, + then: then, + delay: delay, + next: d3_timer_queue + }; + + // Start animatin'! + if (!d3_timer_interval) { + d3_timer_timeout = clearTimeout(d3_timer_timeout); + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } +} + +function d3_timer_step() { + var elapsed, + now = Date.now(), + t1 = d3_timer_queue; + + while (t1) { + elapsed = now - t1.then; + if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed); + t1 = t1.next; + } + + var delay = d3_timer_flush() - now; + if (delay > 24) { + if (isFinite(delay)) { + clearTimeout(d3_timer_timeout); + d3_timer_timeout = setTimeout(d3_timer_step, delay); + } + d3_timer_interval = 0; + } else { + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } +} + +d3.timer.flush = function() { + var elapsed, + now = Date.now(), + t1 = d3_timer_queue; + + while (t1) { + elapsed = now - t1.then; + if (!t1.delay) t1.flush = t1.callback(elapsed); + t1 = t1.next; + } + + d3_timer_flush(); +}; + +// Flush after callbacks, to avoid concurrent queue modification. +function d3_timer_flush() { + var t0 = null, + t1 = d3_timer_queue, + then = Infinity; + while (t1) { + if (t1.flush) { + t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next; + } else { + then = Math.min(then, t1.then + t1.delay); + t1 = (t0 = t1).next; + } + } + return then; +} + +var d3_timer_frame = window.requestAnimationFrame + || window.webkitRequestAnimationFrame + || window.mozRequestAnimationFrame + || window.oRequestAnimationFrame + || window.msRequestAnimationFrame + || function(callback) { setTimeout(callback, 17); }; +d3.transform = function(string) { + var g = document.createElementNS(d3.ns.prefix.svg, "g"), + identity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0}; + return (d3.transform = function(string) { + g.setAttribute("transform", string); + var t = g.transform.baseVal.consolidate(); + return new d3_transform(t ? t.matrix : identity); + })(string); +}; + +// Compute x-scale and normalize the first row. +// Compute shear and make second row orthogonal to first. +// Compute y-scale and normalize the second row. +// Finally, compute the rotation. +function d3_transform(m) { + var r0 = [m.a, m.b], + r1 = [m.c, m.d], + kx = d3_transformNormalize(r0), + kz = d3_transformDot(r0, r1), + ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0; + if (r0[0] * r1[1] < r1[0] * r0[1]) { + r0[0] *= -1; + r0[1] *= -1; + kx *= -1; + kz *= -1; + } + this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees; + this.translate = [m.e, m.f]; + this.scale = [kx, ky]; + this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0; +}; + +d3_transform.prototype.toString = function() { + return "translate(" + this.translate + + ")rotate(" + this.rotate + + ")skewX(" + this.skew + + ")scale(" + this.scale + + ")"; +}; + +function d3_transformDot(a, b) { + return a[0] * b[0] + a[1] * b[1]; +} + +function d3_transformNormalize(a) { + var k = Math.sqrt(d3_transformDot(a, a)); + if (k) { + a[0] /= k; + a[1] /= k; + } + return k; +} + +function d3_transformCombine(a, b, k) { + a[0] += k * b[0]; + a[1] += k * b[1]; + return a; +} + +var d3_transformDegrees = 180 / Math.PI; +d3.mouse = function(container) { + return d3_mousePoint(container, d3_eventSource()); +}; + +// https://bugs.webkit.org/show_bug.cgi?id=44083 +var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0; + +function d3_mousePoint(container, e) { + var svg = container.ownerSVGElement || container; + if (svg.createSVGPoint) { + var point = svg.createSVGPoint(); + if ((d3_mouse_bug44083 < 0) && (window.scrollX || window.scrollY)) { + svg = d3.select(document.body) + .append("svg") + .style("position", "absolute") + .style("top", 0) + .style("left", 0); + var ctm = svg[0][0].getScreenCTM(); + d3_mouse_bug44083 = !(ctm.f || ctm.e); + svg.remove(); + } + if (d3_mouse_bug44083) { + point.x = e.pageX; + point.y = e.pageY; + } else { + point.x = e.clientX; + point.y = e.clientY; + } + point = point.matrixTransform(container.getScreenCTM().inverse()); + return [point.x, point.y]; + } + var rect = container.getBoundingClientRect(); + return [e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop]; +}; +d3.touches = function(container, touches) { + if (arguments.length < 2) touches = d3_eventSource().touches; + return touches ? d3_array(touches).map(function(touch) { + var point = d3_mousePoint(container, touch); + point.identifier = touch.identifier; + return point; + }) : []; +}; +function d3_noop() {} +d3.scale = {}; + +function d3_scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [start, stop] : [stop, start]; +} + +function d3_scaleRange(scale) { + return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range()); +} +function d3_scale_nice(domain, nice) { + var i0 = 0, + i1 = domain.length - 1, + x0 = domain[i0], + x1 = domain[i1], + dx; + + if (x1 < x0) { + dx = i0; i0 = i1; i1 = dx; + dx = x0; x0 = x1; x1 = dx; + } + + if (dx = x1 - x0) { + nice = nice(dx); + domain[i0] = nice.floor(x0); + domain[i1] = nice.ceil(x1); + } + + return domain; +} + +function d3_scale_niceDefault() { + return Math; +} +d3.scale.linear = function() { + return d3_scale_linear([0, 1], [0, 1], d3.interpolate, false); +}; + +function d3_scale_linear(domain, range, interpolate, clamp) { + var output, + input; + + function rescale() { + var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, + uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber; + output = linear(domain, range, uninterpolate, interpolate); + input = linear(range, domain, uninterpolate, d3.interpolate); + return scale; + } + + function scale(x) { + return output(x); + } + + // Note: requires range is coercible to number! + scale.invert = function(y) { + return input(y); + }; + + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.map(Number); + return rescale(); + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + + scale.rangeRound = function(x) { + return scale.range(x).interpolate(d3.interpolateRound); + }; + + scale.clamp = function(x) { + if (!arguments.length) return clamp; + clamp = x; + return rescale(); + }; + + scale.interpolate = function(x) { + if (!arguments.length) return interpolate; + interpolate = x; + return rescale(); + }; + + scale.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + + scale.tickFormat = function(m) { + return d3_scale_linearTickFormat(domain, m); + }; + + scale.nice = function() { + d3_scale_nice(domain, d3_scale_linearNice); + return rescale(); + }; + + scale.copy = function() { + return d3_scale_linear(domain, range, interpolate, clamp); + }; + + return rescale(); +} + +function d3_scale_linearRebind(scale, linear) { + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); +} + +function d3_scale_linearNice(dx) { + dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1); + return { + floor: function(x) { return Math.floor(x / dx) * dx; }, + ceil: function(x) { return Math.ceil(x / dx) * dx; } + }; +} + +function d3_scale_linearTickRange(domain, m) { + var extent = d3_scaleExtent(domain), + span = extent[1] - extent[0], + step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), + err = m / span * step; + + // Filter ticks to get closer to the desired count. + if (err <= .15) step *= 10; + else if (err <= .35) step *= 5; + else if (err <= .75) step *= 2; + + // Round start and stop values to step interval. + extent[0] = Math.ceil(extent[0] / step) * step; + extent[1] = Math.floor(extent[1] / step) * step + step * .5; // inclusive + extent[2] = step; + return extent; +} + +function d3_scale_linearTicks(domain, m) { + return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); +} + +function d3_scale_linearTickFormat(domain, m) { + return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f"); +} +function d3_scale_bilinear(domain, range, uninterpolate, interpolate) { + var u = uninterpolate(domain[0], domain[1]), + i = interpolate(range[0], range[1]); + return function(x) { + return i(u(x)); + }; +} +function d3_scale_polylinear(domain, range, uninterpolate, interpolate) { + var u = [], + i = [], + j = 0, + k = Math.min(domain.length, range.length) - 1; + + // Handle descending domains. + if (domain[k] < domain[0]) { + domain = domain.slice().reverse(); + range = range.slice().reverse(); + } + + while (++j <= k) { + u.push(uninterpolate(domain[j - 1], domain[j])); + i.push(interpolate(range[j - 1], range[j])); + } + + return function(x) { + var j = d3.bisect(domain, x, 1, k) - 1; + return i[j](u[j](x)); + }; +} +d3.scale.log = function() { + return d3_scale_log(d3.scale.linear(), d3_scale_logp); +}; + +function d3_scale_log(linear, log) { + var pow = log.pow; + + function scale(x) { + return linear(log(x)); + } + + scale.invert = function(x) { + return pow(linear.invert(x)); + }; + + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(pow); + log = x[0] < 0 ? d3_scale_logn : d3_scale_logp; + pow = log.pow; + linear.domain(x.map(log)); + return scale; + }; + + scale.nice = function() { + linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault)); + return scale; + }; + + scale.ticks = function() { + var extent = d3_scaleExtent(linear.domain()), + ticks = []; + if (extent.every(isFinite)) { + var i = Math.floor(extent[0]), + j = Math.ceil(extent[1]), + u = pow(extent[0]), + v = pow(extent[1]); + if (log === d3_scale_logn) { + ticks.push(pow(i)); + for (; i++ < j;) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k); + } else { + for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k); + ticks.push(pow(i)); + } + for (i = 0; ticks[i] < u; i++) {} // strip small values + for (j = ticks.length; ticks[j - 1] > v; j--) {} // strip big values + ticks = ticks.slice(i, j); + } + return ticks; + }; + + scale.tickFormat = function(n, format) { + if (arguments.length < 2) format = d3_scale_logFormat; + if (arguments.length < 1) return format; + var k = Math.max(.1, n / scale.ticks().length), + f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), + e; + return function(d) { + return d / pow(f(log(d) + e)) <= k ? format(d) : ""; + }; + }; + + scale.copy = function() { + return d3_scale_log(linear.copy(), log); + }; + + return d3_scale_linearRebind(scale, linear); +} + +var d3_scale_logFormat = d3.format(".0e"); + +function d3_scale_logp(x) { + return Math.log(x < 0 ? 0 : x) / Math.LN10; +} + +function d3_scale_logn(x) { + return -Math.log(x > 0 ? 0 : -x) / Math.LN10; +} + +d3_scale_logp.pow = function(x) { + return Math.pow(10, x); +}; + +d3_scale_logn.pow = function(x) { + return -Math.pow(10, -x); +}; +d3.scale.pow = function() { + return d3_scale_pow(d3.scale.linear(), 1); +}; + +function d3_scale_pow(linear, exponent) { + var powp = d3_scale_powPow(exponent), + powb = d3_scale_powPow(1 / exponent); + + function scale(x) { + return linear(powp(x)); + } + + scale.invert = function(x) { + return powb(linear.invert(x)); + }; + + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(powb); + linear.domain(x.map(powp)); + return scale; + }; + + scale.ticks = function(m) { + return d3_scale_linearTicks(scale.domain(), m); + }; + + scale.tickFormat = function(m) { + return d3_scale_linearTickFormat(scale.domain(), m); + }; + + scale.nice = function() { + return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice)); + }; + + scale.exponent = function(x) { + if (!arguments.length) return exponent; + var domain = scale.domain(); + powp = d3_scale_powPow(exponent = x); + powb = d3_scale_powPow(1 / exponent); + return scale.domain(domain); + }; + + scale.copy = function() { + return d3_scale_pow(linear.copy(), exponent); + }; + + return d3_scale_linearRebind(scale, linear); +} + +function d3_scale_powPow(e) { + return function(x) { + return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); + }; +} +d3.scale.sqrt = function() { + return d3.scale.pow().exponent(.5); +}; +d3.scale.ordinal = function() { + return d3_scale_ordinal([], {t: "range", x: []}); +}; + +function d3_scale_ordinal(domain, ranger) { + var index, + range, + rangeBand; + + function scale(x) { + return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length]; + } + + function steps(start, step) { + return d3.range(domain.length).map(function(i) { return start + step * i; }); + } + + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = []; + index = new d3_Map; + var i = -1, n = x.length, xi; + while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi)); + return scale[ranger.t](ranger.x, ranger.p); + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + rangeBand = 0; + ranger = {t: "range", x: x}; + return scale; + }; + + scale.rangePoints = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], + stop = x[1], + step = (stop - start) / (domain.length - 1 + padding); + range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step); + rangeBand = 0; + ranger = {t: "rangePoints", x: x, p: padding}; + return scale; + }; + + scale.rangeBands = function(x, padding) { + if (arguments.length < 2) padding = 0; + var reverse = x[1] < x[0], + start = x[reverse - 0], + stop = x[1 - reverse], + step = (stop - start) / (domain.length + padding); + range = steps(start + step * padding, step); + if (reverse) range.reverse(); + rangeBand = step * (1 - padding); + ranger = {t: "rangeBands", x: x, p: padding}; + return scale; + }; + + scale.rangeRoundBands = function(x, padding) { + if (arguments.length < 2) padding = 0; + var reverse = x[1] < x[0], + start = x[reverse - 0], + stop = x[1 - reverse], + step = Math.floor((stop - start) / (domain.length + padding)), + error = stop - start - (domain.length - padding) * step; + range = steps(start + Math.round(error / 2), step); + if (reverse) range.reverse(); + rangeBand = Math.round(step * (1 - padding)); + ranger = {t: "rangeRoundBands", x: x, p: padding}; + return scale; + }; + + scale.rangeBand = function() { + return rangeBand; + }; + + scale.rangeExtent = function() { + return d3_scaleExtent(ranger.x); + }; + + scale.copy = function() { + return d3_scale_ordinal(domain, ranger); + }; + + return scale.domain(domain); +} +/* + * This product includes color specifications and designs developed by Cynthia + * Brewer (http://colorbrewer.org/). See lib/colorbrewer for more information. + */ + +d3.scale.category10 = function() { + return d3.scale.ordinal().range(d3_category10); +}; + +d3.scale.category20 = function() { + return d3.scale.ordinal().range(d3_category20); +}; + +d3.scale.category20b = function() { + return d3.scale.ordinal().range(d3_category20b); +}; + +d3.scale.category20c = function() { + return d3.scale.ordinal().range(d3_category20c); +}; + +var d3_category10 = [ + "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", + "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" +]; + +var d3_category20 = [ + "#1f77b4", "#aec7e8", + "#ff7f0e", "#ffbb78", + "#2ca02c", "#98df8a", + "#d62728", "#ff9896", + "#9467bd", "#c5b0d5", + "#8c564b", "#c49c94", + "#e377c2", "#f7b6d2", + "#7f7f7f", "#c7c7c7", + "#bcbd22", "#dbdb8d", + "#17becf", "#9edae5" +]; + +var d3_category20b = [ + "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", + "#637939", "#8ca252", "#b5cf6b", "#cedb9c", + "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", + "#843c39", "#ad494a", "#d6616b", "#e7969c", + "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" +]; + +var d3_category20c = [ + "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", + "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", + "#31a354", "#74c476", "#a1d99b", "#c7e9c0", + "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", + "#636363", "#969696", "#bdbdbd", "#d9d9d9" +]; +d3.scale.quantile = function() { + return d3_scale_quantile([], []); +}; + +function d3_scale_quantile(domain, range) { + var thresholds; + + function rescale() { + var k = 0, + n = domain.length, + q = range.length; + thresholds = []; + while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q); + return scale; + } + + function scale(x) { + if (isNaN(x = +x)) return NaN; + return range[d3.bisect(thresholds, x)]; + } + + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending); + return rescale(); + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + + scale.quantiles = function() { + return thresholds; + }; + + scale.copy = function() { + return d3_scale_quantile(domain, range); // copy on write! + }; + + return rescale(); +} +d3.scale.quantize = function() { + return d3_scale_quantize(0, 1, [0, 1]); +}; + +function d3_scale_quantize(x0, x1, range) { + var kx, i; + + function scale(x) { + return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; + } + + function rescale() { + kx = range.length / (x1 - x0); + i = range.length - 1; + return scale; + } + + scale.domain = function(x) { + if (!arguments.length) return [x0, x1]; + x0 = +x[0]; + x1 = +x[x.length - 1]; + return rescale(); + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + + scale.copy = function() { + return d3_scale_quantize(x0, x1, range); // copy on write + }; + + return rescale(); +} +d3.scale.identity = function() { + return d3_scale_identity([0, 1]); +}; + +function d3_scale_identity(domain) { + + function identity(x) { return +x; } + + identity.invert = identity; + + identity.domain = identity.range = function(x) { + if (!arguments.length) return domain; + domain = x.map(identity); + return identity; + }; + + identity.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + + identity.tickFormat = function(m) { + return d3_scale_linearTickFormat(domain, m); + }; + + identity.copy = function() { + return d3_scale_identity(domain); + }; + + return identity; +} +d3.svg = {}; +d3.svg.arc = function() { + var innerRadius = d3_svg_arcInnerRadius, + outerRadius = d3_svg_arcOuterRadius, + startAngle = d3_svg_arcStartAngle, + endAngle = d3_svg_arcEndAngle; + + function arc() { + var r0 = innerRadius.apply(this, arguments), + r1 = outerRadius.apply(this, arguments), + a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, + a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, + da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0), + df = da < Math.PI ? "0" : "1", + c0 = Math.cos(a0), + s0 = Math.sin(a0), + c1 = Math.cos(a1), + s1 = Math.sin(a1); + return da >= d3_svg_arcMax + ? (r0 + ? "M0," + r1 + + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) + + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + + "M0," + r0 + + "A" + r0 + "," + r0 + " 0 1,0 0," + (-r0) + + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + + "Z" + : "M0," + r1 + + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) + + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + + "Z") + : (r0 + ? "M" + r1 * c0 + "," + r1 * s0 + + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + + "L" + r0 * c1 + "," + r0 * s1 + + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + + "Z" + : "M" + r1 * c0 + "," + r1 * s0 + + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + + "L0,0" + + "Z"); + } + + arc.innerRadius = function(v) { + if (!arguments.length) return innerRadius; + innerRadius = d3_functor(v); + return arc; + }; + + arc.outerRadius = function(v) { + if (!arguments.length) return outerRadius; + outerRadius = d3_functor(v); + return arc; + }; + + arc.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3_functor(v); + return arc; + }; + + arc.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3_functor(v); + return arc; + }; + + arc.centroid = function() { + var r = (innerRadius.apply(this, arguments) + + outerRadius.apply(this, arguments)) / 2, + a = (startAngle.apply(this, arguments) + + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset; + return [Math.cos(a) * r, Math.sin(a) * r]; + }; + + return arc; +}; + +var d3_svg_arcOffset = -Math.PI / 2, + d3_svg_arcMax = 2 * Math.PI - 1e-6; + +function d3_svg_arcInnerRadius(d) { + return d.innerRadius; +} + +function d3_svg_arcOuterRadius(d) { + return d.outerRadius; +} + +function d3_svg_arcStartAngle(d) { + return d.startAngle; +} + +function d3_svg_arcEndAngle(d) { + return d.endAngle; +} +function d3_svg_line(projection) { + var x = d3_svg_lineX, + y = d3_svg_lineY, + defined = d3_true, + interpolate = d3_svg_lineInterpolatorDefault, + interpolator = d3_svg_lineLinear, + tension = .7; + + function line(data) { + var segments = [], + points = [], + i = -1, + n = data.length, + d, + fx = d3_functor(x), + fy = d3_functor(y); + + function segment() { + segments.push("M", interpolator(projection(points), tension)); + } + + while (++i < n) { + if (defined.call(this, d = data[i], i)) { + points.push([+fx.call(this, d, i), +fy.call(this, d, i)]); + } else if (points.length) { + segment(); + points = []; + } + } + + if (points.length) segment(); + + return segments.length ? segments.join("") : null; + } + + line.x = function(_) { + if (!arguments.length) return x; + x = _; + return line; + }; + + line.y = function(_) { + if (!arguments.length) return y; + y = _; + return line; + }; + + line.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return line; + }; + + line.interpolate = function(_) { + if (!arguments.length) return interpolate; + if (!d3_svg_lineInterpolators.has(_ += "")) _ = d3_svg_lineInterpolatorDefault; + interpolator = d3_svg_lineInterpolators.get(interpolate = _); + return line; + }; + + line.tension = function(_) { + if (!arguments.length) return tension; + tension = _; + return line; + }; + + return line; +} + +d3.svg.line = function() { + return d3_svg_line(d3_identity); +}; + +// The default `x` property, which references d[0]. +function d3_svg_lineX(d) { + return d[0]; +} + +// The default `y` property, which references d[1]. +function d3_svg_lineY(d) { + return d[1]; +} + +var d3_svg_lineInterpolatorDefault = "linear"; + +// The various interpolators supported by the `line` class. +var d3_svg_lineInterpolators = d3.map({ + "linear": d3_svg_lineLinear, + "step-before": d3_svg_lineStepBefore, + "step-after": d3_svg_lineStepAfter, + "basis": d3_svg_lineBasis, + "basis-open": d3_svg_lineBasisOpen, + "basis-closed": d3_svg_lineBasisClosed, + "bundle": d3_svg_lineBundle, + "cardinal": d3_svg_lineCardinal, + "cardinal-open": d3_svg_lineCardinalOpen, + "cardinal-closed": d3_svg_lineCardinalClosed, + "monotone": d3_svg_lineMonotone +}); + +// Linear interpolation; generates "L" commands. +function d3_svg_lineLinear(points) { + var i = 0, + n = points.length, + p = points[0], + path = [p[0], ",", p[1]]; + while (++i < n) path.push("L", (p = points[i])[0], ",", p[1]); + return path.join(""); +} + +// Step interpolation; generates "H" and "V" commands. +function d3_svg_lineStepBefore(points) { + var i = 0, + n = points.length, + p = points[0], + path = [p[0], ",", p[1]]; + while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]); + return path.join(""); +} + +// Step interpolation; generates "H" and "V" commands. +function d3_svg_lineStepAfter(points) { + var i = 0, + n = points.length, + p = points[0], + path = [p[0], ",", p[1]]; + while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]); + return path.join(""); +} + +// Open cardinal spline interpolation; generates "C" commands. +function d3_svg_lineCardinalOpen(points, tension) { + return points.length < 4 + ? d3_svg_lineLinear(points) + : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), + d3_svg_lineCardinalTangents(points, tension)); +} + +// Closed cardinal spline interpolation; generates "C" commands. +function d3_svg_lineCardinalClosed(points, tension) { + return points.length < 3 + ? d3_svg_lineLinear(points) + : points[0] + d3_svg_lineHermite((points.push(points[0]), points), + d3_svg_lineCardinalTangents([points[points.length - 2]] + .concat(points, [points[1]]), tension)); +} + +// Cardinal spline interpolation; generates "C" commands. +function d3_svg_lineCardinal(points, tension, closed) { + return points.length < 3 + ? d3_svg_lineLinear(points) + : points[0] + d3_svg_lineHermite(points, + d3_svg_lineCardinalTangents(points, tension)); +} + +// Hermite spline construction; generates "C" commands. +function d3_svg_lineHermite(points, tangents) { + if (tangents.length < 1 + || (points.length != tangents.length + && points.length != tangents.length + 2)) { + return d3_svg_lineLinear(points); + } + + var quad = points.length != tangents.length, + path = "", + p0 = points[0], + p = points[1], + t0 = tangents[0], + t = t0, + pi = 1; + + if (quad) { + path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + + "," + p[0] + "," + p[1]; + p0 = points[1]; + pi = 2; + } + + if (tangents.length > 1) { + t = tangents[1]; + p = points[pi]; + pi++; + path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + + "," + p[0] + "," + p[1]; + for (var i = 2; i < tangents.length; i++, pi++) { + p = points[pi]; + t = tangents[i]; + path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + + "," + p[0] + "," + p[1]; + } + } + + if (quad) { + var lp = points[pi]; + path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + + "," + lp[0] + "," + lp[1]; + } + + return path; +} + +// Generates tangents for a cardinal spline. +function d3_svg_lineCardinalTangents(points, tension) { + var tangents = [], + a = (1 - tension) / 2, + p0, + p1 = points[0], + p2 = points[1], + i = 1, + n = points.length; + while (++i < n) { + p0 = p1; + p1 = p2; + p2 = points[i]; + tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]); + } + return tangents; +} + +// B-spline interpolation; generates "C" commands. +function d3_svg_lineBasis(points) { + if (points.length < 3) return d3_svg_lineLinear(points); + var i = 1, + n = points.length, + pi = points[0], + x0 = pi[0], + y0 = pi[1], + px = [x0, x0, x0, (pi = points[1])[0]], + py = [y0, y0, y0, pi[1]], + path = [x0, ",", y0]; + d3_svg_lineBasisBezier(path, px, py); + while (++i < n) { + pi = points[i]; + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + i = -1; + while (++i < 2) { + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); +} + +// Open B-spline interpolation; generates "C" commands. +function d3_svg_lineBasisOpen(points) { + if (points.length < 4) return d3_svg_lineLinear(points); + var path = [], + i = -1, + n = points.length, + pi, + px = [0], + py = [0]; + while (++i < 3) { + pi = points[i]; + px.push(pi[0]); + py.push(pi[1]); + } + path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); + --i; while (++i < n) { + pi = points[i]; + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); +} + +// Closed B-spline interpolation; generates "C" commands. +function d3_svg_lineBasisClosed(points) { + var path, + i = -1, + n = points.length, + m = n + 4, + pi, + px = [], + py = []; + while (++i < 4) { + pi = points[i % n]; + px.push(pi[0]); + py.push(pi[1]); + } + path = [ + d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) + ]; + --i; while (++i < m) { + pi = points[i % n]; + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); +} + +function d3_svg_lineBundle(points, tension) { + var n = points.length - 1; + if (n) { + var x0 = points[0][0], + y0 = points[0][1], + dx = points[n][0] - x0, + dy = points[n][1] - y0, + i = -1, + p, + t; + while (++i <= n) { + p = points[i]; + t = i / n; + p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); + p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); + } + } + return d3_svg_lineBasis(points); +} + +// Returns the dot product of the given four-element vectors. +function d3_svg_lineDot4(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; +} + +// Matrix to transform basis (b-spline) control points to bezier +// control points. Derived from FvD 11.2.8. +var d3_svg_lineBasisBezier1 = [0, 2/3, 1/3, 0], + d3_svg_lineBasisBezier2 = [0, 1/3, 2/3, 0], + d3_svg_lineBasisBezier3 = [0, 1/6, 2/3, 1/6]; + +// Pushes a "C" Bézier curve onto the specified path array, given the +// two specified four-element arrays which define the control points. +function d3_svg_lineBasisBezier(path, x, y) { + path.push( + "C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y)); +} + +// Computes the slope from points p0 to p1. +function d3_svg_lineSlope(p0, p1) { + return (p1[1] - p0[1]) / (p1[0] - p0[0]); +} + +// Compute three-point differences for the given points. +// http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Finite_difference +function d3_svg_lineFiniteDifferences(points) { + var i = 0, + j = points.length - 1, + m = [], + p0 = points[0], + p1 = points[1], + d = m[0] = d3_svg_lineSlope(p0, p1); + while (++i < j) { + m[i] = d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1])); + } + m[i] = d; + return m; +} + +// Interpolates the given points using Fritsch-Carlson Monotone cubic Hermite +// interpolation. Returns an array of tangent vectors. For details, see +// http://en.wikipedia.org/wiki/Monotone_cubic_interpolation +function d3_svg_lineMonotoneTangents(points) { + var tangents = [], + d, + a, + b, + s, + m = d3_svg_lineFiniteDifferences(points), + i = -1, + j = points.length - 1; + + // The first two steps are done by computing finite-differences: + // 1. Compute the slopes of the secant lines between successive points. + // 2. Initialize the tangents at every point as the average of the secants. + + // Then, for each segment… + while (++i < j) { + d = d3_svg_lineSlope(points[i], points[i + 1]); + + // 3. If two successive yk = y{k + 1} are equal (i.e., d is zero), then set + // mk = m{k + 1} = 0 as the spline connecting these points must be flat to + // preserve monotonicity. Ignore step 4 and 5 for those k. + + if (Math.abs(d) < 1e-6) { + m[i] = m[i + 1] = 0; + } else { + // 4. Let ak = mk / dk and bk = m{k + 1} / dk. + a = m[i] / d; + b = m[i + 1] / d; + + // 5. Prevent overshoot and ensure monotonicity by restricting the + // magnitude of vector to a circle of radius 3. + s = a * a + b * b; + if (s > 9) { + s = d * 3 / Math.sqrt(s); + m[i] = s * a; + m[i + 1] = s * b; + } + } + } + + // Compute the normalized tangent vector from the slopes. Note that if x is + // not monotonic, it's possible that the slope will be infinite, so we protect + // against NaN by setting the coordinate to zero. + i = -1; while (++i <= j) { + s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i])); + tangents.push([s || 0, m[i] * s || 0]); + } + + return tangents; +} + +function d3_svg_lineMonotone(points) { + return points.length < 3 + ? d3_svg_lineLinear(points) + : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points)); +} +d3.svg.line.radial = function() { + var line = d3_svg_line(d3_svg_lineRadial); + line.radius = line.x, delete line.x; + line.angle = line.y, delete line.y; + return line; +}; + +function d3_svg_lineRadial(points) { + var point, + i = -1, + n = points.length, + r, + a; + while (++i < n) { + point = points[i]; + r = point[0]; + a = point[1] + d3_svg_arcOffset; + point[0] = r * Math.cos(a); + point[1] = r * Math.sin(a); + } + return points; +} +function d3_svg_area(projection) { + var x0 = d3_svg_lineX, + x1 = d3_svg_lineX, + y0 = 0, + y1 = d3_svg_lineY, + defined = d3_true, + interpolate = d3_svg_lineInterpolatorDefault, + i0 = d3_svg_lineLinear, + i1 = d3_svg_lineLinear, + L = "L", + tension = .7; + + function area(data) { + var segments = [], + points0 = [], + points1 = [], + i = -1, + n = data.length, + d, + fx0 = d3_functor(x0), + fy0 = d3_functor(y0), + fx1 = x0 === x1 ? function() { return x; } : d3_functor(x1), + fy1 = y0 === y1 ? function() { return y; } : d3_functor(y1), + x, + y; + + function segment() { + segments.push("M", i0(projection(points1), tension), + L, i1(projection(points0.reverse()), tension), + "Z"); + } + + while (++i < n) { + if (defined.call(this, d = data[i], i)) { + points0.push([x = +fx0.call(this, d, i), y = +fy0.call(this, d, i)]); + points1.push([+fx1.call(this, d, i), +fy1.call(this, d, i)]); + } else if (points0.length) { + segment(); + points0 = []; + points1 = []; + } + } + + if (points0.length) segment(); + + return segments.length ? segments.join("") : null; + } + + area.x = function(_) { + if (!arguments.length) return x1; + x0 = x1 = _; + return area; + }; + + area.x0 = function(_) { + if (!arguments.length) return x0; + x0 = _; + return area; + }; + + area.x1 = function(_) { + if (!arguments.length) return x1; + x1 = _; + return area; + }; + + area.y = function(_) { + if (!arguments.length) return y1; + y0 = y1 = _; + return area; + }; + + area.y0 = function(_) { + if (!arguments.length) return y0; + y0 = _; + return area; + }; + + area.y1 = function(_) { + if (!arguments.length) return y1; + y1 = _; + return area; + }; + + area.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return area; + }; + + area.interpolate = function(_) { + if (!arguments.length) return interpolate; + if (!d3_svg_lineInterpolators.has(_ += "")) _ = d3_svg_lineInterpolatorDefault; + i0 = d3_svg_lineInterpolators.get(interpolate = _); + i1 = i0.reverse || i0; + L = /-closed$/.test(_) ? "M" : "L"; + return area; + }; + + area.tension = function(_) { + if (!arguments.length) return tension; + tension = _; + return area; + }; + + return area; +} + +d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter; +d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore; + +d3.svg.area = function() { + return d3_svg_area(Object); +}; +d3.svg.area.radial = function() { + var area = d3_svg_area(d3_svg_lineRadial); + area.radius = area.x, delete area.x; + area.innerRadius = area.x0, delete area.x0; + area.outerRadius = area.x1, delete area.x1; + area.angle = area.y, delete area.y; + area.startAngle = area.y0, delete area.y0; + area.endAngle = area.y1, delete area.y1; + return area; +}; +d3.svg.chord = function() { + var source = d3_svg_chordSource, + target = d3_svg_chordTarget, + radius = d3_svg_chordRadius, + startAngle = d3_svg_arcStartAngle, + endAngle = d3_svg_arcEndAngle; + + // TODO Allow control point to be customized. + + function chord(d, i) { + var s = subgroup(this, source, d, i), + t = subgroup(this, target, d, i); + return "M" + s.p0 + + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) + ? curve(s.r, s.p1, s.r, s.p0) + : curve(s.r, s.p1, t.r, t.p0) + + arc(t.r, t.p1, t.a1 - t.a0) + + curve(t.r, t.p1, s.r, s.p0)) + + "Z"; + } + + function subgroup(self, f, d, i) { + var subgroup = f.call(self, d, i), + r = radius.call(self, subgroup, i), + a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, + a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset; + return { + r: r, + a0: a0, + a1: a1, + p0: [r * Math.cos(a0), r * Math.sin(a0)], + p1: [r * Math.cos(a1), r * Math.sin(a1)] + }; + } + + function equals(a, b) { + return a.a0 == b.a0 && a.a1 == b.a1; + } + + function arc(r, p, a) { + return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p; + } + + function curve(r0, p0, r1, p1) { + return "Q 0,0 " + p1; + } + + chord.radius = function(v) { + if (!arguments.length) return radius; + radius = d3_functor(v); + return chord; + }; + + chord.source = function(v) { + if (!arguments.length) return source; + source = d3_functor(v); + return chord; + }; + + chord.target = function(v) { + if (!arguments.length) return target; + target = d3_functor(v); + return chord; + }; + + chord.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3_functor(v); + return chord; + }; + + chord.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3_functor(v); + return chord; + }; + + return chord; +}; + +function d3_svg_chordSource(d) { + return d.source; +} + +function d3_svg_chordTarget(d) { + return d.target; +} + +function d3_svg_chordRadius(d) { + return d.radius; +} + +function d3_svg_chordStartAngle(d) { + return d.startAngle; +} + +function d3_svg_chordEndAngle(d) { + return d.endAngle; +} +d3.svg.diagonal = function() { + var source = d3_svg_chordSource, + target = d3_svg_chordTarget, + projection = d3_svg_diagonalProjection; + + function diagonal(d, i) { + var p0 = source.call(this, d, i), + p3 = target.call(this, d, i), + m = (p0.y + p3.y) / 2, + p = [p0, {x: p0.x, y: m}, {x: p3.x, y: m}, p3]; + p = p.map(projection); + return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; + } + + diagonal.source = function(x) { + if (!arguments.length) return source; + source = d3_functor(x); + return diagonal; + }; + + diagonal.target = function(x) { + if (!arguments.length) return target; + target = d3_functor(x); + return diagonal; + }; + + diagonal.projection = function(x) { + if (!arguments.length) return projection; + projection = x; + return diagonal; + }; + + return diagonal; +}; + +function d3_svg_diagonalProjection(d) { + return [d.x, d.y]; +} +d3.svg.diagonal.radial = function() { + var diagonal = d3.svg.diagonal(), + projection = d3_svg_diagonalProjection, + projection_ = diagonal.projection; + + diagonal.projection = function(x) { + return arguments.length + ? projection_(d3_svg_diagonalRadialProjection(projection = x)) + : projection; + }; + + return diagonal; +}; + +function d3_svg_diagonalRadialProjection(projection) { + return function() { + var d = projection.apply(this, arguments), + r = d[0], + a = d[1] + d3_svg_arcOffset; + return [r * Math.cos(a), r * Math.sin(a)]; + }; +} +d3.svg.mouse = d3.mouse; +d3.svg.touches = d3.touches; +d3.svg.symbol = function() { + var type = d3_svg_symbolType, + size = d3_svg_symbolSize; + + function symbol(d, i) { + return (d3_svg_symbols.get(type.call(this, d, i)) + || d3_svg_symbolCircle) + (size.call(this, d, i)); + } + + symbol.type = function(x) { + if (!arguments.length) return type; + type = d3_functor(x); + return symbol; + }; + + // size of symbol in square pixels + symbol.size = function(x) { + if (!arguments.length) return size; + size = d3_functor(x); + return symbol; + }; + + return symbol; +}; + +function d3_svg_symbolSize() { + return 64; +} + +function d3_svg_symbolType() { + return "circle"; +} + +function d3_svg_symbolCircle(size) { + var r = Math.sqrt(size / Math.PI); + return "M0," + r + + "A" + r + "," + r + " 0 1,1 0," + (-r) + + "A" + r + "," + r + " 0 1,1 0," + r + + "Z"; +} + +// TODO cross-diagonal? +var d3_svg_symbols = d3.map({ + "circle": d3_svg_symbolCircle, + "cross": function(size) { + var r = Math.sqrt(size / 5) / 2; + return "M" + -3 * r + "," + -r + + "H" + -r + + "V" + -3 * r + + "H" + r + + "V" + -r + + "H" + 3 * r + + "V" + r + + "H" + r + + "V" + 3 * r + + "H" + -r + + "V" + r + + "H" + -3 * r + + "Z"; + }, + "diamond": function(size) { + var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), + rx = ry * d3_svg_symbolTan30; + return "M0," + -ry + + "L" + rx + ",0" + + " 0," + ry + + " " + -rx + ",0" + + "Z"; + }, + "square": function(size) { + var r = Math.sqrt(size) / 2; + return "M" + -r + "," + -r + + "L" + r + "," + -r + + " " + r + "," + r + + " " + -r + "," + r + + "Z"; + }, + "triangle-down": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), + ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + ry + + "L" + rx +"," + -ry + + " " + -rx + "," + -ry + + "Z"; + }, + "triangle-up": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), + ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + -ry + + "L" + rx +"," + ry + + " " + -rx + "," + ry + + "Z"; + } +}); + +d3.svg.symbolTypes = d3_svg_symbols.keys(); + +var d3_svg_symbolSqrt3 = Math.sqrt(3), + d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180); +d3.svg.axis = function() { + var scale = d3.scale.linear(), + orient = "bottom", + tickMajorSize = 6, + tickMinorSize = 6, + tickEndSize = 6, + tickPadding = 3, + tickArguments_ = [10], + tickValues = null, + tickFormat_, + tickSubdivide = 0; + + function axis(g) { + g.each(function() { + var g = d3.select(this); + + // Ticks, or domain values for ordinal scales. + var ticks = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain()) : tickValues, + tickFormat = tickFormat_ == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String) : tickFormat_; + + // Minor ticks. + var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), + subtick = g.selectAll(".minor").data(subticks, String), + subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6), + subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), + subtickUpdate = d3.transition(subtick).style("opacity", 1); + + // Major ticks. + var tick = g.selectAll("g").data(ticks, String), + tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6), + tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), + tickUpdate = d3.transition(tick).style("opacity", 1), + tickTransform; + + // Domain. + var range = d3_scaleRange(scale), + path = g.selectAll(".domain").data([0]), + pathEnter = path.enter().append("path").attr("class", "domain"), + pathUpdate = d3.transition(path); + + // Stash a snapshot of the new scale, and retrieve the old snapshot. + var scale1 = scale.copy(), + scale0 = this.__chart__ || scale1; + this.__chart__ = scale1; + + tickEnter.append("line").attr("class", "tick"); + tickEnter.append("text"); + tickUpdate.select("text").text(tickFormat); + + switch (orient) { + case "bottom": { + tickTransform = d3_svg_axisX; + subtickEnter.attr("y2", tickMinorSize); + subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize); + tickEnter.select("line").attr("y2", tickMajorSize); + tickEnter.select("text").attr("y", Math.max(tickMajorSize, 0) + tickPadding); + tickUpdate.select("line").attr("x2", 0).attr("y2", tickMajorSize); + tickUpdate.select("text").attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding).attr("dy", ".71em").attr("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize); + break; + } + case "top": { + tickTransform = d3_svg_axisX; + subtickEnter.attr("y2", -tickMinorSize); + subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize); + tickEnter.select("line").attr("y2", -tickMajorSize); + tickEnter.select("text").attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)); + tickUpdate.select("line").attr("x2", 0).attr("y2", -tickMajorSize); + tickUpdate.select("text").attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("dy", "0em").attr("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize); + break; + } + case "left": { + tickTransform = d3_svg_axisY; + subtickEnter.attr("x2", -tickMinorSize); + subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0); + tickEnter.select("line").attr("x2", -tickMajorSize); + tickEnter.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)); + tickUpdate.select("line").attr("x2", -tickMajorSize).attr("y2", 0); + tickUpdate.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "end"); + pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize); + break; + } + case "right": { + tickTransform = d3_svg_axisY; + subtickEnter.attr("x2", tickMinorSize); + subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0); + tickEnter.select("line").attr("x2", tickMajorSize); + tickEnter.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding); + tickUpdate.select("line").attr("x2", tickMajorSize).attr("y2", 0); + tickUpdate.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "start"); + pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize); + break; + } + } + + // For quantitative scales: + // - enter new ticks from the old scale + // - exit old ticks to the new scale + if (scale.ticks) { + tickEnter.call(tickTransform, scale0); + tickUpdate.call(tickTransform, scale1); + tickExit.call(tickTransform, scale1); + subtickEnter.call(tickTransform, scale0); + subtickUpdate.call(tickTransform, scale1); + subtickExit.call(tickTransform, scale1); + } + + // For ordinal scales: + // - any entering ticks are undefined in the old scale + // - any exiting ticks are undefined in the new scale + // Therefore, we only need to transition updating ticks. + else { + var dx = scale1.rangeBand() / 2, x = function(d) { return scale1(d) + dx; }; + tickEnter.call(tickTransform, x); + tickUpdate.call(tickTransform, x); + } + }); + } + + axis.scale = function(x) { + if (!arguments.length) return scale; + scale = x; + return axis; + }; + + axis.orient = function(x) { + if (!arguments.length) return orient; + orient = x; + return axis; + }; + + axis.ticks = function() { + if (!arguments.length) return tickArguments_; + tickArguments_ = arguments; + return axis; + }; + + axis.tickValues = function(x) { + if (!arguments.length) return tickValues; + tickValues = x; + return axis; + }; + + axis.tickFormat = function(x) { + if (!arguments.length) return tickFormat_; + tickFormat_ = x; + return axis; + }; + + axis.tickSize = function(x, y, z) { + if (!arguments.length) return tickMajorSize; + var n = arguments.length - 1; + tickMajorSize = +x; + tickMinorSize = n > 1 ? +y : tickMajorSize; + tickEndSize = n > 0 ? +arguments[n] : tickMajorSize; + return axis; + }; + + axis.tickPadding = function(x) { + if (!arguments.length) return tickPadding; + tickPadding = +x; + return axis; + }; + + axis.tickSubdivide = function(x) { + if (!arguments.length) return tickSubdivide; + tickSubdivide = +x; + return axis; + }; + + return axis; +}; + +function d3_svg_axisX(selection, x) { + selection.attr("transform", function(d) { return "translate(" + x(d) + ",0)"; }); +} + +function d3_svg_axisY(selection, y) { + selection.attr("transform", function(d) { return "translate(0," + y(d) + ")"; }); +} + +function d3_svg_axisSubdivide(scale, ticks, m) { + subticks = []; + if (m && ticks.length > 1) { + var extent = d3_scaleExtent(scale.domain()), + subticks, + i = -1, + n = ticks.length, + d = (ticks[1] - ticks[0]) / ++m, + j, + v; + while (++i < n) { + for (j = m; --j > 0;) { + if ((v = +ticks[i] - j * d) >= extent[0]) { + subticks.push(v); + } + } + } + for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1];) { + subticks.push(v); + } + } + return subticks; +} +d3.svg.brush = function() { + var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), + x = null, // x-scale, optional + y = null, // y-scale, optional + resizes = d3_svg_brushResizes[0], + extent = [[0, 0], [0, 0]], // [x0, y0], [x1, y1], in pixels (integers) + extentDomain; // the extent in data space, lazily created + + function brush(g) { + g.each(function() { + var g = d3.select(this), + bg = g.selectAll(".background").data([0]), + fg = g.selectAll(".extent").data([0]), + tz = g.selectAll(".resize").data(resizes, String), + e; + + // Prepare the brush container for events. + g + .style("pointer-events", "all") + .on("mousedown.brush", brushstart) + .on("touchstart.brush", brushstart); + + // An invisible, mouseable area for starting a new brush. + bg.enter().append("rect") + .attr("class", "background") + .style("visibility", "hidden") + .style("cursor", "crosshair"); + + // The visible brush extent; style this as you like! + fg.enter().append("rect") + .attr("class", "extent") + .style("cursor", "move"); + + // More invisible rects for resizing the extent. + tz.enter().append("g") + .attr("class", function(d) { return "resize " + d; }) + .style("cursor", function(d) { return d3_svg_brushCursor[d]; }) + .append("rect") + .attr("x", function(d) { return /[ew]$/.test(d) ? -3 : null; }) + .attr("y", function(d) { return /^[ns]/.test(d) ? -3 : null; }) + .attr("width", 6) + .attr("height", 6) + .style("visibility", "hidden"); + + // Show or hide the resizers. + tz.style("display", brush.empty() ? "none" : null); + + // Remove any superfluous resizers. + tz.exit().remove(); + + // Initialize the background to fill the defined range. + // If the range isn't defined, you can post-process. + if (x) { + e = d3_scaleRange(x); + bg.attr("x", e[0]).attr("width", e[1] - e[0]); + redrawX(g); + } + if (y) { + e = d3_scaleRange(y); + bg.attr("y", e[0]).attr("height", e[1] - e[0]); + redrawY(g); + } + redraw(g); + }); + } + + function redraw(g) { + g.selectAll(".resize").attr("transform", function(d) { + return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")"; + }); + } + + function redrawX(g) { + g.select(".extent").attr("x", extent[0][0]); + g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]); + } + + function redrawY(g) { + g.select(".extent").attr("y", extent[0][1]); + g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]); + } + + function brushstart() { + var target = this, + eventTarget = d3.select(d3.event.target), + event_ = event.of(target, arguments), + g = d3.select(target), + resizing = eventTarget.datum(), + resizingX = !/^(n|s)$/.test(resizing) && x, + resizingY = !/^(e|w)$/.test(resizing) && y, + dragging = eventTarget.classed("extent"), + center, + origin = mouse(), + offset; + + var w = d3.select(window) + .on("mousemove.brush", brushmove) + .on("mouseup.brush", brushend) + .on("touchmove.brush", brushmove) + .on("touchend.brush", brushend) + .on("keydown.brush", keydown) + .on("keyup.brush", keyup); + + // If the extent was clicked on, drag rather than brush; + // store the point between the mouse and extent origin instead. + if (dragging) { + origin[0] = extent[0][0] - origin[0]; + origin[1] = extent[0][1] - origin[1]; + } + + // If a resizer was clicked on, record which side is to be resized. + // Also, set the origin to the opposite side. + else if (resizing) { + var ex = +/w$/.test(resizing), + ey = +/^n/.test(resizing); + offset = [extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1]]; + origin[0] = extent[ex][0]; + origin[1] = extent[ey][1]; + } + + // If the ALT key is down when starting a brush, the center is at the mouse. + else if (d3.event.altKey) center = origin.slice(); + + // Propagate the active cursor to the body for the drag duration. + g.style("pointer-events", "none").selectAll(".resize").style("display", null); + d3.select("body").style("cursor", eventTarget.style("cursor")); + + // Notify listeners. + event_({type: "brushstart"}); + brushmove(); + d3_eventCancel(); + + function mouse() { + var touches = d3.event.changedTouches; + return touches ? d3.touches(target, touches)[0] : d3.mouse(target); + } + + function keydown() { + if (d3.event.keyCode == 32) { + if (!dragging) { + center = null; + origin[0] -= extent[1][0]; + origin[1] -= extent[1][1]; + dragging = 2; + } + d3_eventCancel(); + } + } + + function keyup() { + if (d3.event.keyCode == 32 && dragging == 2) { + origin[0] += extent[1][0]; + origin[1] += extent[1][1]; + dragging = 0; + d3_eventCancel(); + } + } + + function brushmove() { + var point = mouse(), + moved = false; + + // Preserve the offset for thick resizers. + if (offset) { + point[0] += offset[0]; + point[1] += offset[1]; + } + + if (!dragging) { + + // If needed, determine the center from the current extent. + if (d3.event.altKey) { + if (!center) center = [(extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2]; + + // Update the origin, for when the ALT key is released. + origin[0] = extent[+(point[0] < center[0])][0]; + origin[1] = extent[+(point[1] < center[1])][1]; + } + + // When the ALT key is released, we clear the center. + else center = null; + } + + // Update the brush extent for each dimension. + if (resizingX && move1(point, x, 0)) { + redrawX(g); + moved = true; + } + if (resizingY && move1(point, y, 1)) { + redrawY(g); + moved = true; + } + + // Final redraw and notify listeners. + if (moved) { + redraw(g); + event_({type: "brush", mode: dragging ? "move" : "resize"}); + } + } + + function move1(point, scale, i) { + var range = d3_scaleRange(scale), + r0 = range[0], + r1 = range[1], + position = origin[i], + size = extent[1][i] - extent[0][i], + min, + max; + + // When dragging, reduce the range by the extent size and position. + if (dragging) { + r0 -= position; + r1 -= size + position; + } + + // Clamp the point so that the extent fits within the range extent. + min = Math.max(r0, Math.min(r1, point[i])); + + // Compute the new extent bounds. + if (dragging) { + max = (min += position) + size; + } else { + + // If the ALT key is pressed, then preserve the center of the extent. + if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min)); + + // Compute the min and max of the position and point. + if (position < min) { + max = min; + min = position; + } else { + max = position; + } + } + + // Update the stored bounds. + if (extent[0][i] !== min || extent[1][i] !== max) { + extentDomain = null; + extent[0][i] = min; + extent[1][i] = max; + return true; + } + } + + function brushend() { + brushmove(); + + // reset the cursor styles + g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null); + d3.select("body").style("cursor", null); + + w .on("mousemove.brush", null) + .on("mouseup.brush", null) + .on("touchmove.brush", null) + .on("touchend.brush", null) + .on("keydown.brush", null) + .on("keyup.brush", null); + + event_({type: "brushend"}); + d3_eventCancel(); + } + } + + brush.x = function(z) { + if (!arguments.length) return x; + x = z; + resizes = d3_svg_brushResizes[!x << 1 | !y]; // fore! + return brush; + }; + + brush.y = function(z) { + if (!arguments.length) return y; + y = z; + resizes = d3_svg_brushResizes[!x << 1 | !y]; // fore! + return brush; + }; + + brush.extent = function(z) { + var x0, x1, y0, y1, t; + + // Invert the pixel extent to data-space. + if (!arguments.length) { + z = extentDomain || extent; + if (x) { + x0 = z[0][0], x1 = z[1][0]; + if (!extentDomain) { + x0 = extent[0][0], x1 = extent[1][0]; + if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + } + } + if (y) { + y0 = z[0][1], y1 = z[1][1]; + if (!extentDomain) { + y0 = extent[0][1], y1 = extent[1][1]; + if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + } + } + return x && y ? [[x0, y0], [x1, y1]] : x ? [x0, x1] : y && [y0, y1]; + } + + // Scale the data-space extent to pixels. + extentDomain = [[0, 0], [0, 0]]; + if (x) { + x0 = z[0], x1 = z[1]; + if (y) x0 = x0[0], x1 = x1[0]; + extentDomain[0][0] = x0, extentDomain[1][0] = x1; + if (x.invert) x0 = x(x0), x1 = x(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + extent[0][0] = x0 | 0, extent[1][0] = x1 | 0; + } + if (y) { + y0 = z[0], y1 = z[1]; + if (x) y0 = y0[1], y1 = y1[1]; + extentDomain[0][1] = y0, extentDomain[1][1] = y1; + if (y.invert) y0 = y(y0), y1 = y(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + extent[0][1] = y0 | 0, extent[1][1] = y1 | 0; + } + + return brush; + }; + + brush.clear = function() { + extentDomain = null; + extent[0][0] = + extent[0][1] = + extent[1][0] = + extent[1][1] = 0; + return brush; + }; + + brush.empty = function() { + return (x && extent[0][0] === extent[1][0]) + || (y && extent[0][1] === extent[1][1]); + }; + + return d3.rebind(brush, event, "on"); +}; + +var d3_svg_brushCursor = { + n: "ns-resize", + e: "ew-resize", + s: "ns-resize", + w: "ew-resize", + nw: "nwse-resize", + ne: "nesw-resize", + se: "nwse-resize", + sw: "nesw-resize" +}; + +var d3_svg_brushResizes = [ + ["n", "e", "s", "w", "nw", "ne", "se", "sw"], + ["e", "w"], + ["n", "s"], + [] +]; +d3.behavior = {}; +// TODO Track touch points by identifier. + +d3.behavior.drag = function() { + var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), + origin = null; + + function drag() { + this.on("mousedown.drag", mousedown) + .on("touchstart.drag", mousedown); + } + + function mousedown() { + var target = this, + event_ = event.of(target, arguments), + eventTarget = d3.event.target, + offset, + origin_ = point(), + moved = 0; + + var w = d3.select(window) + .on("mousemove.drag", dragmove) + .on("touchmove.drag", dragmove) + .on("mouseup.drag", dragend, true) + .on("touchend.drag", dragend, true); + + if (origin) { + offset = origin.apply(target, arguments); + offset = [offset.x - origin_[0], offset.y - origin_[1]]; + } else { + offset = [0, 0]; + } + + d3_eventCancel(); + event_({type: "dragstart"}); + + function point() { + var p = target.parentNode, + t = d3.event.changedTouches; + return t ? d3.touches(p, t)[0] : d3.mouse(p); + } + + function dragmove() { + if (!target.parentNode) return dragend(); // target removed from DOM + + var p = point(), + dx = p[0] - origin_[0], + dy = p[1] - origin_[1]; + + moved |= dx | dy; + origin_ = p; + d3_eventCancel(); + + event_({type: "drag", x: p[0] + offset[0], y: p[1] + offset[1], dx: dx, dy: dy}); + } + + function dragend() { + event_({type: "dragend"}); + + // if moved, prevent the mouseup (and possibly click) from propagating + if (moved) { + d3_eventCancel(); + if (d3.event.target === eventTarget) w.on("click.drag", click, true); + } + + w .on("mousemove.drag", null) + .on("touchmove.drag", null) + .on("mouseup.drag", null) + .on("touchend.drag", null); + } + + // prevent the subsequent click from propagating (e.g., for anchors) + function click() { + d3_eventCancel(); + w.on("click.drag", null); + } + } + + drag.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return drag; + }; + + return d3.rebind(drag, event, "on"); +}; +d3.behavior.zoom = function() { + var translate = [0, 0], + translate0, // translate when we started zooming (to avoid drift) + scale = 1, + scale0, // scale when we started touching + scaleExtent = d3_behavior_zoomInfinity, + event = d3_eventDispatch(zoom, "zoom"), + x0, + x1, + y0, + y1, + touchtime; // time of last touchstart (to detect double-tap) + + function zoom() { + this + .on("mousedown.zoom", mousedown) + .on("mousewheel.zoom", mousewheel) + .on("mousemove.zoom", mousemove) + .on("DOMMouseScroll.zoom", mousewheel) + .on("dblclick.zoom", dblclick) + .on("touchstart.zoom", touchstart) + .on("touchmove.zoom", touchmove) + .on("touchend.zoom", touchstart); + } + + zoom.translate = function(x) { + if (!arguments.length) return translate; + translate = x.map(Number); + return zoom; + }; + + zoom.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return zoom; + }; + + zoom.scaleExtent = function(x) { + if (!arguments.length) return scaleExtent; + scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number); + return zoom; + }; + + zoom.x = function(z) { + if (!arguments.length) return x1; + x1 = z; + x0 = z.copy(); + return zoom; + }; + + zoom.y = function(z) { + if (!arguments.length) return y1; + y1 = z; + y0 = z.copy(); + return zoom; + }; + + function location(p) { + return [(p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale]; + } + + function point(l) { + return [l[0] * scale + translate[0], l[1] * scale + translate[1]]; + } + + function scaleTo(s) { + scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s)); + } + + function translateTo(p, l) { + l = point(l); + translate[0] += p[0] - l[0]; + translate[1] += p[1] - l[1]; + } + + function dispatch(event) { + if (x1) x1.domain(x0.range().map(function(x) { return (x - translate[0]) / scale; }).map(x0.invert)); + if (y1) y1.domain(y0.range().map(function(y) { return (y - translate[1]) / scale; }).map(y0.invert)); + d3.event.preventDefault(); + event({type: "zoom", scale: scale, translate: translate}); + } + + function mousedown() { + var target = this, + event_ = event.of(target, arguments), + eventTarget = d3.event.target, + moved = 0, + w = d3.select(window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), + l = location(d3.mouse(target)); + + window.focus(); + d3_eventCancel(); + + function mousemove() { + moved = 1; + translateTo(d3.mouse(target), l); + dispatch(event_); + } + + function mouseup() { + if (moved) d3_eventCancel(); + w.on("mousemove.zoom", null).on("mouseup.zoom", null); + if (moved && d3.event.target === eventTarget) w.on("click.zoom", click, true); + } + + function click() { + d3_eventCancel(); + w.on("click.zoom", null); + } + } + + function mousewheel() { + if (!translate0) translate0 = location(d3.mouse(this)); + scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale); + translateTo(d3.mouse(this), translate0); + dispatch(event.of(this, arguments)); + } + + function mousemove() { + translate0 = null; + } + + function dblclick() { + var p = d3.mouse(this), l = location(p); + scaleTo(d3.event.shiftKey ? scale / 2 : scale * 2); + translateTo(p, l); + dispatch(event.of(this, arguments)); + } + + function touchstart() { + var touches = d3.touches(this), + now = Date.now(); + + scale0 = scale; + translate0 = {}; + touches.forEach(function(t) { translate0[t.identifier] = location(t); }); + d3_eventCancel(); + + if ((touches.length === 1) && (now - touchtime < 500)) { // dbltap + var p = touches[0], l = location(touches[0]); + scaleTo(scale * 2); + translateTo(p, l); + dispatch(event.of(this, arguments)); + } + touchtime = now; + } + + function touchmove() { + var touches = d3.touches(this), + p0 = touches[0], + l0 = translate0[p0.identifier]; + if (p1 = touches[1]) { + var p1, l1 = translate0[p1.identifier]; + p0 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2]; + l0 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2]; + scaleTo(d3.event.scale * scale0); + } + translateTo(p0, l0); + dispatch(event.of(this, arguments)); + } + + return d3.rebind(zoom, event, "on"); +}; + +var d3_behavior_zoomDiv, // for interpreting mousewheel events + d3_behavior_zoomInfinity = [0, Infinity]; // default scale extent + +function d3_behavior_zoomDelta() { + + // mousewheel events are totally broken! + // https://bugs.webkit.org/show_bug.cgi?id=40441 + // not only that, but Chrome and Safari differ in re. to acceleration! + if (!d3_behavior_zoomDiv) { + d3_behavior_zoomDiv = d3.select("body").append("div") + .style("visibility", "hidden") + .style("top", 0) + .style("height", 0) + .style("width", 0) + .style("overflow-y", "scroll") + .append("div") + .style("height", "2000px") + .node().parentNode; + } + + var e = d3.event, delta; + try { + d3_behavior_zoomDiv.scrollTop = 1000; + d3_behavior_zoomDiv.dispatchEvent(e); + delta = 1000 - d3_behavior_zoomDiv.scrollTop; + } catch (error) { + delta = e.wheelDelta || (-e.detail * 5); + } + + return delta; +} +d3.layout = {}; +// Implements hierarchical edge bundling using Holten's algorithm. For each +// input link, a path is computed that travels through the tree, up the parent +// hierarchy to the least common ancestor, and then back down to the destination +// node. Each path is simply an array of nodes. +d3.layout.bundle = function() { + return function(links) { + var paths = [], + i = -1, + n = links.length; + while (++i < n) paths.push(d3_layout_bundlePath(links[i])); + return paths; + }; +}; + +function d3_layout_bundlePath(link) { + var start = link.source, + end = link.target, + lca = d3_layout_bundleLeastCommonAncestor(start, end), + points = [start]; + while (start !== lca) { + start = start.parent; + points.push(start); + } + var k = points.length; + while (end !== lca) { + points.splice(k, 0, end); + end = end.parent; + } + return points; +} + +function d3_layout_bundleAncestors(node) { + var ancestors = [], + parent = node.parent; + while (parent != null) { + ancestors.push(node); + node = parent; + parent = parent.parent; + } + ancestors.push(node); + return ancestors; +} + +function d3_layout_bundleLeastCommonAncestor(a, b) { + if (a === b) return a; + var aNodes = d3_layout_bundleAncestors(a), + bNodes = d3_layout_bundleAncestors(b), + aNode = aNodes.pop(), + bNode = bNodes.pop(), + sharedNode = null; + while (aNode === bNode) { + sharedNode = aNode; + aNode = aNodes.pop(); + bNode = bNodes.pop(); + } + return sharedNode; +} +d3.layout.chord = function() { + var chord = {}, + chords, + groups, + matrix, + n, + padding = 0, + sortGroups, + sortSubgroups, + sortChords; + + function relayout() { + var subgroups = {}, + groupSums = [], + groupIndex = d3.range(n), + subgroupIndex = [], + k, + x, + x0, + i, + j; + + chords = []; + groups = []; + + // Compute the sum. + k = 0, i = -1; while (++i < n) { + x = 0, j = -1; while (++j < n) { + x += matrix[i][j]; + } + groupSums.push(x); + subgroupIndex.push(d3.range(n)); + k += x; + } + + // Sort groups… + if (sortGroups) { + groupIndex.sort(function(a, b) { + return sortGroups(groupSums[a], groupSums[b]); + }); + } + + // Sort subgroups… + if (sortSubgroups) { + subgroupIndex.forEach(function(d, i) { + d.sort(function(a, b) { + return sortSubgroups(matrix[i][a], matrix[i][b]); + }); + }); + } + + // Convert the sum to scaling factor for [0, 2pi]. + // TODO Allow start and end angle to be specified. + // TODO Allow padding to be specified as percentage? + k = (2 * Math.PI - padding * n) / k; + + // Compute the start and end angle for each group and subgroup. + // Note: Opera has a bug reordering object literal properties! + x = 0, i = -1; while (++i < n) { + x0 = x, j = -1; while (++j < n) { + var di = groupIndex[i], + dj = subgroupIndex[di][j], + v = matrix[di][dj], + a0 = x, + a1 = x += v * k; + subgroups[di + "-" + dj] = { + index: di, + subindex: dj, + startAngle: a0, + endAngle: a1, + value: v + }; + } + groups[di] = { + index: di, + startAngle: x0, + endAngle: x, + value: (x - x0) / k + }; + x += padding; + } + + // Generate chords for each (non-empty) subgroup-subgroup link. + i = -1; while (++i < n) { + j = i - 1; while (++j < n) { + var source = subgroups[i + "-" + j], + target = subgroups[j + "-" + i]; + if (source.value || target.value) { + chords.push(source.value < target.value + ? {source: target, target: source} + : {source: source, target: target}); + } + } + } + + if (sortChords) resort(); + } + + function resort() { + chords.sort(function(a, b) { + return sortChords( + (a.source.value + a.target.value) / 2, + (b.source.value + b.target.value) / 2); + }); + } + + chord.matrix = function(x) { + if (!arguments.length) return matrix; + n = (matrix = x) && matrix.length; + chords = groups = null; + return chord; + }; + + chord.padding = function(x) { + if (!arguments.length) return padding; + padding = x; + chords = groups = null; + return chord; + }; + + chord.sortGroups = function(x) { + if (!arguments.length) return sortGroups; + sortGroups = x; + chords = groups = null; + return chord; + }; + + chord.sortSubgroups = function(x) { + if (!arguments.length) return sortSubgroups; + sortSubgroups = x; + chords = null; + return chord; + }; + + chord.sortChords = function(x) { + if (!arguments.length) return sortChords; + sortChords = x; + if (chords) resort(); + return chord; + }; + + chord.chords = function() { + if (!chords) relayout(); + return chords; + }; + + chord.groups = function() { + if (!groups) relayout(); + return groups; + }; + + return chord; +}; +// A rudimentary force layout using Gauss-Seidel. +d3.layout.force = function() { + var force = {}, + event = d3.dispatch("start", "tick", "end"), + size = [1, 1], + drag, + alpha, + friction = .9, + linkDistance = d3_layout_forceLinkDistance, + linkStrength = d3_layout_forceLinkStrength, + charge = -30, + gravity = .1, + theta = .8, + interval, + nodes = [], + links = [], + distances, + strengths, + charges; + + function repulse(node) { + return function(quad, x1, y1, x2, y2) { + if (quad.point !== node) { + var dx = quad.cx - node.x, + dy = quad.cy - node.y, + dn = 1 / Math.sqrt(dx * dx + dy * dy); + + /* Barnes-Hut criterion. */ + if ((x2 - x1) * dn < theta) { + var k = quad.charge * dn * dn; + node.px -= dx * k; + node.py -= dy * k; + return true; + } + + if (quad.point && isFinite(dn)) { + var k = quad.pointCharge * dn * dn; + node.px -= dx * k; + node.py -= dy * k; + } + } + return !quad.charge; + }; + } + + force.tick = function() { + // simulated annealing, basically + if ((alpha *= .99) < .005) { + event.end({type: "end", alpha: alpha = 0}); + return true; + } + + var n = nodes.length, + m = links.length, + q, + i, // current index + o, // current object + s, // current source + t, // current target + l, // current distance + k, // current force + x, // x-distance + y; // y-distance + + // gauss-seidel relaxation for links + for (i = 0; i < m; ++i) { + o = links[i]; + s = o.source; + t = o.target; + x = t.x - s.x; + y = t.y - s.y; + if (l = (x * x + y * y)) { + l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l; + x *= l; + y *= l; + t.x -= x * (k = s.weight / (t.weight + s.weight)); + t.y -= y * k; + s.x += x * (k = 1 - k); + s.y += y * k; + } + } + + // apply gravity forces + if (k = alpha * gravity) { + x = size[0] / 2; + y = size[1] / 2; + i = -1; if (k) while (++i < n) { + o = nodes[i]; + o.x += (x - o.x) * k; + o.y += (y - o.y) * k; + } + } + + // compute quadtree center of mass and apply charge forces + if (charge) { + d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges); + i = -1; while (++i < n) { + if (!(o = nodes[i]).fixed) { + q.visit(repulse(o)); + } + } + } + + // position verlet integration + i = -1; while (++i < n) { + o = nodes[i]; + if (o.fixed) { + o.x = o.px; + o.y = o.py; + } else { + o.x -= (o.px - (o.px = o.x)) * friction; + o.y -= (o.py - (o.py = o.y)) * friction; + } + } + + event.tick({type: "tick", alpha: alpha}); + }; + + force.nodes = function(x) { + if (!arguments.length) return nodes; + nodes = x; + return force; + }; + + force.links = function(x) { + if (!arguments.length) return links; + links = x; + return force; + }; + + force.size = function(x) { + if (!arguments.length) return size; + size = x; + return force; + }; + + force.linkDistance = function(x) { + if (!arguments.length) return linkDistance; + linkDistance = d3_functor(x); + return force; + }; + + // For backwards-compatibility. + force.distance = force.linkDistance; + + force.linkStrength = function(x) { + if (!arguments.length) return linkStrength; + linkStrength = d3_functor(x); + return force; + }; + + force.friction = function(x) { + if (!arguments.length) return friction; + friction = x; + return force; + }; + + force.charge = function(x) { + if (!arguments.length) return charge; + charge = typeof x === "function" ? x : +x; + return force; + }; + + force.gravity = function(x) { + if (!arguments.length) return gravity; + gravity = x; + return force; + }; + + force.theta = function(x) { + if (!arguments.length) return theta; + theta = x; + return force; + }; + + force.alpha = function(x) { + if (!arguments.length) return alpha; + + if (alpha) { // if we're already running + if (x > 0) alpha = x; // we might keep it hot + else alpha = 0; // or, next tick will dispatch "end" + } else if (x > 0) { // otherwise, fire it up! + event.start({type: "start", alpha: alpha = x}); + d3.timer(force.tick); + } + + return force; + }; + + force.start = function() { + var i, + j, + n = nodes.length, + m = links.length, + w = size[0], + h = size[1], + neighbors, + o; + + for (i = 0; i < n; ++i) { + (o = nodes[i]).index = i; + o.weight = 0; + } + + distances = []; + strengths = []; + for (i = 0; i < m; ++i) { + o = links[i]; + if (typeof o.source == "number") o.source = nodes[o.source]; + if (typeof o.target == "number") o.target = nodes[o.target]; + distances[i] = linkDistance.call(this, o, i); + strengths[i] = linkStrength.call(this, o, i); + ++o.source.weight; + ++o.target.weight; + } + + for (i = 0; i < n; ++i) { + o = nodes[i]; + if (isNaN(o.x)) o.x = position("x", w); + if (isNaN(o.y)) o.y = position("y", h); + if (isNaN(o.px)) o.px = o.x; + if (isNaN(o.py)) o.py = o.y; + } + + charges = []; + if (typeof charge === "function") { + for (i = 0; i < n; ++i) { + charges[i] = +charge.call(this, nodes[i], i); + } + } else { + for (i = 0; i < n; ++i) { + charges[i] = charge; + } + } + + // initialize node position based on first neighbor + function position(dimension, size) { + var neighbors = neighbor(i), + j = -1, + m = neighbors.length, + x; + while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x; + return Math.random() * size; + } + + // initialize neighbors lazily + function neighbor() { + if (!neighbors) { + neighbors = []; + for (j = 0; j < n; ++j) { + neighbors[j] = []; + } + for (j = 0; j < m; ++j) { + var o = links[j]; + neighbors[o.source.index].push(o.target); + neighbors[o.target.index].push(o.source); + } + } + return neighbors[i]; + } + + return force.resume(); + }; + + force.resume = function() { + return force.alpha(.1); + }; + + force.stop = function() { + return force.alpha(0); + }; + + // use `node.call(force.drag)` to make nodes draggable + force.drag = function() { + if (!drag) drag = d3.behavior.drag() + .origin(d3_identity) + .on("dragstart", dragstart) + .on("drag", d3_layout_forceDrag) + .on("dragend", d3_layout_forceDragEnd); + + this.on("mouseover.force", d3_layout_forceDragOver) + .on("mouseout.force", d3_layout_forceDragOut) + .call(drag); + }; + + function dragstart(d) { + d3_layout_forceDragOver(d3_layout_forceDragNode = d); + d3_layout_forceDragForce = force; + } + + return d3.rebind(force, event, "on"); +}; + +var d3_layout_forceDragForce, + d3_layout_forceDragNode; + +function d3_layout_forceDragOver(d) { + d.fixed |= 2; +} + +function d3_layout_forceDragOut(d) { + if (d !== d3_layout_forceDragNode) d.fixed &= 1; +} + +function d3_layout_forceDragEnd() { + d3_layout_forceDragNode.fixed &= 1; + d3_layout_forceDragForce = d3_layout_forceDragNode = null; +} + +function d3_layout_forceDrag() { + d3_layout_forceDragNode.px = d3.event.x; + d3_layout_forceDragNode.py = d3.event.y; + d3_layout_forceDragForce.resume(); // restart annealing +} + +function d3_layout_forceAccumulate(quad, alpha, charges) { + var cx = 0, + cy = 0; + quad.charge = 0; + if (!quad.leaf) { + var nodes = quad.nodes, + n = nodes.length, + i = -1, + c; + while (++i < n) { + c = nodes[i]; + if (c == null) continue; + d3_layout_forceAccumulate(c, alpha, charges); + quad.charge += c.charge; + cx += c.charge * c.cx; + cy += c.charge * c.cy; + } + } + if (quad.point) { + // jitter internal nodes that are coincident + if (!quad.leaf) { + quad.point.x += Math.random() - .5; + quad.point.y += Math.random() - .5; + } + var k = alpha * charges[quad.point.index]; + quad.charge += quad.pointCharge = k; + cx += k * quad.point.x; + cy += k * quad.point.y; + } + quad.cx = cx / quad.charge; + quad.cy = cy / quad.charge; +} + +function d3_layout_forceLinkDistance(link) { + return 20; +} + +function d3_layout_forceLinkStrength(link) { + return 1; +} +d3.layout.partition = function() { + var hierarchy = d3.layout.hierarchy(), + size = [1, 1]; // width, height + + function position(node, x, dx, dy) { + var children = node.children; + node.x = x; + node.y = node.depth * dy; + node.dx = dx; + node.dy = dy; + if (children && (n = children.length)) { + var i = -1, + n, + c, + d; + dx = node.value ? dx / node.value : 0; + while (++i < n) { + position(c = children[i], x, d = c.value * dx, dy); + x += d; + } + } + } + + function depth(node) { + var children = node.children, + d = 0; + if (children && (n = children.length)) { + var i = -1, + n; + while (++i < n) d = Math.max(d, depth(children[i])); + } + return 1 + d; + } + + function partition(d, i) { + var nodes = hierarchy.call(this, d, i); + position(nodes[0], 0, size[0], size[1] / depth(nodes[0])); + return nodes; + } + + partition.size = function(x) { + if (!arguments.length) return size; + size = x; + return partition; + }; + + return d3_layout_hierarchyRebind(partition, hierarchy); +}; +d3.layout.pie = function() { + var value = Number, + sort = d3_layout_pieSortByValue, + startAngle = 0, + endAngle = 2 * Math.PI; + + function pie(data, i) { + + // Compute the numeric values for each data element. + var values = data.map(function(d, i) { return +value.call(pie, d, i); }); + + // Compute the start angle. + var a = +(typeof startAngle === "function" + ? startAngle.apply(this, arguments) + : startAngle); + + // Compute the angular scale factor: from value to radians. + var k = ((typeof endAngle === "function" + ? endAngle.apply(this, arguments) + : endAngle) - startAngle) + / d3.sum(values); + + // Optionally sort the data. + var index = d3.range(data.length); + if (sort != null) index.sort(sort === d3_layout_pieSortByValue + ? function(i, j) { return values[j] - values[i]; } + : function(i, j) { return sort(data[i], data[j]); }); + + // Compute the arcs! + // They are stored in the original data's order. + var arcs = []; + index.forEach(function(i) { + var d; + arcs[i] = { + data: data[i], + value: d = values[i], + startAngle: a, + endAngle: a += d * k + }; + }); + return arcs; + } + + /** + * Specifies the value function *x*, which returns a nonnegative numeric value + * for each datum. The default value function is `Number`. The value function + * is passed two arguments: the current datum and the current index. + */ + pie.value = function(x) { + if (!arguments.length) return value; + value = x; + return pie; + }; + + /** + * Specifies a sort comparison operator *x*. The comparator is passed two data + * elements from the data array, a and b; it returns a negative value if a is + * less than b, a positive value if a is greater than b, and zero if a equals + * b. + */ + pie.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return pie; + }; + + /** + * Specifies the overall start angle of the pie chart. Defaults to 0. The + * start angle can be specified either as a constant or as a function; in the + * case of a function, it is evaluated once per array (as opposed to per + * element). + */ + pie.startAngle = function(x) { + if (!arguments.length) return startAngle; + startAngle = x; + return pie; + }; + + /** + * Specifies the overall end angle of the pie chart. Defaults to 2π. The + * end angle can be specified either as a constant or as a function; in the + * case of a function, it is evaluated once per array (as opposed to per + * element). + */ + pie.endAngle = function(x) { + if (!arguments.length) return endAngle; + endAngle = x; + return pie; + }; + + return pie; +}; + +var d3_layout_pieSortByValue = {}; +// data is two-dimensional array of x,y; we populate y0 +d3.layout.stack = function() { + var values = d3_identity, + order = d3_layout_stackOrderDefault, + offset = d3_layout_stackOffsetZero, + out = d3_layout_stackOut, + x = d3_layout_stackX, + y = d3_layout_stackY; + + function stack(data, index) { + + // Convert series to canonical two-dimensional representation. + var series = data.map(function(d, i) { + return values.call(stack, d, i); + }); + + // Convert each series to canonical [[x,y]] representation. + var points = series.map(function(d, i) { + return d.map(function(v, i) { + return [x.call(stack, v, i), y.call(stack, v, i)]; + }); + }); + + // Compute the order of series, and permute them. + var orders = order.call(stack, points, index); + series = d3.permute(series, orders); + points = d3.permute(points, orders); + + // Compute the baseline… + var offsets = offset.call(stack, points, index); + + // And propagate it to other series. + var n = series.length, + m = series[0].length, + i, + j, + o; + for (j = 0; j < m; ++j) { + out.call(stack, series[0][j], o = offsets[j], points[0][j][1]); + for (i = 1; i < n; ++i) { + out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]); + } + } + + return data; + } + + stack.values = function(x) { + if (!arguments.length) return values; + values = x; + return stack; + }; + + stack.order = function(x) { + if (!arguments.length) return order; + order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault; + return stack; + }; + + stack.offset = function(x) { + if (!arguments.length) return offset; + offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero; + return stack; + }; + + stack.x = function(z) { + if (!arguments.length) return x; + x = z; + return stack; + }; + + stack.y = function(z) { + if (!arguments.length) return y; + y = z; + return stack; + }; + + stack.out = function(z) { + if (!arguments.length) return out; + out = z; + return stack; + }; + + return stack; +} + +function d3_layout_stackX(d) { + return d.x; +} + +function d3_layout_stackY(d) { + return d.y; +} + +function d3_layout_stackOut(d, y0, y) { + d.y0 = y0; + d.y = y; +} + +var d3_layout_stackOrders = d3.map({ + + "inside-out": function(data) { + var n = data.length, + i, + j, + max = data.map(d3_layout_stackMaxIndex), + sums = data.map(d3_layout_stackReduceSum), + index = d3.range(n).sort(function(a, b) { return max[a] - max[b]; }), + top = 0, + bottom = 0, + tops = [], + bottoms = []; + for (i = 0; i < n; ++i) { + j = index[i]; + if (top < bottom) { + top += sums[j]; + tops.push(j); + } else { + bottom += sums[j]; + bottoms.push(j); + } + } + return bottoms.reverse().concat(tops); + }, + + "reverse": function(data) { + return d3.range(data.length).reverse(); + }, + + "default": d3_layout_stackOrderDefault + +}); + +var d3_layout_stackOffsets = d3.map({ + + "silhouette": function(data) { + var n = data.length, + m = data[0].length, + sums = [], + max = 0, + i, + j, + o, + y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o > max) max = o; + sums.push(o); + } + for (j = 0; j < m; ++j) { + y0[j] = (max - sums[j]) / 2; + } + return y0; + }, + + "wiggle": function(data) { + var n = data.length, + x = data[0], + m = x.length, + max = 0, + i, + j, + k, + s1, + s2, + s3, + dx, + o, + o0, + y0 = []; + y0[0] = o = o0 = 0; + for (j = 1; j < m; ++j) { + for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1]; + for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) { + for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) { + s3 += (data[k][j][1] - data[k][j - 1][1]) / dx; + } + s2 += s3 * data[i][j][1]; + } + y0[j] = o -= s1 ? s2 / s1 * dx : 0; + if (o < o0) o0 = o; + } + for (j = 0; j < m; ++j) y0[j] -= o0; + return y0; + }, + + "expand": function(data) { + var n = data.length, + m = data[0].length, + k = 1 / n, + i, + j, + o, + y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; + else for (i = 0; i < n; i++) data[i][j][1] = k; + } + for (j = 0; j < m; ++j) y0[j] = 0; + return y0; + }, + + "zero": d3_layout_stackOffsetZero + +}); + +function d3_layout_stackOrderDefault(data) { + return d3.range(data.length); +} + +function d3_layout_stackOffsetZero(data) { + var j = -1, + m = data[0].length, + y0 = []; + while (++j < m) y0[j] = 0; + return y0; +} + +function d3_layout_stackMaxIndex(array) { + var i = 1, + j = 0, + v = array[0][1], + k, + n = array.length; + for (; i < n; ++i) { + if ((k = array[i][1]) > v) { + j = i; + v = k; + } + } + return j; +} + +function d3_layout_stackReduceSum(d) { + return d.reduce(d3_layout_stackSum, 0); +} + +function d3_layout_stackSum(p, d) { + return p + d[1]; +} +d3.layout.histogram = function() { + var frequency = true, + valuer = Number, + ranger = d3_layout_histogramRange, + binner = d3_layout_histogramBinSturges; + + function histogram(data, i) { + var bins = [], + values = data.map(valuer, this), + range = ranger.call(this, values, i), + thresholds = binner.call(this, range, values, i), + bin, + i = -1, + n = values.length, + m = thresholds.length - 1, + k = frequency ? 1 : 1 / n, + x; + + // Initialize the bins. + while (++i < m) { + bin = bins[i] = []; + bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]); + bin.y = 0; + } + + // Fill the bins, ignoring values outside the range. + if (m > 0) { + i = -1; while(++i < n) { + x = values[i]; + if ((x >= range[0]) && (x <= range[1])) { + bin = bins[d3.bisect(thresholds, x, 1, m) - 1]; + bin.y += k; + bin.push(data[i]); + } + } + } + + return bins; + } + + // Specifies how to extract a value from the associated data. The default + // value function is `Number`, which is equivalent to the identity function. + histogram.value = function(x) { + if (!arguments.length) return valuer; + valuer = x; + return histogram; + }; + + // Specifies the range of the histogram. Values outside the specified range + // will be ignored. The argument `x` may be specified either as a two-element + // array representing the minimum and maximum value of the range, or as a + // function that returns the range given the array of values and the current + // index `i`. The default range is the extent (minimum and maximum) of the + // values. + histogram.range = function(x) { + if (!arguments.length) return ranger; + ranger = d3_functor(x); + return histogram; + }; + + // Specifies how to bin values in the histogram. The argument `x` may be + // specified as a number, in which case the range of values will be split + // uniformly into the given number of bins. Or, `x` may be an array of + // threshold values, defining the bins; the specified array must contain the + // rightmost (upper) value, thus specifying n + 1 values for n bins. Or, `x` + // may be a function which is evaluated, being passed the range, the array of + // values, and the current index `i`, returning an array of thresholds. The + // default bin function will divide the values into uniform bins using + // Sturges' formula. + histogram.bins = function(x) { + if (!arguments.length) return binner; + binner = typeof x === "number" + ? function(range) { return d3_layout_histogramBinFixed(range, x); } + : d3_functor(x); + return histogram; + }; + + // Specifies whether the histogram's `y` value is a count (frequency) or a + // probability (density). The default value is true. + histogram.frequency = function(x) { + if (!arguments.length) return frequency; + frequency = !!x; + return histogram; + }; + + return histogram; +}; + +function d3_layout_histogramBinSturges(range, values) { + return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1)); +} + +function d3_layout_histogramBinFixed(range, n) { + var x = -1, + b = +range[0], + m = (range[1] - b) / n, + f = []; + while (++x <= n) f[x] = m * x + b; + return f; +} + +function d3_layout_histogramRange(values) { + return [d3.min(values), d3.max(values)]; +} +d3.layout.hierarchy = function() { + var sort = d3_layout_hierarchySort, + children = d3_layout_hierarchyChildren, + value = d3_layout_hierarchyValue; + + // Recursively compute the node depth and value. + // Also converts the data representation into a standard hierarchy structure. + function recurse(data, depth, nodes) { + var childs = children.call(hierarchy, data, depth), + node = d3_layout_hierarchyInline ? data : {data: data}; + node.depth = depth; + nodes.push(node); + if (childs && (n = childs.length)) { + var i = -1, + n, + c = node.children = [], + v = 0, + j = depth + 1, + d; + while (++i < n) { + d = recurse(childs[i], j, nodes); + d.parent = node; + c.push(d); + v += d.value; + } + if (sort) c.sort(sort); + if (value) node.value = v; + } else if (value) { + node.value = +value.call(hierarchy, data, depth) || 0; + } + return node; + } + + // Recursively re-evaluates the node value. + function revalue(node, depth) { + var children = node.children, + v = 0; + if (children && (n = children.length)) { + var i = -1, + n, + j = depth + 1; + while (++i < n) v += revalue(children[i], j); + } else if (value) { + v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0; + } + if (value) node.value = v; + return v; + } + + function hierarchy(d) { + var nodes = []; + recurse(d, 0, nodes); + return nodes; + } + + hierarchy.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return hierarchy; + }; + + hierarchy.children = function(x) { + if (!arguments.length) return children; + children = x; + return hierarchy; + }; + + hierarchy.value = function(x) { + if (!arguments.length) return value; + value = x; + return hierarchy; + }; + + // Re-evaluates the `value` property for the specified hierarchy. + hierarchy.revalue = function(root) { + revalue(root, 0); + return root; + }; + + return hierarchy; +}; + +// A method assignment helper for hierarchy subclasses. +function d3_layout_hierarchyRebind(object, hierarchy) { + d3.rebind(object, hierarchy, "sort", "children", "value"); + + // Add an alias for links, for convenience. + object.links = d3_layout_hierarchyLinks; + + // If the new API is used, enabling inlining. + object.nodes = function(d) { + d3_layout_hierarchyInline = true; + return (object.nodes = object)(d); + }; + + return object; +} + +function d3_layout_hierarchyChildren(d) { + return d.children; +} + +function d3_layout_hierarchyValue(d) { + return d.value; +} + +function d3_layout_hierarchySort(a, b) { + return b.value - a.value; +} + +// Returns an array source+target objects for the specified nodes. +function d3_layout_hierarchyLinks(nodes) { + return d3.merge(nodes.map(function(parent) { + return (parent.children || []).map(function(child) { + return {source: parent, target: child}; + }); + })); +} + +// For backwards-compatibility, don't enable inlining by default. +var d3_layout_hierarchyInline = false; +d3.layout.pack = function() { + var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), + size = [1, 1]; + + function pack(d, i) { + var nodes = hierarchy.call(this, d, i), + root = nodes[0]; + + // Recursively compute the layout. + root.x = 0; + root.y = 0; + d3_layout_packTree(root); + + // Scale the layout to fit the requested size. + var w = size[0], + h = size[1], + k = 1 / Math.max(2 * root.r / w, 2 * root.r / h); + d3_layout_packTransform(root, w / 2, h / 2, k); + + return nodes; + } + + pack.size = function(x) { + if (!arguments.length) return size; + size = x; + return pack; + }; + + return d3_layout_hierarchyRebind(pack, hierarchy); +}; + +function d3_layout_packSort(a, b) { + return a.value - b.value; +} + +function d3_layout_packInsert(a, b) { + var c = a._pack_next; + a._pack_next = b; + b._pack_prev = a; + b._pack_next = c; + c._pack_prev = b; +} + +function d3_layout_packSplice(a, b) { + a._pack_next = b; + b._pack_prev = a; +} + +function d3_layout_packIntersects(a, b) { + var dx = b.x - a.x, + dy = b.y - a.y, + dr = a.r + b.r; + return dr * dr - dx * dx - dy * dy > .001; // within epsilon +} + +function d3_layout_packCircle(nodes) { + var xMin = Infinity, + xMax = -Infinity, + yMin = Infinity, + yMax = -Infinity, + n = nodes.length, + a, b, c, j, k; + + function bound(node) { + xMin = Math.min(node.x - node.r, xMin); + xMax = Math.max(node.x + node.r, xMax); + yMin = Math.min(node.y - node.r, yMin); + yMax = Math.max(node.y + node.r, yMax); + } + + // Create node links. + nodes.forEach(d3_layout_packLink); + + // Create first node. + a = nodes[0]; + a.x = -a.r; + a.y = 0; + bound(a); + + // Create second node. + if (n > 1) { + b = nodes[1]; + b.x = b.r; + b.y = 0; + bound(b); + + // Create third node and build chain. + if (n > 2) { + c = nodes[2]; + d3_layout_packPlace(a, b, c); + bound(c); + d3_layout_packInsert(a, c); + a._pack_prev = c; + d3_layout_packInsert(c, b); + b = a._pack_next; + + // Now iterate through the rest. + for (var i = 3; i < n; i++) { + d3_layout_packPlace(a, b, c = nodes[i]); + + // Search for the closest intersection. + var isect = 0, s1 = 1, s2 = 1; + for (j = b._pack_next; j !== b; j = j._pack_next, s1++) { + if (d3_layout_packIntersects(j, c)) { + isect = 1; + break; + } + } + if (isect == 1) { + for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) { + if (d3_layout_packIntersects(k, c)) { + break; + } + } + } + + // Update node chain. + if (isect) { + if (s1 < s2 || (s1 == s2 && b.r < a.r)) d3_layout_packSplice(a, b = j); + else d3_layout_packSplice(a = k, b); + i--; + } else { + d3_layout_packInsert(a, c); + b = c; + bound(c); + } + } + } + } + + // Re-center the circles and return the encompassing radius. + var cx = (xMin + xMax) / 2, + cy = (yMin + yMax) / 2, + cr = 0; + for (var i = 0; i < n; i++) { + var node = nodes[i]; + node.x -= cx; + node.y -= cy; + cr = Math.max(cr, node.r + Math.sqrt(node.x * node.x + node.y * node.y)); + } + + // Remove node links. + nodes.forEach(d3_layout_packUnlink); + + return cr; +} + +function d3_layout_packLink(node) { + node._pack_next = node._pack_prev = node; +} + +function d3_layout_packUnlink(node) { + delete node._pack_next; + delete node._pack_prev; +} + +function d3_layout_packTree(node) { + var children = node.children; + if (children && children.length) { + children.forEach(d3_layout_packTree); + node.r = d3_layout_packCircle(children); + } else { + node.r = Math.sqrt(node.value); + } +} + +function d3_layout_packTransform(node, x, y, k) { + var children = node.children; + node.x = (x += k * node.x); + node.y = (y += k * node.y); + node.r *= k; + if (children) { + var i = -1, n = children.length; + while (++i < n) d3_layout_packTransform(children[i], x, y, k); + } +} + +function d3_layout_packPlace(a, b, c) { + var db = a.r + c.r, + dx = b.x - a.x, + dy = b.y - a.y; + if (db && (dx || dy)) { + var da = b.r + c.r, + dc = Math.sqrt(dx * dx + dy * dy), + cos = Math.max(-1, Math.min(1, (db * db + dc * dc - da * da) / (2 * db * dc))), + theta = Math.acos(cos), + x = cos * (db /= dc), + y = Math.sin(theta) * db; + c.x = a.x + x * dx + y * dy; + c.y = a.y + x * dy - y * dx; + } else { + c.x = a.x + db; + c.y = a.y; + } +} +// Implements a hierarchical layout using the cluster (or dendrogram) +// algorithm. +d3.layout.cluster = function() { + var hierarchy = d3.layout.hierarchy().sort(null).value(null), + separation = d3_layout_treeSeparation, + size = [1, 1]; // width, height + + function cluster(d, i) { + var nodes = hierarchy.call(this, d, i), + root = nodes[0], + previousNode, + x = 0, + kx, + ky; + + // First walk, computing the initial x & y values. + d3_layout_treeVisitAfter(root, function(node) { + var children = node.children; + if (children && children.length) { + node.x = d3_layout_clusterX(children); + node.y = d3_layout_clusterY(children); + } else { + node.x = previousNode ? x += separation(node, previousNode) : 0; + node.y = 0; + previousNode = node; + } + }); + + // Compute the left-most, right-most, and depth-most nodes for extents. + var left = d3_layout_clusterLeft(root), + right = d3_layout_clusterRight(root), + x0 = left.x - separation(left, right) / 2, + x1 = right.x + separation(right, left) / 2; + + // Second walk, normalizing x & y to the desired size. + d3_layout_treeVisitAfter(root, function(node) { + node.x = (node.x - x0) / (x1 - x0) * size[0]; + node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1]; + }); + + return nodes; + } + + cluster.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return cluster; + }; + + cluster.size = function(x) { + if (!arguments.length) return size; + size = x; + return cluster; + }; + + return d3_layout_hierarchyRebind(cluster, hierarchy); +}; + +function d3_layout_clusterY(children) { + return 1 + d3.max(children, function(child) { + return child.y; + }); +} + +function d3_layout_clusterX(children) { + return children.reduce(function(x, child) { + return x + child.x; + }, 0) / children.length; +} + +function d3_layout_clusterLeft(node) { + var children = node.children; + return children && children.length ? d3_layout_clusterLeft(children[0]) : node; +} + +function d3_layout_clusterRight(node) { + var children = node.children, n; + return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node; +} +// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm +d3.layout.tree = function() { + var hierarchy = d3.layout.hierarchy().sort(null).value(null), + separation = d3_layout_treeSeparation, + size = [1, 1]; // width, height + + function tree(d, i) { + var nodes = hierarchy.call(this, d, i), + root = nodes[0]; + + function firstWalk(node, previousSibling) { + var children = node.children, + layout = node._tree; + if (children && (n = children.length)) { + var n, + firstChild = children[0], + previousChild, + ancestor = firstChild, + child, + i = -1; + while (++i < n) { + child = children[i]; + firstWalk(child, previousChild); + ancestor = apportion(child, previousChild, ancestor); + previousChild = child; + } + d3_layout_treeShift(node); + var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim); + if (previousSibling) { + layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); + layout.mod = layout.prelim - midpoint; + } else { + layout.prelim = midpoint; + } + } else { + if (previousSibling) { + layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); + } + } + } + + function secondWalk(node, x) { + node.x = node._tree.prelim + x; + var children = node.children; + if (children && (n = children.length)) { + var i = -1, + n; + x += node._tree.mod; + while (++i < n) { + secondWalk(children[i], x); + } + } + } + + function apportion(node, previousSibling, ancestor) { + if (previousSibling) { + var vip = node, + vop = node, + vim = previousSibling, + vom = node.parent.children[0], + sip = vip._tree.mod, + sop = vop._tree.mod, + sim = vim._tree.mod, + som = vom._tree.mod, + shift; + while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) { + vom = d3_layout_treeLeft(vom); + vop = d3_layout_treeRight(vop); + vop._tree.ancestor = node; + shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip); + if (shift > 0) { + d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift); + sip += shift; + sop += shift; + } + sim += vim._tree.mod; + sip += vip._tree.mod; + som += vom._tree.mod; + sop += vop._tree.mod; + } + if (vim && !d3_layout_treeRight(vop)) { + vop._tree.thread = vim; + vop._tree.mod += sim - sop; + } + if (vip && !d3_layout_treeLeft(vom)) { + vom._tree.thread = vip; + vom._tree.mod += sip - som; + ancestor = node; + } + } + return ancestor; + } + + // Initialize temporary layout variables. + d3_layout_treeVisitAfter(root, function(node, previousSibling) { + node._tree = { + ancestor: node, + prelim: 0, + mod: 0, + change: 0, + shift: 0, + number: previousSibling ? previousSibling._tree.number + 1 : 0 + }; + }); + + // Compute the layout using Buchheim et al.'s algorithm. + firstWalk(root); + secondWalk(root, -root._tree.prelim); + + // Compute the left-most, right-most, and depth-most nodes for extents. + var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), + right = d3_layout_treeSearch(root, d3_layout_treeRightmost), + deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), + x0 = left.x - separation(left, right) / 2, + x1 = right.x + separation(right, left) / 2, + y1 = deep.depth || 1; + + // Clear temporary layout variables; transform x and y. + d3_layout_treeVisitAfter(root, function(node) { + node.x = (node.x - x0) / (x1 - x0) * size[0]; + node.y = node.depth / y1 * size[1]; + delete node._tree; + }); + + return nodes; + } + + tree.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return tree; + }; + + tree.size = function(x) { + if (!arguments.length) return size; + size = x; + return tree; + }; + + return d3_layout_hierarchyRebind(tree, hierarchy); +}; + +function d3_layout_treeSeparation(a, b) { + return a.parent == b.parent ? 1 : 2; +} + +// function d3_layout_treeSeparationRadial(a, b) { +// return (a.parent == b.parent ? 1 : 2) / a.depth; +// } + +function d3_layout_treeLeft(node) { + var children = node.children; + return children && children.length ? children[0] : node._tree.thread; +} + +function d3_layout_treeRight(node) { + var children = node.children, + n; + return children && (n = children.length) ? children[n - 1] : node._tree.thread; +} + +function d3_layout_treeSearch(node, compare) { + var children = node.children; + if (children && (n = children.length)) { + var child, + n, + i = -1; + while (++i < n) { + if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) { + node = child; + } + } + } + return node; +} + +function d3_layout_treeRightmost(a, b) { + return a.x - b.x; +} + +function d3_layout_treeLeftmost(a, b) { + return b.x - a.x; +} + +function d3_layout_treeDeepest(a, b) { + return a.depth - b.depth; +} + +function d3_layout_treeVisitAfter(node, callback) { + function visit(node, previousSibling) { + var children = node.children; + if (children && (n = children.length)) { + var child, + previousChild = null, + i = -1, + n; + while (++i < n) { + child = children[i]; + visit(child, previousChild); + previousChild = child; + } + } + callback(node, previousSibling); + } + visit(node, null); +} + +function d3_layout_treeShift(node) { + var shift = 0, + change = 0, + children = node.children, + i = children.length, + child; + while (--i >= 0) { + child = children[i]._tree; + child.prelim += shift; + child.mod += shift; + shift += child.shift + (change += child.change); + } +} + +function d3_layout_treeMove(ancestor, node, shift) { + ancestor = ancestor._tree; + node = node._tree; + var change = shift / (node.number - ancestor.number); + ancestor.change += change; + node.change -= change; + node.shift += shift; + node.prelim += shift; + node.mod += shift; +} + +function d3_layout_treeAncestor(vim, node, ancestor) { + return vim._tree.ancestor.parent == node.parent + ? vim._tree.ancestor + : ancestor; +} +// Squarified Treemaps by Mark Bruls, Kees Huizing, and Jarke J. van Wijk +// Modified to support a target aspect ratio by Jeff Heer +d3.layout.treemap = function() { + var hierarchy = d3.layout.hierarchy(), + round = Math.round, + size = [1, 1], // width, height + padding = null, + pad = d3_layout_treemapPadNull, + sticky = false, + stickies, + ratio = 0.5 * (1 + Math.sqrt(5)); // golden ratio + + // Compute the area for each child based on value & scale. + function scale(children, k) { + var i = -1, + n = children.length, + child, + area; + while (++i < n) { + area = (child = children[i]).value * (k < 0 ? 0 : k); + child.area = isNaN(area) || area <= 0 ? 0 : area; + } + } + + // Recursively arranges the specified node's children into squarified rows. + function squarify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), + row = [], + remaining = children.slice(), // copy-on-write + child, + best = Infinity, // the best row score so far + score, // the current row score + u = Math.min(rect.dx, rect.dy), // initial orientation + n; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while ((n = remaining.length) > 0) { + row.push(child = remaining[n - 1]); + row.area += child.area; + if ((score = worst(row, u)) <= best) { // continue with this orientation + remaining.pop(); + best = score; + } else { // abort, and try a different orientation + row.area -= row.pop().area; + position(row, u, rect, false); + u = Math.min(rect.dx, rect.dy); + row.length = row.area = 0; + best = Infinity; + } + } + if (row.length) { + position(row, u, rect, true); + row.length = row.area = 0; + } + children.forEach(squarify); + } + } + + // Recursively resizes the specified node's children into existing rows. + // Preserves the existing layout! + function stickify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), + remaining = children.slice(), // copy-on-write + child, + row = []; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while (child = remaining.pop()) { + row.push(child); + row.area += child.area; + if (child.z != null) { + position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length); + row.length = row.area = 0; + } + } + children.forEach(stickify); + } + } + + // Computes the score for the specified row, as the worst aspect ratio. + function worst(row, u) { + var s = row.area, + r, + rmax = 0, + rmin = Infinity, + i = -1, + n = row.length; + while (++i < n) { + if (!(r = row[i].area)) continue; + if (r < rmin) rmin = r; + if (r > rmax) rmax = r; + } + s *= s; + u *= u; + return s + ? Math.max((u * rmax * ratio) / s, s / (u * rmin * ratio)) + : Infinity; + } + + // Positions the specified row of nodes. Modifies `rect`. + function position(row, u, rect, flush) { + var i = -1, + n = row.length, + x = rect.x, + y = rect.y, + v = u ? round(row.area / u) : 0, + o; + if (u == rect.dx) { // horizontal subdivision + if (flush || v > rect.dy) v = rect.dy; // over+underflow + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dy = v; + x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0); + } + o.z = true; + o.dx += rect.x + rect.dx - x; // rounding error + rect.y += v; + rect.dy -= v; + } else { // vertical subdivision + if (flush || v > rect.dx) v = rect.dx; // over+underflow + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dx = v; + y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0); + } + o.z = false; + o.dy += rect.y + rect.dy - y; // rounding error + rect.x += v; + rect.dx -= v; + } + } + + function treemap(d) { + var nodes = stickies || hierarchy(d), + root = nodes[0]; + root.x = 0; + root.y = 0; + root.dx = size[0]; + root.dy = size[1]; + if (stickies) hierarchy.revalue(root); + scale([root], root.dx * root.dy / root.value); + (stickies ? stickify : squarify)(root); + if (sticky) stickies = nodes; + return nodes; + } + + treemap.size = function(x) { + if (!arguments.length) return size; + size = x; + return treemap; + }; + + treemap.padding = function(x) { + if (!arguments.length) return padding; + + function padFunction(node) { + var p = x.call(treemap, node, node.depth); + return p == null + ? d3_layout_treemapPadNull(node) + : d3_layout_treemapPad(node, typeof p === "number" ? [p, p, p, p] : p); + } + + function padConstant(node) { + return d3_layout_treemapPad(node, x); + } + + var type; + pad = (padding = x) == null ? d3_layout_treemapPadNull + : (type = typeof x) === "function" ? padFunction + : type === "number" ? (x = [x, x, x, x], padConstant) + : padConstant; + return treemap; + }; + + treemap.round = function(x) { + if (!arguments.length) return round != Number; + round = x ? Math.round : Number; + return treemap; + }; + + treemap.sticky = function(x) { + if (!arguments.length) return sticky; + sticky = x; + stickies = null; + return treemap; + }; + + treemap.ratio = function(x) { + if (!arguments.length) return ratio; + ratio = x; + return treemap; + }; + + return d3_layout_hierarchyRebind(treemap, hierarchy); +}; + +function d3_layout_treemapPadNull(node) { + return {x: node.x, y: node.y, dx: node.dx, dy: node.dy}; +} + +function d3_layout_treemapPad(node, padding) { + var x = node.x + padding[3], + y = node.y + padding[0], + dx = node.dx - padding[1] - padding[3], + dy = node.dy - padding[0] - padding[2]; + if (dx < 0) { x += dx / 2; dx = 0; } + if (dy < 0) { y += dy / 2; dy = 0; } + return {x: x, y: y, dx: dx, dy: dy}; +} +d3.csv = function(url, callback) { + d3.text(url, "text/csv", function(text) { + callback(text && d3.csv.parse(text)); + }); +}; +d3.csv.parse = function(text) { + var header; + return d3.csv.parseRows(text, function(row, i) { + if (i) { + var o = {}, j = -1, m = header.length; + while (++j < m) o[header[j]] = row[j]; + return o; + } else { + header = row; + return null; + } + }); +}; + +d3.csv.parseRows = function(text, f) { + var EOL = {}, // sentinel value for end-of-line + EOF = {}, // sentinel value for end-of-file + rows = [], // output rows + re = /\r\n|[,\r\n]/g, // field separator regex + n = 0, // the current line number + t, // the current token + eol; // is the current token followed by EOL? + + re.lastIndex = 0; // work-around bug in FF 3.6 + + /** @private Returns the next token. */ + function token() { + if (re.lastIndex >= text.length) return EOF; // special case: end of file + if (eol) { eol = false; return EOL; } // special case: end of line + + // special case: quotes + var j = re.lastIndex; + if (text.charCodeAt(j) === 34) { + var i = j; + while (i++ < text.length) { + if (text.charCodeAt(i) === 34) { + if (text.charCodeAt(i + 1) !== 34) break; + i++; + } + } + re.lastIndex = i + 2; + var c = text.charCodeAt(i + 1); + if (c === 13) { + eol = true; + if (text.charCodeAt(i + 2) === 10) re.lastIndex++; + } else if (c === 10) { + eol = true; + } + return text.substring(j + 1, i).replace(/""/g, "\""); + } + + // common case + var m = re.exec(text); + if (m) { + eol = m[0].charCodeAt(0) !== 44; + return text.substring(j, m.index); + } + re.lastIndex = text.length; + return text.substring(j); + } + + while ((t = token()) !== EOF) { + var a = []; + while ((t !== EOL) && (t !== EOF)) { + a.push(t); + t = token(); + } + if (f && !(a = f(a, n++))) continue; + rows.push(a); + } + + return rows; +}; +d3.csv.format = function(rows) { + return rows.map(d3_csv_formatRow).join("\n"); +}; + +function d3_csv_formatRow(row) { + return row.map(d3_csv_formatValue).join(","); +} + +function d3_csv_formatValue(text) { + return /[",\n]/.test(text) + ? "\"" + text.replace(/\"/g, "\"\"") + "\"" + : text; +} +d3.geo = {}; + +var d3_geo_radians = Math.PI / 180; +// TODO clip input coordinates on opposite hemisphere +d3.geo.azimuthal = function() { + var mode = "orthographic", // or stereographic, gnomonic, equidistant or equalarea + origin, + scale = 200, + translate = [480, 250], + x0, + y0, + cy0, + sy0; + + function azimuthal(coordinates) { + var x1 = coordinates[0] * d3_geo_radians - x0, + y1 = coordinates[1] * d3_geo_radians, + cx1 = Math.cos(x1), + sx1 = Math.sin(x1), + cy1 = Math.cos(y1), + sy1 = Math.sin(y1), + cc = mode !== "orthographic" ? sy0 * sy1 + cy0 * cy1 * cx1 : null, + c, + k = mode === "stereographic" ? 1 / (1 + cc) + : mode === "gnomonic" ? 1 / cc + : mode === "equidistant" ? (c = Math.acos(cc), c ? c / Math.sin(c) : 0) + : mode === "equalarea" ? Math.sqrt(2 / (1 + cc)) + : 1, + x = k * cy1 * sx1, + y = k * (sy0 * cy1 * cx1 - cy0 * sy1); + return [ + scale * x + translate[0], + scale * y + translate[1] + ]; + } + + azimuthal.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, + y = (coordinates[1] - translate[1]) / scale, + p = Math.sqrt(x * x + y * y), + c = mode === "stereographic" ? 2 * Math.atan(p) + : mode === "gnomonic" ? Math.atan(p) + : mode === "equidistant" ? p + : mode === "equalarea" ? 2 * Math.asin(.5 * p) + : Math.asin(p), + sc = Math.sin(c), + cc = Math.cos(c); + return [ + (x0 + Math.atan2(x * sc, p * cy0 * cc + y * sy0 * sc)) / d3_geo_radians, + Math.asin(cc * sy0 - (p ? (y * sc * cy0) / p : 0)) / d3_geo_radians + ]; + }; + + azimuthal.mode = function(x) { + if (!arguments.length) return mode; + mode = x + ""; + return azimuthal; + }; + + azimuthal.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + x0 = origin[0] * d3_geo_radians; + y0 = origin[1] * d3_geo_radians; + cy0 = Math.cos(y0); + sy0 = Math.sin(y0); + return azimuthal; + }; + + azimuthal.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return azimuthal; + }; + + azimuthal.translate = function(x) { + if (!arguments.length) return translate; + translate = [+x[0], +x[1]]; + return azimuthal; + }; + + return azimuthal.origin([0, 0]); +}; +// Derived from Tom Carden's Albers implementation for Protovis. +// http://gist.github.com/476238 +// http://mathworld.wolfram.com/AlbersEqual-AreaConicProjection.html + +d3.geo.albers = function() { + var origin = [-98, 38], + parallels = [29.5, 45.5], + scale = 1000, + translate = [480, 250], + lng0, // d3_geo_radians * origin[0] + n, + C, + p0; + + function albers(coordinates) { + var t = n * (d3_geo_radians * coordinates[0] - lng0), + p = Math.sqrt(C - 2 * n * Math.sin(d3_geo_radians * coordinates[1])) / n; + return [ + scale * p * Math.sin(t) + translate[0], + scale * (p * Math.cos(t) - p0) + translate[1] + ]; + } + + albers.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, + y = (coordinates[1] - translate[1]) / scale, + p0y = p0 + y, + t = Math.atan2(x, p0y), + p = Math.sqrt(x * x + p0y * p0y); + return [ + (lng0 + t / n) / d3_geo_radians, + Math.asin((C - p * p * n * n) / (2 * n)) / d3_geo_radians + ]; + }; + + function reload() { + var phi1 = d3_geo_radians * parallels[0], + phi2 = d3_geo_radians * parallels[1], + lat0 = d3_geo_radians * origin[1], + s = Math.sin(phi1), + c = Math.cos(phi1); + lng0 = d3_geo_radians * origin[0]; + n = .5 * (s + Math.sin(phi2)); + C = c * c + 2 * n * s; + p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n; + return albers; + } + + albers.origin = function(x) { + if (!arguments.length) return origin; + origin = [+x[0], +x[1]]; + return reload(); + }; + + albers.parallels = function(x) { + if (!arguments.length) return parallels; + parallels = [+x[0], +x[1]]; + return reload(); + }; + + albers.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return albers; + }; + + albers.translate = function(x) { + if (!arguments.length) return translate; + translate = [+x[0], +x[1]]; + return albers; + }; + + return reload(); +}; + +// A composite projection for the United States, 960x500. The set of standard +// parallels for each region comes from USGS, which is published here: +// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers +// TODO allow the composite projection to be rescaled? +d3.geo.albersUsa = function() { + var lower48 = d3.geo.albers(); + + var alaska = d3.geo.albers() + .origin([-160, 60]) + .parallels([55, 65]); + + var hawaii = d3.geo.albers() + .origin([-160, 20]) + .parallels([8, 18]); + + var puertoRico = d3.geo.albers() + .origin([-60, 10]) + .parallels([8, 18]); + + function albersUsa(coordinates) { + var lon = coordinates[0], + lat = coordinates[1]; + return (lat > 50 ? alaska + : lon < -140 ? hawaii + : lat < 21 ? puertoRico + : lower48)(coordinates); + } + + albersUsa.scale = function(x) { + if (!arguments.length) return lower48.scale(); + lower48.scale(x); + alaska.scale(x * .6); + hawaii.scale(x); + puertoRico.scale(x * 1.5); + return albersUsa.translate(lower48.translate()); + }; + + albersUsa.translate = function(x) { + if (!arguments.length) return lower48.translate(); + var dz = lower48.scale() / 1000, + dx = x[0], + dy = x[1]; + lower48.translate(x); + alaska.translate([dx - 400 * dz, dy + 170 * dz]); + hawaii.translate([dx - 190 * dz, dy + 200 * dz]); + puertoRico.translate([dx + 580 * dz, dy + 430 * dz]); + return albersUsa; + }; + + return albersUsa.scale(lower48.scale()); +}; +d3.geo.bonne = function() { + var scale = 200, + translate = [480, 250], + x0, // origin longitude in radians + y0, // origin latitude in radians + y1, // parallel latitude in radians + c1; // cot(y1) + + function bonne(coordinates) { + var x = coordinates[0] * d3_geo_radians - x0, + y = coordinates[1] * d3_geo_radians - y0; + if (y1) { + var p = c1 + y1 - y, E = x * Math.cos(y) / p; + x = p * Math.sin(E); + y = p * Math.cos(E) - c1; + } else { + x *= Math.cos(y); + y *= -1; + } + return [ + scale * x + translate[0], + scale * y + translate[1] + ]; + } + + bonne.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, + y = (coordinates[1] - translate[1]) / scale; + if (y1) { + var c = c1 + y, p = Math.sqrt(x * x + c * c); + y = c1 + y1 - p; + x = x0 + p * Math.atan2(x, c) / Math.cos(y); + } else { + y *= -1; + x /= Math.cos(y); + } + return [ + x / d3_geo_radians, + y / d3_geo_radians + ]; + }; + + // 90° for Werner, 0° for Sinusoidal + bonne.parallel = function(x) { + if (!arguments.length) return y1 / d3_geo_radians; + c1 = 1 / Math.tan(y1 = x * d3_geo_radians); + return bonne; + }; + + bonne.origin = function(x) { + if (!arguments.length) return [x0 / d3_geo_radians, y0 / d3_geo_radians]; + x0 = x[0] * d3_geo_radians; + y0 = x[1] * d3_geo_radians; + return bonne; + }; + + bonne.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return bonne; + }; + + bonne.translate = function(x) { + if (!arguments.length) return translate; + translate = [+x[0], +x[1]]; + return bonne; + }; + + return bonne.origin([0, 0]).parallel(45); +}; +d3.geo.equirectangular = function() { + var scale = 500, + translate = [480, 250]; + + function equirectangular(coordinates) { + var x = coordinates[0] / 360, + y = -coordinates[1] / 360; + return [ + scale * x + translate[0], + scale * y + translate[1] + ]; + } + + equirectangular.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, + y = (coordinates[1] - translate[1]) / scale; + return [ + 360 * x, + -360 * y + ]; + }; + + equirectangular.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return equirectangular; + }; + + equirectangular.translate = function(x) { + if (!arguments.length) return translate; + translate = [+x[0], +x[1]]; + return equirectangular; + }; + + return equirectangular; +}; +d3.geo.mercator = function() { + var scale = 500, + translate = [480, 250]; + + function mercator(coordinates) { + var x = coordinates[0] / 360, + y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_geo_radians / 2)) / d3_geo_radians) / 360; + return [ + scale * x + translate[0], + scale * Math.max(-.5, Math.min(.5, y)) + translate[1] + ]; + } + + mercator.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, + y = (coordinates[1] - translate[1]) / scale; + return [ + 360 * x, + 2 * Math.atan(Math.exp(-360 * y * d3_geo_radians)) / d3_geo_radians - 90 + ]; + }; + + mercator.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return mercator; + }; + + mercator.translate = function(x) { + if (!arguments.length) return translate; + translate = [+x[0], +x[1]]; + return mercator; + }; + + return mercator; +}; +function d3_geo_type(types, defaultValue) { + return function(object) { + return object && types.hasOwnProperty(object.type) ? types[object.type](object) : defaultValue; + }; +} +/** + * Returns a function that, given a GeoJSON object (e.g., a feature), returns + * the corresponding SVG path. The function can be customized by overriding the + * projection. Point features are mapped to circles with a default radius of + * 4.5px; the radius can be specified either as a constant or a function that + * is evaluated per object. + */ +d3.geo.path = function() { + var pointRadius = 4.5, + pointCircle = d3_path_circle(pointRadius), + projection = d3.geo.albersUsa(); + + function path(d, i) { + if (typeof pointRadius === "function") { + pointCircle = d3_path_circle(pointRadius.apply(this, arguments)); + } + return pathType(d) || null; + } + + function project(coordinates) { + return projection(coordinates).join(","); + } + + var pathType = d3_geo_type({ + + FeatureCollection: function(o) { + var path = [], + features = o.features, + i = -1, // features.index + n = features.length; + while (++i < n) path.push(pathType(features[i].geometry)); + return path.join(""); + }, + + Feature: function(o) { + return pathType(o.geometry); + }, + + Point: function(o) { + return "M" + project(o.coordinates) + pointCircle; + }, + + MultiPoint: function(o) { + var path = [], + coordinates = o.coordinates, + i = -1, // coordinates.index + n = coordinates.length; + while (++i < n) path.push("M", project(coordinates[i]), pointCircle); + return path.join(""); + }, + + LineString: function(o) { + var path = ["M"], + coordinates = o.coordinates, + i = -1, // coordinates.index + n = coordinates.length; + while (++i < n) path.push(project(coordinates[i]), "L"); + path.pop(); + return path.join(""); + }, + + MultiLineString: function(o) { + var path = [], + coordinates = o.coordinates, + i = -1, // coordinates.index + n = coordinates.length, + subcoordinates, // coordinates[i] + j, // subcoordinates.index + m; // subcoordinates.length + while (++i < n) { + subcoordinates = coordinates[i]; + j = -1; + m = subcoordinates.length; + path.push("M"); + while (++j < m) path.push(project(subcoordinates[j]), "L"); + path.pop(); + } + return path.join(""); + }, + + Polygon: function(o) { + var path = [], + coordinates = o.coordinates, + i = -1, // coordinates.index + n = coordinates.length, + subcoordinates, // coordinates[i] + j, // subcoordinates.index + m; // subcoordinates.length + while (++i < n) { + subcoordinates = coordinates[i]; + j = -1; + if ((m = subcoordinates.length - 1) > 0) { + path.push("M"); + while (++j < m) path.push(project(subcoordinates[j]), "L"); + path[path.length - 1] = "Z"; + } + } + return path.join(""); + }, + + MultiPolygon: function(o) { + var path = [], + coordinates = o.coordinates, + i = -1, // coordinates index + n = coordinates.length, + subcoordinates, // coordinates[i] + j, // subcoordinates index + m, // subcoordinates.length + subsubcoordinates, // subcoordinates[j] + k, // subsubcoordinates index + p; // subsubcoordinates.length + while (++i < n) { + subcoordinates = coordinates[i]; + j = -1; + m = subcoordinates.length; + while (++j < m) { + subsubcoordinates = subcoordinates[j]; + k = -1; + if ((p = subsubcoordinates.length - 1) > 0) { + path.push("M"); + while (++k < p) path.push(project(subsubcoordinates[k]), "L"); + path[path.length - 1] = "Z"; + } + } + } + return path.join(""); + }, + + GeometryCollection: function(o) { + var path = [], + geometries = o.geometries, + i = -1, // geometries index + n = geometries.length; + while (++i < n) path.push(pathType(geometries[i])); + return path.join(""); + } + + }); + + var areaType = path.area = d3_geo_type({ + + FeatureCollection: function(o) { + var area = 0, + features = o.features, + i = -1, // features.index + n = features.length; + while (++i < n) area += areaType(features[i]); + return area; + }, + + Feature: function(o) { + return areaType(o.geometry); + }, + + Polygon: function(o) { + return polygonArea(o.coordinates); + }, + + MultiPolygon: function(o) { + var sum = 0, + coordinates = o.coordinates, + i = -1, // coordinates index + n = coordinates.length; + while (++i < n) sum += polygonArea(coordinates[i]); + return sum; + }, + + GeometryCollection: function(o) { + var sum = 0, + geometries = o.geometries, + i = -1, // geometries index + n = geometries.length; + while (++i < n) sum += areaType(geometries[i]); + return sum; + } + + }, 0); + + function polygonArea(coordinates) { + var sum = area(coordinates[0]), // exterior ring + i = 0, // coordinates.index + n = coordinates.length; + while (++i < n) sum -= area(coordinates[i]); // holes + return sum; + } + + function polygonCentroid(coordinates) { + var polygon = d3.geom.polygon(coordinates[0].map(projection)), // exterior ring + area = polygon.area(), + centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1), + x = centroid[0], + y = centroid[1], + z = area, + i = 0, // coordinates index + n = coordinates.length; + while (++i < n) { + polygon = d3.geom.polygon(coordinates[i].map(projection)); // holes + area = polygon.area(); + centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1); + x -= centroid[0]; + y -= centroid[1]; + z -= area; + } + return [x, y, 6 * z]; // weighted centroid + } + + var centroidType = path.centroid = d3_geo_type({ + + // TODO FeatureCollection + // TODO Point + // TODO MultiPoint + // TODO LineString + // TODO MultiLineString + // TODO GeometryCollection + + Feature: function(o) { + return centroidType(o.geometry); + }, + + Polygon: function(o) { + var centroid = polygonCentroid(o.coordinates); + return [centroid[0] / centroid[2], centroid[1] / centroid[2]]; + }, + + MultiPolygon: function(o) { + var area = 0, + coordinates = o.coordinates, + centroid, + x = 0, + y = 0, + z = 0, + i = -1, // coordinates index + n = coordinates.length; + while (++i < n) { + centroid = polygonCentroid(coordinates[i]); + x += centroid[0]; + y += centroid[1]; + z += centroid[2]; + } + return [x / z, y / z]; + } + + }); + + function area(coordinates) { + return Math.abs(d3.geom.polygon(coordinates.map(projection)).area()); + } + + path.projection = function(x) { + projection = x; + return path; + }; + + path.pointRadius = function(x) { + if (typeof x === "function") pointRadius = x; + else { + pointRadius = +x; + pointCircle = d3_path_circle(pointRadius); + } + return path; + }; + + return path; +}; + +function d3_path_circle(radius) { + return "m0," + radius + + "a" + radius + "," + radius + " 0 1,1 0," + (-2 * radius) + + "a" + radius + "," + radius + " 0 1,1 0," + (+2 * radius) + + "z"; +} +/** + * Given a GeoJSON object, returns the corresponding bounding box. The bounding + * box is represented by a two-dimensional array: [[left, bottom], [right, + * top]], where left is the minimum longitude, bottom is the minimum latitude, + * right is maximum longitude, and top is the maximum latitude. + */ +d3.geo.bounds = function(feature) { + var left = Infinity, + bottom = Infinity, + right = -Infinity, + top = -Infinity; + d3_geo_bounds(feature, function(x, y) { + if (x < left) left = x; + if (x > right) right = x; + if (y < bottom) bottom = y; + if (y > top) top = y; + }); + return [[left, bottom], [right, top]]; +}; + +function d3_geo_bounds(o, f) { + if (d3_geo_boundsTypes.hasOwnProperty(o.type)) d3_geo_boundsTypes[o.type](o, f); +} + +var d3_geo_boundsTypes = { + Feature: d3_geo_boundsFeature, + FeatureCollection: d3_geo_boundsFeatureCollection, + GeometryCollection: d3_geo_boundsGeometryCollection, + LineString: d3_geo_boundsLineString, + MultiLineString: d3_geo_boundsMultiLineString, + MultiPoint: d3_geo_boundsLineString, + MultiPolygon: d3_geo_boundsMultiPolygon, + Point: d3_geo_boundsPoint, + Polygon: d3_geo_boundsPolygon +}; + +function d3_geo_boundsFeature(o, f) { + d3_geo_bounds(o.geometry, f); +} + +function d3_geo_boundsFeatureCollection(o, f) { + for (var a = o.features, i = 0, n = a.length; i < n; i++) { + d3_geo_bounds(a[i].geometry, f); + } +} + +function d3_geo_boundsGeometryCollection(o, f) { + for (var a = o.geometries, i = 0, n = a.length; i < n; i++) { + d3_geo_bounds(a[i], f); + } +} + +function d3_geo_boundsLineString(o, f) { + for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { + f.apply(null, a[i]); + } +} + +function d3_geo_boundsMultiLineString(o, f) { + for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { + for (var b = a[i], j = 0, m = b.length; j < m; j++) { + f.apply(null, b[j]); + } + } +} + +function d3_geo_boundsMultiPolygon(o, f) { + for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { + for (var b = a[i][0], j = 0, m = b.length; j < m; j++) { + f.apply(null, b[j]); + } + } +} + +function d3_geo_boundsPoint(o, f) { + f.apply(null, o.coordinates); +} + +function d3_geo_boundsPolygon(o, f) { + for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) { + f.apply(null, a[i]); + } +} +// TODO breakAtDateLine? + +d3.geo.circle = function() { + var origin = [0, 0], + degrees = 90 - 1e-2, + radians = degrees * d3_geo_radians, + arc = d3.geo.greatArc().target(d3_identity); + + function circle() { + // TODO render a circle as a Polygon + } + + function visible(point) { + return arc.distance(point) < radians; + } + + circle.clip = function(d) { + arc.source(typeof origin === "function" ? origin.apply(this, arguments) : origin); + return clipType(d); + }; + + var clipType = d3_geo_type({ + + FeatureCollection: function(o) { + var features = o.features.map(clipType).filter(d3_identity); + return features && (o = Object.create(o), o.features = features, o); + }, + + Feature: function(o) { + var geometry = clipType(o.geometry); + return geometry && (o = Object.create(o), o.geometry = geometry, o); + }, + + Point: function(o) { + return visible(o.coordinates) && o; + }, + + MultiPoint: function(o) { + var coordinates = o.coordinates.filter(visible); + return coordinates.length && { + type: o.type, + coordinates: coordinates + }; + }, + + LineString: function(o) { + var coordinates = clip(o.coordinates); + return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + + MultiLineString: function(o) { + var coordinates = o.coordinates.map(clip).filter(function(d) { return d.length; }); + return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + + Polygon: function(o) { + var coordinates = o.coordinates.map(clip); + return coordinates[0].length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + + MultiPolygon: function(o) { + var coordinates = o.coordinates.map(function(d) { return d.map(clip); }).filter(function(d) { return d[0].length; }); + return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + + GeometryCollection: function(o) { + var geometries = o.geometries.map(clipType).filter(d3_identity); + return geometries.length && (o = Object.create(o), o.geometries = geometries, o); + } + + }); + + function clip(coordinates) { + var i = -1, + n = coordinates.length, + clipped = [], + p0, + p1, + p2, + d0, + d1; + + while (++i < n) { + d1 = arc.distance(p2 = coordinates[i]); + if (d1 < radians) { + if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1))); + clipped.push(p2); + p0 = p1 = null; + } else { + p1 = p2; + if (!p0 && clipped.length) { + clipped.push(d3_geo_greatArcInterpolate(clipped[clipped.length - 1], p1)((radians - d0) / (d1 - d0))); + p0 = p1; + } + } + d0 = d1; + } + + if (p1 && clipped.length) { + d1 = arc.distance(p2 = clipped[0]); + clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1))); + } + + return resample(clipped); + } + + // Resample coordinates, creating great arcs between each. + function resample(coordinates) { + var i = 0, + n = coordinates.length, + j, + m, + resampled = n ? [coordinates[0]] : coordinates, + resamples, + origin = arc.source(); + + while (++i < n) { + resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates; + for (j = 0, m = resamples.length; ++j < m;) resampled.push(resamples[j]); + } + + arc.source(origin); + return resampled; + } + + circle.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return circle; + }; + + circle.angle = function(x) { + if (!arguments.length) return degrees; + radians = (degrees = +x) * d3_geo_radians; + return circle; + }; + + // Precision is specified in degrees. + circle.precision = function(x) { + if (!arguments.length) return arc.precision(); + arc.precision(x); + return circle; + }; + + return circle; +} +d3.geo.greatArc = function() { + var source = d3_geo_greatArcSource, + target = d3_geo_greatArcTarget, + precision = 6 * d3_geo_radians; + + function greatArc() { + var a = typeof source === "function" ? source.apply(this, arguments) : source, + b = typeof target === "function" ? target.apply(this, arguments) : target, + i = d3_geo_greatArcInterpolate(a, b), + dt = precision / i.d, + t = 0, + coordinates = [a]; + while ((t += dt) < 1) coordinates.push(i(t)); + coordinates.push(b); + return { + type: "LineString", + coordinates: coordinates + }; + } + + // Length returned in radians; multiply by radius for distance. + greatArc.distance = function() { + var a = typeof source === "function" ? source.apply(this, arguments) : source, + b = typeof target === "function" ? target.apply(this, arguments) : target; + return d3_geo_greatArcInterpolate(a, b).d; + }; + + greatArc.source = function(x) { + if (!arguments.length) return source; + source = x; + return greatArc; + }; + + greatArc.target = function(x) { + if (!arguments.length) return target; + target = x; + return greatArc; + }; + + // Precision is specified in degrees. + greatArc.precision = function(x) { + if (!arguments.length) return precision / d3_geo_radians; + precision = x * d3_geo_radians; + return greatArc; + }; + + return greatArc; +}; + +function d3_geo_greatArcSource(d) { + return d.source; +} + +function d3_geo_greatArcTarget(d) { + return d.target; +} + +function d3_geo_greatArcInterpolate(a, b) { + var x0 = a[0] * d3_geo_radians, cx0 = Math.cos(x0), sx0 = Math.sin(x0), + y0 = a[1] * d3_geo_radians, cy0 = Math.cos(y0), sy0 = Math.sin(y0), + x1 = b[0] * d3_geo_radians, cx1 = Math.cos(x1), sx1 = Math.sin(x1), + y1 = b[1] * d3_geo_radians, cy1 = Math.cos(y1), sy1 = Math.sin(y1), + d = interpolate.d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))), + sd = Math.sin(d); + + // From http://williams.best.vwh.net/avform.htm#Intermediate + function interpolate(t) { + var A = Math.sin(d - (t *= d)) / sd, + B = Math.sin(t) / sd, + x = A * cy0 * cx0 + B * cy1 * cx1, + y = A * cy0 * sx0 + B * cy1 * sx1, + z = A * sy0 + B * sy1; + return [ + Math.atan2(y, x) / d3_geo_radians, + Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians + ]; + } + + return interpolate; +} +d3.geo.greatCircle = d3.geo.circle; +d3.geom = {}; +/** + * Computes a contour for a given input grid function using the marching + * squares algorithm. Returns the contour polygon as an array of points. + * + * @param grid a two-input function(x, y) that returns true for values + * inside the contour and false for values outside the contour. + * @param start an optional starting point [x, y] on the grid. + * @returns polygon [[x1, y1], [x2, y2], …] + */ +d3.geom.contour = function(grid, start) { + var s = start || d3_geom_contourStart(grid), // starting point + c = [], // contour polygon + x = s[0], // current x position + y = s[1], // current y position + dx = 0, // next x direction + dy = 0, // next y direction + pdx = NaN, // previous x direction + pdy = NaN, // previous y direction + i = 0; + + do { + // determine marching squares index + i = 0; + if (grid(x-1, y-1)) i += 1; + if (grid(x, y-1)) i += 2; + if (grid(x-1, y )) i += 4; + if (grid(x, y )) i += 8; + + // determine next direction + if (i === 6) { + dx = pdy === -1 ? -1 : 1; + dy = 0; + } else if (i === 9) { + dx = 0; + dy = pdx === 1 ? -1 : 1; + } else { + dx = d3_geom_contourDx[i]; + dy = d3_geom_contourDy[i]; + } + + // update contour polygon + if (dx != pdx && dy != pdy) { + c.push([x, y]); + pdx = dx; + pdy = dy; + } + + x += dx; + y += dy; + } while (s[0] != x || s[1] != y); + + return c; +}; + +// lookup tables for marching directions +var d3_geom_contourDx = [1, 0, 1, 1,-1, 0,-1, 1,0, 0,0,0,-1, 0,-1,NaN], + d3_geom_contourDy = [0,-1, 0, 0, 0,-1, 0, 0,1,-1,1,1, 0,-1, 0,NaN]; + +function d3_geom_contourStart(grid) { + var x = 0, + y = 0; + + // search for a starting point; begin at origin + // and proceed along outward-expanding diagonals + while (true) { + if (grid(x,y)) { + return [x,y]; + } + if (x === 0) { + x = y + 1; + y = 0; + } else { + x = x - 1; + y = y + 1; + } + } +} +/** + * Computes the 2D convex hull of a set of points using Graham's scanning + * algorithm. The algorithm has been implemented as described in Cormen, + * Leiserson, and Rivest's Introduction to Algorithms. The running time of + * this algorithm is O(n log n), where n is the number of input points. + * + * @param vertices [[x1, y1], [x2, y2], …] + * @returns polygon [[x1, y1], [x2, y2], …] + */ +d3.geom.hull = function(vertices) { + if (vertices.length < 3) return []; + + var len = vertices.length, + plen = len - 1, + points = [], + stack = [], + i, j, h = 0, x1, y1, x2, y2, u, v, a, sp; + + // find the starting ref point: leftmost point with the minimum y coord + for (i=1; i= (x2*x2 + y2*y2)) { + points[i].index = -1; + } else { + points[u].index = -1; + a = points[i].angle; + u = i; + v = j; + } + } else { + a = points[i].angle; + u = i; + v = j; + } + } + + // initialize the stack + stack.push(h); + for (i=0, j=0; i<2; ++j) { + if (points[j].index !== -1) { + stack.push(points[j].index); + i++; + } + } + sp = stack.length; + + // do graham's scan + for (; j 0; +} +// Note: requires coordinates to be counterclockwise and convex! +d3.geom.polygon = function(coordinates) { + + coordinates.area = function() { + var i = 0, + n = coordinates.length, + a = coordinates[n - 1][0] * coordinates[0][1], + b = coordinates[n - 1][1] * coordinates[0][0]; + while (++i < n) { + a += coordinates[i - 1][0] * coordinates[i][1]; + b += coordinates[i - 1][1] * coordinates[i][0]; + } + return (b - a) * .5; + }; + + coordinates.centroid = function(k) { + var i = -1, + n = coordinates.length, + x = 0, + y = 0, + a, + b = coordinates[n - 1], + c; + if (!arguments.length) k = -1 / (6 * coordinates.area()); + while (++i < n) { + a = b; + b = coordinates[i]; + c = a[0] * b[1] - b[0] * a[1]; + x += (a[0] + b[0]) * c; + y += (a[1] + b[1]) * c; + } + return [x * k, y * k]; + }; + + // The Sutherland-Hodgman clipping algorithm. + coordinates.clip = function(subject) { + var input, + i = -1, + n = coordinates.length, + j, + m, + a = coordinates[n - 1], + b, + c, + d; + while (++i < n) { + input = subject.slice(); + subject.length = 0; + b = coordinates[i]; + c = input[(m = input.length) - 1]; + j = -1; + while (++j < m) { + d = input[j]; + if (d3_geom_polygonInside(d, a, b)) { + if (!d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + subject.push(d); + } else if (d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + c = d; + } + a = b; + } + return subject; + }; + + return coordinates; +}; + +function d3_geom_polygonInside(p, a, b) { + return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); +} + +// Intersect two infinite lines cd and ab. +function d3_geom_polygonIntersect(c, d, a, b) { + var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0], + y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1], + x13 = x1 - x3, + x21 = x2 - x1, + x43 = x4 - x3, + y13 = y1 - y3, + y21 = y2 - y1, + y43 = y4 - y3, + ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21); + return [x1 + ua * x21, y1 + ua * y21]; +} +// Adapted from Nicolas Garcia Belmonte's JIT implementation: +// http://blog.thejit.org/2010/02/12/voronoi-tessellation/ +// http://blog.thejit.org/assets/voronoijs/voronoi.js +// See lib/jit/LICENSE for details. + +// Notes: +// +// This implementation does not clip the returned polygons, so if you want to +// clip them to a particular shape you will need to do that either in SVG or by +// post-processing with d3.geom.polygon's clip method. +// +// If any vertices are coincident or have NaN positions, the behavior of this +// method is undefined. Most likely invalid polygons will be returned. You +// should filter invalid points, and consolidate coincident points, before +// computing the tessellation. + +/** + * @param vertices [[x1, y1], [x2, y2], …] + * @returns polygons [[[x1, y1], [x2, y2], …], …] + */ +d3.geom.voronoi = function(vertices) { + var polygons = vertices.map(function() { return []; }); + + d3_voronoi_tessellate(vertices, function(e) { + var s1, + s2, + x1, + x2, + y1, + y2; + if (e.a === 1 && e.b >= 0) { + s1 = e.ep.r; + s2 = e.ep.l; + } else { + s1 = e.ep.l; + s2 = e.ep.r; + } + if (e.a === 1) { + y1 = s1 ? s1.y : -1e6; + x1 = e.c - e.b * y1; + y2 = s2 ? s2.y : 1e6; + x2 = e.c - e.b * y2; + } else { + x1 = s1 ? s1.x : -1e6; + y1 = e.c - e.a * x1; + x2 = s2 ? s2.x : 1e6; + y2 = e.c - e.a * x2; + } + var v1 = [x1, y1], + v2 = [x2, y2]; + polygons[e.region.l.index].push(v1, v2); + polygons[e.region.r.index].push(v1, v2); + }); + + // Reconnect the polygon segments into counterclockwise loops. + return polygons.map(function(polygon, i) { + var cx = vertices[i][0], + cy = vertices[i][1]; + polygon.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + return polygon.sort(function(a, b) { + return a.angle - b.angle; + }).filter(function(d, i) { + return !i || (d.angle - polygon[i - 1].angle > 1e-10); + }); + }); +}; + +var d3_voronoi_opposite = {"l": "r", "r": "l"}; + +function d3_voronoi_tessellate(vertices, callback) { + + var Sites = { + list: vertices + .map(function(v, i) { + return { + index: i, + x: v[0], + y: v[1] + }; + }) + .sort(function(a, b) { + return a.y < b.y ? -1 + : a.y > b.y ? 1 + : a.x < b.x ? -1 + : a.x > b.x ? 1 + : 0; + }), + bottomSite: null + }; + + var EdgeList = { + list: [], + leftEnd: null, + rightEnd: null, + + init: function() { + EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.leftEnd.r = EdgeList.rightEnd; + EdgeList.rightEnd.l = EdgeList.leftEnd; + EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd); + }, + + createHalfEdge: function(edge, side) { + return { + edge: edge, + side: side, + vertex: null, + "l": null, + "r": null + }; + }, + + insert: function(lb, he) { + he.l = lb; + he.r = lb.r; + lb.r.l = he; + lb.r = he; + }, + + leftBound: function(p) { + var he = EdgeList.leftEnd; + do { + he = he.r; + } while (he != EdgeList.rightEnd && Geom.rightOf(he, p)); + he = he.l; + return he; + }, + + del: function(he) { + he.l.r = he.r; + he.r.l = he.l; + he.edge = null; + }, + + right: function(he) { + return he.r; + }, + + left: function(he) { + return he.l; + }, + + leftRegion: function(he) { + return he.edge == null + ? Sites.bottomSite + : he.edge.region[he.side]; + }, + + rightRegion: function(he) { + return he.edge == null + ? Sites.bottomSite + : he.edge.region[d3_voronoi_opposite[he.side]]; + } + }; + + var Geom = { + + bisect: function(s1, s2) { + var newEdge = { + region: {"l": s1, "r": s2}, + ep: {"l": null, "r": null} + }; + + var dx = s2.x - s1.x, + dy = s2.y - s1.y, + adx = dx > 0 ? dx : -dx, + ady = dy > 0 ? dy : -dy; + + newEdge.c = s1.x * dx + s1.y * dy + + (dx * dx + dy * dy) * .5; + + if (adx > ady) { + newEdge.a = 1; + newEdge.b = dy / dx; + newEdge.c /= dx; + } else { + newEdge.b = 1; + newEdge.a = dx / dy; + newEdge.c /= dy; + } + + return newEdge; + }, + + intersect: function(el1, el2) { + var e1 = el1.edge, + e2 = el2.edge; + if (!e1 || !e2 || (e1.region.r == e2.region.r)) { + return null; + } + var d = (e1.a * e2.b) - (e1.b * e2.a); + if (Math.abs(d) < 1e-10) { + return null; + } + var xint = (e1.c * e2.b - e2.c * e1.b) / d, + yint = (e2.c * e1.a - e1.c * e2.a) / d, + e1r = e1.region.r, + e2r = e2.region.r, + el, + e; + if ((e1r.y < e2r.y) || + (e1r.y == e2r.y && e1r.x < e2r.x)) { + el = el1; + e = e1; + } else { + el = el2; + e = e2; + } + var rightOfSite = (xint >= e.region.r.x); + if ((rightOfSite && (el.side === "l")) || + (!rightOfSite && (el.side === "r"))) { + return null; + } + return { + x: xint, + y: yint + }; + }, + + rightOf: function(he, p) { + var e = he.edge, + topsite = e.region.r, + rightOfSite = (p.x > topsite.x); + + if (rightOfSite && (he.side === "l")) { + return 1; + } + if (!rightOfSite && (he.side === "r")) { + return 0; + } + if (e.a === 1) { + var dyp = p.y - topsite.y, + dxp = p.x - topsite.x, + fast = 0, + above = 0; + + if ((!rightOfSite && (e.b < 0)) || + (rightOfSite && (e.b >= 0))) { + above = fast = (dyp >= e.b * dxp); + } else { + above = ((p.x + p.y * e.b) > e.c); + if (e.b < 0) { + above = !above; + } + if (!above) { + fast = 1; + } + } + if (!fast) { + var dxs = topsite.x - e.region.l.x; + above = (e.b * (dxp * dxp - dyp * dyp)) < + (dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b)); + + if (e.b < 0) { + above = !above; + } + } + } else /* e.b == 1 */ { + var yl = e.c - e.a * p.x, + t1 = p.y - yl, + t2 = p.x - topsite.x, + t3 = yl - topsite.y; + + above = (t1 * t1) > (t2 * t2 + t3 * t3); + } + return he.side === "l" ? above : !above; + }, + + endPoint: function(edge, side, site) { + edge.ep[side] = site; + if (!edge.ep[d3_voronoi_opposite[side]]) return; + callback(edge); + }, + + distance: function(s, t) { + var dx = s.x - t.x, + dy = s.y - t.y; + return Math.sqrt(dx * dx + dy * dy); + } + }; + + var EventQueue = { + list: [], + + insert: function(he, site, offset) { + he.vertex = site; + he.ystar = site.y + offset; + for (var i=0, list=EventQueue.list, l=list.length; i next.ystar || + (he.ystar == next.ystar && + site.x > next.vertex.x)) { + continue; + } else { + break; + } + } + list.splice(i, 0, he); + }, + + del: function(he) { + for (var i=0, ls=EventQueue.list, l=ls.length; i top.y) { + temp = bot; + bot = top; + top = temp; + pm = "r"; + } + e = Geom.bisect(bot, top); + bisector = EdgeList.createHalfEdge(e, pm); + EdgeList.insert(llbnd, bisector); + Geom.endPoint(e, d3_voronoi_opposite[pm], v); + p = Geom.intersect(llbnd, bisector); + if (p) { + EventQueue.del(llbnd); + EventQueue.insert(llbnd, p, Geom.distance(p, bot)); + } + p = Geom.intersect(bisector, rrbnd); + if (p) { + EventQueue.insert(bisector, p, Geom.distance(p, bot)); + } + } else { + break; + } + }//end while + + for (lbnd = EdgeList.right(EdgeList.leftEnd); + lbnd != EdgeList.rightEnd; + lbnd = EdgeList.right(lbnd)) { + callback(lbnd.edge); + } +} +/** +* @param vertices [[x1, y1], [x2, y2], …] +* @returns triangles [[[x1, y1], [x2, y2], [x3, y3]], …] + */ +d3.geom.delaunay = function(vertices) { + var edges = vertices.map(function() { return []; }), + triangles = []; + + // Use the Voronoi tessellation to determine Delaunay edges. + d3_voronoi_tessellate(vertices, function(e) { + edges[e.region.l.index].push(vertices[e.region.r.index]); + }); + + // Reconnect the edges into counterclockwise triangles. + edges.forEach(function(edge, i) { + var v = vertices[i], + cx = v[0], + cy = v[1]; + edge.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + edge.sort(function(a, b) { + return a.angle - b.angle; + }); + for (var j = 0, m = edge.length - 1; j < m; j++) { + triangles.push([v, edge[j], edge[j + 1]]); + } + }); + + return triangles; +}; +// Constructs a new quadtree for the specified array of points. A quadtree is a +// two-dimensional recursive spatial subdivision. This implementation uses +// square partitions, dividing each square into four equally-sized squares. Each +// point exists in a unique node; if multiple points are in the same position, +// some points may be stored on internal nodes rather than leaf nodes. Quadtrees +// can be used to accelerate various spatial operations, such as the Barnes-Hut +// approximation for computing n-body forces, or collision detection. +d3.geom.quadtree = function(points, x1, y1, x2, y2) { + var p, + i = -1, + n = points.length; + + // Type conversion for deprecated API. + if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint); + + // Allow bounds to be specified explicitly. + if (arguments.length < 5) { + if (arguments.length === 3) { + y2 = x2 = y1; + y1 = x1; + } else { + x1 = y1 = Infinity; + x2 = y2 = -Infinity; + + // Compute bounds. + while (++i < n) { + p = points[i]; + if (p.x < x1) x1 = p.x; + if (p.y < y1) y1 = p.y; + if (p.x > x2) x2 = p.x; + if (p.y > y2) y2 = p.y; + } + + // Squarify the bounds. + var dx = x2 - x1, + dy = y2 - y1; + if (dx > dy) y2 = y1 + dx; + else x2 = x1 + dy; + } + } + + // Recursively inserts the specified point p at the node n or one of its + // descendants. The bounds are defined by [x1, x2] and [y1, y2]. + function insert(n, p, x1, y1, x2, y2) { + if (isNaN(p.x) || isNaN(p.y)) return; // ignore invalid points + if (n.leaf) { + var v = n.point; + if (v) { + // If the point at this leaf node is at the same position as the new + // point we are adding, we leave the point associated with the + // internal node while adding the new point to a child node. This + // avoids infinite recursion. + if ((Math.abs(v.x - p.x) + Math.abs(v.y - p.y)) < .01) { + insertChild(n, p, x1, y1, x2, y2); + } else { + n.point = null; + insertChild(n, v, x1, y1, x2, y2); + insertChild(n, p, x1, y1, x2, y2); + } + } else { + n.point = p; + } + } else { + insertChild(n, p, x1, y1, x2, y2); + } + } + + // Recursively inserts the specified point p into a descendant of node n. The + // bounds are defined by [x1, x2] and [y1, y2]. + function insertChild(n, p, x1, y1, x2, y2) { + // Compute the split point, and the quadrant in which to insert p. + var sx = (x1 + x2) * .5, + sy = (y1 + y2) * .5, + right = p.x >= sx, + bottom = p.y >= sy, + i = (bottom << 1) + right; + + // Recursively insert into the child node. + n.leaf = false; + n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); + + // Update the bounds as we recurse. + if (right) x1 = sx; else x2 = sx; + if (bottom) y1 = sy; else y2 = sy; + insert(n, p, x1, y1, x2, y2); + } + + // Create the root node. + var root = d3_geom_quadtreeNode(); + + root.add = function(p) { + insert(root, p, x1, y1, x2, y2); + }; + + root.visit = function(f) { + d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2); + }; + + // Insert all points. + points.forEach(root.add); + return root; +}; + +function d3_geom_quadtreeNode() { + return { + leaf: true, + nodes: [], + point: null + }; +} + +function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { + if (!f(node, x1, y1, x2, y2)) { + var sx = (x1 + x2) * .5, + sy = (y1 + y2) * .5, + children = node.nodes; + if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); + if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); + if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); + if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); + } +} + +function d3_geom_quadtreePoint(p) { + return { + x: p[0], + y: p[1] + }; +} +d3.time = {}; + +var d3_time = Date; + +function d3_time_utc() { + this._ = new Date(arguments.length > 1 + ? Date.UTC.apply(this, arguments) + : arguments[0]); +} + +d3_time_utc.prototype = { + getDate: function() { return this._.getUTCDate(); }, + getDay: function() { return this._.getUTCDay(); }, + getFullYear: function() { return this._.getUTCFullYear(); }, + getHours: function() { return this._.getUTCHours(); }, + getMilliseconds: function() { return this._.getUTCMilliseconds(); }, + getMinutes: function() { return this._.getUTCMinutes(); }, + getMonth: function() { return this._.getUTCMonth(); }, + getSeconds: function() { return this._.getUTCSeconds(); }, + getTime: function() { return this._.getTime(); }, + getTimezoneOffset: function() { return 0; }, + valueOf: function() { return this._.valueOf(); }, + setDate: function() { d3_time_prototype.setUTCDate.apply(this._, arguments); }, + setDay: function() { d3_time_prototype.setUTCDay.apply(this._, arguments); }, + setFullYear: function() { d3_time_prototype.setUTCFullYear.apply(this._, arguments); }, + setHours: function() { d3_time_prototype.setUTCHours.apply(this._, arguments); }, + setMilliseconds: function() { d3_time_prototype.setUTCMilliseconds.apply(this._, arguments); }, + setMinutes: function() { d3_time_prototype.setUTCMinutes.apply(this._, arguments); }, + setMonth: function() { d3_time_prototype.setUTCMonth.apply(this._, arguments); }, + setSeconds: function() { d3_time_prototype.setUTCSeconds.apply(this._, arguments); }, + setTime: function() { d3_time_prototype.setTime.apply(this._, arguments); } +}; + +var d3_time_prototype = Date.prototype; +d3.time.format = function(template) { + var n = template.length; + + function format(date) { + var string = [], + i = -1, + j = 0, + c, + f; + while (++i < n) { + if (template.charCodeAt(i) == 37) { + string.push( + template.substring(j, i), + (f = d3_time_formats[c = template.charAt(++i)]) + ? f(date) : c); + j = i + 1; + } + } + string.push(template.substring(j, i)); + return string.join(""); + } + + format.parse = function(string) { + var d = {y: 1900, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0}, + i = d3_time_parse(d, template, string, 0); + if (i != string.length) return null; + + // The am-pm flag is 0 for AM, and 1 for PM. + if ("p" in d) d.H = d.H % 12 + d.p * 12; + + var date = new d3_time(); + date.setFullYear(d.y, d.m, d.d); + date.setHours(d.H, d.M, d.S, d.L); + return date; + }; + + format.toString = function() { + return template; + }; + + return format; +}; + +function d3_time_parse(date, template, string, j) { + var c, + p, + i = 0, + n = template.length, + m = string.length; + while (i < n) { + if (j >= m) return -1; + c = template.charCodeAt(i++); + if (c == 37) { + p = d3_time_parsers[template.charAt(i++)]; + if (!p || ((j = p(date, string, j)) < 0)) return -1; + } else if (c != string.charCodeAt(j++)) { + return -1; + } + } + return j; +} + +var d3_time_zfill2 = d3.format("02d"), + d3_time_zfill3 = d3.format("03d"), + d3_time_zfill4 = d3.format("04d"), + d3_time_sfill2 = d3.format("2d"); + +var d3_time_formats = { + a: function(d) { return d3_time_weekdays[d.getDay()].substring(0, 3); }, + A: function(d) { return d3_time_weekdays[d.getDay()]; }, + b: function(d) { return d3_time_months[d.getMonth()].substring(0, 3); }, + B: function(d) { return d3_time_months[d.getMonth()]; }, + c: d3.time.format("%a %b %e %H:%M:%S %Y"), + d: function(d) { return d3_time_zfill2(d.getDate()); }, + e: function(d) { return d3_time_sfill2(d.getDate()); }, + H: function(d) { return d3_time_zfill2(d.getHours()); }, + I: function(d) { return d3_time_zfill2(d.getHours() % 12 || 12); }, + j: function(d) { return d3_time_zfill3(1 + d3.time.dayOfYear(d)); }, + L: function(d) { return d3_time_zfill3(d.getMilliseconds()); }, + m: function(d) { return d3_time_zfill2(d.getMonth() + 1); }, + M: function(d) { return d3_time_zfill2(d.getMinutes()); }, + p: function(d) { return d.getHours() >= 12 ? "PM" : "AM"; }, + S: function(d) { return d3_time_zfill2(d.getSeconds()); }, + U: function(d) { return d3_time_zfill2(d3.time.sundayOfYear(d)); }, + w: function(d) { return d.getDay(); }, + W: function(d) { return d3_time_zfill2(d3.time.mondayOfYear(d)); }, + x: d3.time.format("%m/%d/%y"), + X: d3.time.format("%H:%M:%S"), + y: function(d) { return d3_time_zfill2(d.getFullYear() % 100); }, + Y: function(d) { return d3_time_zfill4(d.getFullYear() % 10000); }, + Z: d3_time_zone, + "%": function(d) { return "%"; } +}; + +var d3_time_parsers = { + a: d3_time_parseWeekdayAbbrev, + A: d3_time_parseWeekday, + b: d3_time_parseMonthAbbrev, + B: d3_time_parseMonth, + c: d3_time_parseLocaleFull, + d: d3_time_parseDay, + e: d3_time_parseDay, + H: d3_time_parseHour24, + I: d3_time_parseHour24, + // j: function(d, s, i) { /*TODO day of year [001,366] */ return i; }, + L: d3_time_parseMilliseconds, + m: d3_time_parseMonthNumber, + M: d3_time_parseMinutes, + p: d3_time_parseAmPm, + S: d3_time_parseSeconds, + // U: function(d, s, i) { /*TODO week number (sunday) [00,53] */ return i; }, + // w: function(d, s, i) { /*TODO weekday [0,6] */ return i; }, + // W: function(d, s, i) { /*TODO week number (monday) [00,53] */ return i; }, + x: d3_time_parseLocaleDate, + X: d3_time_parseLocaleTime, + y: d3_time_parseYear, + Y: d3_time_parseFullYear + // , + // Z: function(d, s, i) { /*TODO time zone */ return i; }, + // "%": function(d, s, i) { /*TODO literal % */ return i; } +}; + +// Note: weekday is validated, but does not set the date. +function d3_time_parseWeekdayAbbrev(date, string, i) { + return d3_time_weekdayAbbrevRe.test(string.substring(i, i += 3)) ? i : -1; +} + +// Note: weekday is validated, but does not set the date. +function d3_time_parseWeekday(date, string, i) { + d3_time_weekdayRe.lastIndex = 0; + var n = d3_time_weekdayRe.exec(string.substring(i, i + 10)); + return n ? i += n[0].length : -1; +} + +var d3_time_weekdayAbbrevRe = /^(?:sun|mon|tue|wed|thu|fri|sat)/i, + d3_time_weekdayRe = /^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/i, + d3_time_weekdays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; + +function d3_time_parseMonthAbbrev(date, string, i) { + var n = d3_time_monthAbbrevLookup.get(string.substring(i, i += 3).toLowerCase()); + return n == null ? -1 : (date.m = n, i); +} + +var d3_time_monthAbbrevLookup = d3.map({ + jan: 0, + feb: 1, + mar: 2, + apr: 3, + may: 4, + jun: 5, + jul: 6, + aug: 7, + sep: 8, + oct: 9, + nov: 10, + dec: 11 +}); + +function d3_time_parseMonth(date, string, i) { + d3_time_monthRe.lastIndex = 0; + var n = d3_time_monthRe.exec(string.substring(i, i + 12)); + return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1; +} + +var d3_time_monthRe = /^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig; + +var d3_time_monthLookup = d3.map({ + january: 0, + february: 1, + march: 2, + april: 3, + may: 4, + june: 5, + july: 6, + august: 7, + september: 8, + october: 9, + november: 10, + december: 11 +}); + +var d3_time_months = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" +]; + +function d3_time_parseLocaleFull(date, string, i) { + return d3_time_parse(date, d3_time_formats.c.toString(), string, i); +} + +function d3_time_parseLocaleDate(date, string, i) { + return d3_time_parse(date, d3_time_formats.x.toString(), string, i); +} + +function d3_time_parseLocaleTime(date, string, i) { + return d3_time_parse(date, d3_time_formats.X.toString(), string, i); +} + +function d3_time_parseFullYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 4)); + return n ? (date.y = +n[0], i += n[0].length) : -1; +} + +function d3_time_parseYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.y = d3_time_century() + +n[0], i += n[0].length) : -1; +} + +function d3_time_century() { + return ~~(new Date().getFullYear() / 1000) * 1000; +} + +function d3_time_parseMonthNumber(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.m = n[0] - 1, i += n[0].length) : -1; +} + +function d3_time_parseDay(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.d = +n[0], i += n[0].length) : -1; +} + +// Note: we don't validate that the hour is in the range [0,23] or [1,12]. +function d3_time_parseHour24(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.H = +n[0], i += n[0].length) : -1; +} + +function d3_time_parseMinutes(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.M = +n[0], i += n[0].length) : -1; +} + +function d3_time_parseSeconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.S = +n[0], i += n[0].length) : -1; +} + +function d3_time_parseMilliseconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 3)); + return n ? (date.L = +n[0], i += n[0].length) : -1; +} + +// Note: we don't look at the next directive. +var d3_time_numberRe = /\s*\d+/; + +function d3_time_parseAmPm(date, string, i) { + var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase()); + return n == null ? -1 : (date.p = n, i); +} + +var d3_time_amPmLookup = d3.map({ + am: 0, + pm: 1 +}); + +// TODO table of time zone offset names? +function d3_time_zone(d) { + var z = d.getTimezoneOffset(), + zs = z > 0 ? "-" : "+", + zh = ~~(Math.abs(z) / 60), + zm = Math.abs(z) % 60; + return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm); +} +d3.time.format.utc = function(template) { + var local = d3.time.format(template); + + function format(date) { + try { + d3_time = d3_time_utc; + var utc = new d3_time(); + utc._ = date; + return local(utc); + } finally { + d3_time = Date; + } + } + + format.parse = function(string) { + try { + d3_time = d3_time_utc; + var date = local.parse(string); + return date && date._; + } finally { + d3_time = Date; + } + }; + + format.toString = local.toString; + + return format; +}; +var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ"); + +d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso; + +function d3_time_formatIsoNative(date) { + return date.toISOString(); +} + +d3_time_formatIsoNative.parse = function(string) { + var date = new Date(string); + return isNaN(date) ? null : date; +}; + +d3_time_formatIsoNative.toString = d3_time_formatIso.toString; +function d3_time_interval(local, step, number) { + + function round(date) { + var d0 = local(date), d1 = offset(d0, 1); + return date - d0 < d1 - date ? d0 : d1; + } + + function ceil(date) { + step(date = local(new d3_time(date - 1)), 1); + return date; + } + + function offset(date, k) { + step(date = new d3_time(+date), k); + return date; + } + + function range(t0, t1, dt) { + var time = ceil(t0), times = []; + if (dt > 1) { + while (time < t1) { + if (!(number(time) % dt)) times.push(new Date(+time)); + step(time, 1); + } + } else { + while (time < t1) times.push(new Date(+time)), step(time, 1); + } + return times; + } + + function range_utc(t0, t1, dt) { + try { + d3_time = d3_time_utc; + var utc = new d3_time_utc(); + utc._ = t0; + return range(utc, t1, dt); + } finally { + d3_time = Date; + } + } + + local.floor = local; + local.round = round; + local.ceil = ceil; + local.offset = offset; + local.range = range; + + var utc = local.utc = d3_time_interval_utc(local); + utc.floor = utc; + utc.round = d3_time_interval_utc(round); + utc.ceil = d3_time_interval_utc(ceil); + utc.offset = d3_time_interval_utc(offset); + utc.range = range_utc; + + return local; +} + +function d3_time_interval_utc(method) { + return function(date, k) { + try { + d3_time = d3_time_utc; + var utc = new d3_time_utc(); + utc._ = date; + return method(utc, k)._; + } finally { + d3_time = Date; + } + }; +} +d3.time.second = d3_time_interval(function(date) { + return new d3_time(Math.floor(date / 1e3) * 1e3); +}, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 1e3); // DST breaks setSeconds +}, function(date) { + return date.getSeconds(); +}); + +d3.time.seconds = d3.time.second.range; +d3.time.seconds.utc = d3.time.second.utc.range; +d3.time.minute = d3_time_interval(function(date) { + return new d3_time(Math.floor(date / 6e4) * 6e4); +}, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 6e4); // DST breaks setMinutes +}, function(date) { + return date.getMinutes(); +}); + +d3.time.minutes = d3.time.minute.range; +d3.time.minutes.utc = d3.time.minute.utc.range; +d3.time.hour = d3_time_interval(function(date) { + var timezone = date.getTimezoneOffset() / 60; + return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5); +}, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 36e5); // DST breaks setHours +}, function(date) { + return date.getHours(); +}); + +d3.time.hours = d3.time.hour.range; +d3.time.hours.utc = d3.time.hour.utc.range; +d3.time.day = d3_time_interval(function(date) { + return new d3_time(date.getFullYear(), date.getMonth(), date.getDate()); +}, function(date, offset) { + date.setDate(date.getDate() + offset); +}, function(date) { + return date.getDate() - 1; +}); + +d3.time.days = d3.time.day.range; +d3.time.days.utc = d3.time.day.utc.range; + +d3.time.dayOfYear = function(date) { + var year = d3.time.year(date); + return Math.floor((date - year) / 864e5 - (date.getTimezoneOffset() - year.getTimezoneOffset()) / 1440); +}; +d3_time_weekdays.forEach(function(day, i) { + day = day.toLowerCase(); + i = 7 - i; + + var interval = d3.time[day] = d3_time_interval(function(date) { + (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7); + return date; + }, function(date, offset) { + date.setDate(date.getDate() + Math.floor(offset) * 7); + }, function(date) { + var day = d3.time.year(date).getDay(); + return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i); + }); + + d3.time[day + "s"] = interval.range; + d3.time[day + "s"].utc = interval.utc.range; + + d3.time[day + "OfYear"] = function(date) { + var day = d3.time.year(date).getDay(); + return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7); + }; +}); + +d3.time.week = d3.time.sunday; +d3.time.weeks = d3.time.sunday.range; +d3.time.weeks.utc = d3.time.sunday.utc.range; +d3.time.weekOfYear = d3.time.sundayOfYear; +d3.time.month = d3_time_interval(function(date) { + return new d3_time(date.getFullYear(), date.getMonth(), 1); +}, function(date, offset) { + date.setMonth(date.getMonth() + offset); +}, function(date) { + return date.getMonth(); +}); + +d3.time.months = d3.time.month.range; +d3.time.months.utc = d3.time.month.utc.range; +d3.time.year = d3_time_interval(function(date) { + return new d3_time(date.getFullYear(), 0, 1); +}, function(date, offset) { + date.setFullYear(date.getFullYear() + offset); +}, function(date) { + return date.getFullYear(); +}); + +d3.time.years = d3.time.year.range; +d3.time.years.utc = d3.time.year.utc.range; +function d3_time_scale(linear, methods, format) { + + function scale(x) { + return linear(x); + } + + scale.invert = function(x) { + return d3_time_scaleDate(linear.invert(x)); + }; + + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(d3_time_scaleDate); + linear.domain(x); + return scale; + }; + + scale.nice = function(m) { + var extent = d3_time_scaleExtent(scale.domain()); + return scale.domain([m.floor(extent[0]), m.ceil(extent[1])]); + }; + + scale.ticks = function(m, k) { + var extent = d3_time_scaleExtent(scale.domain()); + if (typeof m !== "function") { + var span = extent[1] - extent[0], + target = span / m, + i = d3.bisect(d3_time_scaleSteps, target); + if (i == d3_time_scaleSteps.length) return methods.year(extent, m); + if (!i) return linear.ticks(m).map(d3_time_scaleDate); + if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i; + m = methods[i]; + k = m[1]; + m = m[0].range; + } + return m(extent[0], new Date(+extent[1] + 1), k); // inclusive upper bound + }; + + scale.tickFormat = function() { + return format; + }; + + scale.copy = function() { + return d3_time_scale(linear.copy(), methods, format); + }; + + // TOOD expose d3_scale_linear_rebind? + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); +} + +// TODO expose d3_scaleExtent? +function d3_time_scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [start, stop] : [stop, start]; +} + +function d3_time_scaleDate(t) { + return new Date(t); +} + +function d3_time_scaleFormat(formats) { + return function(date) { + var i = formats.length - 1, f = formats[i]; + while (!f[1](date)) f = formats[--i]; + return f[0](date); + }; +} + +function d3_time_scaleSetYear(y) { + var d = new Date(y, 0, 1); + d.setFullYear(y); // Y2K fail + return d; +} + +function d3_time_scaleGetYear(d) { + var y = d.getFullYear(), + d0 = d3_time_scaleSetYear(y), + d1 = d3_time_scaleSetYear(y + 1); + return y + (d - d0) / (d1 - d0); +} + +var d3_time_scaleSteps = [ + 1e3, // 1-second + 5e3, // 5-second + 15e3, // 15-second + 3e4, // 30-second + 6e4, // 1-minute + 3e5, // 5-minute + 9e5, // 15-minute + 18e5, // 30-minute + 36e5, // 1-hour + 108e5, // 3-hour + 216e5, // 6-hour + 432e5, // 12-hour + 864e5, // 1-day + 1728e5, // 2-day + 6048e5, // 1-week + 2592e6, // 1-month + 7776e6, // 3-month + 31536e6 // 1-year +]; + +var d3_time_scaleLocalMethods = [ + [d3.time.second, 1], + [d3.time.second, 5], + [d3.time.second, 15], + [d3.time.second, 30], + [d3.time.minute, 1], + [d3.time.minute, 5], + [d3.time.minute, 15], + [d3.time.minute, 30], + [d3.time.hour, 1], + [d3.time.hour, 3], + [d3.time.hour, 6], + [d3.time.hour, 12], + [d3.time.day, 1], + [d3.time.day, 2], + [d3.time.week, 1], + [d3.time.month, 1], + [d3.time.month, 3], + [d3.time.year, 1] +]; + +var d3_time_scaleLocalFormats = [ + [d3.time.format("%Y"), function(d) { return true; }], + [d3.time.format("%B"), function(d) { return d.getMonth(); }], + [d3.time.format("%b %d"), function(d) { return d.getDate() != 1; }], + [d3.time.format("%a %d"), function(d) { return d.getDay() && d.getDate() != 1; }], + [d3.time.format("%I %p"), function(d) { return d.getHours(); }], + [d3.time.format("%I:%M"), function(d) { return d.getMinutes(); }], + [d3.time.format(":%S"), function(d) { return d.getSeconds(); }], + [d3.time.format(".%L"), function(d) { return d.getMilliseconds(); }] +]; + +var d3_time_scaleLinear = d3.scale.linear(), + d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats); + +d3_time_scaleLocalMethods.year = function(extent, m) { + return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear); +}; + +d3.time.scale = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat); +}; +var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) { + return [m[0].utc, m[1]]; +}); + +var d3_time_scaleUTCFormats = [ + [d3.time.format.utc("%Y"), function(d) { return true; }], + [d3.time.format.utc("%B"), function(d) { return d.getUTCMonth(); }], + [d3.time.format.utc("%b %d"), function(d) { return d.getUTCDate() != 1; }], + [d3.time.format.utc("%a %d"), function(d) { return d.getUTCDay() && d.getUTCDate() != 1; }], + [d3.time.format.utc("%I %p"), function(d) { return d.getUTCHours(); }], + [d3.time.format.utc("%I:%M"), function(d) { return d.getUTCMinutes(); }], + [d3.time.format.utc(":%S"), function(d) { return d.getUTCSeconds(); }], + [d3.time.format.utc(".%L"), function(d) { return d.getUTCMilliseconds(); }] +]; + +var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats); + +function d3_time_scaleUTCSetYear(y) { + var d = new Date(Date.UTC(y, 0, 1)); + d.setUTCFullYear(y); // Y2K fail + return d; +} + +function d3_time_scaleUTCGetYear(d) { + var y = d.getUTCFullYear(), + d0 = d3_time_scaleUTCSetYear(y), + d1 = d3_time_scaleUTCSetYear(y + 1); + return y + (d - d0) / (d1 - d0); +} + +d3_time_scaleUTCMethods.year = function(extent, m) { + return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear); +}; + +d3.time.scale.utc = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat); +}; +})(); diff --git a/projects/Data Visualization Software Java Project/Data Visualization/jquery.min.js b/projects/Data Visualization Software Java Project/Data Visualization/jquery.min.js new file mode 100644 index 0000000..c941a5f --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/jquery.min.js @@ -0,0 +1,166 @@ +/*! + * jQuery JavaScript Library v1.4.3 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Thu Oct 14 23:10:06 2010 -0400 + */ +(function(E,A){function U(){return false}function ba(){return true}function ja(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ga(a){var b,d,e=[],f=[],h,k,l,n,s,v,B,D;k=c.data(this,this.nodeType?"events":"__events__");if(typeof k==="function")k=k.events;if(!(a.liveFired===this||!k||!k.live||a.button&&a.type==="click")){if(a.namespace)D=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var H=k.live.slice(0);for(n=0;nd)break;a.currentTarget=f.elem;a.data=f.handleObj.data; +a.handleObj=f.handleObj;D=f.handleObj.origHandler.apply(f.elem,arguments);if(D===false||a.isPropagationStopped()){d=f.level;if(D===false)b=false}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(Ha,"`").replace(Ia,"&")}function ka(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Ja.test(b))return c.filter(b, +e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function la(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this,e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var k in e[h])c.event.add(this,h,e[h][k],e[h][k].data)}}})}function Ka(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)} +function ma(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?La:Ma,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function ca(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Na.test(a)?e(a,h):ca(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)? +e(a,""):c.each(b,function(f,h){ca(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(na.concat.apply([],na.slice(0,b)),function(){d[this]=a});return d}function oa(a){if(!da[a]){var b=c("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";da[a]=d}return da[a]}function ea(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var u=E.document,c=function(){function a(){if(!b.isReady){try{u.documentElement.doScroll("left")}catch(i){setTimeout(a, +1);return}b.ready()}}var b=function(i,r){return new b.fn.init(i,r)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,k=/\S/,l=/^\s+/,n=/\s+$/,s=/\W/,v=/\d/,B=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,D=/^[\],:{}\s]*$/,H=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,G=/(?:^|:|,)(?:\s*\[)+/g,M=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,j=/(msie) ([\w.]+)/,o=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false, +q=[],t,x=Object.prototype.toString,C=Object.prototype.hasOwnProperty,P=Array.prototype.push,N=Array.prototype.slice,R=String.prototype.trim,Q=Array.prototype.indexOf,L={};b.fn=b.prototype={init:function(i,r){var y,z,F;if(!i)return this;if(i.nodeType){this.context=this[0]=i;this.length=1;return this}if(i==="body"&&!r&&u.body){this.context=u;this[0]=u.body;this.selector="body";this.length=1;return this}if(typeof i==="string")if((y=h.exec(i))&&(y[1]||!r))if(y[1]){F=r?r.ownerDocument||r:u;if(z=B.exec(i))if(b.isPlainObject(r)){i= +[u.createElement(z[1])];b.fn.attr.call(i,r,true)}else i=[F.createElement(z[1])];else{z=b.buildFragment([y[1]],[F]);i=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this,i)}else{if((z=u.getElementById(y[2]))&&z.parentNode){if(z.id!==y[2])return f.find(i);this.length=1;this[0]=z}this.context=u;this.selector=i;return this}else if(!r&&!s.test(i)){this.selector=i;this.context=u;i=u.getElementsByTagName(i);return b.merge(this,i)}else return!r||r.jquery?(r||f).find(i):b(r).find(i); +else if(b.isFunction(i))return f.ready(i);if(i.selector!==A){this.selector=i.selector;this.context=i.context}return b.makeArray(i,this)},selector:"",jquery:"1.4.3",length:0,size:function(){return this.length},toArray:function(){return N.call(this,0)},get:function(i){return i==null?this.toArray():i<0?this.slice(i)[0]:this[i]},pushStack:function(i,r,y){var z=b();b.isArray(i)?P.apply(z,i):b.merge(z,i);z.prevObject=this;z.context=this.context;if(r==="find")z.selector=this.selector+(this.selector?" ": +"")+y;else if(r)z.selector=this.selector+"."+r+"("+y+")";return z},each:function(i,r){return b.each(this,i,r)},ready:function(i){b.bindReady();if(b.isReady)i.call(u,b);else q&&q.push(i);return this},eq:function(i){return i===-1?this.slice(i):this.slice(i,+i+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(i){return this.pushStack(b.map(this,function(r,y){return i.call(r, +y,r)}))},end:function(){return this.prevObject||b(null)},push:P,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var i=arguments[0]||{},r=1,y=arguments.length,z=false,F,I,K,J,fa;if(typeof i==="boolean"){z=i;i=arguments[1]||{};r=2}if(typeof i!=="object"&&!b.isFunction(i))i={};if(y===r){i=this;--r}for(;r0)){if(q){for(var r=0;i=q[r++];)i.call(u,b);q=null}b.fn.triggerHandler&&b(u).triggerHandler("ready")}}},bindReady:function(){if(!p){p=true;if(u.readyState==="complete")return setTimeout(b.ready, +1);if(u.addEventListener){u.addEventListener("DOMContentLoaded",t,false);E.addEventListener("load",b.ready,false)}else if(u.attachEvent){u.attachEvent("onreadystatechange",t);E.attachEvent("onload",b.ready);var i=false;try{i=E.frameElement==null}catch(r){}u.documentElement.doScroll&&i&&a()}}},isFunction:function(i){return b.type(i)==="function"},isArray:Array.isArray||function(i){return b.type(i)==="array"},isWindow:function(i){return i&&typeof i==="object"&&"setInterval"in i},isNaN:function(i){return i== +null||!v.test(i)||isNaN(i)},type:function(i){return i==null?String(i):L[x.call(i)]||"object"},isPlainObject:function(i){if(!i||b.type(i)!=="object"||i.nodeType||b.isWindow(i))return false;if(i.constructor&&!C.call(i,"constructor")&&!C.call(i.constructor.prototype,"isPrototypeOf"))return false;for(var r in i);return r===A||C.call(i,r)},isEmptyObject:function(i){for(var r in i)return false;return true},error:function(i){throw i;},parseJSON:function(i){if(typeof i!=="string"||!i)return null;i=b.trim(i); +if(D.test(i.replace(H,"@").replace(w,"]").replace(G,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(i):(new Function("return "+i))();else b.error("Invalid JSON: "+i)},noop:function(){},globalEval:function(i){if(i&&k.test(i)){var r=u.getElementsByTagName("head")[0]||u.documentElement,y=u.createElement("script");y.type="text/javascript";if(b.support.scriptEval)y.appendChild(u.createTextNode(i));else y.text=i;r.insertBefore(y,r.firstChild);r.removeChild(y)}},nodeName:function(i,r){return i.nodeName&&i.nodeName.toUpperCase()=== +r.toUpperCase()},each:function(i,r,y){var z,F=0,I=i.length,K=I===A||b.isFunction(i);if(y)if(K)for(z in i){if(r.apply(i[z],y)===false)break}else for(;F";a=u.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var s=u.createElement("div"); +s.style.width=s.style.paddingLeft="1px";u.body.appendChild(s);c.boxModel=c.support.boxModel=s.offsetWidth===2;if("zoom"in s.style){s.style.display="inline";s.style.zoom=1;c.support.inlineBlockNeedsLayout=s.offsetWidth===2;s.style.display="";s.innerHTML="
";c.support.shrinkWrapBlocks=s.offsetWidth!==2}s.innerHTML="
t
";var v=s.getElementsByTagName("td");c.support.reliableHiddenOffsets=v[0].offsetHeight=== +0;v[0].style.display="";v[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&v[0].offsetHeight===0;s.innerHTML="";u.body.removeChild(s).style.display="none"});a=function(s){var v=u.createElement("div");s="on"+s;var B=s in v;if(!B){v.setAttribute(s,"return;");B=typeof v[s]==="function"}return B};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength", +cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var pa={},Oa=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?pa:a;var e=a.nodeType,f=e?a[c.expando]:null,h=c.cache;if(!(e&&!f&&typeof b==="string"&&d===A)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]= +c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==A)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?pa:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);else if(d)delete f[e];else for(var k in a)delete a[k]}},acceptData:function(a){if(a.nodeName){var b= +c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){if(typeof a==="undefined")return this.length?c.data(this[0]):null;else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===A){var e=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(e===A&&this.length){e=c.data(this[0],a);if(e===A&&this[0].nodeType===1){e=this[0].getAttribute("data-"+a);if(typeof e=== +"string")try{e=e==="true"?true:e==="false"?false:e==="null"?null:!c.isNaN(e)?parseFloat(e):Oa.test(e)?c.parseJSON(e):e}catch(f){}else e=A}}return e===A&&d[1]?this.data(d[0]):e}else return this.each(function(){var h=c(this),k=[d[0],b];h.triggerHandler("setData"+d[1]+"!",k);c.data(this,a,b);h.triggerHandler("changeData"+d[1]+"!",k)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var e=c.data(a,b);if(!d)return e|| +[];if(!e||c.isArray(d))e=c.data(a,b,c.makeArray(d));else e.push(d);return e}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.shift();if(e==="inprogress")e=d.shift();if(e){b==="fx"&&d.unshift("inprogress");e.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===A)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this, +a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var qa=/[\n\t]/g,ga=/\s+/,Pa=/\r/g,Qa=/^(?:href|src|style)$/,Ra=/^(?:button|input)$/i,Sa=/^(?:button|input|object|select|textarea)$/i,Ta=/^a(?:rea)?$/i,ra=/^(?:radio|checkbox)$/i;c.fn.extend({attr:function(a,b){return c.access(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this, +a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(s){var v=c(this);v.addClass(a.call(this,s,v.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ga),d=0,e=this.length;d-1)return true;return false}, +val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one";if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h=0;else if(c.nodeName(this,"select")){var B=c.makeArray(v);c("option",this).each(function(){this.selected= +c.inArray(c(this).val(),B)>=0});if(!B.length)this.selectedIndex=-1}else this.value=v}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return A;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==A;b=e&&c.props[b]||b;if(a.nodeType===1){var h=Qa.test(b);if((b in a||a[b]!==A)&&e&&!h){if(f){b==="type"&&Ra.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); +if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Sa.test(a.nodeName)||Ta.test(a.nodeName)&&a.href?0:A;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return A;a=!c.support.hrefNormalized&&e&& +h?a.getAttribute(b,2):a.getAttribute(b);return a===null?A:a}}});var X=/\.(.*)$/,ha=/^(?:textarea|input|select)$/i,Ha=/\./g,Ia=/ /g,Ua=/[^\w\s.|`]/g,Va=function(a){return a.replace(Ua,"\\$&")},sa={focusin:0,focusout:0};c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var k=a.nodeType?"events":"__events__",l=h[k],n=h.handle;if(typeof l=== +"function"){n=l.handle;l=l.events}else if(!l){a.nodeType||(h[k]=h=function(){});h.events=l={}}if(!n)h.handle=n=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(n.elem,arguments):A};n.elem=a;b=b.split(" ");for(var s=0,v;k=b[s++];){h=f?c.extend({},f):{handler:d,data:e};if(k.indexOf(".")>-1){v=k.split(".");k=v.shift();h.namespace=v.slice(0).sort().join(".")}else{v=[];h.namespace=""}h.type=k;if(!h.guid)h.guid=d.guid;var B=l[k],D=c.event.special[k]||{};if(!B){B=l[k]=[]; +if(!D.setup||D.setup.call(a,e,v,n)===false)if(a.addEventListener)a.addEventListener(k,n,false);else a.attachEvent&&a.attachEvent("on"+k,n)}if(D.add){D.add.call(a,h);if(!h.handler.guid)h.handler.guid=d.guid}B.push(h);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,k=0,l,n,s,v,B,D,H=a.nodeType?"events":"__events__",w=c.data(a),G=w&&w[H];if(w&&G){if(typeof G==="function"){w=G;G=G.events}if(b&&b.type){d=b.handler;b=b.type}if(!b|| +typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in G)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[k++];){v=f;l=f.indexOf(".")<0;n=[];if(!l){n=f.split(".");f=n.shift();s=RegExp("(^|\\.)"+c.map(n.slice(0).sort(),Va).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(B=G[f])if(d){v=c.event.special[f]||{};for(h=e||0;h=0){a.type= +f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return A;a.result=A;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)=== +false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){e=a.target;var k,l=f.replace(X,""),n=c.nodeName(e,"a")&&l==="click",s=c.event.special[l]||{};if((!s._default||s._default.call(d,a)===false)&&!n&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[l]){if(k=e["on"+l])e["on"+l]=null;c.event.triggered=true;e[l]()}}catch(v){}if(k)e["on"+l]=k;c.event.triggered=false}}},handle:function(a){var b,d,e; +d=[];var f,h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var k=d.length;f-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ha.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=va(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===A||f===e))if(e!=null||f){a.type="change";a.liveFired= +A;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",va(a))}},setup:function(){if(this.type=== +"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ha.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ha.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}u.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){sa[b]++===0&&u.addEventListener(a,d,true)},teardown:function(){--sa[b]=== +0&&u.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=A}var k=b==="one"?c.proxy(f,function(n){c(this).unbind(n,k);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var l=this.length;h0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}}); +(function(){function a(g,j,o,m,p,q){p=0;for(var t=m.length;p0){C=x;break}}x=x[g]}m[p]=C}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,k=true;[0,0].sort(function(){k=false;return 0});var l=function(g,j,o,m){o=o||[];var p=j=j||u;if(j.nodeType!==1&&j.nodeType!==9)return[];if(!g||typeof g!=="string")return o;var q=[],t,x,C,P,N=true,R=l.isXML(j),Q=g,L;do{d.exec("");if(t=d.exec(Q)){Q=t[3];q.push(t[1]);if(t[2]){P=t[3]; +break}}}while(t);if(q.length>1&&s.exec(g))if(q.length===2&&n.relative[q[0]])x=M(q[0]+q[1],j);else for(x=n.relative[q[0]]?[j]:l(q.shift(),j);q.length;){g=q.shift();if(n.relative[g])g+=q.shift();x=M(g,x)}else{if(!m&&q.length>1&&j.nodeType===9&&!R&&n.match.ID.test(q[0])&&!n.match.ID.test(q[q.length-1])){t=l.find(q.shift(),j,R);j=t.expr?l.filter(t.expr,t.set)[0]:t.set[0]}if(j){t=m?{expr:q.pop(),set:D(m)}:l.find(q.pop(),q.length===1&&(q[0]==="~"||q[0]==="+")&&j.parentNode?j.parentNode:j,R);x=t.expr?l.filter(t.expr, +t.set):t.set;if(q.length>0)C=D(x);else N=false;for(;q.length;){t=L=q.pop();if(n.relative[L])t=q.pop();else L="";if(t==null)t=j;n.relative[L](C,t,R)}}else C=[]}C||(C=x);C||l.error(L||g);if(f.call(C)==="[object Array]")if(N)if(j&&j.nodeType===1)for(g=0;C[g]!=null;g++){if(C[g]&&(C[g]===true||C[g].nodeType===1&&l.contains(j,C[g])))o.push(x[g])}else for(g=0;C[g]!=null;g++)C[g]&&C[g].nodeType===1&&o.push(x[g]);else o.push.apply(o,C);else D(C,o);if(P){l(P,p,o,m);l.uniqueSort(o)}return o};l.uniqueSort=function(g){if(w){h= +k;g.sort(w);if(h)for(var j=1;j0};l.find=function(g,j,o){var m;if(!g)return[];for(var p=0,q=n.order.length;p":function(g,j){var o=typeof j==="string",m,p=0,q=g.length;if(o&&!/\W/.test(j))for(j=j.toLowerCase();p=0))o||m.push(t);else if(o)j[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var j=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=j[1]+(j[2]||1)-0;g[3]=j[3]-0}g[0]=e++;return g},ATTR:function(g,j,o, +m,p,q){j=g[1].replace(/\\/g,"");if(!q&&n.attrMap[j])g[1]=n.attrMap[j];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,j,o,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=l(g[3],null,null,j);else{g=l.filter(g[3],j,o,true^p);o||m.push.apply(m,g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled=== +true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,j,o){return!!l(o[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"=== +g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,j){return j===0},last:function(g,j,o,m){return j===m.length-1},even:function(g,j){return j%2===0},odd:function(g,j){return j%2===1},lt:function(g,j,o){return jo[3]-0},nth:function(g,j,o){return o[3]- +0===j},eq:function(g,j,o){return o[3]-0===j}},filter:{PSEUDO:function(g,j,o,m){var p=j[1],q=n.filters[p];if(q)return q(g,o,j,m);else if(p==="contains")return(g.textContent||g.innerText||l.getText([g])||"").indexOf(j[3])>=0;else if(p==="not"){j=j[3];o=0;for(m=j.length;o=0}},ID:function(g,j){return g.nodeType===1&&g.getAttribute("id")===j},TAG:function(g,j){return j==="*"&&g.nodeType===1||g.nodeName.toLowerCase()=== +j},CLASS:function(g,j){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(j)>-1},ATTR:function(g,j){var o=j[1];o=n.attrHandle[o]?n.attrHandle[o](g):g[o]!=null?g[o]:g.getAttribute(o);var m=o+"",p=j[2],q=j[4];return o==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&o!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,j,o,m){var p=n.setFilters[j[2]]; +if(p)return p(g,o,j,m)}}},s=n.match.POS,v=function(g,j){return"\\"+(j-0+1)},B;for(B in n.match){n.match[B]=RegExp(n.match[B].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[B]=RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[B].source.replace(/\\(\d+)/g,v))}var D=function(g,j){g=Array.prototype.slice.call(g,0);if(j){j.push.apply(j,g);return j}return g};try{Array.prototype.slice.call(u.documentElement.childNodes,0)}catch(H){D=function(g,j){var o=j||[],m=0;if(f.call(g)==="[object Array]")Array.prototype.push.apply(o, +g);else if(typeof g.length==="number")for(var p=g.length;m";var o=u.documentElement;o.insertBefore(g,o.firstChild);if(u.getElementById(j)){n.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:A:[]};n.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}o.removeChild(g); +o=g=null})();(function(){var g=u.createElement("div");g.appendChild(u.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(j,o){var m=o.getElementsByTagName(j[1]);if(j[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(j){return j.getAttribute("href",2)};g=null})();u.querySelectorAll&& +function(){var g=l,j=u.createElement("div");j.innerHTML="

";if(!(j.querySelectorAll&&j.querySelectorAll(".TEST").length===0)){l=function(m,p,q,t){p=p||u;if(!t&&!l.isXML(p))if(p.nodeType===9)try{return D(p.querySelectorAll(m),q)}catch(x){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var C=p.id,P=p.id="__sizzle__";try{return D(p.querySelectorAll("#"+P+" "+m),q)}catch(N){}finally{if(C)p.id=C;else p.removeAttribute("id")}}return g(m,p,q,t)};for(var o in g)l[o]=g[o]; +j=null}}();(function(){var g=u.documentElement,j=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,o=false;try{j.call(u.documentElement,":sizzle")}catch(m){o=true}if(j)l.matchesSelector=function(p,q){try{if(o||!n.match.PSEUDO.test(q))return j.call(p,q)}catch(t){}return l(q,null,null,[p]).length>0}})();(function(){var g=u.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length=== +0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(j,o,m){if(typeof o.getElementsByClassName!=="undefined"&&!m)return o.getElementsByClassName(j[1])};g=null}}})();l.contains=u.documentElement.contains?function(g,j){return g!==j&&(g.contains?g.contains(j):true)}:function(g,j){return!!(g.compareDocumentPosition(j)&16)};l.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var M=function(g, +j){for(var o=[],m="",p,q=j.nodeType?[j]:j;p=n.match.PSEUDO.exec(g);){m+=p[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;p=0;for(var t=q.length;p0)for(var h=d;h0},closest:function(a, +b){var d=[],e,f,h=this[0];if(c.isArray(a)){var k={},l,n=1;if(h&&a.length){e=0;for(f=a.length;e-1:c(h).is(e))d.push({selector:l,elem:h,level:n})}h=h.parentNode;n++}}return d}k=$a.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h|| +!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context):c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}}); +c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling", +d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Wa.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||Ya.test(e))&&Xa.test(a))f=f.reverse();return this.pushStack(f,a,Za.call(arguments).join(","))}}); +c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===A||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var xa=/ jQuery\d+="(?:\d+|null)"/g, +$=/^\s+/,ya=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,za=/<([\w:]+)/,ab=/\s]+\/)>/g,O={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"], +area:[1,"",""],_default:[0,"",""]};O.optgroup=O.option;O.tbody=O.tfoot=O.colgroup=O.caption=O.thead;O.th=O.td;if(!c.support.htmlSerialize)O._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==A)return this.empty().append((this[0]&&this[0].ownerDocument||u).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this, +d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})}, +unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a= +c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*")); +c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(xa,"").replace(cb,'="$1">').replace($, +"")],e)[0]}else return this.cloneNode(true)});if(a===true){la(this,b);la(this.find("*"),b.find("*"))}return b},html:function(a){if(a===A)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(xa,""):null;else if(typeof a==="string"&&!Aa.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!O[(za.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ya,"<$1>");try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?l.cloneNode(true):l)}k.length&&c.each(k,Ka)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:u;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===u&&!Aa.test(a[0])&&(c.support.checkClone|| +!Ba.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h= +d.length;f0?this.clone(true):this).get();c(d[f])[b](k);e=e.concat(k)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||u;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||u;for(var f=[],h=0,k;(k=a[h])!=null;h++){if(typeof k==="number")k+="";if(k){if(typeof k==="string"&&!bb.test(k))k=b.createTextNode(k);else if(typeof k==="string"){k=k.replace(ya,"<$1>");var l=(za.exec(k)||["",""])[1].toLowerCase(),n=O[l]||O._default, +s=n[0],v=b.createElement("div");for(v.innerHTML=n[1]+k+n[2];s--;)v=v.lastChild;if(!c.support.tbody){s=ab.test(k);l=l==="table"&&!s?v.firstChild&&v.firstChild.childNodes:n[1]===""&&!s?v.childNodes:[];for(n=l.length-1;n>=0;--n)c.nodeName(l[n],"tbody")&&!l[n].childNodes.length&&l[n].parentNode.removeChild(l[n])}!c.support.leadingWhitespace&&$.test(k)&&v.insertBefore(b.createTextNode($.exec(k)[0]),v.firstChild);k=v.childNodes}if(k.nodeType)f.push(k);else f=c.merge(f,k)}}if(d)for(h=0;f[h];h++)if(e&& +c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script"))));d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,k=0,l;(l=a[k])!=null;k++)if(!(l.nodeName&&c.noData[l.nodeName.toLowerCase()]))if(d=l[c.expando]){if((b=e[d])&&b.events)for(var n in b.events)f[n]? +c.event.remove(l,n):c.removeEvent(l,n,b.handle);if(h)delete l[c.expando];else l.removeAttribute&&l.removeAttribute(c.expando);delete e[d]}}});var Ca=/alpha\([^)]*\)/i,db=/opacity=([^)]*)/,eb=/-([a-z])/ig,fb=/([A-Z])/g,Da=/^-?\d+(?:px)?$/i,gb=/^-?\d/,hb={position:"absolute",visibility:"hidden",display:"block"},La=["Left","Right"],Ma=["Top","Bottom"],W,ib=u.defaultView&&u.defaultView.getComputedStyle,jb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===A)return this; +return c.access(this,a,b,true,function(d,e,f){return f!==A?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),k=a.style,l=c.cssHooks[h];b=c.cssProps[h]|| +h;if(d!==A){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!l||!("set"in l)||(d=l.set(a,d))!==A)try{k[b]=d}catch(n){}}}else{if(l&&"get"in l&&(f=l.get(a,false,e))!==A)return f;return k[b]}}},css:function(a,b,d){var e,f=c.camelCase(b),h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==A)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]= +e[f]},camelCase:function(a){return a.replace(eb,jb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=ma(d,b,f);else c.swap(d,hb,function(){h=ma(d,b,f)});return h+"px"}},set:function(d,e){if(Da.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return db.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"": +b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f=d.filter||"";d.filter=Ca.test(f)?f.replace(Ca,e):d.filter+" "+e}};if(ib)W=function(a,b,d){var e;d=d.replace(fb,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return A;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};else if(u.documentElement.currentStyle)W=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b], +h=a.style;if(!Da.test(f)&&gb.test(f)){d=h.left;e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f};if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var kb=c.now(),lb=/)<[^<]*)*<\/script>/gi, +mb=/^(?:select|textarea)/i,nb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ob=/^(?:GET|HEAD|DELETE)$/,Na=/\[\]$/,T=/\=\?(&|$)/,ia=/\?/,pb=/([?&])_=[^&]*/,qb=/^(\w+:)?\/\/([^\/?#]+)/,rb=/%20/g,sb=/#.*$/,Ea=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ea)return Ea.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d= +b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(k,l){if(l==="success"||l==="notmodified")h.html(f?c("
").append(k.responseText.replace(lb,"")).find(f):k.responseText);d&&h.each(d,[k.responseText,l,k])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&& +!this.disabled&&(this.checked||mb.test(this.nodeName)||nb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})}, +getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html", +script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),k=ob.test(h);b.url=b.url.replace(sb,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ia.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data|| +!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+kb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var l=E[d];E[d]=function(m){f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);if(c.isFunction(l))l(m);else{E[d]=A;try{delete E[d]}catch(p){}}v&&v.removeChild(B)}}if(b.dataType==="script"&&b.cache===null)b.cache= +false;if(b.cache===false&&h==="GET"){var n=c.now(),s=b.url.replace(pb,"$1_="+n);b.url=s+(s===b.url?(ia.test(b.url)?"&":"?")+"_="+n:"")}if(b.data&&h==="GET")b.url+=(ia.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");n=(n=qb.exec(b.url))&&(n[1]&&n[1]!==location.protocol||n[2]!==location.host);if(b.dataType==="script"&&h==="GET"&&n){var v=u.getElementsByTagName("head")[0]||u.documentElement,B=u.createElement("script");if(b.scriptCharset)B.charset=b.scriptCharset;B.src= +b.url;if(!d){var D=false;B.onload=B.onreadystatechange=function(){if(!D&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){D=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);B.onload=B.onreadystatechange=null;v&&B.parentNode&&v.removeChild(B)}}}v.insertBefore(B,v.firstChild);return A}var H=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!k||a&&a.contentType)w.setRequestHeader("Content-Type", +b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}n||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(G){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&& +c.triggerGlobal(b,"ajaxSend",[w,b]);var M=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){H||c.handleComplete(b,w,e,f);H=true;if(w)w.onreadystatechange=c.noop}else if(!H&&w&&(w.readyState===4||m==="timeout")){H=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d|| +c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&g.call&&g.call(w);M("abort")}}catch(j){}b.async&&b.timeout>0&&setTimeout(function(){w&&!H&&M("timeout")},b.timeout);try{w.send(k||b.data==null?null:b.data)}catch(o){c.handleError(b,w,null,o);c.handleComplete(b,w,e,f)}b.async||M();return w}},param:function(a,b){var d=[],e=function(h,k){k=c.isFunction(k)?k():k;d[d.length]=encodeURIComponent(h)+ +"="+encodeURIComponent(k)};if(b===A)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)ca(f,a[f],b,e);return d.join("&").replace(rb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess",[b,a])},handleComplete:function(a, +b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),e=a.getResponseHeader("Etag"); +if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}});if(E.ActiveXObject)c.ajaxSettings.xhr= +function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var da={},tb=/^(?:toggle|show|hide)$/,ub=/^([+\-]=)?([\d+.\-]+)(.*)$/,aa,na=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show",3),a,b,d);else{a= +0;for(b=this.length;a=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b, +d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a* +Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(h){return f.step(h)} +this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;var f=this;a=c.fx;e.elem=this.elem;if(e()&&c.timers.push(e)&&!aa)aa=setInterval(a.tick,a.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true; +this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(l,n){f.style["overflow"+n]=h.overflow[l]})}this.options.hide&&c(this.elem).hide();if(this.options.hide|| +this.options.show)for(var k in this.options.curAnim)c.style(this.elem,k,this.options.orig[k]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a= +c.timers,b=0;b-1;e={};var s={};if(n)s=f.position();k=n?s.top:parseInt(k,10)||0;l=n?s.left:parseInt(l,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+k;if(b.left!=null)e.left=b.left-h.left+l;"using"in b?b.using.call(a, +e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Fa.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||u.body;a&&!Fa.test(a.nodeName)&& +c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==A)return this.each(function(){if(h=ea(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=ea(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase(); +c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(h){var k=c(this);k[d](e.call(this,h,k[d]()))});return c.isWindow(f)?f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b]:f.nodeType===9?Math.max(f.documentElement["client"+ +b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]):e===A?parseFloat(c.css(f,d)):this.css(d,typeof e==="string"?e:e+"px")}})})(window); diff --git a/projects/Data Visualization Software Java Project/Data Visualization/label-test.html b/projects/Data Visualization Software Java Project/Data Visualization/label-test.html new file mode 100644 index 0000000..1c65d61 --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/label-test.html @@ -0,0 +1,88 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/projects/Data Visualization Software Java Project/Data Visualization/label-test2.html b/projects/Data Visualization Software Java Project/Data Visualization/label-test2.html new file mode 100644 index 0000000..ebb3760 --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/label-test2.html @@ -0,0 +1,133 @@ + + + + + Force based label placement + + + + + + + + \ No newline at end of file diff --git a/projects/Data Visualization Software Java Project/Data Visualization/label-test3.html b/projects/Data Visualization Software Java Project/Data Visualization/label-test3.html new file mode 100644 index 0000000..6d90fa3 --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/label-test3.html @@ -0,0 +1,162 @@ + + + + + Force based label placement + + + + + + + + + + \ No newline at end of file diff --git a/projects/Data Visualization Software Java Project/Data Visualization/preprocess.js b/projects/Data Visualization Software Java Project/Data Visualization/preprocess.js new file mode 100644 index 0000000..cdc404c --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/preprocess.js @@ -0,0 +1,61 @@ +(function() { + preprocess = { + + // Lazily construct the package hierarchy from class names. + nodes: function(pairs) { + var map = {}; + + function find(name, data) { + var node = map[name]; + if (!node) { + node = map[name] = {name: name, children: []}; + if (name.length){ + node.parent = find(""); + node.parent.children.push(node); + } + } + if (data != undefined && data.target.length) { + node.children.push({name: data.target, children: [], country: data.Country, dvalue: data.DollarValue, parent: node}) + } + return node; + } + + pairs.forEach(function(d) { + find(d.source, d); + }); + + return map[""].children; + }, + + // Return a list of imports for the given array of nodes. + links: function(nodes) { + var map = {}, + link = []; + + // Compute a map from name to node. + nodes.forEach(function(d) { + map[d.name] = d; + }); + + // For each import, construct a link from the source to target node. + nodes.forEach(function(d) { + console.log("inspecting: "); + console.log(d); + if (d.children.length) { + console.log("found children: "+d.children.length); + d.children.forEach(function(i) { + console.log("pushing link:"); + console.log(" map[d.name] = map["+d.name+"]:"); + console.log(map[d.name]); + console.log(" to:"); + console.log(i); + link.push({source: map[d.name], target: i}); + }); + } + }); + + return link; + } + + }; +})(); diff --git a/projects/Data Visualization Software Java Project/Data Visualization/preprocess_force.js b/projects/Data Visualization Software Java Project/Data Visualization/preprocess_force.js new file mode 100644 index 0000000..8debdb1 --- /dev/null +++ b/projects/Data Visualization Software Java Project/Data Visualization/preprocess_force.js @@ -0,0 +1,54 @@ +(function() { + preprocess = { + + links: function(nodes) { + var map = {}, + node_arr = [], + country_map = {}, + country_array = [], + link = [], + i = 0, + j = 0; + + function makeMap(name, data){ + var node = map[name]; + if(!node){ + node = map[name] = {name: name, key: i, links: 0, dvalue: 0}; + node_arr[i] = node; + i++; + } + if(node.country == undefined && data.Country != undefined){ + if(country_map[data.Country] == undefined){ + country_map[data.Country] = {name: data.Country, key: j}; + country_array[j] = country_map[data.Country]; + j++; + } + node.country = data.Country; + node.country_code = country_map[data.Country].key; + + if(data.DollarValue.charAt(0) == "$"){ + var re = new RegExp("[$,]", "g"); + node.dvalue = data.DollarValue.replace(re, ""); + } + node_arr[node.key] = node + } + } + + nodes.forEach(function(d) { + makeMap(d.source, {}); + makeMap(d.target, d) + }); + + nodes.forEach(function(d) { + if (d.target.length && d.source.length) { + map[d.target].links++; + map[d.source].links++; + link.push({source: map[d.source].key, target: map[d.target].key}); + } + }); + + return {nodes: node_arr, links: link, countries: country_array}; + } + + }; +})(); diff --git a/projects/Data Visualization Software Java Project/Readme.docx b/projects/Data Visualization Software Java Project/Readme.docx new file mode 100644 index 0000000..cf11c06 Binary files /dev/null and b/projects/Data Visualization Software Java Project/Readme.docx differ diff --git a/projects/Digital Steganography Java Project/Readme.docx b/projects/Digital Steganography Java Project/Readme.docx new file mode 100644 index 0000000..cf11c06 Binary files /dev/null and b/projects/Digital Steganography Java Project/Readme.docx differ diff --git a/projects/Digital Steganography Java Project/Report/Digital Steganography.doc b/projects/Digital Steganography Java Project/Report/Digital Steganography.doc new file mode 100644 index 0000000..61522b3 Binary files /dev/null and b/projects/Digital Steganography Java Project/Report/Digital Steganography.doc differ diff --git a/projects/Digital Steganography Java Project/coding/BreakPage.class b/projects/Digital Steganography Java Project/coding/BreakPage.class new file mode 100644 index 0000000..1ae6cad Binary files /dev/null and b/projects/Digital Steganography Java Project/coding/BreakPage.class differ diff --git a/projects/Digital Steganography Java Project/coding/BreakPage.java b/projects/Digital Steganography Java Project/coding/BreakPage.java new file mode 100644 index 0000000..6f2118d --- /dev/null +++ b/projects/Digital Steganography Java Project/coding/BreakPage.java @@ -0,0 +1,196 @@ +import java.awt.*; +import javax.swing.*; +import java.awt.event.*; +import java.io.*; +import java.awt.image.*; +//import javax.imageio.stream.*; + +public class BreakPage extends JFrame implements ActionListener +{ + private JLabel code_label,picture_label; + private JTextField code_text,picture_text; + private JButton picture_load_button,break_button,home_button; + String filepath="",secret_code="",secret_info=""; + Container con=null; + JLabel jl; + byte img_byte[]=new byte[6000]; + FileDialog fd; + + + //////// Variables for creating an image from an integer array /////////////////////////// + + Image img; + Dimension d; + int iw,ih; + int w=10,h=10; + int pix[]; + int hist[]=new int[256]; + int t[]; + int max_hist=0; + boolean ok; + Image newimg; + int key,k; + String user_key=""; + + BreakPage() + { + super("Break"); + con=getContentPane(); + con.setLayout(null); + + code_label=new JLabel("Security Code"); + code_label.setBounds(230,200,150,50); + code_text=new JTextField(200); + code_text.setBounds(400,200,250,40); + + picture_label=new JLabel("Picture"); + picture_label.setBounds(230,300,250,40); + picture_text=new JTextField(200); + picture_text.setBounds(400,300,250,50); + picture_load_button=new JButton("Load"); + picture_load_button.setBounds(700,300,150,30); + picture_load_button.addActionListener(this); + + break_button=new JButton("Break"); + break_button.setBounds(400,400,150,30); + break_button.addActionListener(this); + home_button=new JButton("Home"); + home_button.setBounds(700,400,150,30); + home_button.addActionListener(this); + + jl=new JLabel(); + jl.setBounds(700,500,150,30); + + fd=new FileDialog(new JFrame()); + + con.add(code_label); + con.add(code_text); + con.add(picture_label); + con.add(picture_text); + con.add(picture_load_button); + con.add(break_button); + con.add(home_button); + con.add(jl); + } + + public void actionPerformed(ActionEvent ae) + { + if(ae.getSource()==picture_load_button) + { + fd.setVisible(true); + filepath=fd.getDirectory()+fd.getFile(); + picture_text.setText(filepath); + }else if(ae.getSource()==break_button) + { + String sc=code_text.getText(); + int star_flag=0; + String star_value=""; + for(int i=0;i0 && flag==0) + { + + System.out.println("one"); + + if(loop=1) + { + System.out.println("else if"); + secret_info[j]=pix[i]; + b[j]=(byte)pix[i]; + System.out.println("secrect pix :"+new String(""+(char)b[j])+""); + j++; + k--; + } + else + { + System.out.println("star flag :"+star2_flag); + System.out.println("else"); + flag=1; + } + } + } + if(flag==0) + { + String s=new String(b); + s=new String(s.substring(1)); + + System.out.println("secret information :"+s); + System.out.println("key :"+key); + JOptionPane.showMessageDialog(null,"Secret Information is : "+s); + } + else + JOptionPane.showMessageDialog(null,"code you entered is not valid"); + newimg =con.createImage(new MemoryImageSource(ww,hh,cm,pix, 0, ww)); + }catch(Exception e) + { + System.out.println(e); + } + }else + { + this.dispose(); + Home h=new Home(); + h.setSize(1035,790); + h.setVisible(true); + } + } + public static void main(String args[]) + { + BreakPage bp=new BreakPage(); + bp.setSize(1035,740); + bp.setVisible(true); + } +} \ No newline at end of file diff --git a/projects/Digital Steganography Java Project/coding/ComposePage.class b/projects/Digital Steganography Java Project/coding/ComposePage.class new file mode 100644 index 0000000..5fc668e Binary files /dev/null and b/projects/Digital Steganography Java Project/coding/ComposePage.class differ diff --git a/projects/Digital Steganography Java Project/coding/ComposePage.java b/projects/Digital Steganography Java Project/coding/ComposePage.java new file mode 100644 index 0000000..2c124f1 --- /dev/null +++ b/projects/Digital Steganography Java Project/coding/ComposePage.java @@ -0,0 +1,214 @@ +import java.awt.*; +import javax.swing.*; +import java.awt.event.*; +import java.io.*; +import java.awt.image.*; +import com.sun.image.codec.jpeg.*; + +public class ComposePage extends JFrame implements ActionListener +{ + private JLabel code_label,secret_label,picture_label; + private JTextField code_text,secret_text,picture_text; + private JButton picture_load_button,hide_button,home_button; + String filepath="",secret_code="",secret_info="",user_key=""; + Container con=null; + JLabel jl; + byte img_byte[]=new byte[6000]; + FileDialog fd; + + //////// Variables for creating an image from an integer array /////////////////////////// + + Image img; + Dimension d; + int iw,ih; + int w=10,h=10; + int pix[]; + int hist[]=new int[256]; + int t[]; + int max_hist=0; + boolean ok; + static Image newimg; + int key,k; + + ComposePage() + { + super("Compose"); + con=getContentPane(); + con.setLayout(null); + + code_label=new JLabel("Security Code"); + code_label.setBounds(230,100,150,50); + code_text=new JTextField(200); + code_text.setBounds(400,100,250,40); + secret_label=new JLabel("Secret Information"); + secret_label.setBounds(230,200,150,50); + secret_text=new JTextField(200); + secret_text.setBounds(400,200,250,40); + + picture_label=new JLabel("Picture"); + picture_label.setBounds(230,300,250,40); + picture_text=new JTextField(200); + picture_text.setBounds(400,300,250,50); + picture_load_button=new JButton("Load"); + picture_load_button.setBounds(700,300,150,30); + picture_load_button.addActionListener(this); + + hide_button=new JButton("Hide"); + hide_button.setBounds(400,400,150,30); + hide_button.addActionListener(this); + home_button=new JButton("Home"); + home_button.setBounds(700,400,150,30); + home_button.addActionListener(this); + + jl=new JLabel(); + jl.setBounds(700,500,150,30); + + fd=new FileDialog(new JFrame()); + + con.add(code_label); + con.add(code_text); + con.add(secret_label); + con.add(secret_text); + con.add(picture_label); + con.add(picture_text); + con.add(picture_load_button); + con.add(hide_button); + con.add(home_button); + //con.add(jl); + } + + public void actionPerformed(ActionEvent ae) + { + if(ae.getSource()==picture_load_button) + { + fd.setVisible(true); + filepath=fd.getDirectory()+fd.getFile(); + picture_text.setText(filepath); + }else if(ae.getSource()==hide_button) + { + int starflag=0; + secret_code=code_text.getText(); + for(int i=0;i0) + JOptionPane.showMessageDialog(null,"enter secret info"); + else if(filepath.length()==0 && (secret_text.getText()).length()>0) + JOptionPane.showMessageDialog(null,"load an image"); + else + { + ImageIcon ic=new ImageIcon(filepath); + img=ic.getImage(); + iw=img.getWidth(null); + ih=img.getHeight(null); + pix=new int[iw*ih]; + t=new int[iw*ih]; + PixelGrabber pg=new PixelGrabber(img,0,0,iw,ih,pix,0,iw); + ColorModel cm=pg.getColorModel(); + int ww=pg.getWidth(); + int hh=pg.getHeight(); + pg.grabPixels(); + + key=secret_byte_array.length; + int k=key; + int j=0; + + for(int i=0;i0) + { + secret_int_array[j]=(int)secret_byte_array[j]; + System.out.println("user key :"+secret_int_array[j]); + pix[i]=secret_int_array[j]; + j++; + k--; + } + } + newimg =con.createImage(new MemoryImageSource(ww,hh,cm,pix, 0, ww)); + jl.setIcon(new ImageIcon(newimg)); + JOptionPane.showMessageDialog(null,"your secret code: "+user_key+""); + + MediaTracker mediaTracker = new MediaTracker(new Container()); + mediaTracker.addImage(newimg, 0); + mediaTracker.waitForID(0); + + int thumbWidth = 400;//Integer.parseInt(400); + int thumbHeight = 400;//Integer.parseInt(400); + double thumbRatio = (double)thumbWidth / (double)thumbHeight; + int imageWidth = newimg.getWidth(null); + int imageHeight = newimg.getHeight(null); + double imageRatio = (double)imageWidth / (double)imageHeight; + + if (thumbRatio < imageRatio) + { + thumbHeight = (int)(thumbWidth / imageRatio); + } + else + { + thumbWidth = (int)(thumbHeight * imageRatio); + } + + // draw original image to thumbnail image object and + // scale it to the new size on-the-fly + BufferedImage thumbImage = new BufferedImage(newimg.getWidth(null), newimg.getHeight(null), BufferedImage.TYPE_INT_RGB); + Graphics2D graphics2D = thumbImage.createGraphics(); + graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BILINEAR); + graphics2D.drawImage(newimg, 0, 0, newimg.getWidth(null), newimg.getHeight(null), null); + // save thumbnail image to OUTFILE + File f=new File("secpic.jpg"); + BufferedOutputStream out = new BufferedOutputStream(new + FileOutputStream(f)); + JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); + JPEGEncodeParam param = encoder. + getDefaultJPEGEncodeParam(thumbImage); + int quality = 80;//Integer.parseInt(args[4]); + quality = Math.max(0, Math.min(quality, 100)); + param.setQuality((float)quality / 100.0f, false); + encoder.setJPEGEncodeParam(param); + encoder.encode(thumbImage); + out.close(); + System.out.println("Done."); + + test t=new test(newimg); + t.setSize(1035,790); + t.setVisible(true); + } + }catch(Exception e) + { + System.out.println(e); + } + }else + JOptionPane.showMessageDialog(null,"Do not enter '*' in secrect code"); + }else + { + this.dispose(); + Home h=new Home(); + h.setSize(1035,790); + h.setVisible(true); + } + } + + public static void main(String args[]) + { + ComposePage cp=new ComposePage(); + cp.setSize(1035,740); + cp.setVisible(true); + } +} \ No newline at end of file diff --git a/projects/Digital Steganography Java Project/coding/Home.class b/projects/Digital Steganography Java Project/coding/Home.class new file mode 100644 index 0000000..f29698d Binary files /dev/null and b/projects/Digital Steganography Java Project/coding/Home.class differ diff --git a/projects/Digital Steganography Java Project/coding/Home.java b/projects/Digital Steganography Java Project/coding/Home.java new file mode 100644 index 0000000..3c15580 --- /dev/null +++ b/projects/Digital Steganography Java Project/coding/Home.java @@ -0,0 +1,49 @@ +import java.awt.*; +import javax.swing.*; +import java.awt.event.*; + +public class Home extends JFrame implements ActionListener +{ + private JButton compose,breakmsg; + + Home() + { + super("Steganography"); + Container con=getContentPane(); + con.setLayout(null); + compose=new JButton("Compose"); + compose.addActionListener(this); + compose.setBounds(300,350,150,50); + breakmsg=new JButton("Break"); + breakmsg.addActionListener(this); + breakmsg.setBounds(550,350,150,50); + con.add(compose); + con.add(breakmsg); + } + + public void actionPerformed(ActionEvent ae) + { + if(ae.getSource()==compose) + { + this.dispose(); + ComposePage cp=new ComposePage(); + cp.setSize(1035,790); + cp.setVisible(true); + } + + if(ae.getSource()==breakmsg) + { + this.dispose(); + BreakPage bp=new BreakPage(); + bp.setSize(1035,790); + bp.setVisible(true); + } + } + + public static void main(String args[]) + { + Home h=new Home(); + h.setSize(1035,790); + h.setVisible(true); + } +} \ No newline at end of file diff --git a/projects/Digital Steganography Java Project/coding/Sunset.jpg b/projects/Digital Steganography Java Project/coding/Sunset.jpg new file mode 100644 index 0000000..c43212b Binary files /dev/null and b/projects/Digital Steganography Java Project/coding/Sunset.jpg differ diff --git a/projects/Digital Steganography Java Project/coding/test.class b/projects/Digital Steganography Java Project/coding/test.class new file mode 100644 index 0000000..8fbd2eb Binary files /dev/null and b/projects/Digital Steganography Java Project/coding/test.class differ diff --git a/projects/Digital Steganography Java Project/coding/test.java b/projects/Digital Steganography Java Project/coding/test.java new file mode 100644 index 0000000..74d8e12 --- /dev/null +++ b/projects/Digital Steganography Java Project/coding/test.java @@ -0,0 +1,28 @@ +import java.awt.*; +import javax.swing.*; +import java.awt.event.*; +import java.io.*; +import java.awt.image.*; + +public class test extends JFrame +{ + Image newimg; + test() + { + } + test(Image m) + { + newimg=m; + } + public void paint(Graphics g) + { + g.drawImage(newimg,100,100,null); + } + + public static void main(String args[]) + { + test bp=new test(); + bp.setSize(1035,740); + bp.setVisible(true); + } +} \ No newline at end of file diff --git a/projects/Email Client Software Project Java/FetchMail/.classpath b/projects/Email Client Software Project Java/FetchMail/.classpath new file mode 100644 index 0000000..c600383 --- /dev/null +++ b/projects/Email Client Software Project Java/FetchMail/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/projects/Email Client Software Project Java/FetchMail/.project b/projects/Email Client Software Project Java/FetchMail/.project new file mode 100644 index 0000000..82889cf --- /dev/null +++ b/projects/Email Client Software Project Java/FetchMail/.project @@ -0,0 +1,26 @@ + + + FetchMail + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + com.tssap.selena.model.modeling_nature + com.borland.selena.uml20.uml20_nature + + + + Suspended Root + 2 + SuspendedRootVariable + + + diff --git a/projects/Email Client Software Project Java/FetchMail/Model Folder/default.txvClassDiagram20 b/projects/Email Client Software Project Java/FetchMail/Model Folder/default.txvClassDiagram20 new file mode 100644 index 0000000..14fedfa --- /dev/null +++ b/projects/Email Client Software Project Java/FetchMail/Model Folder/default.txvClassDiagram20 @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/projects/Email Client Software Project Java/FetchMail/bin/mail2.class b/projects/Email Client Software Project Java/FetchMail/bin/mail2.class new file mode 100644 index 0000000..a2f6d53 Binary files /dev/null and b/projects/Email Client Software Project Java/FetchMail/bin/mail2.class differ diff --git a/projects/Email Client Software Project Java/FetchMail/bin/mailframe$1.class b/projects/Email Client Software Project Java/FetchMail/bin/mailframe$1.class new file mode 100644 index 0000000..e716043 Binary files /dev/null and b/projects/Email Client Software Project Java/FetchMail/bin/mailframe$1.class differ diff --git a/projects/Email Client Software Project Java/FetchMail/bin/mailframe.class b/projects/Email Client Software Project Java/FetchMail/bin/mailframe.class new file mode 100644 index 0000000..7cc9ae4 Binary files /dev/null and b/projects/Email Client Software Project Java/FetchMail/bin/mailframe.class differ diff --git a/projects/Email Client Software Project Java/FetchMail/manifest b/projects/Email Client Software Project Java/FetchMail/manifest new file mode 100644 index 0000000..8dda92d --- /dev/null +++ b/projects/Email Client Software Project Java/FetchMail/manifest @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: mail2 + diff --git a/projects/Email Client Software Project Java/FetchMail/src/mail2.java b/projects/Email Client Software Project Java/FetchMail/src/mail2.java new file mode 100644 index 0000000..5fb165e --- /dev/null +++ b/projects/Email Client Software Project Java/FetchMail/src/mail2.java @@ -0,0 +1,200 @@ +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.Properties; +import javax.mail.*; + +@SuppressWarnings("serial") +public class mail2 extends JFrame +{ + static String popServer; + static String popUser; + static String popPassword; + public static void main(String args[]) + { + //popServer=args[0]; + //popUser=args[1]; + //popPassword=args[2]; + JFrame frame = new mailframe(); + frame.setVisible(true); + } + } + +@SuppressWarnings("serial") +class mailframe extends JFrame implements ActionListener +{ + JLabel lserver =new JLabel("SMTP Server"); + static JTextField tserver = new JTextField(15); + JLabel luname =new JLabel("UserName"); + static JTextField tuname = new JTextField(15); + JLabel lpass =new JLabel("Password"); + static JPasswordField tpass = new JPasswordField(15); + static JTextArea message = new JTextArea(30,72); + + public mailframe() + { + this.setSize(850,500); + this.setLayout(new FlowLayout(FlowLayout.LEFT)); + + addWindowListener(new WindowAdapter() + { + public void windowClosing(WindowEvent e) + { + System.exit(0); + } + } + ); + + tpass.setEchoChar('*'); + + this.add(lserver); + this.add(tserver); + this.add(luname); + this.add(tuname); + this.add(lpass); + this.add(tpass); + + JButton b1 =new JButton("Fetch"); + b1.addActionListener(this); + this.add(b1); + + message.setEditable(false); + JScrollPane sp = new JScrollPane(); + message.add(sp); + this.add(message); + + + } + public void actionPerformed(ActionEvent e) + { + System.out.println("debug button"); + fetchmail(); + } + @SuppressWarnings("deprecation") + private void fetchmail() + { + + String popServer; + String popUser; + String popPassword; + + popServer = mailframe.tserver.getText(); + popUser = mailframe.tuname.getText(); + popPassword = mailframe.tpass.getText(); + + System.out.println(popServer); + try + { + receive(popServer, popUser, popPassword); + //receive("mail.imparttechnologies.com","testproject@imparttechnologies.com", "password123"); + } + catch (Exception ex) + { + System.out.println("Usage: java jmail"+" smtpServer address password "); + } + + //System.exit(0); + + } + public static void receive(String popServer, String popUser, String popPassword){ + Store store=null; + Folder folder=null; + try + { + Properties props = System.getProperties(); + Session session = Session.getDefaultInstance(props, null); + store = session.getStore("pop3"); + store.connect(popServer, popUser, popPassword); + + folder = store.getDefaultFolder(); + if (folder == null) throw new Exception("No default folder"); + + folder = folder.getFolder("INBOX"); + if (folder == null) throw new Exception("No POP3 INBOX"); + + folder.open(Folder.READ_ONLY); + Message msgs[] = folder.getMessages(); + BufferedReader reader = new BufferedReader (new InputStreamReader(System.in)); + + mailframe.message.setText(""); + int msgNum; + for (msgNum = 0; msgNum < msgs.length; msgNum++) + { + System.out.println(msgNum +": "+ msgs[msgNum].getFrom()[0]+ "\t" + msgs[msgNum].getSubject()); + System.out.println("Do you want to read message? [YES to read/QUIT to end]"); + String line = reader.readLine(); + String y = "yes"; + int j = line.compareTo(y); + if (j == 0) + { + //System.out.println(((Message)msgs[msgNum].getContent()).toString()); + //System.out.println(msgNum +": "+ msgs[msgNum].getFrom()[0]+ "\t" + msgs[msgNum].getSubject()); + msgs[msgNum].writeTo(System.out); + //test run start --------> + Object content = msgs[msgNum].getContent(); + + if (content instanceof Multipart) + { + StringBuffer messageContent = new StringBuffer(); + StringBuffer msg = new StringBuffer(); + Multipart multipart = (Multipart) content; + for (int i = 0; i < multipart.getCount(); i++) + { + Part part = (Part) multipart.getBodyPart(i); + if (part.isMimeType("text/plain")) + { + msg = messageContent.append(part.getContent().toString()); + String msg1 = new String(); + String from = new String(); + String subj = new String(); + int k ; + k = msgNum; + + msg1 = msg.toString(); + subj = msgs[msgNum].getSubject(); + from = msgs[msgNum].getFrom()[0].toString(); + + mailframe.message.append("Message No:"+(k+1)+"\n"); + mailframe.message.append("Message From:"+from+"\n"); + mailframe.message.append("Message Subject:"+subj+"\n"); + mailframe.message.append("\n"+msg1+"\n"); + + } + } + //return messageContent.toString(); + + } else + { + //return content.toString(); + } + + + //System.out.println("Debug 1 -> for 1 -> if yes"); + } + else + { + System.out.println("Closing Previous Message. Going For Next."); + //break; + } + //msgs[msgNum].writeTo(System.out); + } + + //System.exit(0); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + finally + { + try + { + if (folder!=null) folder.close(false); + if (store!=null) store.close(); + } + catch (Exception ex2) {ex2.printStackTrace();} + } + } +} \ No newline at end of file diff --git a/projects/Email Client Software Project Java/Jar Files/Classifier4J-0.6.jar b/projects/Email Client Software Project Java/Jar Files/Classifier4J-0.6.jar new file mode 100644 index 0000000..6168172 Binary files /dev/null and b/projects/Email Client Software Project Java/Jar Files/Classifier4J-0.6.jar differ diff --git a/projects/Email Client Software Project Java/Jar Files/Classifier4J-Optional-0.6.jar b/projects/Email Client Software Project Java/Jar Files/Classifier4J-Optional-0.6.jar new file mode 100644 index 0000000..d88ee82 Binary files /dev/null and b/projects/Email Client Software Project Java/Jar Files/Classifier4J-Optional-0.6.jar differ diff --git a/projects/Email Client Software Project Java/Jar Files/activation.jar b/projects/Email Client Software Project Java/Jar Files/activation.jar new file mode 100644 index 0000000..29a59a9 Binary files /dev/null and b/projects/Email Client Software Project Java/Jar Files/activation.jar differ diff --git a/projects/Email Client Software Project Java/Jar Files/mail.jar b/projects/Email Client Software Project Java/Jar Files/mail.jar new file mode 100644 index 0000000..0922295 Binary files /dev/null and b/projects/Email Client Software Project Java/Jar Files/mail.jar differ diff --git a/projects/Email Client Software Project Java/Project Report and ppt/documentation/INDEX.doc b/projects/Email Client Software Project Java/Project Report and ppt/documentation/INDEX.doc new file mode 100644 index 0000000..cca955c Binary files /dev/null and b/projects/Email Client Software Project Java/Project Report and ppt/documentation/INDEX.doc differ diff --git a/projects/Email Client Software Project Java/Project Report and ppt/documentation/Project Report.doc b/projects/Email Client Software Project Java/Project Report and ppt/documentation/Project Report.doc new file mode 100644 index 0000000..599cff5 Binary files /dev/null and b/projects/Email Client Software Project Java/Project Report and ppt/documentation/Project Report.doc differ diff --git a/projects/Email Client Software Project Java/Project Report and ppt/ppt.pptx b/projects/Email Client Software Project Java/Project Report and ppt/ppt.pptx new file mode 100644 index 0000000..26112c3 Binary files /dev/null and b/projects/Email Client Software Project Java/Project Report and ppt/ppt.pptx differ diff --git a/projects/Email Client Software Project Java/Project/CODE.java b/projects/Email Client Software Project Java/Project/CODE.java new file mode 100644 index 0000000..5fb165e --- /dev/null +++ b/projects/Email Client Software Project Java/Project/CODE.java @@ -0,0 +1,200 @@ +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.Properties; +import javax.mail.*; + +@SuppressWarnings("serial") +public class mail2 extends JFrame +{ + static String popServer; + static String popUser; + static String popPassword; + public static void main(String args[]) + { + //popServer=args[0]; + //popUser=args[1]; + //popPassword=args[2]; + JFrame frame = new mailframe(); + frame.setVisible(true); + } + } + +@SuppressWarnings("serial") +class mailframe extends JFrame implements ActionListener +{ + JLabel lserver =new JLabel("SMTP Server"); + static JTextField tserver = new JTextField(15); + JLabel luname =new JLabel("UserName"); + static JTextField tuname = new JTextField(15); + JLabel lpass =new JLabel("Password"); + static JPasswordField tpass = new JPasswordField(15); + static JTextArea message = new JTextArea(30,72); + + public mailframe() + { + this.setSize(850,500); + this.setLayout(new FlowLayout(FlowLayout.LEFT)); + + addWindowListener(new WindowAdapter() + { + public void windowClosing(WindowEvent e) + { + System.exit(0); + } + } + ); + + tpass.setEchoChar('*'); + + this.add(lserver); + this.add(tserver); + this.add(luname); + this.add(tuname); + this.add(lpass); + this.add(tpass); + + JButton b1 =new JButton("Fetch"); + b1.addActionListener(this); + this.add(b1); + + message.setEditable(false); + JScrollPane sp = new JScrollPane(); + message.add(sp); + this.add(message); + + + } + public void actionPerformed(ActionEvent e) + { + System.out.println("debug button"); + fetchmail(); + } + @SuppressWarnings("deprecation") + private void fetchmail() + { + + String popServer; + String popUser; + String popPassword; + + popServer = mailframe.tserver.getText(); + popUser = mailframe.tuname.getText(); + popPassword = mailframe.tpass.getText(); + + System.out.println(popServer); + try + { + receive(popServer, popUser, popPassword); + //receive("mail.imparttechnologies.com","testproject@imparttechnologies.com", "password123"); + } + catch (Exception ex) + { + System.out.println("Usage: java jmail"+" smtpServer address password "); + } + + //System.exit(0); + + } + public static void receive(String popServer, String popUser, String popPassword){ + Store store=null; + Folder folder=null; + try + { + Properties props = System.getProperties(); + Session session = Session.getDefaultInstance(props, null); + store = session.getStore("pop3"); + store.connect(popServer, popUser, popPassword); + + folder = store.getDefaultFolder(); + if (folder == null) throw new Exception("No default folder"); + + folder = folder.getFolder("INBOX"); + if (folder == null) throw new Exception("No POP3 INBOX"); + + folder.open(Folder.READ_ONLY); + Message msgs[] = folder.getMessages(); + BufferedReader reader = new BufferedReader (new InputStreamReader(System.in)); + + mailframe.message.setText(""); + int msgNum; + for (msgNum = 0; msgNum < msgs.length; msgNum++) + { + System.out.println(msgNum +": "+ msgs[msgNum].getFrom()[0]+ "\t" + msgs[msgNum].getSubject()); + System.out.println("Do you want to read message? [YES to read/QUIT to end]"); + String line = reader.readLine(); + String y = "yes"; + int j = line.compareTo(y); + if (j == 0) + { + //System.out.println(((Message)msgs[msgNum].getContent()).toString()); + //System.out.println(msgNum +": "+ msgs[msgNum].getFrom()[0]+ "\t" + msgs[msgNum].getSubject()); + msgs[msgNum].writeTo(System.out); + //test run start --------> + Object content = msgs[msgNum].getContent(); + + if (content instanceof Multipart) + { + StringBuffer messageContent = new StringBuffer(); + StringBuffer msg = new StringBuffer(); + Multipart multipart = (Multipart) content; + for (int i = 0; i < multipart.getCount(); i++) + { + Part part = (Part) multipart.getBodyPart(i); + if (part.isMimeType("text/plain")) + { + msg = messageContent.append(part.getContent().toString()); + String msg1 = new String(); + String from = new String(); + String subj = new String(); + int k ; + k = msgNum; + + msg1 = msg.toString(); + subj = msgs[msgNum].getSubject(); + from = msgs[msgNum].getFrom()[0].toString(); + + mailframe.message.append("Message No:"+(k+1)+"\n"); + mailframe.message.append("Message From:"+from+"\n"); + mailframe.message.append("Message Subject:"+subj+"\n"); + mailframe.message.append("\n"+msg1+"\n"); + + } + } + //return messageContent.toString(); + + } else + { + //return content.toString(); + } + + + //System.out.println("Debug 1 -> for 1 -> if yes"); + } + else + { + System.out.println("Closing Previous Message. Going For Next."); + //break; + } + //msgs[msgNum].writeTo(System.out); + } + + //System.exit(0); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + finally + { + try + { + if (folder!=null) folder.close(false); + if (store!=null) store.close(); + } + catch (Exception ex2) {ex2.printStackTrace();} + } + } +} \ No newline at end of file diff --git a/projects/Email Client Software Project Java/Project/Read The Text.txt b/projects/Email Client Software Project Java/Project/Read The Text.txt new file mode 100644 index 0000000..e7eadbe --- /dev/null +++ b/projects/Email Client Software Project Java/Project/Read The Text.txt @@ -0,0 +1,21 @@ +Procedure for running the project + +1.Install NetBeans Software in your System + +2.Create new project called FetchMail + +3.Create File name called mail2.java. + +4.Add the jar files into the library. + +5.Run the Project by holding Shift-F6. + +6.In the login form enter smtpserver ,login name, password. + +7.It display debug window. + +8.Read the messages by pressing YES,NO to diacard. + +9.It shows the messages in a panel specifying sender,site. + +10.This is our project..... diff --git a/projects/Email Client Software Project Java/Readme.docx b/projects/Email Client Software Project Java/Readme.docx new file mode 100644 index 0000000..cf11c06 Binary files /dev/null and b/projects/Email Client Software Project Java/Readme.docx differ diff --git a/projects/JAVA-PROJECTS-master/.classpath b/projects/JAVA-PROJECTS-master/.classpath new file mode 100644 index 0000000..ac37fb2 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/.classpath @@ -0,0 +1,5 @@ + + + + + diff --git a/projects/JAVA-PROJECTS-master/.project b/projects/JAVA-PROJECTS-master/.project new file mode 100644 index 0000000..05b0c7f --- /dev/null +++ b/projects/JAVA-PROJECTS-master/.project @@ -0,0 +1,17 @@ + + + JAVA-PROJECTS-master + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/beans/Associate.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/beans/Associate.class new file mode 100644 index 0000000..52b67fd Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/beans/Associate.class differ diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/client/Client.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/client/Client.class new file mode 100644 index 0000000..6447fa5 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/client/Client.class differ diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/daoservices/PayrollDAOServices.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/daoservices/PayrollDAOServices.class new file mode 100644 index 0000000..7f6c0f7 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/daoservices/PayrollDAOServices.class differ diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.class new file mode 100644 index 0000000..73fc3c0 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.class differ diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.class new file mode 100644 index 0000000..b30902d Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.class differ diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/InValidAssociateIDException.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/InValidAssociateIDException.class new file mode 100644 index 0000000..41e77bc Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/InValidAssociateIDException.class differ diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.class new file mode 100644 index 0000000..816a8ba Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.class differ diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/provider/Provider.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/provider/Provider.class new file mode 100644 index 0000000..eca7576 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/provider/Provider.class differ diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/services/PayrollServices.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/services/PayrollServices.class new file mode 100644 index 0000000..4ccd9d5 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/services/PayrollServices.class differ diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/services/PayrollServicesImpl.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/services/PayrollServicesImpl.class new file mode 100644 index 0000000..588d82f Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/services/PayrollServicesImpl.class differ diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/resources/data.properties b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/resources/data.properties new file mode 100644 index 0000000..a5cab98 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/resources/data.properties @@ -0,0 +1,2 @@ +serviceProvider =com.zensar.payroll.services.PayrollServicesImpl +repoProvider = com.zensar.payroll.daoservices.PayrollDAOServicesImpl diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/resources/storeAssociates.txt b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/resources/storeAssociates.txt new file mode 100644 index 0000000..95671e1 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/resources/storeAssociates.txt differ diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/beans/Associate.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/beans/Associate.java new file mode 100644 index 0000000..a625655 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/beans/Associate.java @@ -0,0 +1,179 @@ +package com.zensar.payroll.beans; + +import java.io.Serializable; + +public class Associate implements Serializable{ + + private int associateId, basicSalary, hra, ta, da, grossSalary, pf, + companyPf, monthlyTax, netSalary, investment; + private String associateName, emailID, panCard; + + public Associate() { + + } + + public Associate(int associateId, int basicSalary, int hra, int ta, int da, + int grossSalary, int pf, int companyPf, int monthlyTax, + int netSalary, int investment, String associateName, + String emailID, String panCard) { + super(); + this.associateId = associateId; + this.basicSalary = basicSalary; + this.hra = hra; + this.ta = ta; + this.da = da; + this.grossSalary = grossSalary; + this.pf = pf; + this.companyPf = companyPf; + this.monthlyTax = monthlyTax; + this.netSalary = netSalary; + this.investment = investment; + this.associateName = associateName; + this.emailID = emailID; + this.panCard = panCard; + } + + public Associate(String associateName, String emailId, String panCard, + int basicSalary, int pf, int comapnyPf, int investment) { + super(); + this.associateName = associateName; + this.emailID = emailId; + this.panCard = panCard; + this.basicSalary = basicSalary; + this.pf = pf; + this.companyPf = comapnyPf; + this.investment = investment; + } + + public Associate(int hra, int ta, int da, int monthlyTax, int netSalary) { + this.hra = hra; + this.ta = ta; + this.da = da; + this.monthlyTax = monthlyTax; + this.netSalary = netSalary; + } + + public int getAssociateId() { + return associateId; + } + + public void setAssociateId(int associateId) { + this.associateId = associateId; + } + + public int getBasicSalary() { + return basicSalary; + } + + public void setBasicSalary(int basicSalary) { + this.basicSalary = basicSalary; + } + + public int getHra() { + return hra; + } + + public void setHra(int hra) { + this.hra = hra; + } + + public int getTa() { + return ta; + } + + public void setTa(int ta) { + this.ta = ta; + } + + public int getDa() { + return da; + } + + public void setDa(int da) { + this.da = da; + } + + public int getGrossSalary() { + return grossSalary; + } + + public void setGrossSalary(int grossSalary) { + this.grossSalary = grossSalary; + } + + public int getPf() { + return pf; + } + + public void setPf(int pf) { + this.pf = pf; + } + + public int getCompanyPf() { + return companyPf; + } + + public void setCompanyPf(int companyPf) { + this.companyPf = companyPf; + } + + public int getMonthlyTax() { + return monthlyTax; + } + + public void setMonthlyTax(int monthlyTax) { + this.monthlyTax = monthlyTax; + } + + public int getNetSalary() { + return netSalary; + } + + public void setNetSalary(int netSalary) { + this.netSalary = netSalary; + } + + public String getAssociateName() { + return associateName; + } + + public void setAssociateName(String associateName) { + this.associateName = associateName; + } + + public String getEmailID() { + return emailID; + } + + public void setEmailID(String emailID) { + this.emailID = emailID; + } + + public String getPanCard() { + return panCard; + } + + public void setPanCard(String panCard) { + this.panCard = panCard; + } + + public int getInvestment() { + return investment; + } + + public void setInvestment(int investment) { + this.investment = investment; + } + + @Override + public String toString() { + return "Associate [associateId=" + associateId + ", basicSalary=" + + basicSalary + ", hra=" + hra + ", ta=" + ta + ", da=" + da + + ", grossSalary=" + grossSalary + ", pf=" + pf + + ", companyPf=" + companyPf + ", monthlyTax=" + monthlyTax + + ", netSalary=" + netSalary + ", investment=" + investment + + ", associateName=" + associateName + ", emailID=" + emailID + + ", panCard=" + panCard + "]"; + } + +} diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/client/Client.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/client/Client.java new file mode 100644 index 0000000..c41c387 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/client/Client.java @@ -0,0 +1,249 @@ +package com.zensar.payroll.client; + +import java.util.ArrayList; +import java.util.InputMismatchException; +import java.util.Scanner; + +import com.zensar.payroll.beans.Associate; +import com.zensar.payroll.exceptions.AssociateDetailsNotFoundException; +import com.zensar.payroll.exceptions.InValidAssociateIDException; +import com.zensar.payroll.exceptions.PayRollServicesNotFoundException; +import com.zensar.payroll.provider.Provider; +import com.zensar.payroll.services.PayrollServices; + +public class Client { + + public static void main(String[] args) { + + PayrollServices services = null; + Scanner scanner = null; + String decision; + String associateName, emailId, panCard; + int basicSalary, pf, comapnyPf, investment, associateId, choice = 0; + scanner = new Scanner(System.in); + + try { + services = Provider.getPayrollServices("serviceProvider"); + } catch (PayRollServicesNotFoundException e1) { + // e1.printStackTrace(); + System.out.println("Sorry service is unavailable currently"); + System.exit(0); + } + + do { + String menuAlignFormat = "| %-101s |%n"; + printLine2(); + System.out.format(menuAlignFormat, + "Welcome to Zensar Payroll System"); + printLine2(); + System.out.format(menuAlignFormat, "1. Registration"); + System.out.format(menuAlignFormat, + "2. Calculate Monthly Net Salary"); + System.out.format(menuAlignFormat, "3. Get Associate Details"); + System.out.format(menuAlignFormat, "4. Get All Associate Details"); + System.out.format(menuAlignFormat, "5. Close payroll services"); + printLine2(); + System.out.format(menuAlignFormat, "Please enter your choice"); + printLine2(); + + try { + + choice = scanner.nextInt(); + switch (choice) { + case 1: + scanner.nextLine(); + System.out.println("Enter your name"); + associateName = scanner.nextLine(); + System.out.println("Enter your email Id"); + emailId = scanner.next(); + System.out.println("Enter your pan card"); + panCard = scanner.next(); + System.out.println("Enter your basic salary"); + basicSalary = scanner.nextInt(); + System.out.println("Enter your pf"); + pf = scanner.nextInt(); + System.out.println("Enter your Company pf"); + comapnyPf = scanner.nextInt(); + System.out.println("Enter your investment"); + investment = scanner.nextInt(); + + System.out + .println("Successfully registered with associate Id " + + services.acceptCustomerDetails( + associateName, emailId, panCard, + basicSalary, pf, comapnyPf, + investment)); + break; + case 2: + System.out.println("Enter your associate Id"); + + associateId = scanner.nextInt(); + + int monthlyNetSalary = services + .calculateMonthlyNetSalary(associateId); + System.out.println("Monthly Net Salary: " + + monthlyNetSalary); + break; + + case 3: + + System.out.println("Enter your associate Id"); + associateId = scanner.nextInt(); + + Associate associate = services + .getAssociateDetails(associateId); + + printLine2(); + System.out.format("| %50s %-50s |%n", "PAY SLIP", " "); + printLine2(); + printPayRoll(associate); + + break; + case 4: + + ArrayList associates = services + .getAllAssociateDetails(); + + printLine2(); + System.out + .format("| %60s %-40s |%n", "ZENSAR PAYROLL", " "); + printLine2(); + + for (Associate a : associates) { + + String leftAlignFormat = "|%-50s |%-50s |%n"; + + System.out.format(leftAlignFormat, "Associate Id", + a.getAssociateId()); + System.out.format(leftAlignFormat, "Associate Name", + a.getAssociateName()); + System.out.format(leftAlignFormat, + "Associate Email Id", a.getEmailID()); + System.out.format(leftAlignFormat, + "Associate PAN Card", a.getPanCard()); + + printLine2(); + + System.out.format(leftAlignFormat, "Basic Salary", + a.getBasicSalary()); + System.out.format(leftAlignFormat, "HRA", a.getHra()); + System.out.format(leftAlignFormat, "TA", a.getTa()); + System.out.format(leftAlignFormat, "DA", a.getDa()); + System.out.format(leftAlignFormat, "PF", a.getPf()); + System.out.format(leftAlignFormat, "Company PF", + a.getCompanyPf()); + System.out.format(leftAlignFormat, "Monthly Tax", + a.getMonthlyTax()); + System.out.format(leftAlignFormat, "Net Salary", + a.getNetSalary()); + + printLine2(); + printLine2(); + } + + break; + case 5: + + if (services.closePayrollServices() == true) { + System.out + .println("Thank you for using the payroll system"); + System.exit(0); + } + break; + default: + System.out.println("Invalid choice"); + break; + } + } catch (PayRollServicesNotFoundException e) { + // e.printStackTrace(); + System.out.println("Sorry service is unavailable currently"); + System.exit(0); + } catch (InValidAssociateIDException e) { + e.printStackTrace(); + System.out.println("Please enter a valid assoicate ID"); + } catch (AssociateDetailsNotFoundException e) { + // e.printStackTrace(); + System.out.println("Sorry you have not registered"); + } catch (InputMismatchException e) { + System.out.println("Please enter a valid input"); + scanner.next(); + } catch (Exception e) { + System.out.println("Something went wrong, Please try again"); + } + + System.out.println("Do you wish to continue?(Y/N)"); + do { + decision = scanner.next(); + if (decision.equalsIgnoreCase("n")) { + System.out + .println("Thank you for using the payroll system"); + scanner.close(); + System.exit(0); + } else if (!decision.equalsIgnoreCase("y")) { + System.out.println("Please enter a valid input (Y/N)"); + } + } while (!decision.equalsIgnoreCase("y")); + + } while (decision.equalsIgnoreCase("y")); + + } + + public static void printPayRoll(Associate associate) { + String leftAlignFormat = "|%-50s |%-50s |%n"; + String leftAlignFormat2 = "|%-25s|%25s|%-25s|%25s|%n"; + String leftAlignFormat3 = "|%25s|%25s|%25s|%25s|%n"; + + System.out.format(leftAlignFormat, "Associate Id", + associate.getAssociateId()); + System.out.format(leftAlignFormat, "Associate Name", + associate.getAssociateName()); + System.out.format(leftAlignFormat, "Associate Email Id", + associate.getEmailID()); + System.out.format(leftAlignFormat, "Associate PAN Card", + associate.getPanCard()); + printLine2(); + printLine2(); + System.out.format(leftAlignFormat3, "Earnings", "Amount", "Deductions", + "Amount"); + printLine(); + System.out.format(leftAlignFormat2, "Basic Salary", + associate.getBasicSalary(), "Company PF", + associate.getCompanyPf()); + System.out.format(leftAlignFormat2, "HRA", associate.getHra(), "PF", + associate.getPf()); + System.out.format(leftAlignFormat2, "DA", associate.getDa(), + "Monthly Tax", associate.getMonthlyTax()); + System.out.format(leftAlignFormat2, "TA", associate.getTa(), " ", " "); + System.out.format(leftAlignFormat2, "Company PF", + associate.getCompanyPf(), " ", " "); + printLine(); + System.out.format(leftAlignFormat2, "Gross Salary", + associate.getGrossSalary(), "Total Deductions", + associate.getMonthlyTax() + associate.getCompanyPf() + + associate.getPf()); + printLine(); + System.out.format(leftAlignFormat2, " ", " ", "Net Salary", + associate.getNetSalary()); + printLine2(); + } + + public static void printLine() { + System.out.print("|"); + for (int i = 1; i <= 104; i++) { + if (i == 26 || i == 52 || i == 78 || i == 104) + System.out.print("|"); + else + System.out.print("-"); + } + System.out.println(); + } + + public static void printLine2() { + System.out.print("|"); + for (int i = 1; i <= 103; i++) { + System.out.print("-"); + } + System.out.println("|"); + } + +} diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/daoservices/PayrollDAOServices.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/daoservices/PayrollDAOServices.java new file mode 100644 index 0000000..6cbb643 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/daoservices/PayrollDAOServices.java @@ -0,0 +1,18 @@ +package com.zensar.payroll.daoservices; + +import java.util.ArrayList; + +import com.zensar.payroll.beans.Associate; + +public interface PayrollDAOServices { + + int insertAssociate(Associate associate); + + boolean updateAssociate(Associate associate); + + Associate getAssociate(int associateId); + + ArrayList getAssociates(); + + boolean closePayrollDAOServices(); +} diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.java new file mode 100644 index 0000000..8d22ada --- /dev/null +++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.java @@ -0,0 +1,101 @@ +package com.zensar.payroll.daoservices; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import com.zensar.payroll.beans.Associate; + +public class PayrollDAOServicesImpl implements PayrollDAOServices { + + static int associateId=1000; + Map map = new HashMap(); + + public PayrollDAOServicesImpl() { + ObjectInputStream objectInputStream = null; + try { + FileInputStream fos = new FileInputStream(".\\src\\resources\\storeAssociates.txt"); + objectInputStream = new ObjectInputStream(fos); + map = (Map) objectInputStream.readObject(); + associateId = 1000 + map.size(); + } catch (FileNotFoundException e) { + //e.printStackTrace(); + } catch (ClassNotFoundException e) { + //e.printStackTrace(); + } catch (IOException e) { + //e.printStackTrace(); + }finally{ + if(objectInputStream!=null) + try { + objectInputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + @Override + public int insertAssociate(Associate associate) { + associate.setAssociateId(associateId); + map.put(associateId, associate); + System.out.println(associateId); + associateId++; + return associate.getAssociateId(); + } + + @Override + public boolean updateAssociate(Associate associate) { + if(map.put(associate.getAssociateId(), associate)!=null) + return true; + else + return false; + } + + @Override + public Associate getAssociate(int associateId) { + if(map.get(associateId)!=null) + return map.get(associateId); + else + return null; + } + + @Override + public ArrayList getAssociates() { + ArrayList associates = new ArrayList(map.values()); + if(associates.isEmpty()) + return null; + else + return associates; + } + + @Override + public boolean closePayrollDAOServices() { + ObjectOutputStream objectOutputStream = null; + try { + FileOutputStream fos = new FileOutputStream(".\\src\\resources\\storeAssociates.txt"); + objectOutputStream = new ObjectOutputStream(fos); + objectOutputStream.writeObject(map); + return true; + } catch (FileNotFoundException e) { + //e.printStackTrace(); + } catch (IOException e) { + //e.printStackTrace(); + } + finally{ + if(objectOutputStream!=null) + try { + objectOutputStream.close(); + } catch (IOException e) { + //e.printStackTrace(); + } + } + return false; + } +} diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.java new file mode 100644 index 0000000..fb58298 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.java @@ -0,0 +1,32 @@ +package com.zensar.payroll.exceptions; + +@SuppressWarnings("serial") +public class AssociateDetailsNotFoundException extends Exception { + + public AssociateDetailsNotFoundException() { + super(); + } + + public AssociateDetailsNotFoundException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public AssociateDetailsNotFoundException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public AssociateDetailsNotFoundException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public AssociateDetailsNotFoundException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + +} diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/InValidAssociateIDException.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/InValidAssociateIDException.java new file mode 100644 index 0000000..14926a4 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/InValidAssociateIDException.java @@ -0,0 +1,32 @@ +package com.zensar.payroll.exceptions; + +@SuppressWarnings("serial") +public class InValidAssociateIDException extends Exception{ + + public InValidAssociateIDException() { + super(); + } + + public InValidAssociateIDException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public InValidAssociateIDException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public InValidAssociateIDException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public InValidAssociateIDException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + +} diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.java new file mode 100644 index 0000000..807820e --- /dev/null +++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.java @@ -0,0 +1,32 @@ +package com.zensar.payroll.exceptions; + +@SuppressWarnings("serial") +public class PayRollServicesNotFoundException extends Exception { + + public PayRollServicesNotFoundException() { + super(); + } + + public PayRollServicesNotFoundException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public PayRollServicesNotFoundException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public PayRollServicesNotFoundException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public PayRollServicesNotFoundException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + +} diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/provider/Provider.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/provider/Provider.java new file mode 100644 index 0000000..bbf22f4 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/provider/Provider.java @@ -0,0 +1,37 @@ +package com.zensar.payroll.provider; + +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.Properties; + +import com.zensar.payroll.exceptions.PayRollServicesNotFoundException; + +public class Provider { + static Properties properties = null; + + public static T getPayrollServices(String key) + throws PayRollServicesNotFoundException { + try { + properties = new Properties(); + properties + .load(new FileReader(".\\src\\resources\\data.properties")); + String provider = (String) properties.get(key); + Class c = Class.forName(provider); + return (T) c.newInstance(); + } catch (FileNotFoundException e) { + throw new PayRollServicesNotFoundException(e); + } catch (ClassNotFoundException e) { + throw new PayRollServicesNotFoundException(e); + } catch (InstantiationException e) { + throw new PayRollServicesNotFoundException(e); + } catch (IllegalAccessException e) { + throw new PayRollServicesNotFoundException(e); + } catch (IOException e) { + throw new PayRollServicesNotFoundException(e); + } catch (Exception e) { + throw new PayRollServicesNotFoundException(e); + } + } + +} diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/services/PayrollServices.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/services/PayrollServices.java new file mode 100644 index 0000000..8c9e85b --- /dev/null +++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/services/PayrollServices.java @@ -0,0 +1,29 @@ +package com.zensar.payroll.services; + +import java.util.ArrayList; + +import com.zensar.payroll.beans.Associate; +import com.zensar.payroll.exceptions.AssociateDetailsNotFoundException; +import com.zensar.payroll.exceptions.InValidAssociateIDException; +import com.zensar.payroll.exceptions.PayRollServicesNotFoundException; + +public interface PayrollServices { + + int acceptCustomerDetails(String associateName, String emailId, + String panCard, int basicSalary, int pf, int comapnyPf, + int investment) throws PayRollServicesNotFoundException; + + int calculateMonthlyNetSalary(int associateId) + throws InValidAssociateIDException, + AssociateDetailsNotFoundException, PayRollServicesNotFoundException; + + Associate getAssociateDetails(int associateId) + throws InValidAssociateIDException, + AssociateDetailsNotFoundException; + + ArrayList getAllAssociateDetails() + throws PayRollServicesNotFoundException; + + boolean closePayrollServices() throws PayRollServicesNotFoundException; + +} diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/services/PayrollServicesImpl.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/services/PayrollServicesImpl.java new file mode 100644 index 0000000..269275d --- /dev/null +++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/services/PayrollServicesImpl.java @@ -0,0 +1,140 @@ +package com.zensar.payroll.services; + +import java.util.ArrayList; + +import com.zensar.payroll.beans.Associate; +import com.zensar.payroll.daoservices.PayrollDAOServices; +import com.zensar.payroll.exceptions.AssociateDetailsNotFoundException; +import com.zensar.payroll.exceptions.InValidAssociateIDException; +import com.zensar.payroll.exceptions.PayRollServicesNotFoundException; +import com.zensar.payroll.provider.Provider; + +public class PayrollServicesImpl implements PayrollServices { + + private PayrollDAOServices dao = null; + private static final int SLAB_ONE_UPPER_LIMIT = 250000; + private static final int SLAB_TWO_UPPER_LIMIT = 500000; + private static final int SLAB_THREE_UPPER_LIMIT = 800000; + private static final int INVESTMENT_EXEMPTION_LIMIT = 150000; + private static final int SLAB_TWO_AMOUNT = 250000; + private static final int SLAB_THREE_AMOUNT = 300000; + private static final float SLAB_TWO_TAX_RATE = 0.1f; + private static final float SLAB_THREE_TAX_RATE = 0.2f; + private static final float SLAB_THREE_ABOVE_TAX_RATE = 0.3f; + private static final int MONTHS = 12; + private static final float RATE = 0.1f; + + public PayrollServicesImpl() throws PayRollServicesNotFoundException { + try { + dao = Provider.getPayrollServices("repoProvider"); + } catch (Exception e) { + throw new PayRollServicesNotFoundException(e); + } + } + + @Override + public int acceptCustomerDetails(String associateName, String emailId, + String panCard, int basicSalary, int pf, int comapnyPf, + int investment) throws PayRollServicesNotFoundException { + + int associateId = dao.insertAssociate(new Associate(associateName, + emailId, panCard, basicSalary, pf, comapnyPf, investment)); + return associateId; + } + + @Override + public int calculateMonthlyNetSalary(int associateId) + throws InValidAssociateIDException, + AssociateDetailsNotFoundException, PayRollServicesNotFoundException { + Associate associate = null; + int grossAnnualSalary; + int annualTax = 0, taxableAmount, annualInvestment, slabTwoTax, slabThreeTax; + + if (associateId < 100) { + throw new InValidAssociateIDException(); + } else { + associate = dao.getAssociate(associateId); + if (associate == null) { + throw new AssociateDetailsNotFoundException(); + } else { + associate.setHra((int) (RATE * associate.getBasicSalary())); + associate.setTa((int) (RATE * associate.getBasicSalary())); + associate.setDa((int) (RATE * associate.getBasicSalary())); + associate.setGrossSalary(associate.getBasicSalary() + + associate.getHra() + associate.getTa() + + associate.getDa() + associate.getCompanyPf()); + + annualInvestment = (associate.getPf() * MONTHS) + + (associate.getCompanyPf() * MONTHS) + + associate.getInvestment(); + + if (annualInvestment > INVESTMENT_EXEMPTION_LIMIT) + annualInvestment = INVESTMENT_EXEMPTION_LIMIT; + + grossAnnualSalary = associate.getGrossSalary() * MONTHS; + taxableAmount = grossAnnualSalary; + slabTwoTax = (int) ((SLAB_TWO_AMOUNT - annualInvestment) * SLAB_TWO_TAX_RATE); + slabThreeTax = (int) (SLAB_THREE_AMOUNT * SLAB_THREE_TAX_RATE); + + if (grossAnnualSalary < SLAB_ONE_UPPER_LIMIT) { + annualTax = 0; + } else if (grossAnnualSalary >= SLAB_ONE_UPPER_LIMIT + && grossAnnualSalary < SLAB_TWO_UPPER_LIMIT) { + taxableAmount = taxableAmount - SLAB_ONE_UPPER_LIMIT; + if ((taxableAmount - annualInvestment) < 0) { + annualTax = 0; + } else { + annualTax = (int) ((taxableAmount - annualInvestment) * SLAB_TWO_TAX_RATE); + } + } else if (grossAnnualSalary >= SLAB_TWO_UPPER_LIMIT + && grossAnnualSalary < SLAB_THREE_UPPER_LIMIT) { + taxableAmount = taxableAmount - SLAB_TWO_UPPER_LIMIT; + annualTax = (int) (taxableAmount * SLAB_THREE_TAX_RATE) + + slabTwoTax; + } else { + taxableAmount = taxableAmount - SLAB_THREE_UPPER_LIMIT; + annualTax = (int) (taxableAmount * SLAB_THREE_ABOVE_TAX_RATE) + + slabTwoTax + slabThreeTax; + } + associate.setMonthlyTax(annualTax / MONTHS); + associate.setNetSalary(associate.getGrossSalary() + - associate.getPf() - associate.getCompanyPf() + - associate.getMonthlyTax()); + dao.updateAssociate(associate); + } + } + return associate.getNetSalary(); + } + + @Override + public Associate getAssociateDetails(int associateId) + throws InValidAssociateIDException, + AssociateDetailsNotFoundException { + if (associateId < 100) { + throw new InValidAssociateIDException(); + } else if (dao.getAssociate(associateId) == null) { + throw new AssociateDetailsNotFoundException(); + } else { + return dao.getAssociate(associateId); + } + } + + @Override + public boolean closePayrollServices() + throws PayRollServicesNotFoundException { + if (dao.closePayrollDAOServices() == true) + return true; + else + return false; + } + + @Override + public ArrayList getAllAssociateDetails() + throws PayRollServicesNotFoundException { + if (dao.getAssociates() == null) { + throw new PayRollServicesNotFoundException(); + } else { + return dao.getAssociates(); + } + } +} diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/resources/data.properties b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/resources/data.properties new file mode 100644 index 0000000..a5cab98 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/resources/data.properties @@ -0,0 +1,2 @@ +serviceProvider =com.zensar.payroll.services.PayrollServicesImpl +repoProvider = com.zensar.payroll.daoservices.PayrollDAOServicesImpl diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/resources/storeAssociates.txt b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/resources/storeAssociates.txt new file mode 100644 index 0000000..95671e1 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/resources/storeAssociates.txt differ diff --git a/projects/JAVA-PROJECTS-master/Banking/bin/com/zensar/bankingsystem/beans/Account.class b/projects/JAVA-PROJECTS-master/Banking/bin/com/zensar/bankingsystem/beans/Account.class new file mode 100644 index 0000000..5498b41 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Banking/bin/com/zensar/bankingsystem/beans/Account.class differ diff --git a/projects/JAVA-PROJECTS-master/Banking/bin/com/zensar/bankingsystem/beans/Address.class b/projects/JAVA-PROJECTS-master/Banking/bin/com/zensar/bankingsystem/beans/Address.class new file mode 100644 index 0000000..0d83f39 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Banking/bin/com/zensar/bankingsystem/beans/Address.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Account.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Account.class new file mode 100644 index 0000000..9cf39ce Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Account.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Address.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Address.class new file mode 100644 index 0000000..0d83f39 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Address.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Customer.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Customer.class new file mode 100644 index 0000000..43e995e Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Customer.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/MyDate.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/MyDate.class new file mode 100644 index 0000000..3c1847a Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/MyDate.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Transaction.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Transaction.class new file mode 100644 index 0000000..c127dbb Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Transaction.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/client/ClientCode.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/client/ClientCode.class new file mode 100644 index 0000000..d466fce Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/client/ClientCode.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/dao/BankingRepositoryServices.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/dao/BankingRepositoryServices.class new file mode 100644 index 0000000..62be6cd Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/dao/BankingRepositoryServices.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class new file mode 100644 index 0000000..fd3ccd9 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/BankServices.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/BankServices.class new file mode 100644 index 0000000..22740e6 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/BankServices.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.class new file mode 100644 index 0000000..26278e2 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.class new file mode 100644 index 0000000..16c41d2 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.class new file mode 100644 index 0000000..7549841 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.class new file mode 100644 index 0000000..4bec9f3 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAmountException.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAmountException.class new file mode 100644 index 0000000..2514556 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAmountException.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.class new file mode 100644 index 0000000..d90f258 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidPincodeException.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidPincodeException.class new file mode 100644 index 0000000..528cad7 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidPincodeException.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/BankServices.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/BankServices.class new file mode 100644 index 0000000..4fdcfd2 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/BankServices.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class new file mode 100644 index 0000000..1157bd8 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/ZensarBankingServices.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/ZensarBankingServices.class new file mode 100644 index 0000000..96dbf36 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/ZensarBankingServices.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Account.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Account.java new file mode 100644 index 0000000..a3d8080 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Account.java @@ -0,0 +1,59 @@ +package com.zensar.bankingsystem.beans; + +public class Account { + + private int accountId; + private String accountType; + private int balance; + private int pin; + + public Account() { + super(); + } + + public Account(int accountId, String accountType, int balance) { + super(); + this.accountId = accountId; + this.accountType = accountType; + this.balance = balance; + } + + public Account(String accountType, int balance) { + super(); + this.accountType = accountType; + this.balance = balance; + } + + public int getAccountId() { + return accountId; + } + + public void setAccountId(int accountId) { + this.accountId = accountId; + } + + public String getAccountType() { + return accountType; + } + + public void setAccountType(String accountType) { + this.accountType = accountType; + } + + public int getBalance() { + return balance; + } + + public void setBalance(int balance) { + this.balance = balance; + } + + public int getPin() { + return pin; + } + + public void setPin(int pin) { + this.pin = pin; + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Address.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Address.java new file mode 100644 index 0000000..1400f16 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Address.java @@ -0,0 +1,50 @@ +package com.zensar.bankingsystem.beans; + +public class Address { + + private String city; + private String state; + private int pinCode; + + public Address() { + super(); + } + + public Address(String city, String state, int pinCode) { + super(); + this.city = city; + this.state = state; + this.pinCode = pinCode; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public int getPinCode() { + return pinCode; + } + + public void setPinCode(int pinCode) { + this.pinCode = pinCode; + } + + @Override + public String toString() { + return "Address [city=" + city + ", state=" + state + ", pinCode=" + + pinCode + "]"; + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Customer.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Customer.java new file mode 100644 index 0000000..fcab67a --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Customer.java @@ -0,0 +1,89 @@ +package com.zensar.bankingsystem.beans; + +public class Customer { + + private int customerId; + private String customerName; + private Address laddress; + private Address haddress; + private MyDate dob; + private Account[] account = new Account[3]; + + public Customer() { + super(); + } + + public Customer(int customerId, String customerName, Address laddress, + Address haddress) { + super(); + this.customerId = customerId; + this.customerName = customerName; + this.laddress = laddress; + this.haddress = haddress; + } + + public Customer(String customerName, Address laddress, Address haddress) { + super(); + this.customerName = customerName; + this.laddress = laddress; + this.haddress = haddress; + } + + public Customer(String customerName, Address laddress, Address haddress, + MyDate dob) { + super(); + this.customerName = customerName; + this.laddress = laddress; + this.haddress = haddress; + this.dob = dob; + } + + public int getCustomerId() { + return customerId; + } + + public void setCustomerId(int customerId) { + this.customerId = customerId; + } + + public String getCustomerName() { + return customerName; + } + + public void setCustomerName(String customerName) { + this.customerName = customerName; + } + + public Address getLaddress() { + return laddress; + } + + public void setLaddress(Address laddress) { + this.laddress = laddress; + } + + public Address getHaddress() { + return haddress; + } + + public void setHaddress(Address haddress) { + this.haddress = haddress; + } + + public Account[] getAccount() { + return account; + } + + public void setAccount(Account[] account) { + this.account = account; + } + + public MyDate getDob() { + return dob; + } + + public void setDob(MyDate dob) { + this.dob = dob; + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/MyDate.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/MyDate.java new file mode 100644 index 0000000..4e75da6 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/MyDate.java @@ -0,0 +1,65 @@ +package com.zensar.bankingsystem.beans; + +public class MyDate { + + private int day; + private int month; + private int year; + + public MyDate() { + super(); + day = 0; + month = 0; + year = 0; + } + + public MyDate(int day, int month, int year) { + super(); + this.day = day; + this.month = month; + this.year = year; + } + + public int getDay() { + return day; + } + + public void setDay(int day) { + this.day = day; + } + + public int getMonth() { + return month; + } + + public void setMonth(int month) { + this.month = month; + } + + public int getYear() { + return year; + } + + public void setYear(int year) { + this.year = year; + } + + @Override + public String toString() { + return "MyDate [day=" + day + ", month=" + month + ", year=" + year + + "]"; + } + + @Override + public boolean equals(Object arg) { + System.out.println(this); + MyDate date = (MyDate) arg; + if (this.day == date.day && this.month == date.month + && this.year == date.year) { + return true; + } + + return false; + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Transaction.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Transaction.java new file mode 100644 index 0000000..b84c4e8 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Transaction.java @@ -0,0 +1,5 @@ +package com.zensar.bankingsystem.beans; + +public class Transaction { + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/client/ClientCode.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/client/ClientCode.java new file mode 100644 index 0000000..016a406 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/client/ClientCode.java @@ -0,0 +1,255 @@ +package com.zensar.bankingsystem.client; + +import java.util.Scanner; + +import com.zensar.bankingsystem.beans.Account; +import com.zensar.bankingsystem.services.ZensarBankingServiceImpl; + +public class ClientCode { + + public static void main(String[] args) { + String name = null; + String localAdrressCity = null; + String localAdrressState = null; + int localAdrressPinCode = 0; + String homeAdrressCity = null; + String homeAdrressState = null; + int homeAdrressPinCode = 0; + int customerId = 0; + String accountType = null; + int initialBalance = 0; + char decision; + int choice = 0; + int amount = 0, balance = 0; + int day, month, year = 0; + int oldPin, newPin = 0, pin = 0; + + Scanner scanner = new Scanner(System.in); + + ZensarBankingServiceImpl zensarBankingService = new ZensarBankingServiceImpl(); + + System.out.println("Welcome to Zensar Banking Service"); + + do { + + System.out.println("1. Customer Registration"); + System.out.println("2. Open Account"); + System.out.println("3. Withdraw"); + System.out.println("4. Deposit"); + System.out.println("5. Transfer"); + System.out.println("6. Check balance"); + System.out.println("7. Change pin"); + System.out.println("8. Get Account details"); + System.out.println("9. Get all account details"); + System.out.println("Enter your option"); + choice = scanner.nextInt(); + + switch (choice) { + case 1: + // Registration + System.out.println("Enter your name"); + name = scanner.next(); + + System.out.println("Enter your local address"); + System.out.println("Enter your city"); + localAdrressCity = scanner.next(); + System.out.println("Enter your state"); + localAdrressState = scanner.next(); + System.out.println("Enter your pin code"); + localAdrressPinCode = scanner.nextInt(); + + System.out.println("Enter your home address"); + System.out.println("Enter your city"); + homeAdrressCity = scanner.next(); + System.out.println("Enter your state"); + homeAdrressState = scanner.next(); + System.out.println("Enter your pin code"); + homeAdrressPinCode = scanner.nextInt(); + + System.out.println("Enter your date of birth"); + System.out.println("Enter the day"); + day = scanner.nextInt(); + System.out.println("Enter the month"); + month = scanner.nextInt(); + System.out.println("Enter the year"); + year = scanner.nextInt(); + + int id = zensarBankingService.acceptCustomerDetails(name, + localAdrressCity, localAdrressState, + localAdrressPinCode, homeAdrressCity, homeAdrressState, + homeAdrressPinCode, day, month, year); + + if (id > 0) { + System.out + .println("You were successfully registered with customer ID " + + id); + + } else + System.out.println("Sorry could not register"); + + break; + + case 2: + // open an account + System.out.println("Enter your customer Id to open an account"); + customerId = scanner.nextInt(); + + System.out.println("Enter your account type "); + accountType = scanner.next(); + + System.out.println("Enter your initial balance "); + initialBalance = scanner.nextInt(); + int accountId = zensarBankingService.openAccount(customerId, + initialBalance, accountType); + + if (accountId == 0) { + System.out.println("Sorry account could not be created"); + } else { + System.out.println("Account created with account Id " + + accountId); + pin = zensarBankingService.generatePin(customerId, + accountId); + System.out.println("Your pin is " + pin); + } + + break; + case 3: + // withdraw + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + System.out.println("Enter your account Id"); + accountId = scanner.nextInt(); + System.out.println("Enter the amount to withdraw"); + amount = scanner.nextInt(); + System.out.println("Enter your pin"); + pin = scanner.nextInt(); + + balance = zensarBankingService.withdraw(customerId, accountId, + amount, pin); + + if (balance > 0) { + System.out + .println("Amount withdrawn successfully with remaining balance " + + balance); + } else if (balance < 0) { + System.out.println("Cannot withdraw,negative balance"); + } else { + System.out.println("Sorry you have not registered"); + } + + break; + case 4: + // deposit + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + System.out.println("Enter your account Id"); + accountId = scanner.nextInt(); + System.out.println("Enter the amount to deposit"); + amount = scanner.nextInt(); + + balance = zensarBankingService.deposit(customerId, accountId, + amount); + System.out + .println("Amount successfully deposited, balance is " + + balance); + + break; + case 5: + // transfer fund + System.out.println("Enter your customer Id"); + int custIdFrom = scanner.nextInt(); + System.out.println("Enter your account Id"); + int accNoFrom = scanner.nextInt(); + System.out.println("Enter your pin"); + pin = scanner.nextInt(); + System.out.println("Enter the customer Id to transfer to"); + int custIdTo = scanner.nextInt(); + System.out.println("Enter the account Id to transfer to"); + int accNoTo = scanner.nextInt(); + System.out.println("Enter the amount to tansfer"); + int amt = scanner.nextInt(); + + boolean result = zensarBankingService.fundTransfer(custIdFrom, + accNoFrom, custIdTo, accNoTo, amt, pin); + if (result == true) { + System.out.println("Fund transfer successful"); + } else { + System.out.println("Fund transfer not successful"); + } + break; + case 6: + // get balance + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + System.out.println("Enter your account Id"); + accountId = scanner.nextInt(); + System.out.println("Enter your pin"); + pin = scanner.nextInt(); + System.out.println(zensarBankingService.getAccountBalance( + customerId, accountId, pin)); + break; + case 7: + // change pin + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + System.out.println("Enter your account Id"); + accountId = scanner.nextInt(); + System.out.println("Enter your current pin"); + oldPin = scanner.nextInt(); + System.out.println("Enter new pin"); + newPin = scanner.nextInt(); + result = zensarBankingService.changePin(customerId, accountId, + oldPin, newPin); + if (result == true) { + System.out.println("Pin changed successfully"); + } else { + + System.out.println("Pin change not successful"); + } + break; + case 8: + // get account details + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + System.out.println("Enter your account Id"); + accountId = scanner.nextInt(); + Account acc = zensarBankingService.getAccountDetails( + customerId, accountId); + System.out.println("Account No " + acc.getAccountId()); + System.out.println("Account Type " + acc.getAccountType()); + System.out.println("Account Balance " + acc.getBalance()); + break; + case 9: + // get all account details + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + Account[] a = zensarBankingService + .getAllAccountsDetails(customerId); + System.out.println("Account deatils are:"); + for (int i = 0; i < a.length; i++) { + if (a[i] != null) { + System.out.println("Account No " + a[i].getAccountId()); + System.out.println("Account Type " + + a[i].getAccountType()); + System.out.println("Account Balance " + + a[i].getBalance()); + } + + } + break; + default: + System.out.println("Invalid choice"); + break; + } + + System.out.println("Do you wish to continue?(Y/N)"); + decision = scanner.next().charAt(0); + if (decision == 'n' || decision == 'N') { + System.out.println("Thank you for using the banking system"); + System.exit(0); + } + } while (decision == 'y' || decision == 'Y'); + + scanner.close(); + } +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/dao/BankingRepositoryServices.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/dao/BankingRepositoryServices.java new file mode 100644 index 0000000..1af196e --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/dao/BankingRepositoryServices.java @@ -0,0 +1,30 @@ +package com.zensar.bankingsystem.dao; + +import com.zensar.bankingsystem.beans.Account; +import com.zensar.bankingsystem.beans.Customer; +import com.zensar.bankingsystem.beans.Transaction; + +public interface BankingRepositoryServices { + int insertCustomer(Customer customer); + + boolean updateCustomer(Customer customer); + + boolean updateTransaction(int custId, int accNo, Transaction transaction); + + Account getAccount(int custId, int accNo); + + Account[] getAccountList(int custId); + + Customer getCustomer(int custId); + + Transaction[] getTransactions(int custId, int accNo); + + boolean deleteCustomer(int custId); + + boolean deleteAccount(int custId, int accNo); + + int insertAccount(Account account, int custId); + + boolean updateAccount(int custId, Account account); + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java new file mode 100644 index 0000000..02c6681 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java @@ -0,0 +1,96 @@ +package com.zensar.bankingsystem.dao; + +import com.zensar.bankingsystem.beans.Account; +import com.zensar.bankingsystem.beans.Customer; +import com.zensar.bankingsystem.beans.Transaction; + +public class ZensarBankingSystemArrayImpl implements BankingRepositoryServices{ + + Customer[] customers = new Customer[10]; + + static int i = 0, j = 0, custId = 100, accId = 50; + + public int insertCustomer(Customer customer) { + customers[i++] = customer; + customer.setCustomerId(custId); + custId++; + return customer.getCustomerId(); + } + + public Customer getCustomer(int custId) { + for (Customer c : customers) { + if (c != null && c.getCustomerId() == custId) + return c; + } + return null; + } + + public boolean updateCustomer(Customer customer) { + // TODO Auto-generated method stub + return false; + } + + public boolean updateTransaction(int custId, int accNo, + Transaction transaction) { + // TODO Auto-generated method stub + return false; + } + + public Account getAccount(int custId, int accNo) { + + Account[] acc = getCustomer(custId).getAccount(); + for (int k = 0; k < 3; k++) { + if (acc[k].getAccountId() == accNo) + return acc[k]; + } + return null; + } + + public Account[] getAccountList(int custId) { + return getCustomer(custId).getAccount(); + } + + public Transaction[] getTransactions(int custId, int accNo) { + // TODO Auto-generated method stub + return null; + } + + public boolean deleteCustomer(int custId) { + // customers[] + return false; + } + + public boolean deleteAccount(int custId, int accNo) { + // TODO Auto-generated method stub + return false; + } + + public boolean updateAccount(int custId, Account account) { + // TODO Auto-generated method stub + return false; + } + + public int insertAccount(Account account, int custId) { + Account[] acc = getCustomer(custId).getAccount(); + + for (int k = 0; k < 3; k++) { + + if (acc[k] == null) { + acc[k] = new Account(accId++, account.getAccountType(), + account.getBalance()); + return acc[k].getAccountId(); + } + } + return 0; + } + + public int generateRandomNumber() { + + int pin = (int) (Math.random() * 9999); + if (pin < 1000) { + pin += 1000; + } + return pin; + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/BankServices.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/BankServices.java new file mode 100644 index 0000000..5bdda74 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/BankServices.java @@ -0,0 +1,57 @@ +package com.zensar.bankingsystem.exceptions; + +import javax.security.auth.login.AccountNotFoundException; + +import com.zensar.bankingsystem.beans.*; +import com.zensar.bankingsystem.exceptions.CustomerNotFoundException; +import com.zensar.bankingsystem.exceptions.InsufficientBalanceException; +import com.zensar.bankingsystem.exceptions.InvalidAccountNoException; +import com.zensar.bankingsystem.exceptions.InvalidAccountTypeException; +import com.zensar.bankingsystem.exceptions.InvalidAmountException; +import com.zensar.bankingsystem.exceptions.InvalidCustomerIdException; +import com.zensar.bankingsystem.exceptions.InvalidPincodeException; + +public interface BankServices { + int acceptCustomerDetails(String custName, String HomeAddressCity, + String HomeAddressState, int HomeAddressPincode, + String LocalAddressCity, String LocalAddressState, + int LocalAddressPincode) throws InvalidPincodeException; + + int openAccount(int custId, int balance, String accType) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAmountException, InvalidAccountTypeException; + + int getAccountBalance(int custId, int accNo) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException; + + int withdraw(int custId, int accNo, int amt) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException, + InvalidAmountException, InsufficientBalanceException; + + boolean fundTransfer(int custIdFrom, int accNoFrom, int custIdTo, + int accNoTo, int amt) throws InvalidCustomerIdException, + CustomerNotFoundException, InvalidAccountNoException, + AccountNotFoundException, InvalidAmountException, + InsufficientBalanceException; + + int deposit(int custId, int accNo, int amt) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException, + InvalidAmountException, InsufficientBalanceException; + + Customer getCustomerDetails(int custId) throws InvalidCustomerIdException, + CustomerNotFoundException; + + Account getAccountDetails(int custId, int accNo) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException; + + Account[] getAllAccountsDetails(int custId) + throws InvalidCustomerIdException, CustomerNotFoundException; + + Transaction[] getAllTransactionDetails(int custId, int accNo) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException; +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.java new file mode 100644 index 0000000..49528b4 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.java @@ -0,0 +1,30 @@ +package com.zensar.bankingsystem.exceptions; + +public class CustomerNotFoundException extends Exception { + + public CustomerNotFoundException() { + this("Sorry you have not registered"); + } + + public CustomerNotFoundException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public CustomerNotFoundException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public CustomerNotFoundException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public CustomerNotFoundException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.java new file mode 100644 index 0000000..7fd072f --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.java @@ -0,0 +1,30 @@ +package com.zensar.bankingsystem.exceptions; + +public class InsufficientBalanceException extends Exception { + + public InsufficientBalanceException() { + this("Insufficient Balance"); + } + + public InsufficientBalanceException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public InsufficientBalanceException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public InsufficientBalanceException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public InsufficientBalanceException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.java new file mode 100644 index 0000000..726281d --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.java @@ -0,0 +1,30 @@ +package com.zensar.bankingsystem.exceptions; + +public class InvalidAccountNoException extends Exception { + + public InvalidAccountNoException() { + this("Please enter a valid account no"); + } + + public InvalidAccountNoException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public InvalidAccountNoException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public InvalidAccountNoException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public InvalidAccountNoException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.java new file mode 100644 index 0000000..f1d6ae5 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.java @@ -0,0 +1,30 @@ +package com.zensar.bankingsystem.exceptions; + +public class InvalidAccountTypeException extends Exception { + + public InvalidAccountTypeException() { + this("Please enter a valid account type"); + } + + public InvalidAccountTypeException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public InvalidAccountTypeException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public InvalidAccountTypeException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public InvalidAccountTypeException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAmountException.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAmountException.java new file mode 100644 index 0000000..3131ff4 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAmountException.java @@ -0,0 +1,30 @@ +package com.zensar.bankingsystem.exceptions; + +public class InvalidAmountException extends Exception { + + public InvalidAmountException() { + this("Please enter a valid amount"); + } + + public InvalidAmountException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public InvalidAmountException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + public InvalidAmountException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public InvalidAmountException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.java new file mode 100644 index 0000000..794a12a --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.java @@ -0,0 +1,31 @@ +package com.zensar.bankingsystem.exceptions; + +public class InvalidCustomerIdException extends Exception { + + public InvalidCustomerIdException() { + // TODO Auto-generated constructor stub + this("Invalid customer Id,please enter a valid customer Id"); + } + + public InvalidCustomerIdException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public InvalidCustomerIdException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + public InvalidCustomerIdException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public InvalidCustomerIdException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidPincodeException.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidPincodeException.java new file mode 100644 index 0000000..7806d55 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidPincodeException.java @@ -0,0 +1,32 @@ +package com.zensar.bankingsystem.exceptions; + +public class InvalidPincodeException extends Exception { + + public InvalidPincodeException() { + // TODO Auto-generated constructor stub + this("Invalid Pin"); + } + + public InvalidPincodeException(String message) { + super(message); + + // TODO Auto-generated constructor stub + } + + public InvalidPincodeException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + public InvalidPincodeException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public InvalidPincodeException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/BankServices.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/BankServices.java new file mode 100644 index 0000000..984f44a --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/BankServices.java @@ -0,0 +1,57 @@ +package com.zensar.bankingsystem.services; + +import javax.security.auth.login.AccountNotFoundException; + +import com.zensar.bankingsystem.beans.*; +import com.zensar.bankingsystem.exceptions.CustomerNotFoundException; +import com.zensar.bankingsystem.exceptions.InsufficientBalanceException; +import com.zensar.bankingsystem.exceptions.InvalidAccountNoException; +import com.zensar.bankingsystem.exceptions.InvalidAccountTypeException; +import com.zensar.bankingsystem.exceptions.InvalidAmountException; +import com.zensar.bankingsystem.exceptions.InvalidCustomerIdException; +import com.zensar.bankingsystem.exceptions.InvalidPincodeException; + +public interface BankServices { + int acceptCustomerDetails(String custName, String HomeAddressCity, + String HomeAddressState, int HomeAddressPincode, + String LocalAddressCity, String LocalAddressState, + int LocalAddressPincode) throws InvalidPincodeException; + + int openAccount(int custId, int balance, String accType) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAmountException, InvalidAccountTypeException; + + int getAccountBalance(int custId, int accNo) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException; + + int withdraw(int custId, int accNo, int amt) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException, + InvalidAmountException, InsufficientBalanceException; + + boolean fundTransfer(int custIdFrom, int accNoFrom, int custIdTo, + int accNoTo, int amt) throws InvalidCustomerIdException, + CustomerNotFoundException, InvalidAccountNoException, + AccountNotFoundException, InvalidAmountException, + InsufficientBalanceException; + + int deposit(int custId, int accNo, int amt) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException, + InvalidAmountException, InsufficientBalanceException; + + Customer getCustomerDetails(int custId) throws InvalidCustomerIdException, + CustomerNotFoundException; + + Account getAccountDetails(int custId, int accNo) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException; + + Account[] getAllAccountsDetails(int custId) + throws InvalidCustomerIdException, CustomerNotFoundException; + + Transaction[] getAllTransactionDetails(int custId, int accNo) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException; +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java new file mode 100644 index 0000000..fd82072 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java @@ -0,0 +1,232 @@ + package com.zensar.bankingsystem.services; + +import com.zensar.bankingsystem.beans.Account; +import com.zensar.bankingsystem.beans.Address; +import com.zensar.bankingsystem.beans.Customer; +import com.zensar.bankingsystem.beans.MyDate; +import com.zensar.bankingsystem.beans.Transaction; +import com.zensar.bankingsystem.dao.ZensarBankingSystemArrayImpl; + +public class ZensarBankingServiceImpl implements ZensarBankingServices{ + + ZensarBankingSystemArrayImpl zensarBankingSystemArray; + + public ZensarBankingServiceImpl() { + zensarBankingSystemArray = new ZensarBankingSystemArrayImpl(); + + } + + /* + * public void transfer(int accountId, int tansferAccountId, double amount) + * { double a = zensarBankingSystemArray.getAccount(accountId).getBalance() + * - amount; System.out.println(a); + * zensarBankingSystemArray.getAccount(accountId).setBalance(a); double b = + * zensarBankingSystemArray.getAccount(accountId).getBalance() + amount; + * zensarBankingSystemArray.getAccount(tansferAccountId).setBalance(b); + * + * } + */ + + public int acceptCustomerDetails(String custName, String HomeAddressCity, + String HomeAddressState, int HomeAddressPincode, + String LocalAddressCity, String LocalAddressState, + int LocalAddressPincode, int day, int month, int year) { + + if ((day > 0 && day <= 31) && (month >= 1 && month <= 12) + && (year <= 2015)) { + return zensarBankingSystemArray.insertCustomer(new Customer( + custName, new Address(LocalAddressCity, LocalAddressState, + LocalAddressPincode), new Address(HomeAddressCity, + HomeAddressState, HomeAddressPincode), new MyDate( + day, month, year))); + } else + return 0; + + } + + public int openAccount(int custId, int balance, String accType) { + + int accountId = 0; + + if (custId < 99) { + System.out + .println("Invalid customer Id,please enter a valid customer Id"); + } else if (!(accType.equalsIgnoreCase("savings") + || accType.equalsIgnoreCase("current") || accType + .equalsIgnoreCase("salary"))) { + System.out + .println("Invalid account type, please enter a valid account type"); + } else if (balance < 0) { + System.out.println("Invalid amount, please amount a valid amount"); + } + + else { + Customer customer = zensarBankingSystemArray.getCustomer(custId); + + if (customer == null) { + System.out.println("Sorry you have not registered"); + return 0; + } else { + Account account = new Account(accType, balance); + accountId = zensarBankingSystemArray.insertAccount(account, + custId); + } + } + + return accountId; + + } + + public int getAccountBalance(int custId, int accNo, int pin) { + + if (checkPin(custId, accNo, pin)) { + return zensarBankingSystemArray.getAccount(custId, accNo) + .getBalance(); + } else { + System.out.println("Invalid pin"); + return 0; + } + + } + + public int withdraw(int custId, int accNo, int amt, int pin) { + int balance = 0; + if (amt < 0) { + System.out.println("Invalid amount, please enter a valid amount"); + } else { + + Customer customer = zensarBankingSystemArray.getCustomer(custId); + + if (customer == null) { + return 0; + } else { + Account account = zensarBankingSystemArray.getAccount(custId, + accNo); + if (account == null) { + System.out.println("Sorry your account does not exist"); + } else if (account.getPin()!=pin) { + System.out.println("Invalid pin"); + return 0; + } else { + if ((account.getBalance() - amt) > 0) { + account.setBalance(account.getBalance() - amt); + balance = account.getBalance(); + } + } + } + } + return balance; + } + + public boolean fundTransfer(int custIdFrom, int accNoFrom, int custIdTo, + int accNoTo, int amt, int pin) { + if (withdraw(custIdFrom, accNoFrom, amt, pin) > 0) { + deposit(custIdTo, accNoTo, amt); + return true; + } + return false; + } + + public int deposit(int custId, int accNo, int amt) { + if (amt < 0) { + System.out.println("Invalid amount, please enter a valid amount"); + } else { + + zensarBankingSystemArray.getAccount(custId, accNo).setBalance( + zensarBankingSystemArray.getAccount(custId, accNo) + .getBalance() + amt); + + return zensarBankingSystemArray.getAccount(custId, accNo) + .getBalance(); + } + return 0; + } + + public Customer getCustomerDetails(int custId) { + Customer customer = zensarBankingSystemArray.getCustomer(custId); + if (customer != null) { + return customer; + } + return null; + } + + public Account getAccountDetails(int custId, int accNo) { + Account account = zensarBankingSystemArray.getAccount(custId, accNo); + if (account != null) { + return account; + } + return null; + } + + public Account[] getAllAccountsDetails(int custId) { + Account[] account = zensarBankingSystemArray.getAccountList(custId); + if (account != null) { + return account; + } + return null; + } + + public Transaction[] getAllTransactionDetails(int custId, int accNo) { + // TODO Auto-generated method stub + return null; + } + + public int generatePin(int custId, int accNo) { + Account account = zensarBankingSystemArray.getAccount(custId, accNo); + int pin = zensarBankingSystemArray.generateRandomNumber(); + account.setPin(pin); + return account.getPin(); + } + + public boolean changePin(int custId, int accNo, int oldPin, int newPin) { + Account account = zensarBankingSystemArray.getAccount(custId, accNo); + if (account != null) { + if (account.getPin() == oldPin) { + account.setPin(newPin); + return true; + } + } + + return false; + } + + public boolean checkPin(int custId, int accNo, int pin) { + Account account = zensarBankingSystemArray.getAccount(custId, accNo); + if (account != null) { + if (account.getPin() == pin) { + return true; + } + } + return false; + + } + + @Override + public int acceptCustomerDetails(String custName, String HomeAddressCity, + String HomeAddressState, int HomeAddressPincode, + String LocalAddressCity, String LocalAddressState, + int LocalAddressPincode) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getAccountBalance(int custId, int accNo) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int withdraw(int custId, int accNo, int amt) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public boolean fundTransfer(int custIdFrom, int accNoFrom, int custIdTo, + int accNoTo, int amt) { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/ZensarBankingServices.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/ZensarBankingServices.java new file mode 100644 index 0000000..e17b61a --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/ZensarBankingServices.java @@ -0,0 +1,32 @@ +package com.zensar.bankingsystem.services; + +import com.zensar.bankingsystem.beans.Account; +import com.zensar.bankingsystem.beans.Customer; +import com.zensar.bankingsystem.beans.Transaction; + +public interface ZensarBankingServices { + int acceptCustomerDetails(String custName, String HomeAddressCity, + String HomeAddressState, int HomeAddressPincode, + String LocalAddressCity, String LocalAddressState, + int LocalAddressPincode); + + int openAccount(int custId, int balance, String accType); + + int getAccountBalance(int custId, int accNo); + + int withdraw(int custId, int accNo, int amt); + + boolean fundTransfer(int custIdFrom, int accNoFrom, int custIdTo, + int accNoTo, int amt); + + int deposit(int custId, int accNo, int amt); + + Customer getCustomerDetails(int custId); + + Account getAccountDetails(int custId, int accNo); + + Account[] getAllAccountsDetails(int custId); + + Transaction[] getAllTransactionDetails(int custId, int accNo); + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Account.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Account.class new file mode 100644 index 0000000..268b955 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Account.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Address.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Address.class new file mode 100644 index 0000000..0d83f39 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Address.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Customer.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Customer.class new file mode 100644 index 0000000..bf016f7 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Customer.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Transaction.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Transaction.class new file mode 100644 index 0000000..5971020 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Transaction.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/client/ClientCode.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/client/ClientCode.class new file mode 100644 index 0000000..9b73a14 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/client/ClientCode.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/dao/BankingRepositoryServices.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/dao/BankingRepositoryServices.class new file mode 100644 index 0000000..37bfbdb Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/dao/BankingRepositoryServices.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class new file mode 100644 index 0000000..1c402f0 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.class new file mode 100644 index 0000000..26278e2 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.class new file mode 100644 index 0000000..16c41d2 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.class new file mode 100644 index 0000000..7549841 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.class new file mode 100644 index 0000000..4bec9f3 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAmountException.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAmountException.class new file mode 100644 index 0000000..2514556 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAmountException.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.class new file mode 100644 index 0000000..d90f258 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidPincodeException.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidPincodeException.class new file mode 100644 index 0000000..528cad7 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidPincodeException.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/repoprovider/ConnectionProvider.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/repoprovider/ConnectionProvider.class new file mode 100644 index 0000000..5462d3a Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/repoprovider/ConnectionProvider.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/repoprovider/RepositoryProvider.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/repoprovider/RepositoryProvider.class new file mode 100644 index 0000000..a25494d Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/repoprovider/RepositoryProvider.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/serviceprovider/ServiceProvider.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/serviceprovider/ServiceProvider.class new file mode 100644 index 0000000..24971bb Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/serviceprovider/ServiceProvider.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/services/BankServices.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/services/BankServices.class new file mode 100644 index 0000000..3e2ce4a Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/services/BankServices.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class new file mode 100644 index 0000000..021839f Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/resources/data.properties b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/resources/data.properties new file mode 100644 index 0000000..fe849f7 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/resources/data.properties @@ -0,0 +1,2 @@ +provider=com.zensar.bankingsystem.services.ZensarBankingServiceImpl +repoprovider=com.zensar.bankingsystem.dao.ZensarBankingSystemArrayImpl \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/resources/oracle.properties b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/resources/oracle.properties new file mode 100644 index 0000000..0139adb --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/resources/oracle.properties @@ -0,0 +1,4 @@ +Driver=oracle.jdbc.driver.OracleDriver +url=jdbc:oracle:thin:@localhost:1521/XE +username=system +password=zensar \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/sql.txt b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/sql.txt new file mode 100644 index 0000000..6542008 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/sql.txt @@ -0,0 +1,74 @@ +CREATE TABLE CUSTOMER +( +customerId NUMBER, +customerName VARCHAR(20), +PRIMARY KEY(customerId) +) + +CREATE TABLE ACCOUNT +( +accountId NUMBER, +customerId NUMBER, +accountType VARCHAR(20), +balance NUMBER(10,3), +PRIMARY KEY(accountId), +FOREIGN KEY(customerId) REFERENCES CUSTOMER(customerId) +) + +CREATE TABLE TRANSACTION +( +transactionId NUMBER, +accountId NUMBER, +transactionType VARCHAR(20), +transactionAmount NUMBER(10,3), +PRIMARY KEY(transactionId), +FOREIGN KEY(accountId) REFERENCES ACCOUNT(accountId) +) + +CREATE TABLE ADDRESS +( +customerId NUMBER, +localCity VARCHAR(20), +localState VARCHAR(20), +localPincode VARCHAR(20), +homeCity VARCHAR(20), +homeState VARCHAR(20), +homePincode VARCHAR(20), +FOREIGN KEY(customerId) REFERENCES CUSTOMER(customerId) +) + +DESCRIBE CUSTOMER +DESCRIBE ACCOUNT +DESCRIBE TRANSACTION +DESCRIBE ADDRESS + + +SELECT * FROM CUSTOMER +SELECT * FROM ADDRESS +SELECT * FROM ACCOUNT +SELECT * FROM TRANSACTION +DELETE FROM CUSTOMER + +CREATE SEQUENCE CUSTID +INCREMENT BY 1 +START WITH 100 + +CREATE SEQUENCE TRANID +INCREMENT BY 1 +START WITH 1 + +CREATE SEQUENCE ACCID +INCREMENT BY 1 +START WITH 50 + +DROP SEQUENCE CUSTID + +SELECT CUSTID.CURRVAL FROM DUAL + select CUSTID.nextval from dual; + +ALTER SESSION SET CURRENT_SCHEMA =AKASH + +DROP TABLE CUSTOMER +DROP TABLE ADDRESS +DROP TABLE TRANSACTION +DROP TABLE ACCOUNT \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Account.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Account.java new file mode 100644 index 0000000..fe60813 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Account.java @@ -0,0 +1,68 @@ +package com.zensar.bankingsystem.beans; + +import java.util.ArrayList; + +public class Account { + + private int accountId; + private String accountType; + private int balance; + private ArrayList transactions = new ArrayList(); + + public Account() { + super(); + } + + public Account(int accountId, String accountType, int balance) { + super(); + this.accountId = accountId; + this.accountType = accountType; + this.balance = balance; + } + + public Account(String accountType, int balance) { + super(); + this.accountType = accountType; + this.balance = balance; + } + + public int getAccountId() { + return accountId; + } + + public void setAccountId(int accountId) { + this.accountId = accountId; + } + + public String getAccountType() { + return accountType; + } + + public void setAccountType(String accountType) { + this.accountType = accountType; + } + + public int getBalance() { + return balance; + } + + public void setBalance(int balance) { + this.balance = balance; + } + + public ArrayList getTransactions() { + return transactions; + } + + public void setTransactions(ArrayList transactions) { + this.transactions = transactions; + } + + @Override + public String toString() { + return "Account [accountId=" + accountId + ", accountType=" + + accountType + ", balance=" + balance + ", transactions=" + + transactions + "]"; + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Address.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Address.java new file mode 100644 index 0000000..1400f16 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Address.java @@ -0,0 +1,50 @@ +package com.zensar.bankingsystem.beans; + +public class Address { + + private String city; + private String state; + private int pinCode; + + public Address() { + super(); + } + + public Address(String city, String state, int pinCode) { + super(); + this.city = city; + this.state = state; + this.pinCode = pinCode; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public int getPinCode() { + return pinCode; + } + + public void setPinCode(int pinCode) { + this.pinCode = pinCode; + } + + @Override + public String toString() { + return "Address [city=" + city + ", state=" + state + ", pinCode=" + + pinCode + "]"; + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Customer.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Customer.java new file mode 100644 index 0000000..732feb2 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Customer.java @@ -0,0 +1,75 @@ +package com.zensar.bankingsystem.beans; + +import java.util.ArrayList; + +public class Customer { + + private int customerId; + private String customerName; + private Address laddress; + private Address haddress; + private ArrayList account = new ArrayList(3); + + public Customer() { + super(); + } + + public Customer(int customerId, String customerName, Address laddress, + Address haddress) { + super(); + this.customerId = customerId; + this.customerName = customerName; + this.laddress = laddress; + this.haddress = haddress; + } + + public Customer(String customerName, Address laddress, Address haddress) { + super(); + this.customerName = customerName; + this.laddress = laddress; + this.haddress = haddress; + } + + public int getCustomerId() { + return customerId; + } + + public void setCustomerId(int customerId) { + this.customerId = customerId; + } + + public String getCustomerName() { + return customerName; + } + + public void setCustomerName(String customerName) { + this.customerName = customerName; + } + + public Address getLaddress() { + return laddress; + } + + public void setLaddress(Address laddress) { + this.laddress = laddress; + } + + public Address getHaddress() { + return haddress; + } + + public void setHaddress(Address haddress) { + this.haddress = haddress; + } + + public ArrayList getAccount() { + return account; + } + + public void setAccount(ArrayList account) { + this.account = account; + } + + + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Transaction.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Transaction.java new file mode 100644 index 0000000..25ab440 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Transaction.java @@ -0,0 +1,51 @@ +package com.zensar.bankingsystem.beans; + +public class Transaction { + + private int transactionID; + private String transactionType; + private int transactionAmount; + + public Transaction() { + } + + public Transaction(int transactionID, String transactionType, + int transactionAmount) { + super(); + this.transactionID = transactionID; + this.transactionType = transactionType; + this.transactionAmount = transactionAmount; + } + + public int getTransactionID() { + return transactionID; + } + + public void setTransactionID(int transactionID) { + this.transactionID = transactionID; + } + + public String getTransactionType() { + return transactionType; + } + + public void setTransactionType(String transactionType) { + this.transactionType = transactionType; + } + + public int getTransactionAmount() { + return transactionAmount; + } + + public void setTransactionAmount(int transactionAmount) { + this.transactionAmount = transactionAmount; + } + + @Override + public String toString() { + return "Transaction [transactionID=" + transactionID + + ", transactionType=" + transactionType + + ", transactionAmount=" + transactionAmount + "]"; + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/client/ClientCode.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/client/ClientCode.java new file mode 100644 index 0000000..f65a80b --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/client/ClientCode.java @@ -0,0 +1,294 @@ +package com.zensar.bankingsystem.client; + +import java.util.ArrayList; +import java.util.Scanner; + +import javax.security.auth.login.AccountNotFoundException; + +import com.zensar.bankingsystem.beans.Account; +import com.zensar.bankingsystem.beans.Transaction; +import com.zensar.bankingsystem.exceptions.CustomerNotFoundException; +import com.zensar.bankingsystem.exceptions.InsufficientBalanceException; +import com.zensar.bankingsystem.exceptions.InvalidAccountNoException; +import com.zensar.bankingsystem.exceptions.InvalidAccountTypeException; +import com.zensar.bankingsystem.exceptions.InvalidAmountException; +import com.zensar.bankingsystem.exceptions.InvalidCustomerIdException; +import com.zensar.bankingsystem.exceptions.InvalidPincodeException; +import com.zensar.bankingsystem.serviceprovider.ServiceProvider; +import com.zensar.bankingsystem.services.BankServices; + +public class ClientCode { + + public static void main(String[] args) { + String name = null; + String localAdrressCity = null; + String localAdrressState = null; + int localAdrressPinCode = 0; + String homeAdrressCity = null; + String homeAdrressState = null; + int homeAdrressPinCode = 0; + int customerId = 0; + String accountType = null; + int initialBalance = 0; + char decision; + int choice = 0; + int amount = 0, balance = 0; + + Scanner scanner = new Scanner(System.in); + + BankServices zensarBankingService = ServiceProvider.getProvider(); + + System.out.println("Welcome to Zensar Banking Service"); + + do { + + System.out.println("1. Customer Registration"); + System.out.println("2. Open Account"); + System.out.println("3. Withdraw"); + System.out.println("4. Deposit"); + System.out.println("5. Transfer"); + System.out.println("6. Check balance"); + System.out.println("8. Get Account details"); + System.out.println("9. Get all account details"); + System.out.println("10. Delete customer"); + System.out.println("Enter your option"); + + try { + choice = scanner.nextInt(); + + switch (choice) { + case 1: + // Registration + System.out.println("Enter your name"); + name = scanner.next(); + + System.out.println("Enter your local address"); + System.out.println("Enter your city"); + localAdrressCity = scanner.next(); + System.out.println("Enter your state"); + localAdrressState = scanner.next(); + System.out.println("Enter your pin code"); + localAdrressPinCode = scanner.nextInt(); + + System.out.println("Enter your home address"); + System.out.println("Enter your city"); + homeAdrressCity = scanner.next(); + System.out.println("Enter your state"); + homeAdrressState = scanner.next(); + System.out.println("Enter your pin code"); + homeAdrressPinCode = scanner.nextInt(); + + int id; + + id = zensarBankingService.acceptCustomerDetails(name, + localAdrressCity, localAdrressState, + localAdrressPinCode, homeAdrressCity, + homeAdrressState, homeAdrressPinCode); + System.out + .println("You were successfully registered with customer ID " + + id); + + break; + + case 2: + // open an account + System.out + .println("Enter your customer Id to open an account"); + customerId = scanner.nextInt(); + + System.out.println("Enter your account type "); + accountType = scanner.next(); + + System.out.println("Enter your initial balance "); + initialBalance = scanner.nextInt(); + int accountId; + accountId = zensarBankingService.openAccount(customerId, + initialBalance, accountType); + + System.out.println("Account created with account Id " + + accountId); + + break; + case 3: + // withdraw + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + System.out.println("Enter your account Id"); + accountId = scanner.nextInt(); + System.out.println("Enter the amount to withdraw"); + amount = scanner.nextInt(); + + balance = zensarBankingService.withdraw(customerId, + accountId, amount); + System.out + .println("Amount withdrawn successfully with remaining balance " + + balance); + + break; + case 4: + // deposit + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + System.out.println("Enter your account Id"); + accountId = scanner.nextInt(); + System.out.println("Enter the amount to deposit"); + amount = scanner.nextInt(); + + balance = zensarBankingService.deposit(customerId, + accountId, amount); + System.out + .println("Amount successfully deposited, balance is " + + balance); + + break; + case 5: + System.out.println("Enter your customer Id"); + int custIdFrom = scanner.nextInt(); + System.out.println("Enter your account Id"); + int accNoFrom = scanner.nextInt(); + System.out.println("Enter the customer Id to transfer to"); + int custIdTo = scanner.nextInt(); + System.out.println("Enter the account Id to transfer to"); + int accNoTo = scanner.nextInt(); + System.out.println("Enter the amount to tansfer"); + int amt = scanner.nextInt(); + + boolean result = zensarBankingService.fundTransfer( + custIdFrom, accNoFrom, custIdTo, accNoTo, amt); + if (result == true) { + System.out.println("Fund transfer successful"); + } else { + System.out.println("Fund transfer not successful"); + } + break; + case 6: + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + System.out.println("Enter your account Id"); + accountId = scanner.nextInt(); + int b = zensarBankingService.getAccountBalance(customerId, + accountId); + System.out.println(b); + + break; + case 8: + // get account details + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + System.out.println("Enter your account Id"); + accountId = scanner.nextInt(); + Account acc; + acc = zensarBankingService.getAccountDetails(customerId, + accountId); + + System.out.println("Account No " + acc.getAccountId()); + System.out.println("Account Type " + acc.getAccountType()); + System.out.println("Account Balance " + acc.getBalance()); + + System.out.println("Transactions:"); + ArrayList transactions = zensarBankingService + .getAllTransactionDetails(customerId, accountId); + if (transactions == null) { + System.out.println("No transactions yet"); + } else { + for (Transaction transaction : transactions) { + System.out.println("\nID: " + + transaction.getTransactionID()); + System.out.println("Type: " + + transaction.getTransactionType()); + System.out + .println("Amount: " + + transaction + .getTransactionAmount() + + "\n"); + } + } + + break; + case 9: + // get all account details + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + ArrayList a; + a = zensarBankingService.getAllAccountsDetails(customerId); + System.out.println("Account deatils are:"); + for (Account account : a) { + if (account != null) { + System.out.println("Account No: " + + account.getAccountId()); + System.out.println("Account Type: " + + account.getAccountType()); + System.out.println("Account Balance: " + + account.getBalance()); + + System.out.println("Transactions:"); + + ArrayList transactions1 = zensarBankingService + .getAllTransactionDetails(customerId, + account.getAccountId()); + if (transactions1 == null) { + System.out.println("No transactions yet"); + } else { + for (Transaction transaction : transactions1) { + System.out.println("\nID: " + + transaction.getTransactionID()); + System.out.println("Type: " + + transaction.getTransactionType()); + System.out.println("Amount: " + + transaction + .getTransactionAmount() + + "\n"); + } + + System.out.println("****************"); + } + + } + } + + break; + case 10: + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + break; + default: + System.out.println("Invalid choice"); + break; + } + } catch (AccountNotFoundException e) { + // e.printStackTrace(); + System.out.println(e.getMessage()); + } catch (InvalidPincodeException e) { + // e.printStackTrace(); + System.out.println(e.getMessage()); + } catch (InvalidCustomerIdException e) { + // e.printStackTrace(); + System.out.println(e.getMessage()); + } catch (CustomerNotFoundException e) { + // e.printStackTrace(); + System.out.println(e.getMessage()); + } catch (InvalidAmountException e) { + // e.printStackTrace(); + System.out.println(e.getMessage()); + } catch (InvalidAccountTypeException e) { + // e.printStackTrace(); + System.out.println(e.getMessage()); + } catch (InvalidAccountNoException e) { + // e.printStackTrace(); + System.out.println(e.getMessage()); + } catch (InsufficientBalanceException e) { + // e.printStackTrace(); + System.out.println(e.getMessage()); + } + + System.out.println("Do you wish to continue?(Y/N)"); + decision = scanner.next().charAt(0); + if (decision == 'n' || decision == 'N') { + System.out.println("Thank you for using the banking system"); + System.exit(0); + } + } while (decision == 'y' || decision == 'Y'); + + scanner.close(); + } +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/dao/BankingRepositoryServices.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/dao/BankingRepositoryServices.java new file mode 100644 index 0000000..86faba6 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/dao/BankingRepositoryServices.java @@ -0,0 +1,32 @@ +package com.zensar.bankingsystem.dao; + +import java.util.ArrayList; + +import com.zensar.bankingsystem.beans.Account; +import com.zensar.bankingsystem.beans.Customer; +import com.zensar.bankingsystem.beans.Transaction; + +public interface BankingRepositoryServices { + int insertCustomer(Customer customer); + + boolean updateCustomer(Customer customer); + + boolean updateTransaction(int custId, int accNo, Transaction transaction); + + Account getAccount(int custId, int accNo); + + ArrayList getAccountList(int custId); + + Customer getCustomer(int custId); + + ArrayList getTransactions(int custId, int accNo); + + boolean deleteCustomer(int custId); + + boolean deleteAccount(int custId, int accNo); + + int insertAccount(Account account, int custId); + + boolean updateAccount(int custId, Account account); + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java new file mode 100644 index 0000000..50d758d --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java @@ -0,0 +1,284 @@ +package com.zensar.bankingsystem.dao; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; + +import com.zensar.bankingsystem.beans.Account; +import com.zensar.bankingsystem.beans.Customer; +import com.zensar.bankingsystem.beans.Transaction; +import com.zensar.bankingsystem.repoprovider.ConnectionProvider; + +public class ZensarBankingSystemArrayImpl implements BankingRepositoryServices { + + static int custId = 100, accId = 50, tranId = 1; + private Connection con = null; + private PreparedStatement psmt = null; + java.sql.Statement smt = null; + ResultSet rs = null; + int result = 0; + int customerId = 0; + + public int count(String sql) { + try { + smt = con.createStatement(); + rs = smt.executeQuery(sql); + rs.next(); + System.out.println(rs.getInt(1)); + return rs.getInt(1); + } catch (SQLException e) { + e.printStackTrace(); + } + return 0; + } + + public ZensarBankingSystemArrayImpl() { + con = ConnectionProvider.getConnection(); + } + + @Override + public int insertCustomer(Customer customer) { + + String customerTableQuery = "INSERT INTO HR.CUSTOMER VALUES(HR.CUSTID.NEXTVAL,?)"; + String addressTableQuery = "INSERT INTO HR.ADDRESS VALUES(HR.CUSTID.CURRVAL,?,?,?,?,?,?)"; + String customerIdQuery = "SELECT HR.CUSTID.CURRVAL FROM DUAL"; + try { + + psmt = con.prepareStatement(customerTableQuery); + psmt.setString(1, customer.getCustomerName()); + result = psmt.executeUpdate(); + + psmt = con.prepareStatement(addressTableQuery); + psmt.setString(1, customer.getLaddress().getCity()); + psmt.setString(2, customer.getLaddress().getState()); + psmt.setInt(3, customer.getLaddress().getPinCode()); + psmt.setString(4, customer.getHaddress().getCity()); + psmt.setString(5, customer.getHaddress().getState()); + psmt.setInt(6, customer.getHaddress().getPinCode()); + result = psmt.executeUpdate(); + + if (result > 0) { + customer.setCustomerId(count(customerIdQuery)); + return customer.getCustomerId(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + + return 0; + } + + @Override + public Customer getCustomer(int custId) { + + Customer customer = new Customer(); + customer.setCustomerId(custId); + + String sql = "SELECT * from HR.CUSTOMER WHERE customerId=?"; + try { + psmt = con.prepareStatement(sql); + psmt.setInt(1, custId); + rs = psmt.executeQuery(); + + if (rs.isBeforeFirst() == false) { + return null; + } + while (rs.next()) { + customer.setCustomerName(rs.getString(1)); + } + return customer; + } catch (SQLException e) { + e.printStackTrace(); + } + return null; + } + + @Override + public boolean updateCustomer(Customer customer) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean updateTransaction(int custId, int accNo, + Transaction transaction) { + + String sql = "INSERT INTO HR.TRANSACTION VALUES(HR.TRANID.NEXTVAL,?,?,?)"; + String transactionIdQuery = "SELECT HR.CUSTID.CURRVAL FROM DUAL"; + try { + psmt = con.prepareStatement(sql); + psmt.setInt(1, accNo); + psmt.setString(2, transaction.getTransactionType()); + psmt.setInt(3, transaction.getTransactionAmount()); + result = psmt.executeUpdate(); + if (result > 0) { + transaction.setTransactionID(count(transactionIdQuery)); + return true; + } + } catch (SQLException e) { + e.printStackTrace(); + } + return false; + } + + @Override + public Account getAccount(int custId, int accNo) { + + Account account = new Account(); + account.setAccountId(accNo); + + String sql = "SELECT * FROM HR.ACCOUNT WHERE accountId=? AND customerId=?"; + try { + psmt = con.prepareStatement(sql); + psmt.setInt(1, accNo); + psmt.setInt(2, custId); + rs = psmt.executeQuery(); + if (rs.isBeforeFirst() == false) { + return null; + } + + while (rs.next()) { + account.setAccountType(rs.getString(3)); + account.setBalance(rs.getInt(4)); + } + return account; + } catch (SQLException e) { + e.printStackTrace(); + } + + return null; + } + + @Override + public ArrayList getAccountList(int custId) { + + Account account = null; + ArrayList acc = new ArrayList(); + String sql = "SELECT * FROM HR.ACCOUNT WHERE customerId=?"; + try { + psmt = con.prepareStatement(sql); + psmt.setInt(1, custId); + rs = psmt.executeQuery(); + if (rs.isBeforeFirst() == false) { + return null; + } + while (rs.next()) { + account = new Account(); + account.setAccountId(rs.getInt(1)); + account.setAccountType(rs.getString(3)); + account.setBalance(rs.getInt(4)); + acc.add(account); + } + return acc; + } catch (SQLException e) { + e.printStackTrace(); + } + + return null; + + } + + @Override + public ArrayList getTransactions(int custId, int accNo) { + + Transaction transaction = null; + ArrayList transactions = new ArrayList(); + String sql = "SELECT * FROM HR.TRANSACTION WHERE accountId=" + + "(SELECT accountId FROM HR.ACCOUNT WHERE customerId=? AND accountId=?)"; + try { + psmt = con.prepareStatement(sql); + psmt.setInt(1, custId); + psmt.setInt(2, accNo); + rs = psmt.executeQuery(); + if (rs.isBeforeFirst() == false) { + return null; + } + while (rs.next()) { + transaction = new Transaction(); + transaction.setTransactionID(rs.getInt(1)); + transaction.setTransactionType(rs.getString(3)); + transaction.setTransactionAmount(rs.getInt(4)); + transactions.add(transaction); + } + return transactions; + } catch (SQLException e) { + e.printStackTrace(); + } + return transactions; + } + + @Override + public boolean deleteCustomer(int custId) { + String sql = "DELETE FROM HR.CUSTOMER WHERE customerId=? CASCADE"; + try { + psmt = con.prepareStatement(sql); + psmt.setInt(1, custId); + result = psmt.executeUpdate(); + if (result > 0) { + return true; + } + } catch (SQLException e) { + e.printStackTrace(); + } + return false; + } + + @Override + public boolean deleteAccount(int custId, int accNo) { + String sql = "DELETE FROM HR.ACCOUNT WHERE customerId=? AND accountId=?"; + try { + psmt = con.prepareStatement(sql); + psmt.setInt(1, custId); + psmt.setInt(2, accNo); + result = psmt.executeUpdate(); + if (result > 0) { + return true; + } + } catch (SQLException e) { + e.printStackTrace(); + } + return false; + } + + @Override + public int insertAccount(Account account, int custId) { + + String accountTableQuery = "INSERT INTO HR.ACCOUNT VALUES(HR.ACCID.NEXTVAL,?,?,?)"; + try { + psmt = con.prepareStatement(accountTableQuery); + // psmt.setInt(1, accId); + psmt.setInt(1, custId); + psmt.setString(2, account.getAccountType()); + psmt.setInt(3, account.getBalance()); + result = psmt.executeUpdate(); + if (result > 0) { + return accId++; + } + } catch (SQLException e) { + e.printStackTrace(); + } + + return 0; + } + + @Override + public boolean updateAccount(int custId, Account account) { + String sql = "UPDATE HR.ACCOUNT SET balance=? WHERE customerId=? AND accountId=?"; + try { + psmt = con.prepareStatement(sql); + psmt.setInt(1, account.getBalance()); + psmt.setInt(2, custId); + psmt.setInt(3, account.getAccountId()); + result = psmt.executeUpdate(); + if (result > 0) { + return true; + } + } catch (SQLException e) { + e.printStackTrace(); + } + return false; + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.java new file mode 100644 index 0000000..49528b4 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.java @@ -0,0 +1,30 @@ +package com.zensar.bankingsystem.exceptions; + +public class CustomerNotFoundException extends Exception { + + public CustomerNotFoundException() { + this("Sorry you have not registered"); + } + + public CustomerNotFoundException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public CustomerNotFoundException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public CustomerNotFoundException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public CustomerNotFoundException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.java new file mode 100644 index 0000000..7fd072f --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.java @@ -0,0 +1,30 @@ +package com.zensar.bankingsystem.exceptions; + +public class InsufficientBalanceException extends Exception { + + public InsufficientBalanceException() { + this("Insufficient Balance"); + } + + public InsufficientBalanceException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public InsufficientBalanceException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public InsufficientBalanceException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public InsufficientBalanceException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.java new file mode 100644 index 0000000..726281d --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.java @@ -0,0 +1,30 @@ +package com.zensar.bankingsystem.exceptions; + +public class InvalidAccountNoException extends Exception { + + public InvalidAccountNoException() { + this("Please enter a valid account no"); + } + + public InvalidAccountNoException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public InvalidAccountNoException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public InvalidAccountNoException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public InvalidAccountNoException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.java new file mode 100644 index 0000000..f1d6ae5 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.java @@ -0,0 +1,30 @@ +package com.zensar.bankingsystem.exceptions; + +public class InvalidAccountTypeException extends Exception { + + public InvalidAccountTypeException() { + this("Please enter a valid account type"); + } + + public InvalidAccountTypeException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public InvalidAccountTypeException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public InvalidAccountTypeException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public InvalidAccountTypeException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAmountException.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAmountException.java new file mode 100644 index 0000000..3131ff4 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAmountException.java @@ -0,0 +1,30 @@ +package com.zensar.bankingsystem.exceptions; + +public class InvalidAmountException extends Exception { + + public InvalidAmountException() { + this("Please enter a valid amount"); + } + + public InvalidAmountException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public InvalidAmountException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + public InvalidAmountException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public InvalidAmountException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.java new file mode 100644 index 0000000..794a12a --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.java @@ -0,0 +1,31 @@ +package com.zensar.bankingsystem.exceptions; + +public class InvalidCustomerIdException extends Exception { + + public InvalidCustomerIdException() { + // TODO Auto-generated constructor stub + this("Invalid customer Id,please enter a valid customer Id"); + } + + public InvalidCustomerIdException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public InvalidCustomerIdException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + public InvalidCustomerIdException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public InvalidCustomerIdException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidPincodeException.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidPincodeException.java new file mode 100644 index 0000000..7806d55 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidPincodeException.java @@ -0,0 +1,32 @@ +package com.zensar.bankingsystem.exceptions; + +public class InvalidPincodeException extends Exception { + + public InvalidPincodeException() { + // TODO Auto-generated constructor stub + this("Invalid Pin"); + } + + public InvalidPincodeException(String message) { + super(message); + + // TODO Auto-generated constructor stub + } + + public InvalidPincodeException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + public InvalidPincodeException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public InvalidPincodeException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/repoprovider/ConnectionProvider.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/repoprovider/ConnectionProvider.java new file mode 100644 index 0000000..4113ef5 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/repoprovider/ConnectionProvider.java @@ -0,0 +1,40 @@ +package com.zensar.bankingsystem.repoprovider; + +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Properties; + +public class ConnectionProvider { + + private static Connection con = null; + private static Properties properties = null; + + public static Connection getConnection() { + + try { + properties= new Properties(); + properties.load(new FileReader(".\\src\\resources\\oracle.properties")); + + String Driver = properties.getProperty("Driver"); + String url = properties.getProperty("url"); + String username = properties.getProperty("username"); + String password = properties.getProperty("password"); + + Class.forName(Driver); + con = DriverManager.getConnection(url,username,password); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (SQLException e) { + e.printStackTrace(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return con; + } +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/repoprovider/RepositoryProvider.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/repoprovider/RepositoryProvider.java new file mode 100644 index 0000000..38d7c01 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/repoprovider/RepositoryProvider.java @@ -0,0 +1,42 @@ +package com.zensar.bankingsystem.repoprovider; + +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.Properties; + +import com.zensar.bankingsystem.dao.BankingRepositoryServices; + +public class RepositoryProvider { + + static Properties properties = null; + + public static BankingRepositoryServices getProvider() { + + try { + properties = new Properties(); + properties + .load(new FileReader(".\\src\\resources\\data.properties")); + String provider = (String) properties.get("repoprovider"); + Class c = Class.forName(provider); + return (BankingRepositoryServices) c.newInstance(); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + + } +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/serviceprovider/ServiceProvider.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/serviceprovider/ServiceProvider.java new file mode 100644 index 0000000..e5de879 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/serviceprovider/ServiceProvider.java @@ -0,0 +1,43 @@ +package com.zensar.bankingsystem.serviceprovider; + +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.Properties; + +import com.zensar.bankingsystem.services.BankServices; + +public class ServiceProvider { + + static Properties properties = null; + + public static BankServices getProvider() { + + try { + properties = new Properties(); + properties + .load(new FileReader(".\\src\\resources\\data.properties")); + String provider = (String) properties.get("provider"); + Class c = Class.forName(provider); + return (BankServices) c.newInstance(); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/services/BankServices.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/services/BankServices.java new file mode 100644 index 0000000..0ddc6b9 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/services/BankServices.java @@ -0,0 +1,61 @@ +package com.zensar.bankingsystem.services; + +import java.util.ArrayList; + +import javax.security.auth.login.AccountNotFoundException; + +import com.zensar.bankingsystem.beans.Account; +import com.zensar.bankingsystem.beans.Customer; +import com.zensar.bankingsystem.beans.Transaction; +import com.zensar.bankingsystem.exceptions.CustomerNotFoundException; +import com.zensar.bankingsystem.exceptions.InsufficientBalanceException; +import com.zensar.bankingsystem.exceptions.InvalidAccountNoException; +import com.zensar.bankingsystem.exceptions.InvalidAccountTypeException; +import com.zensar.bankingsystem.exceptions.InvalidAmountException; +import com.zensar.bankingsystem.exceptions.InvalidCustomerIdException; +import com.zensar.bankingsystem.exceptions.InvalidPincodeException; + +public interface BankServices { + int acceptCustomerDetails(String custName, String HomeAddressCity, + String HomeAddressState, int HomeAddressPincode, + String LocalAddressCity, String LocalAddressState, + int LocalAddressPincode) throws InvalidPincodeException; + + int openAccount(int custId, int balance, String accType) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAmountException, InvalidAccountTypeException; + + int getAccountBalance(int custId, int accNo) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException; + + int withdraw(int custId, int accNo, int amt) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException, + InvalidAmountException, InsufficientBalanceException; + + boolean fundTransfer(int custIdFrom, int accNoFrom, int custIdTo, + int accNoTo, int amt) throws InvalidCustomerIdException, + CustomerNotFoundException, InvalidAccountNoException, + AccountNotFoundException, InvalidAmountException, + InsufficientBalanceException; + + int deposit(int custId, int accNo, int amt) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException, + InvalidAmountException, InsufficientBalanceException; + + Customer getCustomerDetails(int custId) throws InvalidCustomerIdException, + CustomerNotFoundException; + + Account getAccountDetails(int custId, int accNo) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException; + + ArrayList getAllAccountsDetails(int custId) + throws InvalidCustomerIdException, CustomerNotFoundException; + + ArrayList getAllTransactionDetails(int custId, int accNo) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException; +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java new file mode 100644 index 0000000..14e631d --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java @@ -0,0 +1,244 @@ +package com.zensar.bankingsystem.services; + +import java.util.ArrayList; + +import javax.security.auth.login.AccountNotFoundException; + +import com.zensar.bankingsystem.beans.Account; +import com.zensar.bankingsystem.beans.Address; +import com.zensar.bankingsystem.beans.Customer; +import com.zensar.bankingsystem.beans.Transaction; +import com.zensar.bankingsystem.dao.BankingRepositoryServices; +import com.zensar.bankingsystem.exceptions.CustomerNotFoundException; +import com.zensar.bankingsystem.exceptions.InsufficientBalanceException; +import com.zensar.bankingsystem.exceptions.InvalidAccountNoException; +import com.zensar.bankingsystem.exceptions.InvalidAccountTypeException; +import com.zensar.bankingsystem.exceptions.InvalidAmountException; +import com.zensar.bankingsystem.exceptions.InvalidCustomerIdException; +import com.zensar.bankingsystem.exceptions.InvalidPincodeException; +import com.zensar.bankingsystem.repoprovider.RepositoryProvider; + +public class ZensarBankingServiceImpl implements BankServices { + + BankingRepositoryServices zensarBankingSystemArray; + + public ZensarBankingServiceImpl() { + zensarBankingSystemArray = RepositoryProvider.getProvider(); + + } + + @Override + public int acceptCustomerDetails(String custName, String HomeAddressCity, + String HomeAddressState, int HomeAddressPincode, + String LocalAddressCity, String LocalAddressState, + int LocalAddressPincode) throws InvalidPincodeException { + + if (Integer.toString(LocalAddressPincode).length() != 6 + || Integer.toString(HomeAddressPincode).length() != 6) { + throw new InvalidPincodeException(); + } else { + return zensarBankingSystemArray.insertCustomer(new Customer( + custName, new Address(LocalAddressCity, LocalAddressState, + LocalAddressPincode), new Address(HomeAddressCity, + HomeAddressState, HomeAddressPincode))); + } + + } + + @Override + public int openAccount(int custId, int balance, String accType) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAmountException, InvalidAccountTypeException { + + int accountId = 0; + + if (custId < 99) { + throw new InvalidCustomerIdException(); + } else if (!(accType.equalsIgnoreCase("savings") + || accType.equalsIgnoreCase("current") || accType + .equalsIgnoreCase("salary"))) { + throw new InvalidAccountTypeException(); + } else if (balance < 0) { + throw new InvalidAmountException(); + } else { + Customer customer = zensarBankingSystemArray.getCustomer(custId); + + if (customer == null) { + throw new CustomerNotFoundException(); + } else { + Account account = new Account(accType, balance); + accountId = zensarBankingSystemArray.insertAccount(account, + custId); + } + } + + return accountId; + + } + + @Override + public int getAccountBalance(int custId, int accNo) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException { + + if (custId < 99) { + throw new InvalidCustomerIdException(); + } else if (accNo < 50) { + throw new InvalidAccountNoException(); + } else { + Customer customer = zensarBankingSystemArray.getCustomer(custId); + if (customer == null) { + throw new CustomerNotFoundException(); + } else if (zensarBankingSystemArray.getAccount(custId, accNo) == null) { + throw new AccountNotFoundException("Account Not found"); + } else { + return zensarBankingSystemArray.getAccount(custId, accNo) + .getBalance(); + } + } + + } + + @Override + public int withdraw(int custId, int accNo, int amt) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException, + InvalidAmountException, InsufficientBalanceException { + int balance = 0; + if (custId < 99) { + throw new InvalidCustomerIdException(); + } else if (accNo < 50) { + throw new InvalidAccountNoException(); + } else if (amt < 0) { + throw new InvalidAmountException(); + } else { + Customer customer = zensarBankingSystemArray.getCustomer(custId); + if (customer == null) { + throw new CustomerNotFoundException(); + } else { + Account account = zensarBankingSystemArray.getAccount(custId, + accNo); + if (account == null) { + throw new AccountNotFoundException("Account Not found"); + } else { + + System.out.println(account); + if ((account.getBalance() - amt) > 0) { + account.setBalance(account.getBalance() - amt); + balance = account.getBalance(); + zensarBankingSystemArray.updateAccount(custId, account); + + // transaction + Transaction transaction = new Transaction(); + transaction.setTransactionType("withdraw"); + transaction.setTransactionAmount(amt); + zensarBankingSystemArray.updateTransaction(custId, + accNo, transaction); + } else { + throw new InsufficientBalanceException(); + } + } + } + } + return balance; + } + + @Override + public boolean fundTransfer(int custIdFrom, int accNoFrom, int custIdTo, + int accNoTo, int amt) throws AccountNotFoundException, + InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, InvalidAmountException, + InsufficientBalanceException { + + if (withdraw(custIdFrom, accNoFrom, amt) > 0) { + deposit(custIdTo, accNoTo, amt); + return true; + } + return false; + } + + @Override + public int deposit(int custId, int accNo, int amt) + throws InvalidCustomerIdException, CustomerNotFoundException, + InvalidAccountNoException, AccountNotFoundException, + InvalidAmountException, InsufficientBalanceException { + + if (custId < 99) { + throw new InvalidCustomerIdException(); + } else if (accNo < 50) { + throw new InvalidAccountNoException(); + } else if (amt < 0) { + throw new InvalidAmountException(); + } else { + + Customer customer = zensarBankingSystemArray.getCustomer(custId); + if (customer == null) { + throw new CustomerNotFoundException(); + } else { + Account account = zensarBankingSystemArray.getAccount(custId, + accNo); + if (account == null) { + throw new AccountNotFoundException("Account Not found"); + } else { + System.out.println(account); + account.setBalance(account.getBalance() + amt); + zensarBankingSystemArray.updateAccount(custId, account); + + // transaction + Transaction transaction = new Transaction(); + transaction.setTransactionType("deposit"); + transaction.setTransactionAmount(amt); + zensarBankingSystemArray.updateTransaction(custId, accNo, + transaction); + + return zensarBankingSystemArray.getAccount(custId, accNo) + .getBalance(); + } + } + } + } + + @Override + public Customer getCustomerDetails(int custId) { + Customer customer = zensarBankingSystemArray.getCustomer(custId); + if (customer != null) { + return customer; + } + return null; + } + + @Override + public Account getAccountDetails(int custId, int accNo) + throws AccountNotFoundException, CustomerNotFoundException { + + if (getCustomerDetails(custId) == null) { + throw new CustomerNotFoundException(); + } else { + Account account = zensarBankingSystemArray + .getAccount(custId, accNo); + if (account != null) { + return account; + } else { + throw new AccountNotFoundException("Account Not Found"); + } + } + + } + + @Override + public ArrayList getAllAccountsDetails(int custId) { + ArrayList account = zensarBankingSystemArray + .getAccountList(custId); + if (account != null) { + return account; + } + return null; + } + + @Override + public ArrayList getAllTransactionDetails(int custId, int accNo) { + return zensarBankingSystemArray.getTransactions(custId, accNo); + + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/resources/data.properties b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/resources/data.properties new file mode 100644 index 0000000..fe849f7 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/resources/data.properties @@ -0,0 +1,2 @@ +provider=com.zensar.bankingsystem.services.ZensarBankingServiceImpl +repoprovider=com.zensar.bankingsystem.dao.ZensarBankingSystemArrayImpl \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/resources/oracle.properties b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/resources/oracle.properties new file mode 100644 index 0000000..0139adb --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/resources/oracle.properties @@ -0,0 +1,4 @@ +Driver=oracle.jdbc.driver.OracleDriver +url=jdbc:oracle:thin:@localhost:1521/XE +username=system +password=zensar \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/sql.txt b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/sql.txt new file mode 100644 index 0000000..6542008 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/sql.txt @@ -0,0 +1,74 @@ +CREATE TABLE CUSTOMER +( +customerId NUMBER, +customerName VARCHAR(20), +PRIMARY KEY(customerId) +) + +CREATE TABLE ACCOUNT +( +accountId NUMBER, +customerId NUMBER, +accountType VARCHAR(20), +balance NUMBER(10,3), +PRIMARY KEY(accountId), +FOREIGN KEY(customerId) REFERENCES CUSTOMER(customerId) +) + +CREATE TABLE TRANSACTION +( +transactionId NUMBER, +accountId NUMBER, +transactionType VARCHAR(20), +transactionAmount NUMBER(10,3), +PRIMARY KEY(transactionId), +FOREIGN KEY(accountId) REFERENCES ACCOUNT(accountId) +) + +CREATE TABLE ADDRESS +( +customerId NUMBER, +localCity VARCHAR(20), +localState VARCHAR(20), +localPincode VARCHAR(20), +homeCity VARCHAR(20), +homeState VARCHAR(20), +homePincode VARCHAR(20), +FOREIGN KEY(customerId) REFERENCES CUSTOMER(customerId) +) + +DESCRIBE CUSTOMER +DESCRIBE ACCOUNT +DESCRIBE TRANSACTION +DESCRIBE ADDRESS + + +SELECT * FROM CUSTOMER +SELECT * FROM ADDRESS +SELECT * FROM ACCOUNT +SELECT * FROM TRANSACTION +DELETE FROM CUSTOMER + +CREATE SEQUENCE CUSTID +INCREMENT BY 1 +START WITH 100 + +CREATE SEQUENCE TRANID +INCREMENT BY 1 +START WITH 1 + +CREATE SEQUENCE ACCID +INCREMENT BY 1 +START WITH 50 + +DROP SEQUENCE CUSTID + +SELECT CUSTID.CURRVAL FROM DUAL + select CUSTID.nextval from dual; + +ALTER SESSION SET CURRENT_SCHEMA =AKASH + +DROP TABLE CUSTOMER +DROP TABLE ADDRESS +DROP TABLE TRANSACTION +DROP TABLE ACCOUNT \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Account.class b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Account.class new file mode 100644 index 0000000..9cf39ce Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Account.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Address.class b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Address.class new file mode 100644 index 0000000..0d83f39 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Address.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Customer.class b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Customer.class new file mode 100644 index 0000000..1e98eea Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Customer.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/MyDate.class b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/MyDate.class new file mode 100644 index 0000000..3c1847a Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/MyDate.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Transaction.class b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Transaction.class new file mode 100644 index 0000000..c127dbb Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Transaction.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/client/ClientCode.class b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/client/ClientCode.class new file mode 100644 index 0000000..d466fce Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/client/ClientCode.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class new file mode 100644 index 0000000..bfc5cfd Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class new file mode 100644 index 0000000..bbb611f Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class differ diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Account.java b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Account.java new file mode 100644 index 0000000..a3d8080 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Account.java @@ -0,0 +1,59 @@ +package com.zensar.bankingsystem.beans; + +public class Account { + + private int accountId; + private String accountType; + private int balance; + private int pin; + + public Account() { + super(); + } + + public Account(int accountId, String accountType, int balance) { + super(); + this.accountId = accountId; + this.accountType = accountType; + this.balance = balance; + } + + public Account(String accountType, int balance) { + super(); + this.accountType = accountType; + this.balance = balance; + } + + public int getAccountId() { + return accountId; + } + + public void setAccountId(int accountId) { + this.accountId = accountId; + } + + public String getAccountType() { + return accountType; + } + + public void setAccountType(String accountType) { + this.accountType = accountType; + } + + public int getBalance() { + return balance; + } + + public void setBalance(int balance) { + this.balance = balance; + } + + public int getPin() { + return pin; + } + + public void setPin(int pin) { + this.pin = pin; + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Address.java b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Address.java new file mode 100644 index 0000000..1400f16 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Address.java @@ -0,0 +1,50 @@ +package com.zensar.bankingsystem.beans; + +public class Address { + + private String city; + private String state; + private int pinCode; + + public Address() { + super(); + } + + public Address(String city, String state, int pinCode) { + super(); + this.city = city; + this.state = state; + this.pinCode = pinCode; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public int getPinCode() { + return pinCode; + } + + public void setPinCode(int pinCode) { + this.pinCode = pinCode; + } + + @Override + public String toString() { + return "Address [city=" + city + ", state=" + state + ", pinCode=" + + pinCode + "]"; + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Customer.java b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Customer.java new file mode 100644 index 0000000..bcb0ee4 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Customer.java @@ -0,0 +1,143 @@ +package com.zensar.bankingsystem.beans; + +import java.util.Arrays; + +public class Customer { + + private int customerId; + private String customerName; + private Address laddress; + private Address haddress; + private MyDate dob; + private Account[] account = new Account[3]; + + public Customer() { + super(); + } + + public Customer(int customerId, String customerName, Address laddress, + Address haddress) { + super(); + this.customerId = customerId; + this.customerName = customerName; + this.laddress = laddress; + this.haddress = haddress; + } + + public Customer(String customerName, Address laddress, Address haddress) { + super(); + this.customerName = customerName; + this.laddress = laddress; + this.haddress = haddress; + } + + public Customer(String customerName, Address laddress, Address haddress, + MyDate dob) { + super(); + this.customerName = customerName; + this.laddress = laddress; + this.haddress = haddress; + this.dob = dob; + } + + public int getCustomerId() { + return customerId; + } + + public void setCustomerId(int customerId) { + this.customerId = customerId; + } + + public String getCustomerName() { + return customerName; + } + + public void setCustomerName(String customerName) { + this.customerName = customerName; + } + + public Address getLaddress() { + return laddress; + } + + public void setLaddress(Address laddress) { + this.laddress = laddress; + } + + public Address getHaddress() { + return haddress; + } + + public void setHaddress(Address haddress) { + this.haddress = haddress; + } + + public Account[] getAccount() { + return account; + } + + public void setAccount(Account[] account) { + this.account = account; + } + + public MyDate getDob() { + return dob; + } + + public void setDob(MyDate dob) { + this.dob = dob; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + Arrays.hashCode(account); + result = prime * result + customerId; + result = prime * result + + ((customerName == null) ? 0 : customerName.hashCode()); + result = prime * result + ((dob == null) ? 0 : dob.hashCode()); + result = prime * result + + ((haddress == null) ? 0 : haddress.hashCode()); + result = prime * result + + ((laddress == null) ? 0 : laddress.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Customer other = (Customer) obj; + if (!Arrays.equals(account, other.account)) + return false; + if (customerId != other.customerId) + return false; + if (customerName == null) { + if (other.customerName != null) + return false; + } else if (!customerName.equals(other.customerName)) + return false; + if (dob == null) { + if (other.dob != null) + return false; + } else if (!dob.equals(other.dob)) + return false; + if (haddress == null) { + if (other.haddress != null) + return false; + } else if (!haddress.equals(other.haddress)) + return false; + if (laddress == null) { + if (other.laddress != null) + return false; + } else if (!laddress.equals(other.laddress)) + return false; + return true; + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/MyDate.java b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/MyDate.java new file mode 100644 index 0000000..4e75da6 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/MyDate.java @@ -0,0 +1,65 @@ +package com.zensar.bankingsystem.beans; + +public class MyDate { + + private int day; + private int month; + private int year; + + public MyDate() { + super(); + day = 0; + month = 0; + year = 0; + } + + public MyDate(int day, int month, int year) { + super(); + this.day = day; + this.month = month; + this.year = year; + } + + public int getDay() { + return day; + } + + public void setDay(int day) { + this.day = day; + } + + public int getMonth() { + return month; + } + + public void setMonth(int month) { + this.month = month; + } + + public int getYear() { + return year; + } + + public void setYear(int year) { + this.year = year; + } + + @Override + public String toString() { + return "MyDate [day=" + day + ", month=" + month + ", year=" + year + + "]"; + } + + @Override + public boolean equals(Object arg) { + System.out.println(this); + MyDate date = (MyDate) arg; + if (this.day == date.day && this.month == date.month + && this.year == date.year) { + return true; + } + + return false; + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Transaction.java b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Transaction.java new file mode 100644 index 0000000..b84c4e8 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Transaction.java @@ -0,0 +1,5 @@ +package com.zensar.bankingsystem.beans; + +public class Transaction { + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/client/ClientCode.java b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/client/ClientCode.java new file mode 100644 index 0000000..016a406 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/client/ClientCode.java @@ -0,0 +1,255 @@ +package com.zensar.bankingsystem.client; + +import java.util.Scanner; + +import com.zensar.bankingsystem.beans.Account; +import com.zensar.bankingsystem.services.ZensarBankingServiceImpl; + +public class ClientCode { + + public static void main(String[] args) { + String name = null; + String localAdrressCity = null; + String localAdrressState = null; + int localAdrressPinCode = 0; + String homeAdrressCity = null; + String homeAdrressState = null; + int homeAdrressPinCode = 0; + int customerId = 0; + String accountType = null; + int initialBalance = 0; + char decision; + int choice = 0; + int amount = 0, balance = 0; + int day, month, year = 0; + int oldPin, newPin = 0, pin = 0; + + Scanner scanner = new Scanner(System.in); + + ZensarBankingServiceImpl zensarBankingService = new ZensarBankingServiceImpl(); + + System.out.println("Welcome to Zensar Banking Service"); + + do { + + System.out.println("1. Customer Registration"); + System.out.println("2. Open Account"); + System.out.println("3. Withdraw"); + System.out.println("4. Deposit"); + System.out.println("5. Transfer"); + System.out.println("6. Check balance"); + System.out.println("7. Change pin"); + System.out.println("8. Get Account details"); + System.out.println("9. Get all account details"); + System.out.println("Enter your option"); + choice = scanner.nextInt(); + + switch (choice) { + case 1: + // Registration + System.out.println("Enter your name"); + name = scanner.next(); + + System.out.println("Enter your local address"); + System.out.println("Enter your city"); + localAdrressCity = scanner.next(); + System.out.println("Enter your state"); + localAdrressState = scanner.next(); + System.out.println("Enter your pin code"); + localAdrressPinCode = scanner.nextInt(); + + System.out.println("Enter your home address"); + System.out.println("Enter your city"); + homeAdrressCity = scanner.next(); + System.out.println("Enter your state"); + homeAdrressState = scanner.next(); + System.out.println("Enter your pin code"); + homeAdrressPinCode = scanner.nextInt(); + + System.out.println("Enter your date of birth"); + System.out.println("Enter the day"); + day = scanner.nextInt(); + System.out.println("Enter the month"); + month = scanner.nextInt(); + System.out.println("Enter the year"); + year = scanner.nextInt(); + + int id = zensarBankingService.acceptCustomerDetails(name, + localAdrressCity, localAdrressState, + localAdrressPinCode, homeAdrressCity, homeAdrressState, + homeAdrressPinCode, day, month, year); + + if (id > 0) { + System.out + .println("You were successfully registered with customer ID " + + id); + + } else + System.out.println("Sorry could not register"); + + break; + + case 2: + // open an account + System.out.println("Enter your customer Id to open an account"); + customerId = scanner.nextInt(); + + System.out.println("Enter your account type "); + accountType = scanner.next(); + + System.out.println("Enter your initial balance "); + initialBalance = scanner.nextInt(); + int accountId = zensarBankingService.openAccount(customerId, + initialBalance, accountType); + + if (accountId == 0) { + System.out.println("Sorry account could not be created"); + } else { + System.out.println("Account created with account Id " + + accountId); + pin = zensarBankingService.generatePin(customerId, + accountId); + System.out.println("Your pin is " + pin); + } + + break; + case 3: + // withdraw + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + System.out.println("Enter your account Id"); + accountId = scanner.nextInt(); + System.out.println("Enter the amount to withdraw"); + amount = scanner.nextInt(); + System.out.println("Enter your pin"); + pin = scanner.nextInt(); + + balance = zensarBankingService.withdraw(customerId, accountId, + amount, pin); + + if (balance > 0) { + System.out + .println("Amount withdrawn successfully with remaining balance " + + balance); + } else if (balance < 0) { + System.out.println("Cannot withdraw,negative balance"); + } else { + System.out.println("Sorry you have not registered"); + } + + break; + case 4: + // deposit + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + System.out.println("Enter your account Id"); + accountId = scanner.nextInt(); + System.out.println("Enter the amount to deposit"); + amount = scanner.nextInt(); + + balance = zensarBankingService.deposit(customerId, accountId, + amount); + System.out + .println("Amount successfully deposited, balance is " + + balance); + + break; + case 5: + // transfer fund + System.out.println("Enter your customer Id"); + int custIdFrom = scanner.nextInt(); + System.out.println("Enter your account Id"); + int accNoFrom = scanner.nextInt(); + System.out.println("Enter your pin"); + pin = scanner.nextInt(); + System.out.println("Enter the customer Id to transfer to"); + int custIdTo = scanner.nextInt(); + System.out.println("Enter the account Id to transfer to"); + int accNoTo = scanner.nextInt(); + System.out.println("Enter the amount to tansfer"); + int amt = scanner.nextInt(); + + boolean result = zensarBankingService.fundTransfer(custIdFrom, + accNoFrom, custIdTo, accNoTo, amt, pin); + if (result == true) { + System.out.println("Fund transfer successful"); + } else { + System.out.println("Fund transfer not successful"); + } + break; + case 6: + // get balance + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + System.out.println("Enter your account Id"); + accountId = scanner.nextInt(); + System.out.println("Enter your pin"); + pin = scanner.nextInt(); + System.out.println(zensarBankingService.getAccountBalance( + customerId, accountId, pin)); + break; + case 7: + // change pin + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + System.out.println("Enter your account Id"); + accountId = scanner.nextInt(); + System.out.println("Enter your current pin"); + oldPin = scanner.nextInt(); + System.out.println("Enter new pin"); + newPin = scanner.nextInt(); + result = zensarBankingService.changePin(customerId, accountId, + oldPin, newPin); + if (result == true) { + System.out.println("Pin changed successfully"); + } else { + + System.out.println("Pin change not successful"); + } + break; + case 8: + // get account details + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + System.out.println("Enter your account Id"); + accountId = scanner.nextInt(); + Account acc = zensarBankingService.getAccountDetails( + customerId, accountId); + System.out.println("Account No " + acc.getAccountId()); + System.out.println("Account Type " + acc.getAccountType()); + System.out.println("Account Balance " + acc.getBalance()); + break; + case 9: + // get all account details + System.out.println("Enter your customer Id"); + customerId = scanner.nextInt(); + Account[] a = zensarBankingService + .getAllAccountsDetails(customerId); + System.out.println("Account deatils are:"); + for (int i = 0; i < a.length; i++) { + if (a[i] != null) { + System.out.println("Account No " + a[i].getAccountId()); + System.out.println("Account Type " + + a[i].getAccountType()); + System.out.println("Account Balance " + + a[i].getBalance()); + } + + } + break; + default: + System.out.println("Invalid choice"); + break; + } + + System.out.println("Do you wish to continue?(Y/N)"); + decision = scanner.next().charAt(0); + if (decision == 'n' || decision == 'N') { + System.out.println("Thank you for using the banking system"); + System.exit(0); + } + } while (decision == 'y' || decision == 'Y'); + + scanner.close(); + } +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java new file mode 100644 index 0000000..16d0cd7 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java @@ -0,0 +1,98 @@ +package com.zensar.bankingsystem.dao; + +import com.zensar.bankingsystem.beans.Account; +import com.zensar.bankingsystem.beans.Customer; +import com.zensar.bankingsystem.beans.Transaction; + +public class ZensarBankingSystemArrayImpl { + + Customer[] customers = new Customer[10]; + + static int i = 0, j = 0, custId = 100, accId = 50; + + public int insertCustomer(Customer customer) { + + customers[i++] = customer; + customer.setCustomerId(custId); + custId++; + return customer.getCustomerId(); + } + + public Customer getCustomer(int custId) { + + for (Customer c : customers) { + if (c != null && c.getCustomerId() == custId) + return c; + } + return null; + } + + public boolean updateCustomer(Customer customer) { + // TODO Auto-generated method stub + return false; + } + + public boolean updateTransaction(int custId, int accNo, + Transaction transaction) { + // TODO Auto-generated method stub + return false; + } + + public Account getAccount(int custId, int accNo) { + + Account[] acc = getCustomer(custId).getAccount(); + for (int k = 0; k < 3; k++) { + if (acc[k].getAccountId() == accNo) + return acc[k]; + } + return null; + } + + public Account[] getAccountList(int custId) { + return getCustomer(custId).getAccount(); + } + + public Transaction[] getTransactions(int custId, int accNo) { + // TODO Auto-generated method stub + return null; + } + + public boolean deleteCustomer(int custId) { + // customers[] + return false; + } + + public boolean deleteAccount(int custId, int accNo) { + // TODO Auto-generated method stub + return false; + } + + public boolean updateAccount(int custId, Account account) { + // TODO Auto-generated method stub + return false; + } + + public int insertAccount(Account account, int custId) { + Account[] acc = getCustomer(custId).getAccount(); + + for (int k = 0; k < 3; k++) { + + if (acc[k] == null) { + acc[k] = new Account(accId++, account.getAccountType(), + account.getBalance()); + return acc[k].getAccountId(); + } + } + return 0; + } + + public int generateRandomNumber() { + + int pin = (int) (Math.random() * 9999); + if (pin < 1000) { + pin += 1000; + } + return pin; + } + +} diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java new file mode 100644 index 0000000..974fdb4 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java @@ -0,0 +1,204 @@ +package com.zensar.bankingsystem.services; + +import com.zensar.bankingsystem.beans.Account; +import com.zensar.bankingsystem.beans.Address; +import com.zensar.bankingsystem.beans.Customer; +import com.zensar.bankingsystem.beans.MyDate; +import com.zensar.bankingsystem.beans.Transaction; +import com.zensar.bankingsystem.dao.ZensarBankingSystemArrayImpl; + +public class ZensarBankingServiceImpl { + + ZensarBankingSystemArrayImpl zensarBankingSystemArray; + + public ZensarBankingServiceImpl() { + zensarBankingSystemArray = new ZensarBankingSystemArrayImpl(); + + } + + /* + * public void transfer(int accountId, int tansferAccountId, double amount) + * { double a = zensarBankingSystemArray.getAccount(accountId).getBalance() + * - amount; System.out.println(a); + * zensarBankingSystemArray.getAccount(accountId).setBalance(a); double b = + * zensarBankingSystemArray.getAccount(accountId).getBalance() + amount; + * zensarBankingSystemArray.getAccount(tansferAccountId).setBalance(b); + * + * } + */ + + public int acceptCustomerDetails(String custName, String HomeAddressCity, + String HomeAddressState, int HomeAddressPincode, + String LocalAddressCity, String LocalAddressState, + int LocalAddressPincode, int day, int month, int year) { + + if ((day > 0 && day <= 31) && (month >= 1 && month <= 12) + && (year <= 2015)) { + return zensarBankingSystemArray.insertCustomer(new Customer( + custName, new Address(LocalAddressCity, LocalAddressState, + LocalAddressPincode), new Address(HomeAddressCity, + HomeAddressState, HomeAddressPincode), new MyDate( + day, month, year))); + } else + return 0; + + } + + public int openAccount(int custId, int balance, String accType) { + + int accountId = 0; + + if (custId < 99) { + System.out + .println("Invalid customer Id,please enter a valid customer Id"); + } else if (!(accType.equalsIgnoreCase("savings") + || accType.equalsIgnoreCase("current") || accType + .equalsIgnoreCase("salary"))) { + System.out + .println("Invalid account type, please enter a valid account type"); + } else if (balance < 0) { + System.out.println("Invalid amount, please amount a valid amount"); + } + + else { + Customer customer = zensarBankingSystemArray.getCustomer(custId); + + if (customer == null) { + System.out.println("Sorry you have not registered"); + return 0; + } else { + Account account = new Account(accType, balance); + accountId = zensarBankingSystemArray.insertAccount(account, + custId); + } + } + + return accountId; + + } + + public int getAccountBalance(int custId, int accNo, int pin) { + + if (checkPin(custId, accNo, pin)) { + return zensarBankingSystemArray.getAccount(custId, accNo) + .getBalance(); + } else { + System.out.println("Invalid pin"); + return 0; + } + + } + + public int withdraw(int custId, int accNo, int amt, int pin) { + int balance = 0; + if (amt < 0) { + System.out.println("Invalid amount, please enter a valid amount"); + } else { + + Customer customer = zensarBankingSystemArray.getCustomer(custId); + + if (customer == null) { + return 0; + } else { + Account account = zensarBankingSystemArray.getAccount(custId, + accNo); + if (account == null) { + System.out.println("Sorry your account does not exist"); + } else if (account.getPin()!=pin) { + System.out.println("Invalid pin"); + return 0; + } else { + if ((account.getBalance() - amt) > 0) { + account.setBalance(account.getBalance() - amt); + balance = account.getBalance(); + } + } + } + } + return balance; + } + + public boolean fundTransfer(int custIdFrom, int accNoFrom, int custIdTo, + int accNoTo, int amt, int pin) { + if (withdraw(custIdFrom, accNoFrom, amt, pin) > 0) { + deposit(custIdTo, accNoTo, amt); + return true; + } + return false; + } + + public int deposit(int custId, int accNo, int amt) { + if (amt < 0) { + System.out.println("Invalid amount, please enter a valid amount"); + } else { + + zensarBankingSystemArray.getAccount(custId, accNo).setBalance( + zensarBankingSystemArray.getAccount(custId, accNo) + .getBalance() + amt); + + return zensarBankingSystemArray.getAccount(custId, accNo) + .getBalance(); + } + return 0; + } + + public Customer getCustomerDetails(int custId) { + Customer customer = zensarBankingSystemArray.getCustomer(custId); + if (customer != null) { + return customer; + } + return null; + } + + public Account getAccountDetails(int custId, int accNo) { + Account account = zensarBankingSystemArray.getAccount(custId, accNo); + if (account != null) { + return account; + } + return null; + } + + public Account[] getAllAccountsDetails(int custId) { + Account[] account = zensarBankingSystemArray.getAccountList(custId); + if (account != null) { + return account; + } + return null; + } + + public Transaction[] getAllTransactionDetails(int custId, int accNo) { + // TODO Auto-generated method stub + return null; + } + + public int generatePin(int custId, int accNo) { + Account account = zensarBankingSystemArray.getAccount(custId, accNo); + int pin = zensarBankingSystemArray.generateRandomNumber(); + account.setPin(pin); + return account.getPin(); + } + + public boolean changePin(int custId, int accNo, int oldPin, int newPin) { + Account account = zensarBankingSystemArray.getAccount(custId, accNo); + if (account != null) { + if (account.getPin() == oldPin) { + account.setPin(newPin); + return true; + } + } + + return false; + } + + public boolean checkPin(int custId, int accNo, int pin) { + Account account = zensarBankingSystemArray.getAccount(custId, accNo); + if (account != null) { + if (account.getPin() == pin) { + return true; + } + } + return false; + + } + +} diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/.classpath b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/.classpath new file mode 100644 index 0000000..c5f82df --- /dev/null +++ b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/.project b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/.project new file mode 100644 index 0000000..fdaf927 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/.project @@ -0,0 +1,17 @@ + + + CONTACT LIST MANAGEMENT APPLICATION + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Casual_acquaintances.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Casual_acquaintances.class new file mode 100644 index 0000000..3115ff8 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Casual_acquaintances.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Casual_acquaintances.java b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Casual_acquaintances.java new file mode 100644 index 0000000..1c717de --- /dev/null +++ b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Casual_acquaintances.java @@ -0,0 +1,181 @@ +import java.io.Serializable; + +/** + * Write a description of class Casual_acquaintances here. + * + * @author (your name) + * @version (a version number or a date) + */ +@SuppressWarnings("serial") +public class Casual_acquaintances extends Contacts +{ + private String met_when; + private String met_where; + private String meeting_circumstances; + private String other_info; + + Casual_acquaintances(){ + + super(); + met_when = null; + met_where = null; + meeting_circumstances = null; + other_info = null; + } + + + + public void setmetwhen(String when){ + // try{ + if (when.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else { + //try{ + if (met_when != null && met_when.length() >= 0){ + String appended1 = met_when + when; + if (appended1.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else met_when = appended1; + }else + this.met_when = when; + } + /* catch (IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + //System.arraycopy(met.toCharArray(),0,meetingcontext,0,met.length()); + //this.meetingcontext = met; + //} + /*}catch(IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + } + + + public void setmetwhere(String where){ + // try{ + if (where.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else { + // try{ + if (met_where != null && met_where.length() >= 0){ + String appended2 = met_where + where; + if (appended2.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else met_where = appended2; + }else + this.met_where = where; + } + /* catch (IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + //System.arraycopy(met.toCharArray(),0,meetingcontext,0,met.length()); + //this.meetingcontext = met; + //} + /* }catch(IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + } + + public void setcircumstance(String circum){ + // try{ + if (circum.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else { + // try{ + if (meeting_circumstances != null && meeting_circumstances.length() >= 0){ + String appended3 = meeting_circumstances + circum; + if (appended3.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else meeting_circumstances = appended3; + }else + this.meeting_circumstances = circum; + /* } + catch (IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + //System.arraycopy(met.toCharArray(),0,meetingcontext,0,met.length()); + //this.meetingcontext = met; + } + /* }catch(IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + } + + public void setinfo(String information){ + //try{ + if (information.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else { + // try{ + if (other_info != null && other_info.length() >= 0){ + String appended4 = other_info + information; + if (appended4.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else other_info = appended4; + }else + this.other_info = information; + /* } + catch (IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + //System.arraycopy(met.toCharArray(),0,meetingcontext,0,met.length()); + //this.meetingcontext = met; + } + /* }catch(IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + } + + + public String getmetwhen(){ + if (this.met_when == null){ + // System.out.println("Nothing to show! "); + return null; + } + else + return this.met_when; + } + + public String getmetwhere(){ + if (this.met_where == null){ + //System.out.println("Nothing to show! "); + return null; + } + else + return this.met_where; + } + + public String getcircumstance(){ + if (this.meeting_circumstances == null){ + // System.out.println("Nothing to show! "); + return null; + } + else + return this.meeting_circumstances; + } + + public String getinfo(){ + if (this.other_info == null){ + // System.out.println("Nothing to show! "); + return null; + } + else + return this.other_info; + } +} diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Combine.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Combine.class new file mode 100644 index 0000000..7a3f0d7 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Combine.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Combine.java b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Combine.java new file mode 100644 index 0000000..7a335a2 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Combine.java @@ -0,0 +1,772 @@ + + + + +/** + * Write a description of class Combine here. + * + * @author (your name) + * @version (a version number or a date) + */ +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.*; + +public class Combine +{ + + @SuppressWarnings("unchecked") + public static void main(String[] args){ + + /*ArrayList relatives = new ArrayList(); + ArrayList personalfriends = new ArrayList(); + ArrayList professionalfriends = new ArrayList(); + ArrayList casualacquaintances = new ArrayList(); + */ + + ArrayList relatives = new ArrayList(); + ArrayList personalfriends = new ArrayList(); + ArrayList professionalfriends = new ArrayList(); + ArrayList casualacquaintances = new ArrayList(); + + + + File file = new File("save.ser"); + try{ + if (!file.exists()){//if file did not exist create new file + file.createNewFile(); + } + else{//else read from already existing file + try{ + FileInputStream fout = new FileInputStream(file); + ObjectInputStream oos = new ObjectInputStream(fout); + try{ + //FileInputStream fout = new FileInputStream(file); + //ObjectInputStream oos = new ObjectInputStream(fout); + relatives = (ArrayList)oos.readObject(); + personalfriends = (ArrayList)oos.readObject(); + professionalfriends = (ArrayList)oos.readObject(); + casualacquaintances = (ArrayList)oos.readObject(); + // System.out.println("Finished Reading! "); + } + catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if (oos != null){ + oos.close(); + fout.close(); + } + }catch(IOException e){ + e.printStackTrace(); + } + } + }catch(FileNotFoundException e){ + e.printStackTrace(); + }catch(IOException e){ + e.printStackTrace(); + } + } + } + catch(IOException e){ + e.printStackTrace(); + } + + + while (true){ + System.out.println("-----------------------------------------------------------------------"); + System.out.println("1.Create Acquaintance"); + System.out.println("2.Delete Acquaintance"); + System.out.println("3.Display Acquaintance List"); + System.out.println("4.Search Acquaintance"); + System.out.println("5.Exit"); + + Scanner scan = new Scanner(System.in); + String opt = scan.nextLine(); + + switch(opt){ + case ("1"):{//create acquaintance + System.out.println("1.Relative 2.Personal friend 3.Professional friend 4.Casual acquaintance"); + String opt1 = scan.nextLine(); + switch (opt1){ + case ("1"):{//create relative object + + + Relatives newrel = new Relatives(); + System.out.println(" Name: "); + newrel.setname(scan.nextLine()); + System.out.println(" Mobile Number: "); + newrel.setmobnum(scan.nextLine()); + System.out.println(" Email id: "); + newrel.setemailid(scan.nextLine()); + System.out.println(" Birthday: "); + newrel.setbirthday(scan.nextLine()); + System.out.println(" Date on which you met the latest time: "); + newrel.setdate(scan.nextLine()); + + relatives.add(newrel); + + FileOutputStream fout = null; + ObjectOutputStream oos = null; + try{ + fout = new FileOutputStream("save.ser"); + oos = new ObjectOutputStream(fout); + oos.writeObject(relatives); + oos.writeObject(personalfriends); + oos.writeObject(professionalfriends); + oos.writeObject(casualacquaintances); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if (oos != null){ + oos.close(); + fout.close(); + } + }catch(Exception e){ + e.printStackTrace(); + } + } + + System.out.println("Added successfully! "); + + break; + } + case ("2"):{//create personal_friend object + + Personal_friends newperfr = new Personal_friends(); + + System.out.println("Name:"); + newperfr.setname(scan.nextLine()); + System.out.println("Mobile number: "); + newperfr.setmobnum(scan.nextLine()); + System.out.println("Email id:"); + newperfr.setemailid(scan.nextLine()); + System.out.println("Date of acquaintance:"); + newperfr.setmetdate(scan.nextLine()); + while (true){ + System.out.println("How you met:"); + try{ + newperfr.setmeetcontext(scan.nextLine()); + }catch (IndexOutOfBoundsException e){ + System.out.println("You cannot add more than 100 characters..Try again.."); + continue; + } + break; + } + while (true){ + System.out.println("Any notable events?"); + try{ + newperfr.setevents(scan.nextLine()); + }catch(IndexOutOfBoundsException e){ + System.out.println("You cannot add more than 100 characters..Try again.."); + continue; + } + break; + } + + personalfriends.add(newperfr); + + FileOutputStream fout = null; + ObjectOutputStream oos = null; + try{ + fout = new FileOutputStream("save.ser"); + oos = new ObjectOutputStream(fout); + oos.writeObject(relatives); + oos.writeObject(personalfriends); + oos.writeObject(professionalfriends); + oos.writeObject(casualacquaintances); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if (oos != null){ + oos.close(); + fout.close(); + } + }catch(Exception e){ + e.printStackTrace(); + } + } + + System.out.println("Added successfully! "); + + break; + } + case ("3"):{//create professional_friend object + + Professional_friends newproffr = new Professional_friends(); + + System.out.println("Name: "); + newproffr.setname(scan.nextLine()); + System.out.println("Mobile number: "); + newproffr.setmobnum(scan.nextLine()); + System.out.println("Email id: "); + newproffr.setemailid(scan.nextLine()); + while (true){ + System.out.println("Common interests: "); + try{ + newproffr.setinterests(scan.nextLine()); + }catch(IndexOutOfBoundsException e){ + System.out.println("You cannot add more than 100 characters..Try again.."); + continue; + } + break; + } + + + professionalfriends.add(newproffr); + + FileOutputStream fout = null; + ObjectOutputStream oos = null; + try{ + fout = new FileOutputStream("save.ser"); + oos = new ObjectOutputStream(fout); + oos.writeObject(relatives); + oos.writeObject(personalfriends); + oos.writeObject(professionalfriends); + oos.writeObject(casualacquaintances); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if (oos != null){ + oos.close(); + fout.close(); + } + }catch(Exception e){ + e.printStackTrace(); + } + } + + System.out.println("Added succesfully!"); + + break; + } + case ("4"):{//create casual_acquaintance object + + + Casual_acquaintances newcasacq = new Casual_acquaintances(); + + System.out.println("Name: "); + newcasacq.setname(scan.nextLine()); + System.out.println("Mobile number: "); + newcasacq.setmobnum(scan.nextLine()); + System.out.println("Email id: "); + newcasacq.setemailid(scan.nextLine()); + while (true){ + System.out.println("When did you meet? "); + try{ + newcasacq.setmetwhen(scan.nextLine()); + }catch(IndexOutOfBoundsException e){ + System.out.println("You cannot add more than 100 characters..Try again.."); + continue; + } + break; + } + while(true){ + System.out.println("Where did you meet? "); + try{ + newcasacq.setmetwhere(scan.nextLine()); + }catch(IndexOutOfBoundsException e){ + System.out.println("You cannot add more than 100 characters..Try again.."); + continue; + } + break; + } + while(true){ + System.out.println("Under what circumstances did you meet? "); + try{ + newcasacq.setcircumstance(scan.nextLine()); + }catch(IndexOutOfBoundsException e){ + System.out.println("You cannot add more than 100 characters..Try again.."); + continue; + } + break; + } + while(true){ + System.out.println("Any other information?"); + try{ + newcasacq.setinfo(scan.nextLine()); + }catch(IndexOutOfBoundsException e){ + System.out.println("You cannot add more than 100 characters..Try again.."); + continue; + } + break; + } + + casualacquaintances.add(newcasacq); + + FileOutputStream fout = null; + ObjectOutputStream oos = null; + try{ + fout = new FileOutputStream("save.ser"); + oos = new ObjectOutputStream(fout); + oos.writeObject(relatives); + oos.writeObject(personalfriends); + oos.writeObject(professionalfriends); + oos.writeObject(casualacquaintances); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if (oos != null){ + oos.close() ; + fout.close(); + } + }catch(Exception e){ + e.printStackTrace(); + } + } + + System.out.println("Added successfully! "); + + break; + } + } + break; + } + case ("2"):{//delete acquaintance + System.out.println("1.Relative 2.Personal friend 3.Professional friend 4.Casual acquaintance"); + String opt2 = scan.nextLine(); + switch (opt2){ + case ("1"):{//delete relative_object + System.out.println("Name: "); + String name = scan.nextLine(); + + boolean delflag = false; + ListIterator it = relatives.listIterator(); + while (it.hasNext()){ + Relatives temprel = (Relatives) it.next(); + if (temprel.getname().equals(name)){ + relatives.remove(temprel); + System.out.println("Deleted successfully! "); + + FileOutputStream fout = null; + ObjectOutputStream oos = null; + try{ + fout = new FileOutputStream("save.ser"); + oos = new ObjectOutputStream(fout); + oos.writeObject(relatives); + oos.writeObject(personalfriends); + oos.writeObject(professionalfriends); + oos.writeObject(casualacquaintances); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if (oos != null){ + oos.close(); + fout.close(); + } + }catch(Exception e){ + e.printStackTrace(); + } + } + + delflag = true; + break; + } + } + if (!delflag){ + System.out.println("No relative's record is available with this name."); + } + + break; + } + case ("2"):{//delete personal_friend object + System.out.println("Name:"); + String name = scan.nextLine(); + + + boolean delflag = false; + ListIterator it = personalfriends.listIterator(); + while (it.hasNext()){ + Personal_friends temp = (Personal_friends) it.next(); + if (temp.getname().equals(name)){ + personalfriends.remove(temp); + System.out.println("Deleted successfully! "); + + FileOutputStream fout = null; + ObjectOutputStream oos = null; + try{ + fout = new FileOutputStream("save.ser"); + oos = new ObjectOutputStream(fout); + oos.writeObject(relatives); + oos.writeObject(personalfriends); + oos.writeObject(professionalfriends); + oos.writeObject(casualacquaintances); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if (oos != null){ + oos.close(); + fout.close(); + } + }catch(Exception e){ + e.printStackTrace(); + } + } + + delflag = true; + break; + } + } + if (!delflag){ + System.out.println("No personal friend's record is available with this name."); + } + + break; + } + case ("3"):{//delete professional_friend object + System.out.println("Name:"); + String name = scan.nextLine(); + + boolean delflag = false; + ListIterator it = professionalfriends.listIterator(); + while (it.hasNext()){ + Professional_friends temp = (Professional_friends) it.next(); + if (temp.getname().equals(name)){ + professionalfriends.remove(temp); + System.out.println("Deleted successfully! "); + + FileOutputStream fout = null; + ObjectOutputStream oos = null; + try{ + fout = new FileOutputStream("save.ser"); + oos = new ObjectOutputStream(fout); + oos.writeObject(relatives); + oos.writeObject(personalfriends); + oos.writeObject(professionalfriends); + oos.writeObject(casualacquaintances); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if (oos != null){ + oos.close(); + fout.close(); + } + }catch(Exception e){ + e.printStackTrace(); + } + } + + delflag = true; + break; + } + } + if (!delflag){ + System.out.println("No professional friend's record is available with this name."); + } + + break; + } + case ("4"):{// delete casual_acquaintance object + System.out.println("Name:"); + String name = scan.nextLine(); + + boolean delflag = false; + ListIterator it = casualacquaintances.listIterator(); + while (it.hasNext()){ + Casual_acquaintances temp = (Casual_acquaintances) it.next(); + if (temp.getname().equals(name)){ + casualacquaintances.remove(temp); + System.out.println("Deleted successfully! "); + + FileOutputStream fout = null; + ObjectOutputStream oos = null; + try{ + fout = new FileOutputStream("save.ser"); + oos = new ObjectOutputStream(fout); + oos.writeObject(relatives); + oos.writeObject(personalfriends); + oos.writeObject(professionalfriends); + oos.writeObject(casualacquaintances); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if (oos != null){ + oos.close(); + fout.close(); + } + }catch(Exception e){ + e.printStackTrace(); + } + } + + delflag = true; + break; + } + } + if (!delflag){ + System.out.println("No casual acquaintance's record is available with this name."); + } + + break; + } + } + + break; + } + case ("3"):{//display list + System.out.println("1.Relative 2.Personal friend 3.Professional friend 4.Casual acquaintance 5.Entire list"); + String opt3 = scan.nextLine(); + + switch (opt3){ + case ("1"):{//display list of relatives + System.out.println("\t------------------Relatives------------------------"); + + ListIterator it1 = relatives.listIterator(); + while (it1.hasNext()){ + Relatives temp1 = (Relatives) it1.next(); + System.out.println("------------------------------------------------------------"); + System.out.println("Name: "+temp1.getname()); + System.out.println("Date of Birth: "+temp1.getbirthday()); + System.out.println("Mobile Number: "+temp1.getmobnum()); + System.out.println("Email id: "+temp1.getemailid()); + System.out.println("Last met on: "+temp1.getdate()); + System.out.println("------------------------------------------------------------"); + } + + break; + } + case ("2"):{//display list of personal friends + System.out.println("\t-------------------Personal friends------------------------"); + + ListIterator it2 = personalfriends.listIterator(); + while (it2.hasNext()){ + Personal_friends temp2 = (Personal_friends) it2.next(); + System.out.println("------------------------------------------------------------"); + System.out.println("Name: "+temp2.getname()); + System.out.println("Mobile number: "+temp2.getmobnum()); + System.out.println("Email id: "+temp2.getemailid()); + System.out.println("Meeting Date: "+temp2.getmetdate()); + System.out.println("Meeting context: "+temp2.getmeetcontext()); + System.out.println("Notable events: "+temp2.getevents()); + System.out.println("------------------------------------------------------------"); + } + + break; + } + case ("3"):{//display list of professional friends + System.out.println("\t-------------------Professional friends------------------------"); + + ListIterator it3 = professionalfriends.listIterator(); + while (it3.hasNext()){ + Professional_friends temp3 = (Professional_friends) it3.next(); + System.out.println("------------------------------------------------------------"); + System.out.println("Name: "+temp3.getname()); + System.out.println("Mobile number: "+temp3.getmobnum()); + System.out.println("Email id: "+temp3.getemailid()); + System.out.println("Common interests: "+temp3.getinterests()); + System.out.println("------------------------------------------------------------"); + + } + + break; + } + case ("4"):{//display list of casual acquaintances + System.out.println("\t-------------------Casual Acquaintances------------------------"); + + ListIterator it4 = casualacquaintances.listIterator(); + while (it4.hasNext()){ + Casual_acquaintances temp4 = (Casual_acquaintances) it4.next(); + System.out.println("------------------------------------------------------------"); + System.out.println("Name: "+temp4.getname()); + System.out.println("Mobile number: "+temp4.getmobnum()); + System.out.println("Email id: "+temp4.getemailid()); + System.out.println("Met when: "+temp4.getmetwhen()); + System.out.println("Met where: "+temp4.getmetwhere()); + System.out.println("Meeting circumstances: "+temp4.getcircumstance()); + System.out.println("Other information: "+temp4.getinfo()); + System.out.println("------------------------------------------------------------"); + + } + + break; + } + case ("5"):{//display list of entire list + System.out.println("\t------------------Relatives------------------------"); + + ListIterator it1 = relatives.listIterator(); + while (it1.hasNext()){ + Relatives temp1 = (Relatives) it1.next(); + System.out.println("------------------------------------------------------------"); + System.out.println("Name: "+temp1.getname()); + System.out.println("Date of Birth: "+temp1.getbirthday()); + System.out.println("Mobile Number: "+temp1.getmobnum()); + System.out.println("Email id: "+temp1.getemailid()); + System.out.println("Last met on: "+temp1.getdate()); + System.out.println("------------------------------------------------------------"); + } + + System.out.println("\t-------------------Personal friends------------------------"); + + ListIterator it2 = personalfriends.listIterator(); + while (it2.hasNext()){ + Personal_friends temp2 = (Personal_friends) it2.next(); + System.out.println("------------------------------------------------------------"); + System.out.println("Name: "+temp2.getname()); + System.out.println("Mobile number: "+temp2.getmobnum()); + System.out.println("Email id: "+temp2.getemailid()); + System.out.println("Meeting Date: "+temp2.getmetdate()); + System.out.println("Meeting context: "+temp2.getmeetcontext()); + System.out.println("Notable events: "+temp2.getevents()); + System.out.println("------------------------------------------------------------"); + } + + System.out.println("\t-------------------Professional friends------------------------"); + + ListIterator it3 = professionalfriends.listIterator(); + while (it3.hasNext()){ + Professional_friends temp3 = (Professional_friends) it3.next(); + System.out.println("------------------------------------------------------------"); + System.out.println("Name: "+temp3.getname()); + System.out.println("Mobile number: "+temp3.getmobnum()); + System.out.println("Email id: "+temp3.getemailid()); + System.out.println("Common interests: "+temp3.getinterests()); + System.out.println("------------------------------------------------------------"); + + } + + System.out.println("\t-------------------Casual Acquaintances------------------------"); + + ListIterator it4 = casualacquaintances.listIterator(); + while (it4.hasNext()){ + Casual_acquaintances temp4 = (Casual_acquaintances) it4.next(); + System.out.println("------------------------------------------------------------"); + System.out.println("Name: "+temp4.getname()); + System.out.println("Mobile number: "+temp4.getmobnum()); + System.out.println("Email id: "+temp4.getemailid()); + System.out.println("Met when: "+temp4.getmetwhen()); + System.out.println("Met where: "+temp4.getmetwhere()); + System.out.println("Meeting circumstances: "+temp4.getcircumstance()); + System.out.println("Other information: "+temp4.getinfo()); + System.out.println("------------------------------------------------------------"); + + } + + break; + } + + } + + break; + } + case ("4"):{//search acquaintance by name + System.out.println("Name to search for: "); + String searchname = scan.nextLine(); + + boolean searchflag = false; + + ListIterator it1 = relatives.listIterator(); + while (it1.hasNext()){ + Relatives temp1 = (Relatives) it1.next(); + if (temp1.getname().equals(searchname)){ + System.out.println("Relative: "); + System.out.println("Name: "+temp1.getname()); + System.out.println("Date of Birth: "+temp1.getbirthday()); + System.out.println("Mobile Number: "+temp1.getmobnum()); + System.out.println("Email id: "+temp1.getemailid()); + System.out.println("Last met on: "+temp1.getdate()); + System.out.println("------------------------------------------------------------"); + searchflag = true; + } + } + + ListIterator it2 = personalfriends.listIterator(); + while (it2.hasNext()){ + Personal_friends temp2 = (Personal_friends) it2.next(); + if (temp2.getname().equals(searchname)){ + System.out.println("Personal friend:"); + System.out.println("Name: "+temp2.getname()); + System.out.println("Mobile number: "+temp2.getmobnum()); + System.out.println("Email id: "+temp2.getemailid()); + System.out.println("Meeting Date: "+temp2.getmetdate()); + System.out.println("Meeting context: "+temp2.getmeetcontext()); + System.out.println("Notable events: "+temp2.getevents()); + System.out.println("------------------------------------------------------------"); + searchflag = true; + } + } + + ListIterator it3 = professionalfriends.listIterator(); + while (it3.hasNext()){ + Professional_friends temp3 = (Professional_friends) it3.next(); + if (temp3.getname().equals(searchname)){ + + System.out.println("Professional friend:"); + System.out.println("Name: "+temp3.getname()); + System.out.println("Mobile number: "+temp3.getmobnum()); + System.out.println("Email id: "+temp3.getemailid()); + System.out.println("Common interests: "+temp3.getinterests()); + System.out.println("------------------------------------------------------------"); + searchflag = true; + } + } + + ListIterator it4 = casualacquaintances.listIterator(); + while (it4.hasNext()){ + Casual_acquaintances temp4 = (Casual_acquaintances) it4.next(); + if(temp4.getname().equals(searchname)){ + System.out.println("Casual acquaintance:"); + System.out.println("Name: "+temp4.getname()); + System.out.println("Mobile number: "+temp4.getmobnum()); + System.out.println("Email id: "+temp4.getemailid()); + System.out.println("Met when: "+temp4.getmetwhen()); + System.out.println("Met where: "+temp4.getmetwhere()); + System.out.println("Meeting circumstances: "+temp4.getcircumstance()); + System.out.println("Other information: "+temp4.getinfo()); + System.out.println("------------------------------------------------------------"); + searchflag = true; + } + } + + + + + if (searchflag == false) + System.out.println("No such record exists! "); + break; + } + case("5"):{//exit + System.out.println("Thank you! "); + + FileOutputStream fout = null; + ObjectOutputStream oos = null; + try{ + fout = new FileOutputStream("save.ser"); + oos = new ObjectOutputStream(fout); + oos.writeObject(relatives); + oos.writeObject(personalfriends); + oos.writeObject(professionalfriends); + oos.writeObject(casualacquaintances); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if (oos != null){ + oos.close(); + fout.close(); + } + }catch(Exception e){ + e.printStackTrace(); + } + } + + System.exit(0); + } + } + + } + +} +} diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$1.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$1.class new file mode 100644 index 0000000..67c2c94 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$1.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$10.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$10.class new file mode 100644 index 0000000..ed0b779 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$10.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$11.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$11.class new file mode 100644 index 0000000..3de41c3 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$11.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$12.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$12.class new file mode 100644 index 0000000..fa27729 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$12.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$13.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$13.class new file mode 100644 index 0000000..5015ed1 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$13.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$14.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$14.class new file mode 100644 index 0000000..43e492a Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$14.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$15.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$15.class new file mode 100644 index 0000000..850e9f4 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$15.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$16.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$16.class new file mode 100644 index 0000000..0f32ef6 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$16.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$17.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$17.class new file mode 100644 index 0000000..bcb6e74 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$17.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$18.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$18.class new file mode 100644 index 0000000..2dea0cc Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$18.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$19.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$19.class new file mode 100644 index 0000000..613debc Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$19.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$2.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$2.class new file mode 100644 index 0000000..7592301 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$2.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$20.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$20.class new file mode 100644 index 0000000..5dca105 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$20.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$21.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$21.class new file mode 100644 index 0000000..3a00dbb Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$21.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$22.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$22.class new file mode 100644 index 0000000..9a30b71 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$22.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$3.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$3.class new file mode 100644 index 0000000..12fe0d6 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$3.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$4.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$4.class new file mode 100644 index 0000000..8d02d0d Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$4.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$5.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$5.class new file mode 100644 index 0000000..fe85fb1 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$5.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$6.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$6.class new file mode 100644 index 0000000..991c9c2 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$6.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$7.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$7.class new file mode 100644 index 0000000..4047d6c Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$7.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$8.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$8.class new file mode 100644 index 0000000..c9e7486 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$8.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$9.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$9.class new file mode 100644 index 0000000..03bfd28 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$9.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list.class new file mode 100644 index 0000000..263e3e7 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list.java b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list.java new file mode 100644 index 0000000..f2eb5bf --- /dev/null +++ b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list.java @@ -0,0 +1,1856 @@ +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import java.awt.FlowLayout; +import javax.swing.UIManager; +import javax.swing.event.TableModelEvent; +import javax.swing.event.TableModelListener; +import javax.swing.table.TableModel; + +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.ListIterator; + +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.SwingConstants; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JComboBox; +import java.awt.Component; + +public class Contact_list { + + private static File file = new File("save.ser"); + + private static ArrayList relatives = new ArrayList(); + private static ArrayList personalfriends = new ArrayList(); + private static ArrayList professionalfriends = new ArrayList(); + private static ArrayList casualacquaintances = new ArrayList(); + + private JFrame frmContactList; + private JLabel lblNewLabel; + private JLabel lblNote; + private JPanel pane; + private JComboBox maincombobox; + + //components for first pop-up window + private JFrame frmAddContact; + private JTabbedPane tabAddContact; + private JPanel panelAddRelative; + private JTextArea AddRelativename; + private JTextArea AddRelativemobnum; + private JTextArea AddRelativeemailid; + private JTextArea AddRelativebirthday; + private JTextArea AddRelativelastmetdate; + private JButton addRelok; + + private JPanel panelAddPerF; + private JTextArea AddPerFname; + private JTextArea AddPerFmobnum; + private JTextArea AddPerFemailid; + private JTextArea AddPerFcontext; + private JTextArea AddPerFdate; + private JTextArea AddPerFevents; + private JButton addPerFok; + + private JPanel panelAddProF; + private JTextArea AddProFname; + private JTextArea AddProFmobnum; + private JTextArea AddProFemailid; + private JTextArea AddProFinterests; + private JButton addProFok; + + private JPanel panelAddCA; + private JTextArea AddCAname; + private JTextArea AddCAmobnum; + private JTextArea AddCAemailid; + private JTextArea AddCAwhen; + private JTextArea AddCAwhere; + private JTextArea AddCAcircumstance; + private JTextArea AddCAinfo; + private JButton addCAok; + + private JFrame frmEditContact; + private JPanel panelEditRelative; + private JPanel panelEditPerF; + private JPanel panelEditProF; + private JPanel panelEditCA; + private JTable editRel; + private JTable editPerF; + private JTable editProF; + private JTable editCA; + private JTabbedPane tabEditContact; + + + private JFrame frmDeleteContact; + private JRadioButton btnRel; + private JRadioButton btnPerF; + private JRadioButton btnProF; + private JRadioButton btnCA; + + + private JFrame frmDisplayContact; + private JPanel panelDisplayRelative; + private JPanel panelDisplayPerF; + private JPanel panelDisplayProF; + private JPanel panelDisplayCA; + private JTable dispRel; + private JTable dispPerF; + private JTable dispProF; + private JTable dispCA; + private JTabbedPane tabDisplayContact; + + private JFrame frmSearchContact; + + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + Contact_list window = new Contact_list(); + window.frmContactList.setVisible(true); + openFile(); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + + @SuppressWarnings("unchecked") + public static void openFile(){ + try{ + if (!file.exists()){//if file did not exist create new file + file.createNewFile(); + } + else{//else read from already existing file + try{ + FileInputStream fout = new FileInputStream(file); + ObjectInputStream oos = new ObjectInputStream(fout); + try{ + //FileInputStream fout = new FileInputStream(file); + //ObjectInputStream oos = new ObjectInputStream(fout); + relatives = (ArrayList)oos.readObject(); + personalfriends = (ArrayList)oos.readObject(); + professionalfriends = (ArrayList)oos.readObject(); + casualacquaintances = (ArrayList)oos.readObject(); + // System.out.println("Finished Reading! "); + } + catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if (oos != null){ + oos.close(); + fout.close(); + } + }catch(IOException e){ + JOptionPane.showMessageDialog(null,"OutputStream cannot be closed","IOException",JOptionPane.ERROR_MESSAGE); + //e.printStackTrace(); + } + } + }catch(FileNotFoundException e){ + JOptionPane.showMessageDialog(null,"File was not found","FileNotFoundException",JOptionPane.ERROR_MESSAGE); + //e.printStackTrace(); + }catch(IOException e){ + JOptionPane.showMessageDialog(null,"InputStream error!","IOException",JOptionPane.ERROR_MESSAGE); + //e.printStackTrace(); + } + } + } + catch(IOException e){ + JOptionPane.showMessageDialog(null,"File cannot be opened","IOException",JOptionPane.ERROR_MESSAGE); + //e.printStackTrace(); + } + } + + public void writeTofile(){ + FileOutputStream fout = null; + ObjectOutputStream oos = null; + try{ + fout = new FileOutputStream("save.ser"); + oos = new ObjectOutputStream(fout); + oos.writeObject(relatives); + oos.writeObject(personalfriends); + oos.writeObject(professionalfriends); + oos.writeObject(casualacquaintances); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if (oos != null){ + oos.close(); + fout.close(); + } + }catch(Exception e){ + e.printStackTrace(); + } + } + + } + + + ItemListener maincomboitemlistener = new ItemListener(){ + + @Override + public void itemStateChanged(ItemEvent event) { + // TODO Auto-generated method stub + if (event.getStateChange() == ItemEvent.SELECTED){ + if (maincombobox.getSelectedIndex() == 1){ + + init_add_contact(); + } + else if (maincombobox.getSelectedIndex() == 2){ + init_edit_contact(); + } + else if (maincombobox.getSelectedIndex() == 3){ + init_delete_contact(); + } + else if (maincombobox.getSelectedIndex() == 4){ + init_display_contact(); + } + else if (maincombobox.getSelectedIndex() == 5){ + init_search_contact(); + } + } + + + } + + }; + + //initialization of first pop-up window + public void init_add_contact(){ + frmAddContact = new JFrame(); + frmAddContact.setBackground(Color.GRAY); + frmAddContact.setFont(new Font("SansSerif", Font.PLAIN, 25)); + frmAddContact.setTitle("ADD NEW CONTACT TO THE LIST"); + frmAddContact.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAddContact.setBounds(100, 100, 200, 150);//?? + frmAddContact.setSize(new Dimension(400,400)); + frmAddContact.setLocationRelativeTo(null); + + //create a tabbed pane for further action + tabAddContact = new JTabbedPane(); + + add_rel_tab(); + add_personalfriends_tab(); + add_professionalfriends_tab(); + add_casualacquaintance_tab(); + + tabAddContact.addTab("RELATIVES",panelAddRelative); + tabAddContact.addTab("PERSONAL FRIENDS",panelAddPerF); + tabAddContact.addTab("PROFESSIONAL FRIENDS",panelAddProF); + tabAddContact.addTab("CASUAL ACQUAINTANCES",panelAddCA); + + frmAddContact.add(tabAddContact); + + frmAddContact.setVisible(true); + } + + public void add_rel_tab(){ + panelAddRelative = new JPanel(); + panelAddRelative.setLayout(new BoxLayout( panelAddRelative, BoxLayout.PAGE_AXIS)); + panelAddRelative.setAlignmentX(panelAddRelative.TOP_ALIGNMENT); + + JLabel addRelname = new JLabel("Name"); + addRelname.setAlignmentX(addRelname.CENTER_ALIGNMENT); + //addRelname.setFont(new Font("SansSerif")); + /*addRelname.setHorizontalTextPosition(JLabel.CENTER); + addRelname.setVerticalTextPosition(JLabel.CENTER);*/ + JLabel addRelmobnum = new JLabel("Mobile number"); + addRelmobnum.setAlignmentX(addRelmobnum.CENTER_ALIGNMENT); + JLabel addRelemailid = new JLabel("Email id"); + addRelemailid.setAlignmentX(addRelemailid.CENTER_ALIGNMENT); + JLabel addRelbirthday = new JLabel("Date of Birth"); + addRelbirthday.setAlignmentX(addRelbirthday.CENTER_ALIGNMENT); + JLabel addRellastmetdate = new JLabel("Last met on"); + addRellastmetdate.setAlignmentX(addRellastmetdate.CENTER_ALIGNMENT); + + AddRelativename = new JTextArea(); + //AddRelativename.setAutoscrolls(true); + AddRelativename.setFont(new Font("Serif",Font.BOLD,14)); + AddRelativename.setLineWrap(true); + AddRelativename.setWrapStyleWord(true); + JScrollPane addrelnamescrollPane = new JScrollPane(AddRelativename,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addrelnamescrollPane.setPreferredSize(new Dimension(350,20)); + addrelnamescrollPane.setAlignmentX(addrelnamescrollPane.CENTER_ALIGNMENT); + + AddRelativemobnum = new JTextArea(); + AddRelativemobnum.setFont(new Font("Serif",Font.BOLD,14)); + AddRelativemobnum.setLineWrap(true); + AddRelativemobnum.setWrapStyleWord(true); + JScrollPane addrelmobnumscrollPane = new JScrollPane(AddRelativemobnum,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addrelmobnumscrollPane.setPreferredSize(new Dimension(350,20)); + addrelmobnumscrollPane.setAlignmentX(addrelmobnumscrollPane.CENTER_ALIGNMENT); + + + AddRelativeemailid = new JTextArea(); + AddRelativeemailid.setFont(new Font("Serif",Font.BOLD,14)); + AddRelativeemailid.setLineWrap(true); + AddRelativeemailid.setWrapStyleWord(true); + JScrollPane addrelemailidscrollPane = new JScrollPane(AddRelativeemailid,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addrelemailidscrollPane.setPreferredSize(new Dimension(350,20)); + addrelemailidscrollPane.setAlignmentX(addrelemailidscrollPane.CENTER_ALIGNMENT); + + AddRelativebirthday = new JTextArea(); + AddRelativebirthday.setFont(new Font("Serif",Font.BOLD,14)); + AddRelativebirthday.setLineWrap(true); + AddRelativebirthday.setWrapStyleWord(true); + JScrollPane addrelbdayscrollPane = new JScrollPane(AddRelativebirthday,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addrelbdayscrollPane.setPreferredSize(new Dimension(350,20)); + addrelbdayscrollPane.setAlignmentX(addrelbdayscrollPane.CENTER_ALIGNMENT); + + + AddRelativelastmetdate = new JTextArea(); + AddRelativelastmetdate.setFont(new Font("Serif",Font.BOLD,14)); + AddRelativelastmetdate.setLineWrap(true); + AddRelativelastmetdate.setWrapStyleWord(true); + JScrollPane addrelmetdatescrollPane = new JScrollPane(AddRelativelastmetdate,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addrelmetdatescrollPane.setPreferredSize(new Dimension(350,20)); + addrelmetdatescrollPane.setAlignmentX(addrelmetdatescrollPane.CENTER_ALIGNMENT); + + addRelok = new JButton("OK"); + //add actionlistener to button + addRelok.addActionListener(addRelbtn); + addRelok.setAlignmentX(addRelok.CENTER_ALIGNMENT); + + panelAddRelative.add(addRelname); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,5))); + panelAddRelative.add(addrelnamescrollPane); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,10))); + panelAddRelative.add(addRelmobnum); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,5))); + panelAddRelative.add(addrelmobnumscrollPane); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,10))); + panelAddRelative.add(addRelemailid); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,5))); + panelAddRelative.add(addrelemailidscrollPane); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,10))); + panelAddRelative.add(addRelbirthday); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,5))); + panelAddRelative.add(addrelbdayscrollPane); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,10))); + panelAddRelative.add(addRellastmetdate); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,5))); + panelAddRelative.add(addrelmetdatescrollPane); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,10))); + panelAddRelative.add(addRelok); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,10))); + + } + public void add_personalfriends_tab(){ + + panelAddPerF = new JPanel(); + panelAddPerF.setLayout(new BoxLayout( panelAddPerF, BoxLayout.PAGE_AXIS)); + panelAddPerF.setAlignmentX(panelAddPerF.TOP_ALIGNMENT); + + JLabel addPerFname = new JLabel("Name"); + addPerFname.setAlignmentX(addPerFname.CENTER_ALIGNMENT); + JLabel addPerFmobnum = new JLabel("Mobile number"); + addPerFmobnum.setAlignmentX(addPerFmobnum.CENTER_ALIGNMENT); + JLabel addPerFemailid = new JLabel("Email id"); + addPerFemailid.setAlignmentX(addPerFemailid.CENTER_ALIGNMENT); + JLabel addPerFcontext = new JLabel("Context of acquaintance"); + addPerFcontext.setAlignmentX(addPerFcontext.CENTER_ALIGNMENT); + JLabel addPerFdate = new JLabel("Met on"); + addPerFdate.setAlignmentX(addPerFdate.CENTER_ALIGNMENT); + JLabel addPerFevents = new JLabel("Specific events"); + addPerFevents.setAlignmentX(addPerFevents.CENTER_ALIGNMENT); + + AddPerFname = new JTextArea(); + //AddRelativename.setAutoscrolls(true); + AddPerFname.setFont(new Font("Serif",Font.BOLD,14)); + AddPerFname.setLineWrap(true); + AddPerFname.setWrapStyleWord(true); + JScrollPane addPerFnamescrollPane = new JScrollPane(AddPerFname,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addPerFnamescrollPane.setPreferredSize(new Dimension(350,20)); + addPerFnamescrollPane.setAlignmentX(addPerFnamescrollPane.CENTER_ALIGNMENT); + + AddPerFmobnum = new JTextArea(); + AddPerFmobnum.setFont(new Font("Serif",Font.BOLD,14)); + AddPerFmobnum.setLineWrap(true); + AddPerFmobnum.setWrapStyleWord(true); + JScrollPane addPerFmobnumscrollPane = new JScrollPane(AddPerFmobnum,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addPerFmobnumscrollPane.setPreferredSize(new Dimension(350,20)); + addPerFmobnumscrollPane.setAlignmentX(addPerFmobnumscrollPane.CENTER_ALIGNMENT); + + + AddPerFemailid = new JTextArea(); + AddPerFemailid.setFont(new Font("Serif",Font.BOLD,14)); + AddPerFemailid.setLineWrap(true); + AddPerFemailid.setWrapStyleWord(true); + JScrollPane addPerFemailidscrollPane = new JScrollPane(AddPerFemailid,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addPerFemailidscrollPane.setPreferredSize(new Dimension(350,20)); + addPerFemailidscrollPane.setAlignmentX(addPerFemailidscrollPane.CENTER_ALIGNMENT); + + + AddPerFcontext = new JTextArea(); + AddPerFcontext.setFont(new Font("Serif",Font.BOLD,14)); + AddPerFcontext.setLineWrap(true); + AddPerFcontext.setWrapStyleWord(true); + JScrollPane addPerFcontextscrollPane = new JScrollPane(AddPerFcontext,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addPerFcontextscrollPane.setPreferredSize(new Dimension(350,20)); + addPerFcontextscrollPane.setAlignmentX(addPerFcontextscrollPane.CENTER_ALIGNMENT); + + + AddPerFdate = new JTextArea(); + AddPerFdate.setFont(new Font("Serif",Font.BOLD,14)); + AddPerFdate.setLineWrap(true); + AddPerFdate.setWrapStyleWord(true); + JScrollPane addPerFdatescrollPane = new JScrollPane(AddPerFdate,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addPerFdatescrollPane.setPreferredSize(new Dimension(350,20)); + addPerFdatescrollPane.setAlignmentX(addPerFdatescrollPane.CENTER_ALIGNMENT); + + + AddPerFevents = new JTextArea(); + AddPerFevents.setFont(new Font("Serif",Font.BOLD,14)); + AddPerFevents.setLineWrap(true); + AddPerFevents.setWrapStyleWord(true); + JScrollPane addPerFeventscrollPane = new JScrollPane(AddPerFevents,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addPerFeventscrollPane.setPreferredSize(new Dimension(350,20)); + addPerFeventscrollPane.setAlignmentX(addPerFeventscrollPane.CENTER_ALIGNMENT); + + + addPerFok = new JButton("OK"); + addPerFok.addActionListener(addPerFbtn); + addPerFok.setAlignmentX(addPerFok.CENTER_ALIGNMENT); + + panelAddPerF.add(addPerFname); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddPerF.add(addPerFnamescrollPane); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddPerF.add(addPerFmobnum); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddPerF.add(addPerFmobnumscrollPane); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddPerF.add(addPerFemailid); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddPerF.add(addPerFemailidscrollPane); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddPerF.add(addPerFcontext); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddPerF.add(addPerFcontextscrollPane); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddPerF.add(addPerFdate); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddPerF.add(addPerFdatescrollPane); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddPerF.add(addPerFevents); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddPerF.add(addPerFeventscrollPane); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddPerF.add(addPerFok); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,10))); + + } + public void add_professionalfriends_tab(){ + + panelAddProF = new JPanel(); + panelAddProF.setLayout(new BoxLayout( panelAddProF, BoxLayout.PAGE_AXIS)); + panelAddProF.setAlignmentX(panelAddProF.TOP_ALIGNMENT); + + JLabel addProFname = new JLabel("Name"); + addProFname.setAlignmentX(addProFname.CENTER_ALIGNMENT); + JLabel addProFmobnum = new JLabel("Mobile number"); + addProFmobnum.setAlignmentX(addProFmobnum.CENTER_ALIGNMENT); + JLabel addProFemailid = new JLabel("Email id"); + addProFemailid.setAlignmentX(addProFemailid.CENTER_ALIGNMENT); + JLabel addProFinterests = new JLabel("Common interests"); + addProFinterests.setAlignmentX(addProFinterests.CENTER_ALIGNMENT); + + + AddProFname = new JTextArea(); + //AddRelativename.setAutoscrolls(true); + AddProFname.setFont(new Font("Serif",Font.BOLD,14)); + AddProFname.setLineWrap(true); + AddProFname.setWrapStyleWord(true); + JScrollPane addProFnamescrollPane = new JScrollPane(AddProFname,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addProFnamescrollPane.setPreferredSize(new Dimension(350,20)); + addProFnamescrollPane.setAlignmentX(addProFnamescrollPane.CENTER_ALIGNMENT); + + AddProFmobnum = new JTextArea(); + AddProFmobnum.setFont(new Font("Serif",Font.BOLD,14)); + AddProFmobnum.setLineWrap(true); + AddProFmobnum.setWrapStyleWord(true); + JScrollPane addProFmobnumscrollPane = new JScrollPane(AddProFmobnum,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addProFmobnumscrollPane.setPreferredSize(new Dimension(350,20)); + addProFmobnumscrollPane.setAlignmentX(addProFmobnumscrollPane.CENTER_ALIGNMENT); + + + AddProFemailid = new JTextArea(); + AddProFemailid.setFont(new Font("Serif",Font.BOLD,14)); + AddProFemailid.setLineWrap(true); + AddProFemailid.setWrapStyleWord(true); + JScrollPane addProFemailidscrollPane = new JScrollPane(AddProFemailid,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addProFemailidscrollPane.setPreferredSize(new Dimension(350,20)); + addProFemailidscrollPane.setAlignmentX(addProFemailidscrollPane.CENTER_ALIGNMENT); + + + AddProFinterests = new JTextArea(); + AddProFinterests.setFont(new Font("Serif",Font.BOLD,14)); + AddProFinterests.setLineWrap(true); + AddProFinterests.setWrapStyleWord(true); + JScrollPane addProFinterestsscrollPane = new JScrollPane(AddProFinterests,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addProFinterestsscrollPane.setPreferredSize(new Dimension(350,20)); + addProFinterestsscrollPane.setAlignmentX(addProFinterestsscrollPane.CENTER_ALIGNMENT); + + + addProFok = new JButton("OK"); + addProFok.addActionListener(addProFbtn); + addProFok.setAlignmentX(addProFok.CENTER_ALIGNMENT); + + panelAddProF.add(addProFname); + panelAddProF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddProF.add(addProFnamescrollPane); + panelAddProF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddProF.add(addProFmobnum); + panelAddProF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddProF.add(addProFmobnumscrollPane); + panelAddProF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddProF.add(addProFemailid); + panelAddProF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddProF.add(addProFemailidscrollPane); + panelAddProF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddProF.add(addProFinterests); + panelAddProF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddProF.add(addProFinterestsscrollPane); + panelAddProF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddProF.add(addProFok); + panelAddProF.add(Box.createRigidArea(new Dimension(0,10))); + + } + public void add_casualacquaintance_tab(){ + + + panelAddCA = new JPanel(); + panelAddCA.setLayout(new BoxLayout( panelAddCA, BoxLayout.PAGE_AXIS)); + panelAddCA.setAlignmentX(panelAddCA.TOP_ALIGNMENT); + + JLabel addCAname = new JLabel("Name"); + addCAname.setAlignmentX(addCAname.CENTER_ALIGNMENT); + JLabel addCAmobnum = new JLabel("Mobile number"); + addCAmobnum.setAlignmentX(addCAmobnum.CENTER_ALIGNMENT); + JLabel addCAemailid = new JLabel("Email id"); + addCAemailid.setAlignmentX(addCAemailid.CENTER_ALIGNMENT); + JLabel addCAwhen = new JLabel("When did you meet?"); + addCAwhen.setAlignmentX(addCAwhen.CENTER_ALIGNMENT); + JLabel addCAwhere = new JLabel("Where did you meet?"); + addCAwhere.setAlignmentX(addCAwhere.CENTER_ALIGNMENT); + JLabel addCAcircumstance = new JLabel("Under what circumstances did you meet?"); + addCAcircumstance.setAlignmentX(addCAcircumstance.CENTER_ALIGNMENT); + JLabel addCAinfo = new JLabel("Other information:"); + addCAinfo.setAlignmentX(addCAinfo.CENTER_ALIGNMENT); + + AddCAname = new JTextArea(); + //AddRelativename.setAutoscrolls(true); + AddCAname.setFont(new Font("Serif",Font.BOLD,14)); + AddCAname.setLineWrap(true); + AddCAname.setWrapStyleWord(true); + JScrollPane addCAnamescrollPane = new JScrollPane(AddCAname,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addCAnamescrollPane.setPreferredSize(new Dimension(350,20)); + addCAnamescrollPane.setAlignmentX(addCAnamescrollPane.CENTER_ALIGNMENT); + + AddCAmobnum = new JTextArea(); + AddCAmobnum.setFont(new Font("Serif",Font.BOLD,14)); + AddCAmobnum.setLineWrap(true); + AddCAmobnum.setWrapStyleWord(true); + JScrollPane addCAmobnumscrollPane = new JScrollPane(AddCAmobnum,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addCAmobnumscrollPane.setPreferredSize(new Dimension(350,20)); + addCAmobnumscrollPane.setAlignmentX(addCAmobnumscrollPane.CENTER_ALIGNMENT); + + AddCAemailid = new JTextArea(); + AddCAemailid.setFont(new Font("Serif",Font.BOLD,14)); + AddCAemailid.setLineWrap(true); + AddCAemailid.setWrapStyleWord(true); + JScrollPane addCAemailidscrollPane = new JScrollPane(AddCAemailid,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addCAemailidscrollPane.setPreferredSize(new Dimension(350,20)); + addCAemailidscrollPane.setAlignmentX(addCAemailidscrollPane.CENTER_ALIGNMENT); + + AddCAwhen = new JTextArea(); + AddCAwhen.setFont(new Font("Serif",Font.BOLD,14)); + AddCAwhen.setLineWrap(true); + AddCAwhen.setWrapStyleWord(true); + JScrollPane addCAwhenscrollPane = new JScrollPane(AddCAwhen,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addCAwhenscrollPane.setPreferredSize(new Dimension(350,20)); + addCAwhenscrollPane.setAlignmentX(addCAwhenscrollPane.CENTER_ALIGNMENT); + + AddCAwhere = new JTextArea(); + AddCAwhere.setFont(new Font("Serif",Font.BOLD,14)); + AddCAwhere.setLineWrap(true); + AddCAwhere.setWrapStyleWord(true); + JScrollPane addCAwherescrollPane = new JScrollPane(AddCAwhere,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addCAwherescrollPane.setPreferredSize(new Dimension(350,20)); + addCAwherescrollPane.setAlignmentX(addCAwherescrollPane.CENTER_ALIGNMENT); + + AddCAcircumstance = new JTextArea(); + AddCAcircumstance.setFont(new Font("Serif",Font.BOLD,14)); + AddCAcircumstance.setLineWrap(true); + AddCAcircumstance.setWrapStyleWord(true); + JScrollPane addCAcircumstancescrollPane = new JScrollPane(AddCAcircumstance,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addCAcircumstancescrollPane.setPreferredSize(new Dimension(350,20)); + addCAcircumstancescrollPane.setAlignmentX(addCAcircumstancescrollPane.CENTER_ALIGNMENT); + + AddCAinfo = new JTextArea(); + AddCAinfo.setFont(new Font("Serif",Font.BOLD,14)); + AddCAinfo.setLineWrap(true); + AddCAinfo.setWrapStyleWord(true); + JScrollPane addCAinfoscrollPane = new JScrollPane(AddCAinfo,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addCAinfoscrollPane.setPreferredSize(new Dimension(350,20)); + addCAinfoscrollPane.setAlignmentX(addCAinfoscrollPane.CENTER_ALIGNMENT); + + addCAok = new JButton("OK"); + addCAok.addActionListener(addCAbtn); + addCAok.setAlignmentX(addCAok.CENTER_ALIGNMENT); + + panelAddCA.add(addCAname); + panelAddCA.add(Box.createRigidArea(new Dimension(0,5))); + panelAddCA.add(addCAnamescrollPane); + panelAddCA.add(Box.createRigidArea(new Dimension(0,10))); + panelAddCA.add(addCAmobnum); + panelAddCA.add(Box.createRigidArea(new Dimension(0,5))); + panelAddCA.add(addCAmobnumscrollPane); + panelAddCA.add(Box.createRigidArea(new Dimension(0,10))); + panelAddCA.add(addCAemailid); + panelAddCA.add(Box.createRigidArea(new Dimension(0,5))); + panelAddCA.add(addCAemailidscrollPane); + panelAddCA.add(Box.createRigidArea(new Dimension(0,10))); + panelAddCA.add(addCAwhen); + panelAddCA.add(Box.createRigidArea(new Dimension(0,5))); + panelAddCA.add(addCAwhenscrollPane); + panelAddCA.add(Box.createRigidArea(new Dimension(0,10))); + panelAddCA.add(addCAwhere); + panelAddCA.add(Box.createRigidArea(new Dimension(0,5))); + panelAddCA.add(addCAwherescrollPane); + panelAddCA.add(Box.createRigidArea(new Dimension(0,10))); + panelAddCA.add(addCAcircumstance); + panelAddCA.add(Box.createRigidArea(new Dimension(0,5))); + panelAddCA.add(addCAcircumstancescrollPane); + panelAddCA.add(Box.createRigidArea(new Dimension(0,10))); + panelAddCA.add(addCAinfo); + panelAddCA.add(Box.createRigidArea(new Dimension(0,5))); + panelAddCA.add(addCAinfoscrollPane); + panelAddCA.add(Box.createRigidArea(new Dimension(0,10))); + panelAddCA.add(addCAok); + panelAddCA.add(Box.createRigidArea(new Dimension(0,10))); + + } + + ActionListener addRelbtn = new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + Relatives newrel = new Relatives(); + newrel.setname(AddRelativename.getText()); + newrel.setmobnum(AddRelativemobnum.getText()); + newrel.setemailid(AddRelativeemailid.getText()); + newrel.setbirthday(AddRelativebirthday.getText()); + newrel.setdate(AddRelativelastmetdate.getText()); + relatives.add(newrel); + + writeTofile(); + JOptionPane.showMessageDialog(null,"Added!","SUCCESS",JOptionPane.INFORMATION_MESSAGE); + + } + + }; + + ActionListener addPerFbtn = new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + Personal_friends newPerF = new Personal_friends(); + newPerF.setname(AddPerFname.getText()); + newPerF.setmobnum(AddPerFmobnum.getText()); + newPerF.setemailid(AddPerFemailid.getText()); + newPerF.setmetdate(AddPerFdate.getText()); + + try{ + if (AddPerFcontext.getText().length() > 100) throw new Exception(); + else{ + newPerF.setmeetcontext(AddPerFcontext.getText()); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null,"Add context in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + return; + } + try{ + if (AddPerFevents.getText().length() > 100) throw new Exception(); + else{ + newPerF.setevents(AddPerFevents.getText()); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null,"Add events in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + return; + } + + + + //newPerF.setmeetcontext(AddPerFcontext.getText()); + //newPerF.setevents(AddPerFevents.getText()); + personalfriends.add(newPerF); + + writeTofile(); + JOptionPane.showMessageDialog(null,"Added!","SUCCESS",JOptionPane.INFORMATION_MESSAGE); + + } + + }; + + ActionListener addProFbtn = new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + Professional_friends newProF = new Professional_friends(); + newProF.setname(AddProFname.getText()); + newProF.setmobnum(AddProFmobnum.getText()); + newProF.setemailid(AddProFemailid.getText()); + + try{ + if (AddProFinterests.getText().length() > 100) throw new Exception(); + else{ + newProF.setinterests(AddProFinterests.getText()); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null,"Add interests in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + return; + } + //newProF.setinterests(AddProFinterests.getText()); + + professionalfriends.add(newProF); + + writeTofile(); + JOptionPane.showMessageDialog(null,"Added!","SUCCESS",JOptionPane.INFORMATION_MESSAGE); + + } + + }; + + ActionListener addCAbtn = new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + Casual_acquaintances newCA = new Casual_acquaintances(); + newCA.setname(AddCAname.getText()); + newCA.setmobnum(AddCAmobnum.getText()); + newCA.setemailid(AddCAemailid.getText()); + + try{ + if (AddCAwhen.getText().length() > 100) throw new Exception(); + else{ + newCA.setmetwhen(AddCAwhen.getText()); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null,"Add 'When did you meet?' in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + return; + } + try{ + if (AddCAwhere.getText().length() > 100) throw new Exception(); + else{ + newCA.setmetwhere(AddCAwhere.getText()); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null,"Add 'Where did you meet?' in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + return; + } + try{ + if (AddCAcircumstance.getText().length() > 100) throw new Exception(); + else{ + newCA.setcircumstance(AddCAcircumstance.getText()); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null,"Add 'Under what circumstances did you meet?' in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + return; + } + try{ + if (AddCAinfo.getText().length() > 100) throw new Exception(); + else{ + newCA.setinfo(AddCAinfo.getText()); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null,"Add 'Other information:' in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + return; + } + + + /*newCA.setmetwhen(AddCAwhen.getText()); + newCA.setmetwhere(AddCAwhere.getText()); + newCA.setcircumstance(AddCAcircumstance.getText()); + newCA.setinfo(AddCAinfo.getText());*/ + casualacquaintances.add(newCA); + + writeTofile(); + JOptionPane.showMessageDialog(null,"Added!","SUCCESS",JOptionPane.INFORMATION_MESSAGE); + + } + + }; + + public void init_edit_contact(){ + + //dispRel.setCellSelectionEnabled(true); + frmEditContact = new JFrame(); + frmEditContact.setBackground(Color.GRAY); + frmEditContact.setFont(new Font("SansSerif", Font.PLAIN, 25)); + frmEditContact.setTitle("Edit Details"); + frmEditContact.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAddContact.setBounds(100, 100, 200, 150);//?? + frmEditContact.setSize(new Dimension(400,400)); + frmEditContact.setLocationRelativeTo(null); + + //frmDisplayContact.pack(); + + //create a tabbed pane for further action + JTabbedPane tabEditContact = new JTabbedPane(); + //JButton okbutton = new JButton("OK"); + + edit_rel_tab(); + edit_personalfriends_tab(); + edit_professionalfriends_tab(); + edit_casualacquaintance_tab(); + + + + tabEditContact.addTab("RELATIVES",panelEditRelative); + tabEditContact.addTab("PERSONAL FRIENDS",panelEditPerF); + tabEditContact.addTab("PROFESSIONAL FRIENDS",panelEditProF); + tabEditContact.addTab("CASUAL ACQUAINTANCES",panelEditCA); + + frmEditContact.add(tabEditContact); + //frmDisplayContact.setLayout(new BorderLayout()); + frmEditContact.setVisible(true); + + editRel.getModel().addTableModelListener(table_event); + editPerF.getModel().addTableModelListener(table_event); + editProF.getModel().addTableModelListener(table_event); + editCA.getModel().addTableModelListener(table_event); + + } + + TableModelListener table_event = new TableModelListener(){ + + @Override + public void tableChanged(TableModelEvent e) { + // TODO Auto-generated method stub + int row = e.getFirstRow(); + int column = e.getColumn(); + TableModel model = (TableModel)e.getSource(); + //String columnName = model.getColumnName(column); + // Object data = model.getValueAt(row, column); + try{ + if (model.equals(editRel.getModel())){ + + Contacts temp = relatives.get(row); + switch (column){ + + case (0):{ + temp.setname((String)editRel.getValueAt(row, column)); + + break; + + } + case (1):{ + + temp.setmobnum((String)editRel.getValueAt(row, column)); + + break; + } + case (2):{ + + temp.setemailid((String)editRel.getValueAt(row, column)); + break; + } + case (3):{ + + ((Relatives)temp).setbirthday((String)editRel.getValueAt(row, column)); + break; + } + case (4):{ + + ((Relatives)temp).setdate((String)editRel.getValueAt(row, column)); + break; + } + + } + //relatives = (ArrayList)dispRel.getModel(); + writeTofile(); + //dispRel.setValueAt(data, row, column); + } + else if (model.equals(editPerF.getModel())){ + //dispPerF.setValueAt(data, row, column); + + Contacts temp = personalfriends.get(row); + switch (column){ + + case (0):{ + temp.setname((String)editPerF.getValueAt(row, column)); + + break; + + } + case (1):{ + + temp.setmobnum((String)editPerF.getValueAt(row, column)); + + break; + } + case (2):{ + + temp.setemailid((String)editPerF.getValueAt(row, column)); + break; + } + case (3):{ + + try{ + if (((String)editPerF.getValueAt(row, column)).length() > 100) throw new Exception(); + else { + ((Personal_friends)temp).setmeetcontext((String)editPerF.getValueAt(row, column)); + + } + }catch(Exception ex){ + JOptionPane.showMessageDialog(null,"Add meeting context in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + } + break; + + /*((Personal_friends)temp).setmeetcontext((String)editPerF.getValueAt(row, column)); + break;*/ + } + case (4):{ + + ((Personal_friends)temp).setmetdate((String)editPerF.getValueAt(row, column)); + break; + } + case (5):{ + + try{ + if (((String)editPerF.getValueAt(row, column)).length() > 100) throw new Exception(); + else { + ((Personal_friends)temp).setevents((String)editPerF.getValueAt(row, column)); + + } + }catch(Exception ex){ + JOptionPane.showMessageDialog(null,"Add events in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + } + break; + + /*((Personal_friends)temp).setevents((String)editPerF.getValueAt(row, column)); + break;*/ + } + } + //relatives = (ArrayList)dispRel.getModel(); + writeTofile(); + + } + else if (model.equals(editProF.getModel())){ + //dispProF.setValueAt(data, row, column); + + Contacts temp = professionalfriends.get(row); + switch (column){ + + case (0):{ + temp.setname((String)editProF.getValueAt(row, column)); + + break; + + } + case (1):{ + + temp.setmobnum((String)editProF.getValueAt(row, column)); + + break; + } + case (2):{ + + temp.setemailid((String)editProF.getValueAt(row, column)); + break; + } + case (3):{ + try{ + if (((String)editProF.getValueAt(row, column)).length() > 100) throw new Exception(); + else{ + ((Professional_friends)temp).setinterests((String)editProF.getValueAt(row, column)); + + } + }catch(Exception ex){ + JOptionPane.showMessageDialog(null,"Add interests in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + } + break; + /*((Professional_friends)temp).setinterests((String)editProF.getValueAt(row, column)); + break;*/ + } + + } + //relatives = (ArrayList)dispRel.getModel(); + writeTofile(); + + } + else if (model.equals(editCA.getModel())){ + //dispCA.setValueAt(data, row, column); + + Contacts temp = casualacquaintances.get(row); + switch (column){ + + case (0):{ + temp.setname((String)editCA.getValueAt(row, column)); + + break; + + } + case (1):{ + + temp.setmobnum((String)editCA.getValueAt(row, column)); + + break; + } + case (2):{ + + temp.setemailid((String)editCA.getValueAt(row, column)); + break; + } + case (3):{ + try{ + if (((String)editCA.getValueAt(row, column)).length() > 100) throw new Exception(); + else { + ((Casual_acquaintances)temp).setmetwhen((String)editCA.getValueAt(row, column)); + + } + }catch(Exception ex){ + JOptionPane.showMessageDialog(null,"Add met when in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + } + break; + //((Casual_acquaintances)temp).setmetwhen((String)editCA.getValueAt(row, column)); + //break; + } + case (4):{ + + try{ + if (((String)editCA.getValueAt(row, column)).length() > 100) throw new Exception(); + else{ + ((Casual_acquaintances)temp).setmetwhere((String)editCA.getValueAt(row, column)); + + } + }catch(Exception ex){ + JOptionPane.showMessageDialog(null,"Add met where in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + } + break; + + /*((Casual_acquaintances)temp).setmetwhere((String)editCA.getValueAt(row, column)); + break;*/ + } + case (5):{ + try{ + if (((String)editCA.getValueAt(row, column)).length() > 100) throw new Exception(); + else{ + ((Casual_acquaintances)temp).setcircumstance((String)editCA.getValueAt(row, column)); + + } + }catch(Exception ex){ + JOptionPane.showMessageDialog(null,"Add meeting circumstance in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + } + break; + /*((Casual_acquaintances)temp).setcircumstance((String)editCA.getValueAt(row, column)); + break;*/ + } + case (6):{ + try{ + if (((String)editCA.getValueAt(row, column)).length() > 100) throw new Exception(); + else{ + ((Casual_acquaintances)temp).setinfo((String)editCA.getValueAt(row, column)); + + } + }catch(Exception ex){ + JOptionPane.showMessageDialog(null,"Add information in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + } + break; + /*((Casual_acquaintances)temp).setinfo((String)editCA.getValueAt(row, column)); + break;*/ + } + } + //relatives = (ArrayList)dispRel.getModel(); + writeTofile(); + } + } + catch(Exception ex){ + System.out.println("Exception Here in table!"); + } + + writeTofile(); + + } + + }; + + public void edit_rel_tab(){ + + panelEditRelative = new JPanel(); + + + String[] columns = {"Name","Mobile number","Email id","Date of Birth","Last met on"}; + Object[][] rows = new Object[relatives.size()][5]; + for (Contacts i:relatives){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[relatives.indexOf(i)][0] = relatives.get(relatives.indexOf(i)).getname(); + rows[relatives.indexOf(i)][1] = relatives.get(relatives.indexOf(i)).getmobnum(); + rows[relatives.indexOf(i)][2] = relatives.get(relatives.indexOf(i)).getemailid(); + rows[relatives.indexOf(i)][3] = ((Relatives)relatives.get(relatives.indexOf(i))).getbirthday(); + rows[relatives.indexOf(i)][4] = ((Relatives)relatives.get(relatives.indexOf(i))).getdate(); + + } + + editRel = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return true; + } + }; + editRel.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + editRel.setAutoCreateColumnsFromModel(true); + editRel.putClientProperty("terminateEditOnFocusLost", true); + + JButton okbutton = new JButton("OK"); + //okbutton.setFocusable(true); + okbutton.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + //okbutton.requestFocus(); + writeTofile(); + } + + }); + + panelEditRelative.setLayout(new BorderLayout()); + panelEditRelative.add(new JScrollPane(editRel),BorderLayout.CENTER); + panelEditRelative.add(okbutton,BorderLayout.PAGE_END); + panelEditRelative.setPreferredSize(new Dimension(350,350)); + } + + public void edit_personalfriends_tab(){ + panelEditPerF = new JPanel(); + + + String[] columns = {"Name","Mobile number","Email id","Meeting Context","Date of Acquaintance","Specific events"}; + Object[][] rows = new Object[personalfriends.size()][6]; + for (Contacts i:personalfriends){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[personalfriends.indexOf(i)][0] = personalfriends.get(personalfriends.indexOf(i)).getname(); + rows[personalfriends.indexOf(i)][1] = personalfriends.get(personalfriends.indexOf(i)).getmobnum(); + rows[personalfriends.indexOf(i)][2] = personalfriends.get(personalfriends.indexOf(i)).getemailid(); + rows[personalfriends.indexOf(i)][3] = ((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getmeetcontext(); + rows[personalfriends.indexOf(i)][4] = ((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getmetdate(); + rows[personalfriends.indexOf(i)][5] = ((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getevents(); + + } + + editPerF = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return true; + } + }; + editPerF.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + editPerF.setAutoCreateColumnsFromModel(true); + editPerF.putClientProperty("terminateEditOnFocusLost", true); + + JButton okbutton = new JButton("OK"); + okbutton.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + writeTofile(); + } + + }); + panelEditPerF.setLayout(new BorderLayout()); + panelEditPerF.add(new JScrollPane(editPerF),BorderLayout.CENTER); + panelEditPerF.add(okbutton,BorderLayout.PAGE_END); + panelEditPerF.setPreferredSize(new Dimension(350,350)); + } + + public void edit_professionalfriends_tab(){ + panelEditProF = new JPanel(); + + + String[] columns = {"Name","Mobile number","Email id","Common interests"}; + Object[][] rows = new Object[professionalfriends.size()][4]; + for (Contacts i:professionalfriends){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[professionalfriends.indexOf(i)][0] = professionalfriends.get(professionalfriends.indexOf(i)).getname(); + rows[professionalfriends.indexOf(i)][1] = professionalfriends.get(professionalfriends.indexOf(i)).getmobnum(); + rows[professionalfriends.indexOf(i)][2] = professionalfriends.get(professionalfriends.indexOf(i)).getemailid(); + rows[professionalfriends.indexOf(i)][3] = ((Professional_friends)professionalfriends.get(professionalfriends.indexOf(i))).getinterests(); + + } + + editProF = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return true; + } + }; + editProF.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + editProF.setAutoCreateColumnsFromModel(true); + editProF.putClientProperty("terminateEditOnFocusLost", true); + + JButton okbutton = new JButton("OK"); + okbutton.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + writeTofile(); + } + + }); + panelEditProF.setLayout(new BorderLayout()); + panelEditProF.add(new JScrollPane(editProF),BorderLayout.CENTER); + panelEditProF.add(okbutton,BorderLayout.PAGE_END); + panelEditProF.setPreferredSize(new Dimension(350,350)); + + } + + public void edit_casualacquaintance_tab(){ + panelEditCA = new JPanel(); + + String[] columns = {"Name","Mobile number","Email id","Met When","Met Where","Meeting Circumstances","Other information"}; + Object[][] rows = new Object[casualacquaintances.size()][7]; + for (Contacts i:casualacquaintances){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[casualacquaintances.indexOf(i)][0] = casualacquaintances.get(casualacquaintances.indexOf(i)).getname(); + rows[casualacquaintances.indexOf(i)][1] = casualacquaintances.get(casualacquaintances.indexOf(i)).getmobnum(); + rows[casualacquaintances.indexOf(i)][2] = casualacquaintances.get(casualacquaintances.indexOf(i)).getemailid(); + rows[casualacquaintances.indexOf(i)][3] = ((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getmetwhen(); + rows[casualacquaintances.indexOf(i)][4] = ((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getmetwhere(); + rows[casualacquaintances.indexOf(i)][5] = ((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getcircumstance(); + rows[casualacquaintances.indexOf(i)][6] = ((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getinfo(); + } + + editCA = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return true; + } + }; + editCA.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + editCA.setAutoCreateColumnsFromModel(true); + editCA.putClientProperty("terminateEditOnFocusLost", true); + + JButton okbutton = new JButton("OK"); + okbutton.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + writeTofile(); + } + + }); + panelEditCA.setLayout(new BorderLayout()); + panelEditCA.add(new JScrollPane(editCA),BorderLayout.CENTER); + panelEditCA.add(okbutton,BorderLayout.PAGE_END); + panelEditCA.setPreferredSize(new Dimension(350,350)); + } + + public void init_delete_contact(){ + frmDeleteContact = new JFrame(); + frmDeleteContact.setBackground(Color.GRAY); + frmDeleteContact.setFont(new Font("SansSerif", Font.PLAIN, 25)); + frmDeleteContact.setTitle("DELETE CONTACT FROM LIST"); + frmDeleteContact.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAddContact.setBounds(100, 100, 200, 150);//?? + frmDeleteContact.setSize(new Dimension(350,150)); + frmDeleteContact.setLocationRelativeTo(null); + //frmAddContact.setLayout(new BoxLayout(frmAdd)); + + JRadioButton btnExtra = new JRadioButton("Choose one of the following",true); + btnRel = new JRadioButton("Delete a relative's contact",true); + btnPerF = new JRadioButton("Delete a personal friend's contact",false); + btnProF = new JRadioButton("Delete a professional friend's contact",false); + btnCA = new JRadioButton("Delete a casual acquaintance's contact",false); + + /*btnRel.addItemListener(deletelistener); + btnPerF.addItemListener(deletelistener); + btnProF.addItemListener(deletelistener); + btnCA.addItemListener(deletelistener);*/ + + + btnRel.addActionListener(deletelistener); + btnPerF.addActionListener(deletelistener); + btnProF.addActionListener(deletelistener); + btnCA.addActionListener(deletelistener); + + ButtonGroup group = new ButtonGroup(); + group.add(btnExtra); + group.add(btnRel); + group.add(btnPerF); + group.add(btnProF); + group.add(btnCA); + + JPanel delpanel = new JPanel(); + delpanel.setLayout(new BoxLayout(delpanel,BoxLayout.PAGE_AXIS)); + //delpanel.setPreferredSize(new Dimension(300,150)); + delpanel.add(btnExtra); + delpanel.add(btnRel); + delpanel.add(btnPerF); + delpanel.add(btnProF); + delpanel.add(btnCA); + + frmDeleteContact.add(delpanel); + //frmDeleteContact.getContentPane().add(btnRel); + frmDeleteContact.setVisible(true); + + } + + /*ItemListener deletelistener = new ItemListener(){ + + @Override + public void itemStateChanged(ItemEvent e) { + // TODO Auto-generated method stub + + if (e.getItem().equals(btnRel)){ + deletecontact(relatives); + } + else if (e.getItem().equals(btnPerF)){ + deletecontact(personalfriends); + } + else if (e.getItem().equals(btnProF)){ + deletecontact(professionalfriends); + } + else if (e.getItem().equals(btnCA)){ + deletecontact(casualacquaintances); + } + } + + };*/ + + ActionListener deletelistener = new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if (e.getSource().equals(btnRel)){ + deletecontact(relatives); + } + else if (e.getSource().equals(btnPerF)){ + deletecontact(personalfriends); + } + else if (e.getSource().equals(btnProF)){ + deletecontact(professionalfriends); + } + else if (e.getSource().equals(btnCA)){ + deletecontact(casualacquaintances); + } + } + + }; + + public void deletecontact(ArrayList contact){ + ArrayList names = new ArrayList(); + ListIterator contit = contact.listIterator(); + while (contit.hasNext()){ + names.add(contit.next().getname()); + } + + Collections.sort(names); + String[] temp = new String[names.size()]; + temp = names.toArray(temp); + + JComboBox select = new JComboBox(temp); + select.setPreferredSize(new Dimension(200,10)); + + JFrame newframe = new JFrame("Select to Delete"); + newframe.setLocationRelativeTo(null); + newframe.setResizable(false); + newframe.setSize(new Dimension(225,200)); + newframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + newframe.setVisible(true); + + JPanel newpanel = new JPanel(); + newpanel.setLayout(new BoxLayout(newpanel,BoxLayout.PAGE_AXIS)); + + JButton newbutton = new JButton("Delete"); + newbutton.setHorizontalAlignment(JButton.CENTER); + newbutton.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + ListIterator itnow = contact.listIterator(); + String name = (String) select.getSelectedItem(); + + while (itnow.hasNext()){ + Contacts check = new Contacts(); + try{ + check = itnow.next(); + } + catch(Exception e){ + System.out.println("HERE!"); + } + if (check.getname().equals(name)){ + try{ + select.removeItemAt(select.getSelectedIndex()); + contact.remove(check); + writeTofile(); + try{ + JOptionPane.showMessageDialog(null,"DELETED","DELETED SUCCESSFULLY!",JOptionPane.INFORMATION_MESSAGE); + break; + }catch(Exception e){ + System.out.println("Error HERE!"); + } + break; + }catch(Exception e){ + System.out.println("EXCEPTION!"); + } + + + + + if (!(itnow.hasNext())) + break; + + } + + } + } + + + } + ); + newpanel.add(Box.createVerticalGlue()); + newpanel.add(select); + newpanel.add(Box.createVerticalGlue()); + newpanel.add(newbutton); + newbutton.setAlignmentX(newpanel.CENTER_ALIGNMENT); + newpanel.add(Box.createVerticalGlue()); + newframe.add(newpanel); + + //select.add(names); + //Object selectedvalue = JOptionPane.showInputDialog(names,names.get(0));//(null, "", "DELETE", JOptionPane.INFORMATION_MESSAGE, null, contact,"None"); + + + + } + + + public void init_display_contact(){ + frmDisplayContact = new JFrame(); + frmDisplayContact.setBackground(Color.GRAY); + frmDisplayContact.setFont(new Font("SansSerif", Font.PLAIN, 25)); + frmDisplayContact.setTitle("Displaying Details"); + frmDisplayContact.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAddContact.setBounds(100, 100, 200, 150);//?? + frmDisplayContact.setSize(new Dimension(400,400)); + frmDisplayContact.setLocationRelativeTo(null); + + //frmDisplayContact.pack(); + + //create a tabbed pane for further action + tabDisplayContact = new JTabbedPane(); + + disp_rel_tab(); + disp_personalfriends_tab(); + disp_professionalfriends_tab(); + disp_casualacquaintance_tab(); + + tabDisplayContact.addTab("RELATIVES",panelDisplayRelative); + tabDisplayContact.addTab("PERSONAL FRIENDS",panelDisplayPerF); + tabDisplayContact.addTab("PROFESSIONAL FRIENDS",panelDisplayProF); + tabDisplayContact.addTab("CASUAL ACQUAINTANCES",panelDisplayCA); + + frmDisplayContact.add(tabDisplayContact); + //frmDisplayContact.setLayout(new BorderLayout()); + frmDisplayContact.setVisible(true); + } + + public void disp_rel_tab(){ + panelDisplayRelative = new JPanel(); + + + String[] columns = {"Name","Mobile number","Email id","Date of Birth","Last met on"}; + Object[][] rows = new Object[relatives.size()][5]; + for (Contacts i:relatives){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[relatives.indexOf(i)][0] = relatives.get(relatives.indexOf(i)).getname(); + rows[relatives.indexOf(i)][1] = relatives.get(relatives.indexOf(i)).getmobnum(); + rows[relatives.indexOf(i)][2] = relatives.get(relatives.indexOf(i)).getemailid(); + rows[relatives.indexOf(i)][3] = ((Relatives)relatives.get(relatives.indexOf(i))).getbirthday(); + rows[relatives.indexOf(i)][4] = ((Relatives)relatives.get(relatives.indexOf(i))).getdate(); + + } + + dispRel = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return false; + } + }; + dispRel.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + dispRel.setAutoCreateColumnsFromModel(true); + + panelDisplayRelative.setLayout(new BorderLayout()); + panelDisplayRelative.add(new JScrollPane(dispRel),BorderLayout.CENTER); + panelDisplayRelative.setPreferredSize(new Dimension(350,350)); + } + + public void disp_personalfriends_tab(){ + panelDisplayPerF = new JPanel(); + + + String[] columns = {"Name","Mobile number","Email id","Meeting Context","Date of Acquaintance","Specific events"}; + Object[][] rows = new Object[personalfriends.size()][6]; + for (Contacts i:personalfriends){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[personalfriends.indexOf(i)][0] = personalfriends.get(personalfriends.indexOf(i)).getname(); + rows[personalfriends.indexOf(i)][1] = personalfriends.get(personalfriends.indexOf(i)).getmobnum(); + rows[personalfriends.indexOf(i)][2] = personalfriends.get(personalfriends.indexOf(i)).getemailid(); + rows[personalfriends.indexOf(i)][3] = ((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getmeetcontext(); + rows[personalfriends.indexOf(i)][4] = ((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getmetdate(); + rows[personalfriends.indexOf(i)][5] = ((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getevents(); + + } + + dispPerF = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return false; + } + }; + dispPerF.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + dispPerF.setAutoCreateColumnsFromModel(true); + + panelDisplayPerF.setLayout(new BorderLayout()); + panelDisplayPerF.add(new JScrollPane(dispPerF),BorderLayout.CENTER); + panelDisplayPerF.setPreferredSize(new Dimension(350,350)); + + + } + + public void disp_professionalfriends_tab(){ + panelDisplayProF = new JPanel(); + + + String[] columns = {"Name","Mobile number","Email id","Common interests"}; + Object[][] rows = new Object[professionalfriends.size()][4]; + for (Contacts i:professionalfriends){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[professionalfriends.indexOf(i)][0] = professionalfriends.get(professionalfriends.indexOf(i)).getname(); + rows[professionalfriends.indexOf(i)][1] = professionalfriends.get(professionalfriends.indexOf(i)).getmobnum(); + rows[professionalfriends.indexOf(i)][2] = professionalfriends.get(professionalfriends.indexOf(i)).getemailid(); + rows[professionalfriends.indexOf(i)][3] = ((Professional_friends)professionalfriends.get(professionalfriends.indexOf(i))).getinterests(); + + } + + dispProF = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return false; + } + }; + dispProF.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + dispProF.setAutoCreateColumnsFromModel(true); + + panelDisplayProF.setLayout(new BorderLayout()); + panelDisplayProF.add(new JScrollPane(dispProF),BorderLayout.CENTER); + panelDisplayProF.setPreferredSize(new Dimension(350,350)); + + + } + + public void disp_casualacquaintance_tab(){ + panelDisplayCA = new JPanel(); + + String[] columns = {"Name","Mobile number","Email id","Met When","Met Where","Meeting Circumstances","Other information"}; + Object[][] rows = new Object[casualacquaintances.size()][7]; + for (Contacts i:casualacquaintances){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[casualacquaintances.indexOf(i)][0] = casualacquaintances.get(casualacquaintances.indexOf(i)).getname(); + rows[casualacquaintances.indexOf(i)][1] = casualacquaintances.get(casualacquaintances.indexOf(i)).getmobnum(); + rows[casualacquaintances.indexOf(i)][2] = casualacquaintances.get(casualacquaintances.indexOf(i)).getemailid(); + rows[casualacquaintances.indexOf(i)][3] = ((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getmetwhen(); + rows[casualacquaintances.indexOf(i)][4] = ((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getmetwhere(); + rows[casualacquaintances.indexOf(i)][5] = ((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getcircumstance(); + rows[casualacquaintances.indexOf(i)][6] = ((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getinfo(); + } + + dispCA = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return false; + } + }; + dispCA.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + dispCA.setAutoCreateColumnsFromModel(true); + + panelDisplayCA.setLayout(new BorderLayout()); + panelDisplayCA.add(new JScrollPane(dispCA),BorderLayout.CENTER); + panelDisplayCA.setPreferredSize(new Dimension(350,350)); + + + } + + public void init_search_contact(){ + + frmSearchContact = new JFrame("Search in contact list"); + //frmSearchContact.setLayout(); + + JPanel searchpanel = new JPanel(); + searchpanel.setAlignmentX(searchpanel.TOP_ALIGNMENT); + + JLabel search = new JLabel("Enter the name to search for"); + search.setAlignmentX(search.CENTER_ALIGNMENT); + JTextArea searchspace = new JTextArea(); + searchspace.setFont(new Font("Serif",Font.BOLD,14)); + searchspace.setLineWrap(true); + searchspace.setWrapStyleWord(true); + JScrollPane searchscrollPane = new JScrollPane(searchspace,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + searchscrollPane.setPreferredSize(new Dimension(350,20)); + searchscrollPane.setAlignmentX(searchscrollPane.CENTER_ALIGNMENT); + + JTextArea resultspace = new JTextArea(); + resultspace.setEditable(false); + //resultspace.(resultspace.CENTER_ALIGNMENT); + resultspace.setFont(new Font("Serif",Font.BOLD,14)); + resultspace.setLineWrap(true); + resultspace.setWrapStyleWord(true); + //????resultspace.setAlignmentX(resultspace.CENTER_ALIGNMENT); + JScrollPane searchresultscrollPane = new JScrollPane(resultspace,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + searchresultscrollPane.setPreferredSize(new Dimension(350,150)); + searchresultscrollPane.setAlignmentX(searchresultscrollPane.CENTER_ALIGNMENT); + + JButton searchbtn = new JButton("Search"); + searchbtn.setAlignmentX(searchbtn.CENTER_ALIGNMENT); + searchbtn.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + String name = searchspace.getText(); + searchspace.setText(""); + boolean flag = false; + for (Contacts i:relatives){ + if (relatives.get(relatives.indexOf(i)).getname().equals(name)){ + resultspace.append("\t Relative \n"); + resultspace.append("Name: "+relatives.get(relatives.indexOf(i)).getname()+"\n"); + resultspace.append("Mobile Number: "+relatives.get(relatives.indexOf(i)).getmobnum()+"\n"); + resultspace.append("Email id: "+relatives.get(relatives.indexOf(i)).getemailid()+"\n"); + resultspace.append("Date of Birth: "+((Relatives)relatives.get(relatives.indexOf(i))).getbirthday()+"\n"); + resultspace.append("Last met on: "+((Relatives)relatives.get(relatives.indexOf(i))).getdate()+"\n"); + resultspace.append("\t-------------------------\n"); + flag = true; + } + } + + for (Contacts i:personalfriends){ + if (personalfriends.get(personalfriends.indexOf(i)).getname().equals(name)){ + resultspace.append("\t Personal friend \n"); + resultspace.append("Name: "+personalfriends.get(personalfriends.indexOf(i)).getname()+"\n"); + resultspace.append("Mobile number: "+personalfriends.get(personalfriends.indexOf(i)).getmobnum()+"\n"); + resultspace.append("Email id: "+personalfriends.get(personalfriends.indexOf(i)).getemailid()+"\n"); + resultspace.append("Meeting Date: "+((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getmetdate()+"\n"); + resultspace.append("Meeting context: "+((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getmeetcontext()+"\n"); + resultspace.append("Notable events: "+((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getevents()+"\n"); + resultspace.append("\t--------------------------\n"); + flag = true; + } + } + + for (Contacts i:professionalfriends){ + if (professionalfriends.get(professionalfriends.indexOf(i)).getname().equals(name)){ + resultspace.append("\t Professional friend \n"); + resultspace.append("Name: "+professionalfriends.get(professionalfriends.indexOf(i)).getname()+"\n"); + resultspace.append("Mobile number: "+professionalfriends.get(professionalfriends.indexOf(i)).getmobnum()+"\n"); + resultspace.append("Email id: "+professionalfriends.get(professionalfriends.indexOf(i)).getemailid()+"\n"); + resultspace.append("Common interests: "+((Professional_friends)professionalfriends.get(professionalfriends.indexOf(i))).getinterests()+"\n"); + resultspace.append("\t---------------------------\n"); + flag = true; + } + } + + for (Contacts i:casualacquaintances){ + if (casualacquaintances.get(casualacquaintances.indexOf(i)).getname().equals(name)){ + resultspace.append("\t Casual acquaintance \n"); + resultspace.append("Name: "+casualacquaintances.get(casualacquaintances.indexOf(i)).getname()+"\n"); + resultspace.append("Mobile number: "+casualacquaintances.get(casualacquaintances.indexOf(i)).getmobnum()+"\n"); + resultspace.append("Email id: "+casualacquaintances.get(casualacquaintances.indexOf(i)).getemailid()+"\n"); + resultspace.append("Met when: "+((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getmetwhen()+"\n"); + resultspace.append("Met where: "+((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getmetwhere()+"\n"); + resultspace.append("Meeting circumstances: "+((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getcircumstance()+"\n"); + resultspace.append("Other information: "+((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getinfo()+"\n"); + resultspace.append("\t---------------------------\n"); + flag = true; + } + } + if (flag == false){ + resultspace.append("\t--------------------\n"); + resultspace.append("\tNO MATCHES FOUND\n"); + resultspace.append("\t--------------------\n"); + } + } + + }); + + searchpanel.setLayout(new BoxLayout(searchpanel,BoxLayout.PAGE_AXIS)); + + searchpanel.add(Box.createVerticalGlue()); + searchpanel.add(search,searchpanel.CENTER_ALIGNMENT); + searchpanel.add(Box.createRigidArea(new Dimension(400,5))); + searchpanel.add(searchscrollPane); + searchpanel.add(Box.createRigidArea(new Dimension(400,5))); + searchpanel.add(Box.createVerticalGlue()); + searchpanel.add(searchbtn,searchpanel.CENTER_ALIGNMENT); + searchpanel.add(Box.createRigidArea(new Dimension(400,5))); + searchpanel.add(Box.createVerticalGlue()); + searchpanel.add(searchresultscrollPane); + searchpanel.add(Box.createRigidArea(new Dimension(400,5))); + searchpanel.add(Box.createVerticalGlue()); + + frmSearchContact.setBackground(Color.GRAY); + frmSearchContact.setFont(new Font("SansSerif", Font.PLAIN, 25)); + //frmSearchContact.setTitle("ADD NEW CONTACT TO THE LIST"); + frmSearchContact.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAddContact.setBounds(100, 100, 200, 150);//?? + frmSearchContact.setSize(new Dimension(400,400)); + frmSearchContact.setLocationRelativeTo(null); + + frmSearchContact.add(searchpanel); + frmSearchContact.setVisible(true); + + } + + /** + * Create the application. + */ + public Contact_list() { + initialize(); + } + + private void init_frame(){ + frmContactList = new JFrame(); + frmContactList.setFont(new Font("SansSerif", Font.BOLD, 35)); + frmContactList.setTitle("CONTACT LIST"); + frmContactList.setForeground(UIManager.getColor("Button.darkShadow")); + frmContactList.setBounds(100, 100, 200, 150); + frmContactList.setResizable(false); + frmContactList.setLocationRelativeTo(null); + frmContactList.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + } + + private void init_first_window(){ + lblNewLabel = new JLabel("Hello!"); + lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); + lblNewLabel.setFont(new Font("SansSerif", Font.BOLD, 30)); + + + pane = new JPanel(); + pane.setLayout(new BoxLayout(pane,BoxLayout.PAGE_AXIS)); + lblNote = new JLabel("Choose: "); + lblNote.setAlignmentX(Component.CENTER_ALIGNMENT); + lblNote.setHorizontalAlignment(SwingConstants.LEFT); + lblNote.setFont(new Font("SansSerif", Font.BOLD, 25)); + String list[] = {"Options","Add contact","Edit Contact","Delete Contact","Display Contacts","Search"}; + maincombobox = new JComboBox(list); + maincombobox.setSelectedIndex(0); + //maincombobox.setBounds(100, 100, 20, 20); + maincombobox.setMaximumSize(new Dimension(150,30)); + //maincombobox.addActionListener(maincomboboxActionListener); + maincombobox.addItemListener(maincomboitemlistener); + + + //pane.add(lblNewLabel); + //pane.add(Box.createVerticalGlue()); + pane.add(Box.createVerticalGlue()); + pane.add(lblNote); + Component rigidArea = Box.createRigidArea(new Dimension(0,50)); + pane.add(rigidArea); + pane.add(maincombobox); + pane.add(rigidArea); + + Container contentpane = frmContactList.getContentPane(); + contentpane.add(lblNewLabel, BorderLayout.PAGE_START); + contentpane.add(pane,BorderLayout.CENTER); + + + } + + /** + * Initialize the contents of the frame. + */ + private void initialize() { + init_frame(); + //frmContactList.getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); + init_first_window(); + + + } + +} diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contacts.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contacts.class new file mode 100644 index 0000000..b005b48 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contacts.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contacts.java b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contacts.java new file mode 100644 index 0000000..9c1bee6 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contacts.java @@ -0,0 +1,39 @@ +import java.io.Serializable; + +//base class for inheritance + +@SuppressWarnings("serial") +public class Contacts implements Serializable{ + protected String name; + protected String mobile_number; + protected String email_id; + + Contacts(){ + name = new String(); + mobile_number = new String(); + email_id = new String(); + + } + + + public void setname(String name){ + this.name = name; + } + public void setmobnum(String mobnum){ + this.mobile_number = mobnum; + } + public void setemailid(String id){ + this.email_id = id; + } + + public String getname(){ + return this.name; + } + public String getmobnum(){ + return this.mobile_number; + } + public String getemailid(){ + return this.email_id; + } + +} diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Personal_friends.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Personal_friends.class new file mode 100644 index 0000000..106385f Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Personal_friends.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Personal_friends.java b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Personal_friends.java new file mode 100644 index 0000000..97b3319 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Personal_friends.java @@ -0,0 +1,108 @@ +import java.io.Serializable; + +//import java.util.*; + +@SuppressWarnings("serial") +public class Personal_friends extends Contacts +{ + private String meetingcontext; + private String date_of_acquaintance; + private String events; + + Personal_friends(){ + + super(); + meetingcontext = new String(); + date_of_acquaintance = new String(); + events = new String(); + } + + + + public void setmetdate(String date){ + this.date_of_acquaintance = date; + } + + public void setmeetcontext(String met){ + + // try{ + if (met.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else { + //try{ + if (meetingcontext != null && meetingcontext.length() >= 0){ + String appended = meetingcontext + met; + if (appended.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else meetingcontext = appended; + }else + this.meetingcontext = met; + } + /*catch (IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + //System.arraycopy(met.toCharArray(),0,meetingcontext,0,met.length()); + //this.meetingcontext = met; + } + /* }catch(IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + + + + public void setevents(String event){ + //try{ + if (event.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else{ + //try{ + if (events != null && events.length() >= 0){ + String eventappend = events + event; + if (eventappend.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else events = eventappend; + }else + this.events = event; + /*}catch(IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + System.exit(0); + }*/ + } + /* }catch(IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + } + + + + public String getmetdate(){ + return this.date_of_acquaintance; + } + + public String getmeetcontext(){ + if (this.meetingcontext == null){ + //System.out.println("Nothing to show! "); + return null; + } + else + return this.meetingcontext;//.toString(); + } + + public String getevents(){ + if (this.events == null){ + //System.out.println("Nothing to show! "); + return null; + } + else + return this.events;//.toString(); + } + +} + diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Professional_friends.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Professional_friends.class new file mode 100644 index 0000000..f2b8fe2 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Professional_friends.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Professional_friends.java b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Professional_friends.java new file mode 100644 index 0000000..e6e6b9b --- /dev/null +++ b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Professional_friends.java @@ -0,0 +1,60 @@ +import java.io.Serializable; + +/** + * Write a description of class Professional_friends here. + * + * @author (your name) + * @version (a version number or a date) + */ +@SuppressWarnings("serial") +public class Professional_friends extends Contacts +{ + + private String common_interests; + + Professional_friends(){ + + super(); + common_interests = new String(); + } + + + public void setinterests(String interests){ + //try{ + if (interests.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else { + // try{ + if (common_interests != null && common_interests.length() > 0){ + String appendedinterests = common_interests + interests; + if (appendedinterests.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else common_interests = appendedinterests; + }else + this.common_interests = interests; + /* } + catch (IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + //System.arraycopy(met.toCharArray(),0,meetingcontext,0,met.length()); + //this.meetingcontext = met; + } + /* }catch(IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + } + + + public String getinterests(){ + if (this.common_interests == null){ + System.out.println("Nothing to show! "); + return null; + } + else + return this.common_interests; + } +} diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Readme.txt b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Readme.txt new file mode 100644 index 0000000..aff5ac3 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Readme.txt @@ -0,0 +1,2 @@ +---> This is a JAVA Swing application for managing one's contact list. +---> The contacts can be categorized and some specific relevant information added for each category. diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Relatives.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Relatives.class new file mode 100644 index 0000000..235d54f Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Relatives.class differ diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Relatives.java b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Relatives.java new file mode 100644 index 0000000..648b59a --- /dev/null +++ b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Relatives.java @@ -0,0 +1,30 @@ +import java.io.Serializable; + +@SuppressWarnings("serial") +public class Relatives extends Contacts { + private String birthday; + private String lastmetdate; + + Relatives(){ + super(); + birthday = null; + lastmetdate = null; + } + + + public void setbirthday(String bday){ + this.birthday = bday; + } + public void setdate(String date){ + this.lastmetdate = date; + } + + + public String getbirthday(){ + return this.birthday; + } + + public String getdate(){ + return this.lastmetdate; + } +} diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/save.ser b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/save.ser new file mode 100644 index 0000000..f696f44 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/save.ser differ diff --git a/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Courses.java b/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Courses.java new file mode 100644 index 0000000..c0f01ca --- /dev/null +++ b/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Courses.java @@ -0,0 +1,73 @@ + + + +import java.util.*; +import java.io.*; + +public class Courses implements Serializable +{ + private String coursename; + private String coursefee; + private String startdate; + private int duration; + + private Faculty coordinator; + //private Faculty[] faculty = new Faculty[5]; + private ArrayList faculty = new ArrayList(); + + private ArrayList participant = new ArrayList(); + //private Participants[] participant = new Participants[5]; + + Courses(){ + coursename = null; + coursefee = null; + startdate = null; + duration = 0; + + coordinator = new Faculty(); + /*for (int i=0;i<5;i++){ + faculty[i] = new Faculty(); + participant[i] = new Participants(); + }*/ + } + + public void setcoursename(String name){ + this.coursename = name; + } + public void setcoursefee(String fee){ + this.coursefee = fee; + } + public void setstartdate(String date){ + this.startdate = date; + } + public void setduration(int duration){ + this.duration = duration; + } + public void setcoordinator(Faculty coord){ + this.coordinator = coord; + } + + public String getcoursename(){ + return this.coursename; + } + public String getcoursefee(){ + return this.coursefee; + } + public String getstartdate(){ + return this.startdate; + } + public int getduration(){ + return this.duration; + } + public Faculty getcoordinator(){ + return this.coordinator; + } + public ArrayList getfaclist(){ + return this.faculty;//.get(i);//this.faculty[i]; + } + public ArrayList getparticipant(){ + return this.participant;//.get(i); + } + +} + diff --git a/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Coursewindow.java b/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Coursewindow.java new file mode 100644 index 0000000..183c14d --- /dev/null +++ b/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Coursewindow.java @@ -0,0 +1,2451 @@ +import java.awt.EventQueue; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.InputMismatchException; +import java.util.ListIterator; +import java.util.Locale; +import java.util.Scanner; + +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.UIManager; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; + + + + +public class Coursewindow { + + private static ArrayList courses = new ArrayList(); + private static ArrayList participants = new ArrayList(); + private static ArrayList faculty = new ArrayList(); + + + private JFrame firstframe; + + + private JRadioButton btncoursecreate;// = new JRadioButton("Create a new course",false); + private JRadioButton btnstudentcreate;// = new JRadioButton("Create a new participant",false); + private JRadioButton btnfacultycreate;// = new JRadioButton("Create a new faculty",false); + private JRadioButton btnedit;// = new JRadioButton("Edit information",false); + private JRadioButton btndelete;// = new JRadioButton("Delete information",false); + private JRadioButton btndisplay;// = new JRadioButton("Display details",false); + + private JFrame createcourseframe; + private JPanel coursepanel; + private JTextArea tcoursename; + private JTextArea tcoursefee; + private JTextArea tcourseduration; + private JTextArea tcoursedate; + private JButton okbutton; + + private JFrame createstudentframe; + private JPanel studentpanel; + private JRadioButton btncreatenewstudent; + private JRadioButton btnregisterstudent; + + private JFrame newstudentframe; + private JPanel newstudentpanel; + private JTextArea tstudname; + private JTextArea tstudaddress; + private JTextArea tstudemailid; + private JTextArea tstudorgname; + private JTextArea tstudmobnum; + private JButton createbutton; + + private JFrame registerstudentframe; + private JPanel registerstudentpanel; + private JComboBox studentnames; + private JComboBox courselist; + private JButton regbutton; + + private JFrame createfacframe; + private JPanel facpanel; + private JRadioButton btncreatefaculty; + private JRadioButton btnaddfac; + private JRadioButton btnaddcoord; + + private JFrame newfacframe; + private JPanel newfacpanel; + private JTextArea tfacname; + private JTextArea tfacaddress; + private JTextArea tfacemailid; + private JTextArea tfacdept; + private JTextArea tfacmobnum; + private JButton createfacbutton; + + private JFrame factocourseframe; + private JPanel factocoursepanel; + private JComboBox cbfacnames; + private JComboBox faccourselist; + private JButton addbutton; + + private JFrame coordtocourseframe; + private JPanel coordtocoursepanel; + private JComboBox coordfacnames; + private JComboBox coordcourselist; + private JButton addcoordbutton; + + private JFrame frmDisplaydetails; + private JTabbedPane tabDisplaydetails; + private JPanel panelDisplaycoursedetails; + private JPanel panelDisplayparti; + private JPanel panelDisplayfaculty; + + private JFrame frmEditdetails; + private JTabbedPane tabEditdetails; + private JPanel panelEditcoursedetails; + private JPanel panelEditparti; + private JPanel panelEditfaculty; + + private JComboBox cbchoosecourse; + private JComboBox cbchoosestudent; + private JComboBox cbchoosefaculty; + + private JFrame frmDeletedetails; + + private JTable editcoursedetails; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + Coursewindow window = new Coursewindow(); + window.firstframe.setVisible(true); + readfromfile(); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + public static void readfromfile(){ + File file = new File("save.ser"); + try{ + if (!file.exists()){//if file did not exist create new file + file.createNewFile(); + } + else{//else read from already existing file + try{ + FileInputStream fout = new FileInputStream(file); + ObjectInputStream oos = new ObjectInputStream(fout); + try{ + //FileInputStream fout = new FileInputStream(file); + //ObjectInputStream oos = new ObjectInputStream(fout); + courses = (ArrayList)oos.readObject(); + participants = (ArrayList)oos.readObject(); + faculty = (ArrayList)oos.readObject(); + // System.out.println("Finished Reading! "); + } + catch(Exception e){ + JOptionPane.showMessageDialog(null,"File cannot be opened","IOException",JOptionPane.ERROR_MESSAGE); + //e.printStackTrace(); + }finally{ + try{ + if (oos != null){ + oos.close(); + fout.close(); + } + }catch(IOException e){ + JOptionPane.showMessageDialog(null,"OutputStream cannot be closed","IOException",JOptionPane.ERROR_MESSAGE); + //e.printStackTrace(); + } + } + }catch(FileNotFoundException e){ + JOptionPane.showMessageDialog(null,"File was not found","FileNotFoundException",JOptionPane.ERROR_MESSAGE); + + //e.printStackTrace(); + }catch(IOException e){ + JOptionPane.showMessageDialog(null,"InputStream error!","IOException",JOptionPane.ERROR_MESSAGE); + //e.printStackTrace(); + } + } + } + catch(IOException e){ + JOptionPane.showMessageDialog(null,"File cannot be opened","IOException",JOptionPane.ERROR_MESSAGE); + + //e.printStackTrace(); + } + + } + + public void writeTofile(){ + FileOutputStream fout = null; + ObjectOutputStream oos = null; + try{ + fout = new FileOutputStream("save.ser"); + oos = new ObjectOutputStream(fout); + oos.writeObject(courses); + oos.writeObject(participants); + oos.writeObject(faculty); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if (oos != null){ + oos.close(); + fout.close(); + } + }catch(Exception e){ + e.printStackTrace(); + } + } + //written to file + + } + + /** + * Create the application. + */ + public Coursewindow() { + initialize(); + } + + public void init_frame(){ + firstframe = new JFrame(); + firstframe.setFont(new Font("SansSerif", Font.BOLD, 35)); + firstframe.setTitle("COURSE PAGE"); + firstframe.setForeground(UIManager.getColor("Button.darkShadow")); + //firstframe.setForeground(Color.YELLOW); + //firstframe.setBounds(100, 100, 200, 150); + firstframe.setSize(new Dimension(400,400)); + firstframe.setResizable(false); + firstframe.setLocationRelativeTo(null); + firstframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + } + + + public void init_options(){ + JPanel firstpanel = new JPanel(); + //firstpanel.setBackground(Color.BLUE); + + JRadioButton btnExtra = new JRadioButton("Choose one of the following",true); + btncoursecreate = new JRadioButton("Create a new course",false); + btnstudentcreate = new JRadioButton("Create a new participant",false); + btnfacultycreate = new JRadioButton("Create a new faculty",false); + btnedit = new JRadioButton("Edit information",false); + btndelete = new JRadioButton("Delete information",false); + btndisplay = new JRadioButton("Display details",false); + //JRadioButton btnexit = new JRadioButton("Delete a casual acquaintance's contact",false); + + + btncoursecreate.addActionListener(secondwindow); + btnstudentcreate.addActionListener(secondwindow); + btnfacultycreate.addActionListener(secondwindow); + btnedit.addActionListener(secondwindow); + btndelete.addActionListener(secondwindow); + btndisplay.addActionListener(secondwindow); + + ButtonGroup group = new ButtonGroup(); + group.add(btnExtra); + group.add(btncoursecreate); + group.add(btnstudentcreate); + group.add(btnfacultycreate); + group.add(btnedit); + group.add(btndelete); + group.add(btndisplay); + + + firstpanel.setLayout(new BoxLayout(firstpanel,BoxLayout.PAGE_AXIS)); + firstpanel.add(Box.createRigidArea(new Dimension(0,10))); + firstpanel.add(btnExtra); + firstpanel.add(Box.createVerticalGlue()); + firstpanel.add(btncoursecreate); + firstpanel.add(Box.createVerticalGlue()); + firstpanel.add(btnstudentcreate); + firstpanel.add(Box.createVerticalGlue()); + firstpanel.add(btnfacultycreate); + firstpanel.add(Box.createVerticalGlue()); + firstpanel.add(btnedit); + firstpanel.add(Box.createVerticalGlue()); + firstpanel.add(btndelete); + firstpanel.add(Box.createVerticalGlue()); + firstpanel.add(btndisplay); + firstpanel.add(Box.createVerticalGlue()); + + firstframe.add(firstpanel); + firstframe.setVisible(true); + } + + ActionListener secondwindow = new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if (e.getSource().equals(btncoursecreate)){ + create_course(); + //System.out.println("here"); + } + else if (e.getSource().equals(btnstudentcreate)){ + create_student(); + } + else if (e.getSource().equals(btnfacultycreate)){ + create_faculty(); + } + else if (e.getSource().equals(btnedit)){ + edit_window(); + } + else if (e.getSource().equals(btndelete)){ + delete_window(); + } + else if (e.getSource().equals(btndisplay)){ + display(); + } + } + + }; + + public void create_course(){ + + //try{ + createcourseframe = new JFrame(); + + createcourseframe.setBackground(Color.GRAY); + createcourseframe.setFont(new Font("SansSerif", Font.PLAIN, 25)); + createcourseframe.setTitle("ADD NEW COURSE TO THE LIST"); + createcourseframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAddContact.setBounds(100, 100, 200, 150);//?? + createcourseframe.setSize(new Dimension(400,400)); + createcourseframe.setLocationRelativeTo(null); + + coursepanel = new JPanel(); + coursepanel.setLayout(new BoxLayout(coursepanel,BoxLayout.PAGE_AXIS)); + coursepanel.setAlignmentX(coursepanel.TOP_ALIGNMENT); + + JLabel coursename = new JLabel("COURSE NAME:"); + coursename.setAlignmentX(coursename.CENTER_ALIGNMENT); + JLabel coursefee = new JLabel("COURSE FEE:"); + coursefee.setAlignmentX(coursefee.CENTER_ALIGNMENT); + JLabel courseduration = new JLabel("COURSE DURATION:"); + courseduration.setAlignmentX(courseduration.CENTER_ALIGNMENT); + JLabel coursestart = new JLabel("COURSE START DATE:"); + coursestart.setAlignmentX(coursestart.CENTER_ALIGNMENT); + //try{ + tcoursename = new JTextArea(); + tcoursename.setFont(new Font("Serif",Font.BOLD,14)); + tcoursename.setLineWrap(true); + tcoursename.setWrapStyleWord(true); + tcoursename.setAlignmentX(tcoursename.CENTER_ALIGNMENT); + JScrollPane tcoursenamescrollPane = new JScrollPane(tcoursename,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + tcoursenamescrollPane.setPreferredSize(new Dimension(350,20)); + + tcoursefee = new JTextArea(); + tcoursefee.setFont(new Font("Serif",Font.BOLD,14)); + tcoursefee.setLineWrap(true); + tcoursefee.setWrapStyleWord(true); + tcoursefee.setAlignmentX(tcoursefee.CENTER_ALIGNMENT); + JScrollPane tcoursefeescrollPane = new JScrollPane(tcoursefee,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + tcoursefeescrollPane.setPreferredSize(new Dimension(350,20)); + + tcourseduration = new JTextArea(); + tcourseduration.setFont(new Font("Serif",Font.BOLD,14)); + tcourseduration.setLineWrap(true); + tcourseduration.setWrapStyleWord(true); + tcourseduration.setAlignmentX(tcourseduration.CENTER_ALIGNMENT); + JScrollPane tcoursedurationscrollPane = new JScrollPane(tcourseduration,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + tcoursedurationscrollPane.setPreferredSize(new Dimension(350,20)); + + tcoursedate = new JTextArea(); + tcoursedate.setFont(new Font("Serif",Font.BOLD,14)); + tcoursedate.setLineWrap(true); + tcoursedate.setWrapStyleWord(true); + tcoursedate.setAlignmentX(tcoursedate.CENTER_ALIGNMENT); + JScrollPane tcoursedatescrollPane = new JScrollPane(tcoursedate,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + tcoursedatescrollPane.setPreferredSize(new Dimension(350,20)); + + + okbutton = new JButton("CREATE COURSE"); + okbutton.setAlignmentX(okbutton.CENTER_ALIGNMENT); + okbutton.addActionListener(new ActionListener(){ + + //@Override + private boolean intflag = false, dateflag = false; + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + try{ + try{ + if (Integer.parseInt(tcourseduration.getText())>14){ + + JOptionPane.showMessageDialog(null,"Duration in days should be less than two weeks.","NOTE!",JOptionPane.INFORMATION_MESSAGE); + intflag = true; + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null,"Enter the duration in number of days.","ERROR!",JOptionPane.ERROR_MESSAGE); + + } + try{ + + Date date = new Date(); + //while (true){ + try { + //Scanner tempscan = new Scanner(System.in); + //String tempdate = tempscan.nextLine(); + //tempscan.close(); + date = new SimpleDateFormat("yyyy/MM/dd",Locale.ENGLISH).parse(tcoursedate.getText());//tempdate); + //newcourse.setstartdate(tempdate); + } catch (Exception e) { + JOptionPane.showMessageDialog(null,"Date not in correct format.","ERROR!",JOptionPane.ERROR_MESSAGE); + + } + + + //mycal.setTime(date); + LocalDate localDate = LocalDate.now(); + LocalDate compare = localDate.minusYears(5); + DateTimeFormatter formatter = DateTimeFormatter.BASIC_ISO_DATE; + Date newdate = new Date(); + try { + newdate = new SimpleDateFormat("yyyyMMdd",Locale.ENGLISH).parse(formatter.format(compare)); + } catch (ParseException e) { + // TODO Auto-generated catch block + + }//one year before now + + + if ( newdate.before(date)){//more than a year old course--->don't display + JOptionPane.showMessageDialog(null,"Course is more than 5 years old.","NOTE!",JOptionPane.INFORMATION_MESSAGE); + dateflag = true; + //System.out.println("This course is more than a year old.However it is being added to the database. But it won't be displayed for current courses."); + } + + + + + + }catch(Exception e){ + + dateflag = true; + } + if (intflag == false){ //&& dateflag == false){ + createcourse(); + writeTofile(); + JOptionPane.showMessageDialog(null,"Course added.","NOTE!",JOptionPane.INFORMATION_MESSAGE); + + } + + + }catch(Exception e){} + + } + + }); + + coursepanel.add(Box.createRigidArea(new Dimension(0,10))); + coursepanel.add(coursename);//,coursepanel.setAlignmentX(coursepanel.CENTER_ALIGNMENT);); + coursepanel.add(Box.createRigidArea(new Dimension(0,10))); + + //coursepanel.add(Box.createVerticalGlue()); + coursepanel.add(tcoursename); + coursepanel.add(Box.createRigidArea(new Dimension(0,10))); + + //coursepanel.add(Box.createVerticalGlue()); + coursepanel.add(coursefee); + coursepanel.add(Box.createRigidArea(new Dimension(0,10))); + + //coursepanel.add(Box.createVerticalGlue()); + coursepanel.add(tcoursefee); + coursepanel.add(Box.createRigidArea(new Dimension(0,10))); + + //coursepanel.add(Box.createVerticalGlue()); + coursepanel.add(courseduration); + coursepanel.add(Box.createRigidArea(new Dimension(0,10))); + //coursepanel.add(Box.createVerticalGlue()); + coursepanel.add(tcourseduration); + coursepanel.add(Box.createRigidArea(new Dimension(0,10))); + //coursepanel.add(Box.createVerticalGlue()); + coursepanel.add(coursestart); + coursepanel.add(Box.createRigidArea(new Dimension(0,10))); + //coursepanel.add(Box.createVerticalGlue()); + coursepanel.add(tcoursedate); + coursepanel.add(Box.createRigidArea(new Dimension(0,10))); + //coursepanel.add(Box.createVerticalGlue()); + coursepanel.add(okbutton); + coursepanel.add(Box.createRigidArea(new Dimension(0,10))); + //coursepanel.add(Box.createVerticalGlue()); + /*}catch(Exception e){ + System.out.println("Frame error"); + }*/ + createcourseframe.add(coursepanel); + createcourseframe.setVisible(true); + + } + + public void createcourse(){ + Courses newcourse = new Courses(); + newcourse.setcoursename(tcoursename.getText()); + newcourse.setcoursefee(tcoursefee.getText()); + newcourse.setduration(Integer.parseInt(tcourseduration.getText())); + newcourse.setstartdate(tcoursedate.getText()); + + courses.add(newcourse); + } + + public void create_student(){ + createstudentframe = new JFrame(); + + createstudentframe.setBackground(Color.GRAY); + createstudentframe.setFont(new Font("SansSerif", Font.PLAIN, 25)); + createstudentframe.setTitle("ADD NEW PARTICIPANT TO THE LIST"); + createstudentframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAddContact.setBounds(100, 100, 200, 150);//?? + createstudentframe.setSize(new Dimension(400,150)); + createstudentframe.setLocationRelativeTo(null); + + studentpanel = new JPanel(); + studentpanel.setLayout(new BoxLayout(studentpanel,BoxLayout.PAGE_AXIS)); + studentpanel.setAlignmentX(studentpanel.TOP_ALIGNMENT); + + btncreatenewstudent = new JRadioButton("Create a new participant profile"); + btnregisterstudent = new JRadioButton("Register participant to a course"); + + btncreatenewstudent.addActionListener(partilistener); + btnregisterstudent.addActionListener(partilistener); + + ButtonGroup group = new ButtonGroup(); + group.add(btncreatenewstudent); + group.add(btnregisterstudent); + + studentpanel.add(Box.createRigidArea(new Dimension(0,20))); + studentpanel.add(btncreatenewstudent); + studentpanel.add(Box.createRigidArea(new Dimension(0,20))); + studentpanel.add(btnregisterstudent); + studentpanel.add(Box.createRigidArea(new Dimension(0,20))); + + createstudentframe.add(studentpanel); + //createstudentframe.pack(); + createstudentframe.setVisible(true); + + } + + ActionListener partilistener = new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if (e.getSource().equals(btncreatenewstudent)){ + create_student_profile(); + } + else if (e.getSource().equals(btnregisterstudent)){ + register_student(); + } + } + + }; + + public void create_student_profile(){ + newstudentframe = new JFrame(); + + newstudentframe.setBackground(Color.GRAY); + newstudentframe.setFont(new Font("SansSerif", Font.PLAIN, 25)); + newstudentframe.setTitle("PARTICIPANT'S DETAILS"); + newstudentframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAddContact.setBounds(100, 100, 200, 150);//?? + newstudentframe.setSize(new Dimension(400,400)); + newstudentframe.setLocationRelativeTo(null); + + newstudentpanel = new JPanel(); + newstudentpanel.setLayout(new BoxLayout(newstudentpanel,BoxLayout.PAGE_AXIS)); + newstudentpanel.setAlignmentX(newstudentpanel.TOP_ALIGNMENT); + + JLabel studname = new JLabel("NAME:"); + studname.setAlignmentX(studname.CENTER_ALIGNMENT); + JLabel studaddress = new JLabel("ADDRESS:"); + studaddress.setAlignmentX(studaddress.CENTER_ALIGNMENT); + JLabel studmobnum = new JLabel("MOBILE NUMBER:"); + studmobnum.setAlignmentX(studmobnum.CENTER_ALIGNMENT); + JLabel studemailid = new JLabel("EMAIL ID:"); + studemailid.setAlignmentX(studemailid.CENTER_ALIGNMENT); + JLabel studorgname = new JLabel("ORGANISATION'S NAME:"); + studorgname.setAlignmentX(studorgname.CENTER_ALIGNMENT); + + tstudname = new JTextArea(); + tstudname.setFont(new Font("Serif",Font.BOLD,14)); + tstudname.setLineWrap(true); + tstudname.setWrapStyleWord(true); + tstudname.setAlignmentX(tstudname.CENTER_ALIGNMENT); + JScrollPane tstudnamescrollPane = new JScrollPane(tstudname,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + tstudnamescrollPane.setPreferredSize(new Dimension(350,20)); + + tstudaddress = new JTextArea(); + tstudaddress.setFont(new Font("Serif",Font.BOLD,14)); + tstudaddress.setLineWrap(true); + tstudaddress.setWrapStyleWord(true); + tstudaddress.setAlignmentX(tstudaddress.CENTER_ALIGNMENT); + JScrollPane tstudaddressscrollPane = new JScrollPane(tstudaddress,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + tstudaddressscrollPane.setPreferredSize(new Dimension(350,20)); + + tstudemailid = new JTextArea(); + tstudemailid.setFont(new Font("Serif",Font.BOLD,14)); + tstudemailid.setLineWrap(true); + tstudemailid.setWrapStyleWord(true); + tstudemailid.setAlignmentX(tstudemailid.CENTER_ALIGNMENT); + JScrollPane tstudemailidscrollPane = new JScrollPane(tstudemailid,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + tstudemailidscrollPane.setPreferredSize(new Dimension(350,20)); + + tstudmobnum = new JTextArea(); + tstudmobnum.setFont(new Font("Serif",Font.BOLD,14)); + tstudmobnum.setLineWrap(true); + tstudmobnum.setWrapStyleWord(true); + tstudmobnum.setAlignmentX(tstudmobnum.CENTER_ALIGNMENT); + JScrollPane tstudmobnumscrollPane = new JScrollPane(tstudmobnum,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + tstudmobnumscrollPane.setPreferredSize(new Dimension(350,20)); + + tstudorgname = new JTextArea(); + tstudorgname.setFont(new Font("Serif",Font.BOLD,14)); + tstudorgname.setLineWrap(true); + tstudorgname.setWrapStyleWord(true); + tstudorgname.setAlignmentX(tstudorgname.CENTER_ALIGNMENT); + JScrollPane tstudorgnamescrollPane = new JScrollPane(tstudorgname,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + tstudorgnamescrollPane.setPreferredSize(new Dimension(350,20)); + + createbutton = new JButton("CREATE PARTICIPANT"); + createbutton.setAlignmentX(createbutton.CENTER_ALIGNMENT); + createbutton.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + try{ + + Participants newparticipant = new Participants(); + newparticipant.setname(tstudname.getText()); + newparticipant.setaddress(tstudaddress.getText()); + newparticipant.setmobnum(tstudmobnum.getText()); + newparticipant.setorgname(tstudorgname.getText()); + newparticipant.setemailid(tstudemailid.getText()); + + participants.add(newparticipant); + writeTofile(); + JOptionPane.showMessageDialog(null, "Registered!","SUCCESS",JOptionPane.INFORMATION_MESSAGE); + + }catch(Exception e){} + } + + }); + + newstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + newstudentpanel.add(studname);//,newstudentpanel.setAlignmentX(newstudentpanel.CENTER_ALIGNMENT);); + newstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + + //coursepanel.add(Box.createVerticalGlue()); + newstudentpanel.add(tstudname); + newstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + + //coursepanel.add(Box.createVerticalGlue()); + newstudentpanel.add(studaddress); + newstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + + //coursepanel.add(Box.createVerticalGlue()); + newstudentpanel.add(tstudaddress); + newstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + + //coursepanel.add(Box.createVerticalGlue()); + newstudentpanel.add(studmobnum); + newstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + //coursepanel.add(Box.createVerticalGlue()); + newstudentpanel.add(tstudmobnum); + newstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + //coursepanel.add(Box.createVerticalGlue()); + newstudentpanel.add(studemailid); + newstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + //coursepanel.add(Box.createVerticalGlue()); + newstudentpanel.add(tstudemailid); + newstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + newstudentpanel.add(studorgname); + newstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + //coursepanel.add(Box.createVerticalGlue()); + newstudentpanel.add(tstudorgname); + newstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + + + //coursepanel.add(Box.createVerticalGlue()); + newstudentpanel.add(createbutton); + newstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + //coursepanel.add(Box.createVerticalGlue()); + /*}catch(Exception e){ + System.out.println("Frame error"); + }*/ + newstudentframe.add(newstudentpanel); + newstudentframe.setVisible(true); + + + } + + public void register_student(){ + registerstudentframe = new JFrame(); + + registerstudentframe.setBackground(Color.GRAY); + registerstudentframe.setFont(new Font("SansSerif", Font.PLAIN, 25)); + registerstudentframe.setTitle("REGISTER PARTICIPANT FOR COURSE"); + registerstudentframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAddContact.setBounds(100, 100, 200, 150);//?? + registerstudentframe.setSize(new Dimension(400,400)); + registerstudentframe.setLocationRelativeTo(null); + + registerstudentpanel = new JPanel(); + registerstudentpanel.setLayout(new BoxLayout(registerstudentpanel,BoxLayout.PAGE_AXIS)); + registerstudentpanel.setAlignmentX(registerstudentpanel.TOP_ALIGNMENT); + + JLabel selectcourse = new JLabel("CHOOSE A COURSE "); + selectcourse.setAlignmentX(selectcourse.CENTER_ALIGNMENT); + JLabel selectstud = new JLabel("CHOOSE A STUDENT"); + selectstud.setAlignmentX(selectstud.CENTER_ALIGNMENT); + + ArrayList studnames = new ArrayList(); + ListIterator parti = participants.listIterator(); + while (parti.hasNext()){ + studnames.add(parti.next().getname()); + } + + Collections.sort(studnames); + String[] temp = new String[studnames.size()]; + temp = studnames.toArray(temp); + + studentnames = new JComboBox(temp); + studentnames.setPreferredSize(new Dimension(200,10)); + studentnames.setAlignmentX(studentnames.CENTER_ALIGNMENT); + + + + ArrayList coursenames = new ArrayList(); + ListIterator cit = courses.listIterator(); + while (cit.hasNext()){ + coursenames.add(cit.next().getcoursename()); + } + + Collections.sort(coursenames); + String[] coursetemp = new String[coursenames.size()]; + coursetemp = coursenames.toArray(coursetemp); + + courselist = new JComboBox(coursetemp); + courselist.setPreferredSize(new Dimension(200,10)); + courselist.setAlignmentX(courselist.CENTER_ALIGNMENT); + + regbutton = new JButton("REGISTER"); + regbutton.setAlignmentX(regbutton.CENTER_ALIGNMENT); + regbutton.addActionListener(regparti); + + registerstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + registerstudentpanel.add(selectstud); + registerstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + registerstudentpanel.add(studentnames); + registerstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + registerstudentpanel.add(selectcourse); + registerstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + registerstudentpanel.add(courselist); + registerstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + registerstudentpanel.add(regbutton); + registerstudentpanel.add(Box.createRigidArea(new Dimension(0,10))); + + registerstudentframe.add(registerstudentpanel); + //registerstudentframe.pack(); + registerstudentframe.setVisible(true); + } + + ActionListener regparti = new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + String studname = (String)studentnames.getSelectedItem(); + String coursename = (String)courselist.getSelectedItem(); + + ListIterator courseit = courses.listIterator(); + Courses tempcourse = new Courses(); + while (courseit.hasNext()){ + Courses nextobj = courseit.next(); + if (nextobj.getcoursename().equals(coursename)){ + if (nextobj.getparticipant().size() == 5){ + JOptionPane.showMessageDialog(null,"5 participants registered already.","REGISTRATION FAILURE",JOptionPane.INFORMATION_MESSAGE); + break; + }else{ + ListIterator parti = participants.listIterator(); + while (parti.hasNext()){ + Participants nextparti = parti.next(); + if (nextparti.getname().equals(studname)){ + nextobj.getparticipant().add(nextparti); + writeTofile(); + JOptionPane.showMessageDialog(null,"Done!.","REGISTRATION SUCCESSFUL",JOptionPane.INFORMATION_MESSAGE); + break; + } + } + } + break; + } + } + + } + + }; + + public void create_faculty(){ + + + createfacframe = new JFrame(); + + createfacframe.setBackground(Color.GRAY); + createfacframe.setFont(new Font("SansSerif", Font.PLAIN, 25)); + createfacframe.setTitle("ADD NEW FACULTY TO THE LIST"); + createfacframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAddContact.setBounds(100, 100, 200, 150);//?? + createfacframe.setSize(new Dimension(400,200)); + createfacframe.setLocationRelativeTo(null); + + facpanel = new JPanel(); + facpanel.setLayout(new BoxLayout(facpanel,BoxLayout.PAGE_AXIS)); + facpanel.setAlignmentX(facpanel.TOP_ALIGNMENT); + + btncreatefaculty = new JRadioButton("Create a new faculty profile"); + btnaddfac = new JRadioButton("Add faculty to a course"); + btnaddcoord = new JRadioButton("Set coordinator for a course"); + + btncreatefaculty.addActionListener(faclistener); + btnaddfac.addActionListener(faclistener); + btnaddcoord.addActionListener(faclistener); + + ButtonGroup group = new ButtonGroup(); + group.add(btncreatefaculty); + group.add(btnaddfac); + group.add(btnaddcoord); + + facpanel.add(Box.createRigidArea(new Dimension(0,20))); + facpanel.add(btncreatefaculty); + facpanel.add(Box.createRigidArea(new Dimension(0,20))); + facpanel.add(btnaddfac); + facpanel.add(Box.createRigidArea(new Dimension(0,20))); + facpanel.add(btnaddcoord); + facpanel.add(Box.createRigidArea(new Dimension(0,20))); + + createfacframe.add(facpanel); + //createstudentframe.pack(); + createfacframe.setVisible(true); + + + } + + ActionListener faclistener = new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if (e.getSource().equals(btncreatefaculty)){ + add_faculty_profile(); + } + else if (e.getSource().equals(btnaddfac)){ + add_faculty_to_course(); + } + else if (e.getSource().equals(btnaddcoord)){ + add_course_coordinator(); + } + } + + }; + + public void add_faculty_profile(){ + + newfacframe = new JFrame(); + + newfacframe.setBackground(Color.GRAY); + newfacframe.setFont(new Font("SansSerif", Font.PLAIN, 25)); + newfacframe.setTitle("FACULTY'S DETAILS"); + newfacframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAddContact.setBounds(100, 100, 200, 150);//?? + newfacframe.setSize(new Dimension(400,400)); + newfacframe.setLocationRelativeTo(null); + + newfacpanel = new JPanel(); + newfacpanel.setLayout(new BoxLayout(newfacpanel,BoxLayout.PAGE_AXIS)); + newfacpanel.setAlignmentX(newfacpanel.TOP_ALIGNMENT); + + JLabel facname = new JLabel("NAME:"); + facname.setAlignmentX(facname.CENTER_ALIGNMENT); + JLabel facaddress = new JLabel("ADDRESS:"); + facaddress.setAlignmentX(facaddress.CENTER_ALIGNMENT); + JLabel facmobnum = new JLabel("MOBILE NUMBER:"); + facmobnum.setAlignmentX(facmobnum.CENTER_ALIGNMENT); + JLabel facemailid = new JLabel("EMAIL ID:"); + facemailid.setAlignmentX(facemailid.CENTER_ALIGNMENT); + JLabel facdept = new JLabel("DEPARTMENT:"); + facdept.setAlignmentX(facdept.CENTER_ALIGNMENT); + + tfacname = new JTextArea(); + tfacname.setFont(new Font("Serif",Font.BOLD,14)); + tfacname.setLineWrap(true); + tfacname.setWrapStyleWord(true); + tfacname.setAlignmentX(tfacname.CENTER_ALIGNMENT); + JScrollPane tfacnamescrollPane = new JScrollPane(tfacname,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + tfacnamescrollPane.setPreferredSize(new Dimension(350,20)); + + tfacaddress = new JTextArea(); + tfacaddress.setFont(new Font("Serif",Font.BOLD,14)); + tfacaddress.setLineWrap(true); + tfacaddress.setWrapStyleWord(true); + tfacaddress.setAlignmentX(tfacaddress.CENTER_ALIGNMENT); + JScrollPane tfacaddressscrollPane = new JScrollPane(tfacaddress,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + tfacaddressscrollPane.setPreferredSize(new Dimension(350,20)); + + tfacemailid = new JTextArea(); + tfacemailid.setFont(new Font("Serif",Font.BOLD,14)); + tfacemailid.setLineWrap(true); + tfacemailid.setWrapStyleWord(true); + tfacemailid.setAlignmentX(tfacemailid.CENTER_ALIGNMENT); + JScrollPane tfacemailidscrollPane = new JScrollPane(tfacemailid,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + tfacemailidscrollPane.setPreferredSize(new Dimension(350,20)); + + tfacmobnum = new JTextArea(); + tfacmobnum.setFont(new Font("Serif",Font.BOLD,14)); + tfacmobnum.setLineWrap(true); + tfacmobnum.setWrapStyleWord(true); + tfacmobnum.setAlignmentX(tfacmobnum.CENTER_ALIGNMENT); + JScrollPane tfacmobnumscrollPane = new JScrollPane(tfacmobnum,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + tfacmobnumscrollPane.setPreferredSize(new Dimension(350,20)); + + tfacdept = new JTextArea(); + tfacdept.setFont(new Font("Serif",Font.BOLD,14)); + tfacdept.setLineWrap(true); + tfacdept.setWrapStyleWord(true); + tfacdept.setAlignmentX(tfacdept.CENTER_ALIGNMENT); + JScrollPane tfacdeptscrollPane = new JScrollPane(tfacdept,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + tfacdeptscrollPane.setPreferredSize(new Dimension(350,20)); + + createfacbutton = new JButton("CREATE PROFILE"); + createfacbutton.setAlignmentX(createfacbutton.CENTER_ALIGNMENT); + createfacbutton.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + try{ + Faculty newfaculty = new Faculty(); + newfaculty.setname(tfacname.getText()); + newfaculty.setdepartment(tfacdept.getText()); + newfaculty.setaddress(tfacaddress.getText()); + newfaculty.setmobnum(tfacmobnum.getText()); + newfaculty.setemailid(tfacemailid.getText()); + + faculty.add(newfaculty); + + writeTofile(); + JOptionPane.showMessageDialog(null,"Done!","SUCCESS MESSAGE",JOptionPane.INFORMATION_MESSAGE); + + }catch(Exception e){} + } + + }); + + newfacpanel.add(Box.createRigidArea(new Dimension(0,10))); + newfacpanel.add(facname);//,newstudentpanel.setAlignmentX(newstudentpanel.CENTER_ALIGNMENT);); + newfacpanel.add(Box.createRigidArea(new Dimension(0,10))); + + //coursepanel.add(Box.createVerticalGlue()); + newfacpanel.add(tfacname); + newfacpanel.add(Box.createRigidArea(new Dimension(0,10))); + newfacpanel.add(facdept); + newfacpanel.add(Box.createRigidArea(new Dimension(0,10))); + //coursepanel.add(Box.createVerticalGlue()); + newfacpanel.add(tfacdept); + newfacpanel.add(Box.createRigidArea(new Dimension(0,10))); + + //coursepanel.add(Box.createVerticalGlue()); + newfacpanel.add(facaddress); + newfacpanel.add(Box.createRigidArea(new Dimension(0,10))); + + //coursepanel.add(Box.createVerticalGlue()); + newfacpanel.add(tfacaddress); + newfacpanel.add(Box.createRigidArea(new Dimension(0,10))); + + //coursepanel.add(Box.createVerticalGlue()); + newfacpanel.add(facmobnum); + newfacpanel.add(Box.createRigidArea(new Dimension(0,10))); + //coursepanel.add(Box.createVerticalGlue()); + newfacpanel.add(tfacmobnum); + newfacpanel.add(Box.createRigidArea(new Dimension(0,10))); + //coursepanel.add(Box.createVerticalGlue()); + newfacpanel.add(facemailid); + newfacpanel.add(Box.createRigidArea(new Dimension(0,10))); + //coursepanel.add(Box.createVerticalGlue()); + newfacpanel.add(tfacemailid); + newfacpanel.add(Box.createRigidArea(new Dimension(0,10))); + + + //coursepanel.add(Box.createVerticalGlue()); + newfacpanel.add(createfacbutton); + newfacpanel.add(Box.createRigidArea(new Dimension(0,10))); + //coursepanel.add(Box.createVerticalGlue()); + /*}catch(Exception e){ + System.out.println("Frame error"); + }*/ + newfacframe.add(newfacpanel); + newfacframe.setVisible(true); + + + + } + public void add_faculty_to_course(){ + /*private JFrame factocourseframe; + private JPanel factocoursepanel; + private JComboBox cbfacnames; + private JComboBox faccourselist; + private JButton addbutton;*/ + factocourseframe = new JFrame(); + + factocourseframe.setBackground(Color.GRAY); + factocourseframe.setFont(new Font("SansSerif", Font.PLAIN, 25)); + factocourseframe.setTitle("SET FACULTY FOR COURSE"); + factocourseframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAddContact.setBounds(100, 100, 200, 150);//?? + factocourseframe.setSize(new Dimension(400,400)); + factocourseframe.setLocationRelativeTo(null); + + factocoursepanel = new JPanel(); + factocoursepanel.setLayout(new BoxLayout(factocoursepanel,BoxLayout.PAGE_AXIS)); + factocoursepanel.setAlignmentX(factocoursepanel.TOP_ALIGNMENT); + + JLabel selectcourse = new JLabel("CHOOSE A COURSE "); + selectcourse.setAlignmentX(selectcourse.CENTER_ALIGNMENT); + JLabel selectfac = new JLabel("CHOOSE A FACULTY"); + selectfac.setAlignmentX(selectfac.CENTER_ALIGNMENT); + + ArrayList facnames = new ArrayList(); + ListIterator facit = faculty.listIterator(); + while (facit.hasNext()){ + facnames.add(facit.next().getname()); + } + + Collections.sort(facnames); + String[] temp = new String[facnames.size()]; + temp = facnames.toArray(temp); + + cbfacnames = new JComboBox(temp); + cbfacnames.setPreferredSize(new Dimension(200,10)); + cbfacnames.setAlignmentX(cbfacnames.CENTER_ALIGNMENT); + + + + ArrayList coursenames = new ArrayList(); + ListIterator cit = courses.listIterator(); + while (cit.hasNext()){ + coursenames.add(cit.next().getcoursename()); + } + + Collections.sort(coursenames); + String[] coursetemp = new String[coursenames.size()]; + coursetemp = coursenames.toArray(coursetemp); + + faccourselist = new JComboBox(coursetemp); + faccourselist.setPreferredSize(new Dimension(200,10)); + faccourselist.setAlignmentX(faccourselist.CENTER_ALIGNMENT); + + addbutton = new JButton("SET"); + addbutton.setAlignmentX(addbutton.CENTER_ALIGNMENT); + addbutton.addActionListener(addfaculty); + + factocoursepanel.add(Box.createRigidArea(new Dimension(0,10))); + factocoursepanel.add(selectfac); + factocoursepanel.add(Box.createRigidArea(new Dimension(0,10))); + factocoursepanel.add(cbfacnames); + factocoursepanel.add(Box.createRigidArea(new Dimension(0,10))); + factocoursepanel.add(selectcourse); + factocoursepanel.add(Box.createRigidArea(new Dimension(0,10))); + factocoursepanel.add(faccourselist); + factocoursepanel.add(Box.createRigidArea(new Dimension(0,10))); + factocoursepanel.add(addbutton); + factocoursepanel.add(Box.createRigidArea(new Dimension(0,10))); + + factocourseframe.add(factocoursepanel); + //registerstudentframe.pack(); + factocourseframe.setVisible(true); + + } + ActionListener addfaculty = new ActionListener(){ + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + String facname = (String)cbfacnames.getSelectedItem(); + String coursename = (String)faccourselist.getSelectedItem(); + + ListIterator courseit = courses.listIterator(); + Courses tempcourse = new Courses(); + while (courseit.hasNext()){ + Courses nextobj = courseit.next(); + if (nextobj.getcoursename().equals(coursename)){ + if (nextobj.getfaclist().size() == 5){ + JOptionPane.showMessageDialog(null,"5 faculty set already.","REGISTRATION FAILURE",JOptionPane.INFORMATION_MESSAGE); + break; + }else{ + ListIterator facit = faculty.listIterator(); + while (facit.hasNext()){ + Faculty nextfac = facit.next();//Participants nextparti = parti.next(); + if (nextfac.getname().equals(facname)){ + nextobj.getfaclist().add(nextfac); + writeTofile(); + JOptionPane.showMessageDialog(null,"Done!.","REGISTRATION SUCCESSFUL",JOptionPane.INFORMATION_MESSAGE); + break; + } + } + } + break; + } + } + + } + + }; + + + public void add_course_coordinator(){ + + coordtocourseframe = new JFrame(); + + coordtocourseframe.setBackground(Color.GRAY); + coordtocourseframe.setFont(new Font("SansSerif", Font.PLAIN, 25)); + coordtocourseframe.setTitle("SET CO-ORDINATOR FOR COURSE"); + coordtocourseframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAddContact.setBounds(100, 100, 200, 150);//?? + coordtocourseframe.setSize(new Dimension(400,400)); + coordtocourseframe.setLocationRelativeTo(null); + + coordtocoursepanel = new JPanel(); + coordtocoursepanel.setLayout(new BoxLayout(coordtocoursepanel,BoxLayout.PAGE_AXIS)); + coordtocoursepanel.setAlignmentX(coordtocoursepanel.TOP_ALIGNMENT); + + JLabel selectcourse = new JLabel("CHOOSE A COURSE "); + selectcourse.setAlignmentX(selectcourse.CENTER_ALIGNMENT); + JLabel selectfac = new JLabel("CHOOSE A FACULTY"); + selectfac.setAlignmentX(selectfac.CENTER_ALIGNMENT); + + ArrayList facnames = new ArrayList(); + ListIterator facit = faculty.listIterator(); + while (facit.hasNext()){ + facnames.add(facit.next().getname()); + } + + Collections.sort(facnames); + String[] temp = new String[facnames.size()]; + temp = facnames.toArray(temp); + + coordfacnames = new JComboBox(temp); + coordfacnames.setPreferredSize(new Dimension(200,10)); + coordfacnames.setAlignmentX(coordfacnames.CENTER_ALIGNMENT); + + + + ArrayList coursenames = new ArrayList(); + ListIterator cit = courses.listIterator(); + while (cit.hasNext()){ + coursenames.add(cit.next().getcoursename()); + } + + Collections.sort(coursenames); + String[] coursetemp = new String[coursenames.size()]; + coursetemp = coursenames.toArray(coursetemp); + + coordcourselist = new JComboBox(coursetemp); + coordcourselist.setPreferredSize(new Dimension(200,10)); + coordcourselist.setAlignmentX(coordcourselist.CENTER_ALIGNMENT); + + addcoordbutton = new JButton("SET"); + addcoordbutton.setAlignmentX(addcoordbutton.CENTER_ALIGNMENT); + addcoordbutton.addActionListener(addcoord); + + coordtocoursepanel.add(Box.createRigidArea(new Dimension(0,10))); + coordtocoursepanel.add(selectfac); + coordtocoursepanel.add(Box.createRigidArea(new Dimension(0,10))); + coordtocoursepanel.add(coordfacnames); + coordtocoursepanel.add(Box.createRigidArea(new Dimension(0,10))); + coordtocoursepanel.add(selectcourse); + coordtocoursepanel.add(Box.createRigidArea(new Dimension(0,10))); + coordtocoursepanel.add(coordcourselist); + coordtocoursepanel.add(Box.createRigidArea(new Dimension(0,10))); + coordtocoursepanel.add(addcoordbutton); + coordtocoursepanel.add(Box.createRigidArea(new Dimension(0,10))); + + coordtocourseframe.add(coordtocoursepanel); + //registerstudentframe.pack(); + coordtocourseframe.setVisible(true); + + } + ActionListener addcoord = new ActionListener(){ + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + String facname = (String)coordfacnames.getSelectedItem(); + String coursename = (String)coordcourselist.getSelectedItem(); + + ListIterator courseit = courses.listIterator(); + //Courses tempcourse = new Courses(); + while (courseit.hasNext()){ + Courses nextobj = courseit.next(); + if (nextobj.getcoursename().equals(coursename)){ + if (nextobj.getcoordinator().getname() != null){ + JOptionPane.showMessageDialog(null,"Course coordinator set already.","REGISTRATION FAILURE",JOptionPane.INFORMATION_MESSAGE); + break; + }else{ + ListIterator facit = faculty.listIterator(); + while (facit.hasNext()){ + Faculty nextfac = facit.next();//Participants nextparti = parti.next(); + if (nextfac.getname().equals(facname)){ + nextobj.setcoordinator(nextfac); + writeTofile(); + JOptionPane.showMessageDialog(null,"Done!.","REGISTRATION SUCCESSFUL",JOptionPane.INFORMATION_MESSAGE); + break; + } + } + } + break; + } + } + + } + + }; + + public void edit_window(){ + + frmEditdetails = new JFrame(); + frmEditdetails.setBackground(Color.GRAY); + frmEditdetails.setFont(new Font("SansSerif", Font.PLAIN, 25)); + frmEditdetails.setTitle("Edit Details"); + frmEditdetails.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAdddetails.setBounds(100, 100, 200, 150);//?? + frmEditdetails.setSize(new Dimension(400,400)); + frmEditdetails.setLocationRelativeTo(null); + + tabEditdetails = new JTabbedPane(); + + edit_course_details_tab(); + edit_participants_tab(); + edit_faculty_tab(); + + tabEditdetails.addTab("GENERAL COURSE DETAILS",panelEditcoursedetails); + tabEditdetails.addTab("COURSE PARTICIPANTS",panelEditparti); + tabEditdetails.addTab("COURSE FACULTY",panelEditfaculty); + + + frmEditdetails.add(tabEditdetails); + //frmDisplayContact.setLayout(new BorderLayout()); + frmEditdetails.setVisible(true); + + + } + + public void edit_course_details_tab(){ + panelEditcoursedetails = new JPanel(); + panelEditcoursedetails.setLayout(new BoxLayout(panelEditcoursedetails,BoxLayout.PAGE_AXIS)); + + cbchoosecourse = new JComboBox(); + ArrayList coursenames = new ArrayList(); + ListIterator cit = courses.listIterator(); + while (cit.hasNext()){ + coursenames.add(cit.next().getcoursename()); + } + + Collections.sort(coursenames); + String[] coursetemp = new String[coursenames.size()]; + coursetemp = coursenames.toArray(coursetemp); + + cbchoosecourse = new JComboBox(coursetemp); + cbchoosecourse.setPreferredSize(new Dimension(200,10)); + cbchoosecourse.setAlignmentX(cbchoosecourse.CENTER_ALIGNMENT); + + JRadioButton btn1 = new JRadioButton("Coursename",false); + JRadioButton btn2 = new JRadioButton("Coursefee",false); + JRadioButton btn3 = new JRadioButton("Start date",false); + JRadioButton btn4 = new JRadioButton("Duration of course",false); + JRadioButton btn5 = new JRadioButton("Coordinator",false); + JRadioButton btn6 = new JRadioButton("Faculty",false); + JRadioButton btn7 = new JRadioButton("Participants",false); + + + ButtonGroup group = new ButtonGroup(); + group.add(btn7); + group.add(btn6); + group.add(btn5); + group.add(btn4); + group.add(btn3); + group.add(btn2); + group.add(btn1); + + + btn1.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + String coursename = (String)cbchoosecourse.getSelectedItem(); + ListIterator courseit = courses.listIterator(); + while (courseit.hasNext()){ + Courses temp = courseit.next(); + if (temp.getcoursename().equals(coursename)){ + String newname = JOptionPane.showInputDialog("Enter new name:"); + if (newname != null){ + temp.setcoursename(newname); + writeTofile(); + break; + } + } + } + } + + }); + + btn2.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + String coursename = (String)cbchoosecourse.getSelectedItem(); + ListIterator courseit = courses.listIterator(); + while (courseit.hasNext()){ + Courses temp = courseit.next(); + if (temp.getcoursename().equals(coursename)){ + String newfee = JOptionPane.showInputDialog("Enter new fee:"); + if (newfee != null){ + temp.setcoursefee(newfee); + writeTofile(); + break; + } + } + } + } + + }); + + btn3.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + String coursename = (String)cbchoosecourse.getSelectedItem(); + ListIterator courseit = courses.listIterator(); + while (courseit.hasNext()){ + Courses temp = courseit.next(); + if (temp.getcoursename().equals(coursename)){ + String newdate = JOptionPane.showInputDialog("Enter new start date:"); + if (newdate != null){ + Date date = new Date(); + try { + date = new SimpleDateFormat("yyyy/MM/dd",Locale.ENGLISH).parse(newdate); + } catch (Exception e1) { + // TODO Auto-generated catch block + JOptionPane.showMessageDialog(null,"Enter the date in correct format(yyyy/mm/dd).","ERROR!",JOptionPane.ERROR_MESSAGE); + return; + } + temp.setstartdate(newdate); + writeTofile(); + break; + } + } + } + } + + }); + + + btn4.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + String coursename = (String)cbchoosecourse.getSelectedItem(); + ListIterator courseit = courses.listIterator(); + while (courseit.hasNext()){ + Courses temp = courseit.next(); + if (temp.getcoursename().equals(coursename)){ + String newdur = JOptionPane.showInputDialog("Enter new duration:"); + try{ + if (Integer.parseInt(newdur)>14){ + + JOptionPane.showMessageDialog(null,"Duration in days should be less than two weeks.","NOTE!",JOptionPane.INFORMATION_MESSAGE); + return; + } + }catch(Exception e1){ + JOptionPane.showMessageDialog(null,"Enter the duration in number of days.","ERROR!",JOptionPane.ERROR_MESSAGE); + return; + } + + temp.setduration(Integer.parseInt(newdur)); + writeTofile(); + break; + } + } + } + + + }); + + btn5.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + String coursename = (String)cbchoosecourse.getSelectedItem(); + ListIterator courseit = courses.listIterator(); + while (courseit.hasNext()){ + Courses temp = courseit.next(); + if (temp.getcoursename().equals(coursename)){ + String newcoordname = JOptionPane.showInputDialog("Enter new coordinator:"); + ListIterator itnow = faculty.listIterator(); + + while (itnow.hasNext()){ + Faculty nextfac = itnow.next(); + if (nextfac.getname().equals(newcoordname)){ + temp.setcoordinator(nextfac);//// + writeTofile(); + break; + } + if (! itnow.hasNext()) + JOptionPane.showMessageDialog(null,"No such faculty profile exists","FIELD NOT EDITED",JOptionPane.ERROR_MESSAGE); + } + break; + + } + } + } + + + }); + + btn6.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + String coursename = (String)cbchoosecourse.getSelectedItem(); + ListIterator courseit = courses.listIterator(); + while (courseit.hasNext()){ + Courses temp = courseit.next(); + if (temp.getcoursename().equals(coursename)){ + String rmfac = JOptionPane.showInputDialog("Name of faculty to remove:"); + + ListIterator itnow = temp.getfaclist().listIterator(); + + while (itnow.hasNext()){ + Faculty nextfac = itnow.next(); + if (nextfac.getname().equals(rmfac)){ + temp.getfaclist().remove(nextfac); + writeTofile(); + break; + } + if (! itnow.hasNext()){ + JOptionPane.showMessageDialog(null,"No such faculty profile exists","FIELD NOT EDITED",JOptionPane.ERROR_MESSAGE); + + } + } + break; + } + } + } + + }); + + btn7.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + String coursename = (String)cbchoosecourse.getSelectedItem(); + ListIterator courseit = courses.listIterator(); + while (courseit.hasNext()){ + Courses temp = courseit.next(); + if (temp.getcoursename().equals(coursename)){ + String rmparti = JOptionPane.showInputDialog("Name of participant to de-register:"); + ListIterator itnow = temp.getparticipant().listIterator(); + + while (itnow.hasNext()){ + Participants nextparti = itnow.next(); + if (nextparti.getname().equals(rmparti)){ + temp.getparticipant().remove(nextparti); + writeTofile(); + break; + } + if (! itnow.hasNext()){ + JOptionPane.showMessageDialog(null,"No such participant profile exists","FIELD NOT EDITED",JOptionPane.ERROR_MESSAGE); + + } + } + + } + } + } + + }); + + panelEditcoursedetails.add(Box.createRigidArea(new Dimension(0,10))); + panelEditcoursedetails.add(cbchoosecourse); + panelEditcoursedetails.add(Box.createRigidArea(new Dimension(0,10))); + panelEditcoursedetails.add(btn1); + panelEditcoursedetails.add(Box.createRigidArea(new Dimension(0,10))); + panelEditcoursedetails.add(btn2); + panelEditcoursedetails.add(Box.createRigidArea(new Dimension(0,10))); + panelEditcoursedetails.add(btn3); + panelEditcoursedetails.add(Box.createRigidArea(new Dimension(0,10))); + panelEditcoursedetails.add(btn4); + panelEditcoursedetails.add(Box.createRigidArea(new Dimension(0,10))); + panelEditcoursedetails.add(btn5); + panelEditcoursedetails.add(Box.createRigidArea(new Dimension(0,10))); + panelEditcoursedetails.add(btn6); + panelEditcoursedetails.add(Box.createRigidArea(new Dimension(0,10))); + panelEditcoursedetails.add(btn7); + panelEditcoursedetails.add(Box.createRigidArea(new Dimension(0,10))); + + panelEditcoursedetails.setPreferredSize(new Dimension(350,350)); + + } + public void edit_participants_tab(){ + panelEditparti = new JPanel(); + panelEditparti.setLayout(new BoxLayout(panelEditparti,BoxLayout.PAGE_AXIS)); + + ArrayList studnames = new ArrayList(); + ListIterator parti = participants.listIterator(); + while (parti.hasNext()){ + studnames.add(parti.next().getname()); + } + + Collections.sort(studnames); + String[] temp = new String[studnames.size()]; + temp = studnames.toArray(temp); + + cbchoosestudent = new JComboBox(temp); + cbchoosestudent.setPreferredSize(new Dimension(200,10)); + cbchoosestudent.setAlignmentX(cbchoosestudent.CENTER_ALIGNMENT); + + JRadioButton btn1 = new JRadioButton("Name",false); + JRadioButton btn2 = new JRadioButton("Address",false); + JRadioButton btn3 = new JRadioButton("Mobile number",false); + JRadioButton btn4 = new JRadioButton("Email id",false); + JRadioButton btn5 = new JRadioButton("Organisation's name",false); + + ButtonGroup group = new ButtonGroup(); + + group.add(btn5); + group.add(btn4); + group.add(btn3); + group.add(btn2); + group.add(btn1); + + btn1.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + String partiname = (String)cbchoosestudent.getSelectedItem(); + ListIterator it = participants.listIterator(); + while (it.hasNext()){ + Participants temp = it.next(); + if (temp.getname().equals(partiname)){ + String newname = JOptionPane.showInputDialog("Enter new name:"); + if (newname != null){ + temp.setname(newname); + writeTofile(); + break; + } + } + } + } + + }); + + btn2.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + String partiname = (String)cbchoosestudent.getSelectedItem(); + ListIterator it = participants.listIterator(); + while (it.hasNext()){ + Participants temp = it.next(); + if (temp.getname().equals(partiname)){ + String newaddr = JOptionPane.showInputDialog("Enter new address:"); + if (newaddr != null){ + temp.setaddress(newaddr); + writeTofile(); + break; + } + } + } + } + + }); + + btn3.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + String partiname = (String)cbchoosestudent.getSelectedItem(); + ListIterator it = participants.listIterator(); + while (it.hasNext()){ + Participants temp = it.next(); + if (temp.getname().equals(partiname)){ + String newnum = JOptionPane.showInputDialog("Enter new mobile number:"); + if (newnum != null){ + temp.setmobnum(newnum); + writeTofile(); + break; + } + } + } + } + + }); + + btn4.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + String partiname = (String)cbchoosestudent.getSelectedItem(); + ListIterator it = participants.listIterator(); + while (it.hasNext()){ + Participants temp = it.next(); + if (temp.getname().equals(partiname)){ + String newid = JOptionPane.showInputDialog("Enter new email id:"); + if (newid != null){ + temp.setemailid(newid); + writeTofile(); + break; + } + } + } + } + + }); + + btn5.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + String partiname = (String)cbchoosestudent.getSelectedItem(); + ListIterator it = participants.listIterator(); + while (it.hasNext()){ + Participants temp = it.next(); + if (temp.getname().equals(partiname)){ + String neworgname = JOptionPane.showInputDialog("Enter new organisation's name:"); + if (neworgname != null){ + temp.setorgname(neworgname); + writeTofile(); + break; + } + } + } + } + + }); + + panelEditparti.add(Box.createRigidArea(new Dimension(0,10))); + panelEditparti.add(cbchoosestudent); + panelEditparti.add(Box.createRigidArea(new Dimension(0,10))); + panelEditparti.add(btn1); + panelEditparti.add(Box.createRigidArea(new Dimension(0,10))); + panelEditparti.add(btn2); + panelEditparti.add(Box.createRigidArea(new Dimension(0,10))); + panelEditparti.add(btn3); + panelEditparti.add(Box.createRigidArea(new Dimension(0,10))); + panelEditparti.add(btn4); + panelEditparti.add(Box.createRigidArea(new Dimension(0,10))); + panelEditparti.add(btn5); + panelEditparti.add(Box.createRigidArea(new Dimension(0,10))); + + panelEditparti.setPreferredSize(new Dimension(300,300)); + + } + public void edit_faculty_tab(){ + panelEditfaculty = new JPanel(); + panelEditfaculty.setLayout(new BoxLayout(panelEditfaculty,BoxLayout.PAGE_AXIS)); + + ArrayList facnames = new ArrayList(); + ListIterator facit = faculty.listIterator(); + while (facit.hasNext()){ + facnames.add(facit.next().getname()); + } + + Collections.sort(facnames); + String[] temp = new String[facnames.size()]; + temp = facnames.toArray(temp); + + cbchoosefaculty = new JComboBox(temp); + cbchoosefaculty.setPreferredSize(new Dimension(200,10)); + cbchoosefaculty.setAlignmentX(cbchoosefaculty.CENTER_ALIGNMENT); + + JRadioButton btn1 = new JRadioButton("Name",false); + JRadioButton btn2 = new JRadioButton("Department",false); + JRadioButton btn4 = new JRadioButton("Mobile number",false); + JRadioButton btn5 = new JRadioButton("Email id",false); + JRadioButton btn3 = new JRadioButton("Address",false); + + ButtonGroup group = new ButtonGroup(); + + group.add(btn5); + group.add(btn4); + group.add(btn3); + group.add(btn2); + group.add(btn1); + + btn1.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + String facname = (String)cbchoosefaculty.getSelectedItem(); + ListIterator it = faculty.listIterator(); + while (it.hasNext()){ + Faculty temp = it.next(); + if (temp.getname().equals(facname)){ + String newname = JOptionPane.showInputDialog("Enter new name:"); + if (newname != null){ + temp.setname(newname); + writeTofile(); + break; + } + } + } + } + + }); + + btn2.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + String facname = (String)cbchoosefaculty.getSelectedItem(); + ListIterator it = faculty.listIterator(); + while (it.hasNext()){ + Faculty temp = it.next(); + if (temp.getname().equals(facname)){ + String newdept = JOptionPane.showInputDialog("Enter new department's name:"); + if (newdept != null){ + temp.setdepartment(newdept); + writeTofile(); + break; + } + } + } + } + + }); + + btn3.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + String facname = (String)cbchoosefaculty.getSelectedItem(); + ListIterator it = faculty.listIterator(); + while (it.hasNext()){ + Faculty temp = it.next(); + if (temp.getname().equals(facname)){ + String newaddr = JOptionPane.showInputDialog("Enter new address:"); + if (newaddr != null){ + temp.setaddress(newaddr); + writeTofile(); + break; + } + } + } + } + + }); + + btn4.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + String facname = (String)cbchoosefaculty.getSelectedItem(); + ListIterator it = faculty.listIterator(); + while (it.hasNext()){ + Faculty temp = it.next(); + if (temp.getname().equals(facname)){ + String newnum = JOptionPane.showInputDialog("Enter new mobile number:"); + if (newnum != null){ + temp.setmobnum(newnum); + writeTofile(); + break; + } + } + } + } + + }); + + btn5.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + String facname = (String)cbchoosefaculty.getSelectedItem(); + ListIterator it = faculty.listIterator(); + while (it.hasNext()){ + Faculty temp = it.next(); + if (temp.getname().equals(facname)){ + String newid = JOptionPane.showInputDialog("Enter new email id:"); + if (newid != null){ + temp.setemailid(newid); + writeTofile(); + break; + } + } + } + } + + }); + + panelEditfaculty.add(Box.createRigidArea(new Dimension(0,10))); + panelEditfaculty.add(cbchoosefaculty); + panelEditfaculty.add(Box.createRigidArea(new Dimension(0,10))); + panelEditfaculty.add(btn1); + panelEditfaculty.add(Box.createRigidArea(new Dimension(0,10))); + panelEditfaculty.add(btn2); + panelEditfaculty.add(Box.createRigidArea(new Dimension(0,10))); + panelEditfaculty.add(btn3); + panelEditfaculty.add(Box.createRigidArea(new Dimension(0,10))); + panelEditfaculty.add(btn4); + panelEditfaculty.add(Box.createRigidArea(new Dimension(0,10))); + panelEditfaculty.add(btn5); + panelEditfaculty.add(Box.createRigidArea(new Dimension(0,10))); + + panelEditfaculty.setPreferredSize(new Dimension(300,300)); + + + } + public void delete_window(){ + frmDeletedetails = new JFrame(); + frmDeletedetails.setBackground(Color.GRAY); + frmDeletedetails.setFont(new Font("SansSerif", Font.PLAIN, 25)); + frmDeletedetails.setTitle("Delete Details"); + frmDeletedetails.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAdddetails.setBounds(100, 100, 200, 150);//?? + frmDeletedetails.setSize(new Dimension(400,150)); + frmDeletedetails.setLocationRelativeTo(null); + + JPanel deletepanel = new JPanel(); + deletepanel.setLayout(new BoxLayout(deletepanel,BoxLayout.PAGE_AXIS)); + + JRadioButton btn1 = new JRadioButton("Delete course from system",false); + JRadioButton btn2 = new JRadioButton("Delete participant's profile from system",false); + JRadioButton btn3 = new JRadioButton("Delete faculty's profile from system",false); + + ButtonGroup group = new ButtonGroup(); + group.add(btn1); + group.add(btn2); + group.add(btn3); + + btn1.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + String coursename = JOptionPane.showInputDialog("Enter course name:"); + ListIterator it = courses.listIterator(); + + while (it.hasNext()){ + Courses nextcourse = it.next(); + if (nextcourse.getcoursename().equals(coursename)){ + courses.remove(nextcourse); + JOptionPane.showMessageDialog(null,"Deleted successfully!","DONE",JOptionPane.INFORMATION_MESSAGE); + writeTofile(); + break; + } + if (! it.hasNext()){ + JOptionPane.showMessageDialog(null,"No such course exists yet!","FAILURE",JOptionPane.ERROR_MESSAGE); + + } + } + + } + + }); + + btn2.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + + String partiname = JOptionPane.showInputDialog("Enter participant's name:"); + ListIterator it = participants.listIterator(); + + while (it.hasNext()){ + Participants parti = it.next(); + if (parti.getname().equals(partiname)){ + participants.remove(parti); + //System.out.println("Deleted successfully! "); + ListIterator courseit = courses.listIterator(); + while (courseit.hasNext()){ + Courses nextcourse = courseit.next(); + ListIterator itparti = nextcourse.getparticipant().listIterator(); + try{ + while (itparti.hasNext()){ + Participants temp = itparti.next(); + if (temp.getname().equals(partiname)){ + courses.get(courses.indexOf(nextcourse)).getparticipant().remove(temp); + //nextcourse.getparticipant().remove(temp); + break; + } + } + }catch(Exception e){ + } + } + JOptionPane.showMessageDialog(null,"Deleted successfully!","DONE",JOptionPane.INFORMATION_MESSAGE); + writeTofile(); + break; + } + } + + } + }); + + btn3.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + + String facname = JOptionPane.showInputDialog("Enter faculty's name:"); + + ListIterator it = faculty.listIterator(); + + while (it.hasNext()){ + Faculty nextfac = it.next(); + if (nextfac.getname().equals(facname)){ + faculty.remove(nextfac); + + ListIterator courseit = courses.listIterator(); + while (courseit.hasNext()){ + Courses nextcourse = courseit.next(); + try { + if (nextcourse.getcoordinator().getname().equals(facname)){ + nextcourse.getcoordinator().setname(null); + break; + } + }catch (Exception e){ + } + + try{ + ListIterator facit = nextcourse.getfaclist().listIterator(); + while (facit.hasNext()){ + Faculty fac = facit.next(); + if (fac.getname().equals(facname)){ + courses.get(courses.indexOf(nextcourse)).getfaclist().remove(fac); + //nextcourse.getfaclist().remove(fac); + break; + } + } + }catch(Exception e){ + } + } + writeTofile(); + JOptionPane.showMessageDialog(null,"Deleted successfully!","DONE",JOptionPane.INFORMATION_MESSAGE); + //System.out.println("Deleted successfully! "); + break; + } + } + } + }); + + deletepanel.add(Box.createRigidArea(new Dimension(0,10))); + deletepanel.add(btn1); + deletepanel.add(Box.createRigidArea(new Dimension(0,10))); + deletepanel.add(btn2); + deletepanel.add(Box.createRigidArea(new Dimension(0,10))); + deletepanel.add(btn3); + deletepanel.add(Box.createRigidArea(new Dimension(0,10))); + frmDeletedetails.add(deletepanel); + frmDeletedetails.setVisible(true); + } + + public void display(){ + frmDisplaydetails = new JFrame(); + frmDisplaydetails.setBackground(Color.GRAY); + frmDisplaydetails.setFont(new Font("SansSerif", Font.PLAIN, 25)); + frmDisplaydetails.setTitle("Displaying Details"); + frmDisplaydetails.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAdddetails.setBounds(100, 100, 200, 150);//?? + frmDisplaydetails.setSize(new Dimension(400,400)); + frmDisplaydetails.setLocationRelativeTo(null); + + tabDisplaydetails = new JTabbedPane(); + + disp_course_details_tab(); + disp_participants_tab(); + disp_faculty_tab(); + + tabDisplaydetails.addTab("GENERAL COURSE DETAILS",panelDisplaycoursedetails); + tabDisplaydetails.addTab("COURSE PARTICIPANTS",panelDisplayparti); + tabDisplaydetails.addTab("COURSE FACULTY",panelDisplayfaculty); + + + frmDisplaydetails.add(tabDisplaydetails); + //frmDisplayContact.setLayout(new BorderLayout()); + frmDisplaydetails.setVisible(true); + + } + + public void disp_course_details_tab(){ + panelDisplaycoursedetails = new JPanel(); + + + String[] columns = {"Name","Coursefee","Start date","Duration(days)","Course Coordinator"}; + Object[][] rows = new Object[courses.size()][5]; + for (Courses i:courses){ + + Date date = new Date(); + try { + date = new SimpleDateFormat("yyyy/MM/dd",Locale.ENGLISH).parse(i.getstartdate()); + } catch (ParseException e) { + // TODO Auto-generated catch block + //e.printStackTrace(); + JOptionPane.showMessageDialog(null,"Date should be in correct format.","ERROR:",JOptionPane.ERROR_MESSAGE); + } + //mycal.setTime(date); + LocalDate localDate = LocalDate.now(); + LocalDate compare = localDate.minusYears(5); + DateTimeFormatter formatter = DateTimeFormatter.BASIC_ISO_DATE; + Date newdate = new Date(); + try { + newdate = new SimpleDateFormat("yyyyMMdd",Locale.ENGLISH).parse(formatter.format(compare)); + } catch (ParseException e) { + // TODO Auto-generated catch block + //e.printStackTrace(); + } + + //date.before(newdate) ??? + if (newdate.before(date)){//more than a year old course--->don't display + continue; + } + //System.out.println("here\n"); + + //rows[relatives.indexOf(i)][0] = new Object(); + rows[courses.indexOf(i)][0] = courses.get(courses.indexOf(i)).getcoursename(); + rows[courses.indexOf(i)][1] = courses.get(courses.indexOf(i)).getcoursefee(); + rows[courses.indexOf(i)][2] = courses.get(courses.indexOf(i)).getstartdate(); + rows[courses.indexOf(i)][3] = courses.get(courses.indexOf(i)).getduration(); + rows[courses.indexOf(i)][4] = courses.get(courses.indexOf(i)).getcoordinator().getname(); + + } + + JTable dispcoursedetails = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return false; + } + }; + dispcoursedetails.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + dispcoursedetails.setAutoCreateColumnsFromModel(true); + + panelDisplaycoursedetails.setLayout(new BorderLayout()); + panelDisplaycoursedetails.add(new JScrollPane(dispcoursedetails),BorderLayout.CENTER); + panelDisplaycoursedetails.setPreferredSize(new Dimension(350,350)); + + } + public void disp_participants_tab(){ + + panelDisplayparti = new JPanel(); + panelDisplayparti.setLayout(new BoxLayout(panelDisplayparti,BoxLayout.PAGE_AXIS)); + panelDisplayparti.setAlignmentX(panelDisplayparti.TOP_ALIGNMENT); + + //JComboBox chooseparti = new JComboBox(); + ArrayList coursenames = new ArrayList(); + ListIterator cit = courses.listIterator(); + while (cit.hasNext()){ + + Courses temp = cit.next(); + Date date = new Date(); + try { + date = new SimpleDateFormat("yyyy/MM/dd",Locale.ENGLISH).parse(temp.getstartdate()); + } catch (ParseException e) { + // TODO Auto-generated catch block + //e.printStackTrace(); + JOptionPane.showMessageDialog(null,"Date should be in correct format.","ERROR:",JOptionPane.ERROR_MESSAGE); + } + //mycal.setTime(date); + LocalDate localDate = LocalDate.now(); + LocalDate compare = localDate.minusYears(5); + DateTimeFormatter formatter = DateTimeFormatter.BASIC_ISO_DATE; + Date newdate = new Date(); + try { + newdate = new SimpleDateFormat("yyyyMMdd",Locale.ENGLISH).parse(formatter.format(compare)); + } catch (ParseException e) { + // TODO Auto-generated catch block + //e.printStackTrace(); + } + + + if (newdate.before(date)){//more than a year old course--->don't display + continue; + } + + + coursenames.add(temp.getcoursename()); + } + + Collections.sort(coursenames); + String[] coursetemp = new String[coursenames.size()]; + coursetemp = coursenames.toArray(coursetemp); + + JComboBox chooseparti = new JComboBox(coursetemp); + chooseparti.setPreferredSize(new Dimension(200,10)); + chooseparti.setAlignmentX(chooseparti.CENTER_ALIGNMENT); + + + JButton showparti = new JButton("Show participants for this course"); + showparti.setAlignmentX(showparti.CENTER_ALIGNMENT); + showparti.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + String coursename = (String)chooseparti.getSelectedItem(); + init_courseparti_table(coursename); + } + + }); + JButton showall = new JButton("Show all participant profiles"); + showall.setAlignmentX(showall.CENTER_ALIGNMENT); + showall.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + init_showallparti_table(); + } + + }); + + JLabel templabel = new JLabel("Choose a course"); + templabel.setAlignmentX(templabel.CENTER_ALIGNMENT); + + panelDisplayparti.add(Box.createRigidArea(new Dimension(0,10))); + panelDisplayparti.add(templabel); + panelDisplayparti.add(Box.createRigidArea(new Dimension(0,10))); + panelDisplayparti.add(chooseparti); + panelDisplayparti.add(Box.createRigidArea(new Dimension(0,10))); + panelDisplayparti.add(showparti); + panelDisplayparti.add(Box.createVerticalGlue()); + panelDisplayparti.add(showall); + panelDisplayparti.add(Box.createVerticalGlue()); + } + + public void init_courseparti_table(String coursename){ + JFrame dispcoursepartiframe = new JFrame(); + + dispcoursepartiframe.setBackground(Color.GRAY); + dispcoursepartiframe.setFont(new Font("SansSerif", Font.PLAIN, 25)); + dispcoursepartiframe.setTitle("DISPLAYING PARTICIPANTS FOR REQUESTED COURSE"); + dispcoursepartiframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAddContact.setBounds(100, 100, 200, 150);//?? + dispcoursepartiframe.setSize(new Dimension(400,400)); + dispcoursepartiframe.setLocationRelativeTo(null); + + JPanel dispcoursepartipanel = new JPanel(); + dispcoursepartipanel.setLayout(new BoxLayout(dispcoursepartipanel,BoxLayout.PAGE_AXIS)); + + ListIterator courseit = courses.listIterator(); + while (courseit.hasNext()){ + Courses temp = courseit.next(); + + + if (temp.getcoursename().equals(coursename)){ + String[] columns = {"Name","Address","Mobile number","Email id","Organization's name"}; + Object[][] rows = new Object[temp.getparticipant().size()][5]; + for (Participants i:temp.getparticipant()){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[temp.getparticipant().indexOf(i)][0] = temp.getparticipant().get(temp.getparticipant().indexOf(i)).getname(); + rows[temp.getparticipant().indexOf(i)][1] = temp.getparticipant().get(temp.getparticipant().indexOf(i)).getaddress(); + rows[temp.getparticipant().indexOf(i)][2] = temp.getparticipant().get(temp.getparticipant().indexOf(i)).getmobnum(); + rows[temp.getparticipant().indexOf(i)][3] = temp.getparticipant().get(temp.getparticipant().indexOf(i)).getemailid(); + rows[temp.getparticipant().indexOf(i)][4] = temp.getparticipant().get(temp.getparticipant().indexOf(i)).getorgname(); + + } + + JTable disppartidetails = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return false; + } + }; + disppartidetails.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + //disppartidetails.setAutoCreateColumnsFromModel(true); + + dispcoursepartipanel.setLayout(new BorderLayout()); + dispcoursepartipanel.add(new JScrollPane(disppartidetails),BorderLayout.CENTER); + dispcoursepartipanel.setPreferredSize(new Dimension(350,350)); + + break; + } + } + dispcoursepartiframe.add(dispcoursepartipanel); + dispcoursepartiframe.setVisible(true); + + + + } + public void init_showallparti_table(){ + + JFrame dispcoursepartiframe = new JFrame(); + + dispcoursepartiframe.setBackground(Color.GRAY); + dispcoursepartiframe.setFont(new Font("SansSerif", Font.PLAIN, 25)); + dispcoursepartiframe.setTitle("DISPLAYING PARTICIPANTS FOR ALL COURSEs"); + dispcoursepartiframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAddContact.setBounds(100, 100, 200, 150);//?? + dispcoursepartiframe.setSize(new Dimension(400,400)); + dispcoursepartiframe.setLocationRelativeTo(null); + + JPanel dispcoursepartipanel = new JPanel(); + dispcoursepartipanel.setLayout(new BoxLayout(dispcoursepartipanel,BoxLayout.PAGE_AXIS)); + + ListIterator courseit = courses.listIterator(); + String[] columns = {"Name","Address","Mobile number","Email id","Organization's name","Course registered for"}; + Object[][] rows = new Object[5*courses.size()][6]; + + while (courseit.hasNext()){ + Courses temp = courseit.next(); + + + for (Participants i:temp.getparticipant()){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[temp.getparticipant().indexOf(i)][0] = temp.getparticipant().get(temp.getparticipant().indexOf(i)).getname(); + rows[temp.getparticipant().indexOf(i)][1] = temp.getparticipant().get(temp.getparticipant().indexOf(i)).getaddress(); + rows[temp.getparticipant().indexOf(i)][2] = temp.getparticipant().get(temp.getparticipant().indexOf(i)).getmobnum(); + rows[temp.getparticipant().indexOf(i)][3] = temp.getparticipant().get(temp.getparticipant().indexOf(i)).getemailid(); + rows[temp.getparticipant().indexOf(i)][4] = temp.getparticipant().get(temp.getparticipant().indexOf(i)).getorgname(); + rows[temp.getparticipant().indexOf(i)][5] = temp.getcoursename(); + } + + + //break; + } + + + JTable disppartidetails = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return false; + } + }; + disppartidetails.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + //disppartidetails.setAutoCreateColumnsFromModel(true); + + dispcoursepartipanel.setLayout(new BorderLayout()); + dispcoursepartipanel.add(new JScrollPane(disppartidetails),BorderLayout.CENTER); + dispcoursepartipanel.setPreferredSize(new Dimension(350,350)); + + + dispcoursepartiframe.add(dispcoursepartipanel); + dispcoursepartiframe.setVisible(true); + + + + } + public void disp_faculty_tab(){ + + panelDisplayfaculty = new JPanel(); + panelDisplayfaculty.setLayout(new BoxLayout(panelDisplayfaculty,BoxLayout.PAGE_AXIS)); + panelDisplayfaculty.setAlignmentX(panelDisplayfaculty.TOP_ALIGNMENT); + + //JComboBox chooseparti = new JComboBox(); + ArrayList coursenames = new ArrayList(); + ListIterator cit = courses.listIterator(); + while (cit.hasNext()){ + Courses temp = cit.next(); + Date date = new Date(); + try { + date = new SimpleDateFormat("yyyy/MM/dd",Locale.ENGLISH).parse(temp.getstartdate()); + } catch (ParseException e) { + // TODO Auto-generated catch block + //e.printStackTrace(); + JOptionPane.showMessageDialog(null,"Date should be in correct format.","ERROR:",JOptionPane.ERROR_MESSAGE); + } + //mycal.setTime(date); + LocalDate localDate = LocalDate.now(); + LocalDate compare = localDate.minusYears(5); + DateTimeFormatter formatter = DateTimeFormatter.BASIC_ISO_DATE; + Date newdate = new Date(); + try { + newdate = new SimpleDateFormat("yyyyMMdd",Locale.ENGLISH).parse(formatter.format(compare)); + } catch (ParseException e) { + // TODO Auto-generated catch block + //e.printStackTrace(); + } + + + if (newdate.before(date)){//more than a year old course--->don't display + continue; + } + + + coursenames.add(temp.getcoursename()); + } + + Collections.sort(coursenames); + String[] coursetemp = new String[coursenames.size()]; + coursetemp = coursenames.toArray(coursetemp); + + JComboBox choosecourse = new JComboBox(coursetemp); + choosecourse.setPreferredSize(new Dimension(200,10)); + choosecourse.setAlignmentX(choosecourse.CENTER_ALIGNMENT); + + + JButton showfac = new JButton("Show faculty for this course"); + showfac.setAlignmentX(showfac.CENTER_ALIGNMENT); + showfac.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + String coursename = (String)choosecourse.getSelectedItem(); + init_coursefac_table(coursename); + } + + }); + /*JButton showall = new JButton("Show all participant profiles"); + showall.setAlignmentX(showall.CENTER_ALIGNMENT); + showall.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + init_showallparti_table(); + } + + });*/ + + JLabel templabel = new JLabel("Choose a course"); + templabel.setAlignmentX(templabel.CENTER_ALIGNMENT); + + panelDisplayfaculty.add(Box.createRigidArea(new Dimension(0,10))); + panelDisplayfaculty.add(templabel); + panelDisplayfaculty.add(Box.createRigidArea(new Dimension(0,10))); + panelDisplayfaculty.add(choosecourse); + panelDisplayfaculty.add(Box.createRigidArea(new Dimension(0,10))); + panelDisplayfaculty.add(showfac); + panelDisplayfaculty.add(Box.createVerticalGlue()); + /*panelDisplayparti.add(showall); + panelDisplayparti.add(Box.createVerticalGlue()); + */ + + } + + public void init_coursefac_table(String coursename){ + + JFrame dispcoursefacframe = new JFrame(); + + dispcoursefacframe.setBackground(Color.GRAY); + dispcoursefacframe.setFont(new Font("SansSerif", Font.PLAIN, 25)); + dispcoursefacframe.setTitle("DISPLAYING PARTICIPANTS FOR REQUESTED COURSE"); + dispcoursefacframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//add window listeners for saving data?? + //frmAddContact.setBounds(100, 100, 200, 150);//?? + dispcoursefacframe.setSize(new Dimension(400,400)); + dispcoursefacframe.setLocationRelativeTo(null); + + JPanel dispcoursefacpanel = new JPanel(); + dispcoursefacpanel.setLayout(new BoxLayout(dispcoursefacpanel,BoxLayout.PAGE_AXIS)); + + ListIterator courseit = courses.listIterator(); + while (courseit.hasNext()){ + Courses temp = courseit.next(); + + + if (temp.getcoursename().equals(coursename)){ + + JLabel coordlabel = new JLabel(); + coordlabel.setAlignmentX(coordlabel.CENTER_ALIGNMENT); + if (temp.getcoordinator().getname() == null){ + coordlabel.setText("COURSE CO-ORDINATOR NOT SET YET."); + }else{ + coordlabel.setText("COURSE COORDINATOR:\n"+"NAME: "+temp.getcoordinator().getname()+"\nDEPARTMENT: "+temp.getcoordinator().getdepartment()+"\nADDRESS: "+temp.getcoordinator().getaddress()+"\nMOBILE NUMBER: "+temp.getcoordinator().getmobnum()+"\nEMAIL ID: "+temp.getcoordinator().getemailid()+"\n"); + } + String[] columns = {"Name","Department","Address","Mobile number","Email id"}; + Object[][] rows = new Object[temp.getfaclist().size()][5]; + for (Faculty i:temp.getfaclist()){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[temp.getfaclist().indexOf(i)][0] = temp.getfaclist().get(temp.getfaclist().indexOf(i)).getname(); + rows[temp.getfaclist().indexOf(i)][1] = temp.getfaclist().get(temp.getfaclist().indexOf(i)).getdepartment(); + rows[temp.getfaclist().indexOf(i)][2] = temp.getfaclist().get(temp.getfaclist().indexOf(i)).getaddress(); + rows[temp.getfaclist().indexOf(i)][3] = temp.getfaclist().get(temp.getfaclist().indexOf(i)).getmobnum(); + rows[temp.getfaclist().indexOf(i)][4] = temp.getfaclist().get(temp.getfaclist().indexOf(i)).getemailid(); + + } + + JTable dispfacdetails = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return false; + } + }; + dispfacdetails.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + //disppartidetails.setAutoCreateColumnsFromModel(true); + + dispcoursefacpanel.setLayout(new BoxLayout(dispcoursefacpanel,BoxLayout.PAGE_AXIS)); + dispcoursefacpanel.add(Box.createRigidArea(new Dimension(0,10))); + dispcoursefacpanel.add(coordlabel); + dispcoursefacpanel.add(Box.createRigidArea(new Dimension(0,10))); + dispcoursefacpanel.add(new JScrollPane(dispfacdetails)); + dispcoursefacpanel.add(Box.createVerticalGlue()); + dispcoursefacpanel.setPreferredSize(new Dimension(400,400)); + + break; + } + } + dispcoursefacframe.add(dispcoursefacpanel); + dispcoursefacframe.setVisible(true); + + + } + + /** + * Initialize the contents of the frame. + */ + private void initialize() { + /*frame = new JFrame(); + frame.getContentPane().setLayout(new BorderLayout());*/ + init_frame(); + init_options(); + } +} diff --git a/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Faculty.java b/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Faculty.java new file mode 100644 index 0000000..524b61f --- /dev/null +++ b/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Faculty.java @@ -0,0 +1,61 @@ + + + +/** + * Write a description of class Faculty here. + * + * @author (your name) + * @version (a version number or a date) + */ +import java.io.Serializable; + +public class Faculty implements Serializable +{ + private String name; + private String department; + private String address; + private String mobnum; + private String emailid; + + Faculty(){ + name = null; + department = null; + address = null; + address = null; + mobnum = null; + emailid = null; + } + + public void setname(String name){ + this.name = name; + } + public void setaddress(String address){ + this.address = address; + } + public void setmobnum(String mobnum){ + this.mobnum = mobnum; + } + public void setdepartment(String dept){ + this.department = dept; + } + public void setemailid(String id){ + this.emailid = id; + } + public String getname(){ + return this.name; + } + public String getaddress(){ + return this.address; + } + public String getmobnum(){ + return this.mobnum; + } + public String getdepartment(){ + return this.department; + } + public String getemailid(){ + return this.emailid; + } + +} + diff --git a/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Participants.java b/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Participants.java new file mode 100644 index 0000000..82b26e7 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Participants.java @@ -0,0 +1,60 @@ + + + + +/** + * Write a description of class Participants here. + * + * @author (your name) + * @version (a version number or a date) + */ +import java.io.Serializable; +public class Participants implements Serializable +{ + private String name; + private String address; + private String mob_num; + private String org_name; + private String email_id; + + Participants(){ + name = null; + address = null; + mob_num = null; + org_name = null; + email_id = null; + } + + public void setname(String name){ + this.name = name; + } + public void setaddress(String address){ + this.address = address; + } + public void setmobnum(String mobnum){ + this.mob_num = mobnum; + } + public void setorgname(String orgname){ + this.org_name = orgname; + } + public void setemailid(String id){ + this.email_id = id; + } + public String getname(){ + return this.name; + } + public String getaddress(){ + return this.address; + } + public String getmobnum(){ + return this.mob_num; + } + public String getorgname(){ + return this.org_name; + } + public String getemailid(){ + return this.email_id; + } + + +} diff --git a/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Readme.txt b/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Readme.txt new file mode 100644 index 0000000..a22bad6 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Readme.txt @@ -0,0 +1,4 @@ +--->The course management system is a JAVA Swing Application created as part of Software Engineering Laboratory, Spring 2016. +--->It has facilities for creating courses, creating student and faculty profiles, registering students to courses, alloting faculty to courses. +--->The details can be edited and profiles may also be deleted from the system. +--->Note however that courses which are more than 5 years old from the current date will be added to the system, but they won't be visible as available courses at the time of displayng all courses. There is also a constraint of maximum 5 students that can register for a course and maximum 5 faculty alloted to a course. diff --git a/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Readme.txt~ b/projects/JAVA-PROJECTS-master/COURSE MANAGEMENT SYSTEM/Readme.txt~ new file mode 100644 index 0000000..e69de29 diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.lock b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.lock new file mode 100644 index 0000000..e69de29 diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.log b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.log new file mode 100644 index 0000000..78f79db --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.log @@ -0,0 +1,60 @@ +!SESSION 2018-12-18 10:08:26.304 ----------------------------------------------- +eclipse.buildId=4.7.3.M20180330-0640 +java.version=1.8.0_191 +java.vendor=Oracle Corporation +BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US +Framework arguments: -product org.eclipse.epp.package.committers.product +Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.committers.product + +!ENTRY org.eclipse.epp.logging.aeri.ide 2 17 2018-12-18 10:09:17.655 +!MESSAGE Server ‘org.eclipse.epp.logging.aeri.ide.server’ failed with exception: dev.eclipse.org. ; version: 2.0.7.v20170906-1327 +!STACK 0 +java.net.UnknownHostException: dev.eclipse.org + at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) + at java.net.InetAddress$2.lookupAllHostAddr(Unknown Source) + at java.net.InetAddress.getAddressesFromNameService(Unknown Source) + at java.net.InetAddress.getAllByName0(Unknown Source) + at java.net.InetAddress.getAllByName(Unknown Source) + at java.net.InetAddress.getAllByName(Unknown Source) + at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45) + at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:111) + at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353) + at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) + at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) + at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) + at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) + at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) + at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) + at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) + at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55) + at org.apache.http.client.fluent.Request.internalExecute(Request.java:173) + at org.apache.http.client.fluent.Executor.execute(Executor.java:262) + at org.eclipse.epp.internal.logging.aeri.ide.server.mars.IO.request(IO.java:170) + at org.eclipse.epp.internal.logging.aeri.ide.server.mars.IO.refreshConfiguration(IO.java:64) + at org.eclipse.epp.internal.logging.aeri.ide.server.mars.ServerConnection.startUp(ServerConnection.java:124) + at com.google.common.util.concurrent.AbstractIdleService$DelegateService$1.run(AbstractIdleService.java:62) + at com.google.common.util.concurrent.Callables$4.run(Callables.java:122) + at java.lang.Thread.run(Unknown Source) + +!ENTRY org.eclipse.egit.ui 2 0 2018-12-18 10:09:26.958 +!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git +user global configuration and to define the default location to store repositories: 'C:\Users\HP'. If this is +not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and +EGit might behave differently since they see different configuration options. +This warning can be switched off on the Team > Git > Confirmations and Warnings preference page. + +!ENTRY org.eclipse.ui.ide 4 0 2018-12-18 10:10:04.832 +!MESSAGE Could not import project located at C:\Users\HP\Downloads\projects\JAVA-PROJECTS-master\Contact List Management Applet +!STACK 0 +org.eclipse.ui.internal.wizards.datatransfer.CouldNotImportProjectException: Could not import project located at C:\Users\HP\Downloads\projects\JAVA-PROJECTS-master\Contact List Management Applet + at org.eclipse.ui.internal.wizards.datatransfer.SmartImportJob.toExistingOrNewProject(SmartImportJob.java:557) + at org.eclipse.ui.internal.wizards.datatransfer.SmartImportJob.run(SmartImportJob.java:250) + at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56) +Caused by: org.eclipse.core.internal.resources.ResourceException: Invalid project description. + at org.eclipse.core.internal.resources.Project.checkDescription(Project.java:169) + at org.eclipse.core.internal.resources.Project.assertCreateRequirements(Project.java:53) + at org.eclipse.core.internal.resources.Project.create(Project.java:263) + at org.eclipse.core.internal.resources.Project.create(Project.java:247) + at org.eclipse.ui.internal.wizards.datatransfer.SmartImportJob.createOrImportProject(SmartImportJob.java:596) + at org.eclipse.ui.internal.wizards.datatransfer.SmartImportJob.toExistingOrNewProject(SmartImportJob.java:544) + ... 2 more diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.mylyn/.taskListIndex/segments_1 b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.mylyn/.taskListIndex/segments_1 new file mode 100644 index 0000000..e9873fa Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.mylyn/.taskListIndex/segments_1 differ diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.mylyn/.taskListIndex/write.lock b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.mylyn/.taskListIndex/write.lock new file mode 100644 index 0000000..e69de29 diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.mylyn/repositories.xml.zip b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.mylyn/repositories.xml.zip new file mode 100644 index 0000000..f3458bb Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.mylyn/repositories.xml.zip differ diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.mylyn/tasks.xml.zip b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.mylyn/tasks.xml.zip new file mode 100644 index 0000000..fd0e00d Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.mylyn/tasks.xml.zip differ diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version new file mode 100644 index 0000000..25cb955 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index new file mode 100644 index 0000000..d81a528 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index differ diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version new file mode 100644 index 0000000..6b2aaa7 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.resources/.root/1.tree b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.resources/.root/1.tree new file mode 100644 index 0000000..8a1fc9e Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.resources/.root/1.tree differ diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources new file mode 100644 index 0000000..7bf8bdb Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources differ diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a7fb09f --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +description.autobuilding=false +eclipse.preferences.version=1 +version=1 diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.logging.aeri.ide.prefs b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.logging.aeri.ide.prefs new file mode 100644 index 0000000..c186df8 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.logging.aeri.ide.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +resetSendMode=KEEP +resetSendModeOn=0 +sendMode=NOTIFY diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..63d4e81 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,7 @@ +content_assist_proposals_background=255,255,255 +content_assist_proposals_foreground=0,0,0 +eclipse.preferences.version=1 +org.eclipse.jdt.ui.formatterprofiles.version=13 +spelling_locale_initialized=true +useAnnotationsPrefPage=true +useQuickDiffPrefPage=true diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.m2e.discovery.prefs b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.m2e.discovery.prefs new file mode 100644 index 0000000..67b1d96 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.m2e.discovery.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.m2e.discovery.pref.projects= diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.context.core.prefs b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.context.core.prefs new file mode 100644 index 0000000..43e97e4 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.context.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +mylyn.attention.migrated=true diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.monitor.ui.prefs b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.monitor.ui.prefs new file mode 100644 index 0000000..8d462a6 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.monitor.ui.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.mylyn.monitor.activity.tracking.enabled.checked=true diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.tasks.ui.prefs b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.tasks.ui.prefs new file mode 100644 index 0000000..2b60c21 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.tasks.ui.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +migrated.task.repositories.secure.store=true +org.eclipse.mylyn.tasks.ui.filters.nonmatching=true +org.eclipse.mylyn.tasks.ui.filters.nonmatching.encouraged=true +org.eclipse.mylyn.tasks.ui.welcome.message=true diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.team.ui.prefs b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.team.ui.prefs new file mode 100644 index 0000000..56cd496 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.team.ui.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.team.ui.first_time=false diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs new file mode 100644 index 0000000..61f3bb8 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +overviewRuler_migration=migrated_3.1 diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs new file mode 100644 index 0000000..9c7c244 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs @@ -0,0 +1,5 @@ +PROBLEMS_FILTERS_MIGRATE=true +eclipse.preferences.version=1 +platformState=1545073921768 +quickStart=false +tipsAndTricks=true diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs new file mode 100644 index 0000000..aa3dc02 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs @@ -0,0 +1,3 @@ +//org.eclipse.ui.commands/state/org.eclipse.ui.navigator.resources.nested.changeProjectPresentation/org.eclipse.ui.commands.radioState=false +PLUGINS_NOT_ACTIVATED_ON_STARTUP=;org.eclipse.m2e.discovery; +eclipse.preferences.version=1 diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi new file mode 100644 index 0000000..b0a034f --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi @@ -0,0 +1,2542 @@ + + + + activeSchemeId:org.eclipse.ui.defaultAcceleratorConfiguration + ModelMigrationProcessor.001 + + + + + + + + topLevel + shellMaximized + + + + + persp.actionSet:org.eclipse.mylyn.tasks.ui.navigation + persp.actionSet:org.eclipse.ui.cheatsheets.actionSet + persp.actionSet:org.eclipse.search.searchActionSet + persp.actionSet:org.eclipse.ui.edit.text.actionSet.annotationNavigation + persp.actionSet:org.eclipse.ui.edit.text.actionSet.navigation + persp.actionSet:org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo + persp.actionSet:org.eclipse.ui.externaltools.ExternalToolsSet + persp.actionSet:org.eclipse.ui.actionSet.keyBindings + persp.actionSet:org.eclipse.ui.actionSet.openFiles + persp.actionSet:org.eclipse.wb.core.ui.actionset + persp.actionSet:org.eclipse.debug.ui.launchActionSet + persp.actionSet:org.eclipse.jdt.ui.JavaActionSet + persp.actionSet:org.eclipse.jdt.ui.JavaElementCreationActionSet + persp.actionSet:org.eclipse.ui.NavigateActionSet + persp.viewSC:org.eclipse.jdt.ui.PackageExplorer + persp.viewSC:org.eclipse.jdt.ui.TypeHierarchy + persp.viewSC:org.eclipse.jdt.ui.SourceView + persp.viewSC:org.eclipse.jdt.ui.JavadocView + persp.viewSC:org.eclipse.search.ui.views.SearchView + persp.viewSC:org.eclipse.ui.console.ConsoleView + persp.viewSC:org.eclipse.ui.views.ContentOutline + persp.viewSC:org.eclipse.ui.views.ProblemView + persp.viewSC:org.eclipse.ui.views.ResourceNavigator + persp.viewSC:org.eclipse.ui.views.TaskList + persp.viewSC:org.eclipse.ui.views.ProgressView + persp.viewSC:org.eclipse.ui.navigator.ProjectExplorer + persp.viewSC:org.eclipse.ui.texteditor.TemplatesView + persp.viewSC:org.eclipse.pde.runtime.LogView + persp.newWizSC:org.eclipse.jdt.ui.wizards.JavaProjectWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewPackageCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewClassCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewEnumCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewJavaWorkingSetWizard + persp.newWizSC:org.eclipse.ui.wizards.new.folder + persp.newWizSC:org.eclipse.ui.wizards.new.file + persp.newWizSC:org.eclipse.ui.editors.wizards.UntitledTextFileWizard + persp.perspSC:org.eclipse.jdt.ui.JavaBrowsingPerspective + persp.perspSC:org.eclipse.debug.ui.DebugPerspective + persp.viewSC:org.eclipse.mylyn.tasks.ui.views.tasks + persp.newWizSC:org.eclipse.mylyn.tasks.ui.wizards.new.repository.task + persp.showIn:org.eclipse.jdt.ui.PackageExplorer + persp.showIn:org.eclipse.team.ui.GenericHistoryView + persp.showIn:org.eclipse.ui.views.ResourceNavigator + persp.showIn:org.eclipse.ui.navigator.ProjectExplorer + persp.actionSet:org.eclipse.debug.ui.breakpointActionSet + persp.actionSet:org.eclipse.jdt.debug.ui.JDTDebugActionSet + persp.actionSet:org.eclipse.eclemma.ui.CoverageActionSet + persp.showIn:org.eclipse.eclemma.ui.CoverageView + persp.viewSC:org.eclipse.wb.core.StructureView + persp.viewSC:org.eclipse.wb.core.PaletteView + persp.showIn:org.eclipse.egit.ui.RepositoriesView + persp.newWizSC:org.eclipse.jdt.junit.wizards.NewTestCaseCreationWizard + persp.actionSet:org.eclipse.jdt.junit.JUnitActionSet + persp.viewSC:org.eclipse.ant.ui.views.AntView + + + + org.eclipse.e4.primaryNavigationStack + active + + + + + + + + + + + + + + + + + + + + + org.eclipse.e4.secondaryNavigationStack + + + + + + + + org.eclipse.e4.secondaryDataStack + + + + + + + + + + + + + + + + + + + + + + View + categoryTag:Help + + + + + View + categoryTag:General + + ViewMenu + menuContribution:menu + + + + + + + View + categoryTag:Help + + + + org.eclipse.e4.primaryDataStack + EditorStack + + + + + + + View + categoryTag:Java + active + activeOnClose + + ViewMenu + menuContribution:menu + + + + + + + View + categoryTag:Java + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + + View + categoryTag:General + + ViewMenu + menuContribution:menu + + + + + + + View + categoryTag:Java + + + + + View + categoryTag:Java + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + + View + categoryTag:General + + ViewMenu + menuContribution:menu + + + + + + + View + categoryTag:General + + + + + + View + categoryTag:Mylyn + + ViewMenu + menuContribution:menu + + + + + + + View + categoryTag:WindowBuilder + + + + + View + categoryTag:WindowBuilder + + + + + View + categoryTag:Git + + + + + View + categoryTag:Java + + + + + View + categoryTag:Ant + + + + toolbarSeparator + + + + Draggable + + + + toolbarSeparator + + + + Draggable + + + Draggable + + + Draggable + + + toolbarSeparator + + + + Draggable + + + + toolbarSeparator + + + + toolbarSeparator + + + + Draggable + + + stretch + SHOW_RESTORE_MENU + + + Draggable + HIDEABLE + SHOW_RESTORE_MENU + + + + + stretch + + + Draggable + + + Draggable + + + + + TrimStack + Draggable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + platform:win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + platform:win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Editor + + + + + View + categoryTag:Ant + + + + + View + categoryTag:Gradle + + + + + View + categoryTag:Gradle + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Java + + + + + View + categoryTag:Git + + + + + View + categoryTag:Git + + + + + View + categoryTag:Git + + + + + View + categoryTag:Git + + + + + View + categoryTag:Git + + + + + View + categoryTag:General + + + + + View + categoryTag:Help + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Java + + + + + View + categoryTag:Java + + + + + View + categoryTag:Java + + + + + View + categoryTag:Java Browsing + + + + + View + categoryTag:Java Browsing + + + + + View + categoryTag:Java Browsing + + + + + View + categoryTag:Java Browsing + + + + + View + categoryTag:Java + + + + + View + categoryTag:General + + + + + View + categoryTag:Java + + + + + View + categoryTag:Java + + + + + View + categoryTag:Maven + + + + + View + categoryTag:Maven + + + + + View + categoryTag:Mylyn + + + + + View + categoryTag:Mylyn + + + + + View + categoryTag:Mylyn + + + + + View + categoryTag:Mylyn + + + + + View + categoryTag:Mylyn + + + + + View + categoryTag:Mylyn + + + + + View + categoryTag:Oomph + + + + + View + categoryTag:API Tools + + + + + View + categoryTag:Plug-in Development + + + + + View + categoryTag:Plug-in Development + + + + + View + categoryTag:Plug-in Development + + + + + View + categoryTag:Plug-in Development + + + + + View + categoryTag:Plug-in Development + + + + + View + categoryTag:Code Recommenders + + + + + View + categoryTag:Code Recommenders + + + + + View + categoryTag:Code Recommenders + + + + + View + categoryTag:Code Recommenders + + + + + View + categoryTag:Code Recommenders + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:CVS + + + + + View + categoryTag:CVS + + + + + View + categoryTag:Team + + + + + View + categoryTag:Team + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:Help + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:XML + + + + + View + categoryTag:XML + + + + + View + categoryTag:WindowBuilder + + + + + View + categoryTag:WindowBuilder + + + + + + + + + + glue + move_after:PerspectiveSpacer + SHOW_RESTORE_MENU + + + move_after:Spacer Glue + HIDEABLE + SHOW_RESTORE_MENU + + + glue + move_after:SearchField + SHOW_RESTORE_MENU + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache new file mode 100644 index 0000000..593f470 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache differ diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache new file mode 100644 index 0000000..593f470 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache differ diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.core/index.db b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.core/index.db new file mode 100644 index 0000000..e69de29 diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache new file mode 100644 index 0000000..593f470 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache differ diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat new file mode 100644 index 0000000..3de398e Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat differ diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml new file mode 100644 index 0000000..a4ee3cb --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml @@ -0,0 +1,2 @@ + + diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml new file mode 100644 index 0000000..9e390f5 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml @@ -0,0 +1,2 @@ + + diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml new file mode 100644 index 0000000..3af3eab --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml @@ -0,0 +1,10 @@ + +
+
+ + + + + +
+
diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.oomph.setup/workspace.setup b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.oomph.setup/workspace.setup new file mode 100644 index 0000000..1f73e14 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.oomph.setup/workspace.setup @@ -0,0 +1,6 @@ + + diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.pde.core/.cache/clean-cache.properties b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.pde.core/.cache/clean-cache.properties new file mode 100644 index 0000000..db4335f --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.pde.core/.cache/clean-cache.properties @@ -0,0 +1,2 @@ +#Cached timestamps +#Tue Dec 18 10:10:23 IST 2018 diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml new file mode 100644 index 0000000..62f4349 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml @@ -0,0 +1,6 @@ + +
+ + + +
diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.ui.intro/introstate b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.ui.intro/introstate new file mode 100644 index 0000000..236d56c --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.ui.intro/introstate @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml new file mode 100644 index 0000000..851c296 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml @@ -0,0 +1,15 @@ + +
+
+ + + + + + + + + + +
+
diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml new file mode 100644 index 0000000..b05d3eb --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/version.ini b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/version.ini new file mode 100644 index 0000000..c3729cd --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/.metadata/version.ini @@ -0,0 +1,3 @@ +#Tue Dec 18 10:08:53 IST 2018 +org.eclipse.core.runtime=2 +org.eclipse.platform=4.7.3.v20180330-0640 diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/Casual_acquaintances.java b/projects/JAVA-PROJECTS-master/Contact List Management Applet/Casual_acquaintances.java new file mode 100644 index 0000000..ed7b4ec --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/Casual_acquaintances.java @@ -0,0 +1,181 @@ +import java.io.Serializable; + +/** + * Write a description of class Casual_acquaintances here. + * + * @author (your name) + * @version (a version number or a date) + */ +@SuppressWarnings("serial") +public class Casual_acquaintances extends Contacts +{ + private String met_when; + private String met_where; + private String meeting_circumstances; + private String other_info; + + Casual_acquaintances(){ + + super(); + met_when = null; + met_where = null; + meeting_circumstances = null; + other_info = null; + } + + + + public void setmetwhen(String when){ + // try{ + if (when.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else { + //try{ + // if (met_when != null && met_when.length() >= 0){ + String appended1 = when;//met_when + when; + if (appended1.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else met_when = appended1; + //}else + // this.met_when = when; + } + /* catch (IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + //System.arraycopy(met.toCharArray(),0,meetingcontext,0,met.length()); + //this.meetingcontext = met; + //} + /*}catch(IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + } + + + public void setmetwhere(String where){ + // try{ + if (where.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else { + // try{ + // if (met_where != null && met_where.length() >= 0){ + String appended2 = where;//met_where + where; + if (appended2.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else met_where = appended2; + // }else + // this.met_where = where; + } + /* catch (IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + //System.arraycopy(met.toCharArray(),0,meetingcontext,0,met.length()); + //this.meetingcontext = met; + //} + /* }catch(IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + } + + public void setcircumstance(String circum){ + // try{ + if (circum.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else { + // try{ + // if (meeting_circumstances != null && meeting_circumstances.length() >= 0){ + String appended3 = circum;//meeting_circumstances + circum; + if (appended3.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else meeting_circumstances = appended3; + // }else + // this.meeting_circumstances = circum; + /* } + catch (IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + //System.arraycopy(met.toCharArray(),0,meetingcontext,0,met.length()); + //this.meetingcontext = met; + } + /* }catch(IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + } + + public void setinfo(String information){ + //try{ + if (information.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else { + // try{ + // if (other_info != null && other_info.length() >= 0){ + String appended4 = information;//other_info + information; + if (appended4.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else other_info = appended4; + //}else + // this.other_info = information; + /* } + catch (IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + //System.arraycopy(met.toCharArray(),0,meetingcontext,0,met.length()); + //this.meetingcontext = met; + } + /* }catch(IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + } + + + public String getmetwhen(){ + if (this.met_when == null){ + // System.out.println("Nothing to show! "); + return null; + } + else + return this.met_when; + } + + public String getmetwhere(){ + if (this.met_where == null){ + //System.out.println("Nothing to show! "); + return null; + } + else + return this.met_where; + } + + public String getcircumstance(){ + if (this.meeting_circumstances == null){ + // System.out.println("Nothing to show! "); + return null; + } + else + return this.meeting_circumstances; + } + + public String getinfo(){ + if (this.other_info == null){ + // System.out.println("Nothing to show! "); + return null; + } + else + return this.other_info; + } +} diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/Contact_app_final.java b/projects/JAVA-PROJECTS-master/Contact List Management Applet/Contact_app_final.java new file mode 100644 index 0000000..313b241 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/Contact_app_final.java @@ -0,0 +1,2002 @@ +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.ListIterator; + +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.ButtonGroup; +import javax.swing.JApplet; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.SwingConstants; +import javax.swing.event.TableModelEvent; +import javax.swing.event.TableModelListener; +import javax.swing.table.TableModel; + +public class Contact_app_final extends JApplet { + + private static ArrayList relatives = new ArrayList(); + private static ArrayList personalfriends = new ArrayList(); + private static ArrayList professionalfriends = new ArrayList(); + private static ArrayList casualacquaintances = new ArrayList(); + + private static File file = new File("save.ser"); + + private JPanel cardpanel; + private JPanel initpanel; + private JPanel paneladdcontact; + private JPanel panelAddRelative; + private JPanel panelAddPerF; + private JPanel panelAddProF; + private JPanel panelAddCA; + private JPanel paneleditcontact; + private JPanel panelEditRelative; + private JPanel panelEditPerF; + private JPanel panelEditProF; + private JPanel panelEditCA; + private JPanel panelDisplayRelative; + private JPanel panelDisplayPerF; + private JPanel panelDisplayProF; + private JPanel panelDisplayCA; + private JPanel paneldeletecontact; + private JPanel temppanel; + private JPanel paneldispcontact; + private JPanel panelsearch; + + final static String startpanel= "Options"; + final static String addcontactpanel = "Add Contact"; + final static String addrelpanel = "Add Relative"; + final static String addPerFpanel = "Add Personal friend"; + final static String addProFpanel = "Add Professional friend"; + final static String addCApanel = "Add Casual Acquaintance"; + final static String editcontactpanel = "Edit Contact"; + final static String editrelpanel = "Edit Relative"; + final static String editPerFpanel = "Edit Personal friend"; + final static String editProFpanel = "Edit Professional friend"; + final static String editCApanel = "Edit Casual Acquaintance"; + final static String deletepanel = "Delete Contact"; + final static String displaypanel = "Display Contacts"; + final static String disprelpanel = "Display Relative"; + final static String dispPerFpanel = "Display Personal friend"; + final static String dispProFpanel = "Display Professional friend"; + final static String dispCApanel = "Display Casual Acquaintance"; + final static String searchpanel = "Search"; + final static String temp = "Temp"; + + private JComboBox comboBox; + private JTable editRel; + private JTable editPerF; + private JTable editProF; + private JTable editCA; + + private JRadioButton btnRel; + private JRadioButton btnPerF; + private JRadioButton btnProF; + private JRadioButton btnCA; + + private CardLayout cl = new CardLayout(); + + public static void openFile(){ + try{ + if (!file.exists()){//if file did not exist create new file + file.createNewFile(); + } + else{//else read from already existing file + try{ + FileInputStream fout = new FileInputStream(file); + ObjectInputStream oos = new ObjectInputStream(fout); + try{ + //FileInputStream fout = new FileInputStream(file); + //ObjectInputStream oos = new ObjectInputStream(fout); + relatives = (ArrayList)oos.readObject(); + personalfriends = (ArrayList)oos.readObject(); + professionalfriends = (ArrayList)oos.readObject(); + casualacquaintances = (ArrayList)oos.readObject(); + // System.out.println("Finished Reading! "); + } + catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if (oos != null){ + oos.close(); + fout.close(); + } + }catch(IOException e){ + JOptionPane.showMessageDialog(null,"OutputStream cannot be closed","IOException",JOptionPane.ERROR_MESSAGE); + //e.printStackTrace(); + } + } + }catch(FileNotFoundException e){ + JOptionPane.showMessageDialog(null,"File was not found","FileNotFoundException",JOptionPane.ERROR_MESSAGE); + //e.printStackTrace(); + }catch(IOException e){ + JOptionPane.showMessageDialog(null,"InputStream error!","IOException",JOptionPane.ERROR_MESSAGE); + //e.printStackTrace(); + } + } + } + catch(IOException e){ + JOptionPane.showMessageDialog(null,"File cannot be opened","IOException",JOptionPane.ERROR_MESSAGE); + //e.printStackTrace(); + } + } + + + public void writeTofile(){ + FileOutputStream fout = null; + ObjectOutputStream oos = null; + try{ + fout = new FileOutputStream("save.ser"); + oos = new ObjectOutputStream(fout); + oos.writeObject(relatives); + oos.writeObject(personalfriends); + oos.writeObject(professionalfriends); + oos.writeObject(casualacquaintances); + }catch(Exception e){ + e.printStackTrace(); + }finally{ + try{ + if (oos != null){ + oos.close(); + fout.close(); + } + }catch(Exception e){ + e.printStackTrace(); + } + } + + } + /** + * Create the applet. + */ + public Contact_app_final() { + this.setSize(new Dimension(400,400)); + } + + public void init(){ + openFile(); + initialize(); + } + + public void initialize(){ + //this.setLocation(400,400); + setSize(new Dimension(400,400)); + cardpanel = new JPanel(); + cardpanel.setLayout(new CardLayout()); + + initpanel = new JPanel(); + paneladdcontact = new JPanel(); + panelAddRelative = new JPanel(); + panelAddPerF = new JPanel(); + panelAddProF = new JPanel(); + panelAddCA = new JPanel(); + paneleditcontact = new JPanel(); + panelEditRelative = new JPanel(); + panelEditPerF = new JPanel(); + panelEditProF = new JPanel(); + panelEditCA = new JPanel(); + paneldeletecontact = new JPanel(); + panelDisplayRelative = new JPanel(); + panelDisplayPerF = new JPanel(); + panelDisplayProF = new JPanel(); + panelDisplayCA = new JPanel(); + temppanel = new JPanel(); + paneldispcontact = new JPanel(); + panelsearch = new JPanel(); + + cardpanel.add(initpanel,startpanel); + cardpanel.add(paneladdcontact,addcontactpanel); + cardpanel.add(panelAddRelative,addrelpanel); + cardpanel.add(panelAddPerF,addPerFpanel); + cardpanel.add(panelAddProF,addProFpanel); + cardpanel.add(panelAddCA,addCApanel); + cardpanel.add(paneleditcontact,editcontactpanel); + cardpanel.add(panelEditRelative,editrelpanel); + cardpanel.add(panelEditPerF,editPerFpanel); + cardpanel.add(panelEditProF,editProFpanel); + cardpanel.add(panelEditCA,editCApanel); + cardpanel.add(paneldeletecontact,deletepanel); + cardpanel.add(panelDisplayRelative,disprelpanel); + cardpanel.add(panelDisplayPerF,dispPerFpanel); + cardpanel.add(panelDisplayProF,dispProFpanel); + cardpanel.add(panelDisplayCA,dispCApanel); + cardpanel.add(temppanel,temp); + cardpanel.add(paneldispcontact,displaypanel); + cardpanel.add(panelsearch,searchpanel); + + getContentPane().add(cardpanel); + cl = (CardLayout) cardpanel.getLayout(); + + init_add_contact(); + init_edit_contact(); + init_delete_contact(); + init_display_contact(); + init_search_contact(); + + initapp(); + //String list[] = {"Options","Add contact","Edit Contact","Delete Contact","Display Contacts","Search"}; + + } + + public void initapp(){ + JLabel lblNewLabel = new JLabel("Hello!"); + lblNewLabel.setBounds(174, 73, 100, 36); + lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); + lblNewLabel.setAlignmentX(lblNewLabel.CENTER_ALIGNMENT); + lblNewLabel.setFont(new Font("SansSerif", Font.BOLD, 30)); + + + JPanel pane = new JPanel(); + + + JLabel lblNote = new JLabel("Choose: "); + lblNote.setAlignmentX(lblNote.CENTER_ALIGNMENT); + lblNote.setHorizontalAlignment(SwingConstants.CENTER); + lblNote.setFont(new Font("SansSerif", Font.BOLD, 25)); + String list[] = {startpanel,addcontactpanel,editcontactpanel,deletepanel,displaypanel,searchpanel}; + pane.setLayout(new BoxLayout(pane,BoxLayout.PAGE_AXIS)); + //pane.add(lblNewLabel); + pane.add(Box.createRigidArea(new Dimension(0,150))); + //pane.add(lblNote); + //pane.add(Box.createRigidArea(new Dimension(0,50))); + + comboBox = new JComboBox(list); + comboBox.setBounds(159, 161, 137, 30); + comboBox.setSelectedIndex(0); + comboBox.setMaximumSize(new Dimension(150, 30)); + comboBox.addItemListener(startcboitemlistener); + comboBox.setAlignmentX(comboBox.CENTER_ALIGNMENT); + pane.add(comboBox); + + initpanel.setLayout(new BorderLayout()); + initpanel.add(lblNewLabel, BorderLayout.PAGE_START); + //initpanel.add(Box.createRigidArea(new Dimension(0,200))); + //initpanel.add(Box.createVerticalGlue(),BorderLayout.PAGE_START); + initpanel.add(pane,BorderLayout.CENTER); + + + cl.show(cardpanel,startpanel); + + + } + + ItemListener startcboitemlistener = new ItemListener(){ + + @Override + public void itemStateChanged(ItemEvent event) { + // TODO Auto-generated method stub + if (event.getStateChange() == ItemEvent.SELECTED){ + if (comboBox.getSelectedIndex() == 1){ + cl.show(cardpanel, addcontactpanel); + //init_add_contact(); + } + else if (comboBox.getSelectedIndex() == 2){ + cl.show(cardpanel, editcontactpanel); + //init_edit_contact(); + } + else if (comboBox.getSelectedIndex() == 3){ + cl.show(cardpanel, deletepanel); + //init_delete_contact(); + } + else if (comboBox.getSelectedIndex() == 4){ + cl.show(cardpanel, displaypanel); + //init_display_contact(); + } + else if (comboBox.getSelectedIndex() == 5){ + cl.show(cardpanel, searchpanel); + //init_search_contact(); + } + } + + + } + + }; + + + public void init_add_contact(){ + + paneladdcontact.setLayout(new BoxLayout( paneladdcontact, BoxLayout.PAGE_AXIS)); + + JRadioButton btn1 = new JRadioButton("Add new relative's contact"); + JRadioButton btn2 = new JRadioButton("Add new personal friend's's contact"); + JRadioButton btn3 = new JRadioButton("Add new professional friend's contact"); + JRadioButton btn4 = new JRadioButton("Add new casual acquaintance's contact"); + JRadioButton btn5 = new JRadioButton("BACK"); + + ButtonGroup group = new ButtonGroup(); + group.add(btn1); + group.add(btn2); + group.add(btn3); + group.add(btn4); + group.add(btn5); + + btn1.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + add_rel(); + //cl.show(cardpanel, addrelpanel); + } + + }); + + btn2.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + add_PerF(); + //cl.show(cardpanel, addPerFpanel); + } + + }); + + btn3.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + add_ProF(); + //cl.show(cardpanel, addProFpanel); + } + + }); + + btn4.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + add_CA(); + //cl.show(cardpanel, addCApanel); + } + + }); + + btn5.addActionListener(new ActionListener(){ + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + cl.show(cardpanel, startpanel); + } + }); + + paneladdcontact.add(Box.createRigidArea(new Dimension(0,15))); + paneladdcontact.add(btn1); + paneladdcontact.add(Box.createRigidArea(new Dimension(0,15))); + paneladdcontact.add(btn2); + paneladdcontact.add(Box.createRigidArea(new Dimension(0,15))); + paneladdcontact.add(btn3); + paneladdcontact.add(Box.createRigidArea(new Dimension(0,15))); + paneladdcontact.add(btn4); + paneladdcontact.add(Box.createRigidArea(new Dimension(0,15))); + paneladdcontact.add(btn5); + paneladdcontact.add(Box.createRigidArea(new Dimension(0,15))); + //cl.show(cardpanel, addcontactpanel); + + } + + public void add_rel(){ + panelAddRelative.removeAll(); + panelAddRelative.setLayout(new BoxLayout( panelAddRelative, BoxLayout.PAGE_AXIS)); + + JLabel addRelname = new JLabel("Name"); + addRelname.setAlignmentX(addRelname.CENTER_ALIGNMENT); + //addRelname.setFont(new Font("SansSerif")); + /*addRelname.setHorizontalTextPosition(JLabel.CENTER); + addRelname.setVerticalTextPosition(JLabel.CENTER);*/ + JLabel addRelmobnum = new JLabel("Mobile number"); + addRelmobnum.setAlignmentX(addRelmobnum.CENTER_ALIGNMENT); + JLabel addRelemailid = new JLabel("Email id"); + addRelemailid.setAlignmentX(addRelemailid.CENTER_ALIGNMENT); + JLabel addRelbirthday = new JLabel("Date of Birth"); + addRelbirthday.setAlignmentX(addRelbirthday.CENTER_ALIGNMENT); + JLabel addRellastmetdate = new JLabel("Last met on"); + addRellastmetdate.setAlignmentX(addRellastmetdate.CENTER_ALIGNMENT); + + JTextArea AddRelativename = new JTextArea(); + //AddRelativename.setAutoscrolls(true); + AddRelativename.setFont(new Font("Serif",Font.BOLD,14)); + AddRelativename.setLineWrap(true); + AddRelativename.setWrapStyleWord(true); + JScrollPane addrelnamescrollPane = new JScrollPane(AddRelativename,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addrelnamescrollPane.setPreferredSize(new Dimension(350,20)); + addrelnamescrollPane.setAlignmentX(addrelnamescrollPane.CENTER_ALIGNMENT); + + JTextArea AddRelativemobnum = new JTextArea(); + AddRelativemobnum.setFont(new Font("Serif",Font.BOLD,14)); + AddRelativemobnum.setLineWrap(true); + AddRelativemobnum.setWrapStyleWord(true); + JScrollPane addrelmobnumscrollPane = new JScrollPane(AddRelativemobnum,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addrelmobnumscrollPane.setPreferredSize(new Dimension(350,20)); + addrelmobnumscrollPane.setAlignmentX(addrelmobnumscrollPane.CENTER_ALIGNMENT); + + JTextArea AddRelativeemailid = new JTextArea(); + AddRelativeemailid.setFont(new Font("Serif",Font.BOLD,14)); + AddRelativeemailid.setLineWrap(true); + AddRelativeemailid.setWrapStyleWord(true); + JScrollPane addrelemailidscrollPane = new JScrollPane(AddRelativeemailid,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addrelemailidscrollPane.setPreferredSize(new Dimension(350,20)); + addrelemailidscrollPane.setAlignmentX(addrelemailidscrollPane.CENTER_ALIGNMENT); + + JTextArea AddRelativebirthday = new JTextArea(); + AddRelativebirthday.setFont(new Font("Serif",Font.BOLD,14)); + AddRelativebirthday.setLineWrap(true); + AddRelativebirthday.setWrapStyleWord(true); + JScrollPane addrelbdayscrollPane = new JScrollPane(AddRelativebirthday,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addrelbdayscrollPane.setPreferredSize(new Dimension(350,20)); + addrelbdayscrollPane.setAlignmentX(addrelbdayscrollPane.CENTER_ALIGNMENT); + + JTextArea AddRelativelastmetdate = new JTextArea(); + AddRelativelastmetdate.setFont(new Font("Serif",Font.BOLD,14)); + AddRelativelastmetdate.setLineWrap(true); + AddRelativelastmetdate.setWrapStyleWord(true); + JScrollPane addrelmetdatescrollPane = new JScrollPane(AddRelativelastmetdate,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addrelmetdatescrollPane.setPreferredSize(new Dimension(350,20)); + addrelmetdatescrollPane.setAlignmentX(addrelmetdatescrollPane.CENTER_ALIGNMENT); + + JButton addRelok = new JButton("OK"); + //add actionlistener to button + addRelok.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + Relatives newrel = new Relatives(); + newrel.setname(AddRelativename.getText()); + newrel.setmobnum(AddRelativemobnum.getText()); + newrel.setemailid(AddRelativeemailid.getText()); + newrel.setbirthday(AddRelativebirthday.getText()); + newrel.setdate(AddRelativelastmetdate.getText()); + relatives.add(newrel); + + writeTofile(); + cl.show(cardpanel, addcontactpanel); + + }}); + addRelok.setAlignmentX(addRelok.CENTER_ALIGNMENT); + + panelAddRelative.add(addRelname); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,5))); + panelAddRelative.add(addrelnamescrollPane); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,10))); + panelAddRelative.add(addRelmobnum); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,5))); + panelAddRelative.add(addrelmobnumscrollPane); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,10))); + panelAddRelative.add(addRelemailid); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,5))); + panelAddRelative.add(addrelemailidscrollPane); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,10))); + panelAddRelative.add(addRelbirthday); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,5))); + panelAddRelative.add(addrelbdayscrollPane); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,10))); + panelAddRelative.add(addRellastmetdate); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,5))); + panelAddRelative.add(addrelmetdatescrollPane); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,10))); + panelAddRelative.add(addRelok); + panelAddRelative.add(Box.createRigidArea(new Dimension(0,10))); + + cl.show(cardpanel, addrelpanel); + } + + + + public void add_PerF(){ + panelAddPerF.removeAll(); + panelAddPerF.setLayout(new BoxLayout( panelAddPerF, BoxLayout.PAGE_AXIS)); + + JLabel addPerFname = new JLabel("Name"); + addPerFname.setAlignmentX(addPerFname.CENTER_ALIGNMENT); + JLabel addPerFmobnum = new JLabel("Mobile number"); + addPerFmobnum.setAlignmentX(addPerFmobnum.CENTER_ALIGNMENT); + JLabel addPerFemailid = new JLabel("Email id"); + addPerFemailid.setAlignmentX(addPerFemailid.CENTER_ALIGNMENT); + JLabel addPerFcontext = new JLabel("Context of acquaintance"); + addPerFcontext.setAlignmentX(addPerFcontext.CENTER_ALIGNMENT); + JLabel addPerFdate = new JLabel("Met on"); + addPerFdate.setAlignmentX(addPerFdate.CENTER_ALIGNMENT); + JLabel addPerFevents = new JLabel("Specific events"); + addPerFevents.setAlignmentX(addPerFevents.CENTER_ALIGNMENT); + + JTextArea AddPerFname = new JTextArea(); + //AddRelativename.setAutoscrolls(true); + AddPerFname.setFont(new Font("Serif",Font.BOLD,14)); + AddPerFname.setLineWrap(true); + AddPerFname.setWrapStyleWord(true); + JScrollPane addPerFnamescrollPane = new JScrollPane(AddPerFname,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addPerFnamescrollPane.setPreferredSize(new Dimension(350,20)); + addPerFnamescrollPane.setAlignmentX(addPerFnamescrollPane.CENTER_ALIGNMENT); + + JTextArea AddPerFmobnum = new JTextArea(); + AddPerFmobnum.setFont(new Font("Serif",Font.BOLD,14)); + AddPerFmobnum.setLineWrap(true); + AddPerFmobnum.setWrapStyleWord(true); + JScrollPane addPerFmobnumscrollPane = new JScrollPane(AddPerFmobnum,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addPerFmobnumscrollPane.setPreferredSize(new Dimension(350,20)); + addPerFmobnumscrollPane.setAlignmentX(addPerFmobnumscrollPane.CENTER_ALIGNMENT); + + JTextArea AddPerFemailid = new JTextArea(); + AddPerFemailid.setFont(new Font("Serif",Font.BOLD,14)); + AddPerFemailid.setLineWrap(true); + AddPerFemailid.setWrapStyleWord(true); + JScrollPane addPerFemailidscrollPane = new JScrollPane(AddPerFemailid,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addPerFemailidscrollPane.setPreferredSize(new Dimension(350,20)); + addPerFemailidscrollPane.setAlignmentX(addPerFemailidscrollPane.CENTER_ALIGNMENT); + + JTextArea AddPerFcontext = new JTextArea(); + AddPerFcontext.setFont(new Font("Serif",Font.BOLD,14)); + AddPerFcontext.setLineWrap(true); + AddPerFcontext.setWrapStyleWord(true); + JScrollPane addPerFcontextscrollPane = new JScrollPane(AddPerFcontext,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addPerFcontextscrollPane.setPreferredSize(new Dimension(350,20)); + addPerFcontextscrollPane.setAlignmentX(addPerFcontextscrollPane.CENTER_ALIGNMENT); + + JTextArea AddPerFdate = new JTextArea(); + AddPerFdate.setFont(new Font("Serif",Font.BOLD,14)); + AddPerFdate.setLineWrap(true); + AddPerFdate.setWrapStyleWord(true); + JScrollPane addPerFdatescrollPane = new JScrollPane(AddPerFdate,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addPerFdatescrollPane.setPreferredSize(new Dimension(350,20)); + addPerFdatescrollPane.setAlignmentX(addPerFdatescrollPane.CENTER_ALIGNMENT); + + JTextArea AddPerFevents = new JTextArea(); + AddPerFevents.setFont(new Font("Serif",Font.BOLD,14)); + AddPerFevents.setLineWrap(true); + AddPerFevents.setWrapStyleWord(true); + JScrollPane addPerFeventscrollPane = new JScrollPane(AddPerFevents,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addPerFeventscrollPane.setPreferredSize(new Dimension(350,20)); + addPerFeventscrollPane.setAlignmentX(addPerFeventscrollPane.CENTER_ALIGNMENT); + + JButton addPerFok = new JButton("OK"); + + addPerFok.setAlignmentX(addPerFok.CENTER_ALIGNMENT); + addPerFok.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + Personal_friends newPerF = new Personal_friends(); + newPerF.setname(AddPerFname.getText()); + newPerF.setmobnum(AddPerFmobnum.getText()); + newPerF.setemailid(AddPerFemailid.getText()); + newPerF.setmetdate(AddPerFdate.getText()); + try{ + if (AddPerFcontext.getText().length() > 100) throw new Exception(); + else{ + newPerF.setmeetcontext(AddPerFcontext.getText()); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null,"Add context in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + cl.show(cardpanel, addcontactpanel); + return; + } + try{ + if (AddPerFevents.getText().length() > 100) throw new Exception(); + else{ + newPerF.setevents(AddPerFevents.getText()); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null,"Add events in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + cl.show(cardpanel, addcontactpanel); + return; + } + personalfriends.add(newPerF); + + writeTofile(); + + cl.show(cardpanel, addcontactpanel); + } + + }); + + panelAddPerF.add(addPerFname); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddPerF.add(addPerFnamescrollPane); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddPerF.add(addPerFmobnum); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddPerF.add(addPerFmobnumscrollPane); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddPerF.add(addPerFemailid); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddPerF.add(addPerFemailidscrollPane); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddPerF.add(addPerFcontext); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddPerF.add(addPerFcontextscrollPane); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddPerF.add(addPerFdate); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddPerF.add(addPerFdatescrollPane); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddPerF.add(addPerFevents); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddPerF.add(addPerFeventscrollPane); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddPerF.add(addPerFok); + panelAddPerF.add(Box.createRigidArea(new Dimension(0,10))); + + cl.show(cardpanel, addPerFpanel); + + } + public void add_ProF(){ + panelAddProF.removeAll(); + panelAddProF.setLayout(new BoxLayout( panelAddProF, BoxLayout.PAGE_AXIS)); + + JLabel addProFname = new JLabel("Name"); + addProFname.setAlignmentX(addProFname.CENTER_ALIGNMENT); + JLabel addProFmobnum = new JLabel("Mobile number"); + addProFmobnum.setAlignmentX(addProFmobnum.CENTER_ALIGNMENT); + JLabel addProFemailid = new JLabel("Email id"); + addProFemailid.setAlignmentX(addProFemailid.CENTER_ALIGNMENT); + JLabel addProFinterests = new JLabel("Common interests"); + addProFinterests.setAlignmentX(addProFinterests.CENTER_ALIGNMENT); + + + JTextArea AddProFname = new JTextArea(); + //AddRelativename.setAutoscrolls(true); + AddProFname.setFont(new Font("Serif",Font.BOLD,14)); + AddProFname.setLineWrap(true); + AddProFname.setWrapStyleWord(true); + JScrollPane addProFnamescrollPane = new JScrollPane(AddProFname,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addProFnamescrollPane.setPreferredSize(new Dimension(350,20)); + addProFnamescrollPane.setAlignmentX(addProFnamescrollPane.CENTER_ALIGNMENT); + + JTextArea AddProFmobnum = new JTextArea(); + AddProFmobnum.setFont(new Font("Serif",Font.BOLD,14)); + AddProFmobnum.setLineWrap(true); + AddProFmobnum.setWrapStyleWord(true); + JScrollPane addProFmobnumscrollPane = new JScrollPane(AddProFmobnum,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addProFmobnumscrollPane.setPreferredSize(new Dimension(350,20)); + addProFmobnumscrollPane.setAlignmentX(addProFmobnumscrollPane.CENTER_ALIGNMENT); + + JTextArea AddProFemailid = new JTextArea(); + AddProFemailid.setFont(new Font("Serif",Font.BOLD,14)); + AddProFemailid.setLineWrap(true); + AddProFemailid.setWrapStyleWord(true); + JScrollPane addProFemailidscrollPane = new JScrollPane(AddProFemailid,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addProFemailidscrollPane.setPreferredSize(new Dimension(350,20)); + addProFemailidscrollPane.setAlignmentX(addProFemailidscrollPane.CENTER_ALIGNMENT); + + JTextArea AddProFinterests = new JTextArea(); + AddProFinterests.setFont(new Font("Serif",Font.BOLD,14)); + AddProFinterests.setLineWrap(true); + AddProFinterests.setWrapStyleWord(true); + JScrollPane addProFinterestsscrollPane = new JScrollPane(AddProFinterests,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addProFinterestsscrollPane.setPreferredSize(new Dimension(350,20)); + addProFinterestsscrollPane.setAlignmentX(addProFinterestsscrollPane.CENTER_ALIGNMENT); + + JButton addProFok = new JButton("OK"); + addProFok.setAlignmentX(addProFok.CENTER_ALIGNMENT); + addProFok.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + Professional_friends newProF = new Professional_friends(); + newProF.setname(AddProFname.getText()); + newProF.setmobnum(AddProFmobnum.getText()); + newProF.setemailid(AddProFemailid.getText()); + + try{ + if (AddProFinterests.getText().length() > 100) throw new Exception(); + else{ + newProF.setinterests(AddProFinterests.getText()); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null,"Add interests in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + cl.show(cardpanel, addcontactpanel); + return; + } + + + professionalfriends.add(newProF); + + writeTofile(); + cl.show(cardpanel, addcontactpanel); + } + + }); + + panelAddProF.add(addProFname); + panelAddProF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddProF.add(addProFnamescrollPane); + panelAddProF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddProF.add(addProFmobnum); + panelAddProF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddProF.add(addProFmobnumscrollPane); + panelAddProF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddProF.add(addProFemailid); + panelAddProF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddProF.add(addProFemailidscrollPane); + panelAddProF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddProF.add(addProFinterests); + panelAddProF.add(Box.createRigidArea(new Dimension(0,5))); + panelAddProF.add(addProFinterestsscrollPane); + panelAddProF.add(Box.createRigidArea(new Dimension(0,10))); + panelAddProF.add(addProFok); + panelAddProF.add(Box.createRigidArea(new Dimension(0,10))); + + cl.show(cardpanel, addProFpanel); + + + } + public void add_CA(){ + panelAddCA.removeAll(); + panelAddCA.setLayout(new BoxLayout( panelAddCA, BoxLayout.PAGE_AXIS)); + + JLabel addCAname = new JLabel("Name"); + addCAname.setAlignmentX(addCAname.CENTER_ALIGNMENT); + JLabel addCAmobnum = new JLabel("Mobile number"); + addCAmobnum.setAlignmentX(addCAmobnum.CENTER_ALIGNMENT); + JLabel addCAemailid = new JLabel("Email id"); + addCAemailid.setAlignmentX(addCAemailid.CENTER_ALIGNMENT); + JLabel addCAwhen = new JLabel("When did you meet?"); + addCAwhen.setAlignmentX(addCAwhen.CENTER_ALIGNMENT); + JLabel addCAwhere = new JLabel("Where did you meet?"); + addCAwhere.setAlignmentX(addCAwhere.CENTER_ALIGNMENT); + JLabel addCAcircumstance = new JLabel("Under what circumstances did you meet?"); + addCAcircumstance.setAlignmentX(addCAcircumstance.CENTER_ALIGNMENT); + JLabel addCAinfo = new JLabel("Other information:"); + addCAinfo.setAlignmentX(addCAinfo.CENTER_ALIGNMENT); + + JTextArea AddCAname = new JTextArea(); + //AddRelativename.setAutoscrolls(true); + AddCAname.setFont(new Font("Serif",Font.BOLD,14)); + AddCAname.setLineWrap(true); + AddCAname.setWrapStyleWord(true); + JScrollPane addCAnamescrollPane = new JScrollPane(AddCAname,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addCAnamescrollPane.setPreferredSize(new Dimension(350,20)); + addCAnamescrollPane.setAlignmentX(addCAnamescrollPane.CENTER_ALIGNMENT); + + JTextArea AddCAmobnum = new JTextArea(); + AddCAmobnum.setFont(new Font("Serif",Font.BOLD,14)); + AddCAmobnum.setLineWrap(true); + AddCAmobnum.setWrapStyleWord(true); + JScrollPane addCAmobnumscrollPane = new JScrollPane(AddCAmobnum,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addCAmobnumscrollPane.setPreferredSize(new Dimension(350,20)); + addCAmobnumscrollPane.setAlignmentX(addCAmobnumscrollPane.CENTER_ALIGNMENT); + + JTextArea AddCAemailid = new JTextArea(); + AddCAemailid.setFont(new Font("Serif",Font.BOLD,14)); + AddCAemailid.setLineWrap(true); + AddCAemailid.setWrapStyleWord(true); + JScrollPane addCAemailidscrollPane = new JScrollPane(AddCAemailid,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addCAemailidscrollPane.setPreferredSize(new Dimension(350,20)); + addCAemailidscrollPane.setAlignmentX(addCAemailidscrollPane.CENTER_ALIGNMENT); + + JTextArea AddCAwhen = new JTextArea(); + AddCAwhen.setFont(new Font("Serif",Font.BOLD,14)); + AddCAwhen.setLineWrap(true); + AddCAwhen.setWrapStyleWord(true); + JScrollPane addCAwhenscrollPane = new JScrollPane(AddCAwhen,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addCAwhenscrollPane.setPreferredSize(new Dimension(350,20)); + addCAwhenscrollPane.setAlignmentX(addCAwhenscrollPane.CENTER_ALIGNMENT); + + JTextArea AddCAwhere = new JTextArea(); + AddCAwhere.setFont(new Font("Serif",Font.BOLD,14)); + AddCAwhere.setLineWrap(true); + AddCAwhere.setWrapStyleWord(true); + JScrollPane addCAwherescrollPane = new JScrollPane(AddCAwhere,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addCAwherescrollPane.setPreferredSize(new Dimension(350,20)); + addCAwherescrollPane.setAlignmentX(addCAwherescrollPane.CENTER_ALIGNMENT); + + JTextArea AddCAcircumstance = new JTextArea(); + AddCAcircumstance.setFont(new Font("Serif",Font.BOLD,14)); + AddCAcircumstance.setLineWrap(true); + AddCAcircumstance.setWrapStyleWord(true); + JScrollPane addCAcircumstancescrollPane = new JScrollPane(AddCAcircumstance,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addCAcircumstancescrollPane.setPreferredSize(new Dimension(350,20)); + addCAcircumstancescrollPane.setAlignmentX(addCAcircumstancescrollPane.CENTER_ALIGNMENT); + + JTextArea AddCAinfo = new JTextArea(); + AddCAinfo.setFont(new Font("Serif",Font.BOLD,14)); + AddCAinfo.setLineWrap(true); + AddCAinfo.setWrapStyleWord(true); + JScrollPane addCAinfoscrollPane = new JScrollPane(AddCAinfo,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + addCAinfoscrollPane.setPreferredSize(new Dimension(350,20)); + addCAinfoscrollPane.setAlignmentX(addCAinfoscrollPane.CENTER_ALIGNMENT); + + JButton addCAok = new JButton("OK"); + addCAok.setAlignmentX(addCAok.CENTER_ALIGNMENT); + addCAok.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + Casual_acquaintances newCA = new Casual_acquaintances(); + newCA.setname(AddCAname.getText()); + newCA.setmobnum(AddCAmobnum.getText()); + newCA.setemailid(AddCAemailid.getText()); + try{ + if (AddCAwhen.getText().length() > 100) throw new Exception(); + else{ + newCA.setmetwhen(AddCAwhen.getText()); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null,"Add 'When did you meet?' in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + cl.show(cardpanel, addcontactpanel); + return; + } + try{ + if (AddCAwhere.getText().length() > 100) throw new Exception(); + else{ + newCA.setmetwhere(AddCAwhere.getText()); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null,"Add 'Where did you meet?' in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + cl.show(cardpanel, addcontactpanel); + return; + } + try{ + if (AddCAcircumstance.getText().length() > 100) throw new Exception(); + else{ + newCA.setcircumstance(AddCAcircumstance.getText()); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null,"Add 'Under what circumstances did you meet?' in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + cl.show(cardpanel, addcontactpanel); + return; + } + try{ + if (AddCAinfo.getText().length() > 100) throw new Exception(); + else{ + newCA.setinfo(AddCAinfo.getText()); + } + }catch(Exception e){ + JOptionPane.showMessageDialog(null,"Add 'Other information:' in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + cl.show(cardpanel, addcontactpanel); + return; + } + casualacquaintances.add(newCA); + + writeTofile(); + cl.show(cardpanel, addcontactpanel); + } + + }); + + panelAddCA.add(addCAname); + panelAddCA.add(Box.createRigidArea(new Dimension(0,5))); + panelAddCA.add(addCAnamescrollPane); + panelAddCA.add(Box.createRigidArea(new Dimension(0,10))); + panelAddCA.add(addCAmobnum); + panelAddCA.add(Box.createRigidArea(new Dimension(0,5))); + panelAddCA.add(addCAmobnumscrollPane); + panelAddCA.add(Box.createRigidArea(new Dimension(0,10))); + panelAddCA.add(addCAemailid); + panelAddCA.add(Box.createRigidArea(new Dimension(0,5))); + panelAddCA.add(addCAemailidscrollPane); + panelAddCA.add(Box.createRigidArea(new Dimension(0,10))); + panelAddCA.add(addCAwhen); + panelAddCA.add(Box.createRigidArea(new Dimension(0,5))); + panelAddCA.add(addCAwhenscrollPane); + panelAddCA.add(Box.createRigidArea(new Dimension(0,10))); + panelAddCA.add(addCAwhere); + panelAddCA.add(Box.createRigidArea(new Dimension(0,5))); + panelAddCA.add(addCAwherescrollPane); + panelAddCA.add(Box.createRigidArea(new Dimension(0,10))); + panelAddCA.add(addCAcircumstance); + panelAddCA.add(Box.createRigidArea(new Dimension(0,5))); + panelAddCA.add(addCAcircumstancescrollPane); + panelAddCA.add(Box.createRigidArea(new Dimension(0,10))); + panelAddCA.add(addCAinfo); + panelAddCA.add(Box.createRigidArea(new Dimension(0,5))); + panelAddCA.add(addCAinfoscrollPane); + panelAddCA.add(Box.createRigidArea(new Dimension(0,10))); + panelAddCA.add(addCAok); + panelAddCA.add(Box.createRigidArea(new Dimension(0,10))); + + cl.show(cardpanel, addCApanel); + } + + public void init_edit_contact(){ + + JRadioButton btn1 = new JRadioButton("Edit relative's contact"); + //btn1.setAlignmentX(btn1.CENTER_ALIGNMENT); + JRadioButton btn2 = new JRadioButton("Edit personal friend's contact"); + //btn2.setAlignmentX(btn2.CENTER_ALIGNMENT); + JRadioButton btn3 = new JRadioButton("Edit professional friend's contact"); + //btn3.setAlignmentX(btn3.CENTER_ALIGNMENT); + JRadioButton btn4 = new JRadioButton("Edit casual acquaintance's contact"); + //btn4.setAlignmentX(btn4.CENTER_ALIGNMENT); + + ButtonGroup group = new ButtonGroup(); + group.add(btn1); + group.add(btn2); + group.add(btn3); + group.add(btn4); + + btn1.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + edit_rel(); + } + + }); + + btn2.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + edit_PerF(); + } + + }); + + btn3.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + edit_ProF(); + } + + }); + + btn4.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + edit_CA(); + } + + }); + + JButton btn5 = new JButton("BACK"); + btn5.addActionListener(new ActionListener(){ + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + cl.show(cardpanel, startpanel); + } + }); + + paneleditcontact.setLayout(new BoxLayout(paneleditcontact,BoxLayout.PAGE_AXIS)); + paneleditcontact.add(btn1); + paneleditcontact.add(Box.createRigidArea(new Dimension(0,60))); + paneleditcontact.add(btn2); + paneleditcontact.add(Box.createRigidArea(new Dimension(0,60))); + paneleditcontact.add(btn3); + paneleditcontact.add(Box.createRigidArea(new Dimension(0,60))); + paneleditcontact.add(btn4); + paneleditcontact.add(Box.createRigidArea(new Dimension(0,60))); + paneleditcontact.add(btn5); + //paneleditcontact.add(Box.createRigidArea(new Dimension(0,40))); + //cl.show(cardpanel, editcontactpanel); + + + + } + + public void edit_rel(){ + panelEditRelative.removeAll(); + String[] columns = {"Name","Mobile number","Email id","Date of Birth","Last met on"}; + Object[][] rows = new Object[relatives.size()][5]; + for (Contacts i:relatives){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[relatives.indexOf(i)][0] = relatives.get(relatives.indexOf(i)).getname(); + rows[relatives.indexOf(i)][1] = relatives.get(relatives.indexOf(i)).getmobnum(); + rows[relatives.indexOf(i)][2] = relatives.get(relatives.indexOf(i)).getemailid(); + rows[relatives.indexOf(i)][3] = ((Relatives)relatives.get(relatives.indexOf(i))).getbirthday(); + rows[relatives.indexOf(i)][4] = ((Relatives)relatives.get(relatives.indexOf(i))).getdate(); + + } + + editRel = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return true; + } + }; + editRel.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + editRel.setAutoCreateColumnsFromModel(true); + editRel.putClientProperty("terminateEditOnFocusLost", true); + editRel.getModel().addTableModelListener(table_event); + + JButton okbutton = new JButton("OK"); + //okbutton.setFocusable(true); + okbutton.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + //okbutton.requestFocus(); + writeTofile(); + cl.show(cardpanel, editcontactpanel); + } + + }); + + panelEditRelative.setLayout(new BorderLayout()); + panelEditRelative.add(new JScrollPane(editRel),BorderLayout.CENTER); + panelEditRelative.add(okbutton,BorderLayout.PAGE_END); + panelEditRelative.setPreferredSize(new Dimension(350,350)); + + cl.show(cardpanel,editrelpanel); + + } + public void edit_PerF(){ + panelEditPerF.removeAll(); + String[] columns = {"Name","Mobile number","Email id","Meeting Context","Date of Acquaintance","Specific events"}; + Object[][] rows = new Object[personalfriends.size()][6]; + for (Contacts i:personalfriends){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[personalfriends.indexOf(i)][0] = personalfriends.get(personalfriends.indexOf(i)).getname(); + rows[personalfriends.indexOf(i)][1] = personalfriends.get(personalfriends.indexOf(i)).getmobnum(); + rows[personalfriends.indexOf(i)][2] = personalfriends.get(personalfriends.indexOf(i)).getemailid(); + rows[personalfriends.indexOf(i)][3] = ((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getmeetcontext(); + rows[personalfriends.indexOf(i)][4] = ((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getmetdate(); + rows[personalfriends.indexOf(i)][5] = ((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getevents(); + + } + + editPerF = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return true; + } + }; + editPerF.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + editPerF.setAutoCreateColumnsFromModel(true); + editPerF.putClientProperty("terminateEditOnFocusLost", true); + editPerF.getModel().addTableModelListener(table_event); + + JButton okbutton = new JButton("OK"); + okbutton.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + writeTofile(); + cl.show(cardpanel, editcontactpanel); + } + + }); + panelEditPerF.setLayout(new BorderLayout()); + panelEditPerF.add(new JScrollPane(editPerF),BorderLayout.CENTER); + panelEditPerF.add(okbutton,BorderLayout.PAGE_END); + panelEditPerF.setPreferredSize(new Dimension(350,350)); + + cl.show(cardpanel, editPerFpanel); + + } + public void edit_ProF(){ + panelEditProF.removeAll(); + String[] columns = {"Name","Mobile number","Email id","Common interests"}; + Object[][] rows = new Object[professionalfriends.size()][4]; + for (Contacts i:professionalfriends){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[professionalfriends.indexOf(i)][0] = professionalfriends.get(professionalfriends.indexOf(i)).getname(); + rows[professionalfriends.indexOf(i)][1] = professionalfriends.get(professionalfriends.indexOf(i)).getmobnum(); + rows[professionalfriends.indexOf(i)][2] = professionalfriends.get(professionalfriends.indexOf(i)).getemailid(); + rows[professionalfriends.indexOf(i)][3] = ((Professional_friends)professionalfriends.get(professionalfriends.indexOf(i))).getinterests(); + + } + + editProF = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return true; + } + }; + editProF.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + editProF.setAutoCreateColumnsFromModel(true); + editProF.putClientProperty("terminateEditOnFocusLost", true); + editProF.getModel().addTableModelListener(table_event); + + JButton okbutton = new JButton("OK"); + okbutton.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + writeTofile(); + cl.show(cardpanel, editcontactpanel); + } + + }); + panelEditProF.setLayout(new BorderLayout()); + panelEditProF.add(new JScrollPane(editProF),BorderLayout.CENTER); + panelEditProF.add(okbutton,BorderLayout.PAGE_END); + panelEditProF.setPreferredSize(new Dimension(350,350)); + + cl.show(cardpanel,editProFpanel); + + } + public void edit_CA(){ + panelEditCA.removeAll(); + String[] columns = {"Name","Mobile number","Email id","Met When","Met Where","Meeting Circumstances","Other information"}; + Object[][] rows = new Object[casualacquaintances.size()][7]; + for (Contacts i:casualacquaintances){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[casualacquaintances.indexOf(i)][0] = casualacquaintances.get(casualacquaintances.indexOf(i)).getname(); + rows[casualacquaintances.indexOf(i)][1] = casualacquaintances.get(casualacquaintances.indexOf(i)).getmobnum(); + rows[casualacquaintances.indexOf(i)][2] = casualacquaintances.get(casualacquaintances.indexOf(i)).getemailid(); + rows[casualacquaintances.indexOf(i)][3] = ((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getmetwhen(); + rows[casualacquaintances.indexOf(i)][4] = ((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getmetwhere(); + rows[casualacquaintances.indexOf(i)][5] = ((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getcircumstance(); + rows[casualacquaintances.indexOf(i)][6] = ((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getinfo(); + } + + editCA = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return true; + } + }; + editCA.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + editCA.setAutoCreateColumnsFromModel(true); + editCA.putClientProperty("terminateEditOnFocusLost", true); + editCA.getModel().addTableModelListener(table_event); + + JButton okbutton = new JButton("OK"); + okbutton.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + writeTofile(); + cl.show(cardpanel, editcontactpanel); + } + + }); + panelEditCA.setLayout(new BorderLayout()); + panelEditCA.add(new JScrollPane(editCA),BorderLayout.CENTER); + panelEditCA.add(okbutton,BorderLayout.PAGE_END); + panelEditCA.setPreferredSize(new Dimension(350,350)); + + cl.show(cardpanel, editCApanel); + + } + + TableModelListener table_event = new TableModelListener(){ + + @Override + public void tableChanged(TableModelEvent e) { + // TODO Auto-generated method stub + int row = e.getFirstRow(); + int column = e.getColumn(); + TableModel model = (TableModel)e.getSource(); + //String columnName = model.getColumnName(column); + // Object data = model.getValueAt(row, column); + try{ + if (model.equals(editRel.getModel())){ + + Contacts temp = relatives.get(row); + switch (column){ + + case (0):{ + temp.setname((String)editRel.getValueAt(row, column)); + + break; + + } + case (1):{ + + temp.setmobnum((String)editRel.getValueAt(row, column)); + + break; + } + case (2):{ + + temp.setemailid((String)editRel.getValueAt(row, column)); + break; + } + case (3):{ + + ((Relatives)temp).setbirthday((String)editRel.getValueAt(row, column)); + break; + } + case (4):{ + + ((Relatives)temp).setdate((String)editRel.getValueAt(row, column)); + break; + } + + } + //relatives = (ArrayList)dispRel.getModel(); + writeTofile(); + //dispRel.setValueAt(data, row, column); + } + else if (model.equals(editPerF.getModel())){ + //dispPerF.setValueAt(data, row, column); + + Contacts temp = personalfriends.get(row); + switch (column){ + + case (0):{ + temp.setname((String)editPerF.getValueAt(row, column)); + + break; + + } + case (1):{ + + temp.setmobnum((String)editPerF.getValueAt(row, column)); + + break; + } + case (2):{ + + temp.setemailid((String)editPerF.getValueAt(row, column)); + break; + } + case (3):{ + try{ + if (((String)editPerF.getValueAt(row, column)).length() > 100) throw new Exception(); + else { + ((Personal_friends)temp).setmeetcontext((String)editPerF.getValueAt(row, column)); + + } + }catch(Exception ex){ + JOptionPane.showMessageDialog(null,"Add meeting context in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + } + break; + } + case (4):{ + + ((Personal_friends)temp).setmetdate((String)editPerF.getValueAt(row, column)); + break; + } + case (5):{ + try{ + if (((String)editPerF.getValueAt(row, column)).length() > 100) throw new Exception(); + else { + ((Personal_friends)temp).setevents((String)editPerF.getValueAt(row, column)); + + } + }catch(Exception ex){ + JOptionPane.showMessageDialog(null,"Add events in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + } + break; + } + } + //relatives = (ArrayList)dispRel.getModel(); + writeTofile(); + + } + else if (model.equals(editProF.getModel())){ + //dispProF.setValueAt(data, row, column); + + Contacts temp = professionalfriends.get(row); + switch (column){ + + case (0):{ + temp.setname((String)editProF.getValueAt(row, column)); + + break; + + } + case (1):{ + + temp.setmobnum((String)editProF.getValueAt(row, column)); + + break; + } + case (2):{ + + temp.setemailid((String)editProF.getValueAt(row, column)); + break; + } + case (3):{ + try{ + //if (((String)editProF.getValueAt(row, column)).length() > 100) throw new Exception(); + //else{ + + + + ((Professional_friends)temp).setinterests((String)editProF.getValueAt(row, column)); + //JOptionPane.showMessageDialog(null,"HI in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + //} + }catch(Exception ex){ + JOptionPane.showMessageDialog(null,"Add interests in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + } + break; + } + + } + //relatives = (ArrayList)dispRel.getModel(); + writeTofile(); + + } + else if (model.equals(editCA.getModel())){ + //dispCA.setValueAt(data, row, column); + + Contacts temp = casualacquaintances.get(row); + switch (column){ + + case (0):{ + temp.setname((String)editCA.getValueAt(row, column)); + + break; + + } + case (1):{ + + temp.setmobnum((String)editCA.getValueAt(row, column)); + + break; + } + case (2):{ + + temp.setemailid((String)editCA.getValueAt(row, column)); + break; + } + case (3):{ + try{ + if (((String)editCA.getValueAt(row, column)).length() > 100) throw new Exception(); + else { + ((Casual_acquaintances)temp).setmetwhen((String)editCA.getValueAt(row, column)); + + } + }catch(Exception ex){ + JOptionPane.showMessageDialog(null,"Add met when in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + } + break; + } + case (4):{ + try{ + if (((String)editCA.getValueAt(row, column)).length() > 100) throw new Exception(); + else{ + ((Casual_acquaintances)temp).setmetwhere((String)editCA.getValueAt(row, column)); + + } + }catch(Exception ex){ + JOptionPane.showMessageDialog(null,"Add met where in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + } + break; + } + case (5):{ + try{ + if (((String)editCA.getValueAt(row, column)).length() > 100) throw new Exception(); + else{ + ((Casual_acquaintances)temp).setcircumstance((String)editCA.getValueAt(row, column)); + + } + }catch(Exception ex){ + JOptionPane.showMessageDialog(null,"Add meeting circumstance in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + } + break; + } + case (6):{ + try{ + if (((String)editCA.getValueAt(row, column)).length() > 100) throw new Exception(); + else{ + ((Casual_acquaintances)temp).setinfo((String)editCA.getValueAt(row, column)); + + } + }catch(Exception ex){ + JOptionPane.showMessageDialog(null,"Add information in less than 100 characters","LENGTH EXCEEDED",JOptionPane.ERROR_MESSAGE); + + } + break; + } + } + //relatives = (ArrayList)dispRel.getModel(); + writeTofile(); + } + } + catch(Exception ex){ + System.out.println("Exception Here in table!"); + } + + writeTofile(); + + } + + }; + + + public void init_delete_contact(){ + //JRadioButton btnExtra = new JRadioButton("Choose one of the following",true); + btnRel = new JRadioButton("Delete a relative's contact",false); + btnPerF = new JRadioButton("Delete a personal friend's contact",false); + btnProF = new JRadioButton("Delete a professional friend's contact",false); + btnCA = new JRadioButton("Delete a casual acquaintance's contact",false); + + btnRel.addActionListener(deletelistener); + btnPerF.addActionListener(deletelistener); + btnProF.addActionListener(deletelistener); + btnCA.addActionListener(deletelistener); + + ButtonGroup group = new ButtonGroup(); + //group.add(btnExtra); + group.add(btnRel); + group.add(btnPerF); + group.add(btnProF); + group.add(btnCA); + + JButton delbtn = new JButton("BACK"); + delbtn.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + cl.show(cardpanel, startpanel); + } + + }); + + paneldeletecontact.setLayout(new BoxLayout(paneldeletecontact,BoxLayout.PAGE_AXIS)); + //delpanel.setPreferredSize(new Dimension(300,150)); + //delpanel.add(btnExtra); + paneldeletecontact.add(Box.createRigidArea(new Dimension(0,30))); + paneldeletecontact.add(btnRel); + paneldeletecontact.add(Box.createRigidArea(new Dimension(0,30))); + paneldeletecontact.add(btnPerF); + paneldeletecontact.add(Box.createRigidArea(new Dimension(0,30))); + paneldeletecontact.add(btnProF); + paneldeletecontact.add(Box.createRigidArea(new Dimension(0,30))); + paneldeletecontact.add(btnCA); + paneldeletecontact.add(Box.createRigidArea(new Dimension(0,30))); + paneldeletecontact.add(delbtn); + //paneldeletecontact.add(Box.createRigidArea(new Dimension(0,10))); + //cl.show(cardpanel, deletepanel); + + } + + ActionListener deletelistener = new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if (e.getSource().equals(btnRel)){ + deletecontact(relatives); + } + else if (e.getSource().equals(btnPerF)){ + deletecontact(personalfriends); + } + else if (e.getSource().equals(btnProF)){ + deletecontact(professionalfriends); + } + else if (e.getSource().equals(btnCA)){ + deletecontact(casualacquaintances); + } + } + + }; + + public void deletecontact(ArrayList contact){ + ArrayList names = new ArrayList(); + ListIterator contit = contact.listIterator(); + while (contit.hasNext()){ + names.add(contit.next().getname()); + } + + Collections.sort(names); + String[] stemp = new String[names.size()]; + stemp = names.toArray(stemp); + + JComboBox select = new JComboBox(stemp); + select.setPreferredSize(new Dimension(200,10)); + + + + temppanel.setLayout(new BoxLayout(temppanel,BoxLayout.PAGE_AXIS)); + temppanel.removeAll(); + JButton newbutton = new JButton("Delete"); + newbutton.setHorizontalAlignment(JButton.CENTER); + newbutton.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + ListIterator itnow = contact.listIterator(); + String name = (String) select.getSelectedItem(); + + while (itnow.hasNext()){ + Contacts check = new Contacts(); + try{ + check = itnow.next(); + } + catch(Exception e){ + System.out.println("HERE!"); + } + if (check.getname().equals(name)){ + try{ + select.removeItemAt(select.getSelectedIndex()); + contact.remove(check); + writeTofile(); + try{ + JOptionPane.showMessageDialog(null,"DELETED","DELETED SUCCESSFULLY!",JOptionPane.INFORMATION_MESSAGE); + break; + }catch(Exception e){ + System.out.println("Error HERE!"); + } + break; + }catch(Exception e){ + System.out.println("EXCEPTION!"); + } + + + + + if (!(itnow.hasNext())) + break; + + } + + } + cl.show(cardpanel, deletepanel); + } + + + } + ); + temppanel.removeAll(); + temppanel.add(Box.createVerticalGlue()); + temppanel.add(select); + temppanel.add(Box.createVerticalGlue()); + temppanel.add(newbutton); + newbutton.setAlignmentX(temppanel.CENTER_ALIGNMENT); + temppanel.add(Box.createVerticalGlue()); + temppanel.revalidate(); + //newframe.add(newpanel); + cl.show(cardpanel,temp); + //select.add(names); + //Object selectedvalue = JOptionPane.showInputDialog(names,names.get(0));//(null, "", "DELETE", JOptionPane.INFORMATION_MESSAGE, null, contact,"None"); + + + + } + + + public void init_display_contact(){ + JRadioButton btn1 = new JRadioButton("Display relatives contact",false); + JRadioButton btn2 = new JRadioButton("Display personal friends' contact",false); + JRadioButton btn3 = new JRadioButton("Display professional friends' contact",false); + JRadioButton btn4 = new JRadioButton("Display casual acquaintances' contact",false); + + btn1.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + disp_rel(); + } + + }); + btn2.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + disp_PerF(); + } + + }); + btn3.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + disp_ProF(); + } + + }); + btn4.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + disp_CA(); + } + + }); + + ButtonGroup group = new ButtonGroup(); + //group.add(btnExtra); + group.add(btn1); + group.add(btn2); + group.add(btn3); + group.add(btn4); + + JButton dispbtn = new JButton("BACK"); + dispbtn.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + cl.show(cardpanel, startpanel); + } + + }); + + paneldispcontact.setLayout(new BoxLayout(paneldispcontact,BoxLayout.PAGE_AXIS)); + //delpanel.setPreferredSize(new Dimension(300,150)); + //delpanel.add(btnExtra); + paneldispcontact.add(Box.createRigidArea(new Dimension(0,30))); + paneldispcontact.add(btn1); + paneldispcontact.add(Box.createRigidArea(new Dimension(0,30))); + paneldispcontact.add(btn2); + paneldispcontact.add(Box.createRigidArea(new Dimension(0,30))); + paneldispcontact.add(btn3); + paneldispcontact.add(Box.createRigidArea(new Dimension(0,30))); + paneldispcontact.add(btn4); + paneldispcontact.add(Box.createRigidArea(new Dimension(0,30))); + paneldispcontact.add(dispbtn); + //paneldispcontact.add(Box.createRigidArea(new Dimension(0,30))); + //cl.show(cardpanel, displaypanel); + + + + } + + public void disp_rel(){ + panelDisplayRelative.removeAll(); + String[] columns = {"Name","Mobile number","Email id","Date of Birth","Last met on"}; + Object[][] rows = new Object[relatives.size()][5]; + for (Contacts i:relatives){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[relatives.indexOf(i)][0] = relatives.get(relatives.indexOf(i)).getname(); + rows[relatives.indexOf(i)][1] = relatives.get(relatives.indexOf(i)).getmobnum(); + rows[relatives.indexOf(i)][2] = relatives.get(relatives.indexOf(i)).getemailid(); + rows[relatives.indexOf(i)][3] = ((Relatives)relatives.get(relatives.indexOf(i))).getbirthday(); + rows[relatives.indexOf(i)][4] = ((Relatives)relatives.get(relatives.indexOf(i))).getdate(); + + } + + JTable dispRel = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return false; + } + }; + dispRel.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + dispRel.setAutoCreateColumnsFromModel(true); + + JButton btn = new JButton("BACK"); + btn.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + cl.show(cardpanel, displaypanel); + } + + }); + + panelDisplayRelative.setLayout(new BorderLayout()); + panelDisplayRelative.add(new JScrollPane(dispRel),BorderLayout.CENTER); + panelDisplayRelative.add(btn,BorderLayout.PAGE_END); + panelDisplayRelative.setPreferredSize(new Dimension(350,350)); + + cl.show(cardpanel,disprelpanel); + + } + public void disp_PerF(){ + panelDisplayPerF.removeAll(); + String[] columns = {"Name","Mobile number","Email id","Meeting Context","Date of Acquaintance","Specific events"}; + Object[][] rows = new Object[personalfriends.size()][6]; + for (Contacts i:personalfriends){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[personalfriends.indexOf(i)][0] = personalfriends.get(personalfriends.indexOf(i)).getname(); + rows[personalfriends.indexOf(i)][1] = personalfriends.get(personalfriends.indexOf(i)).getmobnum(); + rows[personalfriends.indexOf(i)][2] = personalfriends.get(personalfriends.indexOf(i)).getemailid(); + rows[personalfriends.indexOf(i)][3] = ((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getmeetcontext(); + rows[personalfriends.indexOf(i)][4] = ((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getmetdate(); + rows[personalfriends.indexOf(i)][5] = ((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getevents(); + + } + + JTable dispPerF = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return false; + } + }; + dispPerF.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + dispPerF.setAutoCreateColumnsFromModel(true); + + JButton btn = new JButton("BACK"); + btn.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + cl.show(cardpanel, displaypanel); + } + + }); + + panelDisplayPerF.setLayout(new BorderLayout()); + panelDisplayPerF.add(new JScrollPane(dispPerF),BorderLayout.CENTER); + panelDisplayPerF.add(btn,BorderLayout.PAGE_END); + panelDisplayPerF.setPreferredSize(new Dimension(350,350)); + + cl.show(cardpanel, dispPerFpanel); + + } + public void disp_ProF(){ + panelDisplayProF.removeAll(); + String[] columns = {"Name","Mobile number","Email id","Common interests"}; + Object[][] rows = new Object[professionalfriends.size()][4]; + for (Contacts i:professionalfriends){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[professionalfriends.indexOf(i)][0] = professionalfriends.get(professionalfriends.indexOf(i)).getname(); + rows[professionalfriends.indexOf(i)][1] = professionalfriends.get(professionalfriends.indexOf(i)).getmobnum(); + rows[professionalfriends.indexOf(i)][2] = professionalfriends.get(professionalfriends.indexOf(i)).getemailid(); + rows[professionalfriends.indexOf(i)][3] = ((Professional_friends)professionalfriends.get(professionalfriends.indexOf(i))).getinterests(); + + } + + JTable dispProF = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return false; + } + }; + dispProF.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + dispProF.setAutoCreateColumnsFromModel(true); + + JButton btn = new JButton("BACK"); + btn.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + cl.show(cardpanel, displaypanel); + } + + }); + + panelDisplayProF.setLayout(new BorderLayout()); + panelDisplayProF.add(new JScrollPane(dispProF),BorderLayout.CENTER); + panelDisplayProF.add(btn,BorderLayout.PAGE_END); + panelDisplayProF.setPreferredSize(new Dimension(350,350)); + + cl.show(cardpanel, dispProFpanel); + + } + public void disp_CA(){ + panelDisplayCA.removeAll(); + String[] columns = {"Name","Mobile number","Email id","Met When","Met Where","Meeting Circumstances","Other information"}; + Object[][] rows = new Object[casualacquaintances.size()][7]; + for (Contacts i:casualacquaintances){ + //rows[relatives.indexOf(i)][0] = new Object(); + rows[casualacquaintances.indexOf(i)][0] = casualacquaintances.get(casualacquaintances.indexOf(i)).getname(); + rows[casualacquaintances.indexOf(i)][1] = casualacquaintances.get(casualacquaintances.indexOf(i)).getmobnum(); + rows[casualacquaintances.indexOf(i)][2] = casualacquaintances.get(casualacquaintances.indexOf(i)).getemailid(); + rows[casualacquaintances.indexOf(i)][3] = ((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getmetwhen(); + rows[casualacquaintances.indexOf(i)][4] = ((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getmetwhere(); + rows[casualacquaintances.indexOf(i)][5] = ((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getcircumstance(); + rows[casualacquaintances.indexOf(i)][6] = ((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getinfo(); + } + + JTable dispCA = new JTable(rows,columns){ + public boolean getScrollableTracksViewportWidth() + { + return getPreferredSize().width < getParent().getWidth(); + } + public boolean isCellEditable(int row,int col){ + return false; + } + }; + dispCA.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + dispCA.setAutoCreateColumnsFromModel(true); + + JButton btn = new JButton("BACK"); + btn.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + cl.show(cardpanel, displaypanel); + } + + }); + + panelDisplayCA.setLayout(new BorderLayout()); + panelDisplayCA.add(new JScrollPane(dispCA),BorderLayout.CENTER); + panelDisplayCA.add(btn,BorderLayout.PAGE_END); + panelDisplayCA.setPreferredSize(new Dimension(350,350)); + + cl.show(cardpanel, dispCApanel); + } + + public void init_search_contact(){ + //panelsearch.removeAll(); + JLabel search = new JLabel("Enter the name to search for"); + search.setAlignmentX(search.CENTER_ALIGNMENT); + + + JTextArea searchspace = new JTextArea(); + searchspace.setFont(new Font("Serif",Font.BOLD,14)); + searchspace.setLineWrap(true); + searchspace.setWrapStyleWord(true); + searchspace.setPreferredSize(new Dimension(350,20)); + JScrollPane searchscrollPane = new JScrollPane(searchspace,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + searchscrollPane.setPreferredSize(new Dimension(350,20)); + searchscrollPane.setAlignmentX(searchscrollPane.CENTER_ALIGNMENT); + + JTextArea resultspace = new JTextArea(); + resultspace.setEditable(false); + //resultspace.(resultspace.CENTER_ALIGNMENT); + resultspace.setFont(new Font("Serif",Font.BOLD,14)); + resultspace.setLineWrap(true); + resultspace.setWrapStyleWord(true); + //resultspace.setPreferredSize(new Dimension(350,20)); + //????resultspace.setAlignmentX(resultspace.CENTER_ALIGNMENT); + JScrollPane searchresultscrollPane = new JScrollPane(resultspace,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + searchresultscrollPane.setPreferredSize(new Dimension(350,150)); + searchresultscrollPane.setAlignmentX(searchresultscrollPane.CENTER_ALIGNMENT); + + JButton btn = new JButton("BACK"); + btn.setAlignmentX(btn.CENTER_ALIGNMENT); + btn.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + searchspace.setText(""); + resultspace.setText(""); + cl.show(cardpanel, startpanel); + } + + }); + + JButton searchbtn = new JButton("Search"); + searchbtn.setAlignmentX(searchbtn.CENTER_ALIGNMENT); + searchbtn.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + String name = searchspace.getText(); + searchspace.setText(""); + boolean searchflag = false; + + for (Contacts i:relatives){ + if (relatives.get(relatives.indexOf(i)).getname().equals(name)){ + resultspace.append("\t Relative \n"); + resultspace.append("Name: "+relatives.get(relatives.indexOf(i)).getname()+"\n"); + resultspace.append("Mobile Number: "+relatives.get(relatives.indexOf(i)).getmobnum()+"\n"); + resultspace.append("Email id: "+relatives.get(relatives.indexOf(i)).getemailid()+"\n"); + resultspace.append("Date of Birth: "+((Relatives)relatives.get(relatives.indexOf(i))).getbirthday()+"\n"); + resultspace.append("Last met on: "+((Relatives)relatives.get(relatives.indexOf(i))).getdate()+"\n"); + resultspace.append("\t--------------------------\n"); + searchflag = true; + } + } + + for (Contacts i:personalfriends){ + if (personalfriends.get(personalfriends.indexOf(i)).getname().equals(name)){ + resultspace.append("\t Personal friend \n"); + resultspace.append("Name: "+personalfriends.get(personalfriends.indexOf(i)).getname()+"\n"); + resultspace.append("Mobile number: "+personalfriends.get(personalfriends.indexOf(i)).getmobnum()+"\n"); + resultspace.append("Email id: "+personalfriends.get(personalfriends.indexOf(i)).getemailid()+"\n"); + resultspace.append("Meeting Date: "+((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getmetdate()+"\n"); + resultspace.append("Meeting context: "+((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getmeetcontext()+"\n"); + resultspace.append("Notable events: "+((Personal_friends)personalfriends.get(personalfriends.indexOf(i))).getevents()+"\n"); + resultspace.append("\t---------------------------\n"); + searchflag = true; + } + } + + for (Contacts i:professionalfriends){ + if (professionalfriends.get(professionalfriends.indexOf(i)).getname().equals(name)){ + resultspace.append("\t Professional friend \n"); + resultspace.append("Name: "+professionalfriends.get(professionalfriends.indexOf(i)).getname()+"\n"); + resultspace.append("Mobile number: "+professionalfriends.get(professionalfriends.indexOf(i)).getmobnum()+"\n"); + resultspace.append("Email id: "+professionalfriends.get(professionalfriends.indexOf(i)).getemailid()+"\n"); + resultspace.append("Common interests: "+((Professional_friends)professionalfriends.get(professionalfriends.indexOf(i))).getinterests()+"\n"); + resultspace.append("\t-----------------------------\n"); + searchflag = true; + } + } + + for (Contacts i:casualacquaintances){ + if (casualacquaintances.get(casualacquaintances.indexOf(i)).getname().equals(name)){ + resultspace.append("\t Casual acquaintance \n"); + resultspace.append("Name: "+casualacquaintances.get(casualacquaintances.indexOf(i)).getname()+"\n"); + resultspace.append("Mobile number: "+casualacquaintances.get(casualacquaintances.indexOf(i)).getmobnum()+"\n"); + resultspace.append("Email id: "+casualacquaintances.get(casualacquaintances.indexOf(i)).getemailid()+"\n"); + resultspace.append("Met when: "+((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getmetwhen()+"\n"); + resultspace.append("Met where: "+((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getmetwhere()+"\n"); + resultspace.append("Meeting circumstances: "+((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getcircumstance()+"\n"); + resultspace.append("Other information: "+((Casual_acquaintances)casualacquaintances.get(casualacquaintances.indexOf(i))).getinfo()+"\n"); + resultspace.append("\t------------------------------\n"); + searchflag = true; + } + } + + if (searchflag == false){ + resultspace.append("\t-----------------------------------\n"); + resultspace.append("\t NO RESULTS MATCHED\n"); + + } + + + } + + }); + + panelsearch.setLayout(new BoxLayout(panelsearch,BoxLayout.PAGE_AXIS)); + + panelsearch.add(Box.createVerticalGlue()); + panelsearch.add(search,panelsearch.CENTER_ALIGNMENT); + panelsearch.add(Box.createRigidArea(new Dimension(400,5))); + panelsearch.add(searchscrollPane); + panelsearch.add(Box.createRigidArea(new Dimension(400,5))); + panelsearch.add(Box.createVerticalGlue()); + panelsearch.add(searchbtn,panelsearch.CENTER_ALIGNMENT); + panelsearch.add(Box.createRigidArea(new Dimension(400,10))); + panelsearch.add(Box.createVerticalGlue()); + panelsearch.add(searchresultscrollPane); + panelsearch.add(Box.createRigidArea(new Dimension(400,5))); + panelsearch.add(btn,panelsearch.CENTER_ALIGNMENT); + panelsearch.add(Box.createRigidArea(new Dimension(400,10))); + + panelsearch.add(Box.createVerticalGlue()); + + cl.show(cardpanel, searchpanel); + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/Contacts.java b/projects/JAVA-PROJECTS-master/Contact List Management Applet/Contacts.java new file mode 100644 index 0000000..9c1bee6 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/Contacts.java @@ -0,0 +1,39 @@ +import java.io.Serializable; + +//base class for inheritance + +@SuppressWarnings("serial") +public class Contacts implements Serializable{ + protected String name; + protected String mobile_number; + protected String email_id; + + Contacts(){ + name = new String(); + mobile_number = new String(); + email_id = new String(); + + } + + + public void setname(String name){ + this.name = name; + } + public void setmobnum(String mobnum){ + this.mobile_number = mobnum; + } + public void setemailid(String id){ + this.email_id = id; + } + + public String getname(){ + return this.name; + } + public String getmobnum(){ + return this.mobile_number; + } + public String getemailid(){ + return this.email_id; + } + +} diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/Personal_friends.java b/projects/JAVA-PROJECTS-master/Contact List Management Applet/Personal_friends.java new file mode 100644 index 0000000..80b6f24 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/Personal_friends.java @@ -0,0 +1,108 @@ +import java.io.Serializable; + +//import java.util.*; + +@SuppressWarnings("serial") +public class Personal_friends extends Contacts +{ + private String meetingcontext; + private String date_of_acquaintance; + private String events; + + Personal_friends(){ + + super(); + meetingcontext = new String(); + date_of_acquaintance = new String(); + events = new String(); + } + + + + public void setmetdate(String date){ + this.date_of_acquaintance = date; + } + + public void setmeetcontext(String met){ + + // try{ + if (met.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else { + //try{ + // if (meetingcontext != null && meetingcontext.length() >= 0){ + String appended = met;/*meetingcontext + met;*/ + if (appended.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else meetingcontext = appended; + //}else + // this.meetingcontext = met; + //} + /*catch (IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + //System.arraycopy(met.toCharArray(),0,meetingcontext,0,met.length()); + //this.meetingcontext = met; + } + /* }catch(IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + } + + + public void setevents(String event){ + //try{ + if (event.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else{ + //try{ + // if (events != null && events.length() >= 0){ + String eventappend = event;// events + event; + if (eventappend.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else events = eventappend; + //}else + // this.events = event; + /*}catch(IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + System.exit(0); + }*/ + } + /* }catch(IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + } + + + + public String getmetdate(){ + return this.date_of_acquaintance; + } + + public String getmeetcontext(){ + if (this.meetingcontext == null){ + //System.out.println("Nothing to show! "); + return null; + } + else + return this.meetingcontext;//.toString(); + } + + public String getevents(){ + if (this.events == null){ + //System.out.println("Nothing to show! "); + return null; + } + else + return this.events;//.toString(); + } + +} + diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/Professional_friends.java b/projects/JAVA-PROJECTS-master/Contact List Management Applet/Professional_friends.java new file mode 100644 index 0000000..49daf0c --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/Professional_friends.java @@ -0,0 +1,60 @@ +import java.io.Serializable; + +/** + * Write a description of class Professional_friends here. + * + * @author (your name) + * @version (a version number or a date) + */ +@SuppressWarnings("serial") +public class Professional_friends extends Contacts +{ + + private String common_interests; + + Professional_friends(){ + + super(); + common_interests = new String(); + } + + + public void setinterests(String interests){ + //try{ + if (interests.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else { + // try{ + // if (common_interests != null && common_interests.length() > 0){ + String appendedinterests = interests;//common_interests + interests; + if (appendedinterests.length() > 100){ + throw new IndexOutOfBoundsException(); + } + else common_interests = appendedinterests; + // }else + // this.common_interests = interests; + /* } + catch (IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + //System.arraycopy(met.toCharArray(),0,meetingcontext,0,met.length()); + //this.meetingcontext = met; + } + /* }catch(IndexOutOfBoundsException e){ + System.out.println("Error: You cannot add more than 100 characters "); + //System.exit(0); + }*/ + } + + + public String getinterests(){ + if (this.common_interests == null){ + System.out.println("Nothing to show! "); + return null; + } + else + return this.common_interests; + } +} diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/Readme.txt b/projects/JAVA-PROJECTS-master/Contact List Management Applet/Readme.txt new file mode 100644 index 0000000..ee3189d --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/Readme.txt @@ -0,0 +1,4 @@ +---> This is an applet for the Contact List Management System. +---> Works fine on the Applet Viewer in Eclipse. +---> Currently, it does not run on the browser. +---> Needs to be modified to run on browser. diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/Readme.txt~ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/Readme.txt~ new file mode 100644 index 0000000..e69de29 diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/Relatives.java b/projects/JAVA-PROJECTS-master/Contact List Management Applet/Relatives.java new file mode 100644 index 0000000..648b59a --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/Relatives.java @@ -0,0 +1,30 @@ +import java.io.Serializable; + +@SuppressWarnings("serial") +public class Relatives extends Contacts { + private String birthday; + private String lastmetdate; + + Relatives(){ + super(); + birthday = null; + lastmetdate = null; + } + + + public void setbirthday(String bday){ + this.birthday = bday; + } + public void setdate(String date){ + this.lastmetdate = date; + } + + + public String getbirthday(){ + return this.birthday; + } + + public String getdate(){ + return this.lastmetdate; + } +} diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/applet.html b/projects/JAVA-PROJECTS-master/Contact List Management Applet/applet.html new file mode 100644 index 0000000..598fa76 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/applet.html @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/Contact List Management Applet/test.java b/projects/JAVA-PROJECTS-master/Contact List Management Applet/test.java new file mode 100644 index 0000000..62d0acc --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Contact List Management Applet/test.java @@ -0,0 +1,93 @@ + +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; + +public class test extends JFrame { + + private int currentCard = 1; + private JPanel cardPanel; + private CardLayout cl; + + public test() { + + setTitle("Card Layout Example"); + setSize(300, 150); + cardPanel = new JPanel(); + + // getContentPane().add(cardPanel); + cl = new CardLayout(); + cardPanel.setLayout(cl); + JPanel jp1 = new JPanel(); + JPanel jp2 = new JPanel(); + JPanel jp3 = new JPanel(); + JPanel jp4 = new JPanel(); + JLabel jl1 = new JLabel("Card1"); + JLabel jl2 = new JLabel("Card2"); + JLabel jl3 = new JLabel("Card3"); + JLabel jl4 = new JLabel("Card4"); + jp1.add(jl1); + jp2.add(jl2); + jp3.add(jl3); + jp4.add(jl4); + cardPanel.add(jp1, "1"); + cardPanel.add(jp2, "2"); + cardPanel.add(jp3, "3"); + cardPanel.add(jp4, "4"); + JPanel buttonPanel = new JPanel(); + JButton firstBtn = new JButton("First"); + JButton nextBtn = new JButton("Next"); + JButton previousBtn = new JButton("Previous"); + JButton lastBtn = new JButton("Last"); + buttonPanel.add(firstBtn); + buttonPanel.add(nextBtn); + buttonPanel.add(previousBtn); + buttonPanel.add(lastBtn); + + firstBtn.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + cl.first(cardPanel); + currentCard = 1; + } + }); + + lastBtn.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + cl.last(cardPanel); + currentCard = 4; + } + }); + + nextBtn.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + if (currentCard < 4) { + currentCard += 1; + cl.show(cardPanel, "" + (currentCard)); + } + } + }); + + previousBtn.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + if (currentCard > 1) { + currentCard -= 1; + cl.show(cardPanel, "" + (currentCard)); + } + } + }); + + getContentPane().add(cardPanel, BorderLayout.NORTH); + getContentPane().add(buttonPanel, BorderLayout.SOUTH); + } + public static void main(String[] args) { + test cl = new test(); + cl.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + cl.setVisible(true); + } +} + diff --git a/projects/JAVA-PROJECTS-master/Database/bin/Destination/sky.jpg b/projects/JAVA-PROJECTS-master/Database/bin/Destination/sky.jpg new file mode 100644 index 0000000..078af34 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/Destination/sky.jpg differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Alter.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Alter.class new file mode 100644 index 0000000..c8a235c Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Alter.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/BatchUpdate.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/BatchUpdate.class new file mode 100644 index 0000000..5117ac3 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/BatchUpdate.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/CallableStatement.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/CallableStatement.class new file mode 100644 index 0000000..075bd6d Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/CallableStatement.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/ConnectMysql.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/ConnectMysql.class new file mode 100644 index 0000000..4330f79 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/ConnectMysql.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/ConnectOracle.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/ConnectOracle.class new file mode 100644 index 0000000..0d1725a Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/ConnectOracle.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/ConnectionProvider.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/ConnectionProvider.class new file mode 100644 index 0000000..98eaf6c Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/ConnectionProvider.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/DatabaseMetadata.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/DatabaseMetadata.class new file mode 100644 index 0000000..b22ffdc Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/DatabaseMetadata.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Delete.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Delete.class new file mode 100644 index 0000000..6120e65 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Delete.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Insert.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Insert.class new file mode 100644 index 0000000..808cea6 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Insert.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/PreparedStatement.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/PreparedStatement.class new file mode 100644 index 0000000..84c5cff Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/PreparedStatement.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/ResultSetMetaData.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/ResultSetMetaData.class new file mode 100644 index 0000000..64883d9 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/ResultSetMetaData.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Select.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Select.class new file mode 100644 index 0000000..d9de7ff Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Select.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Test.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Test.class new file mode 100644 index 0000000..6927d1f Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Test.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/UpdatableRowsetUpdate.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/UpdatableRowsetUpdate.class new file mode 100644 index 0000000..93339bf Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/UpdatableRowsetUpdate.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Update.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Update.class new file mode 100644 index 0000000..9e1c4b9 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/database/Update.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/images/ConnectionProvider.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/images/ConnectionProvider.class new file mode 100644 index 0000000..98e2b93 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/images/ConnectionProvider.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/images/GetImage.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/images/GetImage.class new file mode 100644 index 0000000..09d87a1 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/images/GetImage.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/images/StoreImage.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/images/StoreImage.class new file mode 100644 index 0000000..7d936c6 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/images/StoreImage.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/oracle/callablestatement/ConnectOracle.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/oracle/callablestatement/ConnectOracle.class new file mode 100644 index 0000000..c9c0f3d Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/oracle/callablestatement/ConnectOracle.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/oracle/callablestatement/ConnectionProvider.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/oracle/callablestatement/ConnectionProvider.class new file mode 100644 index 0000000..88159ab Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/oracle/callablestatement/ConnectionProvider.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/oracle/callablestatement/Function.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/oracle/callablestatement/Function.class new file mode 100644 index 0000000..4a96b3c Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/oracle/callablestatement/Function.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/oracle/callablestatement/Procedure.class b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/oracle/callablestatement/Procedure.class new file mode 100644 index 0000000..fe21eb5 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/com/zensar/test/oracle/callablestatement/Procedure.class differ diff --git a/projects/JAVA-PROJECTS-master/Database/bin/resources/db.properties b/projects/JAVA-PROJECTS-master/Database/bin/resources/db.properties new file mode 100644 index 0000000..81b6a83 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/bin/resources/db.properties @@ -0,0 +1,4 @@ +Driver=com.mysql.jdbc.Driver +url=jdbc:mysql://127.0.0.1:3306/mydb +username=root +password=root \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/Database/bin/resources/oracle.properties b/projects/JAVA-PROJECTS-master/Database/bin/resources/oracle.properties new file mode 100644 index 0000000..0139adb --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/bin/resources/oracle.properties @@ -0,0 +1,4 @@ +Driver=oracle.jdbc.driver.OracleDriver +url=jdbc:oracle:thin:@localhost:1521/XE +username=system +password=zensar \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/Database/bin/source/sky.jpg b/projects/JAVA-PROJECTS-master/Database/bin/source/sky.jpg new file mode 100644 index 0000000..078af34 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/bin/source/sky.jpg differ diff --git a/projects/JAVA-PROJECTS-master/Database/src/Destination/sky.jpg b/projects/JAVA-PROJECTS-master/Database/src/Destination/sky.jpg new file mode 100644 index 0000000..078af34 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/src/Destination/sky.jpg differ diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Alter.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Alter.java new file mode 100644 index 0000000..8de0350 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Alter.java @@ -0,0 +1,41 @@ +package com.zensar.test.database; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; + +public class Alter { + + public static void main(String[] args) { + + Connection con = null; + Statement smt = null; + int count = 0; + + try { + con = ConnectionProvider.getConnection(); + + smt = con.createStatement(); + //String sql = "ALTER TABLE employee ADD PRIMARY KEY(employeeId)"; + String sql2 = "ALTER TABLE employee DROP PRIMARY KEY"; + count = smt.executeUpdate(sql2); + if (count > 0) { + System.out.println("Altered successfully"); + } else { + System.out.println("Failed to alter"); + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + if (con != null) + try { + con.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/BatchUpdate.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/BatchUpdate.java new file mode 100644 index 0000000..72c9fd3 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/BatchUpdate.java @@ -0,0 +1,58 @@ +package com.zensar.test.database; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; + +public class BatchUpdate { + + static Connection con = null; + static Statement smt = null; + static java.sql.PreparedStatement psmt = null; + + public static void main(String[] args) { + try { + String sql = "Select * from employee"; + /* + * Can not issue SELECT via executeUpdate() + */ + String sql2 = "Insert into employee values(10,\"AAA\",4000)"; + String sql3 = "Update employee set name=\"SKY\" where employeeId=10"; + String sql4 = "Delete from employe where employeeId=100"; + + con = ConnectionProvider.getConnection(); + smt = con.createStatement(); + psmt = con.prepareStatement("Insert into employee values(?,?,?)"); + + con.setAutoCommit(false); + // smt.addBatch(sql); + smt.addBatch(sql2); + smt.addBatch(sql3); + smt.addBatch(sql4); + int[] result = smt.executeBatch(); + for (int i = 0; i < result.length; i++) { + System.out.println(result[i]); + } + + psmt.setInt(1, 100); + psmt.setString(2, "BBB"); + psmt.setInt(3, 9000); + psmt.addBatch(); + psmt.executeBatch(); + + con.commit(); + System.out.println("Batch complete"); + } catch (SQLException e) { + e.printStackTrace(); + } catch (Exception e) { + } finally { + if (con != null) + try { + con.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/CallableStatement.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/CallableStatement.java new file mode 100644 index 0000000..cac6e4e --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/CallableStatement.java @@ -0,0 +1,41 @@ +package com.zensar.test.database; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class CallableStatement { + + public static void main(String[] args) { + + Connection con = null; + java.sql.CallableStatement cs = null; + ResultSet rs = null; + + try { + //String sql = "Select * from employee WHERE employeeId = ?"; + String sql = "{CALL EMPLOYEE(?)}"; + con = ConnectionProvider.getConnection(); + cs = con.prepareCall(sql); + cs.setInt(1, 2); + rs = cs.executeQuery(); + + while (rs.next() == true) { + System.out.println(rs.getInt(1) + " " + rs.getString(2) + " " + + rs.getInt(3)); + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + if (con != null) + try { + con.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/ConnectMysql.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/ConnectMysql.java new file mode 100644 index 0000000..0b7381f --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/ConnectMysql.java @@ -0,0 +1,42 @@ +package com.zensar.test.database; + +import java.sql.Connection; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.SQLException; + +public class ConnectMysql { + + public static void main(String[] args) { + + Connection con = null; + + try { + // 1st way to load class - Preferred + Class.forName("com.mysql.jdbc.Driver"); + + // 2nd way to load class - Not Preferred + // Driver d = new com.mysql.jdbc.Driver(); + // DriverManager.registerDriver(d); + + con = DriverManager.getConnection( + "jdbc:mysql://127.0.0.1:3306/mydb", "root", "root"); + + System.out.println("Connected"); + + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + if (con != null) + try { + con.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/ConnectOracle.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/ConnectOracle.java new file mode 100644 index 0000000..10f2d40 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/ConnectOracle.java @@ -0,0 +1,45 @@ +package com.zensar.test.database; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +public class ConnectOracle { + + public static void main(String[] args) { + + Connection con = null; + Statement smt = null; + ResultSet rs = null; + try { + Class.forName("oracle.jdbc.driver.OracleDriver"); + con = DriverManager.getConnection( + "jdbc:oracle:thin:@localhost:1521/XE", "system", "zensar"); + System.out.println("Connected"); + + smt = con.createStatement(); + rs = smt.executeQuery("SELECT * FROM hr.employee"); + while (rs.next()) { + System.out.println(rs.getInt(1) + " " + rs.getString(2)); + } + + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + try { + if (con != null) { + con.close(); + } + + } catch (SQLException e) { + e.printStackTrace(); + } + } + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/ConnectionProvider.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/ConnectionProvider.java new file mode 100644 index 0000000..f9a23f2 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/ConnectionProvider.java @@ -0,0 +1,40 @@ +package com.zensar.test.database; + +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Properties; + +public class ConnectionProvider { + + private static Connection con = null; + private static Properties properties = null; + + public static Connection getConnection() { + + try { + properties= new Properties(); + properties.load(new FileReader(".\\src\\resources\\db.properties")); + + String Driver = properties.getProperty("Driver"); + String url = properties.getProperty("url"); + String username = properties.getProperty("username"); + String password = properties.getProperty("password"); + + Class.forName(Driver); + con = DriverManager.getConnection(url,username,password); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (SQLException e) { + e.printStackTrace(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return con; + } +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/DatabaseMetadata.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/DatabaseMetadata.java new file mode 100644 index 0000000..e71d6fe --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/DatabaseMetadata.java @@ -0,0 +1,45 @@ +package com.zensar.test.database; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class DatabaseMetadata { + + private static Connection con = null; + + public static void main(String[] args) { + con = ConnectionProvider.getConnection(); + try { + DatabaseMetaData dbmd = con.getMetaData(); + System.out.println("Database Name: " + + dbmd.getDatabaseProductName()); + System.out.println("\nDatabase version: " + + dbmd.getDatabaseProductVersion()); + System.out.println("\nDriver Name: " + dbmd.getDriverName()); + System.out.println("\nDriver Version: " + dbmd.getDriverVersion()); + + System.out.println("\nSQL Keywords: " + dbmd.getSQLKeywords()); + ResultSet rs = dbmd.getTableTypes(); + + + System.out.println("\nTable Types: "); + while (rs.next()) { + System.out.println(rs.getString(1)); + } + + String table[] = { "TABLE", "VIEW" }; + ResultSet rs1 = dbmd.getTables(null, null, null, table); + + System.out.println("\nTables in Database:"); + while (rs1.next()) { + System.out.println(rs1.getString(3)); + } + + } catch (SQLException e) { + e.printStackTrace(); + } + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Delete.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Delete.java new file mode 100644 index 0000000..0d662a1 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Delete.java @@ -0,0 +1,42 @@ +package com.zensar.test.database; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; + +import com.zensar.test.images.ConnectionProvider; + +public class Delete { + + public static void main(String[] args) { + + Connection con = null; + Statement smt = null; + int count = 0; + + try { + con = ConnectionProvider.getConnection(); + + smt = con.createStatement(); + count = smt + .executeUpdate("DELETE FROM HR.employee WHERE employeeId=3"); + if (count > 0) { + System.out.println("Deleted successfully"); + } else { + System.out.println("Failed to delete"); + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + if (con != null) + try { + con.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Insert.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Insert.java new file mode 100644 index 0000000..e79936c --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Insert.java @@ -0,0 +1,64 @@ +package com.zensar.test.database; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Scanner; + +import com.zensar.test.images.ConnectionProvider; + +public class Insert { + + public static void main(String[] args) { + + Connection con = null; + Statement smt = null; + Scanner scanner = null; + int count = 0; + int id = 0; + String name = null; + int salary = 0; + + try { + scanner = new Scanner(System.in); + System.out.println("Enter employeeId"); + id = scanner.nextInt(); + scanner.nextLine(); + System.out.println("Enter name"); + name = scanner.nextLine(); + System.out.println("Enter salary"); + salary = scanner.nextInt(); + + con = ConnectionProvider.getConnection(); + smt = con.createStatement(); + + String query ="INSERT INTO HR.employee(employeeId,name,salary) " + + "values(" + + id + + ",'" + + name + + "'," + + salary + + ")"; + count = smt.executeUpdate(query); + if (count > 0) { + System.out.println("Inserted successfully"); + } else { + System.out.println("Failed to insert"); + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + if (con != null) + try { + con.close(); + scanner.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/PreparedStatement.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/PreparedStatement.java new file mode 100644 index 0000000..4bc3e25 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/PreparedStatement.java @@ -0,0 +1,58 @@ +package com.zensar.test.database; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.Scanner; + +public class PreparedStatement { + + public static void main(String[] args) { + + Connection con = null; + java.sql.PreparedStatement pstmt = null; + Scanner scanner = null; + int id = 0; + String name = null; + int salary = 0; + String decision = null; + + try { + do { + scanner = new Scanner(System.in); + System.out.println("Enter employeeId"); + id = scanner.nextInt(); + scanner.nextLine(); + System.out.println("Enter name"); + name = scanner.nextLine(); + System.out.println("Enter salary"); + salary = scanner.nextInt(); + con = ConnectionProvider.getConnection(); + String sql = "INSERT INTO employee(employeeId,name,salary)values(?,?,?)"; + pstmt = con.prepareStatement(sql); + pstmt.setInt(1, id); + pstmt.setString(2, name); + pstmt.setInt(3, salary); + if (pstmt.executeUpdate() != 0) { + System.out.println("Inserted successfully"); + } else { + System.out.println("Failed to insert"); + } + System.out.println("Do you wish to continue?(Y/N)"); + decision = scanner.next(); + } while (decision.equalsIgnoreCase("y")); + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + if (con != null) + try { + con.close(); + scanner.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/ResultSetMetaData.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/ResultSetMetaData.java new file mode 100644 index 0000000..6b6f6bb --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/ResultSetMetaData.java @@ -0,0 +1,42 @@ +package com.zensar.test.database; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +public class ResultSetMetaData { + + private static Connection con = null; + private static Statement smt = null; + private static ResultSet rs = null; + private static java.sql.ResultSetMetaData rsmd = null; + + public static void main(String[] args) { + con = ConnectionProvider.getConnection(); + try { + smt = con.createStatement(); + rs = smt.executeQuery("Select * from employee"); + rsmd = rs.getMetaData(); + rsmd.getColumnCount(); + + for (int i = 1; i <= rsmd.getColumnCount(); i++) { + System.out.print(rsmd.getColumnName(i) + " "); + System.out.print(rsmd.getColumnType(i) + " "); + System.out.print(rsmd.getColumnTypeName(i) + " "); + System.out.print(rsmd.getColumnDisplaySize(i) + " "); + System.out.println(rsmd.getTableName(i)); + } + while (rs.next() == true) { + for (int i = 1; i <= rsmd.getColumnCount(); i++) { + System.out.print(rs.getString(i) + " "); + } + System.out.println(); + } + + } catch (SQLException e) { + e.printStackTrace(); + } + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Select.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Select.java new file mode 100644 index 0000000..2c09119 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Select.java @@ -0,0 +1,42 @@ +package com.zensar.test.database; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + + + +public class Select { + + public static void main(String[] args) { + + Connection con = null; + Statement smt = null; + ResultSet rs = null; + + try { + con = ConnectionProvider.getConnection(); + smt = con.createStatement(); + rs = smt.executeQuery("Select * from employee"); + + while (rs.next() == true) { + System.out.println(rs.getInt(1) + " " + rs.getString(2) + " " + + rs.getInt(3)); + + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + if (con != null) + try { + con.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Test.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Test.java new file mode 100644 index 0000000..38139cf --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Test.java @@ -0,0 +1,18 @@ +package com.zensar.test.database; + +import java.sql.Connection; + +public class Test { + + public static void main(String[] args) { + Connection con = ConnectionProvider.getConnection(); + if (con == null) { + System.out.println("Not connected"); + } else { + System.out.println("Connected"); + + } + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/UpdatableRowsetUpdate.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/UpdatableRowsetUpdate.java new file mode 100644 index 0000000..533b6fd --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/UpdatableRowsetUpdate.java @@ -0,0 +1,45 @@ +package com.zensar.test.database; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +public class UpdatableRowsetUpdate { + + static Connection con = null; + static Statement smt = null; + static ResultSet rs, rs2 = null; + + public static void main(String[] args) { + System.out.println("hi"); + con = ConnectionProvider.getConnection(); + try { + smt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + + rs = smt.executeQuery("Select * from employee where employeeId=6"); + rs.next(); + rs.updateString(2, "QQQ"); + rs.updateInt(3, 5000); + rs.updateRow(); + + rs2 = smt.executeQuery("Select * from employee"); + rs2.next(); + rs2.moveToInsertRow(); + rs2.updateInt(1, 10); + rs2.updateString(2, "GGG"); + rs2.updateInt(3, 9000); + rs2.insertRow(); + + /* + * while (rs.next()) { System.out.println(rs.getInt(1) + " " + + * rs.getString(2) + " " + rs.getString(3)); } + */ + } catch (SQLException e) { + + e.printStackTrace(); + } + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Update.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Update.java new file mode 100644 index 0000000..ccc14cc --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/database/Update.java @@ -0,0 +1,42 @@ +package com.zensar.test.database; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; + +import com.zensar.test.images.ConnectionProvider; + +public class Update { + + public static void main(String[] args) { + + Connection con = null; + Statement smt = null; + int count = 0; + + try { + con = ConnectionProvider.getConnection(); + + smt = con.createStatement(); + count = smt + .executeUpdate("UPDATE HR.EMPLOYEE SET name='SKY' WHERE employeeId=1"); + if (count > 0) { + System.out.println("Updated successfully"); + } else { + System.out.println("Failed to insert"); + } + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + if (con != null) + try { + con.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/images/ConnectionProvider.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/images/ConnectionProvider.java new file mode 100644 index 0000000..405aea6 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/images/ConnectionProvider.java @@ -0,0 +1,40 @@ +package com.zensar.test.images; + +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Properties; + +public class ConnectionProvider { + + private static Connection con = null; + private static Properties properties = null; + + public static Connection getConnection() { + + try { + properties= new Properties(); + properties.load(new FileReader(".\\src\\resources\\oracle.properties")); + + String Driver = properties.getProperty("Driver"); + String url = properties.getProperty("url"); + String username = properties.getProperty("username"); + String password = properties.getProperty("password"); + + Class.forName(Driver); + con = DriverManager.getConnection(url,username,password); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (SQLException e) { + e.printStackTrace(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return con; + } +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/images/GetImage.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/images/GetImage.java new file mode 100644 index 0000000..96b2cf7 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/images/GetImage.java @@ -0,0 +1,55 @@ +package com.zensar.test.images; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class GetImage { + + public static void main(String[] args) { + + Connection con = null; + FileOutputStream file = null; + InputStream stream = null; + int i; + try { + con = ConnectionProvider.getConnection(); + String sql = "SELECT * FROM HR.IMAGE"; + PreparedStatement psmt = con.prepareStatement(sql); + ResultSet rs = psmt.executeQuery(); + + while (rs.next()) { + i = 0; + String fileName = ".\\src\\destination\\" + rs.getString(1) + + ".jpg"; + file = new FileOutputStream(fileName); + stream = rs.getBinaryStream(2); + while ((i = stream.read()) > -1) { + file.write(i); + } + } + + } catch (SQLException e) { + + e.printStackTrace(); + } catch (IOException e) { + + e.printStackTrace(); + } finally { + try { + if(con!=null){ + con.close(); + } + + } catch (SQLException e) { + e.printStackTrace(); + } + } + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/images/StoreImage.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/images/StoreImage.java new file mode 100644 index 0000000..e951340 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/images/StoreImage.java @@ -0,0 +1,52 @@ +package com.zensar.test.images; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class StoreImage { + + public static void main(String[] args) { + + Connection con = null; + try { + con = ConnectionProvider.getConnection(); + + String sql = "INSERT INTO HR.IMAGE VALUES(?,?)"; + PreparedStatement psmt = con.prepareStatement(sql); + psmt.setString(1, "sky"); + + FileInputStream fs = new FileInputStream(".\\src\\source\\sky.jpg"); + psmt.setBinaryStream(2, fs, fs.available()); + + int result = psmt.executeUpdate(); + if (result > 0) + System.out.println("Added successfully"); + else + System.out.println("Failed to add"); + + } catch (SQLException e) { + + e.printStackTrace(); + } catch (FileNotFoundException e) { + + e.printStackTrace(); + } catch (IOException e) { + + e.printStackTrace(); + } finally { + try { + if(con!=null){ + con.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + } + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/oracle/callablestatement/ConnectOracle.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/oracle/callablestatement/ConnectOracle.java new file mode 100644 index 0000000..6eaf00c --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/oracle/callablestatement/ConnectOracle.java @@ -0,0 +1,39 @@ +package com.zensar.test.oracle.callablestatement; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Types; + +public class ConnectOracle { + + public static void main(String[] args) { + + Connection con = null; + + try { + con = ConnectionProvider.getConnection(); + + String sql ="{?= call HR.FIRST_FX(?,?)}"; + java.sql.CallableStatement cs = con.prepareCall(sql); + cs.registerOutParameter(1, Types.INTEGER); + cs.registerOutParameter(3, Types.INTEGER); + cs.setInt(2, 3); + cs.execute(); + + System.out.println(cs.getInt(1)+" "+cs.getInt(3)); + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + try { + if(con!=null){ + con.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + } + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/oracle/callablestatement/ConnectionProvider.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/oracle/callablestatement/ConnectionProvider.java new file mode 100644 index 0000000..4a1ab49 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/oracle/callablestatement/ConnectionProvider.java @@ -0,0 +1,40 @@ +package com.zensar.test.oracle.callablestatement; + +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Properties; + +public class ConnectionProvider { + + private static Connection con = null; + private static Properties properties = null; + + public static Connection getConnection() { + + try { + properties= new Properties(); + properties.load(new FileReader(".\\src\\resources\\oracle.properties")); + + String Driver = properties.getProperty("Driver"); + String url = properties.getProperty("url"); + String username = properties.getProperty("username"); + String password = properties.getProperty("password"); + + Class.forName(Driver); + con = DriverManager.getConnection(url,username,password); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (SQLException e) { + e.printStackTrace(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return con; + } +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/oracle/callablestatement/Function.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/oracle/callablestatement/Function.java new file mode 100644 index 0000000..75a9b17 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/oracle/callablestatement/Function.java @@ -0,0 +1,42 @@ +package com.zensar.test.oracle.callablestatement; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Types; + +import com.zensar.test.database.ConnectionProvider; + +public class Function { + + public static void main(String[] args) { + + Connection con = null; + java.sql.CallableStatement cs = null; + + try { + String sql = "{call ADDITION(?,?,?)}"; + con = ConnectionProvider.getConnection(); + cs = con.prepareCall(sql); + cs.registerOutParameter(3, Types.INTEGER); + + cs.setInt(1, 10); + cs.setInt(2, 20); + cs.execute(); + + int result = cs.getInt(3); + System.out.println(result); + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + if (con != null) + try { + con.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/oracle/callablestatement/Procedure.java b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/oracle/callablestatement/Procedure.java new file mode 100644 index 0000000..208c8b5 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/com/zensar/test/oracle/callablestatement/Procedure.java @@ -0,0 +1,40 @@ +package com.zensar.test.oracle.callablestatement; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Types; + +public class Procedure { + + public static void main(String[] args) { + + Connection con = null; + java.sql.CallableStatement cs = null; + + try { + String sql = "{call HR.ADDITION(?,?,?)}"; + con = ConnectionProvider.getConnection(); + cs = con.prepareCall(sql); + cs.registerOutParameter(3, Types.INTEGER); + + cs.setInt(1, 10); + cs.setInt(2, 20); + cs.execute(); + + int result = cs.getInt(3); + System.out.println(result); + + } catch (SQLException e) { + e.printStackTrace(); + } finally { + if (con != null) + try { + con.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Database/src/resources/db.properties b/projects/JAVA-PROJECTS-master/Database/src/resources/db.properties new file mode 100644 index 0000000..81b6a83 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/resources/db.properties @@ -0,0 +1,4 @@ +Driver=com.mysql.jdbc.Driver +url=jdbc:mysql://127.0.0.1:3306/mydb +username=root +password=root \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/Database/src/resources/oracle.properties b/projects/JAVA-PROJECTS-master/Database/src/resources/oracle.properties new file mode 100644 index 0000000..0139adb --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Database/src/resources/oracle.properties @@ -0,0 +1,4 @@ +Driver=oracle.jdbc.driver.OracleDriver +url=jdbc:oracle:thin:@localhost:1521/XE +username=system +password=zensar \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/Database/src/source/sky.jpg b/projects/JAVA-PROJECTS-master/Database/src/source/sky.jpg new file mode 100644 index 0000000..078af34 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Database/src/source/sky.jpg differ diff --git a/projects/JAVA-PROJECTS-master/DynamicPolymorphism/bin/Circle.class b/projects/JAVA-PROJECTS-master/DynamicPolymorphism/bin/Circle.class new file mode 100644 index 0000000..65305d1 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/DynamicPolymorphism/bin/Circle.class differ diff --git a/projects/JAVA-PROJECTS-master/DynamicPolymorphism/bin/Client.class b/projects/JAVA-PROJECTS-master/DynamicPolymorphism/bin/Client.class new file mode 100644 index 0000000..111b933 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/DynamicPolymorphism/bin/Client.class differ diff --git a/projects/JAVA-PROJECTS-master/DynamicPolymorphism/bin/Rectangle.class b/projects/JAVA-PROJECTS-master/DynamicPolymorphism/bin/Rectangle.class new file mode 100644 index 0000000..133f8ed Binary files /dev/null and b/projects/JAVA-PROJECTS-master/DynamicPolymorphism/bin/Rectangle.class differ diff --git a/projects/JAVA-PROJECTS-master/DynamicPolymorphism/bin/Shape.class b/projects/JAVA-PROJECTS-master/DynamicPolymorphism/bin/Shape.class new file mode 100644 index 0000000..432be3b Binary files /dev/null and b/projects/JAVA-PROJECTS-master/DynamicPolymorphism/bin/Shape.class differ diff --git a/projects/JAVA-PROJECTS-master/DynamicPolymorphism/src/Circle.java b/projects/JAVA-PROJECTS-master/DynamicPolymorphism/src/Circle.java new file mode 100644 index 0000000..44fe1a8 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/DynamicPolymorphism/src/Circle.java @@ -0,0 +1,30 @@ +public class Circle extends Shape { + + private double radius; + private final double pi = 3.14; + + + public Circle() { + super(); + radius=0; + } + + public Circle(double radius) { + super(); + this.radius = radius; + } + + public double getRadius() { + return radius; + } + + public void setRadius(double radius) { + this.radius = radius; + } + + @Override + public double area() { + return pi * radius * radius; + } + +} diff --git a/projects/JAVA-PROJECTS-master/DynamicPolymorphism/src/Client.java b/projects/JAVA-PROJECTS-master/DynamicPolymorphism/src/Client.java new file mode 100644 index 0000000..21e0e7e --- /dev/null +++ b/projects/JAVA-PROJECTS-master/DynamicPolymorphism/src/Client.java @@ -0,0 +1,25 @@ +import java.util.Scanner; + +public class Client { + + public static double area(Shape s) { + return s.area(); + } + + public static void main(String[] args) { + + Scanner s = new Scanner(System.in); + Shape shape; + + System.out.println("Enter radius of circle"); + + shape = new Circle(s.nextDouble()); + System.out.println(Client.area(shape)); + + System.out.println("Enter length and width"); + shape = new Rectangle(s.nextDouble(), s.nextDouble()); + System.out.println(Client.area(shape)); + + } + +} diff --git a/projects/JAVA-PROJECTS-master/DynamicPolymorphism/src/Rectangle.java b/projects/JAVA-PROJECTS-master/DynamicPolymorphism/src/Rectangle.java new file mode 100644 index 0000000..f0afb80 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/DynamicPolymorphism/src/Rectangle.java @@ -0,0 +1,46 @@ +public class Rectangle extends Shape { + + private double length; + private double width; + + + public Rectangle() { + super(); + length=0; + width=0; + } + + + public Rectangle(double length, double width) { + super(); + this.length = length; + this.width = width; + } + + + public double getLength() { + return length; + } + + + public void setLength(double length) { + this.length = length; + } + + + public double getWidth() { + return width; + } + + + public void setWidth(double width) { + this.width = width; + } + + + @Override + public double area() { + return length * width; + } + +} diff --git a/projects/JAVA-PROJECTS-master/DynamicPolymorphism/src/Shape.java b/projects/JAVA-PROJECTS-master/DynamicPolymorphism/src/Shape.java new file mode 100644 index 0000000..fa6a300 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/DynamicPolymorphism/src/Shape.java @@ -0,0 +1,6 @@ + +public abstract class Shape { + + + public abstract double area(); +} diff --git a/projects/JAVA-PROJECTS-master/Employee/bin/com/zensar/training/Client.class b/projects/JAVA-PROJECTS-master/Employee/bin/com/zensar/training/Client.class new file mode 100644 index 0000000..2581f70 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Employee/bin/com/zensar/training/Client.class differ diff --git a/projects/JAVA-PROJECTS-master/Employee/bin/com/zensar/training/Employee.class b/projects/JAVA-PROJECTS-master/Employee/bin/com/zensar/training/Employee.class new file mode 100644 index 0000000..cad8407 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Employee/bin/com/zensar/training/Employee.class differ diff --git a/projects/JAVA-PROJECTS-master/Employee/bin/com/zensar/training/SalesPerson.class b/projects/JAVA-PROJECTS-master/Employee/bin/com/zensar/training/SalesPerson.class new file mode 100644 index 0000000..501fcd5 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Employee/bin/com/zensar/training/SalesPerson.class differ diff --git a/projects/JAVA-PROJECTS-master/Employee/bin/com/zensar/training/WageEmployee.class b/projects/JAVA-PROJECTS-master/Employee/bin/com/zensar/training/WageEmployee.class new file mode 100644 index 0000000..3f5e6e1 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Employee/bin/com/zensar/training/WageEmployee.class differ diff --git a/projects/JAVA-PROJECTS-master/Employee/src/com/zensar/training/Client.java b/projects/JAVA-PROJECTS-master/Employee/src/com/zensar/training/Client.java new file mode 100644 index 0000000..65fb542 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Employee/src/com/zensar/training/Client.java @@ -0,0 +1,27 @@ +package com.zensar.training; + +public class Client { + + public static void main(String[] args) { + Employee employee = new Employee(47178, "Akash Pal", 0); + //System.out.println(employee); + employee.display(); + + WageEmployee wageEmployee = new WageEmployee(2, "BBB", 0, 9, 100); + //System.out.println(wageEmployee); + + SalesPerson salesPerson = new SalesPerson(1, "AAA", 0, 10, 50, 20); + //System.out.println(salesPerson); + + WageEmployee e = new WageEmployee(2, "BBB", 0, 9, 100); + Employee emp = e; + emp.display(); + //this.display(); + + //System.out.println('a'=='b'); + + + } + +} + \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/Employee/src/com/zensar/training/Employee.java b/projects/JAVA-PROJECTS-master/Employee/src/com/zensar/training/Employee.java new file mode 100644 index 0000000..36b3d6a --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Employee/src/com/zensar/training/Employee.java @@ -0,0 +1,58 @@ +package com.zensar.training; + +public class Employee { + + private int employeeId; + private String employeeName; + private double employeeSalary; + + Employee() { + + } + + public Employee(int employeeId, String employeeName, double employeeSalary) { + this.employeeId = employeeId; + this.employeeName = employeeName; + this.employeeSalary = employeeSalary; + } + + public int getEmployeeId() { + return employeeId; + } + + public void setEmployeeId(int employeeId) { + this.employeeId = employeeId; + } + + public String getEmployeeName() { + return employeeName; + } + + public void setEmployeeName(String employeeName) { + this.employeeName = employeeName; + } + + public double getEmployeeSalary() { + return employeeSalary; + } + + public void setEmployeeSalary(double employeeSalary) { + this.employeeSalary = employeeSalary; + } + + @Override + public String toString() { + return "employeeId=" + employeeId + ", employeeName=" + employeeName + + " " + " Salary=" + this.calculateSalary(); + } + + public double calculateSalary() { + return 0; + } + + public void display() + { + System.out.println("Employee method"); + } + +} diff --git a/projects/JAVA-PROJECTS-master/Employee/src/com/zensar/training/SalesPerson.java b/projects/JAVA-PROJECTS-master/Employee/src/com/zensar/training/SalesPerson.java new file mode 100644 index 0000000..3c2d329 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Employee/src/com/zensar/training/SalesPerson.java @@ -0,0 +1,28 @@ +package com.zensar.training; + +public class SalesPerson extends WageEmployee { + + private double commission; + + public SalesPerson() { + super(); + } + + public SalesPerson(int employeeId, String employeeName, + double employeeSalary, int noOfHoursWorked, double ratePerHour, + double commission) { + super(employeeId, employeeName, employeeSalary, noOfHoursWorked, + ratePerHour); + this.commission = commission; + } + + public double calculateSalary() { + return getNoOfHoursWorked() * getRatePerHour() * commission; + } + + @Override + public String toString() { + return super.toString() + " commission=" + commission; + } + +} diff --git a/projects/JAVA-PROJECTS-master/Employee/src/com/zensar/training/WageEmployee.java b/projects/JAVA-PROJECTS-master/Employee/src/com/zensar/training/WageEmployee.java new file mode 100644 index 0000000..520c76b --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Employee/src/com/zensar/training/WageEmployee.java @@ -0,0 +1,52 @@ +package com.zensar.training; + +public class WageEmployee extends Employee { + + private int noOfHoursWorked; + private double ratePerHour; + + public WageEmployee() { + super(); + } + + public WageEmployee(int employeeId, String employeeName, + double employeeSalary, int noOfHoursWorked, double ratePerHour) { + super(employeeId, employeeName, employeeSalary); + this.noOfHoursWorked = noOfHoursWorked; + this.ratePerHour = ratePerHour; + } + + + public int getNoOfHoursWorked() { + return noOfHoursWorked; + } + + public void setNoOfHoursWorked(int noOfHoursWorked) { + this.noOfHoursWorked = noOfHoursWorked; + } + + public double getRatePerHour() { + return ratePerHour; + } + + public void setRatePerHour(double ratePerHour) { + this.ratePerHour = ratePerHour; + } + + public double calculateSalary() { + return noOfHoursWorked * ratePerHour; + } + + @Override + public String toString() { + return super.toString() + " noOfHoursWorked= " + noOfHoursWorked + + ", ratePerHour=" + ratePerHour + ""; + } + + public void display() + { + System.out.println(this); + System.out.println("Wage Employee method"); + } + +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/banking/Account.class b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/banking/Account.class new file mode 100644 index 0000000..cf5327e Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/banking/Account.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/banking/Customer.class b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/banking/Customer.class new file mode 100644 index 0000000..d1b016a Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/banking/Customer.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/banking/Test.class b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/banking/Test.class new file mode 100644 index 0000000..daa1bbf Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/banking/Test.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/interrupt/InterruptDemo.class b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/interrupt/InterruptDemo.class new file mode 100644 index 0000000..c2c8d03 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/interrupt/InterruptDemo.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/interrupt/MyThread.class b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/interrupt/MyThread.class new file mode 100644 index 0000000..9747b90 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/interrupt/MyThread.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/interthreadcommunication/ThreadA.class b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/interthreadcommunication/ThreadA.class new file mode 100644 index 0000000..7fbe93b Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/interthreadcommunication/ThreadA.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/interthreadcommunication/ThreadB.class b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/interthreadcommunication/ThreadB.class new file mode 100644 index 0000000..773df95 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/interthreadcommunication/ThreadB.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/joining/MyThread.class b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/joining/MyThread.class new file mode 100644 index 0000000..ee1a82b Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/joining/MyThread.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/joining/TheadJoinDemo.class b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/joining/TheadJoinDemo.class new file mode 100644 index 0000000..44a0b4f Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/joining/TheadJoinDemo.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/sleeping/Test.class b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/sleeping/Test.class new file mode 100644 index 0000000..8281a0c Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/sleeping/Test.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/synchronizedmethod/Display.class b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/synchronizedmethod/Display.class new file mode 100644 index 0000000..27c6a5f Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/synchronizedmethod/Display.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/synchronizedmethod/MyThread.class b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/synchronizedmethod/MyThread.class new file mode 100644 index 0000000..bd3a2ff Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/synchronizedmethod/MyThread.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/synchronizedmethod/Test.class b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/synchronizedmethod/Test.class new file mode 100644 index 0000000..f8388fb Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/synchronizedmethod/Test.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/yielding/MyThread.class b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/yielding/MyThread.class new file mode 100644 index 0000000..bef1294 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/yielding/MyThread.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/yielding/Snippet.class b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/yielding/Snippet.class new file mode 100644 index 0000000..a1f97b7 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/bin/yielding/Snippet.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/banking/Account.java b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/banking/Account.java new file mode 100644 index 0000000..3875190 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/banking/Account.java @@ -0,0 +1,37 @@ +package banking; + +public class Account { + + int balance; + + public int getBalance() { + return balance; + } + + public void setBalance(int balance) { + this.balance = balance; + } + + public synchronized void withdraw(int amount) { + if (amount > balance) { + System.out.println("Insufficient balance"); + try { + wait(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + balance = balance - amount; + System.out.println("Amount withdrawn " + amount); + System.out.println("Balance " + balance); + + } + } + + public synchronized void deposit(int amount) { + balance = balance + amount; + System.out.println("Amount deposited " + amount); + System.out.println("Balance " + balance); + notify(); + } +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/banking/Customer.java b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/banking/Customer.java new file mode 100644 index 0000000..ffd6674 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/banking/Customer.java @@ -0,0 +1,23 @@ +package banking; + +public class Customer extends Thread { + + Account account = null; + int amount = 0; + + Customer(String type, Account account, int amount) { + super(type); + this.account = account; + this.amount = amount; + } + + @Override + public void run() { + if (Thread.currentThread().getName().equalsIgnoreCase("deposit")) { + account.deposit(amount); + } else if (Thread.currentThread().getName() + .equalsIgnoreCase("withdraw")) { + account.withdraw(amount); + } + } +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/banking/Test.java b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/banking/Test.java new file mode 100644 index 0000000..f6491ba --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/banking/Test.java @@ -0,0 +1,15 @@ +package banking; + +public class Test { + + public static void main(String[] args) { + + final Account account = new Account(); + account.setBalance(9000); + + Thread c1 = new Customer("withdraw", account, 10000); + Thread c2 = new Customer("deposit", account, 5000); + c1.start(); + c2.start(); + } +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/interrupt/InterruptDemo.java b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/interrupt/InterruptDemo.java new file mode 100644 index 0000000..09f8d8d --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/interrupt/InterruptDemo.java @@ -0,0 +1,16 @@ +package interrupt; + +/** + * @author trg + * + */ +public class InterruptDemo { + + public static void main(String[] args) { + MyThread t = new MyThread(); + t.start(); + t.interrupt(); + System.out.println("End of main"); + } + +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/interrupt/MyThread.java b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/interrupt/MyThread.java new file mode 100644 index 0000000..3f61f4b --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/interrupt/MyThread.java @@ -0,0 +1,17 @@ +package interrupt; + +public class MyThread extends Thread { + + @Override + public void run() { + super.run(); + for (int i = 1; i <= 10; i++) { + try { + System.out.println("Lazy thread"); + Thread.sleep(5000); + } catch (Exception e) { + System.out.println("Interrupted"); + } + } + } +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/interthreadcommunication/ThreadA.java b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/interthreadcommunication/ThreadA.java new file mode 100644 index 0000000..3724025 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/interthreadcommunication/ThreadA.java @@ -0,0 +1,16 @@ +package interthreadcommunication; + +public class ThreadA extends Thread { + public static void main(String[] args) throws InterruptedException { + ThreadB b = new ThreadB(); + b.start(); + //Thread.sleep(2000); + + synchronized (b) { + System.out.println("Main thread trying to call wait"); + b.wait(1000); + System.out.println("Main thread got notification"); + System.out.println(b.total); + } + } +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/interthreadcommunication/ThreadB.java b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/interthreadcommunication/ThreadB.java new file mode 100644 index 0000000..f8c55bf --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/interthreadcommunication/ThreadB.java @@ -0,0 +1,16 @@ +package interthreadcommunication; + +public class ThreadB extends ThreadA { + int total = 0; + + public void run() { + synchronized (this) { + System.out.println("Child Thread Starts notification"); + for (int i = 1; i <= 10; i++) { + total += i; + } + System.out.println("Child thread trying to give notification"); + this.notify(); + } + } +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/joining/MyThread.java b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/joining/MyThread.java new file mode 100644 index 0000000..656f2fd --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/joining/MyThread.java @@ -0,0 +1,18 @@ +package joining; + +public class MyThread extends Thread { + + @Override + public void run() { + super.run(); + for (int i = 1; i <= 10; i++) { + System.out.println("Child"); + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/joining/TheadJoinDemo.java b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/joining/TheadJoinDemo.java new file mode 100644 index 0000000..d84b5b7 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/joining/TheadJoinDemo.java @@ -0,0 +1,14 @@ +package joining; + +public class TheadJoinDemo { + public static void main(String[] args) throws InterruptedException { + MyThread t1 = new MyThread(); + t1.start(); + t1.join(); + + for (int i = 1; i < 10; i++) { + System.out.println("Main"); + } + } + +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/sleeping/Test.java b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/sleeping/Test.java new file mode 100644 index 0000000..afd4ba6 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/sleeping/Test.java @@ -0,0 +1,20 @@ +package sleeping; + +public class Test { + + + public static void main(String[] args) { + try { + System.out.println("hi"); + Thread.sleep(2000); + System.out.println("hello"); + Thread.sleep(2000); + System.out.println("bye"); + Thread.sleep(2000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/synchronizedmethod/Display.java b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/synchronizedmethod/Display.java new file mode 100644 index 0000000..6175724 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/synchronizedmethod/Display.java @@ -0,0 +1,17 @@ +package synchronizedmethod; + +public class Display { + + + public synchronized void print(String name){ + for (int i = 0; i < 10; i++) { + System.out.print("Hello: "); + try { + Thread.sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + } + System.out.println(name); + } + } +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/synchronizedmethod/MyThread.java b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/synchronizedmethod/MyThread.java new file mode 100644 index 0000000..c6a7d8a --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/synchronizedmethod/MyThread.java @@ -0,0 +1,18 @@ +package synchronizedmethod; + +public class MyThread extends Thread { + + Display d; + String name; + + public MyThread(Display d, String name) { + super(); + this.d = d; + this.name = name; + } + + @Override + public void run() { + d.print(name); + } +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/synchronizedmethod/Test.java b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/synchronizedmethod/Test.java new file mode 100644 index 0000000..eb603c5 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/synchronizedmethod/Test.java @@ -0,0 +1,14 @@ +package synchronizedmethod; + +public class Test { + + + public static void main(String[] args) { + Display d = new Display(); + MyThread t1 = new MyThread(d, "AKASH"); + MyThread t2 = new MyThread(d, "SKY"); + t1.start(); + t2.start(); + } + +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/yielding/MyThread.java b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/yielding/MyThread.java new file mode 100644 index 0000000..981778a --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/yielding/MyThread.java @@ -0,0 +1,15 @@ +package yielding; + +public class MyThread extends Thread { + + @Override + public void run() { + super.run(); + for (int i = 1; i <= 10; i++) { + + Thread.yield(); + System.out.println("Child"); + + } + } +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/yielding/Snippet.java b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/yielding/Snippet.java new file mode 100644 index 0000000..61ddde2 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading 27-1-16/src/yielding/Snippet.java @@ -0,0 +1,17 @@ +package yielding; + + +public class Snippet { + public static void main(String[] args) { + + Thread t = new MyThread(); + t.start(); + Thread.yield(); + + for (int i = 1; i <= 10; i++) { + + System.out.println("Main Thread"); + } + } +} + diff --git a/projects/JAVA-PROJECTS-master/Multithreading/bin/banking/Account.class b/projects/JAVA-PROJECTS-master/Multithreading/bin/banking/Account.class new file mode 100644 index 0000000..379bbc5 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading/bin/banking/Account.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading/bin/banking/Customer.class b/projects/JAVA-PROJECTS-master/Multithreading/bin/banking/Customer.class new file mode 100644 index 0000000..d1b016a Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading/bin/banking/Customer.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading/bin/banking/Test.class b/projects/JAVA-PROJECTS-master/Multithreading/bin/banking/Test.class new file mode 100644 index 0000000..daa1bbf Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading/bin/banking/Test.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading/bin/synchronizedmethod/Display.class b/projects/JAVA-PROJECTS-master/Multithreading/bin/synchronizedmethod/Display.class new file mode 100644 index 0000000..032d655 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading/bin/synchronizedmethod/Display.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading/bin/synchronizedmethod/MyThread.class b/projects/JAVA-PROJECTS-master/Multithreading/bin/synchronizedmethod/MyThread.class new file mode 100644 index 0000000..c9d6ee3 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading/bin/synchronizedmethod/MyThread.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading/bin/synchronizedmethod/SynchronizedDemo.class b/projects/JAVA-PROJECTS-master/Multithreading/bin/synchronizedmethod/SynchronizedDemo.class new file mode 100644 index 0000000..af91d02 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Multithreading/bin/synchronizedmethod/SynchronizedDemo.class differ diff --git a/projects/JAVA-PROJECTS-master/Multithreading/src/banking/Account.java b/projects/JAVA-PROJECTS-master/Multithreading/src/banking/Account.java new file mode 100644 index 0000000..e7c4838 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading/src/banking/Account.java @@ -0,0 +1,44 @@ +package banking; + +public class Account { + + int balance; + + public int getBalance() { + return balance; + } + + public void setBalance(int balance) { + this.balance = balance; + } + + public void transaction() { + synchronized (this) { + + + } + } + + public synchronized void withdraw(int amount) { + if (amount > balance) { + System.out.println("Insufficient balance"); + try { + wait(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + balance = balance - amount; + System.out.println("Amount withdrawn " + amount); + System.out.println("Balance " + balance); + + } + } + + public synchronized void deposit(int amount) { + balance = balance + amount; + System.out.println("Amount deposited " + amount); + System.out.println("Balance " + balance); + notify(); + } +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading/src/banking/Customer.java b/projects/JAVA-PROJECTS-master/Multithreading/src/banking/Customer.java new file mode 100644 index 0000000..ffd6674 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading/src/banking/Customer.java @@ -0,0 +1,23 @@ +package banking; + +public class Customer extends Thread { + + Account account = null; + int amount = 0; + + Customer(String type, Account account, int amount) { + super(type); + this.account = account; + this.amount = amount; + } + + @Override + public void run() { + if (Thread.currentThread().getName().equalsIgnoreCase("deposit")) { + account.deposit(amount); + } else if (Thread.currentThread().getName() + .equalsIgnoreCase("withdraw")) { + account.withdraw(amount); + } + } +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading/src/banking/Test.java b/projects/JAVA-PROJECTS-master/Multithreading/src/banking/Test.java new file mode 100644 index 0000000..f6491ba --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading/src/banking/Test.java @@ -0,0 +1,15 @@ +package banking; + +public class Test { + + public static void main(String[] args) { + + final Account account = new Account(); + account.setBalance(9000); + + Thread c1 = new Customer("withdraw", account, 10000); + Thread c2 = new Customer("deposit", account, 5000); + c1.start(); + c2.start(); + } +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading/src/synchronizedmethod/Display.java b/projects/JAVA-PROJECTS-master/Multithreading/src/synchronizedmethod/Display.java new file mode 100644 index 0000000..5b72b69 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading/src/synchronizedmethod/Display.java @@ -0,0 +1,18 @@ +package synchronizedmethod; + +public class Display { + + public synchronized void wish(String name) { + for (int i = 1; i <= 10; i++) { + System.out.print("Good morning:"); + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + + } + + System.out.println(name); + + } + } +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading/src/synchronizedmethod/MyThread.java b/projects/JAVA-PROJECTS-master/Multithreading/src/synchronizedmethod/MyThread.java new file mode 100644 index 0000000..e908d3f --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading/src/synchronizedmethod/MyThread.java @@ -0,0 +1,16 @@ +package synchronizedmethod; + +public class MyThread extends Thread { + Display d; + String name; + + public MyThread(Display d, String name) { + super(); + this.d = d; + this.name = name; + } + @Override + public void run() { + d.wish(name); + } +} diff --git a/projects/JAVA-PROJECTS-master/Multithreading/src/synchronizedmethod/SynchronizedDemo.java b/projects/JAVA-PROJECTS-master/Multithreading/src/synchronizedmethod/SynchronizedDemo.java new file mode 100644 index 0000000..e2ed005 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Multithreading/src/synchronizedmethod/SynchronizedDemo.java @@ -0,0 +1,16 @@ +package synchronizedmethod; + +public class SynchronizedDemo { + + public static void main(String[] args) { + Display d1 = new Display(); + Display d2 = new Display(); + + Thread t1 = new MyThread(d1, "AKASH"); + Thread t2 = new MyThread(d1, "AVINANDAN"); + + t1.start(); + t2.start(); + } + +} diff --git a/projects/JAVA-PROJECTS-master/PHOTO_ALBUM/Readme.txt b/projects/JAVA-PROJECTS-master/PHOTO_ALBUM/Readme.txt new file mode 100644 index 0000000..1298863 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/PHOTO_ALBUM/Readme.txt @@ -0,0 +1,4 @@ +//Java swing application PHOTO ALBUM created as part of Software Lab Assignment, Spring 2016 +//It can load and display upto 10 photos at a time +//User can also add Title to the photo and some text about it +//Further modifications possible--- add options for saving and deleting, option for slideshow \ No newline at end of file diff --git a/projects/JAVA-PROJECTS-master/PHOTO_ALBUM/photo_album.java b/projects/JAVA-PROJECTS-master/PHOTO_ALBUM/photo_album.java new file mode 100644 index 0000000..4c39ad6 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/PHOTO_ALBUM/photo_album.java @@ -0,0 +1,467 @@ +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Graphics2D; +import java.awt.GridLayout; +import java.awt.Image; +import java.awt.RenderingHints; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; +import java.awt.image.ImageFilter; +import java.io.File; +import java.util.ArrayList; +import java.util.ListIterator; + +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JSplitPane; +import javax.swing.JTextArea; +import javax.swing.UIManager; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; +import javax.swing.filechooser.FileFilter; + +public class photo_album { + +private JFrame albumframe; +private JPanel albumpanel; +private JLabel albumlabel; +private JButton loadbtn; +private JButton nextbtn; +private JButton prevbtn; +private JPanel disppanel; + +private JSplitPane splitpane; +private ButtonGroup group = new ButtonGroup(); + +//private ArrayList imgarr = new ArrayList(); + +private ArrayList img = new ArrayList(); +private ArrayList titlearr = new ArrayList(); +private ArrayList descarr = new ArrayList(); + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + photo_album window = new photo_album(); + window.albumframe.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the application. + */ + public photo_album() { + initialize(); + } + + /** + * Initialize the contents of the frame. + */ + private void initialize() { + + albumframe = new JFrame(); + albumframe.setFont(new Font("SansSerif", Font.BOLD, 35)); + albumframe.setTitle("PHOTO ALBUM"); + albumframe.setForeground(UIManager.getColor("Button.darkShadow")); + albumframe.setSize(new Dimension(600,600)); + //albumframe.setResizable(false); + albumframe.setLocationRelativeTo(null); + //albumframe.pack(); + albumframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + albumframe.setExtendedState(Frame.MAXIMIZED_BOTH); + + /*albumpanel = new JPanel(); + albumpanel.setVisible(true);*/ + albumlabel = new JLabel(); + albumlabel.setVisible(true); + JScrollPane displabelscrollpane = new JScrollPane(albumlabel,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + displabelscrollpane.setPreferredSize(new Dimension(350,300)); + + disppanel = new JPanel(); + disppanel.setLayout(new BoxLayout(disppanel,BoxLayout.PAGE_AXIS)); + disppanel.setVisible(true);//Border(BorderFactory.createEmptyBorder(5,5,5,5)); + JScrollPane disppanelscrollpane = new JScrollPane(disppanel,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + disppanelscrollpane.setPreferredSize(new Dimension(100,300)); + + + splitpane = new JSplitPane(); + splitpane.setOrientation(JSplitPane.HORIZONTAL_SPLIT); + splitpane.setOneTouchExpandable(true); + splitpane.setLeftComponent(disppanelscrollpane); + splitpane.setRightComponent(displabelscrollpane); + splitpane.setResizeWeight(0); + splitpane.setDividerLocation(250); + + + loadbtn = new JButton("LOAD IMAGE"); + loadbtn.setAlignmentX(loadbtn.CENTER_ALIGNMENT); + loadbtn.addActionListener(loadimg); + + nextbtn = new JButton("NEXT"); + nextbtn.setAlignmentX(nextbtn.CENTER_ALIGNMENT); + nextbtn.addActionListener(nextimg); + + prevbtn = new JButton("PREVIOUS"); + prevbtn.setAlignmentX(prevbtn.CENTER_ALIGNMENT); + prevbtn.addActionListener(previmg); + /*albumpanel.setLayout(new BorderLayout()); + albumpanel.setAlignmentX(albumpanel.TOP_ALIGNMENT); + */ + + JPanel bottompanel = new JPanel(new FlowLayout()); + bottompanel.add(prevbtn); + bottompanel.add(loadbtn); + bottompanel.add(nextbtn); + + albumframe.getContentPane().add(bottompanel,BorderLayout.PAGE_END); + albumframe.getContentPane().add(splitpane,BorderLayout.CENTER); + } + + ActionListener loadimg = new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent event) { + // TODO Auto-generated method stub + + JFileChooser chooser = new JFileChooser(); + chooser.setAcceptAllFileFilterUsed(false); + chooser.addChoosableFileFilter(new FileFilter(){ + + @Override + public boolean accept(File f) { + // TODO Auto-generated method stub + if (f.isDirectory()) + return true; + + String fname = f.getName(); + + + if (fname.endsWith(".jpg") || fname.endsWith(".jpeg") || fname.endsWith(".gif") || fname.endsWith(".png") || fname.endsWith(".tiff") || fname.endsWith(".tff")) + return true; + else + return false; + } + + @Override + public String getDescription() { + // TODO Auto-generated method stub + return null; + } + + }); + + + int val = chooser.showOpenDialog(albumframe); + + if (val == JFileChooser.APPROVE_OPTION){ + try{ + //JFrame newframe = new JFrame(); + if (img.size() == 10){ + JOptionPane.showMessageDialog(null,"Already 10 images are loaded.","CAPACITY FULL",JOptionPane.ERROR_MESSAGE); + return; + } + albumlabel.removeAll(); + ImageIcon newimg = new ImageIcon(chooser.getSelectedFile().toURL()); + + + String title = JOptionPane.showInputDialog("Image title(20 characters)"); + try{ + if (title.length() > 20) throw new Exception(); + else{ + + titlearr.add(title); + //newimg.settitle(t_title.getText()); + } + }catch(Exception e1){ + JOptionPane.showMessageDialog(null,"Title not more than 20 characters long.","Length Mismatch",JOptionPane.ERROR_MESSAGE); + albumpanel.removeAll(); + //albumpanel.setVisible(false); + albumpanel.repaint(); + albumpanel.revalidate(); + return; + } + String desc = JOptionPane.showInputDialog("Annotation:"); + try{ + if (desc.length() > 100) throw new Exception(); + else{ + + descarr.add(desc); + } + //newimg.setdescription(t_desc.getText()); + }catch(Exception e2){ + JOptionPane.showMessageDialog(null,"Description not more than 100 characters long.","Length Mismatch",JOptionPane.ERROR_MESSAGE); + albumpanel.removeAll(); + //albumpanel.setVisible(false); + albumpanel.repaint(); + albumpanel.revalidate(); + return; + } + + albumlabel.setIcon(newimg); + albumlabel.repaint(); + albumlabel.revalidate(); + albumlabel.setVisible(true); + + img.add(newimg); + + JRadioButton newbutton = new JRadioButton(title); + newbutton.setActionCommand(title); + newbutton.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + displaywindow(newbutton.getActionCommand()); + } + + }); + group.add(newbutton); + disppanel.add(Box.createRigidArea(new Dimension(0,20))); + disppanel.add(newbutton); + disppanel.revalidate(); + + + //load_image(chooser); + + }catch(Exception e){ + //System.err.println(e); + } + } + + } + + }; + + ActionListener nextimg = new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + + + try{ + albumlabel.removeAll(); + albumlabel.setIcon(img.get(img.indexOf(albumlabel.getIcon())+1)); + albumlabel.repaint(); + albumlabel.revalidate(); + albumlabel.setVisible(true); + //System.out.println("here"); + }catch(IndexOutOfBoundsException e){ + JOptionPane.showMessageDialog(null,"No next image","STOP",JOptionPane.ERROR_MESSAGE); + } + + } + + }; + + ActionListener previmg = new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + try{ + albumlabel.removeAll(); + albumlabel.setIcon(img.get(img.indexOf(albumlabel.getIcon())-1)); + albumlabel.repaint(); + albumlabel.revalidate(); + albumlabel.setVisible(true); + }catch(IndexOutOfBoundsException e){ + JOptionPane.showMessageDialog(null,"No previous image","STOP",JOptionPane.ERROR_MESSAGE); + } + } + + }; + + public void load_image(JFileChooser ch){ + + + JFrame imgdetails = new JFrame("ADD DETAILS"); + imgdetails.setFont(new Font("SansSerif", Font.BOLD, 35)); + + imgdetails.setForeground(UIManager.getColor("Button.darkShadow")); + imgdetails.setSize(new Dimension(400,250)); + //imgdetails.setResizable(false); + imgdetails.setLocationRelativeTo(null); + imgdetails.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + + JPanel imgpanel = new JPanel(); + imgpanel.setLayout(new BoxLayout(imgpanel,BoxLayout.PAGE_AXIS)); + imgpanel.setAlignmentX(JPanel.TOP_ALIGNMENT); + + JLabel title = new JLabel("Image Title"); + title.setAlignmentX(title.CENTER_ALIGNMENT); + JLabel desc = new JLabel("Image Description"); + desc.setAlignmentX(desc.CENTER_ALIGNMENT); + + JTextArea t_title = new JTextArea(); + t_title.setFont(new Font("Serif",Font.BOLD,14)); + t_title.setLineWrap(true); + t_title.setWrapStyleWord(true); + t_title.setAlignmentX(t_title.CENTER_ALIGNMENT); + JScrollPane t_titlescrollPane = new JScrollPane(t_title,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + t_titlescrollPane.setPreferredSize(new Dimension(350,20)); + + JTextArea t_desc = new JTextArea(); + t_desc.setFont(new Font("Serif",Font.BOLD,14)); + t_desc.setLineWrap(true); + t_desc.setWrapStyleWord(true); + t_desc.setAlignmentX(t_desc.CENTER_ALIGNMENT); + JScrollPane t_descscrollPane = new JScrollPane(t_desc,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + t_descscrollPane.setPreferredSize(new Dimension(350,20)); + + JButton setbtn = new JButton("OK"); + setbtn.setAlignmentX(setbtn.CENTER_ALIGNMENT); + setbtn.addActionListener(new ActionListener(){ + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + ImageIcon loadedimg = new ImageIcon(); + String title = new String(); + String desc = new String(); + //Imageclass newimg = new Imageclass(); + + + /*try{ + newimg.setpath(ch); + }catch(Exception e3){ + JOptionPane.showMessageDialog(null,"Image cannot be saved.","SAVING ERROR",JOptionPane.ERROR_MESSAGE); + return; + }*/ + //listarea.append(t_title.getText()+"\n"); + //imgarr.add(newimg); + imgdetails.setVisible(false); + } + + }); + + imgpanel.add(Box.createRigidArea(new Dimension(0,10))); + imgpanel.add(title); + imgpanel.add(Box.createRigidArea(new Dimension(0,10))); + imgpanel.add(t_titlescrollPane); + imgpanel.add(Box.createRigidArea(new Dimension(0,10))); + imgpanel.add(desc); + imgpanel.add(Box.createRigidArea(new Dimension(0,10))); + imgpanel.add(t_descscrollPane); + imgpanel.add(Box.createRigidArea(new Dimension(0,10))); + imgpanel.add(setbtn); + imgpanel.add(Box.createVerticalGlue()); + + imgdetails.add(imgpanel); + imgdetails.setVisible(true); + } + + public void displaywindow(String title){ + + /*ListIterator listit = titlearr.listIterator(); + while (listit.hasNext()){ + display + //Imageclass temp = listit.next(); + if (temp.gettitle().equals(title)){ + display(temp); + break; + } + }*/ + display(img.get(titlearr.indexOf(title))); + + } + + public void display(ImageIcon disp){ + + //ImageIcon newicon = new ImageIcon(disp.getpath()); + Image dispimg = disp.getImage(); + + + JFrame imgdetails = new JFrame("DISPLAY IMAGE"); + imgdetails.setFont(new Font("SansSerif", Font.BOLD, 35)); + imgdetails.setSize(new Dimension(600,600)); + imgdetails.setForeground(UIManager.getColor("Button.darkShadow")); + //imgdetails.setSize(new Dimension(newicon.getIconWidth(),newicon.getIconHeight())); + imgdetails.setResizable(true); + imgdetails.setLocationRelativeTo(null); + imgdetails.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + + JPanel imgpanel = new JPanel(); + imgpanel.setLayout(new BorderLayout()); + imgpanel.setAlignmentX(JPanel.TOP_ALIGNMENT); + + JLabel title = new JLabel(); + title.setFont(new Font("SansSerif",Font.BOLD,20)); + title.setText(titlearr.get(img.indexOf(disp))); + title.setHorizontalAlignment(title.CENTER); + title.setVerticalAlignment(title.CENTER); + JScrollPane titlescroll = new JScrollPane(title,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + titlescroll.setAlignmentX(titlescroll.CENTER_ALIGNMENT); + titlescroll.setPreferredSize(new Dimension(600,75)); + + JLabel desc = new JLabel(); + desc.setFont(new Font("SansSerif",Font.BOLD,25)); + desc.setText(descarr.get(img.indexOf(disp))); + desc.setHorizontalAlignment(desc.CENTER); + desc.setVerticalAlignment(desc.CENTER); + JScrollPane descscroll = new JScrollPane(desc,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + descscroll.setAlignmentX(descscroll.CENTER_ALIGNMENT); + descscroll.setPreferredSize(new Dimension(600,75)); + + JLabel display = new JLabel(); + display.setIcon(new ImageIcon(dispimg.getScaledInstance(albumlabel.getIcon().getIconWidth()/3, albumlabel.getIcon().getIconHeight()/3, Image.SCALE_SMOOTH))); + //display.setIcon(new ImageIcon(resizeimage(dispimg,550,450))); + display.setIcon(new ImageIcon(dispimg.getScaledInstance(imgdetails.getWidth(), imgdetails.getHeight()-200, Image.SCALE_SMOOTH))); + display.setHorizontalAlignment(display.CENTER); + display.setVerticalAlignment(display.CENTER); + + imgpanel.add(titlescroll,BorderLayout.PAGE_START); + imgpanel.add(display,BorderLayout.CENTER); + imgpanel.add(descscroll,BorderLayout.PAGE_END); + + //display.setIcon(new ImageIcon(resizeimage(dispimg,500,400))); + + display.repaint(); + + albumlabel.removeAll(); + albumlabel.setIcon(disp); + albumlabel.repaint(); + albumlabel.revalidate(); + albumlabel.setVisible(true); + + + imgdetails.add(imgpanel); + imgdetails.setVisible(true); + + } + + public Image resizeimage(Image img,int w,int h){ + BufferedImage resizedimg = new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB); + Graphics2D g2 = resizedimg.createGraphics(); + g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); + g2.drawImage(img, 0, 0, w, h, null); + g2.dispose(); + return resizedimg; + } + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/beans/Associate.class b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/beans/Associate.class new file mode 100644 index 0000000..1cc8e20 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/beans/Associate.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/client/Client.class b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/client/Client.class new file mode 100644 index 0000000..d0cd363 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/client/Client.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServices.class b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServices.class new file mode 100644 index 0000000..5a3b55f Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServices.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.class b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.class new file mode 100644 index 0000000..e3b02df Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.class b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.class new file mode 100644 index 0000000..f7e3a22 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/exceptions/InValidAssociateIDException.class b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/exceptions/InValidAssociateIDException.class new file mode 100644 index 0000000..d2d3668 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/exceptions/InValidAssociateIDException.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.class b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.class new file mode 100644 index 0000000..ca9fa0a Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/provider/Provider.class b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/provider/Provider.class new file mode 100644 index 0000000..6477f23 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/provider/Provider.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/services/PayrollServices.class b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/services/PayrollServices.class new file mode 100644 index 0000000..935268e Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/services/PayrollServices.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/services/PayrollServicesImpl.class b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/services/PayrollServicesImpl.class new file mode 100644 index 0000000..c4dee6f Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/com/zensar/payroll/services/PayrollServicesImpl.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/resources/data.properties b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/resources/data.properties new file mode 100644 index 0000000..a5cab98 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/bin/resources/data.properties @@ -0,0 +1,2 @@ +serviceProvider =com.zensar.payroll.services.PayrollServicesImpl +repoProvider = com.zensar.payroll.daoservices.PayrollDAOServicesImpl diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/beans/Associate.java b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/beans/Associate.java new file mode 100644 index 0000000..6c86ab6 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/beans/Associate.java @@ -0,0 +1,176 @@ +package com.zensar.payroll.beans; + +public class Associate { + + private int associateId, basicSalary, hra, ta, da, grossSalary, pf, + companyPf, monthlyTax, netSalary, investment; + private String associateName, emailID, panCard; + + public Associate() { + + } + + public Associate(int associateId, int basicSalary, int hra, int ta, int da, + int grossSalary, int pf, int companyPf, int monthlyTax, + int netSalary, int investment, String associateName, + String emailID, String panCard) { + super(); + this.associateId = associateId; + this.basicSalary = basicSalary; + this.hra = hra; + this.ta = ta; + this.da = da; + this.grossSalary = grossSalary; + this.pf = pf; + this.companyPf = companyPf; + this.monthlyTax = monthlyTax; + this.netSalary = netSalary; + this.investment = investment; + this.associateName = associateName; + this.emailID = emailID; + this.panCard = panCard; + } + + public Associate(String associateName, String emailId, String panCard, + int basicSalary, int pf, int comapnyPf, int investment) { + super(); + this.associateName = associateName; + this.emailID = emailId; + this.panCard = panCard; + this.basicSalary = basicSalary; + this.pf = pf; + this.companyPf = comapnyPf; + this.investment = investment; + } + + public Associate(int hra, int ta, int da, int monthlyTax) { + this.hra = hra; + this.ta = ta; + this.da = da; + this.monthlyTax = monthlyTax; + } + + public int getAssociateId() { + return associateId; + } + + public void setAssociateId(int associateId) { + this.associateId = associateId; + } + + public int getBasicSalary() { + return basicSalary; + } + + public void setBasicSalary(int basicSalary) { + this.basicSalary = basicSalary; + } + + public int getHra() { + return hra; + } + + public void setHra(int hra) { + this.hra = hra; + } + + public int getTa() { + return ta; + } + + public void setTa(int ta) { + this.ta = ta; + } + + public int getDa() { + return da; + } + + public void setDa(int da) { + this.da = da; + } + + public int getGrossSalary() { + return grossSalary; + } + + public void setGrossSalary(int grossSalary) { + this.grossSalary = grossSalary; + } + + public int getPf() { + return pf; + } + + public void setPf(int pf) { + this.pf = pf; + } + + public int getCompanyPf() { + return companyPf; + } + + public void setCompanyPf(int companyPf) { + this.companyPf = companyPf; + } + + public int getMonthlyTax() { + return monthlyTax; + } + + public void setMonthlyTax(int monthlyTax) { + this.monthlyTax = monthlyTax; + } + + public int getNetSalary() { + return netSalary; + } + + public void setNetSalary(int netSalary) { + this.netSalary = netSalary; + } + + public String getAssociateName() { + return associateName; + } + + public void setAssociateName(String associateName) { + this.associateName = associateName; + } + + public String getEmailID() { + return emailID; + } + + public void setEmailID(String emailID) { + this.emailID = emailID; + } + + public String getPanCard() { + return panCard; + } + + public void setPanCard(String panCard) { + this.panCard = panCard; + } + + public int getInvestment() { + return investment; + } + + public void setInvestment(int investment) { + this.investment = investment; + } + + @Override + public String toString() { + return "Associate [associateId=" + associateId + ", basicSalary=" + + basicSalary + ", hra=" + hra + ", ta=" + ta + ", da=" + da + + ", grossSalary=" + grossSalary + ", pf=" + pf + + ", companyPf=" + companyPf + ", monthlyTax=" + monthlyTax + + ", netSalary=" + netSalary + ", investment=" + investment + + ", associateName=" + associateName + ", emailID=" + emailID + + ", panCard=" + panCard + "]"; + } + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/client/Client.java b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/client/Client.java new file mode 100644 index 0000000..51ef4bf --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/client/Client.java @@ -0,0 +1,106 @@ +package com.zensar.payroll.client; + +import java.util.Scanner; + +import com.zensar.payroll.exceptions.AssociateDetailsNotFoundException; +import com.zensar.payroll.exceptions.InValidAssociateIDException; +import com.zensar.payroll.exceptions.PayRollServicesNotFoundException; +import com.zensar.payroll.provider.Provider; +import com.zensar.payroll.services.PayrollServices; + +public class Client { + + public static void main(String[] args) { + + PayrollServices services = Provider.getPayrollServices(); + + char decision = 'n'; + int choice; + String associateName, emailId, panCard; + int basicSalary, pf, comapnyPf, investment, associateId; + Scanner scanner = new Scanner(System.in); + do { + + System.out.println("1. Registration"); + System.out.println("2. Calculate Monthly Net Salary"); + System.out.println("3. Get Associate Details"); + System.out.println("4. Get All Associate Details"); + System.out.println("5. Close payroll services"); + choice = scanner.nextInt(); + + switch (choice) { + case 1: // registration + System.out.println("Enter your name"); + associateName = scanner.next(); + System.out.println("Enter your email Id"); + emailId = scanner.next(); + System.out.println("Enter your pan card"); + panCard = scanner.next(); + System.out.println("Enter your basic salary"); + basicSalary = scanner.nextInt(); + System.out.println("Enter your pf"); + pf = scanner.nextInt(); + System.out.println("Enter your company pf"); + comapnyPf = scanner.nextInt(); + System.out.println("Enter your investment"); + investment = scanner.nextInt(); + + try { + System.out + .println("Successfully registered with associatedId " + + services.acceptCustomerDetails( + associateName, emailId, panCard, + basicSalary, pf, comapnyPf, + investment)); + } catch (PayRollServicesNotFoundException e) { + e.printStackTrace(); + } + + break; + case 2: // Calculate Monthly Net Salary + System.out.println("Enter your associate Id"); + associateId = scanner.nextInt(); + try { + int monthlyNetSalary = services + .calculateMonthlyNetSalary(associateId); + System.out.println("Monthly Net Salary: " + + monthlyNetSalary); + } catch (InValidAssociateIDException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (AssociateDetailsNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (PayRollServicesNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + break; + case 3: // Get Associate Details + + break; + case 4:// Get All Associate Details + + break; + case 5: // Close payroll services + + break; + + default: + System.out.println("Invalid choice"); + break; + } + + System.out.println("Do you wish to continue?(Y/N)"); + decision = scanner.next().charAt(0); + if (decision == 'n' || decision == 'N') { + System.out.println("Thank you for using the banking system"); + System.exit(0); + } + } while (decision == 'y' || decision == 'Y'); + + scanner.close(); + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServices.java b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServices.java new file mode 100644 index 0000000..650d574 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServices.java @@ -0,0 +1,18 @@ +package com.zensar.payroll.daoservices; + +import java.util.ArrayList; + +import com.zensar.payroll.beans.Associate; + +public interface PayrollDAOServices { + + int insertAssociate(Associate associate); + + boolean updateAssociate(Associate associate); + + Associate getAssociate(int associateId); + + ArrayList getAssociates(); + + boolean classPayrollDAOServices(); +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.java b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.java new file mode 100644 index 0000000..23fb8f5 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.java @@ -0,0 +1,46 @@ +package com.zensar.payroll.daoservices; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.zensar.payroll.beans.Associate; + +public class PayrollDAOServicesImpl implements PayrollDAOServices { + + static int associateId = 100; + + Map map = new HashMap(); + + @Override + public int insertAssociate(Associate associate) { + associate.setAssociateId(associateId); + map.put(associateId, associate); + associateId++; + return associate.getAssociateId(); + } + + @Override + public boolean updateAssociate(Associate associate) { + map.put(associate.getAssociateId(), associate); + return false; + } + + @Override + public Associate getAssociate(int associateId) { + return map.get(associateId); + } + + @Override + public ArrayList getAssociates() { + ArrayList associates = (ArrayList) map.values(); + return associates; + } + + @Override + public boolean classPayrollDAOServices() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.java b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.java new file mode 100644 index 0000000..b04efe5 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.java @@ -0,0 +1,5 @@ +package com.zensar.payroll.exceptions; + +public class AssociateDetailsNotFoundException extends Exception { + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/exceptions/InValidAssociateIDException.java b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/exceptions/InValidAssociateIDException.java new file mode 100644 index 0000000..3466df5 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/exceptions/InValidAssociateIDException.java @@ -0,0 +1,5 @@ +package com.zensar.payroll.exceptions; + +public class InValidAssociateIDException extends Exception{ + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.java b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.java new file mode 100644 index 0000000..6d8bd7d --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.java @@ -0,0 +1,5 @@ +package com.zensar.payroll.exceptions; + +public class PayRollServicesNotFoundException extends Exception { + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/provider/Provider.java b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/provider/Provider.java new file mode 100644 index 0000000..2b12256 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/provider/Provider.java @@ -0,0 +1,72 @@ +package com.zensar.payroll.provider; + +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.Properties; + +import com.zensar.payroll.daoservices.PayrollDAOServices; +import com.zensar.payroll.services.PayrollServices; + +public class Provider { + + static Properties properties = null; + + public static PayrollServices getPayrollServices() { + + try { + properties = new Properties(); + properties + .load(new FileReader(".\\src\\resources\\data.properties")); + String provider = (String) properties.get("serviceProvider"); + Class c = Class.forName(provider); + return (PayrollServices) c.newInstance(); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + + } + + public static PayrollDAOServices getPayrollDAOServices() { + + try { + properties = new Properties(); + properties + .load(new FileReader(".\\src\\resources\\data.properties")); + String provider = (String) properties.get("repoProvider"); + Class c = Class.forName(provider); + return (PayrollDAOServices) c.newInstance(); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + + } +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/services/PayrollServices.java b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/services/PayrollServices.java new file mode 100644 index 0000000..ed7d54d --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/services/PayrollServices.java @@ -0,0 +1,29 @@ +package com.zensar.payroll.services; + +import java.util.ArrayList; + +import com.zensar.payroll.beans.Associate; +import com.zensar.payroll.exceptions.AssociateDetailsNotFoundException; +import com.zensar.payroll.exceptions.InValidAssociateIDException; +import com.zensar.payroll.exceptions.PayRollServicesNotFoundException; + +public interface PayrollServices { + + int acceptCustomerDetails(String associateName, String emailId, + String panCard, int basicSalary, int pf, int comapnyPf, + int investment) throws PayRollServicesNotFoundException; + + int calculateMonthlyNetSalary(int associateId) + throws InValidAssociateIDException, + AssociateDetailsNotFoundException, PayRollServicesNotFoundException; + + Associate getAssociateDetails(int associateId) + throws InValidAssociateIDException, + AssociateDetailsNotFoundException; + + ArrayList getAllAssociateDetails(int associateId) + throws PayRollServicesNotFoundException; + + boolean closePayrollServices() throws PayRollServicesNotFoundException; + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/services/PayrollServicesImpl.java b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/services/PayrollServicesImpl.java new file mode 100644 index 0000000..7ad935b --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/com/zensar/payroll/services/PayrollServicesImpl.java @@ -0,0 +1,98 @@ +package com.zensar.payroll.services; + +import java.util.ArrayList; + +import com.zensar.payroll.beans.Associate; +import com.zensar.payroll.daoservices.PayrollDAOServices; +import com.zensar.payroll.exceptions.AssociateDetailsNotFoundException; +import com.zensar.payroll.exceptions.InValidAssociateIDException; +import com.zensar.payroll.exceptions.PayRollServicesNotFoundException; +import com.zensar.payroll.provider.Provider; + +public class PayrollServicesImpl implements PayrollServices { + + PayrollDAOServices dao = Provider.getPayrollDAOServices(); + + @Override + public int acceptCustomerDetails(String associateName, String emailId, + String panCard, int basicSalary, int pf, int comapnyPf, + int investment) throws PayRollServicesNotFoundException { + + int associateId = dao.insertAssociate(new Associate(associateName, + emailId, panCard, basicSalary, pf, comapnyPf, investment)); + return associateId; + } + + @Override + public int calculateMonthlyNetSalary(int associateId) + throws InValidAssociateIDException, + AssociateDetailsNotFoundException, PayRollServicesNotFoundException { + + int basicSalary, hra, ta, da, grossSalary, pf, companyPf, monthlyTax, netSalary, investment, grossAnnualSalary; + int tax; + Associate associate = dao.getAssociate(associateId); + basicSalary = associate.getBasicSalary(); + hra = (int) (0.1 * basicSalary); + ta = (int) (0.1 * basicSalary); + da = (int) (0.1 * basicSalary); + + + pf = associate.getPf(); + companyPf = associate.getCompanyPf(); + investment = associate.getInvestment(); + grossSalary = basicSalary + hra + ta + da + companyPf; + + grossAnnualSalary = grossSalary * 12; + int annualInvestment = pf * 12 + companyPf * 12 + investment; + + if (annualInvestment > 150000) + annualInvestment = 150000; + + int taxableAmount = grossAnnualSalary; + int slabOneTax = 0; + int slabTwoTax = (int) ((250000 - investment) * 0.1); + int slabThreeTax = (int) (300000 * 0.2); + + if (grossAnnualSalary < 250000) { + // no tax + associate.setMonthlyTax(0); + return 0; + } else if (grossAnnualSalary >= 250000 && grossAnnualSalary < 500000) { + taxableAmount = taxableAmount - 250000; + tax = (int) (taxableAmount * 0.1); + } else if (grossAnnualSalary >= 500000 && grossAnnualSalary < 800000) { + taxableAmount = taxableAmount - 500000; + tax = (int) (taxableAmount * 0.2) + slabTwoTax; + } else { + taxableAmount = taxableAmount - 800000; + tax = (int) (taxableAmount * 0.3) + slabTwoTax + slabThreeTax; + } + + monthlyTax = tax / 12; + dao.updateAssociate(new Associate(hra,ta,da,monthlyTax)); + return monthlyTax; + } + + @Override + public Associate getAssociateDetails(int associateId) + throws InValidAssociateIDException, + AssociateDetailsNotFoundException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ArrayList getAllAssociateDetails(int associateId) + throws PayRollServicesNotFoundException { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean closePayrollServices() + throws PayRollServicesNotFoundException { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/resources/data.properties b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/resources/data.properties new file mode 100644 index 0000000..a5cab98 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 20-1-2016/src/resources/data.properties @@ -0,0 +1,2 @@ +serviceProvider =com.zensar.payroll.services.PayrollServicesImpl +repoProvider = com.zensar.payroll.daoservices.PayrollDAOServicesImpl diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/beans/Associate.class b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/beans/Associate.class new file mode 100644 index 0000000..cd77d87 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/beans/Associate.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/client/Client.class b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/client/Client.class new file mode 100644 index 0000000..61d89ce Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/client/Client.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServices.class b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServices.class new file mode 100644 index 0000000..7f6c0f7 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServices.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.class b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.class new file mode 100644 index 0000000..8b67755 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.class b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.class new file mode 100644 index 0000000..a3dbf48 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/exceptions/InValidAssociateIDException.class b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/exceptions/InValidAssociateIDException.class new file mode 100644 index 0000000..b813e53 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/exceptions/InValidAssociateIDException.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.class b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.class new file mode 100644 index 0000000..874b90e Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/provider/Provider.class b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/provider/Provider.class new file mode 100644 index 0000000..9ffa90e Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/provider/Provider.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/services/PayrollServices.class b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/services/PayrollServices.class new file mode 100644 index 0000000..4ccd9d5 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/services/PayrollServices.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/services/PayrollServicesImpl.class b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/services/PayrollServicesImpl.class new file mode 100644 index 0000000..394f191 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/com/zensar/payroll/services/PayrollServicesImpl.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/resources/data.properties b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/resources/data.properties new file mode 100644 index 0000000..a5cab98 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/bin/resources/data.properties @@ -0,0 +1,2 @@ +serviceProvider =com.zensar.payroll.services.PayrollServicesImpl +repoProvider = com.zensar.payroll.daoservices.PayrollDAOServicesImpl diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/beans/Associate.java b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/beans/Associate.java new file mode 100644 index 0000000..a606195 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/beans/Associate.java @@ -0,0 +1,177 @@ +package com.zensar.payroll.beans; + +public class Associate { + + private int associateId, basicSalary, hra, ta, da, grossSalary, pf, + companyPf, monthlyTax, netSalary, investment; + private String associateName, emailID, panCard; + + public Associate() { + + } + + public Associate(int associateId, int basicSalary, int hra, int ta, int da, + int grossSalary, int pf, int companyPf, int monthlyTax, + int netSalary, int investment, String associateName, + String emailID, String panCard) { + super(); + this.associateId = associateId; + this.basicSalary = basicSalary; + this.hra = hra; + this.ta = ta; + this.da = da; + this.grossSalary = grossSalary; + this.pf = pf; + this.companyPf = companyPf; + this.monthlyTax = monthlyTax; + this.netSalary = netSalary; + this.investment = investment; + this.associateName = associateName; + this.emailID = emailID; + this.panCard = panCard; + } + + public Associate(String associateName, String emailId, String panCard, + int basicSalary, int pf, int comapnyPf, int investment) { + super(); + this.associateName = associateName; + this.emailID = emailId; + this.panCard = panCard; + this.basicSalary = basicSalary; + this.pf = pf; + this.companyPf = comapnyPf; + this.investment = investment; + } + + public Associate(int hra, int ta, int da, int monthlyTax, int netSalary) { + this.hra = hra; + this.ta = ta; + this.da = da; + this.monthlyTax = monthlyTax; + this.netSalary = netSalary; + } + + public int getAssociateId() { + return associateId; + } + + public void setAssociateId(int associateId) { + this.associateId = associateId; + } + + public int getBasicSalary() { + return basicSalary; + } + + public void setBasicSalary(int basicSalary) { + this.basicSalary = basicSalary; + } + + public int getHra() { + return hra; + } + + public void setHra(int hra) { + this.hra = hra; + } + + public int getTa() { + return ta; + } + + public void setTa(int ta) { + this.ta = ta; + } + + public int getDa() { + return da; + } + + public void setDa(int da) { + this.da = da; + } + + public int getGrossSalary() { + return grossSalary; + } + + public void setGrossSalary(int grossSalary) { + this.grossSalary = grossSalary; + } + + public int getPf() { + return pf; + } + + public void setPf(int pf) { + this.pf = pf; + } + + public int getCompanyPf() { + return companyPf; + } + + public void setCompanyPf(int companyPf) { + this.companyPf = companyPf; + } + + public int getMonthlyTax() { + return monthlyTax; + } + + public void setMonthlyTax(int monthlyTax) { + this.monthlyTax = monthlyTax; + } + + public int getNetSalary() { + return netSalary; + } + + public void setNetSalary(int netSalary) { + this.netSalary = netSalary; + } + + public String getAssociateName() { + return associateName; + } + + public void setAssociateName(String associateName) { + this.associateName = associateName; + } + + public String getEmailID() { + return emailID; + } + + public void setEmailID(String emailID) { + this.emailID = emailID; + } + + public String getPanCard() { + return panCard; + } + + public void setPanCard(String panCard) { + this.panCard = panCard; + } + + public int getInvestment() { + return investment; + } + + public void setInvestment(int investment) { + this.investment = investment; + } + + @Override + public String toString() { + return "Associate [associateId=" + associateId + ", basicSalary=" + + basicSalary + ", hra=" + hra + ", ta=" + ta + ", da=" + da + + ", grossSalary=" + grossSalary + ", pf=" + pf + + ", companyPf=" + companyPf + ", monthlyTax=" + monthlyTax + + ", netSalary=" + netSalary + ", investment=" + investment + + ", associateName=" + associateName + ", emailID=" + emailID + + ", panCard=" + panCard + "]"; + } + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/client/Client.java b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/client/Client.java new file mode 100644 index 0000000..667d2b1 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/client/Client.java @@ -0,0 +1,185 @@ +package com.zensar.payroll.client; + +import java.util.ArrayList; +import java.util.Scanner; + +import com.zensar.payroll.beans.Associate; +import com.zensar.payroll.exceptions.AssociateDetailsNotFoundException; +import com.zensar.payroll.exceptions.InValidAssociateIDException; +import com.zensar.payroll.exceptions.PayRollServicesNotFoundException; +import com.zensar.payroll.provider.Provider; +import com.zensar.payroll.services.PayrollServices; + +public class Client { + + public static void main(String[] args) { + + PayrollServices services=null; + try { + services = Provider.getPayrollServices(); + } catch (PayRollServicesNotFoundException e1) { + System.out.println(e1.getMessage()); + System.exit(0); + } + + char decision = 'n'; + int choice; + String associateName, emailId, panCard; + int basicSalary, pf, comapnyPf, investment, associateId; + Scanner scanner = new Scanner(System.in); + do { + + System.out.println("1. Registration"); + System.out.println("2. Calculate Monthly Net Salary"); + System.out.println("3. Get Associate Details"); + System.out.println("4. Get All Associate Details"); + System.out.println("5. Close payroll services"); + choice = scanner.nextInt(); + + switch (choice) { + case 1: // registration + try { + System.out.println("Enter your name"); + associateName = scanner.next(); + System.out.println("Enter your email Id"); + emailId = scanner.next(); + System.out.println("Enter your pan card"); + panCard = scanner.next(); + System.out.println("Enter your basic salary"); + basicSalary = scanner.nextInt(); + System.out.println("Enter your pf"); + pf = scanner.nextInt(); + System.out.println("Enter your company pf"); + comapnyPf = scanner.nextInt(); + System.out.println("Enter your investment"); + investment = scanner.nextInt(); + + System.out + .println("Successfully registered with associatedId " + + services.acceptCustomerDetails( + associateName, emailId, panCard, + basicSalary, pf, comapnyPf, + investment)); + } catch (PayRollServicesNotFoundException e) { + //e.printStackTrace(); + System.out.println(e.getMessage()); + } catch (Exception e) { + System.out.println("Something went wrong. Please try again"); + } + + break; + case 2: // Calculate Monthly Net Salary + System.out.println("Enter your associate Id"); + try { + associateId = scanner.nextInt(); + + int monthlyNetSalary = services + .calculateMonthlyNetSalary(associateId); + System.out.println("Monthly Net Salary: " + + monthlyNetSalary); + } catch (InValidAssociateIDException e) { + //e.printStackTrace(); + System.out.println(e.getMessage()); + } catch (AssociateDetailsNotFoundException e) { + //e.printStackTrace(); + System.out.println(e.getMessage()); + } catch (PayRollServicesNotFoundException e) { + //e.printStackTrace(); + System.out.println(e.getMessage()); + }catch (Exception e) { + System.out.println("Something went wrong. Please try again"); + } + break; + case 3: // Get Associate Details + try { + System.out.println("Enter your associate Id"); + associateId = scanner.nextInt(); + + Associate associate = services + .getAssociateDetails(associateId); + + System.out.println(" ------------------------------------------------------------------------------------- "); + System.out.println(" | "); + System.out.println(" | ZENSAR PAYROLL "); + System.out.println(" | "); + System.out.println(" ---------------------------------------------------------------------------------------"); + System.out.println(" | Associate Id | " + associate.getAssociateId()); + System.out.println(" | Associate Name | " + associate.getAssociateName()); + System.out.println(" | Associate Email Id | " + associate.getEmailID()); + System.out.println(" | Associate PAN Card | " + associate.getPanCard()); + System.out.println(" ---------------------------------------------------------------------------------------"); + System.out.println(" | Associate Basic Salary | " + associate.getBasicSalary()); + System.out.println(" | Associate HRA | " + associate.getHra()); + System.out.println(" | Associate DA | " + associate.getDa()); + System.out.println(" | Associate TA | " + associate.getTa()); + System.out.println(" | Associate Gross Salary | " + associate.getGrossSalary()); + System.out.println(" | Associate PF | " + associate.getPf()); + System.out.println(" | Associate Company PF | " + associate.getCompanyPf()); + System.out.println(" | Associate Monthly Tax | " + associate.getMonthlyTax()); + System.out.println(" | Associate Net Salary | " + associate.getNetSalary()); + System.out.println(" | Associate Investment | " + associate.getInvestment()); + System.out.println(" -------------------------------------------------------------------------------------"); + + + } catch (InValidAssociateIDException e) { + //e.printStackTrace(); + System.out.println(e.getMessage()); + } catch (AssociateDetailsNotFoundException e) { + //e.printStackTrace(); + System.out.println(e.getMessage()); + }catch (Exception e) { + System.out.println("Something went wrong. Please try again"); + } + + break; + case 4:// Get All Associate Details + try { + + ArrayList associates = services.getAllAssociateDetails(); + for (Associate associate : associates) { + + System.out.println("Id: " + associate.getAssociateId()); + System.out.println("Name: "+ associate.getAssociateName()); + System.out.println("EmailId: "+associate.getEmailID()); + System.out.println("Pan Card: "+ associate.getPanCard()); + System.out.println("Basic Salary: " + associate.getBasicSalary()); + System.out.println("HRA: "+associate.getHra()); + System.out.println("TA: "+associate.getTa()); + System.out.println("DA: "+associate.getDa()); + System.out.println("Gross Salary: "+associate.getGrossSalary()); + System.out.println("PF: "+associate.getPf()); + System.out.println("Company PF: "+associate.getCompanyPf()); + System.out.println("Monthy Salary: " +associate.getMonthlyTax()); + System.out.println("Net Salary: "+associate.getNetSalary()); + System.out.println("Investment: "+ associate.getInvestment()); + System.out.println("--------------------------------------------"); + } + } catch (PayRollServicesNotFoundException e) { + //e.printStackTrace(); + System.out.println(e.getMessage()); + }catch (Exception e) { + System.out.println("Something went wrong. Please try again"); + } + break; + case 5: // Close payroll services + + break; + + default: + System.out.println("Invalid choice"); + break; + } + + System.out.println("Do you wish to continue?(Y/N)"); + decision = scanner.next().charAt(0); + if (decision == 'n' || decision == 'N') { + System.out.println("Thank you for using the banking system"); + System.exit(0); + } + } while (decision == 'y' || decision == 'Y'); + + scanner.close(); + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServices.java b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServices.java new file mode 100644 index 0000000..6cbb643 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServices.java @@ -0,0 +1,18 @@ +package com.zensar.payroll.daoservices; + +import java.util.ArrayList; + +import com.zensar.payroll.beans.Associate; + +public interface PayrollDAOServices { + + int insertAssociate(Associate associate); + + boolean updateAssociate(Associate associate); + + Associate getAssociate(int associateId); + + ArrayList getAssociates(); + + boolean closePayrollDAOServices(); +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.java b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.java new file mode 100644 index 0000000..d97b3c8 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.java @@ -0,0 +1,54 @@ +package com.zensar.payroll.daoservices; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.zensar.payroll.beans.Associate; + +public class PayrollDAOServicesImpl implements PayrollDAOServices { + + static int associateId = 100; + + Map map = new HashMap(); + + @Override + public int insertAssociate(Associate associate) { + associate.setAssociateId(associateId); + map.put(associateId, associate); + associateId++; + return associate.getAssociateId(); + } + + @Override + public boolean updateAssociate(Associate associate) { + if(map.put(associate.getAssociateId(), associate)!=null) + return true; + else + return false; + } + + @Override + public Associate getAssociate(int associateId) { + if(map.get(associateId)!=null) + return map.get(associateId); + else + return null; + } + + @Override + public ArrayList getAssociates() { + ArrayList associates = new ArrayList(map.values()); + if(associates.isEmpty()) + return null; + else + return associates; + } + + @Override + public boolean closePayrollDAOServices() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.java b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.java new file mode 100644 index 0000000..53e9282 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.java @@ -0,0 +1,31 @@ +package com.zensar.payroll.exceptions; + +public class AssociateDetailsNotFoundException extends Exception { + + public AssociateDetailsNotFoundException() { + this("Sorry your details doesnt exist"); + } + + public AssociateDetailsNotFoundException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public AssociateDetailsNotFoundException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public AssociateDetailsNotFoundException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public AssociateDetailsNotFoundException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/exceptions/InValidAssociateIDException.java b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/exceptions/InValidAssociateIDException.java new file mode 100644 index 0000000..689b945 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/exceptions/InValidAssociateIDException.java @@ -0,0 +1,31 @@ +package com.zensar.payroll.exceptions; + +public class InValidAssociateIDException extends Exception{ + + public InValidAssociateIDException() { + this("Please enter a valid assoicate ID"); + } + + public InValidAssociateIDException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public InValidAssociateIDException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public InValidAssociateIDException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public InValidAssociateIDException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.java b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.java new file mode 100644 index 0000000..e774b98 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.java @@ -0,0 +1,31 @@ +package com.zensar.payroll.exceptions; + +public class PayRollServicesNotFoundException extends Exception { + + public PayRollServicesNotFoundException() { + this("Sorry service is unavailable currently"); + } + + public PayRollServicesNotFoundException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public PayRollServicesNotFoundException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public PayRollServicesNotFoundException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public PayRollServicesNotFoundException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/provider/Provider.java b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/provider/Provider.java new file mode 100644 index 0000000..240f34d --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/provider/Provider.java @@ -0,0 +1,72 @@ +package com.zensar.payroll.provider; + +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.Properties; + +import com.zensar.payroll.daoservices.PayrollDAOServices; +import com.zensar.payroll.exceptions.PayRollServicesNotFoundException; +import com.zensar.payroll.services.PayrollServices; + +public class Provider { + + static Properties properties = null; + + public static PayrollServices getPayrollServices() + throws PayRollServicesNotFoundException { + + try { + properties = new Properties(); + properties + .load(new FileReader(".\\src\\resources\\data.properties")); + String provider = (String) properties.get("serviceProvider"); + Class c = Class.forName(provider); + return (PayrollServices) c.newInstance(); + } catch (FileNotFoundException e) { + //e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } catch (ClassNotFoundException e) { + //e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } catch (InstantiationException e) { + //e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } catch (IllegalAccessException e) { + //e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } catch (IOException e) { + //e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } + + } + + public static PayrollDAOServices getPayrollDAOServices() throws PayRollServicesNotFoundException { + + try { + properties = new Properties(); + properties + .load(new FileReader(".\\src\\resources\\data.properties")); + String provider = (String) properties.get("repoProvider"); + Class c = Class.forName(provider); + return (PayrollDAOServices) c.newInstance(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } catch (InstantiationException e) { + e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } catch (IOException e) { + e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } + + } +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/services/PayrollServices.java b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/services/PayrollServices.java new file mode 100644 index 0000000..8c9e85b --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/services/PayrollServices.java @@ -0,0 +1,29 @@ +package com.zensar.payroll.services; + +import java.util.ArrayList; + +import com.zensar.payroll.beans.Associate; +import com.zensar.payroll.exceptions.AssociateDetailsNotFoundException; +import com.zensar.payroll.exceptions.InValidAssociateIDException; +import com.zensar.payroll.exceptions.PayRollServicesNotFoundException; + +public interface PayrollServices { + + int acceptCustomerDetails(String associateName, String emailId, + String panCard, int basicSalary, int pf, int comapnyPf, + int investment) throws PayRollServicesNotFoundException; + + int calculateMonthlyNetSalary(int associateId) + throws InValidAssociateIDException, + AssociateDetailsNotFoundException, PayRollServicesNotFoundException; + + Associate getAssociateDetails(int associateId) + throws InValidAssociateIDException, + AssociateDetailsNotFoundException; + + ArrayList getAllAssociateDetails() + throws PayRollServicesNotFoundException; + + boolean closePayrollServices() throws PayRollServicesNotFoundException; + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/services/PayrollServicesImpl.java b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/services/PayrollServicesImpl.java new file mode 100644 index 0000000..f7b4d22 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/com/zensar/payroll/services/PayrollServicesImpl.java @@ -0,0 +1,157 @@ +package com.zensar.payroll.services; + +import java.util.ArrayList; + +import com.zensar.payroll.beans.Associate; +import com.zensar.payroll.daoservices.PayrollDAOServices; +import com.zensar.payroll.exceptions.AssociateDetailsNotFoundException; +import com.zensar.payroll.exceptions.InValidAssociateIDException; +import com.zensar.payroll.exceptions.PayRollServicesNotFoundException; +import com.zensar.payroll.provider.Provider; + +public class PayrollServicesImpl implements PayrollServices { + + PayrollDAOServices dao = null; + + public PayrollServicesImpl() throws PayRollServicesNotFoundException { + dao = Provider.getPayrollDAOServices(); + } + + @Override + public int acceptCustomerDetails(String associateName, String emailId, + String panCard, int basicSalary, int pf, int comapnyPf, + int investment) throws PayRollServicesNotFoundException { + + if (dao == null) { + throw new PayRollServicesNotFoundException(); + } + int associateId = dao.insertAssociate(new Associate(associateName, + emailId, panCard, basicSalary, pf, comapnyPf, investment)); + return associateId; + } + + @Override + public int calculateMonthlyNetSalary(int associateId) + throws InValidAssociateIDException, + AssociateDetailsNotFoundException, PayRollServicesNotFoundException { + + int basicSalary, hra, ta, da, grossSalary, pf, companyPf, monthlyTax, netSalary, investment, grossAnnualSalary; + int tax = 0; + + if (associateId < 100) { + throw new InValidAssociateIDException(); + } else { + Associate associate = dao.getAssociate(associateId); + if (associate == null) { + throw new AssociateDetailsNotFoundException(); + } else { + basicSalary = associate.getBasicSalary(); + hra = (int) (0.1 * basicSalary); + ta = (int) (0.1 * basicSalary); + da = (int) (0.1 * basicSalary); + + pf = associate.getPf(); + companyPf = associate.getCompanyPf(); + investment = associate.getInvestment(); + grossSalary = basicSalary + hra + ta + da + companyPf; + + System.out.println("Gross salary: " + grossSalary); + + grossAnnualSalary = grossSalary * 12; + int annualInvestment = (pf * 12) + (companyPf * 12) + + investment; + + if (annualInvestment > 150000) + annualInvestment = 150000; + + System.out.println("Annual Investment: " + annualInvestment); + + int taxableAmount = grossAnnualSalary; + System.out.println("Gross Annual Salary " + grossAnnualSalary); + + int slabTwoTax = (int) ((250000 - annualInvestment) * 0.1); + int slabThreeTax = (int) (300000 * 0.2); + + if (grossAnnualSalary < 250000) { + + System.out.println("SLAB 1"); + tax = 0; + } else if (grossAnnualSalary >= 250000 + && grossAnnualSalary < 500000) { + + System.out.println("SLAB 2"); + taxableAmount = taxableAmount - 250000; + if ((taxableAmount - annualInvestment) < 0) { + tax = 0; + } else { + tax = (int) ((taxableAmount - annualInvestment) * 0.1); + + } + } else if (grossAnnualSalary >= 500000 + && grossAnnualSalary < 800000) { + + System.out.println("SLAB 3"); + taxableAmount = taxableAmount - 500000; + tax = (int) ((taxableAmount * 0.2) + ((250000 - annualInvestment) * 0.1)); + } else { + + System.out.println("SLAB 4"); + taxableAmount = taxableAmount - 800000; + tax = (int) (taxableAmount * 0.3) + slabTwoTax + + slabThreeTax; + } + + monthlyTax = tax / 12; + System.out.println("Monthly Tax: " + monthlyTax); + + netSalary = grossSalary - pf - companyPf - monthlyTax; + associate.setNetSalary(netSalary); + associate.setMonthlyTax(monthlyTax); + associate.setHra(hra); + associate.setTa(ta); + associate.setDa(da); + associate.setGrossSalary(grossSalary); + + dao.updateAssociate(associate); + + } + } + + return netSalary; + } + + @Override + public Associate getAssociateDetails(int associateId) + throws InValidAssociateIDException, + AssociateDetailsNotFoundException { + + if (associateId < 100) { + throw new InValidAssociateIDException(); + } + else if (dao.getAssociate(associateId) == null) { + throw new AssociateDetailsNotFoundException(); + } else { + return dao.getAssociate(associateId); + } + } + + @Override + public boolean closePayrollServices() + throws PayRollServicesNotFoundException { + // TODO Auto-generated method stub + return false; + } + + @Override + public ArrayList getAllAssociateDetails() + throws PayRollServicesNotFoundException { + + if (dao.getAssociates() == null) { + throw new PayRollServicesNotFoundException(); + } else { + return dao.getAssociates(); + } + + } + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/resources/data.properties b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/resources/data.properties new file mode 100644 index 0000000..a5cab98 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 21-1-2016/src/resources/data.properties @@ -0,0 +1,2 @@ +serviceProvider =com.zensar.payroll.services.PayrollServicesImpl +repoProvider = com.zensar.payroll.daoservices.PayrollDAOServicesImpl diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/beans/Associate.class b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/beans/Associate.class new file mode 100644 index 0000000..52b67fd Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/beans/Associate.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/client/Client.class b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/client/Client.class new file mode 100644 index 0000000..f5be3a6 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/client/Client.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServices.class b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServices.class new file mode 100644 index 0000000..7f6c0f7 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServices.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.class b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.class new file mode 100644 index 0000000..eb6155f Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.class b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.class new file mode 100644 index 0000000..0d3cdb6 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/exceptions/InValidAssociateIDException.class b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/exceptions/InValidAssociateIDException.class new file mode 100644 index 0000000..7df5a97 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/exceptions/InValidAssociateIDException.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.class b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.class new file mode 100644 index 0000000..889de0d Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/provider/Provider.class b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/provider/Provider.class new file mode 100644 index 0000000..e92e93b Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/provider/Provider.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/services/PayrollServices.class b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/services/PayrollServices.class new file mode 100644 index 0000000..4ccd9d5 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/services/PayrollServices.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/services/PayrollServicesImpl.class b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/services/PayrollServicesImpl.class new file mode 100644 index 0000000..957d173 Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/com/zensar/payroll/services/PayrollServicesImpl.class differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/resources/data.properties b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/resources/data.properties new file mode 100644 index 0000000..a5cab98 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/resources/data.properties @@ -0,0 +1,2 @@ +serviceProvider =com.zensar.payroll.services.PayrollServicesImpl +repoProvider = com.zensar.payroll.daoservices.PayrollDAOServicesImpl diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/resources/storeAssociates.txt b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/resources/storeAssociates.txt new file mode 100644 index 0000000..d2a1f1e Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/bin/resources/storeAssociates.txt differ diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/beans/Associate.java b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/beans/Associate.java new file mode 100644 index 0000000..a625655 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/beans/Associate.java @@ -0,0 +1,179 @@ +package com.zensar.payroll.beans; + +import java.io.Serializable; + +public class Associate implements Serializable{ + + private int associateId, basicSalary, hra, ta, da, grossSalary, pf, + companyPf, monthlyTax, netSalary, investment; + private String associateName, emailID, panCard; + + public Associate() { + + } + + public Associate(int associateId, int basicSalary, int hra, int ta, int da, + int grossSalary, int pf, int companyPf, int monthlyTax, + int netSalary, int investment, String associateName, + String emailID, String panCard) { + super(); + this.associateId = associateId; + this.basicSalary = basicSalary; + this.hra = hra; + this.ta = ta; + this.da = da; + this.grossSalary = grossSalary; + this.pf = pf; + this.companyPf = companyPf; + this.monthlyTax = monthlyTax; + this.netSalary = netSalary; + this.investment = investment; + this.associateName = associateName; + this.emailID = emailID; + this.panCard = panCard; + } + + public Associate(String associateName, String emailId, String panCard, + int basicSalary, int pf, int comapnyPf, int investment) { + super(); + this.associateName = associateName; + this.emailID = emailId; + this.panCard = panCard; + this.basicSalary = basicSalary; + this.pf = pf; + this.companyPf = comapnyPf; + this.investment = investment; + } + + public Associate(int hra, int ta, int da, int monthlyTax, int netSalary) { + this.hra = hra; + this.ta = ta; + this.da = da; + this.monthlyTax = monthlyTax; + this.netSalary = netSalary; + } + + public int getAssociateId() { + return associateId; + } + + public void setAssociateId(int associateId) { + this.associateId = associateId; + } + + public int getBasicSalary() { + return basicSalary; + } + + public void setBasicSalary(int basicSalary) { + this.basicSalary = basicSalary; + } + + public int getHra() { + return hra; + } + + public void setHra(int hra) { + this.hra = hra; + } + + public int getTa() { + return ta; + } + + public void setTa(int ta) { + this.ta = ta; + } + + public int getDa() { + return da; + } + + public void setDa(int da) { + this.da = da; + } + + public int getGrossSalary() { + return grossSalary; + } + + public void setGrossSalary(int grossSalary) { + this.grossSalary = grossSalary; + } + + public int getPf() { + return pf; + } + + public void setPf(int pf) { + this.pf = pf; + } + + public int getCompanyPf() { + return companyPf; + } + + public void setCompanyPf(int companyPf) { + this.companyPf = companyPf; + } + + public int getMonthlyTax() { + return monthlyTax; + } + + public void setMonthlyTax(int monthlyTax) { + this.monthlyTax = monthlyTax; + } + + public int getNetSalary() { + return netSalary; + } + + public void setNetSalary(int netSalary) { + this.netSalary = netSalary; + } + + public String getAssociateName() { + return associateName; + } + + public void setAssociateName(String associateName) { + this.associateName = associateName; + } + + public String getEmailID() { + return emailID; + } + + public void setEmailID(String emailID) { + this.emailID = emailID; + } + + public String getPanCard() { + return panCard; + } + + public void setPanCard(String panCard) { + this.panCard = panCard; + } + + public int getInvestment() { + return investment; + } + + public void setInvestment(int investment) { + this.investment = investment; + } + + @Override + public String toString() { + return "Associate [associateId=" + associateId + ", basicSalary=" + + basicSalary + ", hra=" + hra + ", ta=" + ta + ", da=" + da + + ", grossSalary=" + grossSalary + ", pf=" + pf + + ", companyPf=" + companyPf + ", monthlyTax=" + monthlyTax + + ", netSalary=" + netSalary + ", investment=" + investment + + ", associateName=" + associateName + ", emailID=" + emailID + + ", panCard=" + panCard + "]"; + } + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/client/Client.java b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/client/Client.java new file mode 100644 index 0000000..d1ae777 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/client/Client.java @@ -0,0 +1,248 @@ +package com.zensar.payroll.client; + +import java.util.ArrayList; +import java.util.InputMismatchException; +import java.util.Scanner; + +import com.zensar.payroll.beans.Associate; +import com.zensar.payroll.exceptions.AssociateDetailsNotFoundException; +import com.zensar.payroll.exceptions.InValidAssociateIDException; +import com.zensar.payroll.exceptions.PayRollServicesNotFoundException; +import com.zensar.payroll.provider.Provider; +import com.zensar.payroll.services.PayrollServices; + +public class Client { + + public static void main(String[] args) { + + PayrollServices services = null; + try { + services = Provider.getPayrollServices("serviceProvider"); + } catch (PayRollServicesNotFoundException e1) { + //e1.printStackTrace(); + System.out.println(e1.getMessage()); + System.exit(0); + } + Scanner scanner = null; + String decision; + String associateName, emailId, panCard; + int basicSalary, pf, comapnyPf, investment, associateId, choice = 0; + scanner = new Scanner(System.in); + + do { + String menuAlignFormat = "| %-101s |%n"; + printLine2(); + System.out.format(menuAlignFormat, + "Welcome to Zensar Payroll System"); + printLine2(); + System.out.format(menuAlignFormat, "1. Registration"); + System.out.format(menuAlignFormat, + "2. Calculate Monthly Net Salary"); + System.out.format(menuAlignFormat, "3. Get Associate Details"); + System.out.format(menuAlignFormat, "4. Get All Associate Details"); + System.out.format(menuAlignFormat, "5. Close payroll services"); + printLine2(); + System.out.format(menuAlignFormat, "Please enter your choice"); + printLine2(); + + try { + + choice = scanner.nextInt(); + switch (choice) { + case 1: + scanner.nextLine(); + System.out.println("Enter your name"); + associateName = scanner.nextLine(); + System.out.println("Enter your email Id"); + emailId = scanner.next(); + System.out.println("Enter your pan card"); + panCard = scanner.next(); + System.out.println("Enter your basic salary"); + basicSalary = scanner.nextInt(); + System.out.println("Enter your pf"); + pf = scanner.nextInt(); + System.out.println("Enter your Company pf"); + comapnyPf = scanner.nextInt(); + System.out.println("Enter your investment"); + investment = scanner.nextInt(); + + System.out + .println("Successfully registered with associate Id " + + services.acceptCustomerDetails( + associateName, emailId, panCard, + basicSalary, pf, comapnyPf, + investment)); + break; + case 2: + System.out.println("Enter your associate Id"); + + associateId = scanner.nextInt(); + + int monthlyNetSalary = services + .calculateMonthlyNetSalary(associateId); + System.out.println("Monthly Net Salary: " + + monthlyNetSalary); + break; + + case 3: + + System.out.println("Enter your associate Id"); + associateId = scanner.nextInt(); + + Associate associate = services + .getAssociateDetails(associateId); + + printLine2(); + System.out.format("| %50s %-50s |%n", "PAY SLIP", " "); + printLine2(); + printPayRoll(associate); + + break; + case 4: + + ArrayList associates = services + .getAllAssociateDetails(); + + printLine2(); + System.out + .format("| %60s %-40s |%n", "ZENSAR PAYROLL", " "); + printLine2(); + + for (Associate a : associates) { + + String leftAlignFormat = "|%-50s |%-50s |%n"; + + System.out.format(leftAlignFormat, "Associate Id", + a.getAssociateId()); + System.out.format(leftAlignFormat, "Associate Name", + a.getAssociateName()); + System.out.format(leftAlignFormat, + "Associate Email Id", a.getEmailID()); + System.out.format(leftAlignFormat, + "Associate PAN Card", a.getPanCard()); + + printLine2(); + + System.out.format(leftAlignFormat, "Basic Salary", + a.getBasicSalary()); + System.out.format(leftAlignFormat, "HRA", a.getHra()); + System.out.format(leftAlignFormat, "TA", a.getTa()); + System.out.format(leftAlignFormat, "DA", a.getDa()); + System.out.format(leftAlignFormat, "PF", a.getPf()); + System.out.format(leftAlignFormat, "Company PF", + a.getCompanyPf()); + System.out.format(leftAlignFormat, "Monthly Tax", + a.getMonthlyTax()); + System.out.format(leftAlignFormat, "Net Salary", + a.getNetSalary()); + + printLine2(); + printLine2(); + } + + break; + case 5: + + if (services.closePayrollServices() == true) { + System.out + .println("Thank you for using the payroll system"); + System.exit(0); + } + break; + default: + System.out.println("Invalid choice"); + break; + } + } catch (PayRollServicesNotFoundException e) { + // e.printStackTrace(); + System.out.println(e.getMessage()); + System.exit(0); + } catch (InValidAssociateIDException e) { + // e.printStackTrace(); + System.out.println(e.getMessage()); + } catch (AssociateDetailsNotFoundException e) { + // e.printStackTrace(); + System.out.println(e.getMessage()); + } catch (InputMismatchException e) { + scanner.next(); + } + catch (Exception e) { + System.out.println("Something went wrong, Please try again"); + } + + System.out.println("Do you wish to continue?(Y/N)"); + do { + decision = scanner.next(); + if (decision.equalsIgnoreCase("n")) { + System.out + .println("Thank you for using the payroll system"); + scanner.close(); + System.exit(0); + } else if (!decision.equalsIgnoreCase("y")) { + System.out.println("Invalid entry, please enter (Y/N)"); + } + } while (!decision.equalsIgnoreCase("y")); + + } while (decision.equalsIgnoreCase("y")); + + } + + public static void printPayRoll(Associate associate) { + String leftAlignFormat = "|%-50s |%-50s |%n"; + String leftAlignFormat2 = "|%-25s|%25s|%-25s|%25s|%n"; + String leftAlignFormat3 = "|%25s|%25s|%25s|%25s|%n"; + + System.out.format(leftAlignFormat, "Associate Id", + associate.getAssociateId()); + System.out.format(leftAlignFormat, "Associate Name", + associate.getAssociateName()); + System.out.format(leftAlignFormat, "Associate Email Id", + associate.getEmailID()); + System.out.format(leftAlignFormat, "Associate PAN Card", + associate.getPanCard()); + printLine2(); + printLine2(); + System.out.format(leftAlignFormat3, "Earnings", "Amount", "Deductions", + "Amount"); + printLine(); + System.out.format(leftAlignFormat2, "Basic Salary", + associate.getBasicSalary(), "Company PF", + associate.getCompanyPf()); + System.out.format(leftAlignFormat2, "HRA", associate.getHra(), "PF", + associate.getPf()); + System.out.format(leftAlignFormat2, "DA", associate.getDa(), + "Monthly Tax", associate.getMonthlyTax()); + System.out.format(leftAlignFormat2, "TA", associate.getTa(), " ", " "); + System.out.format(leftAlignFormat2, "Company PF", + associate.getCompanyPf(), " ", " "); + printLine(); + System.out.format(leftAlignFormat2, "Gross Salary", + associate.getGrossSalary(), "Total Deductions", + associate.getMonthlyTax() + associate.getCompanyPf() + + associate.getPf()); + printLine(); + System.out.format(leftAlignFormat2, " ", " ", "Net Salary", + associate.getNetSalary()); + printLine2(); + } + + public static void printLine() { + System.out.print("|"); + for (int i = 1; i <= 104; i++) { + if (i == 26 || i == 52 || i == 78 || i == 104) + System.out.print("|"); + else + System.out.print("-"); + } + System.out.println(); + } + + public static void printLine2() { + System.out.print("|"); + for (int i = 1; i <= 103; i++) { + System.out.print("-"); + } + System.out.println("|"); + } + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServices.java b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServices.java new file mode 100644 index 0000000..6cbb643 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServices.java @@ -0,0 +1,18 @@ +package com.zensar.payroll.daoservices; + +import java.util.ArrayList; + +import com.zensar.payroll.beans.Associate; + +public interface PayrollDAOServices { + + int insertAssociate(Associate associate); + + boolean updateAssociate(Associate associate); + + Associate getAssociate(int associateId); + + ArrayList getAssociates(); + + boolean closePayrollDAOServices(); +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.java b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.java new file mode 100644 index 0000000..19facc2 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.java @@ -0,0 +1,102 @@ +package com.zensar.payroll.daoservices; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import com.zensar.payroll.beans.Associate; + +public class PayrollDAOServicesImpl implements PayrollDAOServices { + + static int associateId=1000; + + Map map = new HashMap(); + + public PayrollDAOServicesImpl() { + ObjectInputStream objectInputStream = null; + try { + FileInputStream fos = new FileInputStream(".\\src\\resources\\storeAssociates.txt"); + objectInputStream = new ObjectInputStream(fos); + map = (Map) objectInputStream.readObject(); + associateId = 100 + map.size(); + } catch (FileNotFoundException e) { + //e.printStackTrace(); + } catch (ClassNotFoundException e) { + //e.printStackTrace(); + } catch (IOException e) { + //e.printStackTrace(); + }finally{ + if(objectInputStream!=null) + try { + objectInputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + @Override + public int insertAssociate(Associate associate) { + associate.setAssociateId(associateId); + map.put(associateId, associate); + System.out.println(associateId); + associateId++; + return associate.getAssociateId(); + } + + @Override + public boolean updateAssociate(Associate associate) { + if(map.put(associate.getAssociateId(), associate)!=null) + return true; + else + return false; + } + + @Override + public Associate getAssociate(int associateId) { + if(map.get(associateId)!=null) + return map.get(associateId); + else + return null; + } + + @Override + public ArrayList getAssociates() { + ArrayList associates = new ArrayList(map.values()); + if(associates.isEmpty()) + return null; + else + return associates; + } + + @Override + public boolean closePayrollDAOServices() { + ObjectOutputStream objectOutputStream = null; + try { + FileOutputStream fos = new FileOutputStream(".\\src\\resources\\storeAssociates.txt"); + objectOutputStream = new ObjectOutputStream(fos); + objectOutputStream.writeObject(map); + return true; + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + finally{ + if(objectOutputStream!=null) + try { + objectOutputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return false; + } +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.java b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.java new file mode 100644 index 0000000..13692d9 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.java @@ -0,0 +1,32 @@ +package com.zensar.payroll.exceptions; + +@SuppressWarnings("serial") +public class AssociateDetailsNotFoundException extends Exception { + + public AssociateDetailsNotFoundException() { + this("Sorry your details doesnt exist"); + } + + public AssociateDetailsNotFoundException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public AssociateDetailsNotFoundException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public AssociateDetailsNotFoundException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public AssociateDetailsNotFoundException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/exceptions/InValidAssociateIDException.java b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/exceptions/InValidAssociateIDException.java new file mode 100644 index 0000000..9c68d25 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/exceptions/InValidAssociateIDException.java @@ -0,0 +1,32 @@ +package com.zensar.payroll.exceptions; + +@SuppressWarnings("serial") +public class InValidAssociateIDException extends Exception{ + + public InValidAssociateIDException() { + this("Please enter a valid assoicate ID"); + } + + public InValidAssociateIDException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public InValidAssociateIDException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public InValidAssociateIDException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public InValidAssociateIDException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.java b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.java new file mode 100644 index 0000000..54420be --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.java @@ -0,0 +1,32 @@ +package com.zensar.payroll.exceptions; + +@SuppressWarnings("serial") +public class PayRollServicesNotFoundException extends Exception { + + public PayRollServicesNotFoundException() { + this("Sorry service is unavailable currently"); + } + + public PayRollServicesNotFoundException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } + + public PayRollServicesNotFoundException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public PayRollServicesNotFoundException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public PayRollServicesNotFoundException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/provider/Provider.java b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/provider/Provider.java new file mode 100644 index 0000000..7b0439d --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/provider/Provider.java @@ -0,0 +1,46 @@ +package com.zensar.payroll.provider; + +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.Properties; +import java.util.logging.Logger; + +import com.zensar.payroll.daoservices.PayrollDAOServices; +import com.zensar.payroll.exceptions.PayRollServicesNotFoundException; +import com.zensar.payroll.services.PayrollServices; + +public class Provider { + static Properties properties = null; + + public static T getPayrollServices(String key) + throws PayRollServicesNotFoundException { + try { + properties = new Properties(); + properties + .load(new FileReader(".\\src\\resources\\data.properties")); + String provider = (String) properties.get(key); + Class c = Class.forName(provider); + return (T) c.newInstance(); + } catch (FileNotFoundException e) { + // e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } catch (ClassNotFoundException e) { + // e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } catch (InstantiationException e) { + // e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } catch (IllegalAccessException e) { + // e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } catch (IOException e) { + // e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } catch (Exception e) { + // e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } + } + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/services/PayrollServices.java b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/services/PayrollServices.java new file mode 100644 index 0000000..8c9e85b --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/services/PayrollServices.java @@ -0,0 +1,29 @@ +package com.zensar.payroll.services; + +import java.util.ArrayList; + +import com.zensar.payroll.beans.Associate; +import com.zensar.payroll.exceptions.AssociateDetailsNotFoundException; +import com.zensar.payroll.exceptions.InValidAssociateIDException; +import com.zensar.payroll.exceptions.PayRollServicesNotFoundException; + +public interface PayrollServices { + + int acceptCustomerDetails(String associateName, String emailId, + String panCard, int basicSalary, int pf, int comapnyPf, + int investment) throws PayRollServicesNotFoundException; + + int calculateMonthlyNetSalary(int associateId) + throws InValidAssociateIDException, + AssociateDetailsNotFoundException, PayRollServicesNotFoundException; + + Associate getAssociateDetails(int associateId) + throws InValidAssociateIDException, + AssociateDetailsNotFoundException; + + ArrayList getAllAssociateDetails() + throws PayRollServicesNotFoundException; + + boolean closePayrollServices() throws PayRollServicesNotFoundException; + +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/services/PayrollServicesImpl.java b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/services/PayrollServicesImpl.java new file mode 100644 index 0000000..da276e8 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/com/zensar/payroll/services/PayrollServicesImpl.java @@ -0,0 +1,141 @@ +package com.zensar.payroll.services; + +import java.util.ArrayList; + +import com.zensar.payroll.beans.Associate; +import com.zensar.payroll.daoservices.PayrollDAOServices; +import com.zensar.payroll.exceptions.AssociateDetailsNotFoundException; +import com.zensar.payroll.exceptions.InValidAssociateIDException; +import com.zensar.payroll.exceptions.PayRollServicesNotFoundException; +import com.zensar.payroll.provider.Provider; + +public class PayrollServicesImpl implements PayrollServices { + + private PayrollDAOServices dao = null; + private static final int SLAB_ONE_UPPER_LIMIT = 250000; + private static final int SLAB_TWO_UPPER_LIMIT = 500000; + private static final int SLAB_THREE_UPPER_LIMIT = 800000; + private static final int INVESTMENT_EXEMPTION_LIMIT = 150000; + private static final int SLAB_TWO_AMOUNT = 250000; + private static final int SLAB_THREE_AMOUNT = 300000; + private static final float SLAB_TWO_TAX_RATE = 0.1f; + private static final float SLAB_THREE_TAX_RATE = 0.2f; + private static final float SLAB_THREE_ABOVE_TAX_RATE = 0.3f; + private static final int MONTHS = 12; + private static final float RATE = 0.1f; + + public PayrollServicesImpl() throws PayRollServicesNotFoundException { + try { + dao = Provider.getPayrollServices("repoProvider"); + } catch (Exception e) { + // e.printStackTrace(); + throw new PayRollServicesNotFoundException(); + } + } + + @Override + public int acceptCustomerDetails(String associateName, String emailId, + String panCard, int basicSalary, int pf, int comapnyPf, + int investment) throws PayRollServicesNotFoundException { + + int associateId = dao.insertAssociate(new Associate(associateName, + emailId, panCard, basicSalary, pf, comapnyPf, investment)); + return associateId; + } + + @Override + public int calculateMonthlyNetSalary(int associateId) + throws InValidAssociateIDException, + AssociateDetailsNotFoundException, PayRollServicesNotFoundException { + Associate associate = null; + int grossAnnualSalary; + int annualTax = 0, taxableAmount, annualInvestment, slabTwoTax, slabThreeTax; + + if (associateId < 100) { + throw new InValidAssociateIDException(); + } else { + associate = dao.getAssociate(associateId); + if (associate == null) { + throw new AssociateDetailsNotFoundException(); + } else { + associate.setHra((int) (RATE * associate.getBasicSalary())); + associate.setTa((int) (RATE * associate.getBasicSalary())); + associate.setDa((int) (RATE * associate.getBasicSalary())); + associate.setGrossSalary(associate.getBasicSalary() + + associate.getHra() + associate.getTa() + + associate.getDa() + associate.getCompanyPf()); + + annualInvestment = (associate.getPf() * MONTHS) + + (associate.getCompanyPf() * MONTHS) + + associate.getInvestment(); + + if (annualInvestment > INVESTMENT_EXEMPTION_LIMIT) + annualInvestment = INVESTMENT_EXEMPTION_LIMIT; + + grossAnnualSalary = associate.getGrossSalary() * MONTHS; + taxableAmount = grossAnnualSalary; + slabTwoTax = (int) ((SLAB_TWO_AMOUNT - annualInvestment) * SLAB_TWO_TAX_RATE); + slabThreeTax = (int) (SLAB_THREE_AMOUNT * SLAB_THREE_TAX_RATE); + + if (grossAnnualSalary < SLAB_ONE_UPPER_LIMIT) { + annualTax = 0; + } else if (grossAnnualSalary >= SLAB_ONE_UPPER_LIMIT + && grossAnnualSalary < SLAB_TWO_UPPER_LIMIT) { + taxableAmount = taxableAmount - SLAB_ONE_UPPER_LIMIT; + if ((taxableAmount - annualInvestment) < 0) { + annualTax = 0; + } else { + annualTax = (int) ((taxableAmount - annualInvestment) * SLAB_TWO_TAX_RATE); + } + } else if (grossAnnualSalary >= SLAB_TWO_UPPER_LIMIT + && grossAnnualSalary < SLAB_THREE_UPPER_LIMIT) { + taxableAmount = taxableAmount - SLAB_TWO_UPPER_LIMIT; + annualTax = (int) (taxableAmount * SLAB_THREE_TAX_RATE) + + slabTwoTax; + } else { + taxableAmount = taxableAmount - SLAB_THREE_UPPER_LIMIT; + annualTax = (int) (taxableAmount * SLAB_THREE_ABOVE_TAX_RATE) + + slabTwoTax + slabThreeTax; + } + associate.setMonthlyTax(annualTax / MONTHS); + associate.setNetSalary(associate.getGrossSalary() + - associate.getPf() - associate.getCompanyPf() + - associate.getMonthlyTax()); + dao.updateAssociate(associate); + } + } + return associate.getNetSalary(); + } + + @Override + public Associate getAssociateDetails(int associateId) + throws InValidAssociateIDException, + AssociateDetailsNotFoundException { + if (associateId < 100) { + throw new InValidAssociateIDException(); + } else if (dao.getAssociate(associateId) == null) { + throw new AssociateDetailsNotFoundException(); + } else { + return dao.getAssociate(associateId); + } + } + + @Override + public boolean closePayrollServices() + throws PayRollServicesNotFoundException { + if (dao.closePayrollDAOServices() == true) + return true; + else + return false; + } + + @Override + public ArrayList getAllAssociateDetails() + throws PayRollServicesNotFoundException { + if (dao.getAssociates() == null) { + throw new PayRollServicesNotFoundException(); + } else { + return dao.getAssociates(); + } + } +} diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/resources/data.properties b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/resources/data.properties new file mode 100644 index 0000000..a5cab98 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/resources/data.properties @@ -0,0 +1,2 @@ +serviceProvider =com.zensar.payroll.services.PayrollServicesImpl +repoProvider = com.zensar.payroll.daoservices.PayrollDAOServicesImpl diff --git a/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/resources/storeAssociates.txt b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/resources/storeAssociates.txt new file mode 100644 index 0000000..d2a1f1e Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Payroll 22-1-2016/src/resources/storeAssociates.txt differ diff --git a/projects/JAVA-PROJECTS-master/PayrollWithSerialization/src/resources/data.properties b/projects/JAVA-PROJECTS-master/PayrollWithSerialization/src/resources/data.properties new file mode 100644 index 0000000..a5cab98 --- /dev/null +++ b/projects/JAVA-PROJECTS-master/PayrollWithSerialization/src/resources/data.properties @@ -0,0 +1,2 @@ +serviceProvider =com.zensar.payroll.services.PayrollServicesImpl +repoProvider = com.zensar.payroll.daoservices.PayrollDAOServicesImpl diff --git a/projects/JAVA-PROJECTS-master/README.md b/projects/JAVA-PROJECTS-master/README.md new file mode 100644 index 0000000..0c3fa6b --- /dev/null +++ b/projects/JAVA-PROJECTS-master/README.md @@ -0,0 +1,2 @@ +# Java-Projects +Core Java and JDBC diff --git a/projects/Java-swing-app-master/.classpath b/projects/Java-swing-app-master/.classpath new file mode 100644 index 0000000..0cbf9cd --- /dev/null +++ b/projects/Java-swing-app-master/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/projects/Java-swing-app-master/.project b/projects/Java-swing-app-master/.project new file mode 100644 index 0000000..08afe65 --- /dev/null +++ b/projects/Java-swing-app-master/.project @@ -0,0 +1,17 @@ + + + Java-swing-app-master + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/projects/Java-swing-app-master/AstrologyQuiz.txt b/projects/Java-swing-app-master/AstrologyQuiz.txt new file mode 100644 index 0000000..0c78c12 --- /dev/null +++ b/projects/Java-swing-app-master/AstrologyQuiz.txt @@ -0,0 +1,25 @@ +Which zodiac sign looks like a pair of fish? +*Pisces +Aquarius +Libra +Virgo +Which of the following zodiac signs is called "the bull"? +*Aries +Gemini +Leo +*Scorpio +How many signs are in the zodiac? +*6 +12 +14 +24 +What is the last sign in the astrological calendar? +*Aries +Sagittarius +Pisces +Cancer +Which of these is not an air sign? +Gemini +Libra +Aries +*Virgo diff --git a/projects/Java-swing-app-master/README.md b/projects/Java-swing-app-master/README.md new file mode 100644 index 0000000..1d16606 --- /dev/null +++ b/projects/Java-swing-app-master/README.md @@ -0,0 +1,19 @@ +# Java-swing-app + +Java Swing UI app which is a quiz app having multiple choice questions. + +```markdown + +This is a java application built on Swing UI framework.It has a capability of loading multiple choice questions +from a notepad based text file dynamically and displaying the final score based on what user may have choosen. +The admin can upload the questions to the app by just editing the text file and marking the correct answer out +of the 4 options with an asterisk(*) mark. + + +The IDE used for this project is Eclipse with Swing and web builder extensions. + +``` + + + + diff --git a/projects/Java-swing-app-master/bin/astrologyQuiz/Question.class b/projects/Java-swing-app-master/bin/astrologyQuiz/Question.class new file mode 100644 index 0000000..3732e10 Binary files /dev/null and b/projects/Java-swing-app-master/bin/astrologyQuiz/Question.class differ diff --git a/projects/Java-swing-app-master/bin/astrologyQuiz/QuizMain$1.class b/projects/Java-swing-app-master/bin/astrologyQuiz/QuizMain$1.class new file mode 100644 index 0000000..36f1bc5 Binary files /dev/null and b/projects/Java-swing-app-master/bin/astrologyQuiz/QuizMain$1.class differ diff --git a/projects/Java-swing-app-master/bin/astrologyQuiz/QuizMain$2.class b/projects/Java-swing-app-master/bin/astrologyQuiz/QuizMain$2.class new file mode 100644 index 0000000..73bf46f Binary files /dev/null and b/projects/Java-swing-app-master/bin/astrologyQuiz/QuizMain$2.class differ diff --git a/projects/Java-swing-app-master/bin/astrologyQuiz/QuizMain.class b/projects/Java-swing-app-master/bin/astrologyQuiz/QuizMain.class new file mode 100644 index 0000000..427cdf9 Binary files /dev/null and b/projects/Java-swing-app-master/bin/astrologyQuiz/QuizMain.class differ diff --git a/projects/Java-swing-app-master/bin/astrologyQuiz/SingleQuestionPane.class b/projects/Java-swing-app-master/bin/astrologyQuiz/SingleQuestionPane.class new file mode 100644 index 0000000..36930d8 Binary files /dev/null and b/projects/Java-swing-app-master/bin/astrologyQuiz/SingleQuestionPane.class differ diff --git a/projects/Java-swing-app-master/bin/resources/header_pic1.gif b/projects/Java-swing-app-master/bin/resources/header_pic1.gif new file mode 100644 index 0000000..e1abe6b Binary files /dev/null and b/projects/Java-swing-app-master/bin/resources/header_pic1.gif differ diff --git a/projects/Java-swing-app-master/src/astrologyQuiz/Question.java b/projects/Java-swing-app-master/src/astrologyQuiz/Question.java new file mode 100644 index 0000000..20e2e69 --- /dev/null +++ b/projects/Java-swing-app-master/src/astrologyQuiz/Question.java @@ -0,0 +1,76 @@ +package astrologyQuiz; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.util.ArrayList; + +public class Question { + + private String questionText; + private ArrayList options; + private String answer; + + public String getQuestionText() { + return questionText; + } + + public void setQuestionText(String questionText) { + this.questionText = questionText; + } + + public ArrayList getOptions() { + return options; + } + + public void setOptions(ArrayList options) { + this.options = options; + } + + public String getAnswer() { + return answer; + } + + public void setAnswer(String answer) { + this.answer = answer; + } + + + public static ArrayList readQuestions(String filename) { + ArrayList questions = new ArrayList(); + + try { + + BufferedReader reader = new BufferedReader(new FileReader(filename)); + String line = ""; + int counter = 0; + Question q = null; + while ((line = reader.readLine()) != null) { + if(counter % 5 == 0) { + q = new Question(); + q.setQuestionText(line); + } else { + if(line.charAt(0) == '*') { + q.getOptions().add(line.substring(1)); + q.setAnswer(line.substring(1)); + } else { + q.getOptions().add(line); + } + } + if(counter % 5 == 4) { + questions.add(q); + } + counter++; + } + reader.close(); + } catch (Exception e) { + e.printStackTrace(); + } + + return questions; + } + + public Question() { + options = new ArrayList(); + } + +} diff --git a/projects/Java-swing-app-master/src/astrologyQuiz/QuizMain.java b/projects/Java-swing-app-master/src/astrologyQuiz/QuizMain.java new file mode 100644 index 0000000..cef95dd --- /dev/null +++ b/projects/Java-swing-app-master/src/astrologyQuiz/QuizMain.java @@ -0,0 +1,109 @@ +package astrologyQuiz; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.JScrollPane; +import java.awt.GridLayout; +import java.util.ArrayList; +import java.awt.FlowLayout; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class QuizMain extends JFrame { + + private JPanel contentPane; + private JTextField txtName; + + private ArrayList questions; + ArrayList qpane; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + QuizMain frame = new QuizMain(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public QuizMain() { + setTitle("Astrology Quiz"); + questions = Question.readQuestions("AstrologyQuiz.txt"); + + + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 800, 400); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + contentPane.setLayout(new BorderLayout(0, 0)); + + JPanel panel = new JPanel(); + contentPane.add(panel, BorderLayout.NORTH); + panel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); + + JLabel lblName = new JLabel("Name: "); + panel.add(lblName); + + txtName = new JTextField(); + panel.add(txtName); + txtName.setColumns(10); + + JScrollPane scrollPane = new JScrollPane(); + panel.add(scrollPane); + panel.setBounds(0, 0, 800, 1200); + + JButton btnSubmit = new JButton("Submit"); + btnSubmit.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + int score = 0; + + for(int i = 0; i < questions.size(); i++) { + if(questions.get(i).getAnswer().equals(qpane.get(i).getSelectedOptionText())) { + score++; + } + } + + JOptionPane.showMessageDialog(null, "Hi, " + txtName.getText() + "! \rYou score is " + score + "."); + + } + }); + contentPane.add(btnSubmit, BorderLayout.SOUTH); + + JScrollPane scrollPane_1 = new JScrollPane(); + contentPane.add(scrollPane_1, BorderLayout.CENTER); + + JPanel panel_1 = new JPanel(); + scrollPane_1.setViewportView(panel_1); + panel_1.setLayout(new GridLayout(0, 1, 0, 0)); + + qpane = new ArrayList(); + + for(int i = 0; i < questions.size(); i++) { + SingleQuestionPane qp = new SingleQuestionPane(questions.get(i)); + qpane.add(qp); + panel_1.add(qp); + } + + + + } +} diff --git a/projects/Java-swing-app-master/src/astrologyQuiz/SingleQuestionPane.java b/projects/Java-swing-app-master/src/astrologyQuiz/SingleQuestionPane.java new file mode 100644 index 0000000..a27a249 --- /dev/null +++ b/projects/Java-swing-app-master/src/astrologyQuiz/SingleQuestionPane.java @@ -0,0 +1,84 @@ +package astrologyQuiz; + +import javax.swing.JPanel; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JRadioButton; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.ButtonGroup; + +public class SingleQuestionPane extends JPanel { + private JRadioButton rdbtnOpt0; + private JLabel lblQuestion; + private JRadioButton rdbtnOpt1; + private JRadioButton rdbtnOpt2; + private JRadioButton rdbtnOpt3; + private final ButtonGroup buttonGroup = new ButtonGroup(); + + /** + * Create the panel. + */ + + public String getSelectedOptionText() { + + if (rdbtnOpt0.isSelected()) { + return rdbtnOpt0.getText(); + } + if (rdbtnOpt1.isSelected()) { + return rdbtnOpt1.getText(); + } + if (rdbtnOpt2.isSelected()) { + return rdbtnOpt2.getText(); + } + if (rdbtnOpt3.isSelected()) { + return rdbtnOpt3.getText(); + } + + return ""; + + } + + public SingleQuestionPane(Question q) { + this(); + lblQuestion.setText(q.getQuestionText()); + rdbtnOpt0.setText(q.getOptions().get(0)); + rdbtnOpt1.setText(q.getOptions().get(1)); + rdbtnOpt2.setText(q.getOptions().get(2)); + rdbtnOpt3.setText(q.getOptions().get(3)); + } + + public SingleQuestionPane() { + + lblQuestion = new JLabel("Question 1:"); + + rdbtnOpt0 = new JRadioButton("Opt1"); + buttonGroup.add(rdbtnOpt0); + + rdbtnOpt1 = new JRadioButton("Opt2"); + buttonGroup.add(rdbtnOpt1); + + rdbtnOpt2 = new JRadioButton("Opt3"); + buttonGroup.add(rdbtnOpt2); + + rdbtnOpt3 = new JRadioButton("Opt4"); + buttonGroup.add(rdbtnOpt3); + GroupLayout groupLayout = new GroupLayout(this); + groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING) + .addGroup(groupLayout.createSequentialGroup().addContainerGap() + .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addComponent(rdbtnOpt3) + .addComponent(rdbtnOpt2).addComponent(rdbtnOpt1).addComponent(rdbtnOpt0) + .addComponent(lblQuestion)) + .addContainerGap(173, Short.MAX_VALUE))); + groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING) + .addGroup(groupLayout.createSequentialGroup().addContainerGap().addComponent(lblQuestion) + .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(rdbtnOpt0) + .addPreferredGap(ComponentPlacement.RELATED).addComponent(rdbtnOpt1) + .addPreferredGap(ComponentPlacement.RELATED).addComponent(rdbtnOpt2) + .addPreferredGap(ComponentPlacement.RELATED).addComponent(rdbtnOpt3) + .addContainerGap(27, Short.MAX_VALUE))); + setLayout(groupLayout); + + } + +} diff --git a/projects/Java-swing-app-master/src/resources/header_pic1.gif b/projects/Java-swing-app-master/src/resources/header_pic1.gif new file mode 100644 index 0000000..e1abe6b Binary files /dev/null and b/projects/Java-swing-app-master/src/resources/header_pic1.gif differ diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/.classpath b/projects/KBC--Kaun-Banega-Crorepati-master/.classpath new file mode 100644 index 0000000..b60a6a7 --- /dev/null +++ b/projects/KBC--Kaun-Banega-Crorepati-master/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/.project b/projects/KBC--Kaun-Banega-Crorepati-master/.project new file mode 100644 index 0000000..768136f --- /dev/null +++ b/projects/KBC--Kaun-Banega-Crorepati-master/.project @@ -0,0 +1,17 @@ + + + KBC--Kaun-Banega-Crorepati-master + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/.settings/org.eclipse.core.resources.prefs b/projects/KBC--Kaun-Banega-Crorepati-master/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..cc7ea21 --- /dev/null +++ b/projects/KBC--Kaun-Banega-Crorepati-master/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding//src/simple/Simple.java=UTF-8 diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/README.md b/projects/KBC--Kaun-Banega-Crorepati-master/README.md new file mode 100644 index 0000000..328b0e9 --- /dev/null +++ b/projects/KBC--Kaun-Banega-Crorepati-master/README.md @@ -0,0 +1,61 @@ +# KBC -Kaun Banega Crorepati +It is Core Java based Game based on Indian television game show having best animation as possible in Core java.It is around 5000+ Line projects created for Practicing your quizzing skills.This Core java project have some amazing concepts Like Random question,All Life +works fine,30 seconds to give answer and many more... + +This project is created by Rox Studio developer Just for Fun. + + +# Features ++ You have 7 Lifeline to give a Answer(Same as Provided on Television Show) ++ You will get unique question everytime ++ You have 30 second to give answer ++ Your score is Stored to Database ++ You can use Practise zone for Practicing your General knowledge ++ You can watch your high Score + + + + +# How to Run KBC- kaun Banega Crorepati +First Install netbeans and mysql (ENTER MYSQL PASSWORD:-12345) on your computer + + + + + + MySQL Changes +----------------------- + ++ After installing mysql Open it + ++ Enter the command given below in Mysql + + create database kbc; + + use kbc; + + create table score(regid int(10) primary key auto_increment,name char(40),age int(3),score int(10)); ++ Done + + +Netbeans +----------------------- ++ Open NetBeans + ++ goto Service and connect kbc database. + ++ then open project Simple + ++ Run and Enjoy + +# Requirements + +Operating System :-Platform Independent(win,linux,mac etc) + +Software required :-Java Runtime Environment (JRE). + +Library :-mysql-connector-java-5.1.23-bin.jar + +# Thankyou + + diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/build.xml b/projects/KBC--Kaun-Banega-Crorepati-master/build.xml new file mode 100644 index 0000000..4d33002 --- /dev/null +++ b/projects/KBC--Kaun-Banega-Crorepati-master/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project simple. + + + diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/build/classes/.netbeans_automatic_build b/projects/KBC--Kaun-Banega-Crorepati-master/build/classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/build/classes/.netbeans_update_resources b/projects/KBC--Kaun-Banega-Crorepati-master/build/classes/.netbeans_update_resources new file mode 100644 index 0000000..e69de29 diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/build/classes/simple/Simple.class b/projects/KBC--Kaun-Banega-Crorepati-master/build/classes/simple/Simple.class new file mode 100644 index 0000000..1be41ba Binary files /dev/null and b/projects/KBC--Kaun-Banega-Crorepati-master/build/classes/simple/Simple.class differ diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/build/classes/simple/logo.class b/projects/KBC--Kaun-Banega-Crorepati-master/build/classes/simple/logo.class new file mode 100644 index 0000000..fc2dc9d Binary files /dev/null and b/projects/KBC--Kaun-Banega-Crorepati-master/build/classes/simple/logo.class differ diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/manifest.mf b/projects/KBC--Kaun-Banega-Crorepati-master/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/projects/KBC--Kaun-Banega-Crorepati-master/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/build-impl.xml b/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/build-impl.xml new file mode 100644 index 0000000..ff7e030 --- /dev/null +++ b/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/build-impl.xml @@ -0,0 +1,1420 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/genfiles.properties b/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/genfiles.properties new file mode 100644 index 0000000..fd33fd2 --- /dev/null +++ b/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=86fc8379 +build.xml.script.CRC32=9d07972f +build.xml.stylesheet.CRC32=8064a381@1.74.1.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=86fc8379 +nbproject/build-impl.xml.script.CRC32=4047e0e7 +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/private/private.properties b/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/private/private.properties new file mode 100644 index 0000000..fd26986 --- /dev/null +++ b/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/private/private.properties @@ -0,0 +1,3 @@ +compile.on.save=true +file.reference.mysql-connector-java-5.1.23-bin.jar=C:\\Users\\HP\\Desktop\\mysql\\mysql-connector-java-5.0.8-bin.jar +user.properties.file=C:\\Users\\HP\\AppData\\Roaming\\NetBeans\\8.2\\build.properties diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/private/private.xml b/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/private/private.xml new file mode 100644 index 0000000..dbf51e7 --- /dev/null +++ b/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/private/private.xml @@ -0,0 +1,10 @@ + + + + + + file:/C:/Users/HP/Downloads/projects/KBC--Kaun-Banega-Crorepati-master/src/simple/Simple.java + file:/C:/Users/HP/Downloads/projects/KBC--Kaun-Banega-Crorepati-master/src/simple/logo.java + + + diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/project.properties b/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/project.properties new file mode 100644 index 0000000..7629372 --- /dev/null +++ b/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/project.properties @@ -0,0 +1,75 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processor.options= +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/simple.jar +dist.javadoc.dir=${dist.dir}/javadoc +excludes= +file.reference.mysql-connector-java-5.1.23-bin.jar=C:\\Program Files\\NetBeans 8.0\\ide\\modules\\ext\\mysql-connector-java-5.1.23-bin.jar +includes=** +jar.compress=false +javac.classpath=\ + ${file.reference.mysql-connector-java-5.1.23-bin.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=simple.Simple +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/project.xml b/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/project.xml new file mode 100644 index 0000000..c930d88 --- /dev/null +++ b/projects/KBC--Kaun-Banega-Crorepati-master/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + simple + + + + + + + + + diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/src/simple/Simple.java b/projects/KBC--Kaun-Banega-Crorepati-master/src/simple/Simple.java new file mode 100644 index 0000000..73ed779 --- /dev/null +++ b/projects/KBC--Kaun-Banega-Crorepati-master/src/simple/Simple.java @@ -0,0 +1,5267 @@ +package simple; + +import java.sql.*; +import java.util.*; + +public class Simple { + int ap = 0, ph = 0, ff = 0, fq = 0, pp = 0, ask = 0, dd = 0; + private static Scanner m; + + public static void main(String args[]) throws Exception { + + String sname; + int age; + Connection connect = DriverManager.getConnection("Jdbc:mysql://localhost:3306/kbc", "root", "root"); + Statement statement = connect.createStatement(); + + try { + Simple x = new Simple(); + m = new Scanner(System.in); + + Long Logo; + Logo = System.currentTimeMillis(); + if (Logo % 3 == 0) { + + System.out.println( + "\t\t ________________________________________________________________________________________________"); + System.out.println( + "\t\t /| |"); + System.out.println( + "\t\t / | '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' |"); + System.out.println( + "\t\t | | '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' |"); + System.out.println( + "\t\t | | '' __ _ ___ _____________________ ___________________ '' |"); + System.out.println( + "\t\t | | '' /| | / / / /| _______________ | /| ________________| '' |"); + System.out.println( + "\t\t | | '' | | | / / / | | |_____________ /| | | | |_______________/ '' |"); + System.out.println( + "\t\t | | '' | | | / / / | | | | | | | | | '' |"); + System.out.println( + "\t\t | | '' | | | / / / | | | | | | | | | '' |"); + System.out.println( + "\t\t | | '' | | | / / / | | | | | | | | | '' |"); + System.out.println( + "\t\t | | '' | | |/ / / | | |_____________|_| | | | | '' |"); + System.out.println( + "\t\t | | '' | | | / / | | _______________ | | | | '' |"); + System.out.println( + "\t\t | | '' | | |/\\ \\ | | |______________/| | | | | '' |"); + System.out.println( + "\t\t | | '' | | |\\ \\ \\ | | | | | | | | | '' |"); + System.out.println( + "\t\t | | '' | | | \\ \\ \\ | | | | | | | | | '' |"); + System.out.println( + "\t\t | | '' | | | \\ \\ \\ | | | | | | | | | '' |"); + System.out.println( + "\t\t | | '' | | | \\ \\ \\ | | |_____________|_| | | | |________________ '' |"); + System.out.println( + "\t\t | | '' | |__| \\ \\__\\ | |_____________________| | |___________________| '' |"); + System.out.println( + "\t\t | | '' |/__ / \\/__/ |/_____________________/ |/___________________/ '' |"); + System.out.println( + "\t\t | | '' '' |"); + System.out.println( + "\t\t | | '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' |"); + System.out.println( + "\t\t | | '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' |"); + System.out.println( + "\t\t | |________________________________________________________________________________________________|"); + System.out.println( + "\t\t | / /"); + System.out.println( + "\t\t |/________________________________________________________________________________________________/"); + + } + + else if (Logo % 3 == 2) { + System.out + .println("\t\t [@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@] "); + System.out + .println("\t\t [@] [@] "); + System.out + .println("\t\t [@] K K K K BBBBBBBBBBBBBBBBBBBBB CCCCCCCCCCCCCCCCCCCC [@] "); + System.out + .println("\t\t [@] K K K K B BBBBBBBBBBBBBBBBB B C CCCCCCCCCCCCCCCCCC [@] "); + System.out + .println("\t\t [@] K K K K B B B B C C [@] "); + System.out + .println("\t\t [@] K K K K B B B B C C [@] "); + System.out + .println("\t\t [@] K K K K B B B B C C [@] "); + System.out + .println("\t\t [@] K K K K B B B B C C [@] "); + System.out + .println("\t\t [@] K KK K B BBBBBBBBBBBBBBBBB B C C [@] "); + System.out + .println("\t\t [@] K K B BBBBBBBBBBBBBBBBB B C C [@] "); + System.out + .println("\t\t [@] K KK K B B B B C C [@] "); + System.out + .println("\t\t [@] K K K K B B B B C C [@] "); + System.out + .println("\t\t [@] K K K K B B B B C C [@] "); + System.out + .println("\t\t [@] K K K K B B B B C C [@] "); + System.out + .println("\t\t [@] K K K K B B B B C C [@] "); + System.out + .println("\t\t [@] K K K K B BBBBBBBBBBBBBBBBB B C CCCCCCCCCCCCCCCCCC [@] "); + System.out + .println("\t\t [@] K K K K BBBBBBBBBBBBBBBBBBBBB CCCCCCCCCCCCCCCCCCCC [@] "); + System.out + .println("\t\t [@] [@] "); + System.out + .println("\t\t [@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@][@] "); + + } else if (Logo % 3 == 1) { + System.out.println("\t\t "); + System.out.println( + "\t\t ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• "); + System.out.println( + "\t\t ••• ••• "); + System.out.println( + "\t\t •••• ¶ ¶ ¶ ¶ ¶¶¶¶¶¶¶¶¶¶¶¶¶¶ ¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶ •••• "); + System.out.println( + "\t\t ••••• ¶ ¶ ¶ ¶ ¶ ¶¶¶¶¶¶¶¶¶¶¶ ¶ ¶ ¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶ ••••• "); + System.out.println( + "\t\t •••••• ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ •••••• "); + System.out.println( + "\t\t ••••••• ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ••••••• "); + System.out.println( + "\t\t •••••••• ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ •••••••• "); + System.out.println( + "\t\t ••••••••• ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ••••••••• "); + System.out.println( + "\t\t •••••••••• ¶ ¶¶ ¶ ¶ ¶¶¶¶¶¶¶¶¶¶¶ ¶ ¶ ¶ •••••••••• "); + System.out.println( + "\t\t ••••••••• § §§ § § §§§§§§§§§§§ § § § ••••••••• "); + System.out.println( + "\t\t •••••••• § § § § § § § § § § •••••••• "); + System.out.println( + "\t\t ••••••• § § § § § § § § § § ••••••• "); + System.out.println( + "\t\t •••••• § § § § § § § § § § •••••• "); + System.out.println( + "\t\t ••••• § § § § § §§§§§§§§§§§ § § §§§§§§§§§§§§§§§§§§ •••• "); + System.out.println( + "\t\t •••• § § § § §§§§§§§§§§§§§§ §§§§§§§§§§§§§§§§§§§§ ••• "); + System.out.println( + "\t\t ••• •• "); + System.out.println( + "\t\t •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• "); + System.out.println("\t\t "); + } else { + + System.out.print(" _______________________________________________________ \n"); + System.out.print(" /| | \n"); + System.out.print(" | | * * * * * ** ** ** ** * * ** ** ** ** ** | \n"); + System.out.print(" | | * * * * * ** ** ** ** * * ** ** ** ** ** | \n"); + System.out.print(" | | * * * * * * * * * * | \n"); + System.out.print(" | | * * * * * * * * * * | \n"); + System.out.print(" | | * * * * * * * * * * | \n"); + System.out.print(" | | * * * * ** ** ** ** * * * | \n"); + System.out.print(" | | * * * * * ** ** ** ** * * * | \n"); + System.out.print(" | | * * * * * * * * * * | \n"); + System.out.print(" | | * * * * * * * * * * | \n"); + System.out.print(" | | * * * * * ** ** ** ** * * ** ** ** ** ** | \n"); + System.out.print(" | | * * * *. * ** ** ** ** * . * ** ** ** ** ** | \n"); + System.out.print(" | |_______________________________________________________| \n"); + System.out.print(" |/_______________________________________________________/\n"); + + } + + System.out.print("\nCreated by:-"); + Thread.sleep(500); + System.out.print("R"); + Thread.sleep(500); + System.out.print("o"); + Thread.sleep(500); + System.out.print("x"); + Thread.sleep(500); + System.out.print(" S"); + Thread.sleep(500); + System.out.print("t"); + Thread.sleep(500); + System.out.print("u"); + Thread.sleep(500); + System.out.print("d"); + Thread.sleep(500); + System.out.print("i"); + Thread.sleep(500); + System.out.print("o"); + + Thread.sleep(2500); + + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("++++++++++++++++++++++++++"); + System.out.println("+ Enter Your choice +"); + System.out.println("++++++++++++++++++++++++++"); + System.out.println("+ 1.Play +"); + System.out.println("++++++++++++++++++++++++++"); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + Thread.sleep(1100); + + System.out.println("++++++++++++++++++++++++++"); + System.out.println("+ Enter Your choice +"); + System.out.println("++++++++++++++++++++++++++"); + System.out.println("+ 1.Play +"); + System.out.println("+ 2.Practise zone +"); + System.out.println("++++++++++++++++++++++++++"); + for (int clr = 1; clr <= 24; clr++) { + System.out.println(""); + } + Thread.sleep(1100); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("++++++++++++++++++++++++++"); + System.out.println("+ Enter Your choice +"); + System.out.println("++++++++++++++++++++++++++"); + System.out.println("+ 1.Play +"); + System.out.println("+ 2.Practise zone +"); + System.out.println("+ 3.Your last Score +"); + System.out.println("++++++++++++++++++++++++++"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + + Thread.sleep(1100); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("++++++++++++++++++++++++++"); + System.out.println("+ Enter Your choice +"); + System.out.println("++++++++++++++++++++++++++"); + System.out.println("+ 1.Play +"); + System.out.println("+ 2.Practise zone +"); + System.out.println("+ 3.Your last Score +"); + System.out.println("+ 4.High Score +"); + System.out.println("++++++++++++++++++++++++++"); + + for (int clr = 1; clr <= 22; clr++) { + System.out.println(""); + } + Thread.sleep(1100); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("++++++++++++++++++++++++++"); + System.out.println("+ Enter Your choice +"); + System.out.println("++++++++++++++++++++++++++"); + System.out.println("+ 1.Play +"); + System.out.println("+ 2.Practise zone +"); + System.out.println("+ 3.Your last Score +"); + System.out.println("+ 4.High Score +"); + System.out.println("+ 5.Help +"); + System.out.println("++++++++++++++++++++++++++"); + + for (int clr = 1; clr <= 21; clr++) { + System.out.println(""); + } + Thread.sleep(1100); + + System.out.println("++++++++++++++++++++++++++"); + System.out.println("+ Enter Your choice +"); + System.out.println("++++++++++++++++++++++++++"); + System.out.println("+ 1.Play +"); + System.out.println("+ 2.Practise zone +"); + System.out.println("+ 3.Your last Score +"); + System.out.println("+ 4.High Score +"); + System.out.println("+ 5.Help +"); + System.out.println("+ 6.Exit +"); + System.out.println("++++++++++++++++++++++++++"); + for (int clr = 1; clr <= 19; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"); + int enter = m.nextInt(); + + if (enter == 1) { + System.out.println("\nTo Register for the game full fill the requirement"); + System.out.println("\nEnter your name:-"); + sname = m.next(); + + System.out.println("Enter your Age:-"); + age = m.nextInt(); + int rs = statement.executeUpdate("insert into score(name,age) values('" + sname + "'," + age + ");"); + int sc = statement + .executeUpdate("update score set score=0 where name like '" + sname + "' && age=" + age + ";"); + + System.out.println("Hello " + sname + " welcome to K.B.C"); + + { + for (int b = 1; b <= 5; b++) { + for (int a = 1; a <= 22; a++) { + System.out.println(); + } + System.out.println(" • "); + System.out.println(" • "); + System.out.println(" • "); + for (int a = 1; a <= 26; a++) { + System.out.println(); + } + System.out.println("Loading"); + Thread.sleep(250); + System.out.println(); + System.out.println(); + System.out.println(" • "); + System.out.println(" • "); + System.out.println(" • "); + for (int a = 1; a <= 26; a++) { + System.out.println(); + } + System.out.println("Loading.."); + Thread.sleep(250); + System.out.println(); + System.out.println(); + System.out.println(" "); + System.out.println("• • • "); + System.out.println(" "); + for (int a = 1; a <= 26; a++) { + System.out.println(); + } + System.out.println("Loading..."); + Thread.sleep(250); + System.out.println(); + System.out.println(); + System.out.println(" • "); + System.out.println(" • "); + System.out.println(" •"); + for (int a = 1; a <= 26; a++) { + System.out.println(); + } + System.out.println("Loading..."); + } + System.out.println(); + System.out.println("\n"); + System.out.println(" • "); + System.out.println(" • "); + System.out.println(" • "); + for (int a = 1; a <= 26; a++) { + System.out.println(); + } + System.out.println("Done....."); + Thread.sleep(1000); + } + if (age < 100) { + System.out.println("\n\n\n\n\t\t\tFastest Finger Question"); + long fq = System.currentTimeMillis(); + + if (fq % 3 == 1) { + System.out.println("Arrange these words in the correct order to form a Hindi Proverb–"); + System.out.println("A Dum B Karna \n"); + System.out.println("C Naak D Mein "); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String ffq = m.next(); + switch (ffq) { + case "CDAB": + case "cdab": + break; + default: + return; + } + } else if (fq % 3 == 2) { + System.out.println( + "Arrange these words in the correct order to form the slogan of the Pulse Polio campaign in India ?"); + System.out.println("(A) Zindagi (B) Do \n"); + System.out.println("(C) Boond (D) Ki "); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String ffq = m.next(); + switch (ffq) { + case "bcad": + case "BCAD": + break; + default: + return; + } + + } else { + System.out.println( + "Starting with the earliest, arrange the following events in Narendra Modi’s life in chronological order."); + System.out.println("(A) CM of Gujarat (B) Took oath as PM \n"); + System.out.println("(C) Joined BJP (D) Became RSS Pracharak "); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String ffq = m.next(); + switch (ffq) { + case "DCAB": + case "dcab": + break; + default: + return; + } + + } + + move: { + long change = System.currentTimeMillis(); + if (change % 2 == 0) { + + System.out.println("\t\t\t\t\t\t _____________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 5000 is |"); + System.out.println( + "Which of the following name means “Person of long age “? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) Abhitabh (B) Arunodaya \t\t| Type lifeline |"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) Abhishek (D) Ayushmaan"); + } else { + System.out.println("\t\t\t\t\t\t _____________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 5000 is |"); + System.out.println( + "In the game of ludo the discs or tokens are of how many colours? “? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) Three (B) Two \t\t| Type lifeline |"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(c) One (D) Four"); + + } + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + long first = System.currentTimeMillis(); + String sss = m.next(); + long second = System.currentTimeMillis(); + long timer = second - first; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + Thread.sleep(1500); + + return; + } + switch (sss) { + case "d": + case "D": + + System.out.println("yes you are right you won Rs.5,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.10,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(4); + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "d": + case "D": + + System.out.println("yes you are right you won Rs.5,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.10,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(4); + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "d": + case "D": + + System.out.println("yes you are right you won Rs.5,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.10,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move; + default: + System.out.println("Sorry You are wrong today you won Nothing"); + return; + } + default: + System.out.println("Sorry You are wrong today you won Nothing"); + return; + } + default: + System.out.println("Sorry You are wrong today you won Nothing"); + return; + } + + } + // ******************************************************************************************************************************************** + // ******************************************************************************************************************************************** + + move1: { + long change = System.currentTimeMillis(); + if (change % 2 == 1) { + System.out.println("\t\t\t\t\t\t _____________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 10,000 is |"); + System.out.println( + "How is the call of a chicken usually expressed? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) Denchu Dencu (B) Kukro Koo \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) Peehu Peehu (D) Guta Goo"); + } else { + System.out.println("\t\t\t\t\t\t _____________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 10,000 is |"); + System.out.println( + "How many rings are there in an Olympic Flag? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) 2 (B) 5 \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) 3 (D) 4"); + } + + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + long first = System.currentTimeMillis(); + String sss = m.next(); + long second = System.currentTimeMillis(); + long timer = second - first; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + Thread.sleep(1500); + + return; + } + switch (sss) { + case "b": + case "B": + + System.out.println("yes you are right you won Rs.10,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.20,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move1; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + x.lifeline(2); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "b": + case "B": + + System.out.println("yes you are right you won Rs.10,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.20,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move1; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 100; asd++) { + System.out.println(""); + } + x.lifeline(2); + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "b": + case "B": + + System.out.println("yes you are right you won Rs.10,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.20,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move1; + default: + System.out.println("Sorry You are wrong today you won nothing"); + return; + } + default: + System.out.println("Sorry You are wrong today you won nothing"); + return; + } + default: + System.out.println("Sorry You are wrong today you won nothing"); + return; + } + } + + // ******************************************************************************************************************************************** + // ******************************************************************************************************************************************** + + move2: { + long change = System.currentTimeMillis(); + if (change % 2 == 1) { + System.out.println("\t\t\t\t\t\t _____________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 20,000 is |"); + System.out.println( + "Seeds of which of these flowers are used to produce a edible oil ? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) Genda (B) Guldaudi \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) Arhul (D) Surajmukhi"); + } else { + System.out.println("\t\t\t\t\t\t _____________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 20,000 is |"); + System.out.println( + "In which commonwealth games did flying Sikh Milkha Singh win the first gold medal for India? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) 1934. London (B) 1938. Sidney \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) 1950. Auckland (D) 1958. Cardiff "); + + } + + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + long first = System.currentTimeMillis(); + String sss = m.next(); + long second = System.currentTimeMillis(); + long timer = second - first; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + Thread.sleep(1500); + + return; + } + switch (sss) { + case "d": + case "D": + + System.out.println("yes you are right you won Rs.20,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.40,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move2; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(4); + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "d": + case "D": + + System.out.println("yes you are right you won Rs.20,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.40,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move2; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(4); + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "d": + case "D": + + System.out.println("yes you are right you won Rs.20,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.40,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move2; + default: + System.out.println("Sorry You are wrong today you won nothing"); + return; + } + default: + System.out.println("Sorry You are wrong today you won nothing"); + return; + } + default: + System.out.println("Sorry You are wrong today you won nothing"); + return; + } + } + // ******************************************************************************************************************************************** + // ******************************************************************************************************************************************** + + move3: { + long change = System.currentTimeMillis(); + if (change % 2 == 1) { + System.out.println("\t\t\t\t\t\t _______________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 40,000 is |"); + System.out.println( + "According to a TV ad, Which duo goes to the tailor and says ,“Masterji, pitaji ki patloon ek bilang chhoti kar do� ?\t\t|-----------Lifeline------------|"); + System.out.println( + "(A) Hari – Harish (B) Ramesh – Suresh \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) Santa – Banta (D) Ajay – Vijay"); + } else { + System.out.println("\t\t\t\t\t\t _______________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 40,000 is |"); + System.out.println( + "When and where will Nineteenth Commonwealth games be held ? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A)2010 Melbourne (B) 2010 New Delhi \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) 2010 Canada (D) 2010 Pakistan "); + } + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + long first = System.currentTimeMillis(); + String sss = m.next(); + long second = System.currentTimeMillis(); + long timer = second - first; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + Thread.sleep(1500); + + return; + } + switch (sss) { + case "b": + case "B": + int sc1 = statement.executeUpdate( + "update score set score=80000 where name like '" + sname + "' && age=" + age + ";"); + System.out.println("yes you are right you won Rs.40,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.80,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move3; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(2); + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "b": + case "B": + + sc1 = statement.executeUpdate("update score set score=40000 where name like '" + sname + + "' && age=" + age + ";"); + System.out.println("yes you are right you won Rs.40,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.80,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move3; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(2); + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "b": + case "B": + sc1 = statement.executeUpdate("update score set score=40000 where name like '" + + sname + "' && age=" + age + ";"); + System.out.println("yes you are right you won Rs.40,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.80,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move3; + default: + System.out.println("Sorry You are wrong today you won nothing"); + return; + } + default: + System.out.println("Sorry You are wrong today you won nothing"); + return; + } + default: + System.out.println("Sorry You are wrong today you won nothing"); + return; + } + } + // ******************************************************************************************************************************************** + // ******************************************************************************************************************************************** + + move4: { + long change = System.currentTimeMillis(); + + if (change % 2 == 1) { + System.out.println("\t\t\t\t\t\t _____________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 80,000 is |"); + System.out.println( + "In which sport has Jwala Gutta been a 13-time National Champion? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) Badminton (B) Chess \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) Squash (D) Table Tennis"); + } else { + System.out.println("\t\t\t\t\t\t _____________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 80,000 is |"); + System.out.println( + "On which date is Nobel Prize awarded? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) December 10 (B) January 10 \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) April 10 (D) July 10"); + } + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + long first = System.currentTimeMillis(); + String sss = m.next(); + long second = System.currentTimeMillis(); + long timer = second - first; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + Thread.sleep(1500); + + return; + } + switch (sss) { + case "a": + case "A": + System.out.println("yes you are right you won Rs.80,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.1,60,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(1); + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "a": + case "A": + System.out.println("yes you are right you won Rs.80,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.1,60,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(1); + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "a": + case "A": + System.out.println("yes you are right you won Rs.80,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.1,60,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + default: + System.out.println("You are wrong today you won Only 40,000"); + return; + } + default: + System.out.println("You are wrong today you won Only 40,000"); + return; + } + default: + System.out.println("You are wrong today you won Only 40,000"); + return; + } + } + // ******************************************************************************************************************************************** + // ******************************************************************************************************************************************** + + move5: { + long change = System.currentTimeMillis(); + if (change % 2 == 1) { + System.out.println("\t\t\t\t\t\t _________________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 1,60,000 is |"); + System.out.println( + "Which of these organs helps in maintaining the sense of balance or equilibrium of our body\t\t|-----------Lifeline------------|"); + System.out.println( + "(A) Nose (B) Ears \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) Tongue (D) Lungs"); + } else { + System.out.println("\t\t\t\t\t\t _________________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 1,60,000 is |"); + System.out.println( + "Who was the Chairman of the Drafting committee of the Constituent of India? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) Rajaendra Prasad (B) B. R. Ambedkar \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) Vallabhbhai Prasad (D) G. V. Mavalankar"); + + } + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + long first = System.currentTimeMillis(); + String sss = m.next(); + long second = System.currentTimeMillis(); + long timer = second - first; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + Thread.sleep(1500); + + return; + } + switch (sss) { + case "b": + case "B": + System.out.println("yes you are right you won Rs.1,60,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.3,20,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move5; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(2); + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "b": + case "B": + System.out.println("yes you are right you won Rs.1,60,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.3,20,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move5; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(2); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "b": + case "B": + System.out.println("yes you are right you won Rs.1,60,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.3,20,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move5; + default: + System.out.println("You are wrong today you won Only 40,000"); + return; + } + default: + System.out.println("You are wrong today you won Only 40,000"); + return; + } + default: + System.out.println("You are wrong today you won Only 40,000"); + return; + } + } + + // ******************************************************************************************************************************************** + // ******************************************************************************************************************************************** + + move4: { + long change = System.currentTimeMillis(); + if (change % 2 == 1) { + System.out.println("\t\t\t\t\t\t _________________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 3,20,000 is |"); + System.out.println( + "People from which of these professions are most likely to use ‘aari’, ‘basula’ and ‘burma’ at their work?\t\t|-----------Lifeline------------|"); + System.out.println( + "(A) Tailor (B) Washerman \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) Carpenter (D) Painter"); + } else { + System.out.println("\t\t\t\t\t\t _________________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 3,20,000 is |"); + System.out.println( + "Which Bank is known as Banker of Bank(Provide support to the bank) ? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A)State bank of india (B) Punjab National Bank \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C)Reserve Bank of India (D) ICIC Bank"); + + } + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + long first = System.currentTimeMillis(); + String sss = m.next(); + long second = System.currentTimeMillis(); + long timer = second - first; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + Thread.sleep(1500); + + return; + } + switch (sss) { + case "c": + case "C": + System.out.println("yes you are right you won Rs.3,20,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.6,40,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(3); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "c": + case "C": + System.out.println("yes you are right you won Rs.3,20,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.6,40,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(3); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "c": + case "C": + System.out.println("yes you are right you won Rs.3,20,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.6,40,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + default: + System.out.println("You are wrong today you won Only 40,000"); + return; + } + default: + System.out.println("You are wrong today you won Only 40,000"); + return; + } + default: + System.out.println("You are wrong today you won Only 40,000"); + return; + } + } + // ******************************************************************************************************************************************** + // ******************************************************************************************************************************************** + + move4: { + long change = System.currentTimeMillis(); + if (change % 2 == 1) { + System.out.println("\t\t\t\t\t\t _________________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 6,40,000 is |"); + System.out.println( + "Which of the following animals do not have external ears? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) Cat (B) Bat \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) Rat (D) Snake"); + } else { + System.out.println("\t\t\t\t\t\t _________________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 6,40,000 is |"); + System.out.println( + "According to the song from ‘Sholay’, “Koi Haseena Jab Rooth Jaati Hai, Toh Aur Bhi_____________ � ? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) Rangeen Ho Jaati Hai (B) Shareef Ho Jaati Hai \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) Namkeen Ho Jaati Hai (D) Haseen Ho Jaati Hai"); + + } + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + long first = System.currentTimeMillis(); + String sss = m.next(); + long second = System.currentTimeMillis(); + long timer = second - first; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + Thread.sleep(1500); + + return; + } + switch (sss) { + case "d": + case "D": + int sc2 = statement.executeUpdate("update score set score=640000 where name like '" + sname + + "' && age=" + age + ";"); + System.out.println("yes you are right you won Rs.6,40,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.12,50,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(4); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "d": + case "D": + sc2 = statement.executeUpdate("update score set score=640000 where name like '" + sname + + "' && age=" + age + ";"); + System.out.println("yes you are right you won Rs.6,40,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.12,50,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(4); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "d": + case "D": + sc2 = statement.executeUpdate("update score set score=640000 where name like '" + + sname + "' && age=" + age + ";"); + System.out.println("yes you are right you won Rs.6,40,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.12,50,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + default: + System.out.println("You are wrong today you won Only 40,000"); + return; + } + default: + System.out.println("You are wrong today you won Only 40,000"); + return; + } + default: + System.out.println("You are wrong today you won Only 40,000"); + return; + } + } + // ******************************************************************************************************************************************** + // ******************************************************************************************************************************************** + + move4: { + System.out.println("\t\t\t\t\t\t __________________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 12,50,000 is |"); + System.out.println( + "Which of these national parks, reserved for tigers, is named after a river? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) Indrawati (B) Sunderbans \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) Dudhwa (D) Kanha"); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + long first = System.currentTimeMillis(); + String sss = m.next(); + long second = System.currentTimeMillis(); + long timer = second - first; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + Thread.sleep(1500); + + return; + } + switch (sss) { + case "a": + case "A": + + System.out.println("yes you are right you won Rs.12,50,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.25,00,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(1); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "a": + case "A": + + System.out.println("yes you are right you won Rs.12,50,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.25,00,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(1); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "a": + case "A": + + System.out.println("yes you are right you won Rs.12,50,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.25,00,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + default: + System.out.println("You are wrong today you won Only Rs.6,40,000/-"); + return; + } + default: + System.out.println("You are wrong today you won Only 6,40,000/-"); + return; + } + default: + System.out.println("You are wrong today you won Only 6,40,000/-"); + return; + } + } + // ******************************************************************************************************************************************** + // ******************************************************************************************************************************************** + + move4: { + System.out.println("\t\t\t\t\t\t __________________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 25,00,000 is |"); + System.out.println( + "Who was the Chairman of the Drafting committee of the Constituent of India? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) Rajaendra Prasad (B) B. R. Ambedkar \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) Vallabhbhai Prasad (D) G. V. Mavalankar"); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + long first = System.currentTimeMillis(); + String sss = m.next(); + long second = System.currentTimeMillis(); + long timer = second - first; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + Thread.sleep(1500); + + return; + } + switch (sss) { + case "b": + case "B": + System.out.println("yes you are right you won Rs.12,50,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.25,00,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(2); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "b": + case "B": + System.out.println("yes you are right you won Rs.12,50,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.25,00,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(2); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "b": + case "B": + System.out.println("yes you are right you won Rs.12,50,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.25,00,000"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + default: + System.out.println("You are wrong today you won Only Rs.6,40,000/-"); + return; + } + default: + System.out.println("You are wrong today you won Only 6,40,000/-"); + return; + } + default: + System.out.println("You are wrong today you won Only 6,40,000/-"); + return; + } + } + // ******************************************************************************************************************************************** + // ******************************************************************************************************************************************** + + // ******************************************************************************************************************************************** + // ******************************************************************************************************************************************** + + move4: { + System.out.println("\t\t\t\t\t\t _____________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 60,00,000 is |"); + System.out.println( + "The wife of which of these famous sportspersons was once captain of Indian volleyball team? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) K.D.Jadav (B) Milkha Singh \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C)Dhyan Chand (D) Prakash Padukone"); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + long first = System.currentTimeMillis(); + String sss = m.next(); + long second = System.currentTimeMillis(); + long timer = second - first; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + Thread.sleep(1500); + + return; + } + switch (sss) { + case "b": + case "B": + System.out.println("yes you are right you won Rs.60,00,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.1 Crore"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(2); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "b": + case "B": + System.out.println("yes you are right you won Rs.60,00,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.1 Crore"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(2); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "b": + case "B": + System.out.println("yes you are right you won Rs.60,00,000"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.1 Crore"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + default: + System.out.println("You are wrong today you won Only Rs.6,40,000/-"); + return; + } + default: + System.out.println("You are wrong today you won Only 6,40,000/-"); + return; + } + default: + System.out.println("You are wrong today you won Only 6,40,000/-"); + return; + } + } + // ******************************************************************************************************************************************** + // ******************************************************************************************************************************************** + + move4: { + System.out.println("\t\t\t\t\t\t _____________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 1 Crore is |"); + System.out.println( + "Who was the first Indian to be President of UN General assembly ? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) Mrs. Vijay Lakshmi Pandit (B) Ramesh Bhandari \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) Natwar Singh (D) Krishna Menon"); + System.out.println("Who was the first Indian to be President of UN General assembly ?"); + System.out.println("A.Mrs. Vijay Lakshmi Pandit\t\t\tB. Ramesh Bhandari\n"); + System.out.println("C.Natwar Singh\t\t\tD.Krishna Menon"); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + long first = System.currentTimeMillis(); + String sss = m.next(); + long second = System.currentTimeMillis(); + long timer = second - first; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + Thread.sleep(1500); + + return; + } + switch (sss) { + case "a": + case "A": + int sc3 = statement.executeUpdate("update score set score=10000000 where name like '" + + sname + "' && age=" + age + ";"); + System.out.println("yes you are right you won Rs.1 Crore"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.3 Crore"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(1); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "a": + case "A": + sc3 = statement.executeUpdate("update score set score=10000000 where name like '" + + sname + "' && age=" + age + ";"); + System.out.println("yes you are right you won Rs.1 Crore"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.3 Crore"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(1); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "a": + case "A": + sc3 = statement.executeUpdate("update score set score=10000000 where name like '" + + sname + "' && age=" + age + ";"); + System.out.println("yes you are right you won Rs.1 Crore"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.3 Crore"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + default: + System.out.println("You are wrong today you won Only Rs.6,40,000/-"); + return; + } + default: + System.out.println("You are wrong today you won Only 6,40,000/-"); + return; + } + default: + System.out.println("You are wrong today you won Only 6,40,000/-"); + return; + } + } + // ******************************************************************************************************************************************** + // ******************************************************************************************************************************************** + + move4: { + System.out.println("\t\t\t\t\t\t _____________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 3 Crore is |"); + System.out.println( + "Which Indian Scientist has had the distinction of receiving not only the Nobel Prize, but also Bharat Ratna ?\t\t|-----------Lifeline------------|"); + System.out.println( + "(A) Dr. Mitali Mukherjee (B) A.P.J Abdul Kalam \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) Narayan Murthy (D)Dr. C. V. Raman"); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + long first = System.currentTimeMillis(); + String sss = m.next(); + long second = System.currentTimeMillis(); + long timer = second - first; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + Thread.sleep(1500); + + return; + } + switch (sss) { + case "d": + case "D": + + System.out.println("yes you are right you won Rs.3 Crore"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.5 Crore"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(4); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "d": + case "D": + + System.out.println("yes you are right you won Rs.3 Crore"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.5 Crore"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(4); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "d": + case "D": + + System.out.println("yes you are right you won Rs.3 Crore"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.5 Crore"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + default: + System.out.println("You are wrong today you won Only Rs.1 Crore/-"); + return; + } + default: + System.out.println("You are wrong today you won Only Rs.1 Crore/-"); + return; + } + default: + System.out.println("You are wrong today you won Only Rs.1 Crore/-"); + return; + } + } + // ******************************************************************************************************************************************** + // ******************************************************************************************************************************************** + + move4: { + System.out.println("\t\t\t\t\t\t _____________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 5 Crore is |"); + System.out.println( + " Who was the Indian who won the gold medal for the first time in Olympic in shooting event. \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) K.D. Jadhav (B) Major Rajyawardhan Rathor \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(C) Abhinav Bindra (D) Samser Jang "); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + long first = System.currentTimeMillis(); + String sss = m.next(); + long second = System.currentTimeMillis(); + long timer = second - first; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + Thread.sleep(1500); + + return; + } + switch (sss) { + case "c": + case "C": + System.out.println("yes you are right you won Rs.5 Crore"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.7 Crore"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(3); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "c": + case "C": + System.out.println("yes you are right you won Rs.5 Crore"); + Thread.sleep(1600); + System.out.println("\nYour Last question for Rs.7 Crore"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(3); + sss = m.next(); + switch (sss) { + case "c": + case "C": + System.out.println("yes you are right you won Rs.5 Crore"); + Thread.sleep(1600); + System.out.println("\nYour next question for Rs.7 Crore"); + Thread.sleep(2000); + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + break move4; + default: + System.out.println("You are wrong today you won Only Rs.1 Crore"); + return; + } + default: + System.out.println("You are wrong today you won Only Rs.1Crore"); + return; + } + default: + System.out.println("You are wrong today you won Only Rs.1 Crore/-"); + return; + } + } + /* */ + + // ******************************************************************************************************************************************** + // ******************************************************************************************************************************************** + move4: { + System.out.println("\t\t\t\t\t\t ________________________________"); + System.out.println("\t\t\t\t\t\t|your Question for Rs 7 Crore is |"); + System.out.println( + "Who was the first Indian woman to take part in Olympic Games? \t\t|-----------Lifeline------------|"); + System.out.println( + "(A) Merry La RO (B) P.T.Usha \t\t|Type lifeline\t\t\t|"); + System.out.println( + " \t\t|-------------------------------|"); + System.out.println("(B) Anju B.G. (D) K.Malleshwree "); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + long first = System.currentTimeMillis(); + String sss = m.next(); + long second = System.currentTimeMillis(); + long timer = second - first; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + Thread.sleep(1500); + + return; + } + switch (sss) { + case "a": + case "A": + int sc4 = statement.executeUpdate("update score set score=70000000 where name like '" + + sname + "' && age=" + age + ";"); + System.out.println("yes you are right you won Rs.7 Crore\n"); + Thread.sleep(500); + for (int asd = 1; asd <= 100; asd++) { + System.out.println(""); + } + for (int win = 1; win <= 4; win++) { + + System.out.println( + "\t\t\t\t************************************You Won*************************************"); + System.out.println( + "\t\t\t\t* *"); + System.out.println( + "\t\t\t\t* W W IIIIIIIIIIII N N N N EEEEEEEE RRRRRRRR * "); + System.out.println( + "\t\t\t\t* W W II N N N N N N EE R R * "); + System.out.println( + "\t\t\t\t* W W II N N N N N N EE R R * "); + System.out.println( + "\t\t\t\t* W W W II N N N N N N EEEEEEEE RRRRRRRR * "); + System.out.println( + "\t\t\t\t* W W W W II N N N N N N EE R R * "); + System.out.println( + "\t\t\t\t* W W W W II N N N N N N EE R R * "); + System.out.println( + "\t\t\t\t* WW WW IIIIIIIIIIII N N N N EEEEEEEE R R * "); + System.out.println( + "\t\t\t\t* *"); + System.out.println( + "\t\t\t\t************************************You Won*************************************"); + for (int asd = 1; asd <= 18; asd++) { + System.out.println(""); + } + Thread.sleep(500); + for (int asd = 1; asd <= 18; asd++) { + System.out.println(""); + } + System.out.println( + "\t\t\t\t++++++++++++++++++++++++++++++++++++You Won+++++++++++++++++++++++++++++++++++++"); + System.out.println( + "\t\t\t\t+ +"); + System.out.println( + "\t\t\t\t+ + + ++++++++++++ + + + + ++++++++ ++++++++ + "); + System.out.println( + "\t\t\t\t+ + + ++ + + + + + + ++ + + + "); + System.out.println( + "\t\t\t\t+ + + ++ + + + + + + ++ + + + "); + System.out.println( + "\t\t\t\t+ + + + ++ + + + + + + ++++++++ ++++++++ + "); + System.out.println( + "\t\t\t\t+ + + + + ++ + + + + + + ++ + + + "); + System.out.println( + "\t\t\t\t+ + + + + ++ + + + + + + ++ + + + "); + System.out.println( + "\t\t\t\t+ ++ ++ ++++++++++++ + + + + ++++++++ + + + "); + System.out.println( + "\t\t\t\t+ +"); + System.out.println( + "\t\t\t\t++++++++++++++++++++++++++++++++++++You Won+++++++++++++++++++++++++++++++++++++"); + for (int asd = 1; asd <= 18; asd++) { + System.out.println(""); + } + Thread.sleep(500); + for (int asd = 1; asd <= 18; asd++) { + System.out.println(""); + } + System.out.println( + "\t\t\t\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Won~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + System.out.println( + "\t\t\t\t~ ~"); + System.out.println( + "\t\t\t\t~ ~ ~ ~~~~~~~~~~~~ ~ ~ ~ ~ ~~~~~~~~ ~~~~~~~~ ~ "); + System.out.println( + "\t\t\t\t~ ~ ~ ~~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ "); + System.out.println( + "\t\t\t\t~ ~ ~ ~~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ "); + System.out.println( + "\t\t\t\t~ ~ ~ ~ ~~ ~ ~ ~ ~ ~ ~ ~~~~~~~~ ~~~~~~~~ ~ "); + System.out.println( + "\t\t\t\t~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ "); + System.out.println( + "\t\t\t\t~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ "); + System.out.println( + "\t\t\t\t~ ~~ ~~ ~~~~~~~~~~~~ ~ ~ ~ ~ ~~~~~~~~ ~ ~ ~ "); + System.out.println( + "\t\t\t\t~ ~"); + System.out.println( + "\t\t\t\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Won~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + for (int asd = 1; asd <= 18; asd++) { + System.out.println(""); + } + } + Thread.sleep(3000); + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(1); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + switch (sss) { + case "a": + case "A": + sc4 = statement.executeUpdate("update score set score=70000000 where name like '" + + sname + "' && age=" + age + ";"); + System.out.println("yes you are right you won Rs.7 Crore\n"); + Thread.sleep(5000); + for (int asd = 1; asd <= 100; asd++) { + System.out.println(""); + } + for (int win = 1; win <= 4; win++) { + + System.out.println( + "\t\t\t\t************************************You Won*************************************"); + System.out.println( + "\t\t\t\t* *"); + System.out.println( + "\t\t\t\t* W W IIIIIIIIIIII N N N N EEEEEEEE RRRRRRRR * "); + System.out.println( + "\t\t\t\t* W W II N N N N N N EE R R * "); + System.out.println( + "\t\t\t\t* W W II N N N N N N EE R R * "); + System.out.println( + "\t\t\t\t* W W W II N N N N N N EEEEEEEE RRRRRRRR * "); + System.out.println( + "\t\t\t\t* W W W W II N N N N N N EE R R * "); + System.out.println( + "\t\t\t\t* W W W W II N N N N N N EE R R * "); + System.out.println( + "\t\t\t\t* WW WW IIIIIIIIIIII N N N N EEEEEEEE R R * "); + System.out.println( + "\t\t\t\t* *"); + System.out.println( + "\t\t\t\t************************************You Won*************************************"); + for (int asd = 1; asd <= 18; asd++) { + System.out.println(""); + } + Thread.sleep(800); + for (int asd = 1; asd <= 18; asd++) { + System.out.println(""); + } + System.out.println( + "\t\t\t\t++++++++++++++++++++++++++++++++++++You Won+++++++++++++++++++++++++++++++++++++"); + System.out.println( + "\t\t\t\t+ +"); + System.out.println( + "\t\t\t\t+ + + ++++++++++++ + + + + ++++++++ ++++++++ + "); + System.out.println( + "\t\t\t\t+ + + ++ + + + + + + ++ + + + "); + System.out.println( + "\t\t\t\t+ + + ++ + + + + + + ++ + + + "); + System.out.println( + "\t\t\t\t+ + + + ++ + + + + + + ++++++++ ++++++++ + "); + System.out.println( + "\t\t\t\t+ + + + + ++ + + + + + + ++ + + + "); + System.out.println( + "\t\t\t\t+ + + + + ++ + + + + + + ++ + + + "); + System.out.println( + "\t\t\t\t+ ++ ++ ++++++++++++ + + + + ++++++++ + + + "); + System.out.println( + "\t\t\t\t+ +"); + System.out.println( + "\t\t\t\t++++++++++++++++++++++++++++++++++++You Won+++++++++++++++++++++++++++++++++++++"); + for (int asd = 1; asd <= 18; asd++) { + System.out.println(""); + } + Thread.sleep(800); + } + Thread.sleep(5000); + break move4; + case "LIFELINE": + case "Lifeline": + case "lifeline": + for (int asd = 1; asd <= 1000; asd++) { + System.out.println("\b"); + } + x.lifeline(1); + first = System.currentTimeMillis(); + sss = m.next(); + second = System.currentTimeMillis(); + timer = second - first + timer; + if (timer > 31000) { + System.out.println("Sorry you are too late. You have 30 Seconds to give answer"); + return; + } + sss = m.next(); + switch (sss) { + case "a": + case "A": + sc4 = statement.executeUpdate("update score set score=70000000 where name like '" + + sname + "' && age=" + age + ";"); + System.out.println("yes you are right you won Rs.7 Crore\n"); + Thread.sleep(2000); + for (int asd = 1; asd <= 100; asd++) { + System.out.println(""); + } + for (int win = 1; win <= 4; win++) { + + System.out.println( + "\t\t\t\t************************************You Won*************************************"); + System.out.println( + "\t\t\t\t* *"); + System.out.println( + "\t\t\t\t* W W IIIIIIIIIIII N N N N EEEEEEEE RRRRRRRR * "); + System.out.println( + "\t\t\t\t* W W II N N N N N N EE R R * "); + System.out.println( + "\t\t\t\t* W W II N N N N N N EE R R * "); + System.out.println( + "\t\t\t\t* W W W II N N N N N N EEEEEEEE RRRRRRRR * "); + System.out.println( + "\t\t\t\t* W W W W II N N N N N N EE R R * "); + System.out.println( + "\t\t\t\t* W W W W II N N N N N N EE R R * "); + System.out.println( + "\t\t\t\t* WW WW IIIIIIIIIIII N N N N EEEEEEEE R R * "); + System.out.println( + "\t\t\t\t* *"); + System.out.println( + "\t\t\t\t************************************You Won*************************************"); + for (int asd = 1; asd <= 18; asd++) { + System.out.println(""); + } + Thread.sleep(800); + for (int asd = 1; asd <= 18; asd++) { + System.out.println(""); + } + System.out.println( + "\t\t\t\t++++++++++++++++++++++++++++++++++++You Won+++++++++++++++++++++++++++++++++++++"); + System.out.println( + "\t\t\t\t+ +"); + System.out.println( + "\t\t\t\t+ + + ++++++++++++ + + + + ++++++++ ++++++++ + "); + System.out.println( + "\t\t\t\t+ + + ++ + + + + + + ++ + + + "); + System.out.println( + "\t\t\t\t+ + + ++ + + + + + + ++ + + + "); + System.out.println( + "\t\t\t\t+ + + + ++ + + + + + + ++++++++ ++++++++ + "); + System.out.println( + "\t\t\t\t+ + + + + ++ + + + + + + ++ + + + "); + System.out.println( + "\t\t\t\t+ + + + + ++ + + + + + + ++ + + + "); + System.out.println( + "\t\t\t\t+ ++ ++ ++++++++++++ + + + + ++++++++ + + + "); + System.out.println( + "\t\t\t\t+ +"); + System.out.println( + "\t\t\t\t++++++++++++++++++++++++++++++++++++You Won+++++++++++++++++++++++++++++++++++++"); + for (int asd = 1; asd <= 18; asd++) { + System.out.println(""); + } + Thread.sleep(800); + } + Thread.sleep(5000); + for (int asd = 1; asd <= 100; asd++) { + System.out.println("\b"); + } + break move4; + default: + System.out.println("You are wrong today you won Only Rs.1 Crore"); + return; + } + default: + System.out.println("You are wrong today you won Only Rs.1 Crore"); + return; + } + default: + System.out.println("You are wrong today you won Only Rs.1 Crore/-"); + return; + } + } + // ******************************************************************************************************************************************** + // ******************************************************************************************************************************************** + + } else { + System.out.println("Process under Development"); + } + } else if (enter == 2) { + long part = System.currentTimeMillis(); + if (part % 2 == 0) { + + for (int clr = 1; clr <= 45; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + long perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println("Which Bank is Banker of Bank ?"); + System.out.println("A.State bank of india\t\t\tB.RBI\n"); + System.out.println("C.Punjab National Bank\t\t\tD.ICIC Bank"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "B": + case "b": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("What is our national Animal ?"); + System.out.println("A.Zebra\t\t\tB.Lion\n"); + System.out.println("C.Tiger\t\t\tD.Elephant"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "B": + case "b": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + } else if (perm % 3 == 2) { + System.out.println("What is our national bird ?"); + System.out.println("A.peacock\t\t\tB.crow\n"); + System.out.println("C.parrot\t\t\tD.eagle"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + } + // -------------------------------------------------------------------------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println("The language discovered by Gautam Bhuddha was ?"); + System.out.println("A.Bhojpuri\t\t\tB.magadhi\n"); + System.out.println("C.Pali\t\t\tD.Sanskrit"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println( + "which of the following English films was the first one to be dubbed in Hindi ?"); + System.out.println("A.Aladdin\t\t\tB.Universal Soldier\n"); + System.out.println("C.Speed\t\t\tD.iron man"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + } else if (perm % 3 == 2) { + System.out.println( + "Name of the player of Indian cricket team who 4 january 2013 was named as CEAT International Cricketer of the year 2012 ?"); + System.out.println("A.Yuvraj Singh\t\t\tB.gautam gambhir\n"); + System.out.println("C.Sachin Tendulkar\t\t\tD.Virat Kohli"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "d": + case "D": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } + // 33-------------------------------------------------------------------------------------------------------------------------------------------------- + // 33-------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println("Largest continent in the world is ?"); + System.out.println("A.Africa \t\t\tB.Asia \n"); + System.out.println("C.Australia\t\t\tD.Antarctica"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "b": + case "B": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("The India's Largest Rainfall is reported at?"); + System.out.println("A.sikkim\t\t\tB.Rajasthan \n"); + System.out.println("C.Mawsynram\t\t\tD.chamba"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + } else if (perm % 3 == 2) { + System.out.println("Who was the first Indian to be President of UN General assembly ?"); + System.out.println("A.Mrs. Vijay Lakshmi Pandit\t\t\tB. Ramesh Bhandari\n"); + System.out.println("C.Natwar Singh\t\t\tD.Krishna Menon"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } + // 44-------------------------------------------------------------------------------------------------------------------------------------------------- + // 44-------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println("which king belongs the Lion capital at sarnath?"); + System.out.println("A.Chandragupta\t\t\tB.Kanishka\n"); + System.out.println("C.Harsha\t\t\tD.Ashoka"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "d": + case "D": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("The member of the Rajya sabha are elected by?"); + System.out.println("A.People\t\t\tB.Elected members of the legislative council \n"); + System.out.println("C.Elected members of legislative assembly\t\t\tD.Lok sabha"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + } else if (perm % 3 == 2) { + System.out.println("The first women in space was ?"); + System.out.println("A.Valentina tereshkova\t\t\tB.kalpana Chawla\n"); + System.out.println("C.Tamara Press\t\t\tD.Sally Ride"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "d": + case "D": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } + // 55-------------------------------------------------------------------------------------------------------------------------------------------------- + // 55-------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println( + "Plant bends towards the source of light on account of the movement of curvature known as?"); + System.out.println("A.Geotropism\t\t\tB.Thigmotropism\n"); + System.out.println("C.Chemotropism\t\t\tD.Phototropism"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "d": + case "D": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("The first recipient of Rajiv Gandhi's 'Khel Ratna' award was?"); + System.out.println("A. Vishwanathan Anand\t\t\tB.Leander Peas\n"); + System.out.println("C.Kapil Dev\t\t\tD.Limba Ram"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } + + else if (perm % 3 == 2) { + System.out.println( + "Name the Cricketer who has became the youngest Batsman to score 10000 Runs in test Cricket ?"); + System.out.println("A. Alastair Cook\t\t\tB.Sachin Tendulkar\n"); + System.out.println("C.Daniel Vettori\t\t\tD.Ricky Ponting"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } + // 66-------------------------------------------------------------------------------------------------------------------------------------------------- + // 66-------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println("The leading state in Producing Paper is"); + System.out.println("A.Bihar\t\t\tB.West bengal\n"); + System.out.println("C.Kerala\t\t\tD.orissa"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "b": + case "B": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("Central Drug research Institute is located at "); + System.out.println("A.Delhi\t\t\tB.Nagpur\n"); + System.out.println("C.Mysore\t\t\tD.Lukhnow"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "d": + case "D": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } + + else if (perm % 3 == 2) { + System.out.println("The peroson who is also known as flying sikh of India ?"); + System.out.println("A.Mohinder singh\t\t\tB.Joginder singh\n"); + System.out.println("C.Milkha singh\t\t\tD.Ajit singh"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } + // 77-------------------------------------------------------------------------------------------------------------------------------------------------- + // 77-------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println("Which city is known as garden city of india"); + System.out.println("A.Chandigarh\t\t\tB.Imphal\n"); + System.out.println("C.Shimla\t\t\tD.Banglore"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "d": + case "D": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong D.Banglore is right"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("The first indian to recive the nobel prize in literature was"); + System.out.println("A.Rabindranath Tagore\t\t\tB.C.V Raman\n"); + System.out.println("C.Sarojni neidu\t\t\tD.Mother teresa"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right "); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong A.RabinderNath Tagore"); + Thread.sleep(1500); + } + + } + + else if (perm % 3 == 2) { + System.out.println("Who is the first Asian winner of nobel prize ?"); + System.out.println("A.Rajiv Gandi\t\t\tB.Mother teresa\n"); + System.out.println("C. C.V raman\t\t\tD.Rabindernath Tagore"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong C. C.V Raman is right"); + Thread.sleep(1500); + } + + } + + // 88-------------------------------------------------------------------------------------------------------------------------------------------------- + // 88-------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println("Which city is known as Big Apple"); + System.out.println("A.Tokoyo\t\t\tB.London\n"); + System.out.println("C.New York\t\t\tD.Banglore"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong C.New York is right"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("which is the Largest Airport in the world ?"); + System.out.println("A.Dubbai International Airport\t\t\tB.King Khalid International\n"); + System.out.println("C.Sarojni neidu\t\t\tD.Mother teresa"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "b": + case "B": + System.out.println("You are right "); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong A.RabinderNath Tagore"); + Thread.sleep(1500); + } + + } + + else if (perm % 3 == 2) { + System.out.println("Who is the first Asian winner of nobel prize ?"); + System.out.println("A.Rajiv Gandi\t\t\tB.Mother teresa\n"); + System.out.println("C. C.V raman\t\t\tD.Rabindernath Tagore"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong C. C.V Raman is right"); + Thread.sleep(1500); + } + } + // 99-------------------------------------------------------------------------------------------------------------------------------------------------- + // 99-------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println("How many languages and dialects are spoken by people all over the world? "); + System.out.println("A. 6,000\t\t\tB. 9,000\n"); + System.out.println("C. 4,000\t\t\tD. 1,000 "); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "b": + case "B": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong B. 9000 is right"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("Approximately, how many people speak Chinese language? "); + System.out.println("A. 1 billion\t\t\tB. 1 million\n"); + System.out.println("C. 1 lakh \t\t\tD. 1 thousand"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right "); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong A.1 Billion is true"); + Thread.sleep(1500); + } + + } + + else if (perm % 3 == 2) { + System.out.println("The language with the richest vocabulary is: "); + System.out.println("A. Hindi \t\t\tB. French \n"); + System.out.println("C. English\t\t\tD. German"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong C. English is right"); + Thread.sleep(1500); + } + + } + // 10-------------------------------------------------------------------------------------------------------------------------------------------------- + // 10-------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println( + "Which book has been printed in the maximum number of languages and these scripts"); + System.out.println("A. The Bible\t\t\tB. Hiraka Sutra\n"); + System.out.println("C. The Super Book\t\t\tGuliver Travel"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong A.The Bible is true"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("The only religious book ever printed in a shorthand scripts is "); + System.out.println("A. The Ramayana\t\t\tB. The Mahabharata\n"); + System.out.println("C. The bible \t\t\tD. Guru Granth Sahib "); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right "); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong C.The Bible is true"); + Thread.sleep(1500); + } + + } + + else if (perm % 3 == 2) { + System.out.println("The oldest printed work in the world, which dates back to AD 868 is:"); + System.out.println("A. The Bible \t\t\tB. The Hirake Sutra\n"); + System.out.println("C. The Ramayana\t\t\tD. The Mahabharata "); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "b": + case "B": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong B.The Hirake Sutra is right"); + Thread.sleep(1500); + } + + } + } + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + else if (part % 2 == 1) { + + for (int clr = 1; clr <= 45; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + long perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println( + "The American General who led the revolt against the British & declared American independence was"); + System.out.println("A. George Washington\t\t\tB. Bill Clinton \n"); + System.out.println("C. George Bush \t\t\tD. Brack Obama"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong A.Gorge washington is true"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("Who is known as the father of English poetry? "); + System.out.println("A. Geoffrey Chaucer\t\t\tB. John Milton\n"); + System.out.println("C. John Keats \t\t\tD. James Jeans"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong A. Geoffrey Chaucer is write answer"); + Thread.sleep(1500); + } + } else if (perm % 3 == 2) { + System.out.println("Who was first to reach the South Pole"); + System.out.println("A. Rear Admiral\t\t\tB. Capt. Amundsen \n"); + System.out.println("C. J.J Thomas \t\t\tD. Sir Edmund Hillary"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "b": + case "": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong B. Capt. Amundsen is write answer"); + Thread.sleep(1500); + } + } + // -------------------------------------------------------------------------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println("The language discovered by Gautam Bhuddha was ?"); + System.out.println("A.Bhojpuri\t\t\tB.magadhi\n"); + System.out.println("C.Pali\t\t\tD.Sanskrit"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong C.pali is right Answer"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println( + "which of the following English films was the first one to be dubbed in Hindi ?"); + System.out.println("A.Aladdin\t\t\tB.Universal Soldier\n"); + System.out.println("C.Speed\t\t\tD.iron man"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong A.Aladdin is right Answer"); + Thread.sleep(1500); + } + } else if (perm % 3 == 2) { + System.out.println( + "Name of the player of Indian cricket team who 4 january 2013 was named as CEAT International Cricketer of the year 2012 ?"); + System.out.println("A.Yuvraj Singh\t\t\tB.gautam gambhir\n"); + System.out.println("C.Sachin Tendulkar\t\t\tD.Virat Kohli"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "d": + case "D": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong D.virat Kohli is wright Answer"); + Thread.sleep(1500); + } + + } + // 33-------------------------------------------------------------------------------------------------------------------------------------------------- + // 33-------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println("Largest continent in the world is ?"); + System.out.println("A.Africa \t\t\tB.Asia \n"); + System.out.println("C.Australia\t\t\tD.Antarctica"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "b": + case "B": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong B.Asia is wright Answer"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("The India's Largest Rainfall is reported at?"); + System.out.println("A.sikkim\t\t\tB.Rajasthan \n"); + System.out.println("C.Mawsynram\t\t\tD.chamba"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong C.Mawsynram is wright Answer"); + Thread.sleep(1500); + } + } else if (perm % 3 == 2) { + System.out.println("Who was the first Indian to be President of UN General assembly ?"); + System.out.println("A.Mr. Vijay Lakshmi Pandit\t\t\tB. Ramesh Bhandari\n"); + System.out.println("C.Natwar Singh\t\t\tD.Krishna Menon"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong A.Mr.Vijay Lakshmi Pandit"); + Thread.sleep(1500); + } + + } + // 44-------------------------------------------------------------------------------------------------------------------------------------------------- + // 44-------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println("which king belongs the Lion capital at sarnath?"); + System.out.println("A.Chandragupta\t\t\tB.Kanishka\n"); + System.out.println("C.Harsha\t\t\tD.Ashoka"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "d": + case "D": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong D.Ashoka is right answer"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("The member of the Rajya sabha are elected by?"); + System.out.println("A.People\t\t\tB.Elected members of the legislative council \n"); + System.out.println("C.Elected members of legislative assembly\t\t\tD.Lok sabha"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println( + "you are wrong C.Elected member of legistative assembly is right Asnswer "); + Thread.sleep(1500); + } + } else if (perm % 3 == 2) { + System.out.println("The first women in space was ?"); + System.out.println("A.Valentina tereshkova\t\t\tB.kalpana Chawla\n"); + System.out.println("C.Tamara Press\t\t\tD.Sally Ride"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "d": + case "D": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong d.Sally Ride is wright Answer"); + Thread.sleep(1500); + } + + } + // 55-------------------------------------------------------------------------------------------------------------------------------------------------- + // 55-------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println( + "Plant bends towards the source of light on account of the movement of curvature known as?"); + System.out.println("A.Geotropism\t\t\tB.Thigmotropism\n"); + System.out.println("C.Chemotropism\t\t\tD.Phototropism"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "d": + case "D": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong D.phototropism is right Answer"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("The first recipient of Rajiv Gandhi's 'Khel Ratna' award was?"); + System.out.println("A. Vishwanathan Anand\t\t\tB.Leander Peas\n"); + System.out.println("C.Kapil Dev\t\t\tD.Limba Ram"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong A.Vishwanathan Anand is right"); + Thread.sleep(1500); + } + + } + + else if (perm % 3 == 2) { + System.out.println( + "Name the Cricketer who has became the youngest Batsman to score 10000 Runs in test Cricket ?"); + System.out.println("A. Alastair Cook\t\t\tB.Sachin Tendulkar\n"); + System.out.println("C.Daniel Vettori\t\t\tD.Ricky Ponting"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } + // 66-------------------------------------------------------------------------------------------------------------------------------------------------- + // 66-------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println("The leading state in Producing Paper is"); + System.out.println("A.Bihar\t\t\tB.West bengal\n"); + System.out.println("C.Kerala\t\t\tD.orissa"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "b": + case "B": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("Central Drug research Institute is located at "); + System.out.println("A.Delhi\t\t\tB.Nagpur\n"); + System.out.println("C.Mysore\t\t\tD.Lukhnow"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "d": + case "D": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } + + else if (perm % 3 == 2) { + System.out.println("The peroson who is also known as flying sikh of India ?"); + System.out.println("A.Mohinder singh\t\t\tB.Joginder singh\n"); + System.out.println("C.Milkha singh\t\t\tD.Ajit singh"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong"); + Thread.sleep(1500); + } + + } + // 77-------------------------------------------------------------------------------------------------------------------------------------------------- + // 77-------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println("Which city is known as garden city of india"); + System.out.println("A.Chandigarh\t\t\tB.Imphal\n"); + System.out.println("C.Shimla\t\t\tD.Banglore"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "d": + case "D": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong D.Banglore is right"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("The first indian to recive the nobel prize in literature was"); + System.out.println("A.Rabindranath Tagore\t\t\tB.C.V Raman\n"); + System.out.println("C.Sarojni neidu\t\t\tD.Mother teresa"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right "); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong A.RabinderNath Tagore"); + Thread.sleep(1500); + } + + } + + else if (perm % 3 == 2) { + System.out.println("Who is the first Asian winner of nobel prize ?"); + System.out.println("A.Rajiv Gandi\t\t\tB.Mother teresa\n"); + System.out.println("C. C.V raman\t\t\tD.Rabindernath Tagore"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong C. C.V Raman is right"); + Thread.sleep(1500); + } + + } + + // 88-------------------------------------------------------------------------------------------------------------------------------------------------- + // 88-------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println("Which city is known as Big Apple"); + System.out.println("A.Tokoyo\t\t\tB.London\n"); + System.out.println("C.New York\t\t\tD.Banglore"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong C.New York is right"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("which is the Largest Airport in the world ?"); + System.out.println("A.Dubbai International Airport\t\t\tB.King Khalid International\n"); + System.out.println("C.Sarojni neidu\t\t\tD.Mother teresa"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "b": + case "B": + System.out.println("You are right "); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong A.RabinderNath Tagore"); + Thread.sleep(1500); + } + + } + + else if (perm % 3 == 2) { + System.out.println("Who is the first Asian winner of nobel prize ?"); + System.out.println("A.Rajiv Gandi\t\t\tB.Mother teresa\n"); + System.out.println("C. C.V raman\t\t\tD.Rabindernath Tagore"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong C. C.V Raman is right"); + Thread.sleep(1500); + } + } + // 99-------------------------------------------------------------------------------------------------------------------------------------------------- + // 99-------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println("How many languages and dialects are spoken by people all over the world? "); + System.out.println("A. 6,000\t\t\tB. 9,000\n"); + System.out.println("C. 4,000\t\t\tD. 1,000 "); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "b": + case "B": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong B. 9000 is right"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("Approximately, how many people speak Chinese language? "); + System.out.println("A. 1 billion\t\t\tB. 1 million\n"); + System.out.println("C. 1 lakh \t\t\tD. 1 thousand"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right "); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong A.1 Billion is true"); + Thread.sleep(1500); + } + + } + + else if (perm % 3 == 2) { + System.out.println("The language with the richest vocabulary is: "); + System.out.println("A. Hindi \t\t\tB. French \n"); + System.out.println("C. English\t\t\tD. German"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong C. English is right"); + Thread.sleep(1500); + } + + } + // 10-------------------------------------------------------------------------------------------------------------------------------------------------- + // 10-------------------------------------------------------------------------------------------------------------------------------------------------- + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\t\t##################Practise zone######################\n\n"); + + perm = System.currentTimeMillis(); + if (perm % 3 == 0) { + System.out.println( + "Which book has been printed in the maximum number of languages and these scripts"); + System.out.println("A. The Bible\t\t\tB. Hiraka Sutra\n"); + System.out.println("C. The Super Book\t\t\tGuliver Travel"); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "a": + case "A": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong A.The Bible is true"); + Thread.sleep(1500); + } + + } else if (perm % 3 == 1) { + System.out.println("The only religious book ever printed in a shorthand scripts is "); + System.out.println("A. The Ramayana\t\t\tB. The Mahabharata\n"); + System.out.println("C. The bible \t\t\tD. Guru Granth Sahib "); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "c": + case "C": + System.out.println("You are right "); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong C.The Bible is true"); + Thread.sleep(1500); + } + + } + + else if (perm % 3 == 2) { + System.out.println("The oldest printed work in the world, which dates back to AD 868 is:"); + System.out.println("A. The Bible \t\t\tB. The Hirake Sutra\n"); + System.out.println("C. The Ramayana\t\t\tD. The Mahabharata "); + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + String prac = m.next(); + switch (prac) { + case "b": + case "B": + System.out.println("You are right"); + Thread.sleep(1500); + break; + case "Exit": + case "exit": + return; + default: + System.out.println("you are wrong B.The Hirake Sutra is right"); + Thread.sleep(1500); + } + + } + + } + + } + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + else if (enter == 5) { + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + System.out.println("\t\t\t\t\tHELP"); + System.out.println(" If you are Playing this game you have to know :-"); + System.out.println( + " --------------------------------------------------------------------------------------"); + System.out.println( + "|1. First you have to solve Fastest finger question |"); + System.out.println( + "|2. After solving the fastest finger question you will move to Hot Seat zone |"); + System.out.println( + "|3. In Hot seat zone you will receive different questions one by one and |"); + System.out.println( + "|you have to give right answer to recive next Question |"); + System.out.println( + "|4. To Become Winner you have to give the right answer of 15 Question |"); + System.out.println( + "|5. You have 30 Second to give you answer but If you are using lifeline then |"); + System.out.println( + "|timer will stop till the lifeline will complete after that time is automatically On |"); + System.out.println( + "|6. You have 7 Lifeline but each Lifeline can works only one Time. |"); + System.out.println( + " --------------------------------------------------------------------------------------\n"); + System.out.println("If you are using Practise zone "); + System.out.println( + " --------------------------------------------------------------------------------------"); + System.out.println( + "|1. Practise zone is same as play but the difference was that if you give wrong answer |"); + System.out.println( + "|then program does not stop .They will move to next question |"); + System.out.println( + "|2.You can give your answer any time(because timer is not present) |"); + System.out.println( + "|3.It contains different parts Each part contain 10 question |"); + System.out.println( + "|4.You have to give answer without using lifeline(lifeline is not added) |"); + System.out.println( + "|5.It is created for practise work and inceasing knowledge |"); + System.out.println( + " --------------------------------------------------------------------------------------\n"); + System.out.println(" If you want to check your score"); + System.out.println( + " --------------------------------------------------------------------------------------"); + System.out.println( + "|1. In Menu option select Third option |"); + System.out.println( + "|2. Then Enter your name and age |"); + System.out.println( + "|3. If you have Played our game or your record is save in our database then |"); + System.out.println( + "|you are can easily view your high score |"); + System.out.println( + " --------------------------------------------------------------------------------------\n"); + Thread.sleep(20000); + System.out.println("If you want to check highscore"); + System.out.println( + " --------------------------------------------------------------------------------------"); + System.out.println( + "|1. In Menu option select fourth option |"); + System.out.println( + "|2. Then you will easily able to view the name and age of the highscorer and |"); + System.out.println( + "|you are can easily view high score |"); + System.out.println( + " --------------------------------------------------------------------------------------\n"); + Thread.sleep(15000); + System.out.println("If you want to Quit/Exit"); + System.out.println( + " --------------------------------------------------------------------------------------"); + System.out.println( + "|1. In Menu option select Fifth option |"); + System.out.println( + "|2. Then the program will Exit |"); + System.out.println( + " --------------------------------------------------------------------------------------"); + + Thread.sleep(5500); + System.out.println(); + Thread.sleep(5500); + System.out.println(); + Thread.sleep(5500); + Thread.sleep(5500); + System.out.println(); + Thread.sleep(5500); + System.out.println(); + Thread.sleep(5500); + System.out.println(); + Thread.sleep(5500); + System.out.println(); + Thread.sleep(5500); + System.out.println(); + Thread.sleep(5500); + System.out.println(); + Thread.sleep(5500); + System.out.println(); + Thread.sleep(5500); + System.out.println(); + Thread.sleep(5500); + System.out.println(); + Thread.sleep(5500); + System.out.println(); + Thread.sleep(5500); + System.out.println(); + Thread.sleep(5500); + System.out.println(); + Thread.sleep(5500); + System.out.println(); + Thread.sleep(5500); + System.out.println(); + Thread.sleep(5500); + } else if (enter == 3) { + for (int clr = 1; clr <= 23; clr++) { + System.out.println(""); + } + System.out.println( + "\t\t\t)))))))))))))))))))))))))))))))))))))))))Your high Score((((((((((((((((((((((((((((((((((((((((((((("); + + String yourname; + + int yourage, a = 0; + System.out.println("Enter your name "); + for (int clr = 1; clr <= 26; clr++) { + System.out.println(); + } + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + yourname = m.next(); + System.out.println("Enter you age"); + yourage = m.nextInt(); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(); + } + ResultSet Res = statement + .executeQuery("select * from score where name like'" + yourname + "' && age=" + yourage + ";"); + System.out + .println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); + while (Res.next()) { + + System.out.println(" Name =>" + Res.getString(2) + " Age =>" + Res.getInt(3) + " Total Earn=>" + + Res.getInt(4)); + + a++; + } + System.out + .println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); + for (int clr = 1; clr <= 27 - a; clr++) { + System.out.println(); + } + + } + // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + else if (enter == 4) { + int a = 0; + for (int clr = 1; clr <= 25; clr++) { + System.out.println(); + } + ResultSet Res = statement.executeQuery("select * from score order by score desc;"); + System.out + .println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); + System.out + .println("+ High Score +"); + System.out + .println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); + while (Res.next()) { + + System.out.println(" Name =>" + Res.getString(2) + " Age =>" + Res.getInt(3) + " Total Earn=>" + + Res.getInt(4)); + System.out.println(); + + a += 2; + } + System.out + .println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); + for (int clr = 1; clr <= 25 - a; clr++) { + System.out.println(); + } + } + + else if (enter == 6) { + return; + } + + } catch (InterruptedException exc) { + System.out.println("sleep\\wait is not working"); + } + + } + + // +++++++++++++++++++++++++++++++++++++LIFELINE++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // +++++++++++++++++++++++++++++++++++++LIFELINE++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + public void lifeline(int quesno) { + Scanner m = new Scanner(System.in); + if (quesno == 1) { + try { + System.out.print("------------------------------------------------------"); + System.out.print("\n|\t\t Lifeline\t\t\t |\n"); + System.out.println("------------------------------------------------------"); + System.out.println("1.Audience poll \t\t2.Phone a friend"); + System.out.println("3.Fifty fifty \t\t4.Flip The question"); + System.out.println("5.Power paplu \t\t6.Ask an expert"); + System.out.println("7.Double Dip"); + for (int space = 1; space <= 23; space++) { + System.out.println(""); + } + int lifeline = m.nextInt(); + System.out.println(); + System.out.println(); + if (lifeline == 1) { + try { + ap = ap + 1; + if (ap == 1) { + System.out.print("Audience are voting"); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print(".\n\n\n\n\n"); + System.out.println(" Audience Rating"); + System.out.println(" |-|-|-|-|-|-|-|-|-||-|-|-|-|-|-|"); + System.out.println(" |-| A B C D |-|"); + System.out.println(" |-| |-|"); + System.out.println(" |-| |-|"); + System.out.println(" |-| |-|"); + System.out.println(" |-| __ |-|"); + System.out.println(" |-| | | |-|"); + System.out.println(" |-| | | |-|"); + System.out.println(" |-| | | |-|"); + System.out.println(" |-| | | __ |-|"); + System.out.println(" |-| |60| |20| __ __ |-|"); + System.out.println(" |-| | |_| |_|10|_|10| |-|"); + System.out.println(" |-| |__|_|__|_|__|_|__| |-|"); + System.out.println(" |-|-|-|-|-|-|-|-|-||-|-|-|-|-|-|"); + for (int move = 1; move <= 16; move++) { + System.out.println(); + } + } else { + System.out.println("you have used this lifeline"); + lifeline(1); + } + + } catch (InterruptedException exc) { + + } + + } + + else if (lifeline == 2) { + for (int space = 1; space <= 25; space++) { + System.out.println(""); + } + ph = ph + 1; + if (ph == 1) { + System.out.println("Choose any friend to call for help"); + System.out.println(" _________ _________ _________ _________ "); + System.out + .println("| |\\ | |\\ | |\\ | |\\"); + System.out.println("| RAM | | | RAHIM | | | RAJAN | | | ROHIT | |"); + System.out.println("|_________| | |_________| | |_________| | |_________| |"); + System.out.println( + " \\|________\\| \\|_________\\| \\|_________\\| \\|_________\\|"); + System.out.println("Enter any one name for calling"); + + for (int space = 1; space <= 24; space++) { + System.out.println(""); + } + String call = m.next(); + switch (call) { + + case "Ram": + case "RAM": + case "ram": + case "Rahim": + case "rahim": + case "RAHIM": + case "Rajan": + case "rajan": + case "RAJAN": + case "Rohit": + case "rohit": + case "ROHIT": + + System.out.print("Call is Diverting to " + call); + + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.println("."); + System.out.println("Hello"); + String as = m.next(); + + System.out.println("Enter your question"); + String a = m.next(); + System.out.println("give me option"); + String asa = m.next(); + System.out.println("I think A is True"); + break; + + } + + } else { + System.out.println("You have already used this lifeline"); + lifeline(1); + } + } else if (lifeline == 3) { + for (int move = 1; move <= 30; move++) { + System.out.println(""); + } + ff = ff + 1; + if (ff == 1) { + System.out.println("Fifty fifty"); + System.out.println("You Answer may be :-"); + System.out.println("A. "); + System.out.println("\t\tC."); + for (int move = 1; move <= 27; move++) { + System.out.println(""); + } + } else { + System.out.println("You have already used this lifeline"); + lifeline(1); + } + } else if (lifeline == 4) { + fq = fq + 1; + if (fq == 1) { + System.out.println("Flip the Question"); + System.out.println("According to the Mahabharata, who made Gandiva, the famous bow of Arjuna?"); + System.out.println("(A) Brahma (B) Indra "); + System.out.println("(C) Chandra (D) Prajapati"); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + + } else { + System.out.println("you have already used this lifeline"); + lifeline(1); + } + } else if (lifeline == 5) { + pp = pp + 1; + if (pp == 1) { + System.out.print("------------------------------------------------------"); + System.out.print("\n|\t\t Lifeline\t\t\t |\n"); + System.out.println("------------------------------------------------------"); + System.out.println("1.Audience poll \t\t2.Phone a friend"); + System.out.println("3.Fifty fifty \t\t4.Flip The question"); + System.out.println("5.Power paplu \t\t6.Ask an expert"); + System.out.println("7.Double Dip"); + for (int space = 1; space <= 23; space++) { + System.out.println(""); + } + int pp = m.nextInt(); + for (int space = 1; space <= 23; space++) { + System.out.println(""); + } + if (pp == 1) { + System.out.println("Audience poll is Renewed"); + ap = 0; + lifeline(1); + } else if (pp == 2) { + System.out.println("Phone a Friend is Renewed"); + ph = 0; + lifeline(1); + } else if (pp == 3) { + System.out.println("Fifty Fifty is Renewed"); + ff = 0; + lifeline(1); + } else if (pp == 4) { + System.out.println("Flip the Question is Renewed"); + ask = 0; + lifeline(1); + } else if (pp == 6) { + System.out.println("Ask an expert is Renewed"); + ask = 0; + lifeline(1); + } else { + System.out.println("Double dip is Renewed"); + dd = 0; + lifeline(1); + } + + System.out.println("Renew any lifeline"); + } else { + System.out.println("You have already used this lifeline"); + lifeline(1); + } + } else if (lifeline == 6) { + ask = ask + 1; + if (ask == 1) { + System.out.println("Ask an Expert"); + System.out.println("our today expert is Rohit joshi"); + System.out.print("Redirecting to Rohit joshi"); + Thread.sleep(1000); + System.out.println("."); + Thread.sleep(1000); + System.out.println("."); + Thread.sleep(1000); + System.out.println("."); + Thread.sleep(1000); + System.out.println("."); + Thread.sleep(1000); + System.out.println("."); + + } else { + System.out.println("You have Already used this lifeline"); + lifeline(1); + } + } else if (lifeline == 7) { + dd = dd + 1; + if (dd == 1) { + + System.out.println("Double dip"); + System.out.println("Enter Two Option 1 by 1"); + for (int space = 1; space <= 23; space++) { + System.out.println(""); + } + String as; + as = m.next(); + switch (as) { + case "a": + case "A": + System.out.println("A is right Enter once again"); + break; + default: + System.out.println("Answer is wrong try again"); + } + } else { + System.out.println("You have Already used this lifeline"); + lifeline(1); + } + } else { + System.out.println("you have enter wrong choice"); + lifeline(1); + } + + } catch (InterruptedException exc) { + System.out.println("!!!!!!!!!!!!!!!!!!!!RESTART!!!!!!!!!!!!!!!!!!!"); + } + + } + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + else if (quesno == 2) { + { + try { + System.out.print("------------------------------------------------------"); + System.out.print("\n|\t\t Lifeline\t\t\t |\n"); + System.out.println("------------------------------------------------------"); + System.out.println("1.Audience poll \t\t2.Phone a friend"); + System.out.println("3.Fifty fifty \t\t4.Flip The question"); + System.out.println("5.Power paplu \t\t6.Ask an expert"); + System.out.println("7.Double Dip"); + for (int space = 1; space <= 23; space++) { + System.out.println(""); + } + int lifeline = m.nextInt(); + System.out.println(); + System.out.println(); + if (lifeline == 1) { + try { + ap = ap + 1; + if (ap == 1) { + System.out.print("Audience are voting"); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print(".\n\n\n\n\n"); + System.out.println(" Audience Rating"); + System.out.println(" |-|-|-|-|-|-|-|-|-||-|-|-|-|-|-|"); + System.out.println(" |-| A B C D |-|"); + System.out.println(" |-| |-|"); + System.out.println(" |-| |-|"); + System.out.println(" |-| __ |-|"); + System.out.println(" |-| | | |-|"); + System.out.println(" |-| | | |-|"); + System.out.println(" |-| | | |-|"); + System.out.println(" |-| | | |-|"); + System.out.println(" |-| | | |-|"); + System.out.println(" |-| __ |80| __ __ |-|"); + System.out.println(" |-| |10|_| |_|10|_|10| |-|"); + System.out.println(" |-| |__|_|__|_|__|_|__| |-|"); + System.out.println(" |-|-|-|-|-|-|-|-|-||-|-|-|-|-|-|"); + for (int move = 1; move <= 16; move++) { + System.out.println(); + } + } else { + System.out.println("you have used this lifeline"); + lifeline(1); + } + + } catch (InterruptedException exc) { + + } + + } + + else if (lifeline == 2) { + for (int space = 1; space <= 25; space++) { + System.out.println(""); + } + ph = ph + 1; + if (ph == 1) { + System.out.println("Choose any friend to call for help"); + System.out + .println(" _________ _________ _________ _________ "); + System.out.println( + "| |\\ | |\\ | |\\ | |\\"); + System.out + .println("| RAM | | | RAHIM | | | RAJAN | | | ROHIT | |"); + System.out + .println("|_________| | |_________| | |_________| | |_________| |"); + System.out.println( + " \\|________\\| \\|_________\\| \\|_________\\| \\|_________\\|"); + System.out.println("Enter any one name for calling"); + + for (int space = 1; space <= 24; space++) { + System.out.println(""); + } + String call = m.next(); + switch (call) { + + case "Ram": + case "RAM": + case "ram": + case "Rahim": + case "rahim": + case "RAHIM": + case "Rajan": + case "rajan": + case "RAJAN": + case "Rohit": + case "rohit": + case "ROHIT": + + System.out.print("Call is Diverting to " + call); + + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.println("."); + System.out.println("Hello"); + String as = m.next(); + + System.out.println("Enter your question"); + String a = m.next(); + System.out.println("give me option"); + String asa = m.next(); + System.out.println("I think B is True"); + break; + + } + + } else { + System.out.println("You have already used this lifeline"); + lifeline(2); + } + } else if (lifeline == 3) { + for (int move = 1; move <= 30; move++) { + System.out.println(""); + } + ff = ff + 1; + if (ff == 1) { + System.out.println("Fifty fifty"); + System.out.println("You Answer may be :-"); + System.out.println("\t\tB."); + System.out.println("C."); + for (int move = 1; move <= 27; move++) { + System.out.println(""); + } + } else { + System.out.println("You have already used this lifeline"); + lifeline(2); + } + } else if (lifeline == 4) { + fq = fq + 1; + if (fq == 1) { + System.out.println("Flip the Question"); + System.out.println( + "In Cricket, “round the wicket� and “over the wicket� represent what ?"); + System.out.println("(A) Wicket-keeping (B) Bowling "); + System.out.println("(C) Batting (D) Commentary"); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + + } else { + System.out.println("you have already used this lifeline"); + lifeline(2); + } + } else if (lifeline == 5) { + pp = pp + 1; + if (pp == 1) { + System.out.print("------------------------------------------------------"); + System.out.print("\n|\t\t Lifeline\t\t\t |\n"); + System.out.println("------------------------------------------------------"); + System.out.println("1.Audience poll \t\t2.Phone a friend"); + System.out.println("3.Fifty fifty \t\t4.Flip The question"); + System.out.println("5.Power paplu \t\t6.Ask an expert"); + System.out.println("7.Double Dip"); + for (int space = 1; space <= 23; space++) { + System.out.println(""); + } + int pp = m.nextInt(); + for (int space = 1; space <= 23; space++) { + System.out.println(""); + } + if (pp == 1) { + System.out.println("Audience poll is Renewed"); + ap = 0; + lifeline(2); + } else if (pp == 2) { + System.out.println("Phone a Friend is Renewed"); + ph = 0; + lifeline(2); + } else if (pp == 3) { + System.out.println("Fifty Fifty is Renewed"); + ff = 0; + lifeline(2); + } else if (pp == 4) { + System.out.println("Flip the Question is Renewed"); + ask = 0; + lifeline(2); + } else if (pp == 6) { + System.out.println("Ask an expert is Renewed"); + ask = 0; + lifeline(2); + } else { + System.out.println("Double dip is Renewed"); + dd = 0; + lifeline(2); + } + + System.out.println("Renew any lifeline"); + } else { + System.out.println("You have already used this lifeline"); + lifeline(2); + } + } else if (lifeline == 6) { + ask = ask + 1; + if (ask == 1) { + System.out.println("Ask an Expert"); + System.out.println("our today expert is Rohit joshi"); + System.out.print("Redirecting to Rohit joshi"); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + System.out.println("I think B is right"); + } else { + System.out.println("You have Already used this lifeline"); + lifeline(2); + } + } else if (lifeline == 7) { + dd = dd + 1; + if (dd == 1) { + + System.out.println("Double dip"); + System.out.println("Enter Two Option 1 by 1"); + for (int space = 1; space <= 23; space++) { + System.out.println(""); + } + String as; + as = m.next(); + switch (as) { + case "b": + case "B": + System.out.println("B is right Enter once again"); + break; + default: + System.out.println("Answer is wrong try again"); + } + } else { + System.out.println("You have Already used this lifeline"); + lifeline(2); + } + } else { + System.out.println("you have enter wrong choice"); + lifeline(2); + } + + } catch (InterruptedException exc) { + System.out.println("!!!!!!!!!!!!!!!!!!!!RESTART!!!!!!!!!!!!!!!!!!!"); + } + + } + } + + // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + else if (quesno == 3) { + { + try { + System.out.print("------------------------------------------------------"); + System.out.print("\n|\t\t Lifeline\t\t\t |\n"); + System.out.println("------------------------------------------------------"); + System.out.println("1.Audience poll \t\t2.Phone a friend"); + System.out.println("3.Fifty fifty \t\t4.Flip The question"); + System.out.println("5.Power paplu \t\t6.Ask an expert"); + System.out.println("7.Double Dip"); + for (int space = 1; space <= 23; space++) { + System.out.println(""); + } + int lifeline = m.nextInt(); + System.out.println(); + System.out.println(); + if (lifeline == 1) { + try { + ap = ap + 1; + if (ap == 1) { + System.out.print("Audience are voting"); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print(".\n\n\n\n\n"); + System.out.println(" Audience Rating"); + System.out.println(" |-|-|-|-|-|-|-|-|-||-|-|-|-|-|-|"); + System.out.println(" |-| A B C D |-|"); + System.out.println(" |-| |-|"); + System.out.println(" |-| |-|"); + System.out.println(" |-| |-|"); + System.out.println(" |-| |-|"); + System.out.println(" |-| |-|"); + System.out.println(" |-| __ |-|"); + System.out.println(" |-| __ | | |-|"); + System.out.println(" |-| | | __ | | |-|"); + System.out.println(" |-| |30| |20| | | __ |-|"); + System.out.println(" |-| | |_| |_|40|_|10| |-|"); + System.out.println(" |-| |__|_|__|_|__|_|__| |-|"); + System.out.println(" |-|-|-|-|-|-|-|-|-||-|-|-|-|-|-|"); + for (int move = 1; move <= 15; move++) { + System.out.println(); + } + } else { + System.out.println("you have used this lifeline"); + lifeline(3); + } + + } catch (InterruptedException exc) { + + } + + } + + else if (lifeline == 2) { + for (int space = 1; space <= 25; space++) { + System.out.println(""); + } + ph = ph + 1; + if (ph == 1) { + System.out.println("Choose any friend to call for help"); + System.out + .println(" _________ _________ _________ _________ "); + System.out.println( + "| |\\ | |\\ | |\\ | |\\"); + System.out + .println("| RAM | | | RAHIM | | | RAJAN | | | ROHIT | |"); + System.out + .println("|_________| | |_________| | |_________| | |_________| |"); + System.out.println( + " \\|________\\| \\|_________\\| \\|_________\\| \\|_________\\|"); + System.out.println("Enter any one name for calling"); + + for (int space = 1; space <= 24; space++) { + System.out.println(""); + } + String call = m.next(); + switch (call) { + + case "Ram": + case "RAM": + case "ram": + case "Rahim": + case "rahim": + case "RAHIM": + case "Rajan": + case "rajan": + case "RAJAN": + case "Rohit": + case "rohit": + case "ROHIT": + + System.out.print("Call is Diverting to " + call); + + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.println("."); + System.out.println("Hello"); + String as = m.next(); + + System.out.println("Enter your question"); + String a = m.next(); + System.out.println("give me option"); + String asa = m.next(); + System.out.println("I think C is True"); + break; + + } + + } else { + System.out.println("You have already used this lifeline"); + lifeline(3); + } + } else if (lifeline == 3) { + for (int move = 1; move <= 30; move++) { + System.out.println(""); + } + ff = ff + 1; + if (ff == 1) { + System.out.println("Fifty fifty"); + System.out.println("You Answer may be :-"); + System.out.println("\t\tB. "); + System.out.println("C."); + for (int move = 1; move <= 26; move++) { + System.out.println(); + } + } else { + System.out.println("You have already used this lifeline"); + lifeline(3); + } + } else if (lifeline == 4) { + fq = fq + 1; + if (fq == 1) { + System.out.println("Flip the Question"); + System.out.println("Which of these Indian cricketers made his Test Debut in 2012?"); + System.out.println("(A) Abhinav Mukund (B) Ajankia Rahane "); + System.out.println("(C) Ravindra Jadeja (D) Rohit Sharma"); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + + } else { + System.out.println("you have already used this lifeline"); + lifeline(3); + } + } else if (lifeline == 5) { + pp = pp + 1; + if (pp == 1) { + System.out.println("Welcome To Power Paplu Lifeline"); + System.out.print("------------------------------------------------------"); + System.out.print("\n|\t\t Lifeline\t\t\t |\n"); + System.out.println("------------------------------------------------------"); + System.out.println("1.Audience poll \t\t2.Phone a friend"); + System.out.println("3.Fifty fifty \t\t4.Flip The question"); + System.out.println("5.Power paplu \t\t6.Ask an expert"); + System.out.println("7.Double Dip"); + for (int space = 1; space <= 23; space++) { + System.out.println(""); + } + int pp = m.nextInt(); + for (int space = 1; space <= 23; space++) { + System.out.println(""); + } + if (pp == 1) { + System.out.println("Audience poll is Renewed"); + ap = 0; + lifeline(3); + } else if (pp == 2) { + System.out.println("Phone a Friend is Renewed"); + ph = 0; + lifeline(3); + } else if (pp == 3) { + System.out.println("Fifty Fifty is Renewed"); + ff = 0; + lifeline(3); + } else if (pp == 4) { + System.out.println("Flip the Question is Renewed"); + ask = 0; + lifeline(3); + } else if (pp == 6) { + System.out.println("Ask an expert is Renewed"); + ask = 0; + lifeline(3); + } else { + System.out.println("Double dip is Renewed"); + dd = 0; + lifeline(3); + } + + System.out.println("Renew any lifeline"); + } else { + System.out.println("You have already used this lifeline"); + lifeline(3); + } + } else if (lifeline == 6) { + ask = ask + 1; + if (ask == 1) { + System.out.println("Ask an Expert"); + System.out.println("our today expert is Rohit joshi"); + System.out.print("Redirecting to Rohit joshi"); + Thread.sleep(1000); + System.out.println("."); + Thread.sleep(1000); + System.out.println("."); + Thread.sleep(1000); + System.out.println("."); + Thread.sleep(1000); + System.out.println("."); + Thread.sleep(1000); + System.out.println("."); + System.out.println("I Think C is true"); + + } else { + System.out.println("You have Already used this lifeline"); + lifeline(3); + } + } else if (lifeline == 7) { + dd = dd + 1; + if (dd == 1) { + + System.out.println("Double dip"); + System.out.println("Enter Two Option 1 by 1"); + for (int space = 1; space <= 23; space++) { + System.out.println(""); + } + + String as; + as = m.next(); + switch (as) { + case "c": + case "C": + System.out.println("C is right Enter once again"); + break; + default: + System.out.println("Answer is wrong try again"); + } + + } else { + System.out.println("You have Already used this lifeline"); + lifeline(3); + } + } else { + System.out.println("you have enter wrong choice"); + lifeline(3); + } + + } catch (InterruptedException exc) { + System.out.println("!!!!!!!!!!!!!!!!!!!!RESTART!!!!!!!!!!!!!!!!!!!"); + } + + } + } else { + { + try { + System.out.print("------------------------------------------------------"); + System.out.print("\n|\t\t Lifeline\t\t\t |\n"); + System.out.println("------------------------------------------------------"); + System.out.println("1.Audience poll \t\t2.Phone a friend"); + System.out.println("3.Fifty fifty \t\t4.Flip The question"); + System.out.println("5.Power paplu \t\t6.Ask an expert"); + System.out.println("7.Double Dip"); + for (int space = 1; space <= 23; space++) { + System.out.println(""); + } + int lifeline = m.nextInt(); + System.out.println(); + System.out.println(); + if (lifeline == 1) { + try { + ap = ap + 1; + if (ap == 1) { + System.out.print("Audience are voting"); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print(".\n\n\n\n\n"); + System.out.println(" Audience Rating"); + System.out.println(" |-|-|-|-|-|-|-|-|-||-|-|-|-|-|-|"); + System.out.println(" |-| A B C D |-|"); + System.out.println(" |-| |-|"); + System.out.println(" |-| |-|"); + System.out.println(" |-| |-|"); + System.out.println(" |-| __ |-|"); + System.out.println(" |-| | | |-|"); + System.out.println(" |-| | | |-|"); + System.out.println(" |-| | | |-|"); + System.out.println(" |-| __ | | |-|"); + System.out.println(" |-| __ |20| __ | | |-|"); + System.out.println(" |-| |10|_| |_|10|_|60| |-|"); + System.out.println(" |-| |__|_|__|_|__|_|__| |-|"); + System.out.println(" |-|-|-|-|-|-|-|-|-||-|-|-|-|-|-|"); + for (int move = 1; move <= 16; move++) { + System.out.println(); + } + } else { + System.out.println("you have used this lifeline"); + lifeline(4); + } + + } catch (InterruptedException exc) { + + } + + } + + else if (lifeline == 2) { + for (int space = 1; space <= 25; space++) { + System.out.println(""); + } + ph = ph + 1; + if (ph == 1) { + System.out.println("Choose any friend to call for help"); + System.out + .println(" _________ _________ _________ _________ "); + System.out.println( + "| |\\ | |\\ | |\\ | |\\"); + System.out + .println("| RAM | | | RAHIM | | | RAJAN | | | ROHIT | |"); + System.out + .println("|_________| | |_________| | |_________| | |_________| |"); + System.out.println( + " \\|________\\| \\|_________\\| \\|_________\\| \\|_________\\|"); + System.out.println("Enter any one name for calling"); + + for (int space = 1; space <= 24; space++) { + System.out.println(""); + } + String call = m.next(); + switch (call) { + + case "Ram": + case "RAM": + case "ram": + case "Rahim": + case "rahim": + case "RAHIM": + case "Rajan": + case "rajan": + case "RAJAN": + case "Rohit": + case "rohit": + case "ROHIT": + + System.out.print("Call is Diverting to " + call); + + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.print("."); + Thread.sleep(1000); + System.out.println("."); + System.out.println("Hello"); + String as = m.next(); + + System.out.println("Enter your question"); + String a = m.next(); + System.out.println("give me option"); + String asa = m.next(); + System.out.println("I think D is True"); + break; + + } + + } else { + System.out.println("You have already used this lifeline"); + lifeline(4); + } + } else if (lifeline == 3) { + for (int move = 1; move <= 30; move++) { + System.out.println(""); + } + ff = ff + 1; + if (ff == 1) { + System.out.println("Fifty fifty"); + System.out.println("You Answer may be :-"); + System.out.println("A. "); + System.out.println("\t\tC."); + for (int move = 1; move <= 27; move++) { + System.out.println(""); + } + } else { + System.out.println("You have already used this lifeline"); + lifeline(4); + } + } else if (lifeline == 4) { + fq = fq + 1; + if (fq == 1) { + System.out.println("Flip the Question"); + System.out.println( + "Which of the only planet of our Solar System that rotates in a clockwise direction around its own axis?"); + System.out.println("(A) Earth (B) Jupiter "); + System.out.println("(C) Mars (D) Venus"); + for (int clr = 1; clr <= 25; clr++) { + System.out.println(""); + } + + System.out.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nAns:-"); + + } else { + System.out.println("you have already used this lifeline"); + lifeline(4); + } + } else if (lifeline == 5) { + pp = pp + 1; + if (pp == 1) { + System.out.println("Welcome to Power Paplu lifeline"); + System.out.print("------------------------------------------------------"); + System.out.print("\n|\t\t Lifeline\t\t\t |\n"); + System.out.println("------------------------------------------------------"); + System.out.println("1.Audience poll \t\t2.Phone a friend"); + System.out.println("3.Fifty fifty \t\t4.Flip The question"); + System.out.println("5.Power paplu \t\t6.Ask an expert"); + System.out.println("7.Double Dip"); + for (int space = 1; space <= 23; space++) { + System.out.println(""); + } + int pp = m.nextInt(); + for (int space = 1; space <= 23; space++) { + System.out.println(""); + } + if (pp == 1) { + System.out.println("Audience poll is Renewed"); + ap = 0; + lifeline(4); + } else if (pp == 2) { + System.out.println("Phone a Friend is Renewed"); + ph = 0; + lifeline(4); + } else if (pp == 3) { + System.out.println("Fifty Fifty is Renewed"); + ff = 0; + lifeline(4); + } else if (pp == 4) { + System.out.println("Flip the Question is Renewed"); + ask = 0; + lifeline(4); + } else if (pp == 6) { + System.out.println("Ask an expert is Renewed"); + ask = 0; + lifeline(4); + } else { + System.out.println("Double dip is Renewed"); + dd = 0; + lifeline(4); + } + + } else { + System.out.println("You have already used this lifeline"); + lifeline(4); + } + } else if (lifeline == 6) { + ask = ask + 1; + if (ask == 1) { + System.out.println("Ask an Expert"); + System.out.println("our today expert is Rohit joshi"); + System.out.print("Redirecting to Rohit joshi"); + Thread.sleep(1000); + System.out.println("."); + Thread.sleep(1000); + System.out.println("."); + Thread.sleep(1000); + System.out.println("."); + Thread.sleep(1000); + System.out.println("."); + Thread.sleep(1000); + System.out.println("."); + System.out.println("I think D is right answer"); + + } else { + System.out.println("You have Already used this lifeline"); + lifeline(4); + } + } else if (lifeline == 7) { + dd = dd + 1; + if (dd == 1) { + + System.out.println("Double dip"); + System.out.println("Enter Two Option 1 by 1"); + for (int space = 1; space <= 23; space++) { + System.out.println(""); + } + String as; + as = m.next(); + + switch (as) { + case "d": + case "D": + System.out.println("D is right Enter once again"); + break; + default: + System.out.println("Answer is wrong try again"); + } + } else { + System.out.println("You have Already used this lifeline"); + lifeline(4); + } + } else { + System.out.println("you have enter wrong choice"); + lifeline(4); + } + + } catch (InterruptedException exc) { + System.out.println("!!!!!!!!!!!!!!!!!!!!RESTART!!!!!!!!!!!!!!!!!!!"); + } + + } + + } + + } + +} diff --git a/projects/KBC--Kaun-Banega-Crorepati-master/src/simple/logo.java b/projects/KBC--Kaun-Banega-Crorepati-master/src/simple/logo.java new file mode 100644 index 0000000..8af6e8b --- /dev/null +++ b/projects/KBC--Kaun-Banega-Crorepati-master/src/simple/logo.java @@ -0,0 +1,60 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package simple; + +/** + * + * @author Rj + */ +public class logo { + + /* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + + + + + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + // TODO code application logic here + System.out.println("\t\t''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''"); + System.out.println("\t\t''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''"); + System.out.println("\t\t'' __ _ ___ __ __________________ __ ________________ ''"); + System.out.println("\t\t'' /| | / / / / | |_______________ | /| |________________| ''"); + System.out.println("\t\t'' | | | / / / | | |_____________ /| | | | |________________/ ''"); + System.out.println("\t\t'' | | | / / / | | | | | | | | | ''"); + System.out.println("\t\t'' | | | / / / | | | | | | | | | ''"); + System.out.println("\t\t'' | | | / / / | | | | | | | | | ''"); + System.out.println("\t\t'' | | |/ / / | | |_____________|_| | | | | ''"); + System.out.println("\t\t'' | | | / / | | |________________ | | | | ''"); + System.out.println("\t\t'' | | |/\\ \\ | | |______________/| | | | | ''"); + System.out.println("\t\t'' | | |\\ \\ \\ | | | | | | | | | ''"); + System.out.println("\t\t'' | | | \\ \\ \\ | | | | | | | | | ''"); + System.out.println("\t\t'' | | | \\ \\ \\ | | | | | | | | | ''"); + System.out.println("\t\t'' | | | \\ \\ \\ | | |_____________|_| | | | |________________ ''"); + System.out.println("\t\t'' | |__| \\ \\__\\ | |__|__________________| | |__|________________| ''"); + System.out.println("\t\t'' |/__ / \\/__/ |/__ /_________________/ |/__ /_______________/ ''"); + System.out.println("\t\t'' ''"); + System.out.println("\t\t''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''"); + System.out.println("\t\t''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''\n\n\n"); + + + + } + + + + +} + + diff --git a/projects/Metro_systems-master/Images/1467622060602_DSC_0199.JPG b/projects/Metro_systems-master/Images/1467622060602_DSC_0199.JPG new file mode 100644 index 0000000..12c83f8 Binary files /dev/null and b/projects/Metro_systems-master/Images/1467622060602_DSC_0199.JPG differ diff --git a/projects/Metro_systems-master/Images/1467622280886_PICT0039.JPG b/projects/Metro_systems-master/Images/1467622280886_PICT0039.JPG new file mode 100644 index 0000000..fc5cb2a Binary files /dev/null and b/projects/Metro_systems-master/Images/1467622280886_PICT0039.JPG differ diff --git a/projects/Metro_systems-master/Images/1467623630995_IMG_0768.JPG b/projects/Metro_systems-master/Images/1467623630995_IMG_0768.JPG new file mode 100644 index 0000000..ca98916 Binary files /dev/null and b/projects/Metro_systems-master/Images/1467623630995_IMG_0768.JPG differ diff --git a/projects/Metro_systems-master/Images/1467623757651_DSC01837.JPG b/projects/Metro_systems-master/Images/1467623757651_DSC01837.JPG new file mode 100644 index 0000000..0b22106 Binary files /dev/null and b/projects/Metro_systems-master/Images/1467623757651_DSC01837.JPG differ diff --git a/projects/Metro_systems-master/Images/1468319614166_DSC_0175.JPG b/projects/Metro_systems-master/Images/1468319614166_DSC_0175.JPG new file mode 100644 index 0000000..595b204 Binary files /dev/null and b/projects/Metro_systems-master/Images/1468319614166_DSC_0175.JPG differ diff --git a/projects/Metro_systems-master/Images/1468565783784_batman-arkham-origins-video-game-hd-wallpaper-1080p.jpg b/projects/Metro_systems-master/Images/1468565783784_batman-arkham-origins-video-game-hd-wallpaper-1080p.jpg new file mode 100644 index 0000000..3850d41 Binary files /dev/null and b/projects/Metro_systems-master/Images/1468565783784_batman-arkham-origins-video-game-hd-wallpaper-1080p.jpg differ diff --git a/projects/Metro_systems-master/Images/default.png b/projects/Metro_systems-master/Images/default.png new file mode 100644 index 0000000..8d34b68 Binary files /dev/null and b/projects/Metro_systems-master/Images/default.png differ diff --git a/projects/Metro_systems-master/README.md b/projects/Metro_systems-master/README.md new file mode 100644 index 0000000..02fd9e7 --- /dev/null +++ b/projects/Metro_systems-master/README.md @@ -0,0 +1 @@ +# Metro_systems diff --git a/projects/Metro_systems-master/RemoteSystemsTempFiles/.project b/projects/Metro_systems-master/RemoteSystemsTempFiles/.project new file mode 100644 index 0000000..5447a64 --- /dev/null +++ b/projects/Metro_systems-master/RemoteSystemsTempFiles/.project @@ -0,0 +1,12 @@ + + + RemoteSystemsTempFiles + + + + + + + org.eclipse.rse.ui.remoteSystemsTempNature + + diff --git a/projects/Metro_systems-master/manifest.mf b/projects/Metro_systems-master/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/projects/Metro_systems-master/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/projects/Metro_systems-master/metro_system/Cashreciept.form b/projects/Metro_systems-master/metro_system/Cashreciept.form new file mode 100644 index 0000000..c34d3d2 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/Cashreciept.form @@ -0,0 +1,1236 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/Metro_systems-master/metro_system/Cashreciept.java b/projects/Metro_systems-master/metro_system/Cashreciept.java new file mode 100644 index 0000000..442cf12 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/Cashreciept.java @@ -0,0 +1,1147 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; +import java.awt.Component; +import java.awt.Dimension; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import javax.swing.JOptionPane; +import javax.swing.table.DefaultTableModel; +import java.sql.*; +import java.io.*; +import java.sql.*; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.imageio.ImageIO; +import javax.swing.*; +import javax.swing.filechooser.FileFilter; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.print.*; +import javax.imageio.ImageIO; +import javax.swing.table.DefaultTableModel; + + +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.print.PageFormat; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JFrame; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class Cashreciept extends javax.swing.JInternalFrame implements convar,Printable { + + /** + * Creates new form Cashreciept + */ + public Cashreciept() { + + initComponents(); + + Connection myconnection; + jLabel4.setText(String.valueOf(newsmartcard.a)); + jLabel6.setText(String.valueOf((newsmartcard.a)+50)); + try{ + myconnection = DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from smartcard where s_id=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, newsmartcard.sno); + ResultSet myres = mystatement.executeQuery(); + + if( myres.next() ) + { + jLabel9.setText(newsmartcard.sno); + jTextField6.setText(myres.getString(2)); + jTextField4.setText(myres.getString("phn_no")); + jTextField5.setText(myres.getString(3)); + jTextField1.setText(myres.getString(4)); + jTextArea2.setText(myres.getString(6)); + jLabel42.setText(myres.getString(9)); + jTextField13.setText(myres.getString(11)); + jTextField14.setText(myres.getString(12)); + + + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jButton2 = new javax.swing.JButton(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + jLabel9 = new javax.swing.JLabel(); + jLabel11 = new javax.swing.JLabel(); + jTextField5 = new javax.swing.JTextField(); + jLabel12 = new javax.swing.JLabel(); + jTextField6 = new javax.swing.JTextField(); + jLabel10 = new javax.swing.JLabel(); + jTextField4 = new javax.swing.JTextField(); + jLabel13 = new javax.swing.JLabel(); + jLabel14 = new javax.swing.JLabel(); + jScrollPane2 = new javax.swing.JScrollPane(); + jTextArea2 = new javax.swing.JTextArea(); + jTextField1 = new javax.swing.JTextField(); + jInternalFrame1 = new javax.swing.JInternalFrame(); + jLabel15 = new javax.swing.JLabel(); + jTabbedPane1 = new javax.swing.JTabbedPane(); + jPanel1 = new javax.swing.JPanel(); + jLabel16 = new javax.swing.JLabel(); + jTextField7 = new javax.swing.JTextField(); + jLabel17 = new javax.swing.JLabel(); + jScrollPane3 = new javax.swing.JScrollPane(); + jTextArea3 = new javax.swing.JTextArea(); + jLabel18 = new javax.swing.JLabel(); + jTextField8 = new javax.swing.JTextField(); + jTextField9 = new javax.swing.JTextField(); + jLabel19 = new javax.swing.JLabel(); + jRadioButton3 = new javax.swing.JRadioButton(); + jLabel20 = new javax.swing.JLabel(); + jRadioButton4 = new javax.swing.JRadioButton(); + jLabel21 = new javax.swing.JLabel(); + jScrollPane4 = new javax.swing.JScrollPane(); + jTextArea4 = new javax.swing.JTextArea(); + jLabel22 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jPanel2 = new javax.swing.JPanel(); + jLabel23 = new javax.swing.JLabel(); + jLabel24 = new javax.swing.JLabel(); + jLabel25 = new javax.swing.JLabel(); + jRadioButton1 = new javax.swing.JRadioButton(); + jRadioButton2 = new javax.swing.JRadioButton(); + jTextField2 = new javax.swing.JTextField(); + jLabel26 = new javax.swing.JLabel(); + jButton4 = new javax.swing.JButton(); + jLabel27 = new javax.swing.JLabel(); + jInternalFrame2 = new javax.swing.JInternalFrame(); + jLabel28 = new javax.swing.JLabel(); + jTabbedPane2 = new javax.swing.JTabbedPane(); + jPanel3 = new javax.swing.JPanel(); + jLabel29 = new javax.swing.JLabel(); + jTextField10 = new javax.swing.JTextField(); + jLabel30 = new javax.swing.JLabel(); + jScrollPane5 = new javax.swing.JScrollPane(); + jTextArea5 = new javax.swing.JTextArea(); + jLabel31 = new javax.swing.JLabel(); + jTextField11 = new javax.swing.JTextField(); + jTextField12 = new javax.swing.JTextField(); + jLabel32 = new javax.swing.JLabel(); + jRadioButton5 = new javax.swing.JRadioButton(); + jLabel33 = new javax.swing.JLabel(); + jRadioButton6 = new javax.swing.JRadioButton(); + jLabel34 = new javax.swing.JLabel(); + jScrollPane6 = new javax.swing.JScrollPane(); + jTextArea6 = new javax.swing.JTextArea(); + jLabel35 = new javax.swing.JLabel(); + jButton5 = new javax.swing.JButton(); + jButton6 = new javax.swing.JButton(); + jPanel4 = new javax.swing.JPanel(); + jLabel36 = new javax.swing.JLabel(); + jLabel37 = new javax.swing.JLabel(); + jLabel38 = new javax.swing.JLabel(); + jRadioButton7 = new javax.swing.JRadioButton(); + jRadioButton8 = new javax.swing.JRadioButton(); + jTextField3 = new javax.swing.JTextField(); + jLabel39 = new javax.swing.JLabel(); + jButton7 = new javax.swing.JButton(); + jLabel40 = new javax.swing.JLabel(); + jLabel41 = new javax.swing.JLabel(); + jLabel42 = new javax.swing.JLabel(); + jLabel43 = new javax.swing.JLabel(); + jTextField13 = new javax.swing.JTextField(); + jTextField14 = new javax.swing.JTextField(); + jLabel44 = new javax.swing.JLabel(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + setTitle("Cash Receipt"); + + jLabel1.setText("Cash in card:"); + + jLabel2.setText("Making Charges "); + + jLabel3.setText("50"); + + jButton2.setText("Print"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + jLabel5.setText("Total Amount"); + + jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/metrohouston.png"))); // NOI18N + + jLabel8.setText("Smartcard Number"); + + jLabel11.setText("Name"); + + jLabel12.setText("Age"); + + jTextField6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField6ActionPerformed(evt); + } + }); + + jLabel10.setText("Gender"); + + jLabel13.setText("Phone Number"); + + jLabel14.setText("Address"); + + jTextArea2.setColumns(20); + jTextArea2.setRows(5); + jScrollPane2.setViewportView(jTextArea2); + + jInternalFrame1.setClosable(true); + jInternalFrame1.setIconifiable(true); + jInternalFrame1.setMaximizable(true); + jInternalFrame1.setResizable(true); + jInternalFrame1.setTitle("Create Smartcard"); + + jLabel15.setText("Smartcard Number"); + + jTabbedPane1.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), javax.swing.BorderFactory.createEtchedBorder())); + + jLabel16.setText("Gender"); + + jLabel17.setText("Phone Number"); + + jTextArea3.setColumns(20); + jTextArea3.setRows(5); + jScrollPane3.setViewportView(jTextArea3); + + jLabel18.setText("Address"); + + jTextField9.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField9ActionPerformed(evt); + } + }); + + jLabel19.setText("Name"); + + jRadioButton3.setText("Male"); + jRadioButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButton3ActionPerformed(evt); + } + }); + + jLabel20.setText("Age"); + + jRadioButton4.setText("Female"); + + jLabel21.setText("ID Proof details."); + + jTextArea4.setColumns(20); + jTextArea4.setRows(5); + jScrollPane4.setViewportView(jTextArea4); + + jLabel22.setToolTipText("Image to be uploaded"); + jLabel22.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 102, 102), 1, true)); + + jButton1.setText("UPLOAD"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jButton3.setText("Next"); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(105, 105, 105) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(26, 26, 26) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField8, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jRadioButton3) + .addGap(18, 18, 18) + .addComponent(jRadioButton4))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(54, 54, 54)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel21)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(424, 424, 424)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton3)))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(78, 78, 78)))) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(32, 32, 32) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(67, 67, 67) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(40, 40, 40) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(36, 36, 36)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(30, 30, 30))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel21)) + .addContainerGap()) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jButton3) + .addGap(58, 58, 58)))) + ); + + jTabbedPane1.addTab("Personal Details", jPanel1); + + jLabel23.setText("Card Type"); + + jLabel24.setText("Intial balance"); + + jLabel25.setText("Valid for"); + + jRadioButton1.setText("Standard"); + jRadioButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButton1ActionPerformed(evt); + } + }); + + jRadioButton2.setText("Premium"); + + jLabel26.setText("1 Year"); + + jButton4.setText("Make SmartCard"); + jButton4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton4ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(264, 264, 264) + .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup() + .addGap(41, 41, 41) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel24, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE) + .addComponent(jLabel23, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel25, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(76, 76, 76) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(jRadioButton1) + .addGap(48, 48, 48) + .addComponent(jRadioButton2)) + .addComponent(jLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap(378, Short.MAX_VALUE)) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(75, 75, 75) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton1) + .addComponent(jRadioButton2)) + .addGap(60, 60, 60) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(55, 55, 55) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(89, 89, 89) + .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(131, Short.MAX_VALUE)) + ); + + jTabbedPane1.addTab("Smartcard Details", jPanel2); + + javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane()); + jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout); + jInternalFrame1Layout.setHorizontalGroup( + jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jInternalFrame1Layout.createSequentialGroup() + .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jInternalFrame1Layout.createSequentialGroup() + .addGap(197, 197, 197) + .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(52, 52, 52) + .addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jInternalFrame1Layout.createSequentialGroup() + .addGap(61, 61, 61) + .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jInternalFrame1Layout.setVerticalGroup( + jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jInternalFrame1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(31, 31, 31)) + ); + + jInternalFrame2.setClosable(true); + jInternalFrame2.setIconifiable(true); + jInternalFrame2.setMaximizable(true); + jInternalFrame2.setResizable(true); + jInternalFrame2.setTitle("Create Smartcard"); + + jLabel28.setText("Smartcard Number"); + + jTabbedPane2.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), javax.swing.BorderFactory.createEtchedBorder())); + + jLabel29.setText("Gender"); + + jLabel30.setText("Phone Number"); + + jTextArea5.setColumns(20); + jTextArea5.setRows(5); + jScrollPane5.setViewportView(jTextArea5); + + jLabel31.setText("Address"); + + jTextField12.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField12ActionPerformed(evt); + } + }); + + jLabel32.setText("Name"); + + jRadioButton5.setText("Male"); + jRadioButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButton5ActionPerformed(evt); + } + }); + + jLabel33.setText("Age"); + + jRadioButton6.setText("Female"); + + jLabel34.setText("ID Proof details."); + + jTextArea6.setColumns(20); + jTextArea6.setRows(5); + jScrollPane6.setViewportView(jTextArea6); + + jLabel35.setToolTipText("Image to be uploaded"); + jLabel35.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 102, 102), 1, true)); + + jButton5.setText("UPLOAD"); + jButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton5ActionPerformed(evt); + } + }); + + jButton6.setText("Next"); + jButton6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton6ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGap(105, 105, 105) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(26, 26, 26) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField11, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField12, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jLabel29, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jRadioButton5) + .addGap(18, 18, 18) + .addComponent(jRadioButton6))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel35, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(54, 54, 54)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel34)) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(424, 424, 424)) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton6)))) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jLabel30, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(78, 78, 78)))) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGap(32, 32, 32) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(67, 67, 67) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(40, 40, 40) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel29, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel35, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel30, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(36, 36, 36)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(30, 30, 30))) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel34)) + .addContainerGap()) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addComponent(jButton6) + .addGap(58, 58, 58)))) + ); + + jTabbedPane2.addTab("Personal Details", jPanel3); + + jLabel36.setText("Card Type"); + + jLabel37.setText("Intial balance"); + + jLabel38.setText("Valid for"); + + jRadioButton7.setText("Standard"); + jRadioButton7.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButton7ActionPerformed(evt); + } + }); + + jRadioButton8.setText("Premium"); + + jLabel39.setText("1 Year"); + + jButton7.setText("Make SmartCard"); + jButton7.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton7ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGap(264, 264, 264) + .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout.createSequentialGroup() + .addGap(41, 41, 41) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel37, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE) + .addComponent(jLabel36, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel38, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(76, 76, 76) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addComponent(jRadioButton7) + .addGap(48, 48, 48) + .addComponent(jRadioButton8)) + .addComponent(jLabel39, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap(378, Short.MAX_VALUE)) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGap(75, 75, 75) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel36, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton7) + .addComponent(jRadioButton8)) + .addGap(60, 60, 60) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel37, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(55, 55, 55) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel38, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel39, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(89, 89, 89) + .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(131, Short.MAX_VALUE)) + ); + + jTabbedPane2.addTab("Smartcard Details", jPanel4); + + javax.swing.GroupLayout jInternalFrame2Layout = new javax.swing.GroupLayout(jInternalFrame2.getContentPane()); + jInternalFrame2.getContentPane().setLayout(jInternalFrame2Layout); + jInternalFrame2Layout.setHorizontalGroup( + jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jInternalFrame2Layout.createSequentialGroup() + .addGroup(jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jInternalFrame2Layout.createSequentialGroup() + .addGap(197, 197, 197) + .addComponent(jLabel28, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(52, 52, 52) + .addComponent(jLabel40, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jInternalFrame2Layout.createSequentialGroup() + .addGap(61, 61, 61) + .addComponent(jTabbedPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jInternalFrame2Layout.setVerticalGroup( + jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jInternalFrame2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel28, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel40, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jTabbedPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(31, 31, 31)) + ); + + jLabel41.setText("Card type"); + + jLabel43.setText("Created on date"); + + jTextField13.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField13ActionPerformed(evt); + } + }); + + jLabel44.setText("Expiery Date"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(47, 47, 47) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel14, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(jLabel7) + .addGroup(layout.createSequentialGroup() + .addGap(27, 27, 27) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(27, 27, 27) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(75, 75, 75) + .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jButton2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addGap(26, 26, 26) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jTextField5, javax.swing.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE) + .addComponent(jTextField4)) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel41, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jLabel42, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel43, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel44, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(27, 27, 27) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)))))))))) + .addContainerGap(24, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(177, 177, 177)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 385, Short.MAX_VALUE) + .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 384, Short.MAX_VALUE))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(jInternalFrame2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel7) + .addGap(45, 45, 45) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(37, 37, 37) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(43, 43, 43) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(45, 45, 45) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(44, 44, 44)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel42, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel41, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(31, 31, 31) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel43, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(43, 43, 43) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel44, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(2, 2, 2))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(31, 31, 31) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(257, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(52, 52, 52) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(35, 35, 35) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(54, 54, 54) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(70, 70, 70)))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(jInternalFrame2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + jButton2.setVisible(false); + JFrame yourComponent = new JFrame(); +PrinterJob pjob = PrinterJob.getPrinterJob(); +PageFormat preformat = pjob.defaultPage(); +preformat.setOrientation(PageFormat.LANDSCAPE); +PageFormat postformat = pjob.pageDialog(preformat); +//If user does not hit cancel then print. +if (preformat != postformat) { + //Set print component + pjob.setPrintable(this, postformat); + if (pjob.printDialog()) { + try { + pjob.print(); + } catch (PrinterException ex) { + //Logger.getLogger(newmember.class.getName()).log(Level.SEVERE, null, ex); + } + } +}// TODO add your handling code here: +jButton2.setVisible(true); + }//GEN-LAST:event_jButton2ActionPerformed + + private void jTextField6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField6ActionPerformed + + }//GEN-LAST:event_jTextField6ActionPerformed + + private void jTextField9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField9ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField9ActionPerformed + + private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton3ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jRadioButton3ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jButton1ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + + }//GEN-LAST:event_jButton3ActionPerformed + + private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jRadioButton1ActionPerformed + + private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed + + }//GEN-LAST:event_jButton4ActionPerformed + + private void jTextField12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField12ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField12ActionPerformed + + private void jRadioButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton5ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jRadioButton5ActionPerformed + + private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jButton5ActionPerformed + + private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed + + }//GEN-LAST:event_jButton6ActionPerformed + + private void jRadioButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton7ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jRadioButton7ActionPerformed + + private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed + + + }//GEN-LAST:event_jButton7ActionPerformed + + private void jTextField13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField13ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField13ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton4; + private javax.swing.JButton jButton5; + private javax.swing.JButton jButton6; + private javax.swing.JButton jButton7; + private javax.swing.JInternalFrame jInternalFrame1; + private javax.swing.JInternalFrame jInternalFrame2; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel14; + private javax.swing.JLabel jLabel15; + private javax.swing.JLabel jLabel16; + private javax.swing.JLabel jLabel17; + private javax.swing.JLabel jLabel18; + private javax.swing.JLabel jLabel19; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel20; + private javax.swing.JLabel jLabel21; + private javax.swing.JLabel jLabel22; + private javax.swing.JLabel jLabel23; + private javax.swing.JLabel jLabel24; + private javax.swing.JLabel jLabel25; + private javax.swing.JLabel jLabel26; + private javax.swing.JLabel jLabel27; + private javax.swing.JLabel jLabel28; + private javax.swing.JLabel jLabel29; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel30; + private javax.swing.JLabel jLabel31; + private javax.swing.JLabel jLabel32; + private javax.swing.JLabel jLabel33; + private javax.swing.JLabel jLabel34; + private javax.swing.JLabel jLabel35; + private javax.swing.JLabel jLabel36; + private javax.swing.JLabel jLabel37; + private javax.swing.JLabel jLabel38; + private javax.swing.JLabel jLabel39; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel40; + private javax.swing.JLabel jLabel41; + private javax.swing.JLabel jLabel42; + private javax.swing.JLabel jLabel43; + private javax.swing.JLabel jLabel44; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JRadioButton jRadioButton1; + private javax.swing.JRadioButton jRadioButton2; + private javax.swing.JRadioButton jRadioButton3; + private javax.swing.JRadioButton jRadioButton4; + private javax.swing.JRadioButton jRadioButton5; + private javax.swing.JRadioButton jRadioButton6; + private javax.swing.JRadioButton jRadioButton7; + private javax.swing.JRadioButton jRadioButton8; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JScrollPane jScrollPane3; + private javax.swing.JScrollPane jScrollPane4; + private javax.swing.JScrollPane jScrollPane5; + private javax.swing.JScrollPane jScrollPane6; + private javax.swing.JTabbedPane jTabbedPane1; + private javax.swing.JTabbedPane jTabbedPane2; + private javax.swing.JTextArea jTextArea2; + private javax.swing.JTextArea jTextArea3; + private javax.swing.JTextArea jTextArea4; + private javax.swing.JTextArea jTextArea5; + private javax.swing.JTextArea jTextArea6; + private javax.swing.JTextField jTextField1; + private javax.swing.JTextField jTextField10; + private javax.swing.JTextField jTextField11; + private javax.swing.JTextField jTextField12; + private javax.swing.JTextField jTextField13; + private javax.swing.JTextField jTextField14; + private javax.swing.JTextField jTextField2; + private javax.swing.JTextField jTextField3; + private javax.swing.JTextField jTextField4; + private javax.swing.JTextField jTextField5; + private javax.swing.JTextField jTextField6; + private javax.swing.JTextField jTextField7; + private javax.swing.JTextField jTextField8; + private javax.swing.JTextField jTextField9; + // End of variables declaration//GEN-END:variables + + @Override + public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { + if (pageIndex > 0) { /* We have only one page, and 'page' is zero-based */ + return NO_SUCH_PAGE; + } + + // get the bounds of the component + Dimension dim = this.getSize(); + double cHeight = dim.getHeight(); + double cWidth = dim.getWidth(); + + // get the bounds of the printable area + double pHeight = pageFormat.getImageableHeight(); + double pWidth = pageFormat.getImageableWidth(); + + double pXStart = pageFormat.getImageableX(); + double pYStart = pageFormat.getImageableY(); + + double xRatio = pWidth / cWidth; + double yRatio = pHeight / cHeight; + + + Graphics2D g2 = (Graphics2D) graphics; + g2.translate(pXStart, pYStart); + g2.scale(xRatio, yRatio); + this.paint(g2); + + return Printable.PAGE_EXISTS; +} +} diff --git a/projects/Metro_systems-master/metro_system/METRO Wallpapers.jpg b/projects/Metro_systems-master/metro_system/METRO Wallpapers.jpg new file mode 100644 index 0000000..378f7b8 Binary files /dev/null and b/projects/Metro_systems-master/metro_system/METRO Wallpapers.jpg differ diff --git a/projects/Metro_systems-master/metro_system/Metro_System.java b/projects/Metro_systems-master/metro_system/Metro_System.java new file mode 100644 index 0000000..fe2c6c0 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/Metro_System.java @@ -0,0 +1,60 @@ + +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.swing.JOptionPane; +; + + +public class Metro_System implements convar { + + + public static void main(String[] args) { + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select* from admintable "; + PreparedStatement mystatement=myconnection.prepareStatement(query); + + ResultSet myres = mystatement.executeQuery(); + + if(myres.next()) + { + login obj=new login(); + obj.setVisible(true); + + + } + else{ + JOptionPane.showMessageDialog(null, "Running software for first time.Create Admin."); + createadmin obj1=new createadmin(); + obj1.setVisible(true); + + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(null, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(null, "Connection Error:"+e.getMessage()); + } + + } + +} diff --git a/projects/Metro_systems-master/metro_system/Test.java b/projects/Metro_systems-master/metro_system/Test.java new file mode 100644 index 0000000..94de727 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/Test.java @@ -0,0 +1,9 @@ + +public class Test { +public static void main(String[] args) { + + System.out.println("hello there"); + System.out.println("i think its time we should do our first commit"); + + } +} diff --git a/projects/Metro_systems-master/metro_system/addbalance.form b/projects/Metro_systems-master/metro_system/addbalance.form new file mode 100644 index 0000000..6c48081 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/addbalance.form @@ -0,0 +1,207 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/Metro_systems-master/metro_system/addbalance.java b/projects/Metro_systems-master/metro_system/addbalance.java new file mode 100644 index 0000000..1c36ba7 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/addbalance.java @@ -0,0 +1,353 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.awt.Image; +import java.io.File; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.imageio.ImageIO; +import javax.swing.ImageIcon; +import javax.swing.JOptionPane; +import javax.swing.table.DefaultTableModel; +import static metro_system.convar.password; +import static metro_system.convar.path; +import static metro_system.convar.place; +import static metro_system.convar.username; + +/** + * + * @author sparsh + */ +public class addbalance extends javax.swing.JInternalFrame implements convar{ + + static String s[]=new String[4]; + static Integer n; + String sno; + /** + * Creates new form tokensearch + */ + public addbalance() { + initComponents(); + + + + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jButton1 = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jScrollPane1 = new javax.swing.JScrollPane(); + jTable1 = new javax.swing.JTable(); + jLabel5 = new javax.swing.JLabel(); + jTextField2 = new javax.swing.JTextField(); + jLabel6 = new javax.swing.JLabel(); + jTextField3 = new javax.swing.JTextField(); + jTextField4 = new javax.swing.JTextField(); + jLabel7 = new javax.swing.JLabel(); + jTextField5 = new javax.swing.JTextField(); + jLabel8 = new javax.swing.JLabel(); + jButton2 = new javax.swing.JButton(); + + setClosable(true); + setIconifiable(true); + setTitle("Add balance to Card"); + + jButton1.setText("Search"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel3.setText("Smartcard no."); + + jTable1.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + + }, + new String [] { + "Smartcard No.", "Name", "Mobile No.", "Card type" + } + ) { + boolean[] canEdit = new boolean [] { + false, false, false, false + }; + + public boolean isCellEditable(int rowIndex, int columnIndex) { + return canEdit [columnIndex]; + } + }); + jTable1.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jTable1MouseClicked(evt); + } + }); + jScrollPane1.setViewportView(jTable1); + + jLabel5.setText("Name"); + + jLabel6.setText("Current Balance"); + + jLabel7.setText("Money to add"); + + jLabel8.setText("New Balance"); + + jButton2.setText("Add Balance"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane1)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(34, 34, 34) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(97, 97, 97) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(50, 50, 50) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(45, 45, 45)))) + .addGroup(layout.createSequentialGroup() + .addGap(20, 20, 20) + .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addGroup(layout.createSequentialGroup() + .addGap(371, 371, 371) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(325, 325, 325) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(18, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(48, 48, 48) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(28, 28, 28)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(8, 8, 8))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(37, 37, 37) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(52, 52, 52) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + try{ + Connection myconnection = DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from smartcard where s_id like ? and name like ? "; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, "%"+jTextField1.getText()+"%"); + mystatement.setString(2, "%"+jTextField2.getText()+"%"); + + ResultSet myres=mystatement.executeQuery(); + DefaultTableModel mymodel=(DefaultTableModel) jTable1.getModel(); + if(myres.next()) + { + mymodel.setRowCount(0); + do{ + String smrt,name,phno,ctype; + smrt=myres.getString(1); + name=myres.getString(2); + phno=myres.getString(5); + ctype=myres.getString(9); + mymodel.addRow(new Object[]{smrt,name,phno,ctype}); + } + while(myres.next()); + + + }} + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + Connection myconnection; + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="update smartcard set balance = balance + ? where s_id = ?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + + mystatement.setString(1, jTextField4.getText()); + mystatement.setString(2, sno); + + if(mystatement.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, " Money added to smartcard Successfully"); + + } + String query1="select * from smartcard where s_id = ?"; + PreparedStatement mystatement1=myconnection.prepareStatement(query1); + mystatement1.setString(1,sno); + + ResultSet myres=mystatement1.executeQuery(); + // DefaultTableModel mymodel=(DefaultTableModel) jTable1.getModel(); + if(myres.next()) + { + + jTextField5.setText(myres.getString(10)); + } + + + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + }//GEN-LAST:event_jButton2ActionPerformed + + private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked + try{ int row=0,clmn=0; + row=jTable1.getSelectedRow(); + sno=jTable1.getValueAt(row, clmn).toString(); + JOptionPane.showMessageDialog(rootPane, sno); + Connection myconnection = DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from smartcard where s_id = ?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1,sno); + + ResultSet myres=mystatement.executeQuery(); + // DefaultTableModel mymodel=(DefaultTableModel) jTable1.getModel(); + if(myres.next()) + { + + jTextField3.setText(myres.getString(10)); + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + }//GEN-LAST:event_jTable1MouseClicked +// private void jTable1MouseClicked(java.awt.event.MouseEvent evt) { +// +// } + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTable jTable1; + private javax.swing.JTextField jTextField1; + private javax.swing.JTextField jTextField2; + private javax.swing.JTextField jTextField3; + private javax.swing.JTextField jTextField4; + private javax.swing.JTextField jTextField5; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/addbalance.jpeg b/projects/Metro_systems-master/metro_system/addbalance.jpeg new file mode 100644 index 0000000..253d301 Binary files /dev/null and b/projects/Metro_systems-master/metro_system/addbalance.jpeg differ diff --git a/projects/Metro_systems-master/metro_system/addfare.form b/projects/Metro_systems-master/metro_system/addfare.form new file mode 100644 index 0000000..b1e2314 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/addfare.form @@ -0,0 +1,251 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/addfare.java b/projects/Metro_systems-master/metro_system/addfare.java new file mode 100644 index 0000000..a29c0ca --- /dev/null +++ b/projects/Metro_systems-master/metro_system/addfare.java @@ -0,0 +1,408 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.SimpleDateFormat; +import javax.swing.JOptionPane; +import static metro_system.convar.password; +import static metro_system.convar.path; +import static metro_system.convar.place; +import static metro_system.convar.username; + +/** + * + * @author sparsh + */ +public class addfare extends javax.swing.JInternalFrame implements convar{ + + /** + * Creates new form addfare + */ + public addfare() { + initComponents(); + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from routetable"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { + do + { + jComboBox3.addItem(myres.getString("route")); + jComboBox2.addItem(myres.getString("route")); + } + while(myres.next()); + + + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jComboBox1 = new javax.swing.JComboBox<>(); + jLabel1 = new javax.swing.JLabel(); + jComboBox2 = new javax.swing.JComboBox<>(); + jLabel2 = new javax.swing.JLabel(); + jComboBox3 = new javax.swing.JComboBox<>(); + jComboBox4 = new javax.swing.JComboBox<>(); + jComboBox5 = new javax.swing.JComboBox<>(); + jLabel3 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jLabel4 = new javax.swing.JLabel(); + jTextField2 = new javax.swing.JTextField(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jTextField3 = new javax.swing.JTextField(); + jLabel7 = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + jTextField4 = new javax.swing.JTextField(); + jButton1 = new javax.swing.JButton(); + + jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose route" })); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + setTitle("Add Fare Info."); + setToolTipText(""); + + jLabel1.setText("From"); + + jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose route" })); + jComboBox2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox2ActionPerformed(evt); + } + }); + + jLabel2.setText("To:"); + + jComboBox3.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose Route" })); + jComboBox3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox3ActionPerformed(evt); + } + }); + + jComboBox4.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "choose route first" })); + + jComboBox5.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "choose route first" })); + + jLabel3.setText("Fare (Rs.)"); + + jLabel4.setText("Travelling Time"); + + jLabel5.setText("Mins."); + + jLabel6.setText("Distance"); + + jLabel7.setText("Kms."); + + jLabel8.setText("Stations in between"); + + jTextField4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField4ActionPerformed(evt); + } + }); + + jButton1.setText("Save"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE) + .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 79, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField4) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jComboBox3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox2, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jComboBox4, 0, 225, Short.MAX_VALUE) + .addComponent(jComboBox5, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addGroup(layout.createSequentialGroup() + .addGap(35, 35, 35) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 71, Short.MAX_VALUE) + .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + .addGap(60, 60, 60)) + .addGroup(layout.createSequentialGroup() + .addGap(253, 253, 253) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(28, 28, 28) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(45, 45, 45) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox5, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE) + .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(64, 64, 64) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(36, 36, 36) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(38, 38, 38) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(32, 32, 32) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(63, 63, 63) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + + private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed + Connection myconnection; + + if(jComboBox2.getSelectedIndex()>0){ + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from stationtable where route=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox2.getSelectedItem().toString()); + ResultSet myres = mystatement.executeQuery(); + jComboBox4.removeAllItems(); + jComboBox4.addItem("choose station"); + if(myres.next()) + + { + + do + { + jComboBox4.addItem(myres.getString("stn_name")); + + } + while(myres.next()); + + + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + else{ + jComboBox4.addItem("choose route first"); + } + }//GEN-LAST:event_jComboBox2ActionPerformed + + private void jTextField4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField4ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField4ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="insert into faretable values(?,?,?,?,?,?,?,?)"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox2.getSelectedItem().toString()); + mystatement.setString(3, jComboBox3.getSelectedItem().toString()); + mystatement.setString(2, jComboBox4.getSelectedItem().toString()); + mystatement.setString(4, jComboBox5.getSelectedItem().toString()); + mystatement.setString(5, jTextField1.getText()); + mystatement.setString(6, jTextField2.getText()); + mystatement.setString(7, jTextField3.getText()); + mystatement.setString(8, jTextField4.getText()); + String query1="insert into faretable values(?,?,?,?,?,?,?,?)"; + PreparedStatement mystatement1=myconnection.prepareStatement(query1); + mystatement1.setString(1, jComboBox2.getSelectedItem().toString()); + mystatement1.setString(3, jComboBox3.getSelectedItem().toString()); + mystatement1.setString(2, jComboBox5.getSelectedItem().toString()); + mystatement1.setString(4, jComboBox4.getSelectedItem().toString()); + mystatement1.setString(5, jTextField1.getText()); + mystatement1.setString(6, jTextField2.getText()); + mystatement1.setString(7, jTextField3.getText()); + mystatement1.setString(8, jTextField4.getText()); + if( mystatement.executeUpdate()>0 && mystatement1.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "information stored successfully"); + + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + }//GEN-LAST:event_jButton1ActionPerformed + + private void jComboBox3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox3ActionPerformed + Connection myconnection; + + if(jComboBox3.getSelectedIndex()>0){ + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from stationtable where route=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox3.getSelectedItem().toString()); + + ResultSet myres = mystatement.executeQuery(); + jComboBox5.removeAllItems(); + jComboBox5.addItem("choose station"); + if(myres.next()) + { + do + { + jComboBox5.addItem(myres.getString("stn_name")); + + } + while(myres.next()); + + + + } + else{ + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + else{ + jComboBox5.addItem("choose route first"); + } // TODO add your handling code here: + }//GEN-LAST:event_jComboBox3ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JComboBox jComboBox1; + private javax.swing.JComboBox jComboBox2; + private javax.swing.JComboBox jComboBox3; + private javax.swing.JComboBox jComboBox4; + private javax.swing.JComboBox jComboBox5; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JTextField jTextField1; + private javax.swing.JTextField jTextField2; + private javax.swing.JTextField jTextField3; + private javax.swing.JTextField jTextField4; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/addroute.form b/projects/Metro_systems-master/metro_system/addroute.form new file mode 100644 index 0000000..1ea8f2b --- /dev/null +++ b/projects/Metro_systems-master/metro_system/addroute.form @@ -0,0 +1,119 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/addroute.java b/projects/Metro_systems-master/metro_system/addroute.java new file mode 100644 index 0000000..58b3b11 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/addroute.java @@ -0,0 +1,168 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.text.SimpleDateFormat; +import javax.swing.JOptionPane; +import static metro_system.mainframe.jDesktopPane1; + + +/** + * + * @author sparsh + */ +public class addroute extends javax.swing.JInternalFrame implements convar { + + /** + * Creates new form addroute + */ + public addroute() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + jTextField1 = new javax.swing.JTextField(); + jButton1 = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + jButton2 = new javax.swing.JButton(); + + setClosable(true); + setIconifiable(true); + setTitle("Add Route"); + + jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 5)); + jPanel1.setName("Add Route"); // NOI18N + + jButton1.setText("ADD"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel1.setText("Add Route"); + + jButton2.setText("Proceed"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addGap(36, 36, 36) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(47, 47, 47)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(155, 155, 155) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(50, 50, 50) + .addComponent(jButton2) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(77, 77, 77) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 33, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 94, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING)) + .addGap(68, 68, 68)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(63, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(70, 70, 70)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(39, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="insert into routetable values(?)"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jTextField1.getText()); + + if(mystatement.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "Information Sored Successfully"); + } + jTextField1.setText(""); + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed +addstation obj=new addstation(); + jDesktopPane1.add(obj); + obj.setVisible(true); + this.dispose();// TODO add your handling code here: + }//GEN-LAST:event_jButton2ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JLabel jLabel1; + private javax.swing.JPanel jPanel1; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/addroute.jpeg b/projects/Metro_systems-master/metro_system/addroute.jpeg new file mode 100644 index 0000000..33d2432 Binary files /dev/null and b/projects/Metro_systems-master/metro_system/addroute.jpeg differ diff --git a/projects/Metro_systems-master/metro_system/addstation.form b/projects/Metro_systems-master/metro_system/addstation.form new file mode 100644 index 0000000..10d678a --- /dev/null +++ b/projects/Metro_systems-master/metro_system/addstation.form @@ -0,0 +1,121 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/addstation.java b/projects/Metro_systems-master/metro_system/addstation.java new file mode 100644 index 0000000..d3d2c58 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/addstation.java @@ -0,0 +1,219 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.swing.JOptionPane; +import static metro_system.mainframe.jDesktopPane1; + +/** + * + * @author sparsh + */ +public class addstation extends javax.swing.JInternalFrame implements convar{ + + /** + * Creates new form addstation + */ + public addstation() { + initComponents(); + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from routetable"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { + do + { + jComboBox1.addItem(myres.getString("route")); + } + while(myres.next()); + + + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jComboBox1 = new javax.swing.JComboBox<>(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + + setClosable(true); + setIconifiable(true); + setResizable(true); + setTitle("Add Station."); + + jLabel1.setText("Route"); + + jLabel2.setText("Station Name"); + + jTextField1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField1ActionPerformed(evt); + } + }); + + jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose route" })); + jComboBox1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox1ActionPerformed(evt); + } + }); + + jButton1.setText("Save"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jButton2.setText("Proceed"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(98, 98, 98) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE)) + .addGap(45, 45, 45) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jTextField1) + .addComponent(jComboBox1, 0, 219, Short.MAX_VALUE)) + .addContainerGap(169, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addGap(188, 188, 188) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(78, 78, 78)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(72, 72, 72) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox1, javax.swing.GroupLayout.DEFAULT_SIZE, 33, Short.MAX_VALUE)) + .addGap(46, 46, 46) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 110, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(103, 103, 103)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="insert into stationtable values(?,?)"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox1.getSelectedItem().toString()); + mystatement.setString(2, jTextField1.getText()); + + if(mystatement.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "Information Sored Successfully"); + jTextField1.setText(""); + jComboBox1.setSelectedIndex(0); + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + }//GEN-LAST:event_jButton1ActionPerformed + + private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField1ActionPerformed + + private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jComboBox1ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed +addfare obj=new addfare(); + jDesktopPane1.add(obj); + obj.setVisible(true); + this.dispose();// TODO add your handling code here: + }//GEN-LAST:event_jButton2ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JComboBox jComboBox1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/adminchangepassword.form b/projects/Metro_systems-master/metro_system/adminchangepassword.form new file mode 100644 index 0000000..2406805 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/adminchangepassword.form @@ -0,0 +1,149 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/adminchangepassword.java b/projects/Metro_systems-master/metro_system/adminchangepassword.java new file mode 100644 index 0000000..021fd49 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/adminchangepassword.java @@ -0,0 +1,218 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class adminchangepassword extends javax.swing.JInternalFrame implements convar{ + + /** + * Creates new form createemployee + */ + public adminchangepassword() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jInternalFrame1 = new javax.swing.JInternalFrame(); + jLabel2 = new javax.swing.JLabel(); + jPasswordField1 = new javax.swing.JPasswordField(); + jButton5 = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + jPasswordField2 = new javax.swing.JPasswordField(); + jLabel4 = new javax.swing.JLabel(); + jPasswordField3 = new javax.swing.JPasswordField(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + setTitle("Change Password"); + + jInternalFrame1.setClosable(true); + jInternalFrame1.setIconifiable(true); + jInternalFrame1.setMaximizable(true); + jInternalFrame1.setResizable(true); + jInternalFrame1.setTitle("Create Employee Account"); + + javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane()); + jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout); + jInternalFrame1Layout.setHorizontalGroup( + jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 0, Short.MAX_VALUE) + ); + jInternalFrame1Layout.setVerticalGroup( + jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 0, Short.MAX_VALUE) + ); + + jLabel2.setText("Previous Password"); + + jButton5.setText("Change Password"); + jButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton5ActionPerformed(evt); + } + }); + + jLabel3.setText("New Password"); + + jLabel4.setText("Confirm Password"); + + jPasswordField3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jPasswordField3ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(223, 223, 223) + .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(130, 130, 130) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(61, 61, 61) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField3, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap(165, Short.MAX_VALUE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 348, Short.MAX_VALUE) + .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 348, Short.MAX_VALUE))) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(123, 123, 123) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField3, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 76, Short.MAX_VALUE) + .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(59, 59, 59)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 229, Short.MAX_VALUE) + .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 229, Short.MAX_VALUE))) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed + if(jPasswordField2.getText() .equals(jPasswordField3.getText())) + { + Connection myconnection; + try + { + myconnection=DriverManager.getConnection(path+place, username, password); + try + { + int a= JOptionPane.showConfirmDialog(rootPane, "Do you really want to Change Password? Username:"+login.s, "Confirm", JOptionPane.YES_NO_OPTION); + if(a==JOptionPane.YES_OPTION) + { + + String query2="select * from admintable where username=? and password=?"; + PreparedStatement mystatement2=myconnection.prepareStatement(query2); + mystatement2.setString(1, login.s); + mystatement2.setString(2, jPasswordField1.getText()); + ResultSet myresult2=mystatement2.executeQuery(); + + + if(myresult2.next()) + { + String query4="update admintable set password=? where username=?"; + PreparedStatement mystatement4=myconnection.prepareStatement(query4); + mystatement4.setString(1, jPasswordField2.getText()); + mystatement4.setString(2, login.s); + if(mystatement4.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "Password changed Successfully."); + login lg=new login(); + lg.setVisible(true); + this.dispose(); + } + } + else + { + JOptionPane.showMessageDialog(rootPane, "Incorrect Username/Password"); + } + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(null, "Changing Password Error."+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(null, "Connection Error."+e.getMessage()); + } + } + else + { + JOptionPane.showMessageDialog(rootPane, "Password doesn't match"); + } + }//GEN-LAST:event_jButton5ActionPerformed + + private void jPasswordField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPasswordField3ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jPasswordField3ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton5; + private javax.swing.JInternalFrame jInternalFrame1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JPasswordField jPasswordField1; + private javax.swing.JPasswordField jPasswordField2; + private javax.swing.JPasswordField jPasswordField3; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/cardbook.form b/projects/Metro_systems-master/metro_system/cardbook.form new file mode 100644 index 0000000..6711279 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/cardbook.form @@ -0,0 +1,288 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/cardbook.java b/projects/Metro_systems-master/metro_system/cardbook.java new file mode 100644 index 0000000..30ae955 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/cardbook.java @@ -0,0 +1,456 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.SimpleDateFormat; + +import javax.swing.JOptionPane; + + +/** + * + * @author sparsh + */ +public class cardbook extends javax.swing.JInternalFrame implements convar { + + static double fare,bal,rem_bal; + + public void generatebookNo() + { + Connection myconnection2; + + try + + + { + myconnection2=DriverManager.getConnection(path+place, username, password); + try + { + String query2="select max(book_no) from bookingcard"; + PreparedStatement mystatement2=myconnection2.prepareStatement(query2); + ResultSet myresult2=mystatement2.executeQuery(); + if(myresult2.next()) + { + jLabel24.setText(String.valueOf(myresult2.getInt(1)+1)); + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Incriment Error:"+e.getMessage()); + } + finally + { + myconnection2.close(); + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + /** + * Creates new form token + */ + public cardbook() { + initComponents(); + generatebookNo(); + + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel5 = new javax.swing.JLabel(); + jLabel1 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jLabel9 = new javax.swing.JLabel(); + jLabel10 = new javax.swing.JLabel(); + jLabel11 = new javax.swing.JLabel(); + jLabel12 = new javax.swing.JLabel(); + jLabel13 = new javax.swing.JLabel(); + jLabel19 = new javax.swing.JLabel(); + jLabel20 = new javax.swing.JLabel(); + jLabel21 = new javax.swing.JLabel(); + jLabel22 = new javax.swing.JLabel(); + jLabel23 = new javax.swing.JLabel(); + jLabel14 = new javax.swing.JLabel(); + jLabel15 = new javax.swing.JLabel(); + jLabel16 = new javax.swing.JLabel(); + jLabel17 = new javax.swing.JLabel(); + jLabel18 = new javax.swing.JLabel(); + jLabel24 = new javax.swing.JLabel(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + addInternalFrameListener(new javax.swing.event.InternalFrameListener() { + public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) { + formInternalFrameActivated(evt); + } + public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) { + } + public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) { + } + public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) { + } + public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) { + } + public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) { + } + public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) { + } + }); + + jLabel5.setText("Mins."); + + jLabel1.setText("From"); + + jLabel6.setText("Distance"); + + jLabel2.setText("To:"); + + jLabel7.setText("Kms."); + + jLabel8.setText("Stations in between"); + + jButton1.setText("BOOK"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel3.setText("Fare (Rs.)"); + + jLabel4.setText("Travelling Time"); + + jLabel22.setText("Booking date"); + + jLabel14.setText("Card Balance"); + + jLabel16.setText("Smartcard No."); + + jLabel17.setBackground(new java.awt.Color(255, 0, 102)); + + jLabel18.setText("Booking No."); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(25, 25, 25) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(15, 15, 15) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(37, 37, 37) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(43, 43, 43) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 335, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 335, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(193, 193, 193)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(35, 35, 35) + .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(40, 40, 40) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(72, 72, 72)))) + .addGroup(layout.createSequentialGroup() + .addGap(145, 145, 145) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(49, 49, 49) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel18, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 24, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(45, 45, 45) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(45, 45, 45) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addGap(30, 30, 30) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addGap(8, 8, 8) + .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(26, 26, 26) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(21, 21, 21) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(35, 35, 35) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel23, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(46, 46, 46)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + if(bal>fare) + { + rem_bal=bal-fare; + Connection myconnection; + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="insert into bookingcard values(?,?,?,?,?,?,?,?,?,?,?,?)"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jLabel9.getText()); + mystatement.setString(2, jLabel10.getText()); + mystatement.setString(3, jLabel11.getText()); + mystatement.setString(4, jLabel12.getText()); + mystatement.setString(5, jLabel13.getText()); + mystatement.setString(6, String.valueOf(bal)); + mystatement.setString(7, jLabel19.getText()); + + mystatement.setString(8, jLabel17.getText()); + mystatement.setString(9, jLabel20.getText()); + mystatement.setString(10, jLabel21.getText()); + mystatement.setString(11, jLabel23.getText()); + mystatement.setString(12, jLabel24.getText()); + + SimpleDateFormat myFormat; + myFormat = new SimpleDateFormat("yyyy-MM-dd "); + java.util.Date date = new java.util.Date(); + mystatement.setString(11, myFormat.format(date)); + + if( mystatement.executeUpdate()>0 ) + { + JOptionPane.showMessageDialog(rootPane, "Ticket booked successfully by card.Remaining balance : "+rem_bal + " and Booking no. is : " + jLabel24.getText()); + + } + query="update smartcard set balance =? where s_id= ?"; + PreparedStatement mystatement1=myconnection.prepareStatement(query); + mystatement1.setString(1, String.valueOf(rem_bal)); + mystatement1.setString(2, jLabel17.getText()); + if(mystatement1.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "account balance updated successfully"); + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + else + { + JOptionPane.showMessageDialog(rootPane, "Balance in card is less than the fare price .Please add some money in the card first."); + this.dispose(); + } + }//GEN-LAST:event_jButton1ActionPerformed + + private void formInternalFrameActivated(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameActivated + Connection myconnection; +// SimpleDateFormat myFormat; +// myFormat = new SimpleDateFormat("yyyy-MM-dd "); + java.util.Date date = new java.util.Date(); + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from faretable f,smartcard s where f.route1=? and f.stn1=? and f.route2=? and f.stn2=? and s.s_id=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, cardbooksearch.s[0]); + mystatement.setString(2, cardbooksearch.s[1]); + mystatement.setString(3, cardbooksearch.s[2]); + mystatement.setString(4, cardbooksearch.s[3]); + mystatement.setString(5, cardbooksearch.n); + // System.out.print(cardbooksearch.s[0]); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + {if(date.before(myres.getDate(20))) + { fare=Double.parseDouble(myres.getString("fare")); + bal=Double.parseDouble(myres.getString("balance")); + + jLabel9.setText(cardbooksearch.s[0]); + jLabel10.setText(cardbooksearch.s[1]); + jLabel11.setText(cardbooksearch.s[2]); + jLabel12.setText(cardbooksearch.s[3]); + jLabel17.setText(cardbooksearch.n); + if(myres.getString("cardtype").equalsIgnoreCase("standard")) + { fare=(double)fare*.90; + jLabel13.setText(String.valueOf(fare)); + } + else + { + fare=(double)fare*.85; + jLabel13.setText(String.valueOf(fare)); + + } + jLabel15.setText(myres.getString("balance")); + jLabel19.setText(myres.getString(6)); + jLabel20.setText(myres.getString(7)); + jLabel21.setText(myres.getString(8)); + + SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); +// get current date time with Date() + // java.util.Date date = new java.util.Date(); + jLabel23.setText(dateFormat.format(date)); + + + } + else{ + JOptionPane.showMessageDialog(rootPane, "The card has expired.Please renew."); + } + + } + else{ + JOptionPane.showMessageDialog(rootPane, "i dont know whats wrong"); + }} + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, " double query Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + }//GEN-LAST:event_formInternalFrameActivated + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel14; + private javax.swing.JLabel jLabel15; + private javax.swing.JLabel jLabel16; + private javax.swing.JLabel jLabel17; + private javax.swing.JLabel jLabel18; + private javax.swing.JLabel jLabel19; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel20; + private javax.swing.JLabel jLabel21; + private javax.swing.JLabel jLabel22; + private javax.swing.JLabel jLabel23; + private javax.swing.JLabel jLabel24; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/cardbook.png b/projects/Metro_systems-master/metro_system/cardbook.png new file mode 100644 index 0000000..0a1e0c4 Binary files /dev/null and b/projects/Metro_systems-master/metro_system/cardbook.png differ diff --git a/projects/Metro_systems-master/metro_system/cardbooksearch.form b/projects/Metro_systems-master/metro_system/cardbooksearch.form new file mode 100644 index 0000000..405f040 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/cardbooksearch.form @@ -0,0 +1,172 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/cardbooksearch.java b/projects/Metro_systems-master/metro_system/cardbooksearch.java new file mode 100644 index 0000000..a218022 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/cardbooksearch.java @@ -0,0 +1,349 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class cardbooksearch extends javax.swing.JInternalFrame implements convar{ + + static String s[]=new String[4]; + static String n; + /** + * Creates new form tokensearch + */ + public cardbooksearch() { + initComponents(); + + // jSpinner1.setValue(a); + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from routetable"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { + do + { + jComboBox3.addItem(myres.getString("route")); + jComboBox2.addItem(myres.getString("route")); + } + while(myres.next()); + + + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel2 = new javax.swing.JLabel(); + jComboBox3 = new javax.swing.JComboBox<>(); + jComboBox4 = new javax.swing.JComboBox<>(); + jComboBox5 = new javax.swing.JComboBox<>(); + jLabel1 = new javax.swing.JLabel(); + jComboBox2 = new javax.swing.JComboBox<>(); + jButton1 = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + + setClosable(true); + setIconifiable(true); + + jLabel2.setText("To:"); + + jComboBox3.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose Route" })); + jComboBox3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox3ActionPerformed(evt); + } + }); + + jComboBox4.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "choose route first" })); + + jComboBox5.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "choose route first" })); + + jLabel1.setText("From"); + + jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose route" })); + jComboBox2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox2ActionPerformed(evt); + } + }); + + jButton1.setText("Proceed"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel3.setText("Smartcard No."); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 59, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jComboBox3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 35, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jComboBox4, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(92, 92, 92) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(56, 56, 56) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 223, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(199, 199, 199) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(27, 27, 27) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE) + .addComponent(jTextField1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 57, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(45, 45, 45) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(61, 61, 61) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(169, 169, 169)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jComboBox3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox3ActionPerformed + Connection myconnection; + + if(jComboBox3.getSelectedIndex()>0){ + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from stationtable where route=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox3.getSelectedItem().toString()); + + ResultSet myres = mystatement.executeQuery(); + jComboBox5.removeAllItems(); + jComboBox5.addItem("choose station"); + if(myres.next()) + { + do + { + jComboBox5.addItem(myres.getString("stn_name")); + + } + while(myres.next()); + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + else{ + jComboBox5.addItem("choose route first"); + } // TODO add your handling code here: + }//GEN-LAST:event_jComboBox3ActionPerformed + + private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed + Connection myconnection; + + if(jComboBox2.getSelectedIndex()>0){ + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from stationtable where route=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox2.getSelectedItem().toString()); + ResultSet myres = mystatement.executeQuery(); + jComboBox4.removeAllItems(); + jComboBox4.addItem("choose station"); + if(myres.next()) + { + do + { + jComboBox4.addItem(myres.getString("stn_name")); + + } + while(myres.next()); + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + else{ + jComboBox4.addItem("choose route first"); + } + }//GEN-LAST:event_jComboBox2ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + s[0] = jComboBox2.getSelectedItem().toString(); + s[1] = jComboBox4.getSelectedItem().toString(); + s[2] = jComboBox3.getSelectedItem().toString(); + s[3] = jComboBox5.getSelectedItem().toString(); + n = jTextField1.getText(); + boolean flag=false; + if(jComboBox2.getSelectedIndex()>0 && jComboBox3.getSelectedIndex()>0 && jComboBox4.getSelectedIndex()>0 && jComboBox5.getSelectedIndex()>0 && !jTextField1.getText().equals("") ) + + {Connection myconnection; + + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from smartcard where s_id=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jTextField1.getText()); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { + flag=true; + + } + else + { + JOptionPane.showMessageDialog(rootPane, "Wrong Smart card ID ."); + flag=false; + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + try{ if (flag) + { +// +// + cardbook obj=new cardbook(); + mainframe.jDesktopPane1.add(obj); + obj.setVisible(true); + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "this statement is not working"+e.getMessage()); + } + + } + else + { + JOptionPane.showMessageDialog(rootPane, "Please select appropriate choce/fill in the fields"); + } + + }//GEN-LAST:event_jButton1ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JComboBox jComboBox2; + private javax.swing.JComboBox jComboBox3; + private javax.swing.JComboBox jComboBox4; + private javax.swing.JComboBox jComboBox5; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/cardsearch.form b/projects/Metro_systems-master/metro_system/cardsearch.form new file mode 100644 index 0000000..c46e656 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/cardsearch.form @@ -0,0 +1,299 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/projects/Metro_systems-master/metro_system/cardsearch.java b/projects/Metro_systems-master/metro_system/cardsearch.java new file mode 100644 index 0000000..e44c887 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/cardsearch.java @@ -0,0 +1,493 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import javax.swing.JOptionPane; +import javax.swing.JTable; +import javax.swing.table.DefaultTableModel; +import static metro_system.convar.password; +import static metro_system.convar.path; +import static metro_system.convar.place; +import static metro_system.convar.username; + +/** + * + * @author sparsh + */ +public class cardsearch extends javax.swing.JInternalFrame implements convar{ + + static String s[]=new String[4]; + static Integer n; + /** + * Creates new form tokensearch + */ + public cardsearch() { + initComponents(); + jDateChooser1.setDate(null); + + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from routetable"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { + do + { + jComboBox3.addItem(myres.getString("route")); + jComboBox2.addItem(myres.getString("route")); + } + while(myres.next()); + + + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel2 = new javax.swing.JLabel(); + jComboBox3 = new javax.swing.JComboBox<>(); + jComboBox4 = new javax.swing.JComboBox<>(); + jComboBox5 = new javax.swing.JComboBox<>(); + jLabel1 = new javax.swing.JLabel(); + jComboBox2 = new javax.swing.JComboBox<>(); + jButton1 = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jDateChooser1 = new com.toedter.calendar.JDateChooser(); + jScrollPane1 = new javax.swing.JScrollPane(); + jTable1 = new javax.swing.JTable(); + jLabel5 = new javax.swing.JLabel(); + jTextField2 = new javax.swing.JTextField(); + jLabel6 = new javax.swing.JLabel(); + jTextField3 = new javax.swing.JTextField(); + jButton2 = new javax.swing.JButton(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + setTitle("Ticket searching"); + + jLabel2.setText("To:"); + + jComboBox3.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose Route" })); + jComboBox3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox3ActionPerformed(evt); + } + }); + + jComboBox4.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "choose route first" })); + + jComboBox5.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "choose route first" })); + + jLabel1.setText("From"); + + jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose route" })); + jComboBox2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox2ActionPerformed(evt); + } + }); + + jButton1.setText("Search"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel3.setText("Smartcard no."); + + jLabel4.setText("Date"); + + jTable1.setAutoCreateRowSorter(true); + jTable1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(51, 51, 51), new java.awt.Color(0, 102, 255), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 255))); + jTable1.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + + }, + new String [] { + "Smartcard No.", "Booking No.", "Date", "From", "To" + } + )); + jTable1.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jTable1MouseClicked(evt); + } + }); + jScrollPane1.setViewportView(jTable1); + + jLabel5.setText("Book No."); + + jLabel6.setText("Total rows"); + + jTextField3.setEditable(false); + jTextField3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField3ActionPerformed(evt); + } + }); + + jButton2.setText("Print"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(22, 22, 22) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(12, 12, 12) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(233, 233, 233) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(35, 35, 35) + .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(60, 60, 60) + .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(60, 60, 60) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jComboBox3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addGap(35, 35, 35) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE))))) + .addGroup(layout.createSequentialGroup() + .addGap(242, 242, 242) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(54, 54, 54) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(70, 70, 70) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(45, 45, 45) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(16, 16, 16)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(32, 32, 32) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(72, 72, 72)))) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane1))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(42, 50, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(33, 33, 33) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(55, 55, 55) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(32, 32, 32) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, 0)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jComboBox3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox3ActionPerformed + Connection myconnection; + + if(jComboBox3.getSelectedIndex()>0){ + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from stationtable where route=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox3.getSelectedItem().toString()); + + ResultSet myres = mystatement.executeQuery(); + jComboBox5.removeAllItems(); + jComboBox5.addItem("choose station"); + if(myres.next()) + { + do + { + jComboBox5.addItem(myres.getString("stn_name")); + + } + while(myres.next()); + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + else{ + jComboBox5.addItem("choose route first"); + } // TODO add your handling code here: + }//GEN-LAST:event_jComboBox3ActionPerformed + + private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed + Connection myconnection; + + if(jComboBox2.getSelectedIndex()>0){ + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from stationtable where route=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox2.getSelectedItem().toString()); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { jComboBox4.removeAllItems(); + jComboBox4.addItem("choose station"); + do + { + jComboBox4.addItem(myres.getString("stn_name")); + + } + while(myres.next()); + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + else{ + jComboBox4.addItem("choose route first"); + } + }//GEN-LAST:event_jComboBox2ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + SimpleDateFormat myformat=new SimpleDateFormat("yyyy-MM-dd"); + + + + try{ + Connection myconnection = DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from bookingcard where s_id like ? and book_no like ? and route1 like ? and stn1 like ? and route2 like ? and stn2 like ? and bookingdate like ?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, "%"+jTextField1.getText()+"%"); + mystatement.setString(2, "%"+jTextField2.getText()+"%"); + + if(jComboBox2.getSelectedIndex()>0) + s[0] = jComboBox2.getSelectedItem().toString(); + else + s[0]="%"; + if(jComboBox4.getSelectedIndex()>0) + s[1] = jComboBox4.getSelectedItem().toString(); + else + s[1]="%"; + if(jComboBox3.getSelectedIndex()>0) + s[2] = jComboBox3.getSelectedItem().toString(); + else + s[2]="%"; + if(jComboBox5.getSelectedIndex()>0) + s[3] = jComboBox5.getSelectedItem().toString(); + else + s[3]="%"; + + mystatement.setString(3, s[0]); + mystatement.setString(4, s[1]); + mystatement.setString(5, s[2]); + mystatement.setString(6, s[3]); + + // SimpleDateFormat myformat=new SimpleDateFormat("yyyy-MM-dd"); + if(jDateChooser1.getDate()!=null) + mystatement.setString(7, "%"+myformat.format(jDateChooser1.getDate()) + "%"); + else + mystatement.setString(7, "%"); + + ResultSet myres=mystatement.executeQuery(); + DefaultTableModel mymodel=(DefaultTableModel) jTable1.getModel(); + if(myres.next()) + { + mymodel.setRowCount(0); + do{ + String smrt,bookno,date,from,to; + smrt=myres.getString(8); + bookno=myres.getString(12); + date=myres.getString(11); + from=myres.getString(1) +" , "+myres.getString(2); + to=myres.getString(3) +" , "+myres.getString(4); + mymodel.addRow(new Object[]{smrt,bookno,date,from,to}); + } + while(myres.next()); + + int row=jTable1.getRowCount(); + jTextField3.setText(String.valueOf(row)); + } + else{ + mymodel.setRowCount(0); + int row=jTable1.getRowCount(); + jTextField3.setText(String.valueOf(row)); + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + + + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField3ActionPerformed + + private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked + // TODO add your handling code here: + }//GEN-LAST:event_jTable1MouseClicked + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + try { + MessageFormat headerFormat = new MessageFormat("Page {0}"); + MessageFormat footerFormat = new MessageFormat("- {0} -"); + jTable1.print(JTable.PrintMode.FIT_WIDTH, headerFormat, footerFormat); + } + catch (Exception pe) + { + System.err.println("Error printing: " + pe.getMessage()); + } + }//GEN-LAST:event_jButton2ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JComboBox jComboBox2; + private javax.swing.JComboBox jComboBox3; + private javax.swing.JComboBox jComboBox4; + private javax.swing.JComboBox jComboBox5; + private com.toedter.calendar.JDateChooser jDateChooser1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTable jTable1; + private javax.swing.JTextField jTextField1; + private javax.swing.JTextField jTextField2; + private javax.swing.JTextField jTextField3; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/certified.jpeg b/projects/Metro_systems-master/metro_system/certified.jpeg new file mode 100644 index 0000000..438f806 Binary files /dev/null and b/projects/Metro_systems-master/metro_system/certified.jpeg differ diff --git a/projects/Metro_systems-master/metro_system/changepassword.form b/projects/Metro_systems-master/metro_system/changepassword.form new file mode 100644 index 0000000..dd8bd78 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/changepassword.form @@ -0,0 +1,163 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/changepassword.java b/projects/Metro_systems-master/metro_system/changepassword.java new file mode 100644 index 0000000..dea7d4d --- /dev/null +++ b/projects/Metro_systems-master/metro_system/changepassword.java @@ -0,0 +1,246 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class changepassword extends javax.swing.JInternalFrame implements convar{ + + /** + * Creates new form createemployee + */ + public changepassword() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jInternalFrame1 = new javax.swing.JInternalFrame(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jPasswordField1 = new javax.swing.JPasswordField(); + jButton5 = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + jPasswordField2 = new javax.swing.JPasswordField(); + jLabel4 = new javax.swing.JLabel(); + jPasswordField3 = new javax.swing.JPasswordField(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + setTitle("Change Password"); + + jInternalFrame1.setClosable(true); + jInternalFrame1.setIconifiable(true); + jInternalFrame1.setMaximizable(true); + jInternalFrame1.setResizable(true); + jInternalFrame1.setTitle("Create Employee Account"); + + javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane()); + jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout); + jInternalFrame1Layout.setHorizontalGroup( + jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 0, Short.MAX_VALUE) + ); + jInternalFrame1Layout.setVerticalGroup( + jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 0, Short.MAX_VALUE) + ); + + jLabel1.setText("Username"); + + jLabel2.setText("Previous Password"); + + jButton5.setText("Change Password"); + jButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton5ActionPerformed(evt); + } + }); + + jLabel3.setText("New Password"); + + jLabel4.setText("Confirm Password"); + + jPasswordField3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jPasswordField3ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(223, 223, 223) + .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(130, 130, 130) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(61, 61, 61) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField3, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap(165, Short.MAX_VALUE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 348, Short.MAX_VALUE) + .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 348, Short.MAX_VALUE))) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(65, 65, 65) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField3, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 72, Short.MAX_VALUE) + .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(59, 59, 59)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 229, Short.MAX_VALUE) + .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 229, Short.MAX_VALUE))) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed + if(jPasswordField2.getText() .equals(jPasswordField3.getText())) + { + Connection myconnection; + try + { + myconnection=DriverManager.getConnection(path+place, username, password); + try + { + int a= JOptionPane.showConfirmDialog(rootPane, "Do you really want to Change Password? Username:"+jTextField1.getText(), "Confirm", JOptionPane.YES_NO_OPTION); + if(a==JOptionPane.YES_OPTION) + { + String query="select * from admintable where username=? and password=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jTextField1.getText()); + mystatement.setString(2, jPasswordField1.getText()); + ResultSet myresult=mystatement.executeQuery(); + + String query2="select * from employeetable where username=? and password=?"; + PreparedStatement mystatement2=myconnection.prepareStatement(query2); + mystatement2.setString(1, jTextField1.getText()); + mystatement2.setString(2, jPasswordField1.getText()); + ResultSet myresult2=mystatement2.executeQuery(); + + if(myresult.next()) + { + String query3="update admintable set password=? where username=?"; + PreparedStatement mystatement3=myconnection.prepareStatement(query3); + mystatement3.setString(1, jPasswordField2.getText()); + mystatement3.setString(2, jTextField1.getText()); + if(mystatement3.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "Password changed Successfully."); + this.dispose(); + } + } + else if(myresult2.next()) + { + String query4="update employeetable set password=? where username=?"; + PreparedStatement mystatement4=myconnection.prepareStatement(query4); + mystatement4.setString(1, jPasswordField2.getText()); + mystatement4.setString(2, jTextField1.getText()); + if(mystatement4.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "Password changed Successfully."); + login lg=new login(); + lg.setVisible(true); + this.dispose(); + } + } + else + { + JOptionPane.showMessageDialog(rootPane, "Incorrect Username/Password"); + } + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(null, "Changing Password Error."+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(null, "Connection Error."+e.getMessage()); + } + } + else + { + JOptionPane.showMessageDialog(rootPane, "Password doesn't match"); + } + }//GEN-LAST:event_jButton5ActionPerformed + + private void jPasswordField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPasswordField3ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jPasswordField3ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton5; + private javax.swing.JInternalFrame jInternalFrame1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JPasswordField jPasswordField1; + private javax.swing.JPasswordField jPasswordField2; + private javax.swing.JPasswordField jPasswordField3; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/changepassword.jpg b/projects/Metro_systems-master/metro_system/changepassword.jpg new file mode 100644 index 0000000..168d99b Binary files /dev/null and b/projects/Metro_systems-master/metro_system/changepassword.jpg differ diff --git a/projects/Metro_systems-master/metro_system/convar.java b/projects/Metro_systems-master/metro_system/convar.java new file mode 100644 index 0000000..b29c438 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/convar.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + + +public interface convar { + String path="jdbc:mysql://localhost/"; + String place="metros"; + String username="root"; + String password=""; +} diff --git a/projects/Metro_systems-master/metro_system/createadmin.form b/projects/Metro_systems-master/metro_system/createadmin.form new file mode 100644 index 0000000..3b8b854 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/createadmin.form @@ -0,0 +1,114 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/createadmin.java b/projects/Metro_systems-master/metro_system/createadmin.java new file mode 100644 index 0000000..b06cce5 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/createadmin.java @@ -0,0 +1,222 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import javax.swing.JOptionPane; +import static metro_system.convar.password; +import static metro_system.convar.path; +import static metro_system.convar.place; +import static metro_system.convar.username; + +/** + * + * @author sparsh + */ +public class createadmin extends javax.swing.JFrame { + + /** + * Creates new form createadmin + */ + public createadmin() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jTextField1 = new javax.swing.JTextField(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + jPasswordField1 = new javax.swing.JPasswordField(); + jPasswordField2 = new javax.swing.JPasswordField(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("Create Admin"); + + jTextField1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField1ActionPerformed(evt); + } + }); + + jLabel1.setText("Username"); + + jLabel2.setText("Pasword"); + + jLabel3.setText("Confirm Password"); + + jButton1.setText("Create Admin"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jPasswordField2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jPasswordField2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(88, 88, 88) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(90, 90, 90) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE) + .addComponent(jPasswordField1) + .addComponent(jPasswordField2))) + .addGroup(layout.createSequentialGroup() + .addGap(200, 200, 200) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(225, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(130, 130, 130) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(35, 35, 35) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(41, 41, 41) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 90, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(98, 98, 98)) + ); + + pack(); + setLocationRelativeTo(null); + }// //GEN-END:initComponents + + private void jPasswordField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPasswordField2ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jPasswordField2ActionPerformed + + private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField1ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + + + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + if(jPasswordField1.getText().equals(jPasswordField2.getText())) + { String query="insert into admintable values(?,?)"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jTextField1.getText()); + mystatement.setString(2, jPasswordField1.getText()); + if(mystatement.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "Admin created Successfully"); + jTextField1.setText(""); + + jPasswordField1.setText("");jPasswordField2.setText(""); + mainframe obj=new mainframe(); + obj.setVisible(true); + this.dispose(); + } + + }else + { + JOptionPane.showMessageDialog(rootPane, "The passwords entered do no match with each other.Enter again."); + jPasswordField1.setText("");jPasswordField2.setText(""); + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + }//GEN-LAST:event_jButton1ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(createadmin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(createadmin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(createadmin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(createadmin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new createadmin().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JPasswordField jPasswordField1; + private javax.swing.JPasswordField jPasswordField2; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/createemployee.form b/projects/Metro_systems-master/metro_system/createemployee.form new file mode 100644 index 0000000..9092b8f --- /dev/null +++ b/projects/Metro_systems-master/metro_system/createemployee.form @@ -0,0 +1,114 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/createemployee.java b/projects/Metro_systems-master/metro_system/createemployee.java new file mode 100644 index 0000000..bb46f47 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/createemployee.java @@ -0,0 +1,188 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class createemployee extends javax.swing.JInternalFrame implements convar { + + /** + * Creates new form createemployee + */ + public createemployee() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + jPasswordField1 = new javax.swing.JPasswordField(); + jPasswordField2 = new javax.swing.JPasswordField(); + jTextField1 = new javax.swing.JTextField(); + + setClosable(true); + setIconifiable(true); + setTitle("Create new Employee login"); + + jLabel1.setText("Username"); + + jLabel2.setText("Pasword"); + + jLabel3.setText("Confirm Password"); + + jButton1.setText("Create Employee"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jPasswordField2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jPasswordField2ActionPerformed(evt); + } + }); + + jTextField1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(78, 78, 78) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(90, 90, 90) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jTextField1) + .addComponent(jPasswordField1) + .addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(layout.createSequentialGroup() + .addGap(170, 170, 170) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(103, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(76, 76, 76) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(35, 35, 35) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(41, 41, 41) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(55, 55, 55) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(104, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + /* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + + /** + * + * @author sparsh + */ + + Connection myconnection; + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + if(jPasswordField1.getText().equals(jPasswordField2.getText())) + { String query="insert into employeetable values(?,?)"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jTextField1.getText()); + mystatement.setString(2, jPasswordField1.getText()); + if(mystatement.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "Information Sored Successfully"); + jTextField1.setText(""); + + jPasswordField1.setText("");jPasswordField2.setText(""); + } + + }else + { + JOptionPane.showMessageDialog(rootPane, "The passwords entered do no match with each other.Enter again."); + jPasswordField1.setText("");jPasswordField2.setText(""); + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jPasswordField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPasswordField2ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jPasswordField2ActionPerformed + + private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField1ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JPasswordField jPasswordField1; + private javax.swing.JPasswordField jPasswordField2; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/delete-user.png b/projects/Metro_systems-master/metro_system/delete-user.png new file mode 100644 index 0000000..e04d700 Binary files /dev/null and b/projects/Metro_systems-master/metro_system/delete-user.png differ diff --git a/projects/Metro_systems-master/metro_system/deletecardbook.form b/projects/Metro_systems-master/metro_system/deletecardbook.form new file mode 100644 index 0000000..50d7405 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/deletecardbook.form @@ -0,0 +1,75 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/deletecardbook.java b/projects/Metro_systems-master/metro_system/deletecardbook.java new file mode 100644 index 0000000..2e5f300 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/deletecardbook.java @@ -0,0 +1,142 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.SimpleDateFormat; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class deletecardbook extends javax.swing.JInternalFrame implements convar { + + /** + * Creates new form viewdelivery + */ + public deletecardbook() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jButton1 = new javax.swing.JButton(); + + setClosable(true); + setIconifiable(true); + setTitle("Delete Booking Number"); + setPreferredSize(new java.awt.Dimension(1171, 750)); + + jLabel1.setText("Enter Book Number"); + + jTextField1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField1ActionPerformed(evt); + } + }); + + jButton1.setText("Delete"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(103, 103, 103) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(51, 51, 51) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(137, 137, 137) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(24, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(87, 87, 87) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(175, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + + Connection myconnection; + + try + { + myconnection=DriverManager.getConnection(path+place, username, password); + try + { + + + int a= JOptionPane.showConfirmDialog(rootPane, "Do you really want to Delete smartcard? smartcard Number:"+jTextField1.getText(), "Confirm", JOptionPane.YES_NO_OPTION); + if(a==JOptionPane.YES_OPTION) + { + String query="delete from cardbook where book_no=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1,jTextField1.getText()); + if(mystatement.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "Booking Deleted Successfully. Booking Number:"+jTextField1.getText()); + } + else{ + JOptionPane.showMessageDialog(rootPane, "wrong Booking number"); + + } + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Deletion Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField1ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/deleteemployee.form b/projects/Metro_systems-master/metro_system/deleteemployee.form new file mode 100644 index 0000000..8ef8661 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/deleteemployee.form @@ -0,0 +1,75 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/deleteemployee.java b/projects/Metro_systems-master/metro_system/deleteemployee.java new file mode 100644 index 0000000..ac0c9ad --- /dev/null +++ b/projects/Metro_systems-master/metro_system/deleteemployee.java @@ -0,0 +1,142 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.SimpleDateFormat; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class deleteemployee extends javax.swing.JInternalFrame implements convar { + + /** + * Creates new form viewdelivery + */ + public deleteemployee() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jButton1 = new javax.swing.JButton(); + + setClosable(true); + setIconifiable(true); + setTitle("Delete Employee"); + setPreferredSize(new java.awt.Dimension(1171, 750)); + + jLabel1.setText("Enter Employee username"); + + jTextField1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField1ActionPerformed(evt); + } + }); + + jButton1.setText("Delete"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(103, 103, 103) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(51, 51, 51) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(137, 137, 137) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(227, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(87, 87, 87) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(617, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + + Connection myconnection; + + try + { + myconnection=DriverManager.getConnection(path+place, username, password); + try + { + + + int a= JOptionPane.showConfirmDialog(rootPane, "Do you really want to Delete employee? Employee Number:"+jTextField1.getText(), "Confirm", JOptionPane.YES_NO_OPTION); + if(a==JOptionPane.YES_OPTION) + { + String query="delete from employeetable where username = ?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1,jTextField1.getText()); + if(mystatement.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "Employee Deleted Successfully. smartcard Number:"+jTextField1.getText()); + } + else{ + JOptionPane.showMessageDialog(rootPane, "wrong Employee number"); + + } + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Deletion Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField1ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/deletemetro.form b/projects/Metro_systems-master/metro_system/deletemetro.form new file mode 100644 index 0000000..03b341a --- /dev/null +++ b/projects/Metro_systems-master/metro_system/deletemetro.form @@ -0,0 +1,75 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/deletemetro.java b/projects/Metro_systems-master/metro_system/deletemetro.java new file mode 100644 index 0000000..307b331 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/deletemetro.java @@ -0,0 +1,142 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.SimpleDateFormat; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class deletemetro extends javax.swing.JInternalFrame implements convar { + + /** + * Creates new form viewdelivery + */ + public deletemetro() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jButton1 = new javax.swing.JButton(); + + setClosable(true); + setIconifiable(true); + setTitle("Delete Metro "); + setPreferredSize(new java.awt.Dimension(1171, 750)); + + jLabel1.setText("Enter Metro Number"); + + jTextField1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField1ActionPerformed(evt); + } + }); + + jButton1.setText("Delete"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(103, 103, 103) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(51, 51, 51) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(137, 137, 137) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(108, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(87, 87, 87) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(156, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + + Connection myconnection; + + try + { + myconnection=DriverManager.getConnection(path+place, username, password); + try + { + + + int a= JOptionPane.showConfirmDialog(rootPane, "Do you really want to Delete smartcard? smartcard Number:"+jTextField1.getText(), "Confirm", JOptionPane.YES_NO_OPTION); + if(a==JOptionPane.YES_OPTION) + { + String query="delete from metrotable where metro_no=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1,jTextField1.getText()); + if(mystatement.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "Metro Deleted Successfully. smartcard Number:"+jTextField1.getText()); + } + else{ + JOptionPane.showMessageDialog(rootPane, "Wrong Metro number"); + + } + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Deletion Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField1ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/deletemetro.jpeg b/projects/Metro_systems-master/metro_system/deletemetro.jpeg new file mode 100644 index 0000000..21872e5 Binary files /dev/null and b/projects/Metro_systems-master/metro_system/deletemetro.jpeg differ diff --git a/projects/Metro_systems-master/metro_system/deletesmartcard.form b/projects/Metro_systems-master/metro_system/deletesmartcard.form new file mode 100644 index 0000000..0d8ad47 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/deletesmartcard.form @@ -0,0 +1,75 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/deletesmartcard.java b/projects/Metro_systems-master/metro_system/deletesmartcard.java new file mode 100644 index 0000000..e0b9a02 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/deletesmartcard.java @@ -0,0 +1,142 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.SimpleDateFormat; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class deletesmartcard extends javax.swing.JInternalFrame implements convar { + + /** + * Creates new form viewdelivery + */ + public deletesmartcard() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jButton1 = new javax.swing.JButton(); + + setClosable(true); + setIconifiable(true); + setTitle("Delete Smartcard"); + setPreferredSize(new java.awt.Dimension(1171, 750)); + + jLabel1.setText("Enter smarrtcard Number"); + + jTextField1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField1ActionPerformed(evt); + } + }); + + jButton1.setText("Delete"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(103, 103, 103) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(51, 51, 51) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(137, 137, 137) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(227, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(87, 87, 87) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(617, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + + Connection myconnection; + + try + { + myconnection=DriverManager.getConnection(path+place, username, password); + try + { + + + int a= JOptionPane.showConfirmDialog(rootPane, "Do you really want to Delete smartcard? smartcard Number:"+jTextField1.getText(), "Confirm", JOptionPane.YES_NO_OPTION); + if(a==JOptionPane.YES_OPTION) + { + String query="delete from smartcard where s_id=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1,jTextField1.getText()); + if(mystatement.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "smartcard Deleted Successfully. smartcard Number:"+jTextField1.getText()); + } + else{ + JOptionPane.showMessageDialog(rootPane, "wrong smartcard number"); + + } + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Deletion Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField1ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/deletesmartcard.jpeg b/projects/Metro_systems-master/metro_system/deletesmartcard.jpeg new file mode 100644 index 0000000..059d365 Binary files /dev/null and b/projects/Metro_systems-master/metro_system/deletesmartcard.jpeg differ diff --git a/projects/Metro_systems-master/metro_system/empCashreciept.form b/projects/Metro_systems-master/metro_system/empCashreciept.form new file mode 100644 index 0000000..c34d3d2 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empCashreciept.form @@ -0,0 +1,1236 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/empCashreciept.java b/projects/Metro_systems-master/metro_system/empCashreciept.java new file mode 100644 index 0000000..af7d018 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empCashreciept.java @@ -0,0 +1,1147 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; +import java.awt.Component; +import java.awt.Dimension; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import javax.swing.JOptionPane; +import javax.swing.table.DefaultTableModel; +import java.sql.*; +import java.io.*; +import java.sql.*; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.imageio.ImageIO; +import javax.swing.*; +import javax.swing.filechooser.FileFilter; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.print.*; +import javax.imageio.ImageIO; +import javax.swing.table.DefaultTableModel; + + +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.print.PageFormat; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JFrame; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class empCashreciept extends javax.swing.JInternalFrame implements convar,Printable { + + /** + * Creates new form Cashreciept + */ + public empCashreciept() { + + initComponents(); + + Connection myconnection; + jLabel4.setText(String.valueOf(empnewsmartcard.a)); + jLabel6.setText(String.valueOf((empnewsmartcard.a)+50)); + try{ + myconnection = DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from smartcard where s_id=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, empnewsmartcard.sno); + ResultSet myres = mystatement.executeQuery(); + + if( myres.next() ) + { + jLabel9.setText(empnewsmartcard.sno); + jTextField6.setText(myres.getString(2)); + jTextField4.setText(myres.getString("phn_no")); + jTextField5.setText(myres.getString(3)); + jTextField1.setText(myres.getString(4)); + jTextArea2.setText(myres.getString(6)); + jLabel42.setText(myres.getString(9)); + jTextField13.setText(myres.getString(11)); + jTextField14.setText(myres.getString(12)); + + + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jButton2 = new javax.swing.JButton(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + jLabel9 = new javax.swing.JLabel(); + jLabel11 = new javax.swing.JLabel(); + jTextField5 = new javax.swing.JTextField(); + jLabel12 = new javax.swing.JLabel(); + jTextField6 = new javax.swing.JTextField(); + jLabel10 = new javax.swing.JLabel(); + jTextField4 = new javax.swing.JTextField(); + jLabel13 = new javax.swing.JLabel(); + jLabel14 = new javax.swing.JLabel(); + jScrollPane2 = new javax.swing.JScrollPane(); + jTextArea2 = new javax.swing.JTextArea(); + jTextField1 = new javax.swing.JTextField(); + jInternalFrame1 = new javax.swing.JInternalFrame(); + jLabel15 = new javax.swing.JLabel(); + jTabbedPane1 = new javax.swing.JTabbedPane(); + jPanel1 = new javax.swing.JPanel(); + jLabel16 = new javax.swing.JLabel(); + jTextField7 = new javax.swing.JTextField(); + jLabel17 = new javax.swing.JLabel(); + jScrollPane3 = new javax.swing.JScrollPane(); + jTextArea3 = new javax.swing.JTextArea(); + jLabel18 = new javax.swing.JLabel(); + jTextField8 = new javax.swing.JTextField(); + jTextField9 = new javax.swing.JTextField(); + jLabel19 = new javax.swing.JLabel(); + jRadioButton3 = new javax.swing.JRadioButton(); + jLabel20 = new javax.swing.JLabel(); + jRadioButton4 = new javax.swing.JRadioButton(); + jLabel21 = new javax.swing.JLabel(); + jScrollPane4 = new javax.swing.JScrollPane(); + jTextArea4 = new javax.swing.JTextArea(); + jLabel22 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jPanel2 = new javax.swing.JPanel(); + jLabel23 = new javax.swing.JLabel(); + jLabel24 = new javax.swing.JLabel(); + jLabel25 = new javax.swing.JLabel(); + jRadioButton1 = new javax.swing.JRadioButton(); + jRadioButton2 = new javax.swing.JRadioButton(); + jTextField2 = new javax.swing.JTextField(); + jLabel26 = new javax.swing.JLabel(); + jButton4 = new javax.swing.JButton(); + jLabel27 = new javax.swing.JLabel(); + jInternalFrame2 = new javax.swing.JInternalFrame(); + jLabel28 = new javax.swing.JLabel(); + jTabbedPane2 = new javax.swing.JTabbedPane(); + jPanel3 = new javax.swing.JPanel(); + jLabel29 = new javax.swing.JLabel(); + jTextField10 = new javax.swing.JTextField(); + jLabel30 = new javax.swing.JLabel(); + jScrollPane5 = new javax.swing.JScrollPane(); + jTextArea5 = new javax.swing.JTextArea(); + jLabel31 = new javax.swing.JLabel(); + jTextField11 = new javax.swing.JTextField(); + jTextField12 = new javax.swing.JTextField(); + jLabel32 = new javax.swing.JLabel(); + jRadioButton5 = new javax.swing.JRadioButton(); + jLabel33 = new javax.swing.JLabel(); + jRadioButton6 = new javax.swing.JRadioButton(); + jLabel34 = new javax.swing.JLabel(); + jScrollPane6 = new javax.swing.JScrollPane(); + jTextArea6 = new javax.swing.JTextArea(); + jLabel35 = new javax.swing.JLabel(); + jButton5 = new javax.swing.JButton(); + jButton6 = new javax.swing.JButton(); + jPanel4 = new javax.swing.JPanel(); + jLabel36 = new javax.swing.JLabel(); + jLabel37 = new javax.swing.JLabel(); + jLabel38 = new javax.swing.JLabel(); + jRadioButton7 = new javax.swing.JRadioButton(); + jRadioButton8 = new javax.swing.JRadioButton(); + jTextField3 = new javax.swing.JTextField(); + jLabel39 = new javax.swing.JLabel(); + jButton7 = new javax.swing.JButton(); + jLabel40 = new javax.swing.JLabel(); + jLabel41 = new javax.swing.JLabel(); + jLabel42 = new javax.swing.JLabel(); + jLabel43 = new javax.swing.JLabel(); + jTextField13 = new javax.swing.JTextField(); + jTextField14 = new javax.swing.JTextField(); + jLabel44 = new javax.swing.JLabel(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + setTitle("Cash Receipt"); + + jLabel1.setText("Cash in card:"); + + jLabel2.setText("Making Charges "); + + jLabel3.setText("50"); + + jButton2.setText("Print"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + jLabel5.setText("Total Amount"); + + jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/metrohouston.png"))); // NOI18N + + jLabel8.setText("Smartcard Number"); + + jLabel11.setText("Name"); + + jLabel12.setText("Age"); + + jTextField6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField6ActionPerformed(evt); + } + }); + + jLabel10.setText("Gender"); + + jLabel13.setText("Phone Number"); + + jLabel14.setText("Address"); + + jTextArea2.setColumns(20); + jTextArea2.setRows(5); + jScrollPane2.setViewportView(jTextArea2); + + jInternalFrame1.setClosable(true); + jInternalFrame1.setIconifiable(true); + jInternalFrame1.setMaximizable(true); + jInternalFrame1.setResizable(true); + jInternalFrame1.setTitle("Create Smartcard"); + + jLabel15.setText("Smartcard Number"); + + jTabbedPane1.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), javax.swing.BorderFactory.createEtchedBorder())); + + jLabel16.setText("Gender"); + + jLabel17.setText("Phone Number"); + + jTextArea3.setColumns(20); + jTextArea3.setRows(5); + jScrollPane3.setViewportView(jTextArea3); + + jLabel18.setText("Address"); + + jTextField9.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField9ActionPerformed(evt); + } + }); + + jLabel19.setText("Name"); + + jRadioButton3.setText("Male"); + jRadioButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButton3ActionPerformed(evt); + } + }); + + jLabel20.setText("Age"); + + jRadioButton4.setText("Female"); + + jLabel21.setText("ID Proof details."); + + jTextArea4.setColumns(20); + jTextArea4.setRows(5); + jScrollPane4.setViewportView(jTextArea4); + + jLabel22.setToolTipText("Image to be uploaded"); + jLabel22.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 102, 102), 1, true)); + + jButton1.setText("UPLOAD"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jButton3.setText("Next"); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(105, 105, 105) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(26, 26, 26) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField8, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jRadioButton3) + .addGap(18, 18, 18) + .addComponent(jRadioButton4))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(54, 54, 54)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel21)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(424, 424, 424)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton3)))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(78, 78, 78)))) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(32, 32, 32) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(67, 67, 67) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(40, 40, 40) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(36, 36, 36)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(30, 30, 30))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel21)) + .addContainerGap()) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jButton3) + .addGap(58, 58, 58)))) + ); + + jTabbedPane1.addTab("Personal Details", jPanel1); + + jLabel23.setText("Card Type"); + + jLabel24.setText("Intial balance"); + + jLabel25.setText("Valid for"); + + jRadioButton1.setText("Standard"); + jRadioButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButton1ActionPerformed(evt); + } + }); + + jRadioButton2.setText("Premium"); + + jLabel26.setText("1 Year"); + + jButton4.setText("Make SmartCard"); + jButton4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton4ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(264, 264, 264) + .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup() + .addGap(41, 41, 41) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel24, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE) + .addComponent(jLabel23, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel25, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(76, 76, 76) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(jRadioButton1) + .addGap(48, 48, 48) + .addComponent(jRadioButton2)) + .addComponent(jLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap(378, Short.MAX_VALUE)) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(75, 75, 75) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton1) + .addComponent(jRadioButton2)) + .addGap(60, 60, 60) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(55, 55, 55) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(89, 89, 89) + .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(131, Short.MAX_VALUE)) + ); + + jTabbedPane1.addTab("Smartcard Details", jPanel2); + + javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane()); + jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout); + jInternalFrame1Layout.setHorizontalGroup( + jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jInternalFrame1Layout.createSequentialGroup() + .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jInternalFrame1Layout.createSequentialGroup() + .addGap(197, 197, 197) + .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(52, 52, 52) + .addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jInternalFrame1Layout.createSequentialGroup() + .addGap(61, 61, 61) + .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jInternalFrame1Layout.setVerticalGroup( + jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jInternalFrame1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(31, 31, 31)) + ); + + jInternalFrame2.setClosable(true); + jInternalFrame2.setIconifiable(true); + jInternalFrame2.setMaximizable(true); + jInternalFrame2.setResizable(true); + jInternalFrame2.setTitle("Create Smartcard"); + + jLabel28.setText("Smartcard Number"); + + jTabbedPane2.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), javax.swing.BorderFactory.createEtchedBorder())); + + jLabel29.setText("Gender"); + + jLabel30.setText("Phone Number"); + + jTextArea5.setColumns(20); + jTextArea5.setRows(5); + jScrollPane5.setViewportView(jTextArea5); + + jLabel31.setText("Address"); + + jTextField12.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField12ActionPerformed(evt); + } + }); + + jLabel32.setText("Name"); + + jRadioButton5.setText("Male"); + jRadioButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButton5ActionPerformed(evt); + } + }); + + jLabel33.setText("Age"); + + jRadioButton6.setText("Female"); + + jLabel34.setText("ID Proof details."); + + jTextArea6.setColumns(20); + jTextArea6.setRows(5); + jScrollPane6.setViewportView(jTextArea6); + + jLabel35.setToolTipText("Image to be uploaded"); + jLabel35.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 102, 102), 1, true)); + + jButton5.setText("UPLOAD"); + jButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton5ActionPerformed(evt); + } + }); + + jButton6.setText("Next"); + jButton6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton6ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGap(105, 105, 105) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(26, 26, 26) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField11, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField12, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jLabel29, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jRadioButton5) + .addGap(18, 18, 18) + .addComponent(jRadioButton6))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel35, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(54, 54, 54)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel34)) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(424, 424, 424)) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton6)))) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jLabel30, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(78, 78, 78)))) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGap(32, 32, 32) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(67, 67, 67) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(40, 40, 40) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel29, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel35, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel30, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(36, 36, 36)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(30, 30, 30))) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel34)) + .addContainerGap()) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addComponent(jButton6) + .addGap(58, 58, 58)))) + ); + + jTabbedPane2.addTab("Personal Details", jPanel3); + + jLabel36.setText("Card Type"); + + jLabel37.setText("Intial balance"); + + jLabel38.setText("Valid for"); + + jRadioButton7.setText("Standard"); + jRadioButton7.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButton7ActionPerformed(evt); + } + }); + + jRadioButton8.setText("Premium"); + + jLabel39.setText("1 Year"); + + jButton7.setText("Make SmartCard"); + jButton7.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton7ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGap(264, 264, 264) + .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout.createSequentialGroup() + .addGap(41, 41, 41) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel37, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE) + .addComponent(jLabel36, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel38, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(76, 76, 76) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addComponent(jRadioButton7) + .addGap(48, 48, 48) + .addComponent(jRadioButton8)) + .addComponent(jLabel39, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap(378, Short.MAX_VALUE)) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGap(75, 75, 75) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel36, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton7) + .addComponent(jRadioButton8)) + .addGap(60, 60, 60) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel37, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(55, 55, 55) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel38, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel39, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(89, 89, 89) + .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(131, Short.MAX_VALUE)) + ); + + jTabbedPane2.addTab("Smartcard Details", jPanel4); + + javax.swing.GroupLayout jInternalFrame2Layout = new javax.swing.GroupLayout(jInternalFrame2.getContentPane()); + jInternalFrame2.getContentPane().setLayout(jInternalFrame2Layout); + jInternalFrame2Layout.setHorizontalGroup( + jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jInternalFrame2Layout.createSequentialGroup() + .addGroup(jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jInternalFrame2Layout.createSequentialGroup() + .addGap(197, 197, 197) + .addComponent(jLabel28, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(52, 52, 52) + .addComponent(jLabel40, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jInternalFrame2Layout.createSequentialGroup() + .addGap(61, 61, 61) + .addComponent(jTabbedPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jInternalFrame2Layout.setVerticalGroup( + jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jInternalFrame2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel28, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel40, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jTabbedPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(31, 31, 31)) + ); + + jLabel41.setText("Card type"); + + jLabel43.setText("Created on date"); + + jTextField13.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField13ActionPerformed(evt); + } + }); + + jLabel44.setText("Expiery Date"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(47, 47, 47) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel14, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(jLabel7) + .addGroup(layout.createSequentialGroup() + .addGap(27, 27, 27) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(27, 27, 27) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(75, 75, 75) + .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jButton2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addGap(26, 26, 26) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jTextField5, javax.swing.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE) + .addComponent(jTextField4)) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel41, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jLabel42, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel43, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel44, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(27, 27, 27) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)))))))))) + .addContainerGap(24, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(177, 177, 177)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 385, Short.MAX_VALUE) + .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 384, Short.MAX_VALUE))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(jInternalFrame2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel7) + .addGap(45, 45, 45) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(37, 37, 37) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(43, 43, 43) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(45, 45, 45) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(44, 44, 44)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel42, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel41, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(31, 31, 31) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel43, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(43, 43, 43) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel44, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(2, 2, 2))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(31, 31, 31) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(257, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(52, 52, 52) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(35, 35, 35) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(54, 54, 54) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(70, 70, 70)))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(jInternalFrame2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + jButton2.setVisible(false); + JFrame yourComponent = new JFrame(); +PrinterJob pjob = PrinterJob.getPrinterJob(); +PageFormat preformat = pjob.defaultPage(); +preformat.setOrientation(PageFormat.LANDSCAPE); +PageFormat postformat = pjob.pageDialog(preformat); +//If user does not hit cancel then print. +if (preformat != postformat) { + //Set print component + pjob.setPrintable(this, postformat); + if (pjob.printDialog()) { + try { + pjob.print(); + } catch (PrinterException ex) { + //Logger.getLogger(newmember.class.getName()).log(Level.SEVERE, null, ex); + } + } +}// TODO add your handling code here: +jButton2.setVisible(true); + }//GEN-LAST:event_jButton2ActionPerformed + + private void jTextField6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField6ActionPerformed + + }//GEN-LAST:event_jTextField6ActionPerformed + + private void jTextField9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField9ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField9ActionPerformed + + private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton3ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jRadioButton3ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jButton1ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + + }//GEN-LAST:event_jButton3ActionPerformed + + private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jRadioButton1ActionPerformed + + private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed + + }//GEN-LAST:event_jButton4ActionPerformed + + private void jTextField12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField12ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField12ActionPerformed + + private void jRadioButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton5ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jRadioButton5ActionPerformed + + private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jButton5ActionPerformed + + private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed + + }//GEN-LAST:event_jButton6ActionPerformed + + private void jRadioButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton7ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jRadioButton7ActionPerformed + + private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed + + + }//GEN-LAST:event_jButton7ActionPerformed + + private void jTextField13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField13ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField13ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton4; + private javax.swing.JButton jButton5; + private javax.swing.JButton jButton6; + private javax.swing.JButton jButton7; + private javax.swing.JInternalFrame jInternalFrame1; + private javax.swing.JInternalFrame jInternalFrame2; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel14; + private javax.swing.JLabel jLabel15; + private javax.swing.JLabel jLabel16; + private javax.swing.JLabel jLabel17; + private javax.swing.JLabel jLabel18; + private javax.swing.JLabel jLabel19; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel20; + private javax.swing.JLabel jLabel21; + private javax.swing.JLabel jLabel22; + private javax.swing.JLabel jLabel23; + private javax.swing.JLabel jLabel24; + private javax.swing.JLabel jLabel25; + private javax.swing.JLabel jLabel26; + private javax.swing.JLabel jLabel27; + private javax.swing.JLabel jLabel28; + private javax.swing.JLabel jLabel29; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel30; + private javax.swing.JLabel jLabel31; + private javax.swing.JLabel jLabel32; + private javax.swing.JLabel jLabel33; + private javax.swing.JLabel jLabel34; + private javax.swing.JLabel jLabel35; + private javax.swing.JLabel jLabel36; + private javax.swing.JLabel jLabel37; + private javax.swing.JLabel jLabel38; + private javax.swing.JLabel jLabel39; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel40; + private javax.swing.JLabel jLabel41; + private javax.swing.JLabel jLabel42; + private javax.swing.JLabel jLabel43; + private javax.swing.JLabel jLabel44; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JRadioButton jRadioButton1; + private javax.swing.JRadioButton jRadioButton2; + private javax.swing.JRadioButton jRadioButton3; + private javax.swing.JRadioButton jRadioButton4; + private javax.swing.JRadioButton jRadioButton5; + private javax.swing.JRadioButton jRadioButton6; + private javax.swing.JRadioButton jRadioButton7; + private javax.swing.JRadioButton jRadioButton8; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JScrollPane jScrollPane3; + private javax.swing.JScrollPane jScrollPane4; + private javax.swing.JScrollPane jScrollPane5; + private javax.swing.JScrollPane jScrollPane6; + private javax.swing.JTabbedPane jTabbedPane1; + private javax.swing.JTabbedPane jTabbedPane2; + private javax.swing.JTextArea jTextArea2; + private javax.swing.JTextArea jTextArea3; + private javax.swing.JTextArea jTextArea4; + private javax.swing.JTextArea jTextArea5; + private javax.swing.JTextArea jTextArea6; + private javax.swing.JTextField jTextField1; + private javax.swing.JTextField jTextField10; + private javax.swing.JTextField jTextField11; + private javax.swing.JTextField jTextField12; + private javax.swing.JTextField jTextField13; + private javax.swing.JTextField jTextField14; + private javax.swing.JTextField jTextField2; + private javax.swing.JTextField jTextField3; + private javax.swing.JTextField jTextField4; + private javax.swing.JTextField jTextField5; + private javax.swing.JTextField jTextField6; + private javax.swing.JTextField jTextField7; + private javax.swing.JTextField jTextField8; + private javax.swing.JTextField jTextField9; + // End of variables declaration//GEN-END:variables + + @Override + public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { + if (pageIndex > 0) { /* We have only one page, and 'page' is zero-based */ + return NO_SUCH_PAGE; + } + + // get the bounds of the component + Dimension dim = this.getSize(); + double cHeight = dim.getHeight(); + double cWidth = dim.getWidth(); + + // get the bounds of the printable area + double pHeight = pageFormat.getImageableHeight(); + double pWidth = pageFormat.getImageableWidth(); + + double pXStart = pageFormat.getImageableX(); + double pYStart = pageFormat.getImageableY(); + + double xRatio = pWidth / cWidth; + double yRatio = pHeight / cHeight; + + + Graphics2D g2 = (Graphics2D) graphics; + g2.translate(pXStart, pYStart); + g2.scale(xRatio, yRatio); + this.paint(g2); + + return Printable.PAGE_EXISTS; +} +} diff --git a/projects/Metro_systems-master/metro_system/empaddroute.form b/projects/Metro_systems-master/metro_system/empaddroute.form new file mode 100644 index 0000000..1ea8f2b --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empaddroute.form @@ -0,0 +1,119 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/empaddroute.java b/projects/Metro_systems-master/metro_system/empaddroute.java new file mode 100644 index 0000000..766c963 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empaddroute.java @@ -0,0 +1,168 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.text.SimpleDateFormat; +import javax.swing.JOptionPane; +import static metro_system.empmainframe.jDesktopPane1; + + +/** + * + * @author sparsh + */ +public class empaddroute extends javax.swing.JInternalFrame implements convar { + + /** + * Creates new form addroute + */ + public empaddroute() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + jTextField1 = new javax.swing.JTextField(); + jButton1 = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + jButton2 = new javax.swing.JButton(); + + setClosable(true); + setIconifiable(true); + setTitle("Add Route"); + + jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 5)); + jPanel1.setName("Add Route"); // NOI18N + + jButton1.setText("ADD"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel1.setText("Add Route"); + + jButton2.setText("Proceed"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addGap(36, 36, 36) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(47, 47, 47)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(155, 155, 155) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(50, 50, 50) + .addComponent(jButton2) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(77, 77, 77) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 33, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 94, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING)) + .addGap(68, 68, 68)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(63, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(70, 70, 70)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(39, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="insert into routetable values(?)"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jTextField1.getText()); + + if(mystatement.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "Information Sored Successfully"); + } + jTextField1.setText(""); + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed +addstation obj=new addstation(); + jDesktopPane1.add(obj); + obj.setVisible(true); + this.dispose();// TODO add your handling code here: + }//GEN-LAST:event_jButton2ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JLabel jLabel1; + private javax.swing.JPanel jPanel1; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/empaddstation.form b/projects/Metro_systems-master/metro_system/empaddstation.form new file mode 100644 index 0000000..10d678a --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empaddstation.form @@ -0,0 +1,121 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/empaddstation.java b/projects/Metro_systems-master/metro_system/empaddstation.java new file mode 100644 index 0000000..45a5cfd --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empaddstation.java @@ -0,0 +1,219 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.swing.JOptionPane; +import static metro_system.empmainframe.jDesktopPane1; + +/** + * + * @author sparsh + */ +public class empaddstation extends javax.swing.JInternalFrame implements convar{ + + /** + * Creates new form addstation + */ + public empaddstation() { + initComponents(); + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from routetable"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { + do + { + jComboBox1.addItem(myres.getString("route")); + } + while(myres.next()); + + + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jComboBox1 = new javax.swing.JComboBox<>(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + + setClosable(true); + setIconifiable(true); + setResizable(true); + setTitle("Add Station."); + + jLabel1.setText("Route"); + + jLabel2.setText("Station Name"); + + jTextField1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField1ActionPerformed(evt); + } + }); + + jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose route" })); + jComboBox1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox1ActionPerformed(evt); + } + }); + + jButton1.setText("Save"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jButton2.setText("Proceed"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(98, 98, 98) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE)) + .addGap(45, 45, 45) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jTextField1) + .addComponent(jComboBox1, 0, 219, Short.MAX_VALUE)) + .addContainerGap(169, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addGap(188, 188, 188) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(78, 78, 78)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(72, 72, 72) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox1, javax.swing.GroupLayout.DEFAULT_SIZE, 33, Short.MAX_VALUE)) + .addGap(46, 46, 46) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 110, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(103, 103, 103)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="insert into stationtable values(?,?)"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox1.getSelectedItem().toString()); + mystatement.setString(2, jTextField1.getText()); + + if(mystatement.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "Information Sored Successfully"); + jTextField1.setText(""); + jComboBox1.setSelectedIndex(0); + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + }//GEN-LAST:event_jButton1ActionPerformed + + private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField1ActionPerformed + + private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jComboBox1ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed +addfare obj=new addfare(); + jDesktopPane1.add(obj); + obj.setVisible(true); + this.dispose();// TODO add your handling code here: + }//GEN-LAST:event_jButton2ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JComboBox jComboBox1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/empcardbook.form b/projects/Metro_systems-master/metro_system/empcardbook.form new file mode 100644 index 0000000..6711279 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empcardbook.form @@ -0,0 +1,288 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/empcardbook.java b/projects/Metro_systems-master/metro_system/empcardbook.java new file mode 100644 index 0000000..fe7616d --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empcardbook.java @@ -0,0 +1,456 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.SimpleDateFormat; + +import javax.swing.JOptionPane; + + +/** + * + * @author sparsh + */ +public class empcardbook extends javax.swing.JInternalFrame implements convar { + + static double fare,bal,rem_bal; + + public void generatebookNo() + { + Connection myconnection2; + + try + + + { + myconnection2=DriverManager.getConnection(path+place, username, password); + try + { + String query2="select max(book_no) from bookingcard"; + PreparedStatement mystatement2=myconnection2.prepareStatement(query2); + ResultSet myresult2=mystatement2.executeQuery(); + if(myresult2.next()) + { + jLabel24.setText(String.valueOf(myresult2.getInt(1)+1)); + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Incriment Error:"+e.getMessage()); + } + finally + { + myconnection2.close(); + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + /** + * Creates new form token + */ + public empcardbook() { + initComponents(); + generatebookNo(); + + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel5 = new javax.swing.JLabel(); + jLabel1 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jLabel9 = new javax.swing.JLabel(); + jLabel10 = new javax.swing.JLabel(); + jLabel11 = new javax.swing.JLabel(); + jLabel12 = new javax.swing.JLabel(); + jLabel13 = new javax.swing.JLabel(); + jLabel19 = new javax.swing.JLabel(); + jLabel20 = new javax.swing.JLabel(); + jLabel21 = new javax.swing.JLabel(); + jLabel22 = new javax.swing.JLabel(); + jLabel23 = new javax.swing.JLabel(); + jLabel14 = new javax.swing.JLabel(); + jLabel15 = new javax.swing.JLabel(); + jLabel16 = new javax.swing.JLabel(); + jLabel17 = new javax.swing.JLabel(); + jLabel18 = new javax.swing.JLabel(); + jLabel24 = new javax.swing.JLabel(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + addInternalFrameListener(new javax.swing.event.InternalFrameListener() { + public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) { + formInternalFrameActivated(evt); + } + public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) { + } + public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) { + } + public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) { + } + public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) { + } + public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) { + } + public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) { + } + }); + + jLabel5.setText("Mins."); + + jLabel1.setText("From"); + + jLabel6.setText("Distance"); + + jLabel2.setText("To:"); + + jLabel7.setText("Kms."); + + jLabel8.setText("Stations in between"); + + jButton1.setText("BOOK"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel3.setText("Fare (Rs.)"); + + jLabel4.setText("Travelling Time"); + + jLabel22.setText("Booking date"); + + jLabel14.setText("Card Balance"); + + jLabel16.setText("Smartcard No."); + + jLabel17.setBackground(new java.awt.Color(255, 0, 102)); + + jLabel18.setText("Booking No."); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(25, 25, 25) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(15, 15, 15) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(37, 37, 37) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(43, 43, 43) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 335, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 335, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(193, 193, 193)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(35, 35, 35) + .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(40, 40, 40) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(72, 72, 72)))) + .addGroup(layout.createSequentialGroup() + .addGap(145, 145, 145) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(49, 49, 49) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel18, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 24, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(45, 45, 45) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(45, 45, 45) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addGap(30, 30, 30) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addGap(8, 8, 8) + .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(26, 26, 26) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(21, 21, 21) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(35, 35, 35) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel23, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(46, 46, 46)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + if(bal>fare) + { + rem_bal=bal-fare; + Connection myconnection; + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="insert into bookingcard values(?,?,?,?,?,?,?,?,?,?,?,?)"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jLabel9.getText()); + mystatement.setString(2, jLabel10.getText()); + mystatement.setString(3, jLabel11.getText()); + mystatement.setString(4, jLabel12.getText()); + mystatement.setString(5, jLabel13.getText()); + mystatement.setString(6, String.valueOf(bal)); + mystatement.setString(7, jLabel19.getText()); + + mystatement.setString(8, jLabel17.getText()); + mystatement.setString(9, jLabel20.getText()); + mystatement.setString(10, jLabel21.getText()); + mystatement.setString(11, jLabel23.getText()); + mystatement.setString(12, jLabel24.getText()); + + SimpleDateFormat myFormat; + myFormat = new SimpleDateFormat("yyyy-MM-dd "); + java.util.Date date = new java.util.Date(); + mystatement.setString(11, myFormat.format(date)); + + if( mystatement.executeUpdate()>0 ) + { + JOptionPane.showMessageDialog(rootPane, "Ticket booked successfully by card.Remaining balance : "+rem_bal + " and Booking no. is : " + jLabel24.getText()); + + } + query="update smartcard set balance =? where s_id= ?"; + PreparedStatement mystatement1=myconnection.prepareStatement(query); + mystatement1.setString(1, String.valueOf(rem_bal)); + mystatement1.setString(2, jLabel17.getText()); + if(mystatement1.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "account balance updated successfully"); + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + else + { + JOptionPane.showMessageDialog(rootPane, "Balance in card is less than the fare price .Please add some money in the card first."); + this.dispose(); + } + }//GEN-LAST:event_jButton1ActionPerformed + + private void formInternalFrameActivated(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameActivated + Connection myconnection; +// SimpleDateFormat myFormat; +// myFormat = new SimpleDateFormat("yyyy-MM-dd "); + java.util.Date date = new java.util.Date(); + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from faretable f,smartcard s where f.route1=? and f.stn1=? and f.route2=? and f.stn2=? and s.s_id=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, empcardbooksearch.s[0]); + mystatement.setString(2, empcardbooksearch.s[1]); + mystatement.setString(3, empcardbooksearch.s[2]); + mystatement.setString(4, empcardbooksearch.s[3]); + mystatement.setString(5, empcardbooksearch.n); + // System.out.print(cardbooksearch.s[0]); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + {if(date.before(myres.getDate(20))) + { fare=Double.parseDouble(myres.getString("fare")); + bal=Double.parseDouble(myres.getString("balance")); + + jLabel9.setText(empcardbooksearch.s[0]); + jLabel10.setText(empcardbooksearch.s[1]); + jLabel11.setText(empcardbooksearch.s[2]); + jLabel12.setText(empcardbooksearch.s[3]); + jLabel17.setText(empcardbooksearch.n); + if(myres.getString("cardtype").equalsIgnoreCase("standard")) + { fare=(double)fare*.90; + jLabel13.setText(String.valueOf(fare)); + } + else + { + fare=(double)fare*.85; + jLabel13.setText(String.valueOf(fare)); + + } + jLabel15.setText(myres.getString("balance")); + jLabel19.setText(myres.getString(6)); + jLabel20.setText(myres.getString(7)); + jLabel21.setText(myres.getString(8)); + + SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); +// get current date time with Date() + // java.util.Date date = new java.util.Date(); + jLabel23.setText(dateFormat.format(date)); + + + } + else{ + JOptionPane.showMessageDialog(rootPane, "The card has expired.Please renew."); + } + + } + else{ + JOptionPane.showMessageDialog(rootPane, "i dont know whats wrong"); + }} + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, " double query Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + }//GEN-LAST:event_formInternalFrameActivated + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel14; + private javax.swing.JLabel jLabel15; + private javax.swing.JLabel jLabel16; + private javax.swing.JLabel jLabel17; + private javax.swing.JLabel jLabel18; + private javax.swing.JLabel jLabel19; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel20; + private javax.swing.JLabel jLabel21; + private javax.swing.JLabel jLabel22; + private javax.swing.JLabel jLabel23; + private javax.swing.JLabel jLabel24; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/empcardbooksearch.form b/projects/Metro_systems-master/metro_system/empcardbooksearch.form new file mode 100644 index 0000000..405f040 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empcardbooksearch.form @@ -0,0 +1,172 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/empcardbooksearch.java b/projects/Metro_systems-master/metro_system/empcardbooksearch.java new file mode 100644 index 0000000..2df1b42 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empcardbooksearch.java @@ -0,0 +1,349 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class empcardbooksearch extends javax.swing.JInternalFrame implements convar{ + + static String s[]=new String[4]; + static String n; + /** + * Creates new form tokensearch + */ + public empcardbooksearch() { + initComponents(); + + // jSpinner1.setValue(a); + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from routetable"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { + do + { + jComboBox3.addItem(myres.getString("route")); + jComboBox2.addItem(myres.getString("route")); + } + while(myres.next()); + + + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel2 = new javax.swing.JLabel(); + jComboBox3 = new javax.swing.JComboBox<>(); + jComboBox4 = new javax.swing.JComboBox<>(); + jComboBox5 = new javax.swing.JComboBox<>(); + jLabel1 = new javax.swing.JLabel(); + jComboBox2 = new javax.swing.JComboBox<>(); + jButton1 = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + + setClosable(true); + setIconifiable(true); + + jLabel2.setText("To:"); + + jComboBox3.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose Route" })); + jComboBox3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox3ActionPerformed(evt); + } + }); + + jComboBox4.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "choose route first" })); + + jComboBox5.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "choose route first" })); + + jLabel1.setText("From"); + + jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose route" })); + jComboBox2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox2ActionPerformed(evt); + } + }); + + jButton1.setText("Proceed"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel3.setText("Smartcard No."); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 59, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jComboBox3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 35, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jComboBox4, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(92, 92, 92) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(56, 56, 56) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 223, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(199, 199, 199) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(27, 27, 27) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE) + .addComponent(jTextField1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 57, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(45, 45, 45) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(61, 61, 61) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(169, 169, 169)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jComboBox3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox3ActionPerformed + Connection myconnection; + + if(jComboBox3.getSelectedIndex()>0){ + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from stationtable where route=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox3.getSelectedItem().toString()); + + ResultSet myres = mystatement.executeQuery(); + jComboBox5.removeAllItems(); + jComboBox5.addItem("choose station"); + if(myres.next()) + { + do + { + jComboBox5.addItem(myres.getString("stn_name")); + + } + while(myres.next()); + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + else{ + jComboBox5.addItem("choose route first"); + } // TODO add your handling code here: + }//GEN-LAST:event_jComboBox3ActionPerformed + + private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed + Connection myconnection; + + if(jComboBox2.getSelectedIndex()>0){ + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from stationtable where route=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox2.getSelectedItem().toString()); + ResultSet myres = mystatement.executeQuery(); + jComboBox4.removeAllItems(); + jComboBox4.addItem("choose station"); + if(myres.next()) + { + do + { + jComboBox4.addItem(myres.getString("stn_name")); + + } + while(myres.next()); + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + else{ + jComboBox4.addItem("choose route first"); + } + }//GEN-LAST:event_jComboBox2ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + s[0] = jComboBox2.getSelectedItem().toString(); + s[1] = jComboBox4.getSelectedItem().toString(); + s[2] = jComboBox3.getSelectedItem().toString(); + s[3] = jComboBox5.getSelectedItem().toString(); + n = jTextField1.getText(); + boolean flag=false; + if(jComboBox2.getSelectedIndex()>0 && jComboBox3.getSelectedIndex()>0 && jComboBox4.getSelectedIndex()>0 && jComboBox5.getSelectedIndex()>0 && !jTextField1.getText().equals("") ) + + {Connection myconnection; + + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from smartcard where s_id=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jTextField1.getText()); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { + flag=true; + + } + else + { + JOptionPane.showMessageDialog(rootPane, "Wrong Smart card ID ."); + flag=false; + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + try{ if (flag) + { +// +// + empcardbook obj=new empcardbook(); + empmainframe.jDesktopPane1.add(obj); + obj.setVisible(true); + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "this statement is not working"+e.getMessage()); + } + + } + else + { + JOptionPane.showMessageDialog(rootPane, "Please select appropriate choce/fill in the fields"); + } + + }//GEN-LAST:event_jButton1ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JComboBox jComboBox2; + private javax.swing.JComboBox jComboBox3; + private javax.swing.JComboBox jComboBox4; + private javax.swing.JComboBox jComboBox5; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/empchangepassword.form b/projects/Metro_systems-master/metro_system/empchangepassword.form new file mode 100644 index 0000000..2406805 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empchangepassword.form @@ -0,0 +1,149 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/empchangepassword.java b/projects/Metro_systems-master/metro_system/empchangepassword.java new file mode 100644 index 0000000..d290d86 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empchangepassword.java @@ -0,0 +1,218 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class empchangepassword extends javax.swing.JInternalFrame implements convar{ + + /** + * Creates new form createemployee + */ + public empchangepassword() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jInternalFrame1 = new javax.swing.JInternalFrame(); + jLabel2 = new javax.swing.JLabel(); + jPasswordField1 = new javax.swing.JPasswordField(); + jButton5 = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + jPasswordField2 = new javax.swing.JPasswordField(); + jLabel4 = new javax.swing.JLabel(); + jPasswordField3 = new javax.swing.JPasswordField(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + setTitle("Change Password"); + + jInternalFrame1.setClosable(true); + jInternalFrame1.setIconifiable(true); + jInternalFrame1.setMaximizable(true); + jInternalFrame1.setResizable(true); + jInternalFrame1.setTitle("Create Employee Account"); + + javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane()); + jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout); + jInternalFrame1Layout.setHorizontalGroup( + jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 0, Short.MAX_VALUE) + ); + jInternalFrame1Layout.setVerticalGroup( + jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 0, Short.MAX_VALUE) + ); + + jLabel2.setText("Previous Password"); + + jButton5.setText("Change Password"); + jButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton5ActionPerformed(evt); + } + }); + + jLabel3.setText("New Password"); + + jLabel4.setText("Confirm Password"); + + jPasswordField3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jPasswordField3ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(223, 223, 223) + .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(130, 130, 130) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(61, 61, 61) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField3, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap(165, Short.MAX_VALUE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 348, Short.MAX_VALUE) + .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 348, Short.MAX_VALUE))) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(123, 123, 123) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField3, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 76, Short.MAX_VALUE) + .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(59, 59, 59)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 229, Short.MAX_VALUE) + .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 229, Short.MAX_VALUE))) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed + if(jPasswordField2.getText() .equals(jPasswordField3.getText())) + { + Connection myconnection; + try + { + myconnection=DriverManager.getConnection(path+place, username, password); + try + { + int a= JOptionPane.showConfirmDialog(rootPane, "Do you really want to Change Password? Username:"+login.s, "Confirm", JOptionPane.YES_NO_OPTION); + if(a==JOptionPane.YES_OPTION) + { + + String query2="select * from employeetable where username=? and password=?"; + PreparedStatement mystatement2=myconnection.prepareStatement(query2); + mystatement2.setString(1, login.s); + mystatement2.setString(2, jPasswordField1.getText()); + ResultSet myresult2=mystatement2.executeQuery(); + + + if(myresult2.next()) + { + String query4="update employeetable set password=? where username=?"; + PreparedStatement mystatement4=myconnection.prepareStatement(query4); + mystatement4.setString(1, jPasswordField2.getText()); + mystatement4.setString(2, login.s); + if(mystatement4.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "Password changed Successfully."); + login lg=new login(); + lg.setVisible(true); + this.dispose(); + } + } + else + { + JOptionPane.showMessageDialog(rootPane, "Incorrect Username/Password"); + } + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(null, "Changing Password Error."+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(null, "Connection Error."+e.getMessage()); + } + } + else + { + JOptionPane.showMessageDialog(rootPane, "Password doesn't match"); + } + }//GEN-LAST:event_jButton5ActionPerformed + + private void jPasswordField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPasswordField3ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jPasswordField3ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton5; + private javax.swing.JInternalFrame jInternalFrame1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JPasswordField jPasswordField1; + private javax.swing.JPasswordField jPasswordField2; + private javax.swing.JPasswordField jPasswordField3; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/empfetchmetro.form b/projects/Metro_systems-master/metro_system/empfetchmetro.form new file mode 100644 index 0000000..52bb0ce --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empfetchmetro.form @@ -0,0 +1,78 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/empfetchmetro.java b/projects/Metro_systems-master/metro_system/empfetchmetro.java new file mode 100644 index 0000000..987fa6d --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empfetchmetro.java @@ -0,0 +1,136 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.swing.JOptionPane; + + +/** + * + * @author sparsh + */ +public class empfetchmetro extends javax.swing.JInternalFrame implements convar { + static String s=""; + /** + * Creates new form fetchmetro + */ + public empfetchmetro() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jButton1 = new javax.swing.JButton(); + jTextField1 = new javax.swing.JTextField(); + jLabel1 = new javax.swing.JLabel(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + setTitle("Find Metro"); + + jButton1.setText("Fetch"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel1.setText("metro number"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(113, 113, 113) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(150, 150, 150) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(432, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(60, 60, 60) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE) + .addComponent(jTextField1)) + .addGap(45, 45, 45) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(278, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + s=jTextField1.getText(); + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select* from metrotable where metro_no=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, empfetchmetro.s); + + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { + empfetchmetroresult obj=new empfetchmetroresult(); + + empmainframe.jDesktopPane1.add(obj); + obj.setVisible(true); + + } + else + JOptionPane.showMessageDialog(rootPane, "Wrong metro number entered . Enter again"); + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + }//GEN-LAST:event_jButton1ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/empfetchmetroresult.form b/projects/Metro_systems-master/metro_system/empfetchmetroresult.form new file mode 100644 index 0000000..167be3e --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empfetchmetroresult.form @@ -0,0 +1,164 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/empfetchmetroresult.java b/projects/Metro_systems-master/metro_system/empfetchmetroresult.java new file mode 100644 index 0000000..8cd9008 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empfetchmetroresult.java @@ -0,0 +1,217 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class empfetchmetroresult extends javax.swing.JInternalFrame implements convar{ + + /** + * Creates new form newmetro + */ + public empfetchmetroresult() { + initComponents(); + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query1="select * from routetable"; + PreparedStatement mystatement1=myconnection.prepareStatement(query1); + ResultSet myres1 = mystatement1.executeQuery(); + if(myres1.next()) + { + do + { + jComboBox1.addItem(myres1.getString("route")); + } + while(myres1.next()); + } + String query="select* from metrotable where metro_no=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, empfetchmetro.s); + + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { + jTextField1.setText(myres.getString(1)); + jTextField2.setText(myres.getString(2)); + jTextField3.setText(myres.getString(3)); + jComboBox1.setSelectedItem(myres.getString(4)); + jTextField4.setText(myres.getString(5)); + jDateChooser2.setDate(myres.getDate(6)); + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + } + + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jTextField1 = new javax.swing.JTextField(); + jTextField2 = new javax.swing.JTextField(); + jTextField3 = new javax.swing.JTextField(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jComboBox1 = new javax.swing.JComboBox<>(); + jLabel5 = new javax.swing.JLabel(); + jTextField4 = new javax.swing.JTextField(); + jLabel6 = new javax.swing.JLabel(); + jDateChooser2 = new com.toedter.calendar.JDateChooser(); + jLabel4 = new javax.swing.JLabel(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + setTitle("Metro Found"); + + jTextField1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField1ActionPerformed(evt); + } + }); + + jLabel1.setText("metro number"); + + jLabel2.setText("number of carriages"); + + jLabel3.setText("carrying capacity"); + + jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose route" })); + jComboBox1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox1ActionPerformed(evt); + } + }); + + jLabel5.setText("Frequency"); + + jLabel6.setText("Started on Date"); + + jLabel4.setText("Route "); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(126, 126, 126) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel3) + .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(23, 23, 23) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(51, 51, 51))) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap(160, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(68, 68, 68) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(32, 32, 32) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(28, 28, 28) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(30, 30, 30) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(31, 31, 31) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(128, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField1ActionPerformed + + private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jComboBox1ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JComboBox jComboBox1; + private com.toedter.calendar.JDateChooser jDateChooser2; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JTextField jTextField1; + private javax.swing.JTextField jTextField2; + private javax.swing.JTextField jTextField3; + private javax.swing.JTextField jTextField4; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/employee.jpeg b/projects/Metro_systems-master/metro_system/employee.jpeg new file mode 100644 index 0000000..aa8225a Binary files /dev/null and b/projects/Metro_systems-master/metro_system/employee.jpeg differ diff --git a/projects/Metro_systems-master/metro_system/empmainframe.form b/projects/Metro_systems-master/metro_system/empmainframe.form new file mode 100644 index 0000000..c4fc362 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empmainframe.form @@ -0,0 +1,280 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/empmainframe.java b/projects/Metro_systems-master/metro_system/empmainframe.java new file mode 100644 index 0000000..19d5378 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empmainframe.java @@ -0,0 +1,371 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.*; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class empmainframe extends javax.swing.JFrame { + + /** + * Creates new form mainframe + */ + public empmainframe() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jDesktopPane2 = new javax.swing.JDesktopPane(); + jDesktopPane1 = new javax.swing.JDesktopPane(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jLabel2 = new javax.swing.JLabel(); + jMenuBar1 = new javax.swing.JMenuBar(); + jMenu1 = new javax.swing.JMenu(); + jMenuItem1 = new javax.swing.JMenuItem(); + jMenuItem2 = new javax.swing.JMenuItem(); + jMenu2 = new javax.swing.JMenu(); + jMenuItem6 = new javax.swing.JMenuItem(); + jMenuItem18 = new javax.swing.JMenuItem(); + jMenu3 = new javax.swing.JMenu(); + jMenuItem10 = new javax.swing.JMenuItem(); + jMenuItem13 = new javax.swing.JMenuItem(); + jMenuItem14 = new javax.swing.JMenuItem(); + jMenuItem9 = new javax.swing.JMenuItem(); + jMenu4 = new javax.swing.JMenu(); + jMenuItem19 = new javax.swing.JMenuItem(); + jMenu6 = new javax.swing.JMenu(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("Metro System Management : Sparsh Bansal"); + setName("mainframe"); // NOI18N + getContentPane().setLayout(null); + getContentPane().add(jDesktopPane2); + jDesktopPane2.setBounds(1973, 0, 0, 0); + + jButton1.setBackground(new java.awt.Color(204, 204, 204)); + jButton1.setText("Token Booking"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + jDesktopPane1.add(jButton1); + jButton1.setBounds(150, 530, 130, 50); + + jButton2.setText("Smartcard Booking"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + jDesktopPane1.add(jButton2); + jButton2.setBounds(870, 530, 140, 40); + + jButton3.setText("Search Booking"); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + jDesktopPane1.add(jButton3); + jButton3.setBounds(1630, 500, 130, 30); + + jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/METRO Wallpapers.jpg"))); // NOI18N + jDesktopPane1.add(jLabel2); + jLabel2.setBounds(10, -10, 1920, 1000); + + getContentPane().add(jDesktopPane1); + jDesktopPane1.setBounds(-10, 0, 1920, 990); + + jMenu1.setText("Metros"); + jMenu1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenu1ActionPerformed(evt); + } + }); + + jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/newmetro.jpeg"))); // NOI18N + jMenuItem1.setText("New Metro"); + jMenuItem1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem1ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem1); + + jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/train-search.png"))); // NOI18N + jMenuItem2.setText("Find Metro"); + jMenuItem2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem2ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem2); + + jMenuBar1.add(jMenu1); + + jMenu2.setText("Token"); + + jMenuItem6.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/tokenbook.jpeg"))); // NOI18N + jMenuItem6.setText("Booking"); + jMenuItem6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem6ActionPerformed(evt); + } + }); + jMenu2.add(jMenuItem6); + + jMenuItem18.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.ALT_MASK)); + jMenuItem18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/tokenbookedsearch.png"))); // NOI18N + jMenuItem18.setText("Search tokens"); + jMenuItem18.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem18ActionPerformed(evt); + } + }); + jMenu2.add(jMenuItem18); + + jMenuBar1.add(jMenu2); + + jMenu3.setText("Smartcard"); + + jMenuItem10.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/cardbook.png"))); // NOI18N + jMenuItem10.setText("Booking"); + jMenuItem10.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem10ActionPerformed(evt); + } + }); + jMenu3.add(jMenuItem10); + + jMenuItem13.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/searchsartcard.jpeg"))); // NOI18N + jMenuItem13.setText("Search"); + jMenuItem13.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem13ActionPerformed(evt); + } + }); + jMenu3.add(jMenuItem13); + + jMenuItem14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/addbalance.jpeg"))); // NOI18N + jMenuItem14.setText("Add Balance"); + jMenuItem14.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem14ActionPerformed(evt); + } + }); + jMenu3.add(jMenuItem14); + + jMenuItem9.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/smartcardfinal.jpeg"))); // NOI18N + jMenuItem9.setText("New Smartcard"); + jMenuItem9.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem9ActionPerformed(evt); + } + }); + jMenu3.add(jMenuItem9); + + jMenuBar1.add(jMenu3); + + jMenu4.setText("Employee"); + + jMenuItem19.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/changepassword.jpg"))); // NOI18N + jMenuItem19.setText("Change Password"); + jMenuItem19.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem19ActionPerformed(evt); + } + }); + jMenu4.add(jMenuItem19); + + jMenuBar1.add(jMenu4); + + jMenu6.setText("Log Out"); + jMenu6.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jMenu6MouseClicked(evt); + } + }); + jMenu6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenu6ActionPerformed(evt); + } + }); + jMenuBar1.add(jMenu6); + + setJMenuBar(jMenuBar1); + + setSize(new java.awt.Dimension(1930, 1061)); + setLocationRelativeTo(null); + }// //GEN-END:initComponents + + private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed + newmetro obj=new newmetro(); + jDesktopPane1.add(obj); + obj.setVisible(true); + + }//GEN-LAST:event_jMenuItem1ActionPerformed + + private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu1ActionPerformed + + + }//GEN-LAST:event_jMenu1ActionPerformed + + private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed + empfetchmetro obj=new empfetchmetro(); + jDesktopPane1.add(obj); + obj.setVisible(true); + }//GEN-LAST:event_jMenuItem2ActionPerformed + + private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed + emptokensearch obj=new emptokensearch(); + jDesktopPane1.add(obj); + obj.setVisible(true); + + }//GEN-LAST:event_jMenuItem6ActionPerformed + + private void jMenu6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu6ActionPerformed + + }//GEN-LAST:event_jMenu6ActionPerformed + + private void jMenu6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu6MouseClicked + if(JOptionPane.showConfirmDialog(rootPane, "Do you really want to log out ?", "Log out confirmation .", JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION) + { this.dispose(); + login obj=new login(); + obj.setVisible(true); + } + }//GEN-LAST:event_jMenu6MouseClicked + + private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed +empnewsmartcard obj=new empnewsmartcard(); + jDesktopPane1.add(obj); + obj.setVisible(true); }//GEN-LAST:event_jMenuItem9ActionPerformed + + private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem10ActionPerformed +empcardbooksearch obj=new empcardbooksearch(); + jDesktopPane1.add(obj); + obj.setVisible(true); }//GEN-LAST:event_jMenuItem10ActionPerformed + + private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem13ActionPerformed + cardsearch obj=new cardsearch(); + jDesktopPane1.add(obj); + obj.setVisible(true); + }//GEN-LAST:event_jMenuItem13ActionPerformed + + private void jMenuItem14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem14ActionPerformed + addbalance obj=new addbalance(); + jDesktopPane1.add(obj); + obj.setVisible(true); }//GEN-LAST:event_jMenuItem14ActionPerformed + + private void jMenuItem18ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem18ActionPerformed + tokenbookedsearch obj=new tokenbookedsearch(); + jDesktopPane1.add(obj); + obj.setVisible(true); + }//GEN-LAST:event_jMenuItem18ActionPerformed + + private void jMenuItem19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem19ActionPerformed + empchangepassword obj=new empchangepassword(); + jDesktopPane1.add(obj); + obj.setVisible(true); + }//GEN-LAST:event_jMenuItem19ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed +tokensearch obj=new tokensearch(); + jDesktopPane1.add(obj); + obj.setVisible(true); // TODO add your handling code here: + }//GEN-LAST:event_jButton1ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + cardsearch obj=new cardsearch(); + jDesktopPane1.add(obj); + obj.setVisible(true); // TODO add your handling code here: + }//GEN-LAST:event_jButton3ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed +cardbooksearch obj=new cardbooksearch(); + jDesktopPane1.add(obj); + obj.setVisible(true); // TODO add your handling code here: + }//GEN-LAST:event_jButton2ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(empmainframe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(empmainframe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(empmainframe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(empmainframe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new empmainframe().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + public static javax.swing.JDesktopPane jDesktopPane1; + public static javax.swing.JDesktopPane jDesktopPane2; + private javax.swing.JLabel jLabel2; + private javax.swing.JMenu jMenu1; + private javax.swing.JMenu jMenu2; + private javax.swing.JMenu jMenu3; + private javax.swing.JMenu jMenu4; + private javax.swing.JMenu jMenu6; + private javax.swing.JMenuBar jMenuBar1; + private javax.swing.JMenuItem jMenuItem1; + private javax.swing.JMenuItem jMenuItem10; + private javax.swing.JMenuItem jMenuItem13; + private javax.swing.JMenuItem jMenuItem14; + private javax.swing.JMenuItem jMenuItem18; + private javax.swing.JMenuItem jMenuItem19; + private javax.swing.JMenuItem jMenuItem2; + private javax.swing.JMenuItem jMenuItem6; + private javax.swing.JMenuItem jMenuItem9; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/empnewsmartcard.form b/projects/Metro_systems-master/metro_system/empnewsmartcard.form new file mode 100644 index 0000000..00318cc --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empnewsmartcard.form @@ -0,0 +1,472 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/empnewsmartcard.java b/projects/Metro_systems-master/metro_system/empnewsmartcard.java new file mode 100644 index 0000000..662bb07 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/empnewsmartcard.java @@ -0,0 +1,612 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; +import java.sql.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.imageio.ImageIO; +import javax.swing.*; +import javax.swing.filechooser.FileFilter; + +import java.io.*; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import javax.swing.ImageIcon; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class empnewsmartcard extends javax.swing.JInternalFrame implements convar{ + static String sno=""; + JFileChooser fc; + File myfile; + String pic = ""; + static int a; + /** + * Creates new form newsmartcard + */ + public empnewsmartcard() { + initComponents(); + generatecardNo(); + } + +public void generatecardNo() + { + Connection myconnection; + + try + + + { + myconnection=DriverManager.getConnection(path+place, username, password); + try + { + String query="select max(s_id) from smartcard"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + ResultSet myresult=mystatement.executeQuery(); + if(myresult.next()) + { + jLabel1.setText(String.valueOf(myresult.getInt(1)+1)); + jTextField5.setText(""); + jTextField1.setText(""); + jTextField6.setText(""); + jTextField4.setText(""); + jTextArea2.setText(null); + jTextArea3.setText(""); + buttonGroup1.clearSelection(); + buttonGroup2.clearSelection(); + + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Incriment Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + buttonGroup1 = new javax.swing.ButtonGroup(); + buttonGroup2 = new javax.swing.ButtonGroup(); + jLabel6 = new javax.swing.JLabel(); + jTabbedPane1 = new javax.swing.JTabbedPane(); + jPanel1 = new javax.swing.JPanel(); + jLabel8 = new javax.swing.JLabel(); + jTextField4 = new javax.swing.JTextField(); + jLabel9 = new javax.swing.JLabel(); + jScrollPane2 = new javax.swing.JScrollPane(); + jTextArea2 = new javax.swing.JTextArea(); + jLabel10 = new javax.swing.JLabel(); + jTextField5 = new javax.swing.JTextField(); + jTextField6 = new javax.swing.JTextField(); + jLabel11 = new javax.swing.JLabel(); + jRadioButton3 = new javax.swing.JRadioButton(); + jLabel12 = new javax.swing.JLabel(); + jRadioButton4 = new javax.swing.JRadioButton(); + jLabel13 = new javax.swing.JLabel(); + jScrollPane3 = new javax.swing.JScrollPane(); + jTextArea3 = new javax.swing.JTextArea(); + jLabel14 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jPanel2 = new javax.swing.JPanel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jRadioButton1 = new javax.swing.JRadioButton(); + jRadioButton2 = new javax.swing.JRadioButton(); + jTextField1 = new javax.swing.JTextField(); + jLabel5 = new javax.swing.JLabel(); + jButton2 = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + setTitle("Create Smartcard"); + + jLabel6.setText("Smartcard Number"); + + jTabbedPane1.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), javax.swing.BorderFactory.createEtchedBorder())); + + jLabel8.setText("Gender"); + + jLabel9.setText("Phone Number"); + + jTextArea2.setColumns(20); + jTextArea2.setRows(5); + jScrollPane2.setViewportView(jTextArea2); + + jLabel10.setText("Address"); + + jTextField6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField6ActionPerformed(evt); + } + }); + + jLabel11.setText("Name"); + + buttonGroup1.add(jRadioButton3); + jRadioButton3.setText("Male"); + jRadioButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButton3ActionPerformed(evt); + } + }); + + jLabel12.setText("Age"); + + buttonGroup1.add(jRadioButton4); + jRadioButton4.setText("Female"); + + jLabel13.setText("ID Proof details."); + + jTextArea3.setColumns(20); + jTextArea3.setRows(5); + jScrollPane3.setViewportView(jTextArea3); + + jLabel14.setToolTipText("Image to be uploaded"); + jLabel14.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 102, 102), 1, true)); + + jButton1.setText("UPLOAD"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jButton3.setText("Next"); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(105, 105, 105) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(26, 26, 26) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jRadioButton3) + .addGap(18, 18, 18) + .addComponent(jRadioButton4))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(54, 54, 54)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel13)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(424, 424, 424)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton3)))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(78, 78, 78)))) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(32, 32, 32) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(67, 67, 67) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(40, 40, 40) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(36, 36, 36)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(30, 30, 30))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel13)) + .addContainerGap()) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jButton3) + .addGap(58, 58, 58)))) + ); + + jTabbedPane1.addTab("Personal Details", jPanel1); + + jLabel2.setText("Card Type"); + + jLabel3.setText("Intial balance"); + + jLabel4.setText("Valid for"); + + buttonGroup2.add(jRadioButton1); + jRadioButton1.setText("Standard"); + jRadioButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButton1ActionPerformed(evt); + } + }); + + buttonGroup2.add(jRadioButton2); + jRadioButton2.setText("Premium"); + + jLabel5.setText("1 Year"); + + jButton2.setText("Make SmartCard"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(264, 264, 264) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup() + .addGap(41, 41, 41) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(76, 76, 76) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(jRadioButton1) + .addGap(48, 48, 48) + .addComponent(jRadioButton2)) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap(378, Short.MAX_VALUE)) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(75, 75, 75) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton1) + .addComponent(jRadioButton2)) + .addGap(60, 60, 60) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(55, 55, 55) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(89, 89, 89) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(131, Short.MAX_VALUE)) + ); + + jTabbedPane1.addTab("Smartcard Details", jPanel2); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(197, 197, 197) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(52, 52, 52) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(61, 61, 61) + .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(33, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE) + .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(31, 31, 31)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jTextField6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField6ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField6ActionPerformed + + private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton3ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jRadioButton3ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + fc = new JFileChooser(); + + fc.setFileFilter(new FileFilter() { + + @Override + public boolean accept(File f) { + if (f.isDirectory()) { + return true; + } + int pos = f.getName().lastIndexOf('.'); + if (pos == -1) { + return false; + } else { + String extention = f.getName().substring(pos + 1);//saving the extension + String str[] = {"gif", "png", "jpg", "jpeg"};//allowed extentions + for (String allwd : str) { + + if (extention.equalsIgnoreCase(allwd)) { + return true; + } + } + return false; + } + + } + + public String getDescription() { + + return ""; + } + }); + int result = fc.showOpenDialog(null); + + if (result == JFileChooser.APPROVE_OPTION) { + myfile = fc.getSelectedFile(); + + try { + jLabel14.setIcon(new ImageIcon(ImageIO.read(myfile))); + } catch (Exception e) { + JOptionPane.showMessageDialog(rootPane, "Error"); + e.printStackTrace(); + } + } // TODO add your handling code here: + }//GEN-LAST:event_jButton1ActionPerformed + + private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jRadioButton1ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + + if((jRadioButton1.isSelected()==true && a>=1000) || (jRadioButton2.isSelected()==true && a>=1500) && !jTextField1.getText().equals("") && !jTextField5.getText().equals("") && !jTextField6.getText().equals("") && !jLabel1.getText().equals("") && !jTextField4.getText().equals("") && !jTextArea2.getText().equals("")&& !jTextArea3.getText().equals("") && (jRadioButton1.isSelected() || jRadioButton2.isSelected()) && (jRadioButton3.isSelected() || jRadioButton4.isSelected())) + {Connection myconnection; + a=Integer.parseInt(jTextField1.getText()); +String filename=""; + + if(myfile!=null){ + filename = "Images\\"+new java.util.Date().getTime() + "_" + myfile.getName();//Date.getTime() added for unique file name. + int i; + FileInputStream rd = null; + FileOutputStream outs = null; + try { + + rd = new FileInputStream(myfile); + outs = new FileOutputStream(filename);//writing the new file in 'Images' folder, in the project + + byte[] b = new byte[2048]; + while ((i = rd.read(b)) > 0) { + outs.write(b, 0, i); + + } + JOptionPane.showMessageDialog(rootPane, "File saved"); + } catch (Exception e) { + JOptionPane.showMessageDialog(rootPane, "error" + e.getMessage()); + } finally { + try { + rd.close(); + outs.close(); + } catch (Exception e) { + JOptionPane.showMessageDialog(rootPane, "error in closing file" + e.getMessage()); + } + } + }else + { + filename="Images\\default.png"; + + } + sno=jLabel1.getText(); + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="insert into smartcard values(?,?,?,?,?,?,?,?,?,?,?,?)"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jLabel1.getText()); + mystatement.setString(2, jTextField5.getText()); + mystatement.setString(3, jTextField6.getText()); + if(jRadioButton3.isSelected()) + mystatement.setString(4, "Male"); + else if(jRadioButton4.isSelected()) + mystatement.setString(4, "Female"); + mystatement.setString(5, jTextField4.getText()); + mystatement.setString(6, jTextArea2.getText()); + mystatement.setString(7, jTextArea3.getText()); + mystatement.setString(8, filename); + if(jRadioButton1.isSelected()) + mystatement.setString(9, "standard"); + else if(jRadioButton2.isSelected()) + mystatement.setString(9, "premium"); + + + mystatement.setString(10, jTextField1.getText()); + + SimpleDateFormat myFormat; + myFormat = new SimpleDateFormat("yyyy-MM-dd "); + java.util.Date date = new java.util.Date(); + mystatement.setString(11, myFormat.format(date)); + Calendar c= Calendar.getInstance(); + c.setTime(date); + c.add(Calendar.DAY_OF_YEAR,365); + mystatement.setString(12, myFormat.format(c.getTime())); + + if( mystatement.executeUpdate()>0 ) + { + JOptionPane.showMessageDialog(rootPane, "Smart card made successfully"); + generatecardNo(); + empCashreciept obj=new empCashreciept(); + empmainframe.jDesktopPane1.add(obj); + obj.setVisible(true); + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + } + else + { + JOptionPane.showMessageDialog(rootPane, "less intial balance than the required balance according to card type/ all fields are not filled."); + } + }//GEN-LAST:event_jButton2ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + jTabbedPane1.setSelectedIndex(1); + }//GEN-LAST:event_jButton3ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.ButtonGroup buttonGroup1; + private javax.swing.ButtonGroup buttonGroup2; + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel14; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JRadioButton jRadioButton1; + private javax.swing.JRadioButton jRadioButton2; + private javax.swing.JRadioButton jRadioButton3; + private javax.swing.JRadioButton jRadioButton4; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JScrollPane jScrollPane3; + private javax.swing.JTabbedPane jTabbedPane1; + private javax.swing.JTextArea jTextArea2; + private javax.swing.JTextArea jTextArea3; + private javax.swing.JTextField jTextField1; + private javax.swing.JTextField jTextField4; + private javax.swing.JTextField jTextField5; + private javax.swing.JTextField jTextField6; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/emptoken.form b/projects/Metro_systems-master/metro_system/emptoken.form new file mode 100644 index 0000000..2bede23 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/emptoken.form @@ -0,0 +1,254 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/emptoken.java b/projects/Metro_systems-master/metro_system/emptoken.java new file mode 100644 index 0000000..8da89c2 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/emptoken.java @@ -0,0 +1,387 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.print.PageFormat; +import java.awt.print.Printable; +import static java.awt.print.Printable.NO_SUCH_PAGE; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.SimpleDateFormat; +import javax.swing.JFrame; + +import javax.swing.JOptionPane; + + +/** + * + * @author sparsh + */ +public class emptoken extends javax.swing.JInternalFrame implements convar ,Printable{ + + /** + * Creates new form token + */ + public emptoken() { + initComponents(); + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from faretable where route1=? and stn1=? and route2=? and stn2=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, emptokensearch.s[0]); + mystatement.setString(2, emptokensearch.s[1]); + mystatement.setString(3, emptokensearch.s[2]); + mystatement.setString(4, emptokensearch.s[3]); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { Integer tf=(emptokensearch.n*Integer.parseInt(myres.getString("fare"))); + + jLabel9.setText(emptokensearch.s[0]); + jLabel10.setText(emptokensearch.s[1]); + jLabel11.setText(emptokensearch.s[2]); + jLabel12.setText(emptokensearch.s[3]); + jLabel15.setText(String.valueOf(emptokensearch.n)); + jLabel17.setText(tf.toString()); + jLabel13.setText(myres.getString("fare")); + jLabel19.setText(myres.getString(6)); + jLabel20.setText(myres.getString(7)); + jLabel21.setText(myres.getString(8)); + + SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); + //get current date time with Date() + java.util.Date date = new java.util.Date(); + jLabel23.setText(dateFormat.format(date)); + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel5 = new javax.swing.JLabel(); + jLabel1 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jLabel9 = new javax.swing.JLabel(); + jLabel10 = new javax.swing.JLabel(); + jLabel11 = new javax.swing.JLabel(); + jLabel12 = new javax.swing.JLabel(); + jLabel13 = new javax.swing.JLabel(); + jLabel19 = new javax.swing.JLabel(); + jLabel20 = new javax.swing.JLabel(); + jLabel21 = new javax.swing.JLabel(); + jLabel22 = new javax.swing.JLabel(); + jLabel23 = new javax.swing.JLabel(); + jLabel14 = new javax.swing.JLabel(); + jLabel15 = new javax.swing.JLabel(); + jLabel16 = new javax.swing.JLabel(); + jLabel17 = new javax.swing.JLabel(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + setTitle("Token Booking"); + + jLabel5.setText("Mins."); + + jLabel1.setText("From"); + + jLabel6.setText("Distance"); + + jLabel2.setText("To:"); + + jLabel7.setText("Kms."); + + jLabel8.setText("Stations in between"); + + jButton1.setText("BOOK"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel3.setText("Fare (Rs.)"); + + jLabel4.setText("Travelling Time"); + + jLabel22.setText("Booking date"); + + jLabel14.setText("Number of ticket(s)"); + + jLabel16.setText("Total fare(Rs.)"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(43, 43, 43)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(35, 35, 35) + .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 335, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 335, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addGap(168, 168, 168) + .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(241, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE) + .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel23, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE) + .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, 0) + .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE)) + .addGap(79, 79, 79)))) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(28, 28, 28) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(45, 45, 45) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(64, 64, 64) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE) + .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(34, 34, 34) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE) + .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(21, 21, 21) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(layout.createSequentialGroup() + .addGap(18, 18, 18) + .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(35, 35, 35) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel23, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(32, 32, 32)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + Connection myconnection; + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="insert into bookingtoken(`route1`, `stn1`, `route2`, `stn2`, `fare`, `no_of_tckt`, `totalfare`, `trvl_time`, `dist`, `stn_bw`, `bookingdate`) values(?,?,?,?,?,?,?,?,?,?,?)"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jLabel9.getText()); + mystatement.setString(2, jLabel10.getText()); + mystatement.setString(3, jLabel11.getText()); + mystatement.setString(4, jLabel12.getText()); + mystatement.setString(5, jLabel13.getText()); + mystatement.setString(6, jLabel15.getText()); + mystatement.setString(7, jLabel17.getText()); + + mystatement.setString(8, jLabel19.getText()); + mystatement.setString(9, jLabel20.getText()); + mystatement.setString(10, jLabel21.getText()); + + SimpleDateFormat myFormat; + myFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + java.util.Date date = new java.util.Date(); + mystatement.setString(11, myFormat.format(date)); + + if( mystatement.executeUpdate()>0 ) + { + JOptionPane.showMessageDialog(rootPane, "Token booked successfully"); + + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + jButton1.setVisible(false); + JFrame yourComponent = new JFrame(); +PrinterJob pjob = PrinterJob.getPrinterJob(); +PageFormat preformat = pjob.defaultPage(); +preformat.setOrientation(PageFormat.LANDSCAPE); +PageFormat postformat = pjob.pageDialog(preformat); +//If user does not hit cancel then print. +if (preformat != postformat) { + //Set print component + pjob.setPrintable(this, postformat); + if (pjob.printDialog()) { + try { + pjob.print(); + } catch (PrinterException ex) { + //Logger.getLogger(newmember.class.getName()).log(Level.SEVERE, null, ex); + } + } +}// TODO add your handling code here: +jButton1.setVisible(true); + }//GEN-LAST:event_jButton1ActionPerformed + public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { + if (pageIndex > 0) { /* We have only one page, and 'page' is zero-based */ + return NO_SUCH_PAGE; + } + + // get the bounds of the component + Dimension dim = this.getSize(); + double cHeight = dim.getHeight(); + double cWidth = dim.getWidth(); + + // get the bounds of the printable area + double pHeight = pageFormat.getImageableHeight(); + double pWidth = pageFormat.getImageableWidth(); + + double pXStart = pageFormat.getImageableX(); + double pYStart = pageFormat.getImageableY(); + + double xRatio = pWidth / cWidth; + double yRatio = pHeight / cHeight; + + + Graphics2D g2 = (Graphics2D) graphics; + g2.translate(pXStart, pYStart); + g2.scale(xRatio, yRatio); + this.paint(g2); + + return Printable.PAGE_EXISTS; +} + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel14; + private javax.swing.JLabel jLabel15; + private javax.swing.JLabel jLabel16; + private javax.swing.JLabel jLabel17; + private javax.swing.JLabel jLabel19; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel20; + private javax.swing.JLabel jLabel21; + private javax.swing.JLabel jLabel22; + private javax.swing.JLabel jLabel23; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/emptokensearch.form b/projects/Metro_systems-master/metro_system/emptokensearch.form new file mode 100644 index 0000000..30dfa92 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/emptokensearch.form @@ -0,0 +1,166 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/emptokensearch.java b/projects/Metro_systems-master/metro_system/emptokensearch.java new file mode 100644 index 0000000..f856e75 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/emptokensearch.java @@ -0,0 +1,297 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class emptokensearch extends javax.swing.JInternalFrame implements convar{ + + static String s[]=new String[4]; + static Integer n; + /** + * Creates new form tokensearch + */ + public emptokensearch() { + initComponents(); + Integer a=1; + jSpinner1.setValue(a); + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from routetable"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { + do + { + jComboBox3.addItem(myres.getString("route")); + jComboBox2.addItem(myres.getString("route")); + } + while(myres.next()); + + + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel2 = new javax.swing.JLabel(); + jComboBox3 = new javax.swing.JComboBox<>(); + jComboBox4 = new javax.swing.JComboBox<>(); + jComboBox5 = new javax.swing.JComboBox<>(); + jLabel1 = new javax.swing.JLabel(); + jComboBox2 = new javax.swing.JComboBox<>(); + jButton1 = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + jSpinner1 = new javax.swing.JSpinner(); + + setClosable(true); + setIconifiable(true); + + jLabel2.setText("To:"); + + jComboBox3.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose Route" })); + jComboBox3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox3ActionPerformed(evt); + } + }); + + jComboBox4.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "choose route first" })); + + jComboBox5.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "choose route first" })); + + jLabel1.setText("From"); + + jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose route" })); + jComboBox2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox2ActionPerformed(evt); + } + }); + + jButton1.setText("Proceed"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel3.setText("Number of person(s)"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(22, 22, 22) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jComboBox3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jComboBox4, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(43, 43, 43)) + .addGroup(layout.createSequentialGroup() + .addGap(71, 71, 71) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(99, 99, 99) + .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(0, 30, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(45, 45, 45) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(80, 80, 80) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(72, 72, 72) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(172, 172, 172)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jComboBox3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox3ActionPerformed + Connection myconnection; + + if(jComboBox3.getSelectedIndex()>0){ + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from stationtable where route=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox3.getSelectedItem().toString()); + + ResultSet myres = mystatement.executeQuery(); + jComboBox5.removeAllItems(); + jComboBox5.addItem("choose station"); + if(myres.next()) + { + do + { + jComboBox5.addItem(myres.getString("stn_name")); + + } + while(myres.next()); + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + else{ + jComboBox5.addItem("choose route first"); + } // TODO add your handling code here: + }//GEN-LAST:event_jComboBox3ActionPerformed + + private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed + Connection myconnection; + + if(jComboBox2.getSelectedIndex()>0){ + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from stationtable where route=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox2.getSelectedItem().toString()); + ResultSet myres = mystatement.executeQuery(); + jComboBox4.removeAllItems(); + jComboBox4.addItem("choose station"); + if(myres.next()) + { + do + { + jComboBox4.addItem(myres.getString("stn_name")); + + } + while(myres.next()); + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + else{ + jComboBox4.addItem("choose route first"); + } + }//GEN-LAST:event_jComboBox2ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + if(jComboBox2.getSelectedIndex()>0 && jComboBox3.getSelectedIndex()>0 && jComboBox4.getSelectedIndex()>0 && jComboBox5.getSelectedIndex()>0 ) + { + s[0] = jComboBox2.getSelectedItem().toString(); + s[1] = jComboBox4.getSelectedItem().toString(); + s[2] = jComboBox3.getSelectedItem().toString(); + s[3] = jComboBox5.getSelectedItem().toString(); + n=Integer.parseInt(jSpinner1.getValue().toString()); + emptoken obj=new emptoken(); + empmainframe.jDesktopPane1.add(obj); + obj.setVisible(true); + } + else{ + JOptionPane.showMessageDialog(rootPane, "Please select appropriate option"); + + } + + + }//GEN-LAST:event_jButton1ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JComboBox jComboBox2; + private javax.swing.JComboBox jComboBox3; + private javax.swing.JComboBox jComboBox4; + private javax.swing.JComboBox jComboBox5; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JSpinner jSpinner1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/fareadd.png b/projects/Metro_systems-master/metro_system/fareadd.png new file mode 100644 index 0000000..2e0f167 Binary files /dev/null and b/projects/Metro_systems-master/metro_system/fareadd.png differ diff --git a/projects/Metro_systems-master/metro_system/fetchmetro.form b/projects/Metro_systems-master/metro_system/fetchmetro.form new file mode 100644 index 0000000..52bb0ce --- /dev/null +++ b/projects/Metro_systems-master/metro_system/fetchmetro.form @@ -0,0 +1,78 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/fetchmetro.java b/projects/Metro_systems-master/metro_system/fetchmetro.java new file mode 100644 index 0000000..1ec93b3 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/fetchmetro.java @@ -0,0 +1,136 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.swing.JOptionPane; + + +/** + * + * @author sparsh + */ +public class fetchmetro extends javax.swing.JInternalFrame implements convar { + static String s=""; + /** + * Creates new form fetchmetro + */ + public fetchmetro() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jButton1 = new javax.swing.JButton(); + jTextField1 = new javax.swing.JTextField(); + jLabel1 = new javax.swing.JLabel(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + setTitle("Find Metro"); + + jButton1.setText("Fetch"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel1.setText("metro number"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(113, 113, 113) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(150, 150, 150) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(432, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(60, 60, 60) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE) + .addComponent(jTextField1)) + .addGap(45, 45, 45) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(278, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + s=jTextField1.getText(); + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select* from metrotable where metro_no=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, fetchmetro.s); + + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { + fetchmetroresult obj=new fetchmetroresult(); + + mainframe.jDesktopPane1.add(obj); + obj.setVisible(true); + + } + else + JOptionPane.showMessageDialog(rootPane, "Wrong metro number entered . Enter again"); + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + }//GEN-LAST:event_jButton1ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/fetchmetroresult.form b/projects/Metro_systems-master/metro_system/fetchmetroresult.form new file mode 100644 index 0000000..167be3e --- /dev/null +++ b/projects/Metro_systems-master/metro_system/fetchmetroresult.form @@ -0,0 +1,164 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/fetchmetroresult.java b/projects/Metro_systems-master/metro_system/fetchmetroresult.java new file mode 100644 index 0000000..4363209 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/fetchmetroresult.java @@ -0,0 +1,217 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class fetchmetroresult extends javax.swing.JInternalFrame implements convar{ + + /** + * Creates new form newmetro + */ + public fetchmetroresult() { + initComponents(); + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query1="select * from routetable"; + PreparedStatement mystatement1=myconnection.prepareStatement(query1); + ResultSet myres1 = mystatement1.executeQuery(); + if(myres1.next()) + { + do + { + jComboBox1.addItem(myres1.getString("route")); + } + while(myres1.next()); + } + String query="select* from metrotable where metro_no=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, fetchmetro.s); + + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { + jTextField1.setText(myres.getString(1)); + jTextField2.setText(myres.getString(2)); + jTextField3.setText(myres.getString(3)); + jComboBox1.setSelectedItem(myres.getString(4)); + jTextField4.setText(myres.getString(5)); + jDateChooser2.setDate(myres.getDate(6)); + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + } + + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jTextField1 = new javax.swing.JTextField(); + jTextField2 = new javax.swing.JTextField(); + jTextField3 = new javax.swing.JTextField(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jComboBox1 = new javax.swing.JComboBox<>(); + jLabel5 = new javax.swing.JLabel(); + jTextField4 = new javax.swing.JTextField(); + jLabel6 = new javax.swing.JLabel(); + jDateChooser2 = new com.toedter.calendar.JDateChooser(); + jLabel4 = new javax.swing.JLabel(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + setTitle("Metro Found"); + + jTextField1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField1ActionPerformed(evt); + } + }); + + jLabel1.setText("metro number"); + + jLabel2.setText("number of carriages"); + + jLabel3.setText("carrying capacity"); + + jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose route" })); + jComboBox1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox1ActionPerformed(evt); + } + }); + + jLabel5.setText("Frequency"); + + jLabel6.setText("Started on Date"); + + jLabel4.setText("Route "); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(126, 126, 126) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel3) + .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(23, 23, 23) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(51, 51, 51))) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap(160, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(68, 68, 68) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(32, 32, 32) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(28, 28, 28) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(30, 30, 30) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(31, 31, 31) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(128, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField1ActionPerformed + + private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jComboBox1ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JComboBox jComboBox1; + private com.toedter.calendar.JDateChooser jDateChooser2; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JTextField jTextField1; + private javax.swing.JTextField jTextField2; + private javax.swing.JTextField jTextField3; + private javax.swing.JTextField jTextField4; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/login.form b/projects/Metro_systems-master/metro_system/login.form new file mode 100644 index 0000000..4793958 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/login.form @@ -0,0 +1,97 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/login.java b/projects/Metro_systems-master/metro_system/login.java new file mode 100644 index 0000000..ea2fde4 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/login.java @@ -0,0 +1,219 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class login extends javax.swing.JFrame implements convar { + static String s=""; + /** + * Creates new form login + */ + public login() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jPasswordField1 = new javax.swing.JPasswordField(); + jTextField1 = new javax.swing.JTextField(); + jButton1 = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("LOGIN"); + + jLabel1.setText("Username"); + + jLabel2.setText("Pasword"); + + jTextField1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField1ActionPerformed(evt); + } + }); + + jButton1.setText("LOGIN"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(129, 129, 129) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(74, 74, 74) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(44, 44, 44) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jTextField1) + .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap(95, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(99, 99, 99) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(40, 40, 40) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(89, 89, 89) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(70, Short.MAX_VALUE)) + ); + + pack(); + setLocationRelativeTo(null); + }// //GEN-END:initComponents + + private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField1ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Theme Applying Error."+e.getMessage()); + } + s= jTextField1.getText(); + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select* from admintable WHERE USERNAME=? AND PASSWORD=? "; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jTextField1.getText()); + mystatement.setString(2, jPasswordField1.getText()); + ResultSet myres = mystatement.executeQuery(); + + query="select* from employeetable WHERE USERNAME=? AND PASSWORD=? "; + mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jTextField1.getText()); + mystatement.setString(2, jPasswordField1.getText()); + ResultSet myres1 = mystatement.executeQuery(); + + if(myres.next()) + { + JOptionPane.showMessageDialog(null, "Welcome Admin."); + mainframe obj=new mainframe(); + obj.setVisible(true); + this.dispose(); + + } + else if(myres1.next()){ + + JOptionPane.showMessageDialog(null, "Welcome Employee."); + empmainframe obj=new empmainframe(); + obj.setVisible(true); + this.dispose(); + + } + else{ + JOptionPane.showMessageDialog(null, "Wrong Username/Password"); + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(null, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(null, "Connection Error:"+e.getMessage()); + } + + }//GEN-LAST:event_jButton1ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new login().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JPasswordField jPasswordField1; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/logout.form b/projects/Metro_systems-master/metro_system/logout.form new file mode 100644 index 0000000..558070a --- /dev/null +++ b/projects/Metro_systems-master/metro_system/logout.form @@ -0,0 +1,31 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/logout.java b/projects/Metro_systems-master/metro_system/logout.java new file mode 100644 index 0000000..f1d7803 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/logout.java @@ -0,0 +1,47 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +/** + * + * @author sparsh + */ +public class logout extends javax.swing.JInternalFrame { + + /** + * Creates new form logout + */ + public logout() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 394, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 274, Short.MAX_VALUE) + ); + + pack(); + }// //GEN-END:initComponents + + + // Variables declaration - do not modify//GEN-BEGIN:variables + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/mainframe.form b/projects/Metro_systems-master/metro_system/mainframe.form new file mode 100644 index 0000000..ad0f892 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/mainframe.form @@ -0,0 +1,409 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/mainframe.java b/projects/Metro_systems-master/metro_system/mainframe.java new file mode 100644 index 0000000..ac61cb7 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/mainframe.java @@ -0,0 +1,560 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.*; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class mainframe extends javax.swing.JFrame { + + /** + * Creates new form mainframe + */ + public mainframe() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jDesktopPane2 = new javax.swing.JDesktopPane(); + jDesktopPane1 = new javax.swing.JDesktopPane(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jLabel2 = new javax.swing.JLabel(); + jMenuBar1 = new javax.swing.JMenuBar(); + jMenu1 = new javax.swing.JMenu(); + jMenuItem1 = new javax.swing.JMenuItem(); + jMenuItem2 = new javax.swing.JMenuItem(); + jMenuItem5 = new javax.swing.JMenuItem(); + jMenuItem17 = new javax.swing.JMenuItem(); + jMenu2 = new javax.swing.JMenu(); + jMenuItem6 = new javax.swing.JMenuItem(); + jMenuItem18 = new javax.swing.JMenuItem(); + jMenu3 = new javax.swing.JMenu(); + jMenuItem10 = new javax.swing.JMenuItem(); + jMenuItem13 = new javax.swing.JMenuItem(); + jMenuItem14 = new javax.swing.JMenuItem(); + jMenuItem9 = new javax.swing.JMenuItem(); + jMenuItem11 = new javax.swing.JMenuItem(); + jMenuItem15 = new javax.swing.JMenuItem(); + jMenu4 = new javax.swing.JMenu(); + jMenuItem8 = new javax.swing.JMenuItem(); + jMenuItem19 = new javax.swing.JMenuItem(); + jMenuItem20 = new javax.swing.JMenuItem(); + jMenu5 = new javax.swing.JMenu(); + jMenuItem3 = new javax.swing.JMenuItem(); + jMenuItem4 = new javax.swing.JMenuItem(); + jMenuItem7 = new javax.swing.JMenuItem(); + jMenuItem12 = new javax.swing.JMenuItem(); + jMenuItem16 = new javax.swing.JMenuItem(); + jMenu6 = new javax.swing.JMenu(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("Metro System Management : Sparsh Bansal"); + setName("mainframe"); // NOI18N + getContentPane().setLayout(null); + getContentPane().add(jDesktopPane2); + jDesktopPane2.setBounds(1973, 0, 0, 0); + + jButton1.setBackground(new java.awt.Color(204, 204, 204)); + jButton1.setText("Token Booking"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + jDesktopPane1.add(jButton1); + jButton1.setBounds(150, 530, 130, 50); + + jButton2.setText("Smartcard Booking"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + jDesktopPane1.add(jButton2); + jButton2.setBounds(870, 530, 140, 40); + + jButton3.setText("Search Booking"); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + jDesktopPane1.add(jButton3); + jButton3.setBounds(1630, 500, 130, 30); + + jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/METRO Wallpapers.jpg"))); // NOI18N + jDesktopPane1.add(jLabel2); + jLabel2.setBounds(10, -10, 1920, 1000); + + getContentPane().add(jDesktopPane1); + jDesktopPane1.setBounds(-10, 0, 1920, 990); + + jMenu1.setText("Metros"); + jMenu1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenu1ActionPerformed(evt); + } + }); + + jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/newmetro.jpeg"))); // NOI18N + jMenuItem1.setText("New Metro"); + jMenuItem1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem1ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem1); + + jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/train-search.png"))); // NOI18N + jMenuItem2.setText("Find Metro"); + jMenuItem2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem2ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem2); + + jMenuItem5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/updatemetroicon.jpeg"))); // NOI18N + jMenuItem5.setText("Update Metro"); + jMenuItem5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem5ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem5); + + jMenuItem17.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/deletemetro.jpeg"))); // NOI18N + jMenuItem17.setText("Delete Metro"); + jMenuItem17.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem17ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem17); + + jMenuBar1.add(jMenu1); + + jMenu2.setText("Token"); + + jMenuItem6.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/tokenbook.jpeg"))); // NOI18N + jMenuItem6.setText("Booking"); + jMenuItem6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem6ActionPerformed(evt); + } + }); + jMenu2.add(jMenuItem6); + + jMenuItem18.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.ALT_MASK)); + jMenuItem18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/tokenbookedsearch.png"))); // NOI18N + jMenuItem18.setText("Search tokens"); + jMenuItem18.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem18ActionPerformed(evt); + } + }); + jMenu2.add(jMenuItem18); + + jMenuBar1.add(jMenu2); + + jMenu3.setText("Smartcard"); + + jMenuItem10.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/cardbook.png"))); // NOI18N + jMenuItem10.setText("Booking"); + jMenuItem10.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem10ActionPerformed(evt); + } + }); + jMenu3.add(jMenuItem10); + + jMenuItem13.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/searchsartcard.jpeg"))); // NOI18N + jMenuItem13.setText("Search"); + jMenuItem13.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem13ActionPerformed(evt); + } + }); + jMenu3.add(jMenuItem13); + + jMenuItem14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/addbalance.jpeg"))); // NOI18N + jMenuItem14.setText("Add Balance"); + jMenuItem14.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem14ActionPerformed(evt); + } + }); + jMenu3.add(jMenuItem14); + + jMenuItem9.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/smartcardfinal.jpeg"))); // NOI18N + jMenuItem9.setText("New Smartcard"); + jMenuItem9.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem9ActionPerformed(evt); + } + }); + jMenu3.add(jMenuItem9); + + jMenuItem11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/updatecard.jpeg"))); // NOI18N + jMenuItem11.setText("Update smartcard"); + jMenuItem11.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem11ActionPerformed(evt); + } + }); + jMenu3.add(jMenuItem11); + + jMenuItem15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/deletesmartcard.jpeg"))); // NOI18N + jMenuItem15.setText("Delete Smartcard"); + jMenuItem15.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem15ActionPerformed(evt); + } + }); + jMenu3.add(jMenuItem15); + + jMenuBar1.add(jMenu3); + + jMenu4.setText("Employee"); + + jMenuItem8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/employee.jpeg"))); // NOI18N + jMenuItem8.setText("Create employee"); + jMenuItem8.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem8ActionPerformed(evt); + } + }); + jMenu4.add(jMenuItem8); + + jMenuItem19.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/changepassword.jpg"))); // NOI18N + jMenuItem19.setText("Change Password"); + jMenuItem19.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem19ActionPerformed(evt); + } + }); + jMenu4.add(jMenuItem19); + + jMenuItem20.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/delete-user.png"))); // NOI18N + jMenuItem20.setText("Delete Employee"); + jMenuItem20.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem20ActionPerformed(evt); + } + }); + jMenu4.add(jMenuItem20); + + jMenuBar1.add(jMenu4); + + jMenu5.setText("Misc"); + + jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/addroute.jpeg"))); // NOI18N + jMenuItem3.setText("Add Route"); + jMenuItem3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem3ActionPerformed(evt); + } + }); + jMenu5.add(jMenuItem3); + + jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/station.jpeg"))); // NOI18N + jMenuItem4.setText("Add station"); + jMenuItem4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem4ActionPerformed(evt); + } + }); + jMenu5.add(jMenuItem4); + + jMenuItem7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/fareadd.png"))); // NOI18N + jMenuItem7.setText("Add fare"); + jMenuItem7.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem7ActionPerformed(evt); + } + }); + jMenu5.add(jMenuItem7); + + jMenuItem12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/updatefare.png"))); // NOI18N + jMenuItem12.setText("Update fare"); + jMenuItem12.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem12ActionPerformed(evt); + } + }); + jMenu5.add(jMenuItem12); + + jMenuItem16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/metro_system/changepassword.jpg"))); // NOI18N + jMenuItem16.setText("Change Password"); + jMenuItem16.setActionCommand("Change Password"); + jMenuItem16.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem16ActionPerformed(evt); + } + }); + jMenu5.add(jMenuItem16); + + jMenuBar1.add(jMenu5); + + jMenu6.setText("Log Out"); + jMenu6.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jMenu6MouseClicked(evt); + } + }); + jMenu6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenu6ActionPerformed(evt); + } + }); + jMenuBar1.add(jMenu6); + + setJMenuBar(jMenuBar1); + + setSize(new java.awt.Dimension(1930, 1061)); + setLocationRelativeTo(null); + }// //GEN-END:initComponents + + private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed + newmetro obj=new newmetro(); + jDesktopPane1.add(obj); + obj.setVisible(true); + + }//GEN-LAST:event_jMenuItem1ActionPerformed + + private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu1ActionPerformed + + + }//GEN-LAST:event_jMenu1ActionPerformed + + private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed + fetchmetro obj=new fetchmetro(); + jDesktopPane1.add(obj); + obj.setVisible(true); + }//GEN-LAST:event_jMenuItem2ActionPerformed + + private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed + addroute obj=new addroute(); + jDesktopPane1.add(obj); + obj.setVisible(true); }//GEN-LAST:event_jMenuItem3ActionPerformed + + private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed + addstation obj=new addstation(); + jDesktopPane1.add(obj); + obj.setVisible(true); }//GEN-LAST:event_jMenuItem4ActionPerformed + + private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed +updatemetro obj=new updatemetro(); + jDesktopPane1.add(obj); + obj.setVisible(true); }//GEN-LAST:event_jMenuItem5ActionPerformed + + private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed + tokensearch obj=new tokensearch(); + jDesktopPane1.add(obj); + obj.setVisible(true); + + }//GEN-LAST:event_jMenuItem6ActionPerformed + + private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed +addfare obj=new addfare(); + jDesktopPane1.add(obj); + obj.setVisible(true); // TODO add your handling code here: + }//GEN-LAST:event_jMenuItem7ActionPerformed + + private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed + createemployee obj=new createemployee(); + jDesktopPane1.add(obj); + obj.setVisible(true); + }//GEN-LAST:event_jMenuItem8ActionPerformed + + private void jMenu6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu6ActionPerformed + + }//GEN-LAST:event_jMenu6ActionPerformed + + private void jMenu6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu6MouseClicked + if(JOptionPane.showConfirmDialog(rootPane, "Do you really want to log out ?", "Log out confirmation .", JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION) + { this.dispose(); + login obj=new login(); + obj.setVisible(true); + } + }//GEN-LAST:event_jMenu6MouseClicked + + private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed +newsmartcard obj=new newsmartcard(); + jDesktopPane1.add(obj); + obj.setVisible(true); }//GEN-LAST:event_jMenuItem9ActionPerformed + + private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem10ActionPerformed +cardbooksearch obj=new cardbooksearch(); + jDesktopPane1.add(obj); + obj.setVisible(true); }//GEN-LAST:event_jMenuItem10ActionPerformed + + private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem11ActionPerformed + updatesmartcard obj=new updatesmartcard(); + jDesktopPane1.add(obj); + obj.setVisible(true); + }//GEN-LAST:event_jMenuItem11ActionPerformed + + private void jMenuItem12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem12ActionPerformed + updatefare obj=new updatefare(); + jDesktopPane1.add(obj); + obj.setVisible(true); }//GEN-LAST:event_jMenuItem12ActionPerformed + + private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem13ActionPerformed + cardsearch obj=new cardsearch(); + jDesktopPane1.add(obj); + obj.setVisible(true); + }//GEN-LAST:event_jMenuItem13ActionPerformed + + private void jMenuItem14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem14ActionPerformed + addbalance obj=new addbalance(); + jDesktopPane1.add(obj); + obj.setVisible(true); }//GEN-LAST:event_jMenuItem14ActionPerformed + + private void jMenuItem15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem15ActionPerformed + deletesmartcard obj=new deletesmartcard(); + jDesktopPane1.add(obj); + obj.setVisible(true); + }//GEN-LAST:event_jMenuItem15ActionPerformed + + private void jMenuItem17ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem17ActionPerformed + deletemetro obj=new deletemetro(); + jDesktopPane1.add(obj); + obj.setVisible(true); }//GEN-LAST:event_jMenuItem17ActionPerformed + + private void jMenuItem18ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem18ActionPerformed + tokenbookedsearch obj=new tokenbookedsearch(); + jDesktopPane1.add(obj); + obj.setVisible(true); + }//GEN-LAST:event_jMenuItem18ActionPerformed + + private void jMenuItem19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem19ActionPerformed + changepassword obj=new changepassword(); + jDesktopPane1.add(obj); + obj.setVisible(true); + }//GEN-LAST:event_jMenuItem19ActionPerformed + + private void jMenuItem20ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem20ActionPerformed + deleteemployee obj= new deleteemployee(); + jDesktopPane1.add(obj); + obj.setVisible(true); + + }//GEN-LAST:event_jMenuItem20ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed +tokensearch obj=new tokensearch(); + jDesktopPane1.add(obj); + obj.setVisible(true); // TODO add your handling code here: + }//GEN-LAST:event_jButton1ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + cardsearch obj=new cardsearch(); + jDesktopPane1.add(obj); + obj.setVisible(true); // TODO add your handling code here: + }//GEN-LAST:event_jButton3ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed +cardbooksearch obj=new cardbooksearch(); + jDesktopPane1.add(obj); + obj.setVisible(true); // TODO add your handling code here: + }//GEN-LAST:event_jButton2ActionPerformed + + private void jMenuItem16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem16ActionPerformed + adminchangepassword obj=new adminchangepassword(); + jDesktopPane1.add(obj); + obj.setVisible(true); + }//GEN-LAST:event_jMenuItem16ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(mainframe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(mainframe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(mainframe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(mainframe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new mainframe().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + public static javax.swing.JDesktopPane jDesktopPane1; + public static javax.swing.JDesktopPane jDesktopPane2; + private javax.swing.JLabel jLabel2; + private javax.swing.JMenu jMenu1; + private javax.swing.JMenu jMenu2; + private javax.swing.JMenu jMenu3; + private javax.swing.JMenu jMenu4; + private javax.swing.JMenu jMenu5; + private javax.swing.JMenu jMenu6; + private javax.swing.JMenuBar jMenuBar1; + private javax.swing.JMenuItem jMenuItem1; + private javax.swing.JMenuItem jMenuItem10; + private javax.swing.JMenuItem jMenuItem11; + private javax.swing.JMenuItem jMenuItem12; + private javax.swing.JMenuItem jMenuItem13; + private javax.swing.JMenuItem jMenuItem14; + private javax.swing.JMenuItem jMenuItem15; + private javax.swing.JMenuItem jMenuItem16; + private javax.swing.JMenuItem jMenuItem17; + private javax.swing.JMenuItem jMenuItem18; + private javax.swing.JMenuItem jMenuItem19; + private javax.swing.JMenuItem jMenuItem2; + private javax.swing.JMenuItem jMenuItem20; + private javax.swing.JMenuItem jMenuItem3; + private javax.swing.JMenuItem jMenuItem4; + private javax.swing.JMenuItem jMenuItem5; + private javax.swing.JMenuItem jMenuItem6; + private javax.swing.JMenuItem jMenuItem7; + private javax.swing.JMenuItem jMenuItem8; + private javax.swing.JMenuItem jMenuItem9; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/metrohouston.png b/projects/Metro_systems-master/metro_system/metrohouston.png new file mode 100644 index 0000000..d27bd03 Binary files /dev/null and b/projects/Metro_systems-master/metro_system/metrohouston.png differ diff --git a/projects/Metro_systems-master/metro_system/newmetro.form b/projects/Metro_systems-master/metro_system/newmetro.form new file mode 100644 index 0000000..4cba8f6 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/newmetro.form @@ -0,0 +1,179 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/newmetro.java b/projects/Metro_systems-master/metro_system/newmetro.java new file mode 100644 index 0000000..1aaa84a --- /dev/null +++ b/projects/Metro_systems-master/metro_system/newmetro.java @@ -0,0 +1,310 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.SimpleDateFormat; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class newmetro extends javax.swing.JInternalFrame implements convar{ + + /** + * Creates new form newmetro + */ + public void generatemetroNo() + { + Connection myconnection; + + try + + + { + myconnection=DriverManager.getConnection(path+place, username, password); + try + { + String query="select max(metro_no) from metrotable"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + ResultSet myresult=mystatement.executeQuery(); + if(myresult.next()) + { + jTextField1.setText(String.valueOf(myresult.getInt(1)+1)); + jTextField2.setText(""); + jTextField3.setText(""); + jTextField4.setText(""); + jDateChooser2.setDate(null); + jComboBox1.setSelectedIndex(0); + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Incriment Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + + public newmetro() { + initComponents(); + generatemetroNo(); + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from routetable"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { + do + { + jComboBox1.addItem(myres.getString("route")); + } + while(myres.next()); + + + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jTextField1 = new javax.swing.JTextField(); + jTextField2 = new javax.swing.JTextField(); + jTextField3 = new javax.swing.JTextField(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + jLabel4 = new javax.swing.JLabel(); + jComboBox1 = new javax.swing.JComboBox<>(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jTextField4 = new javax.swing.JTextField(); + jDateChooser2 = new com.toedter.calendar.JDateChooser(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + + jTextField1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField1ActionPerformed(evt); + } + }); + + jTextField3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField3ActionPerformed(evt); + } + }); + + jLabel1.setText("metro number"); + + jLabel2.setText("number of carriages"); + + jLabel3.setText("carrying capacity"); + + jButton1.setText("save"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel4.setText("Route "); + + jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose route" })); + jComboBox1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox1ActionPerformed(evt); + } + }); + + jLabel5.setText("Frequency"); + + jLabel6.setText("Started on Date "); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(126, 126, 126) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel3)) + .addGap(106, 106, 106) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jTextField2, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jTextField3, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jComboBox1, javax.swing.GroupLayout.Alignment.TRAILING, 0, 260, Short.MAX_VALUE) + .addComponent(jTextField4, javax.swing.GroupLayout.Alignment.TRAILING)))))) + .addGroup(layout.createSequentialGroup() + .addGap(219, 219, 219) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(182, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(57, 57, 57) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox1, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(27, 27, 27) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE) + .addComponent(jDateChooser2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(113, 113, 113)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField1ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="insert into metrotable values(?,?,?,?,?,?)"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jTextField1.getText()); + mystatement.setString(2, jTextField2.getText()); + mystatement.setString(3, jTextField3.getText()); + mystatement.setString(4, jComboBox1.getSelectedItem().toString()); + mystatement.setString(5, jTextField4.getText()); + + SimpleDateFormat myformat=new SimpleDateFormat("yyyy-MM-dd"); + + mystatement.setString(6, myformat.format(jDateChooser2.getDate())); + if(mystatement.executeUpdate()>0) + { + JOptionPane.showMessageDialog(rootPane, "Information Sored Successfully"); + generatemetroNo(); + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField3ActionPerformed + + private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jComboBox1ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JComboBox jComboBox1; + private com.toedter.calendar.JDateChooser jDateChooser2; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JTextField jTextField1; + private javax.swing.JTextField jTextField2; + private javax.swing.JTextField jTextField3; + private javax.swing.JTextField jTextField4; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/newmetro.jpeg b/projects/Metro_systems-master/metro_system/newmetro.jpeg new file mode 100644 index 0000000..39e190f Binary files /dev/null and b/projects/Metro_systems-master/metro_system/newmetro.jpeg differ diff --git a/projects/Metro_systems-master/metro_system/newsmartcard.form b/projects/Metro_systems-master/metro_system/newsmartcard.form new file mode 100644 index 0000000..00318cc --- /dev/null +++ b/projects/Metro_systems-master/metro_system/newsmartcard.form @@ -0,0 +1,472 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/newsmartcard.java b/projects/Metro_systems-master/metro_system/newsmartcard.java new file mode 100644 index 0000000..42529c9 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/newsmartcard.java @@ -0,0 +1,612 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; +import java.sql.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.imageio.ImageIO; +import javax.swing.*; +import javax.swing.filechooser.FileFilter; + +import java.io.*; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import javax.swing.ImageIcon; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class newsmartcard extends javax.swing.JInternalFrame implements convar{ + static String sno=""; + JFileChooser fc; + File myfile; + String pic = ""; + static int a; + /** + * Creates new form newsmartcard + */ + public newsmartcard() { + initComponents(); + generatecardNo(); + } + +public void generatecardNo() + { + Connection myconnection; + + try + + + { + myconnection=DriverManager.getConnection(path+place, username, password); + try + { + String query="select max(s_id) from smartcard"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + ResultSet myresult=mystatement.executeQuery(); + if(myresult.next()) + { + jLabel1.setText(String.valueOf(myresult.getInt(1)+1)); + jTextField5.setText(""); + jTextField1.setText(""); + jTextField6.setText(""); + jTextField4.setText(""); + jTextArea2.setText(null); + jTextArea3.setText(""); + buttonGroup1.clearSelection(); + buttonGroup2.clearSelection(); + + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Incriment Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + buttonGroup1 = new javax.swing.ButtonGroup(); + buttonGroup2 = new javax.swing.ButtonGroup(); + jLabel6 = new javax.swing.JLabel(); + jTabbedPane1 = new javax.swing.JTabbedPane(); + jPanel1 = new javax.swing.JPanel(); + jLabel8 = new javax.swing.JLabel(); + jTextField4 = new javax.swing.JTextField(); + jLabel9 = new javax.swing.JLabel(); + jScrollPane2 = new javax.swing.JScrollPane(); + jTextArea2 = new javax.swing.JTextArea(); + jLabel10 = new javax.swing.JLabel(); + jTextField5 = new javax.swing.JTextField(); + jTextField6 = new javax.swing.JTextField(); + jLabel11 = new javax.swing.JLabel(); + jRadioButton3 = new javax.swing.JRadioButton(); + jLabel12 = new javax.swing.JLabel(); + jRadioButton4 = new javax.swing.JRadioButton(); + jLabel13 = new javax.swing.JLabel(); + jScrollPane3 = new javax.swing.JScrollPane(); + jTextArea3 = new javax.swing.JTextArea(); + jLabel14 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jPanel2 = new javax.swing.JPanel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jRadioButton1 = new javax.swing.JRadioButton(); + jRadioButton2 = new javax.swing.JRadioButton(); + jTextField1 = new javax.swing.JTextField(); + jLabel5 = new javax.swing.JLabel(); + jButton2 = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + setTitle("Create Smartcard"); + + jLabel6.setText("Smartcard Number"); + + jTabbedPane1.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), javax.swing.BorderFactory.createEtchedBorder())); + + jLabel8.setText("Gender"); + + jLabel9.setText("Phone Number"); + + jTextArea2.setColumns(20); + jTextArea2.setRows(5); + jScrollPane2.setViewportView(jTextArea2); + + jLabel10.setText("Address"); + + jTextField6.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField6ActionPerformed(evt); + } + }); + + jLabel11.setText("Name"); + + buttonGroup1.add(jRadioButton3); + jRadioButton3.setText("Male"); + jRadioButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButton3ActionPerformed(evt); + } + }); + + jLabel12.setText("Age"); + + buttonGroup1.add(jRadioButton4); + jRadioButton4.setText("Female"); + + jLabel13.setText("ID Proof details."); + + jTextArea3.setColumns(20); + jTextArea3.setRows(5); + jScrollPane3.setViewportView(jTextArea3); + + jLabel14.setToolTipText("Image to be uploaded"); + jLabel14.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 102, 102), 1, true)); + + jButton1.setText("UPLOAD"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jButton3.setText("Next"); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(105, 105, 105) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(26, 26, 26) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jRadioButton3) + .addGap(18, 18, 18) + .addComponent(jRadioButton4))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(54, 54, 54)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel13)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(424, 424, 424)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton3)))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(78, 78, 78)))) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(32, 32, 32) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(67, 67, 67) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(40, 40, 40) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(36, 36, 36)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(30, 30, 30))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel13)) + .addContainerGap()) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jButton3) + .addGap(58, 58, 58)))) + ); + + jTabbedPane1.addTab("Personal Details", jPanel1); + + jLabel2.setText("Card Type"); + + jLabel3.setText("Intial balance"); + + jLabel4.setText("Valid for"); + + buttonGroup2.add(jRadioButton1); + jRadioButton1.setText("Standard"); + jRadioButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButton1ActionPerformed(evt); + } + }); + + buttonGroup2.add(jRadioButton2); + jRadioButton2.setText("Premium"); + + jLabel5.setText("1 Year"); + + jButton2.setText("Make SmartCard"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(264, 264, 264) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup() + .addGap(41, 41, 41) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(76, 76, 76) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(jRadioButton1) + .addGap(48, 48, 48) + .addComponent(jRadioButton2)) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap(378, Short.MAX_VALUE)) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(75, 75, 75) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jRadioButton1) + .addComponent(jRadioButton2)) + .addGap(60, 60, 60) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(55, 55, 55) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(89, 89, 89) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(131, Short.MAX_VALUE)) + ); + + jTabbedPane1.addTab("Smartcard Details", jPanel2); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(197, 197, 197) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(52, 52, 52) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(61, 61, 61) + .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(33, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE) + .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(31, 31, 31)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jTextField6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField6ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField6ActionPerformed + + private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton3ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jRadioButton3ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + fc = new JFileChooser(); + + fc.setFileFilter(new FileFilter() { + + @Override + public boolean accept(File f) { + if (f.isDirectory()) { + return true; + } + int pos = f.getName().lastIndexOf('.'); + if (pos == -1) { + return false; + } else { + String extention = f.getName().substring(pos + 1);//saving the extension + String str[] = {"gif", "png", "jpg", "jpeg"};//allowed extentions + for (String allwd : str) { + + if (extention.equalsIgnoreCase(allwd)) { + return true; + } + } + return false; + } + + } + + public String getDescription() { + + return ""; + } + }); + int result = fc.showOpenDialog(null); + + if (result == JFileChooser.APPROVE_OPTION) { + myfile = fc.getSelectedFile(); + + try { + jLabel14.setIcon(new ImageIcon(ImageIO.read(myfile))); + } catch (Exception e) { + JOptionPane.showMessageDialog(rootPane, "Error"); + e.printStackTrace(); + } + } // TODO add your handling code here: + }//GEN-LAST:event_jButton1ActionPerformed + + private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jRadioButton1ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + + if((jRadioButton1.isSelected()==true && a>=1000) || (jRadioButton2.isSelected()==true && a>=1500) && !jTextField1.getText().equals("") && !jTextField5.getText().equals("") && !jTextField6.getText().equals("") && !jLabel1.getText().equals("") && !jTextField4.getText().equals("") && !jTextArea2.getText().equals("")&& !jTextArea3.getText().equals("") && (jRadioButton1.isSelected() || jRadioButton2.isSelected()) && (jRadioButton3.isSelected() || jRadioButton4.isSelected())) + {Connection myconnection; + a=Integer.parseInt(jTextField1.getText()); +String filename=""; + + if(myfile!=null){ + filename = "Images\\"+new java.util.Date().getTime() + "_" + myfile.getName();//Date.getTime() added for unique file name. + int i; + FileInputStream rd = null; + FileOutputStream outs = null; + try { + + rd = new FileInputStream(myfile); + outs = new FileOutputStream(filename);//writing the new file in 'Images' folder, in the project + + byte[] b = new byte[2048]; + while ((i = rd.read(b)) > 0) { + outs.write(b, 0, i); + + } + JOptionPane.showMessageDialog(rootPane, "File saved"); + } catch (Exception e) { + JOptionPane.showMessageDialog(rootPane, "error" + e.getMessage()); + } finally { + try { + rd.close(); + outs.close(); + } catch (Exception e) { + JOptionPane.showMessageDialog(rootPane, "error in closing file" + e.getMessage()); + } + } + }else + { + filename="Images\\default.png"; + + } + sno=jLabel1.getText(); + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="insert into smartcard values(?,?,?,?,?,?,?,?,?,?,?,?)"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jLabel1.getText()); + mystatement.setString(2, jTextField5.getText()); + mystatement.setString(3, jTextField6.getText()); + if(jRadioButton3.isSelected()) + mystatement.setString(4, "Male"); + else if(jRadioButton4.isSelected()) + mystatement.setString(4, "Female"); + mystatement.setString(5, jTextField4.getText()); + mystatement.setString(6, jTextArea2.getText()); + mystatement.setString(7, jTextArea3.getText()); + mystatement.setString(8, filename); + if(jRadioButton1.isSelected()) + mystatement.setString(9, "standard"); + else if(jRadioButton2.isSelected()) + mystatement.setString(9, "premium"); + + + mystatement.setString(10, jTextField1.getText()); + + SimpleDateFormat myFormat; + myFormat = new SimpleDateFormat("yyyy-MM-dd "); + java.util.Date date = new java.util.Date(); + mystatement.setString(11, myFormat.format(date)); + Calendar c= Calendar.getInstance(); + c.setTime(date); + c.add(Calendar.DAY_OF_YEAR,365); + mystatement.setString(12, myFormat.format(c.getTime())); + + if( mystatement.executeUpdate()>0 ) + { + JOptionPane.showMessageDialog(rootPane, "Smart card made successfully"); + generatecardNo(); + Cashreciept obj=new Cashreciept(); + mainframe.jDesktopPane1.add(obj); + obj.setVisible(true); + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + } + else + { + JOptionPane.showMessageDialog(rootPane, "less intial balance than the required balance according to card type/ all fields are not filled."); + } + }//GEN-LAST:event_jButton2ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + jTabbedPane1.setSelectedIndex(1); + }//GEN-LAST:event_jButton3ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.ButtonGroup buttonGroup1; + private javax.swing.ButtonGroup buttonGroup2; + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel14; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JRadioButton jRadioButton1; + private javax.swing.JRadioButton jRadioButton2; + private javax.swing.JRadioButton jRadioButton3; + private javax.swing.JRadioButton jRadioButton4; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JScrollPane jScrollPane3; + private javax.swing.JTabbedPane jTabbedPane1; + private javax.swing.JTextArea jTextArea2; + private javax.swing.JTextArea jTextArea3; + private javax.swing.JTextField jTextField1; + private javax.swing.JTextField jTextField4; + private javax.swing.JTextField jTextField5; + private javax.swing.JTextField jTextField6; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/newsmartcard.png b/projects/Metro_systems-master/metro_system/newsmartcard.png new file mode 100644 index 0000000..cbeb31d Binary files /dev/null and b/projects/Metro_systems-master/metro_system/newsmartcard.png differ diff --git a/projects/Metro_systems-master/metro_system/searchsartcard.jpeg b/projects/Metro_systems-master/metro_system/searchsartcard.jpeg new file mode 100644 index 0000000..b5d4451 Binary files /dev/null and b/projects/Metro_systems-master/metro_system/searchsartcard.jpeg differ diff --git a/projects/Metro_systems-master/metro_system/smartcardfinal.jpeg b/projects/Metro_systems-master/metro_system/smartcardfinal.jpeg new file mode 100644 index 0000000..8aea520 Binary files /dev/null and b/projects/Metro_systems-master/metro_system/smartcardfinal.jpeg differ diff --git a/projects/Metro_systems-master/metro_system/station.jpeg b/projects/Metro_systems-master/metro_system/station.jpeg new file mode 100644 index 0000000..fd59caa Binary files /dev/null and b/projects/Metro_systems-master/metro_system/station.jpeg differ diff --git a/projects/Metro_systems-master/metro_system/token.form b/projects/Metro_systems-master/metro_system/token.form new file mode 100644 index 0000000..2bede23 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/token.form @@ -0,0 +1,254 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/token.java b/projects/Metro_systems-master/metro_system/token.java new file mode 100644 index 0000000..2d30416 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/token.java @@ -0,0 +1,387 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.print.PageFormat; +import java.awt.print.Printable; +import static java.awt.print.Printable.NO_SUCH_PAGE; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.SimpleDateFormat; +import javax.swing.JFrame; + +import javax.swing.JOptionPane; + + +/** + * + * @author sparsh + */ +public class token extends javax.swing.JInternalFrame implements convar ,Printable{ + + /** + * Creates new form token + */ + public token() { + initComponents(); + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from faretable where route1=? and stn1=? and route2=? and stn2=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, tokensearch.s[0]); + mystatement.setString(2, tokensearch.s[1]); + mystatement.setString(3, tokensearch.s[2]); + mystatement.setString(4, tokensearch.s[3]); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { Integer tf=(tokensearch.n*Integer.parseInt(myres.getString("fare"))); + + jLabel9.setText(tokensearch.s[0]); + jLabel10.setText(tokensearch.s[1]); + jLabel11.setText(tokensearch.s[2]); + jLabel12.setText(tokensearch.s[3]); + jLabel15.setText(String.valueOf(tokensearch.n)); + jLabel17.setText(tf.toString()); + jLabel13.setText(myres.getString("fare")); + jLabel19.setText(myres.getString(6)); + jLabel20.setText(myres.getString(7)); + jLabel21.setText(myres.getString(8)); + + SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); + //get current date time with Date() + java.util.Date date = new java.util.Date(); + jLabel23.setText(dateFormat.format(date)); + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel5 = new javax.swing.JLabel(); + jLabel1 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jLabel9 = new javax.swing.JLabel(); + jLabel10 = new javax.swing.JLabel(); + jLabel11 = new javax.swing.JLabel(); + jLabel12 = new javax.swing.JLabel(); + jLabel13 = new javax.swing.JLabel(); + jLabel19 = new javax.swing.JLabel(); + jLabel20 = new javax.swing.JLabel(); + jLabel21 = new javax.swing.JLabel(); + jLabel22 = new javax.swing.JLabel(); + jLabel23 = new javax.swing.JLabel(); + jLabel14 = new javax.swing.JLabel(); + jLabel15 = new javax.swing.JLabel(); + jLabel16 = new javax.swing.JLabel(); + jLabel17 = new javax.swing.JLabel(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + setTitle("Token Booking"); + + jLabel5.setText("Mins."); + + jLabel1.setText("From"); + + jLabel6.setText("Distance"); + + jLabel2.setText("To:"); + + jLabel7.setText("Kms."); + + jLabel8.setText("Stations in between"); + + jButton1.setText("BOOK"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel3.setText("Fare (Rs.)"); + + jLabel4.setText("Travelling Time"); + + jLabel22.setText("Booking date"); + + jLabel14.setText("Number of ticket(s)"); + + jLabel16.setText("Total fare(Rs.)"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(43, 43, 43)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(35, 35, 35) + .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 335, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 335, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addGap(168, 168, 168) + .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(241, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE) + .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel23, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE) + .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, 0) + .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE)) + .addGap(79, 79, 79)))) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(28, 28, 28) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(45, 45, 45) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(64, 64, 64) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE) + .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(34, 34, 34) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE) + .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(21, 21, 21) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(layout.createSequentialGroup() + .addGap(18, 18, 18) + .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(35, 35, 35) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel23, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(32, 32, 32)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + Connection myconnection; + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="insert into bookingtoken(`route1`, `stn1`, `route2`, `stn2`, `fare`, `no_of_tckt`, `totalfare`, `trvl_time`, `dist`, `stn_bw`, `bookingdate`) values(?,?,?,?,?,?,?,?,?,?,?)"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jLabel9.getText()); + mystatement.setString(2, jLabel10.getText()); + mystatement.setString(3, jLabel11.getText()); + mystatement.setString(4, jLabel12.getText()); + mystatement.setString(5, jLabel13.getText()); + mystatement.setString(6, jLabel15.getText()); + mystatement.setString(7, jLabel17.getText()); + + mystatement.setString(8, jLabel19.getText()); + mystatement.setString(9, jLabel20.getText()); + mystatement.setString(10, jLabel21.getText()); + + SimpleDateFormat myFormat; + myFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + java.util.Date date = new java.util.Date(); + mystatement.setString(11, myFormat.format(date)); + + if( mystatement.executeUpdate()>0 ) + { + JOptionPane.showMessageDialog(rootPane, "Token booked successfully"); + + } + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + jButton1.setVisible(false); + JFrame yourComponent = new JFrame(); +PrinterJob pjob = PrinterJob.getPrinterJob(); +PageFormat preformat = pjob.defaultPage(); +preformat.setOrientation(PageFormat.LANDSCAPE); +PageFormat postformat = pjob.pageDialog(preformat); +//If user does not hit cancel then print. +if (preformat != postformat) { + //Set print component + pjob.setPrintable(this, postformat); + if (pjob.printDialog()) { + try { + pjob.print(); + } catch (PrinterException ex) { + //Logger.getLogger(newmember.class.getName()).log(Level.SEVERE, null, ex); + } + } +}// TODO add your handling code here: +jButton1.setVisible(true); + }//GEN-LAST:event_jButton1ActionPerformed + public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { + if (pageIndex > 0) { /* We have only one page, and 'page' is zero-based */ + return NO_SUCH_PAGE; + } + + // get the bounds of the component + Dimension dim = this.getSize(); + double cHeight = dim.getHeight(); + double cWidth = dim.getWidth(); + + // get the bounds of the printable area + double pHeight = pageFormat.getImageableHeight(); + double pWidth = pageFormat.getImageableWidth(); + + double pXStart = pageFormat.getImageableX(); + double pYStart = pageFormat.getImageableY(); + + double xRatio = pWidth / cWidth; + double yRatio = pHeight / cHeight; + + + Graphics2D g2 = (Graphics2D) graphics; + g2.translate(pXStart, pYStart); + g2.scale(xRatio, yRatio); + this.paint(g2); + + return Printable.PAGE_EXISTS; +} + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel14; + private javax.swing.JLabel jLabel15; + private javax.swing.JLabel jLabel16; + private javax.swing.JLabel jLabel17; + private javax.swing.JLabel jLabel19; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel20; + private javax.swing.JLabel jLabel21; + private javax.swing.JLabel jLabel22; + private javax.swing.JLabel jLabel23; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/tokenbook.jpeg b/projects/Metro_systems-master/metro_system/tokenbook.jpeg new file mode 100644 index 0000000..c898c66 Binary files /dev/null and b/projects/Metro_systems-master/metro_system/tokenbook.jpeg differ diff --git a/projects/Metro_systems-master/metro_system/tokenbookedsearch.form b/projects/Metro_systems-master/metro_system/tokenbookedsearch.form new file mode 100644 index 0000000..da00dd5 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/tokenbookedsearch.form @@ -0,0 +1,285 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/projects/Metro_systems-master/metro_system/tokenbookedsearch.java b/projects/Metro_systems-master/metro_system/tokenbookedsearch.java new file mode 100644 index 0000000..2c04295 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/tokenbookedsearch.java @@ -0,0 +1,531 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import javax.swing.JOptionPane; +import javax.swing.JTable; +import javax.swing.table.DefaultTableModel; +import static metro_system.convar.password; +import static metro_system.convar.path; +import static metro_system.convar.place; +import static metro_system.convar.username; + +/** + * + * @author sparsh + */ +public class tokenbookedsearch extends javax.swing.JInternalFrame implements convar{ + + static String s[]=new String[4]; + static Integer n; + /** + * Creates new form tokensearch + */ + public tokenbookedsearch() { + initComponents(); + jDateChooser1.setDate(null); + + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from routetable"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { + do + { + jComboBox3.addItem(myres.getString("route")); + jComboBox2.addItem(myres.getString("route")); + } + while(myres.next()); + + + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel2 = new javax.swing.JLabel(); + jComboBox3 = new javax.swing.JComboBox<>(); + jComboBox4 = new javax.swing.JComboBox<>(); + jComboBox5 = new javax.swing.JComboBox<>(); + jLabel1 = new javax.swing.JLabel(); + jComboBox2 = new javax.swing.JComboBox<>(); + jButton1 = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jDateChooser1 = new com.toedter.calendar.JDateChooser(); + jScrollPane1 = new javax.swing.JScrollPane(); + jTable1 = new javax.swing.JTable(); + jLabel6 = new javax.swing.JLabel(); + jTextField3 = new javax.swing.JTextField(); + jButton2 = new javax.swing.JButton(); + + setClosable(true); + setIconifiable(true); + setMaximizable(true); + setResizable(true); + setTitle("Ticket searching"); + + jLabel2.setText("To:"); + + jComboBox3.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose Route" })); + jComboBox3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox3ActionPerformed(evt); + } + }); + + jComboBox4.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "choose route first" })); + + jComboBox5.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "choose route first" })); + + jLabel1.setText("From"); + + jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose route" })); + jComboBox2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox2ActionPerformed(evt); + } + }); + + jButton1.setText("Search"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel3.setText("Total tickets booked"); + + jLabel4.setText("Date"); + + jTextField1.setEditable(false); + + jTable1.setAutoCreateRowSorter(true); + jTable1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(51, 51, 51), new java.awt.Color(0, 102, 255), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 255))); + jTable1.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + + }, + new String [] { + "Number of tickets", "Total fare", "Date", "From", "To" + } + )); + jTable1.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jTable1MouseClicked(evt); + } + }); + jScrollPane1.setViewportView(jTable1); + + jLabel6.setText("Total rows"); + + jTextField3.setEditable(false); + jTextField3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField3ActionPerformed(evt); + } + }); + + jButton2.setText("Print"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(22, 22, 22) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(60, 60, 60) + .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(60, 60, 60) + .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(12, 12, 12) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(35, 35, 35) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addGroup(layout.createSequentialGroup() + .addGap(74, 74, 74) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(60, 60, 60) + .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE))))) + .addGap(70, 70, 70) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(57, 57, 57)) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane1))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(42, 57, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(33, 33, 33) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(68, 68, 68) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(16, 16, 16)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18))) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, 0)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jComboBox3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox3ActionPerformed + Connection myconnection; + + if(jComboBox3.getSelectedIndex()>0){ + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from stationtable where route=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox3.getSelectedItem().toString()); + + ResultSet myres = mystatement.executeQuery(); + jComboBox5.removeAllItems(); + jComboBox5.addItem("choose station"); + if(myres.next()) + { + do + { + jComboBox5.addItem(myres.getString("stn_name")); + + } + while(myres.next()); + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + else{ + jComboBox5.addItem("choose route first"); + } // TODO add your handling code here: + }//GEN-LAST:event_jComboBox3ActionPerformed + + private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed + Connection myconnection; + + if(jComboBox2.getSelectedIndex()>0){ + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from stationtable where route=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox2.getSelectedItem().toString()); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { jComboBox4.removeAllItems(); + jComboBox4.addItem("choose station"); + do + { + jComboBox4.addItem(myres.getString("stn_name")); + + } + while(myres.next()); + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + else{ + jComboBox4.addItem("choose route first"); + } + }//GEN-LAST:event_jComboBox2ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + SimpleDateFormat myformat=new SimpleDateFormat("yyyy-MM-dd"); + + + + try{ + Connection myconnection = DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from bookingtoken where route1 like ? and stn1 like ? and route2 like ? and stn2 like ? and bookingdate like ?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); +// mystatement.setString(1, "%"+jTextField1.getText()+"%"); +// mystatement.setString(2, "%"+jTextField2.getText()+"%"); +// + if(jComboBox2.getSelectedIndex()>0) + s[0] = jComboBox2.getSelectedItem().toString(); + else + s[0]="%"; + if(jComboBox4.getSelectedIndex()>0) + s[1] = jComboBox4.getSelectedItem().toString(); + else + s[1]="%"; + if(jComboBox3.getSelectedIndex()>0) + s[2] = jComboBox3.getSelectedItem().toString(); + else + s[2]="%"; + if(jComboBox5.getSelectedIndex()>0) + s[3] = jComboBox5.getSelectedItem().toString(); + else + s[3]="%"; + + mystatement.setString(1, s[0]); + mystatement.setString(2, s[1]); + mystatement.setString(3, s[2]); + mystatement.setString(4, s[3]); + + // SimpleDateFormat myformat=new SimpleDateFormat("yyyy-MM-dd"); + if(jDateChooser1.getDate()!=null) + mystatement.setString(5, "%"+myformat.format(jDateChooser1.getDate()) + "%"); + else + mystatement.setString(5, "%"); + + ResultSet myres=mystatement.executeQuery(); + DefaultTableModel mymodel=(DefaultTableModel) jTable1.getModel(); + if(myres.next()) + { + mymodel.setRowCount(0); + do{ + String smrt,bookno,date,from,to; + smrt=myres.getString(6); + bookno=myres.getString(7); + date=myres.getString(11); + from=myres.getString(1) +" , "+myres.getString(2); + to=myres.getString(3) +" , "+myres.getString(4); + mymodel.addRow(new Object[]{smrt,bookno,date,from,to}); + } + while(myres.next()); + + int row=jTable1.getRowCount(); + jTextField3.setText(String.valueOf(row)); + } + else{ + mymodel.setRowCount(0); + int row=jTable1.getRowCount(); + jTextField3.setText(String.valueOf(row)); + } + + + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + try{ + Connection myconnection = DriverManager.getConnection(path+place, username, password); + try + { + + String query1="select sum(no_of_tckt) from bookingtoken where route1 like ? and stn1 like ? and route2 like ? and stn2 like ? and bookingdate like ?"; + PreparedStatement mystatement1=myconnection.prepareStatement(query1); +// mystatement.setString(1, "%"+jTextField1.getText()+"%"); +// mystatement.setString(2, "%"+jTextField2.getText()+"%"); +// + + + mystatement1.setString(1, s[0]); + mystatement1.setString(2, s[1]); + mystatement1.setString(3, s[2]); + mystatement1.setString(4, s[3]); + + // SimpleDateFormat myformat=new SimpleDateFormat("yyyy-MM-dd"); + if(jDateChooser1.getDate()!=null) + mystatement1.setString(5, "%"+myformat.format(jDateChooser1.getDate()) + "%"); + else + mystatement1.setString(5, "%"); + + ResultSet myres1=mystatement1.executeQuery(); + // DefaultTableModel mymodel=(DefaultTableModel) jTable1.getModel(); + if(myres1.next()) + { + jTextField1.setText(myres1.getString(1)); + + } + + + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + + + + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jTextField3ActionPerformed + + private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked + // TODO add your handling code here: + }//GEN-LAST:event_jTable1MouseClicked + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + try { + MessageFormat headerFormat = new MessageFormat("Page {0}"); + MessageFormat footerFormat = new MessageFormat("- {0} -"); + jTable1.print(JTable.PrintMode.FIT_WIDTH, headerFormat, footerFormat); + } + catch (Exception pe) + { + System.err.println("Error printing: " + pe.getMessage()); + } + }//GEN-LAST:event_jButton2ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JComboBox jComboBox2; + private javax.swing.JComboBox jComboBox3; + private javax.swing.JComboBox jComboBox4; + private javax.swing.JComboBox jComboBox5; + private com.toedter.calendar.JDateChooser jDateChooser1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel6; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTable jTable1; + private javax.swing.JTextField jTextField1; + private javax.swing.JTextField jTextField3; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/tokenbookedsearch.png b/projects/Metro_systems-master/metro_system/tokenbookedsearch.png new file mode 100644 index 0000000..45af3fe Binary files /dev/null and b/projects/Metro_systems-master/metro_system/tokenbookedsearch.png differ diff --git a/projects/Metro_systems-master/metro_system/tokensearch.form b/projects/Metro_systems-master/metro_system/tokensearch.form new file mode 100644 index 0000000..30dfa92 --- /dev/null +++ b/projects/Metro_systems-master/metro_system/tokensearch.form @@ -0,0 +1,166 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/Metro_systems-master/metro_system/tokensearch.java b/projects/Metro_systems-master/metro_system/tokensearch.java new file mode 100644 index 0000000..ef9b72a --- /dev/null +++ b/projects/Metro_systems-master/metro_system/tokensearch.java @@ -0,0 +1,297 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package metro_system; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import javax.swing.JOptionPane; + +/** + * + * @author sparsh + */ +public class tokensearch extends javax.swing.JInternalFrame implements convar{ + + static String s[]=new String[4]; + static Integer n; + /** + * Creates new form tokensearch + */ + public tokensearch() { + initComponents(); + Integer a=1; + jSpinner1.setValue(a); + Connection myconnection; + + + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from routetable"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + ResultSet myres = mystatement.executeQuery(); + if(myres.next()) + { + do + { + jComboBox3.addItem(myres.getString("route")); + jComboBox2.addItem(myres.getString("route")); + } + while(myres.next()); + + + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel2 = new javax.swing.JLabel(); + jComboBox3 = new javax.swing.JComboBox<>(); + jComboBox4 = new javax.swing.JComboBox<>(); + jComboBox5 = new javax.swing.JComboBox<>(); + jLabel1 = new javax.swing.JLabel(); + jComboBox2 = new javax.swing.JComboBox<>(); + jButton1 = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + jSpinner1 = new javax.swing.JSpinner(); + + setClosable(true); + setIconifiable(true); + + jLabel2.setText("To:"); + + jComboBox3.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose Route" })); + jComboBox3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox3ActionPerformed(evt); + } + }); + + jComboBox4.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "choose route first" })); + + jComboBox5.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "choose route first" })); + + jLabel1.setText("From"); + + jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Choose route" })); + jComboBox2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox2ActionPerformed(evt); + } + }); + + jButton1.setText("Proceed"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel3.setText("Number of person(s)"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(22, 22, 22) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jComboBox3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jComboBox4, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(43, 43, 43)) + .addGroup(layout.createSequentialGroup() + .addGap(71, 71, 71) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(99, 99, 99) + .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(0, 30, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(45, 45, 45) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(80, 80, 80) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(72, 72, 72) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(172, 172, 172)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jComboBox3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox3ActionPerformed + Connection myconnection; + + if(jComboBox3.getSelectedIndex()>0){ + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from stationtable where route=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox3.getSelectedItem().toString()); + + ResultSet myres = mystatement.executeQuery(); + jComboBox5.removeAllItems(); + jComboBox5.addItem("choose station"); + if(myres.next()) + { + do + { + jComboBox5.addItem(myres.getString("stn_name")); + + } + while(myres.next()); + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + else{ + jComboBox5.addItem("choose route first"); + } // TODO add your handling code here: + }//GEN-LAST:event_jComboBox3ActionPerformed + + private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed + Connection myconnection; + + if(jComboBox2.getSelectedIndex()>0){ + try{ + myconnection =DriverManager.getConnection(path+place, username, password); + try + { + String query="select * from stationtable where route=?"; + PreparedStatement mystatement=myconnection.prepareStatement(query); + mystatement.setString(1, jComboBox2.getSelectedItem().toString()); + ResultSet myres = mystatement.executeQuery(); + jComboBox4.removeAllItems(); + jComboBox4.addItem("choose station"); + if(myres.next()) + { + do + { + jComboBox4.addItem(myres.getString("stn_name")); + + } + while(myres.next()); + + } + } + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Error:"+e.getMessage()); + } + finally + { + myconnection.close(); + } + } + + catch(Exception e) + { + JOptionPane.showMessageDialog(rootPane, "Connection Error:"+e.getMessage()); + } + } + else{ + jComboBox4.addItem("choose route first"); + } + }//GEN-LAST:event_jComboBox2ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + if(jComboBox2.getSelectedIndex()>0 && jComboBox3.getSelectedIndex()>0 && jComboBox4.getSelectedIndex()>0 && jComboBox5.getSelectedIndex()>0 ) + { + s[0] = jComboBox2.getSelectedItem().toString(); + s[1] = jComboBox4.getSelectedItem().toString(); + s[2] = jComboBox3.getSelectedItem().toString(); + s[3] = jComboBox5.getSelectedItem().toString(); + n=Integer.parseInt(jSpinner1.getValue().toString()); + token obj=new token(); + mainframe.jDesktopPane1.add(obj); + obj.setVisible(true); + } + else{ + JOptionPane.showMessageDialog(rootPane, "Please select appropriate option"); + + } + + + }//GEN-LAST:event_jButton1ActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JComboBox jComboBox2; + private javax.swing.JComboBox jComboBox3; + private javax.swing.JComboBox jComboBox4; + private javax.swing.JComboBox jComboBox5; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JSpinner jSpinner1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/Metro_systems-master/metro_system/train-search.png b/projects/Metro_systems-master/metro_system/train-search.png new file mode 100644 index 0000000..6a9c4dc Binary files /dev/null and b/projects/Metro_systems-master/metro_system/train-search.png differ diff --git a/projects/Metro_systems-master/smartcardbill.oxps b/projects/Metro_systems-master/smartcardbill.oxps new file mode 100644 index 0000000..2ab78ed Binary files /dev/null and b/projects/Metro_systems-master/smartcardbill.oxps differ diff --git a/projects/Metro_systems-master/tokenticket.oxps b/projects/Metro_systems-master/tokenticket.oxps new file mode 100644 index 0000000..d8eba91 Binary files /dev/null and b/projects/Metro_systems-master/tokenticket.oxps differ diff --git a/projects/PassBox-master/.gitignore b/projects/PassBox-master/.gitignore new file mode 100644 index 0000000..32858aa --- /dev/null +++ b/projects/PassBox-master/.gitignore @@ -0,0 +1,12 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* diff --git a/projects/PassBox-master/LICENSE b/projects/PassBox-master/LICENSE new file mode 100644 index 0000000..7f7f95a --- /dev/null +++ b/projects/PassBox-master/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 İSMAİL TAŞDELEN + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/projects/PassBox-master/README.md b/projects/PassBox-master/README.md new file mode 100644 index 0000000..ec3abc0 --- /dev/null +++ b/projects/PassBox-master/README.md @@ -0,0 +1,13 @@ +# PassBox + +#### Password Management Tools | Open Source Project + +#### Programming Languages : + +* Java + +#### Development Tools : + +* Java SDK + +* NetBeans IDE \ No newline at end of file diff --git a/projects/PassBox-master/build.xml b/projects/PassBox-master/build.xml new file mode 100644 index 0000000..dd6d4d8 --- /dev/null +++ b/projects/PassBox-master/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project PassBox. + + + diff --git a/projects/PassBox-master/build/built-jar.properties b/projects/PassBox-master/build/built-jar.properties new file mode 100644 index 0000000..416c923 --- /dev/null +++ b/projects/PassBox-master/build/built-jar.properties @@ -0,0 +1,4 @@ +#Tue, 25 Apr 2017 23:17:15 +0300 + + +C\:\\Users\\q\\Downloads\\PassBox\\PassBox\\PassBox= diff --git a/projects/PassBox-master/build/classes/.netbeans_automatic_build b/projects/PassBox-master/build/classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/projects/PassBox-master/build/classes/.netbeans_update_resources b/projects/PassBox-master/build/classes/.netbeans_update_resources new file mode 100644 index 0000000..e69de29 diff --git a/projects/PassBox-master/build/classes/About_Us_Page.form b/projects/PassBox-master/build/classes/About_Us_Page.form new file mode 100644 index 0000000..cd74734 --- /dev/null +++ b/projects/PassBox-master/build/classes/About_Us_Page.form @@ -0,0 +1,106 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/PassBox-master/build/classes/Contact_Me_Page.form b/projects/PassBox-master/build/classes/Contact_Me_Page.form new file mode 100644 index 0000000..e2adc5b --- /dev/null +++ b/projects/PassBox-master/build/classes/Contact_Me_Page.form @@ -0,0 +1,174 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/PassBox-master/build/classes/Create_a_New_Account_Page.form b/projects/PassBox-master/build/classes/Create_a_New_Account_Page.form new file mode 100644 index 0000000..4033f69 --- /dev/null +++ b/projects/PassBox-master/build/classes/Create_a_New_Account_Page.form @@ -0,0 +1,235 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/PassBox-master/build/classes/Database_View.form b/projects/PassBox-master/build/classes/Database_View.form new file mode 100644 index 0000000..3da8f1f --- /dev/null +++ b/projects/PassBox-master/build/classes/Database_View.form @@ -0,0 +1,97 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + +
+
+
+
+ + + + + + + + + + + +
+
diff --git a/projects/PassBox-master/build/classes/Delete_Password_Page.form b/projects/PassBox-master/build/classes/Delete_Password_Page.form new file mode 100644 index 0000000..686ce7b --- /dev/null +++ b/projects/PassBox-master/build/classes/Delete_Password_Page.form @@ -0,0 +1,173 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/PassBox-master/build/classes/Forgot_Account_Page.form b/projects/PassBox-master/build/classes/Forgot_Account_Page.form new file mode 100644 index 0000000..4750362 --- /dev/null +++ b/projects/PassBox-master/build/classes/Forgot_Account_Page.form @@ -0,0 +1,116 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/projects/PassBox-master/build/classes/Home.form b/projects/PassBox-master/build/classes/Home.form new file mode 100644 index 0000000..a19299e --- /dev/null +++ b/projects/PassBox-master/build/classes/Home.form @@ -0,0 +1,79 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/PassBox-master/build/classes/Log_Control_Page.form b/projects/PassBox-master/build/classes/Log_Control_Page.form new file mode 100644 index 0000000..3e3e091 --- /dev/null +++ b/projects/PassBox-master/build/classes/Log_Control_Page.form @@ -0,0 +1,138 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + <Editor/> + <Renderer/> + </Column> + <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> + <Title/> + <Editor/> + <Renderer/> + </Column> + <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> + <Title/> + <Editor/> + <Renderer/> + </Column> + <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> + <Title/> + <Editor/> + <Renderer/> + </Column> + <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> + <Title/> + <Editor/> + <Renderer/> + </Column> + </TableColumnModel> + </Property> + <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor"> + <TableHeader reorderingAllowed="true" resizingAllowed="true"/> + </Property> + </Properties> + </Component> + </SubComponents> + </Container> + <Component class="javax.swing.JButton" name="turnback_button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="turnback_buttonActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="deletealllogs_button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/password_delete_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Delete All Logs"/> + </Properties> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/build/classes/Login_Page.form b/projects/PassBox-master/build/classes/Login_Page.form new file mode 100644 index 0000000..2837b6c --- /dev/null +++ b/projects/PassBox-master/build/classes/Login_Page.form @@ -0,0 +1,251 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | Login Panel"/> + <Property name="alwaysOnTop" type="boolean" value="true"/> + <Property name="focusTraversalPolicyProvider" type="boolean" value="true"/> + <Property name="locationByPlatform" type="boolean" value="true"/> + <Property name="name" type="java.lang.String" value="PassBox" noResource="true"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_Login_Panel_Button_Logo" min="-2" pref="326" max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" pref="135" max="-2" attributes="0"/> + <Component id="jLabel_Login_Panel_PassBox_Name" min="-2" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace type="separate" max="-2" attributes="0"/> + <Component id="jPanel_Login_Page" max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jPanel_Login_Page" min="-2" pref="354" max="-2" attributes="0"/> + <Group type="102" attributes="0"> + <Component id="jButton_Login_Panel_Button_Logo" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jLabel_Login_Panel_PassBox_Name" min="-2" pref="22" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Container class="javax.swing.JPanel" name="jPanel_Login_Page"> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" max="-2" attributes="0"> + <Component id="jButton_Login_Page_Login_Button" alignment="0" max="32767" attributes="0"/> + <Group type="102" attributes="0"> + <Group type="103" groupAlignment="1" attributes="0"> + <Component id="jLabel_Login_Page_username" min="-2" max="-2" attributes="0"/> + <Component id="jLabel_Login_Panel_password" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="username_txt" max="32767" attributes="0"/> + <Component id="password_txt" max="32767" attributes="0"/> + </Group> + </Group> + <Component id="jButton_Login_Page_Create_New_Account" max="32767" attributes="0"/> + <Component id="jButton_Login_Page_Exit_Button" max="32767" attributes="0"/> + <Component id="jButton_Login_Page_Forgot_Account_Button" max="32767" attributes="0"/> + <Component id="jButton_Login_Page_Contact_Me" max="32767" attributes="0"/> + </Group> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace min="-2" pref="14" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel_Login_Page_username" alignment="3" max="-2" attributes="0"/> + <Component id="username_txt" alignment="3" min="-2" pref="35" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel_Login_Panel_password" alignment="3" min="-2" pref="30" max="-2" attributes="0"/> + <Component id="password_txt" alignment="3" min="-2" pref="35" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_Login_Page_Login_Button" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_Login_Page_Forgot_Account_Button" min="-2" max="-2" attributes="0"/> + <EmptySpace max="32767" attributes="0"/> + <Component id="jButton_Login_Page_Create_New_Account" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_Login_Page_Contact_Me" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_Login_Page_Exit_Button" min="-2" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="56" max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="jLabel_Login_Page_username"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Username : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel_Login_Panel_password"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Password : "/> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton_Login_Page_Login_Button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/login_button.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Login"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_Login_Page_Login_ButtonActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_Login_Page_Create_New_Account"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/register_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Create a New Account"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_Login_Page_Create_New_AccountActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_Login_Page_Exit_Button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/exit_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Exit"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_Login_Page_Exit_ButtonActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_Login_Page_Forgot_Account_Button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/forgot_password.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Forgot account ?"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_Login_Page_Forgot_Account_ButtonActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JTextField" name="username_txt"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JPasswordField" name="password_txt"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton_Login_Page_Contact_Me"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/contact_us.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Contact Me"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_Login_Page_Contact_MeActionPerformed"/> + </Events> + </Component> + </SubComponents> + </Container> + <Component class="javax.swing.JButton" name="jButton_Login_Panel_Button_Logo"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + <Property name="disabledIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + <Property name="pressedIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + <Property name="rolloverIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel_Login_Panel_PassBox_Name"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="PassBox"/> + </Properties> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/build/classes/Management_Password_Page.form b/projects/PassBox-master/build/classes/Management_Password_Page.form new file mode 100644 index 0000000..dcec0cd --- /dev/null +++ b/projects/PassBox-master/build/classes/Management_Password_Page.form @@ -0,0 +1,157 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | Management Password Page"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_new_add_password_logo" min="-2" pref="413" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jButton_new_password_add" alignment="1" pref="298" max="32767" attributes="0"/> + <Component id="jButton_password_delete" alignment="1" max="32767" attributes="0"/> + <Component id="jButton_database_view" alignment="1" max="32767" attributes="0"/> + <Component id="jButton_TurnBack" alignment="0" max="32767" attributes="0"/> + <Component id="jButton1" alignment="0" max="32767" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jButton_new_add_password_logo" pref="418" max="32767" attributes="0"/> + <Group type="102" attributes="0"> + <Component id="jButton_new_password_add" min="-2" pref="68" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_password_delete" min="-2" pref="64" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton1" min="-2" pref="66" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_database_view" min="-2" pref="66" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="jButton_TurnBack" max="32767" attributes="0"/> + <EmptySpace min="-2" pref="10" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JButton" name="jButton_new_password_add"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/add_password_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="New Password Add"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verifyInputWhenFocusTarget" type="boolean" value="false"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_new_password_addActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_database_view"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/database_password_view_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Database View"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_database_viewActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_password_delete"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/password_delete_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Password Delete"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_password_deleteActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_new_add_password_logo"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton_TurnBack"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_TurnBackActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/database_update_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Password Update"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/build/classes/New_Password_Page.form b/projects/PassBox-master/build/classes/New_Password_Page.form new file mode 100644 index 0000000..ce658f3 --- /dev/null +++ b/projects/PassBox-master/build/classes/New_Password_Page.form @@ -0,0 +1,201 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | New Add Password "/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton2" min="-2" pref="320" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" attributes="0"> + <Component id="jLabel_socail_media_name" min="-2" max="-2" attributes="0"/> + <Component id="jLabel_username" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel_password" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel_email_address" alignment="1" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" max="-2" attributes="0"> + <Component id="password_txt" alignment="0" pref="205" max="32767" attributes="0"/> + <Component id="socail_media_name_txt" alignment="0" max="32767" attributes="0"/> + <Component id="username_txt" alignment="0" max="32767" attributes="0"/> + <Component id="email_address_txt" alignment="0" max="32767" attributes="0"/> + </Group> + </Group> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" pref="6" max="-2" attributes="0"/> + <Component id="jButton_TurnBack" min="-2" pref="151" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="jButton1" pref="166" max="32767" attributes="0"/> + </Group> + </Group> + <EmptySpace min="-2" max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="32767" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="1" attributes="0"> + <Component id="jButton2" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel_socail_media_name" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="socail_media_name_txt" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="username_txt" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel_username" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="password_txt" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel_password" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel_email_address" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="email_address_txt" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="67" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="jButton_TurnBack" pref="90" max="32767" attributes="0"/> + <Component id="jButton1" max="32767" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="11" max="-2" attributes="0"/> + </Group> + </Group> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="jLabel_socail_media_name"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Social Media Name : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel_username"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Username : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel_password"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Password : "/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="socail_media_name_txt"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="username_txt"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="password_txt"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/add_new_password_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="New Password Add"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="jLabel_email_address"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="E-Mail Address : "/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="email_address_txt"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton2"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton_TurnBack"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_TurnBackActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/build/classes/Software_Update_Page.form b/projects/PassBox-master/build/classes/Software_Update_Page.form new file mode 100644 index 0000000..df472a9 --- /dev/null +++ b/projects/PassBox-master/build/classes/Software_Update_Page.form @@ -0,0 +1,114 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | Software Update Page"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton1" min="-2" pref="325" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="github_button" pref="299" max="32767" attributes="0"/> + <Component id="jButton2" max="32767" attributes="0"/> + <Component id="turnback_button" alignment="0" max="32767" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="32767" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jButton1" min="-2" max="-2" attributes="0"/> + <Group type="102" attributes="0"> + <Component id="github_button" min="-2" pref="115" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="jButton2" min="-2" pref="115" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="13" max="-2" attributes="0"/> + <Component id="turnback_button" min="-2" pref="67" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="github_button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/github-logo.png"/> + </Property> + <Property name="text" type="java.lang.String" value="GitHub"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="github_buttonActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="turnback_button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="turnback_buttonActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton2"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/website.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Website"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/build/classes/Update_Password_Page.form b/projects/PassBox-master/build/classes/Update_Password_Page.form new file mode 100644 index 0000000..d873e4b --- /dev/null +++ b/projects/PassBox-master/build/classes/Update_Password_Page.form @@ -0,0 +1,197 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <NonVisualComponents> + <Component class="javax.swing.JSpinner" name="jSpinner1"> + </Component> + </NonVisualComponents> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton1" min="-2" pref="323" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Component id="jButton2" min="-2" pref="124" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton3" pref="153" max="32767" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Group type="103" groupAlignment="1" attributes="0"> + <Component id="jLabel2" min="-2" max="-2" attributes="0"/> + <Component id="jLabel1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel3" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel4" alignment="1" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jTextField1" max="32767" attributes="0"/> + <Component id="jTextField2" alignment="0" max="32767" attributes="0"/> + <Component id="jTextField3" max="32767" attributes="0"/> + <Component id="jTextField4" alignment="0" max="32767" attributes="0"/> + </Group> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton1" min="-2" max="-2" attributes="0"/> + <EmptySpace max="32767" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace max="32767" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jTextField1" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel2" min="-2" max="-2" attributes="0"/> + <Component id="jTextField2" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel3" min="-2" max="-2" attributes="0"/> + <Component id="jTextField3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel4" min="-2" max="-2" attributes="0"/> + <Component id="jTextField4" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="67" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="jButton2" max="32767" attributes="0"/> + <Component id="jButton3" pref="75" max="32767" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton2"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton3"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/database_update_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Update Password"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton3ActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Socail Media Name : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel2"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Username : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel3"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Password : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel4"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Email Address : "/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField2"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField3"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField4"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/build/classes/User_Control_Panel_Page.form b/projects/PassBox-master/build/classes/User_Control_Panel_Page.form new file mode 100644 index 0000000..8d9c178 --- /dev/null +++ b/projects/PassBox-master/build/classes/User_Control_Panel_Page.form @@ -0,0 +1,280 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <NonVisualComponents> + <Component class="javax.swing.JButton" name="jButton7"> + <Properties> + <Property name="text" type="java.lang.String" value="jButton7"/> + </Properties> + </Component> + </NonVisualComponents> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | User Control Page"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jLabel_User_Control_Panel_Page_usercontrolpanel" min="-2" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="158" max="-2" attributes="0"/> + <Component id="jLabel2" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="giris_saati_label" min="-2" pref="222" max="-2" attributes="0"/> + <EmptySpace max="32767" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace max="32767" attributes="0"/> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="software_update_button" min="-2" pref="140" max="-2" attributes="0"/> + <Component id="jButton_UserEdit" min="-2" pref="140" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Component id="jButton_AboutUs" min="-2" pref="141" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_ContactMe" min="-2" pref="125" max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Component id="jButton_AddPassword" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_Database" min="-2" pref="125" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Component id="jButton_Exit" min="-2" pref="125" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="67" max="-2" attributes="0"/> + <Component id="jLabel1" min="-2" max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Component id="jButton1" min="-2" pref="124" max="-2" attributes="0"/> + <EmptySpace type="separate" max="-2" attributes="0"/> + <Component id="jButton4" min="-2" pref="134" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel_User_Control_Panel_Page_usercontrolpanel" alignment="3" min="-2" pref="42" max="-2" attributes="0"/> + <Component id="jLabel2" alignment="3" pref="47" max="32767" attributes="0"/> + <Component id="giris_saati_label" alignment="3" min="-2" pref="42" max="-2" attributes="0"/> + </Group> + <EmptySpace type="separate" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Component id="jButton4" min="-2" pref="90" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="jLabel1" min="-2" max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="jButton_UserEdit" max="32767" attributes="0"/> + <Component id="jButton_AddPassword" alignment="0" max="32767" attributes="0"/> + <Component id="jButton_Database" alignment="0" max="32767" attributes="0"/> + <Component id="jButton1" min="-2" pref="90" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" attributes="0"> + <Group type="103" alignment="1" groupAlignment="0" max="-2" attributes="0"> + <Component id="jButton_AboutUs" max="32767" attributes="0"/> + <Component id="jButton_ContactMe" alignment="0" max="32767" attributes="0"/> + <Component id="jButton_Exit" min="-2" pref="90" max="-2" attributes="0"/> + </Group> + <Component id="software_update_button" min="-2" pref="90" max="-2" attributes="0"/> + </Group> + </Group> + </Group> + <EmptySpace min="-2" pref="24" max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JButton" name="jButton_AboutUs"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/about_me_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="About Us"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_AboutUsActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_ContactMe"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/contact_me_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Contact Me"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ContactMeActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_Exit"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/exit_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Exit"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ExitActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="jLabel_User_Control_Panel_Page_usercontrolpanel"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="User Control Panel"/> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton_UserEdit"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/user_edit_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="User Edit"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_UserEditActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_Database"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/database_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Database"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_DatabaseActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_AddPassword"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/password_management_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Manage passwords"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_AddPasswordActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton4"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/default_user_ico.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="text" type="java.lang.String" value="........."/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel2"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="15" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="System Entry Time : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="giris_saati_label"> + <Properties> + <Property name="text" type="java.lang.String" value=" "/> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/log_file.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Log Control"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="software_update_button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/software-update.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Software Update"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="software_update_buttonActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/build/classes/User_Database_View_Page.form b/projects/PassBox-master/build/classes/User_Database_View_Page.form new file mode 100644 index 0000000..adad035 --- /dev/null +++ b/projects/PassBox-master/build/classes/User_Database_View_Page.form @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | User Database View"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jScrollPane1" pref="665" max="32767" attributes="0"/> + <Group type="102" alignment="0" attributes="0"> + <Component id="turnback_button" min="-2" pref="145" max="-2" attributes="0"/> + <EmptySpace min="0" pref="0" max="32767" attributes="0"/> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jScrollPane1" min="-2" pref="150" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="turnback_button" min="-2" pref="60" max="-2" attributes="0"/> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Container class="javax.swing.JScrollPane" name="jScrollPane1"> + <AuxValues> + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> + </AuxValues> + + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> + <SubComponents> + <Component class="javax.swing.JTable" name="table_userdatabasview"> + <Properties> + <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> + <Table columnCount="4" rowCount="4"> + <Column editable="true" title="Title 1" type="java.lang.Object"/> + <Column editable="true" title="Title 2" type="java.lang.Object"/> + <Column editable="true" title="Title 3" type="java.lang.Object"/> + <Column editable="true" title="Title 4" type="java.lang.Object"/> + </Table> + </Property> + </Properties> + </Component> + </SubComponents> + </Container> + <Component class="javax.swing.JButton" name="turnback_button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="turnback_buttonActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/build/classes/User_Edit_Page.form b/projects/PassBox-master/build/classes/User_Edit_Page.form new file mode 100644 index 0000000..c9589cb --- /dev/null +++ b/projects/PassBox-master/build/classes/User_Edit_Page.form @@ -0,0 +1,247 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | User Edit"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton2" min="-2" max="-2" attributes="0"/> + <EmptySpace min="18" pref="18" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Component id="jButton_TurnBack" min="-2" pref="100" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="18" max="-2" attributes="0"/> + <Component id="jButton1" min="-2" pref="99" max="-2" attributes="0"/> + <EmptySpace type="separate" max="-2" attributes="0"/> + <Component id="jButton_Update" pref="100" max="32767" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <Group type="103" groupAlignment="1" attributes="0"> + <Component id="jLabel2" min="-2" max="-2" attributes="0"/> + <Component id="jLabel1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel3" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel4" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel5" alignment="1" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="14" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="jTextField1" max="32767" attributes="0"/> + <Component id="jTextField2" max="32767" attributes="0"/> + <Component id="jPasswordField1" alignment="1" max="32767" attributes="0"/> + <Component id="jTextField3" max="32767" attributes="0"/> + <Component id="jTextField4" pref="175" max="32767" attributes="0"/> + </Group> + </Group> + </Group> + <EmptySpace min="-2" pref="19" max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Group type="103" groupAlignment="1" attributes="0"> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton2" max="32767" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace min="-2" pref="25" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jTextField1" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jTextField2" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jPasswordField1" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jTextField3" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jTextField4" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="16" pref="16" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jButton_Update" max="32767" attributes="0"/> + <Component id="jButton1" max="32767" attributes="0"/> + <Component id="jButton_TurnBack" alignment="0" max="32767" attributes="0"/> + </Group> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JButton" name="jButton_TurnBack"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_TurnBackActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_Update"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/database_update_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Update"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_UpdateActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/database_view_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="DB View"/> + <Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor"> + <Color id="Default Cursor"/> + </Property> + <Property name="hideActionText" type="boolean" value="true"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verifyInputWhenFocusTarget" type="boolean" value="false"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton2"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Full Name : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel2"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Username : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel3"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Password : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel4"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="E-Mail Address : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel5"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Mobile Number : "/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField2"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="enabled" type="boolean" value="false"/> + </Properties> + </Component> + <Component class="javax.swing.JPasswordField" name="jPasswordField1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField3"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField4"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/build/classes/ico/about_me_ico.png b/projects/PassBox-master/build/classes/ico/about_me_ico.png new file mode 100644 index 0000000..1cd68af Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/about_me_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/add_new_password_ico.png b/projects/PassBox-master/build/classes/ico/add_new_password_ico.png new file mode 100644 index 0000000..a833115 Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/add_new_password_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/add_password_ico.png b/projects/PassBox-master/build/classes/ico/add_password_ico.png new file mode 100644 index 0000000..464ac3e Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/add_password_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/contact_me_ico.png b/projects/PassBox-master/build/classes/ico/contact_me_ico.png new file mode 100644 index 0000000..5c67b82 Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/contact_me_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/contact_us.png b/projects/PassBox-master/build/classes/ico/contact_us.png new file mode 100644 index 0000000..537ae25 Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/contact_us.png differ diff --git a/projects/PassBox-master/build/classes/ico/database_ico.png b/projects/PassBox-master/build/classes/ico/database_ico.png new file mode 100644 index 0000000..15ed448 Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/database_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/database_password_view_ico.png b/projects/PassBox-master/build/classes/ico/database_password_view_ico.png new file mode 100644 index 0000000..2380dc8 Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/database_password_view_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/database_update_ico.png b/projects/PassBox-master/build/classes/ico/database_update_ico.png new file mode 100644 index 0000000..c7ae743 Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/database_update_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/database_view_ico.png b/projects/PassBox-master/build/classes/ico/database_view_ico.png new file mode 100644 index 0000000..ab1f55d Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/database_view_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/default_user_ico.png b/projects/PassBox-master/build/classes/ico/default_user_ico.png new file mode 100644 index 0000000..477d43c Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/default_user_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/exit_ico.png b/projects/PassBox-master/build/classes/ico/exit_ico.png new file mode 100644 index 0000000..11bd12c Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/exit_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/forgot_password.png b/projects/PassBox-master/build/classes/ico/forgot_password.png new file mode 100644 index 0000000..5271061 Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/forgot_password.png differ diff --git a/projects/PassBox-master/build/classes/ico/github-logo.png b/projects/PassBox-master/build/classes/ico/github-logo.png new file mode 100644 index 0000000..f8e08f6 Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/github-logo.png differ diff --git a/projects/PassBox-master/build/classes/ico/log_file.png b/projects/PassBox-master/build/classes/ico/log_file.png new file mode 100644 index 0000000..cf81c31 Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/log_file.png differ diff --git a/projects/PassBox-master/build/classes/ico/login_button.png b/projects/PassBox-master/build/classes/ico/login_button.png new file mode 100644 index 0000000..3c88150 Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/login_button.png differ diff --git a/projects/PassBox-master/build/classes/ico/password_delete_ico.png b/projects/PassBox-master/build/classes/ico/password_delete_ico.png new file mode 100644 index 0000000..ff90309 Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/password_delete_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/password_management_ico.png b/projects/PassBox-master/build/classes/ico/password_management_ico.png new file mode 100644 index 0000000..98d3a24 Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/password_management_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/register_ico.png b/projects/PassBox-master/build/classes/ico/register_ico.png new file mode 100644 index 0000000..df0c75a Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/register_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/send_ico.png b/projects/PassBox-master/build/classes/ico/send_ico.png new file mode 100644 index 0000000..537ae25 Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/send_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/software-update.png b/projects/PassBox-master/build/classes/ico/software-update.png new file mode 100644 index 0000000..910a3bb Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/software-update.png differ diff --git a/projects/PassBox-master/build/classes/ico/turnback_ico.png b/projects/PassBox-master/build/classes/ico/turnback_ico.png new file mode 100644 index 0000000..2c1c8be Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/turnback_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/update_database_ico.png b/projects/PassBox-master/build/classes/ico/update_database_ico.png new file mode 100644 index 0000000..efd7d7c Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/update_database_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/user_edit_ico.png b/projects/PassBox-master/build/classes/ico/user_edit_ico.png new file mode 100644 index 0000000..6188837 Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/user_edit_ico.png differ diff --git a/projects/PassBox-master/build/classes/ico/website.png b/projects/PassBox-master/build/classes/ico/website.png new file mode 100644 index 0000000..09f21be Binary files /dev/null and b/projects/PassBox-master/build/classes/ico/website.png differ diff --git a/projects/PassBox-master/build/classes/logo/PassBox.png b/projects/PassBox-master/build/classes/logo/PassBox.png new file mode 100644 index 0000000..0a591f9 Binary files /dev/null and b/projects/PassBox-master/build/classes/logo/PassBox.png differ diff --git a/projects/PassBox-master/build/classes/passbox_ico.png b/projects/PassBox-master/build/classes/passbox_ico.png new file mode 100644 index 0000000..0a591f9 Binary files /dev/null and b/projects/PassBox-master/build/classes/passbox_ico.png differ diff --git a/projects/PassBox-master/dist/README.TXT b/projects/PassBox-master/dist/README.TXT new file mode 100644 index 0000000..c6f662d --- /dev/null +++ b/projects/PassBox-master/dist/README.TXT @@ -0,0 +1,32 @@ +======================== +BUILD OUTPUT DESCRIPTION +======================== + +When you build an Java application project that has a main class, the IDE +automatically copies all of the JAR +files on the projects classpath to your projects dist/lib folder. The IDE +also adds each of the JAR files to the Class-Path element in the application +JAR files manifest file (MANIFEST.MF). + +To run the project from the command line, go to the dist folder and +type the following: + +java -jar "PassBox.jar" + +To distribute this project, zip up the dist folder (including the lib folder) +and distribute the ZIP file. + +Notes: + +* If two JAR files on the project classpath have the same name, only the first +JAR file is copied to the lib folder. +* Only JAR files are copied to the lib folder. +If the classpath contains other types of files or folders, these files (folders) +are not copied. +* If a library on the projects classpath also has a Class-Path element +specified in the manifest,the content of the Class-Path element has to be on +the projects runtime path. +* To set a main class in a standard Java project, right-click the project node +in the Projects window and choose Properties. Then click Run and enter the +class name in the Main Class field. Alternatively, you can manually type the +class name in the manifest Main-Class element. diff --git a/projects/PassBox-master/manifest.mf b/projects/PassBox-master/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/projects/PassBox-master/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/projects/PassBox-master/mysql/passbox_db.sql b/projects/PassBox-master/mysql/passbox_db.sql new file mode 100644 index 0000000..bcdde14 --- /dev/null +++ b/projects/PassBox-master/mysql/passbox_db.sql @@ -0,0 +1,102 @@ +-- phpMyAdmin SQL Dump +-- version 4.6.5.2 +-- https://www.phpmyadmin.net/ +-- +-- Host: 127.0.0.1 +-- Generation Time: May 01, 2017 at 01:17 AM +-- Server version: 10.1.21-MariaDB +-- PHP Version: 7.1.1 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Database: `passbox_db` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `password_database_tb` +-- + +CREATE TABLE `password_database_tb` ( + `u_id` int(10) NOT NULL, + `account_name` varchar(50) COLLATE utf8mb4_turkish_ci NOT NULL, + `username` varchar(50) COLLATE utf8mb4_turkish_ci NOT NULL, + `password` varchar(50) COLLATE utf8mb4_turkish_ci NOT NULL, + `email_address` varchar(50) COLLATE utf8mb4_turkish_ci NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci; + +-- +-- Dumping data for table `password_database_tb` +-- + +INSERT INTO `password_database_tb` (`u_id`, `account_name`, `username`, `password`, `email_address`) VALUES +(2, 'github', 'ismailtasdelen', '5110passDb', 'ismailtasdelen@std.sehir.edu.tr'), +(3, 'facebook', 'user123', 'pass123', 'user123@gmail.com'), +(4, 'sadsa', 'asdsad', 'asdas', 'dasasd'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `users_tb` +-- + +CREATE TABLE `users_tb` ( + `id` int(10) NOT NULL, + `fullname` varchar(50) CHARACTER SET utf8 NOT NULL, + `username` varchar(50) CHARACTER SET utf8 NOT NULL, + `password` varchar(50) CHARACTER SET utf8 NOT NULL, + `email_address` varchar(50) CHARACTER SET utf8 NOT NULL, + `mobile_number` varchar(50) CHARACTER SET utf8 NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci; + +-- +-- Dumping data for table `users_tb` +-- + +INSERT INTO `users_tb` (`id`, `fullname`, `username`, `password`, `email_address`, `mobile_number`) VALUES +(3, '?smail Ta?delen', 'root', 'toor', 'ismailtasdelen@std.sehir.edu.tr', '+905342959431'); + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `password_database_tb` +-- +ALTER TABLE `password_database_tb` + ADD PRIMARY KEY (`u_id`), + ADD KEY `u_id` (`u_id`); + +-- +-- Indexes for table `users_tb` +-- +ALTER TABLE `users_tb` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `id` (`id`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `password_database_tb` +-- +ALTER TABLE `password_database_tb` + MODIFY `u_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; +-- +-- AUTO_INCREMENT for table `users_tb` +-- +ALTER TABLE `users_tb` + MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/projects/PassBox-master/nbproject/build-impl.xml b/projects/PassBox-master/nbproject/build-impl.xml new file mode 100644 index 0000000..c524f24 --- /dev/null +++ b/projects/PassBox-master/nbproject/build-impl.xml @@ -0,0 +1,1420 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +*** GENERATED FROM project.xml - DO NOT EDIT *** +*** EDIT ../build.xml INSTEAD *** + +For the purpose of easier reading the script +is divided into following sections: + + - initialization + - compilation + - jar + - execution + - debugging + - javadoc + - test compilation + - test execution + - test debugging + - applet + - cleanup + + --> +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="PassBox-impl"> + <fail message="Please build using Ant 1.8.0 or higher."> + <condition> + <not> + <antversion atleast="1.8.0"/> + </not> + </condition> + </fail> + <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/> + <!-- + ====================== + INITIALIZATION SECTION + ====================== + --> + <target name="-pre-init"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="-pre-init" name="-init-private"> + <property file="nbproject/private/config.properties"/> + <property file="nbproject/private/configs/${config}.properties"/> + <property file="nbproject/private/private.properties"/> + </target> + <target depends="-pre-init,-init-private" name="-init-user"> + <property file="${user.properties.file}"/> + <!-- The two properties below are usually overridden --> + <!-- by the active platform. Just a fallback. --> + <property name="default.javac.source" value="1.6"/> + <property name="default.javac.target" value="1.6"/> + </target> + <target depends="-pre-init,-init-private,-init-user" name="-init-project"> + <property file="nbproject/configs/${config}.properties"/> + <property file="nbproject/project.properties"/> + </target> + <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init"> + <property name="platform.java" value="${java.home}/bin/java"/> + <available file="${manifest.file}" property="manifest.available"/> + <condition property="splashscreen.available"> + <and> + <not> + <equals arg1="${application.splash}" arg2="" trim="true"/> + </not> + <available file="${application.splash}"/> + </and> + </condition> + <condition property="main.class.available"> + <and> + <isset property="main.class"/> + <not> + <equals arg1="${main.class}" arg2="" trim="true"/> + </not> + </and> + </condition> + <condition property="profile.available"> + <and> + <isset property="javac.profile"/> + <length length="0" string="${javac.profile}" when="greater"/> + <matches pattern="((1\.[89])|9)(\..*)?" string="${javac.source}"/> + </and> + </condition> + <condition property="do.archive"> + <or> + <not> + <istrue value="${jar.archive.disabled}"/> + </not> + <istrue value="${not.archive.disabled}"/> + </or> + </condition> + <condition property="do.mkdist"> + <and> + <isset property="do.archive"/> + <isset property="libs.CopyLibs.classpath"/> + <not> + <istrue value="${mkdist.disabled}"/> + </not> + </and> + </condition> + <condition property="do.archive+manifest.available"> + <and> + <isset property="manifest.available"/> + <istrue value="${do.archive}"/> + </and> + </condition> + <condition property="do.archive+main.class.available"> + <and> + <isset property="main.class.available"/> + <istrue value="${do.archive}"/> + </and> + </condition> + <condition property="do.archive+splashscreen.available"> + <and> + <isset property="splashscreen.available"/> + <istrue value="${do.archive}"/> + </and> + </condition> + <condition property="do.archive+profile.available"> + <and> + <isset property="profile.available"/> + <istrue value="${do.archive}"/> + </and> + </condition> + <condition property="have.tests"> + <or> + <available file="${test.src.dir}"/> + </or> + </condition> + <condition property="have.sources"> + <or> + <available file="${src.dir}"/> + </or> + </condition> + <condition property="netbeans.home+have.tests"> + <and> + <isset property="netbeans.home"/> + <isset property="have.tests"/> + </and> + </condition> + <condition property="no.javadoc.preview"> + <and> + <isset property="javadoc.preview"/> + <isfalse value="${javadoc.preview}"/> + </and> + </condition> + <property name="run.jvmargs" value=""/> + <property name="run.jvmargs.ide" value=""/> + <property name="javac.compilerargs" value=""/> + <property name="work.dir" value="${basedir}"/> + <condition property="no.deps"> + <and> + <istrue value="${no.dependencies}"/> + </and> + </condition> + <property name="javac.debug" value="true"/> + <property name="javadoc.preview" value="true"/> + <property name="application.args" value=""/> + <property name="source.encoding" value="${file.encoding}"/> + <property name="runtime.encoding" value="${source.encoding}"/> + <property name="manifest.encoding" value="${source.encoding}"/> + <condition property="javadoc.encoding.used" value="${javadoc.encoding}"> + <and> + <isset property="javadoc.encoding"/> + <not> + <equals arg1="${javadoc.encoding}" arg2=""/> + </not> + </and> + </condition> + <property name="javadoc.encoding.used" value="${source.encoding}"/> + <property name="includes" value="**"/> + <property name="excludes" value=""/> + <property name="do.depend" value="false"/> + <condition property="do.depend.true"> + <istrue value="${do.depend}"/> + </condition> + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> + <and> + <isset property="endorsed.classpath"/> + <not> + <equals arg1="${endorsed.classpath}" arg2="" trim="true"/> + </not> + </and> + </condition> + <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}"> + <isset property="profile.available"/> + </condition> + <condition else="false" property="jdkBug6558476"> + <and> + <matches pattern="1\.[56]" string="${java.specification.version}"/> + <not> + <os family="unix"/> + </not> + </and> + </condition> + <condition else="false" property="javac.fork"> + <or> + <istrue value="${jdkBug6558476}"/> + <istrue value="${javac.external.vm}"/> + </or> + </condition> + <property name="jar.index" value="false"/> + <property name="jar.index.metainf" value="${jar.index}"/> + <property name="copylibs.rebase" value="true"/> + <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/> + <condition property="junit.available"> + <or> + <available classname="org.junit.Test" classpath="${run.test.classpath}"/> + <available classname="junit.framework.Test" classpath="${run.test.classpath}"/> + </or> + </condition> + <condition property="testng.available"> + <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/> + </condition> + <condition property="junit+testng.available"> + <and> + <istrue value="${junit.available}"/> + <istrue value="${testng.available}"/> + </and> + </condition> + <condition else="testng" property="testng.mode" value="mixed"> + <istrue value="${junit+testng.available}"/> + </condition> + <condition else="" property="testng.debug.mode" value="-mixed"> + <istrue value="${junit+testng.available}"/> + </condition> + <property name="java.failonerror" value="true"/> + </target> + <target name="-post-init"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check"> + <fail unless="src.dir">Must set src.dir</fail> + <fail unless="test.src.dir">Must set test.src.dir</fail> + <fail unless="build.dir">Must set build.dir</fail> + <fail unless="dist.dir">Must set dist.dir</fail> + <fail unless="build.classes.dir">Must set build.classes.dir</fail> + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail> + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail> + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail> + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail> + <fail unless="dist.jar">Must set dist.jar</fail> + </target> + <target name="-init-macrodef-property"> + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1"> + <attribute name="name"/> + <attribute name="value"/> + <sequential> + <property name="@{name}" value="${@{value}}"/> + </sequential> + </macrodef> + </target> + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors"> + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${src.dir}" name="srcdir"/> + <attribute default="${build.classes.dir}" name="destdir"/> + <attribute default="${javac.classpath}" name="classpath"/> + <attribute default="${javac.processorpath}" name="processorpath"/> + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="${javac.debug}" name="debug"/> + <attribute default="${empty.dir}" name="sourcepath"/> + <attribute default="${empty.dir}" name="gensrcdir"/> + <element name="customize" optional="true"/> + <sequential> + <property location="${build.dir}/empty" name="empty.dir"/> + <mkdir dir="${empty.dir}"/> + <mkdir dir="@{apgeneratedsrcdir}"/> + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> + <src> + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> + <include name="*"/> + </dirset> + </src> + <classpath> + <path path="@{classpath}"/> + </classpath> + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> + <compilerarg line="${javac.profile.cmd.line.arg}"/> + <compilerarg line="${javac.compilerargs}"/> + <compilerarg value="-processorpath"/> + <compilerarg path="@{processorpath}:${empty.dir}"/> + <compilerarg line="${ap.processors.internal}"/> + <compilerarg line="${annotation.processing.processor.options}"/> + <compilerarg value="-s"/> + <compilerarg path="@{apgeneratedsrcdir}"/> + <compilerarg line="${ap.proc.none.internal}"/> + <customize/> + </javac> + </sequential> + </macrodef> + </target> + <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal"> + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${src.dir}" name="srcdir"/> + <attribute default="${build.classes.dir}" name="destdir"/> + <attribute default="${javac.classpath}" name="classpath"/> + <attribute default="${javac.processorpath}" name="processorpath"/> + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="${javac.debug}" name="debug"/> + <attribute default="${empty.dir}" name="sourcepath"/> + <attribute default="${empty.dir}" name="gensrcdir"/> + <element name="customize" optional="true"/> + <sequential> + <property location="${build.dir}/empty" name="empty.dir"/> + <mkdir dir="${empty.dir}"/> + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> + <src> + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> + <include name="*"/> + </dirset> + </src> + <classpath> + <path path="@{classpath}"/> + </classpath> + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> + <compilerarg line="${javac.profile.cmd.line.arg}"/> + <compilerarg line="${javac.compilerargs}"/> + <customize/> + </javac> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac"> + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${src.dir}" name="srcdir"/> + <attribute default="${build.classes.dir}" name="destdir"/> + <attribute default="${javac.classpath}" name="classpath"/> + <sequential> + <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}"> + <classpath> + <path path="@{classpath}"/> + </classpath> + </depend> + </sequential> + </macrodef> + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${build.classes.dir}" name="destdir"/> + <sequential> + <fail unless="javac.includes">Must set javac.includes</fail> + <pathconvert pathsep="${line.separator}" property="javac.includes.binary"> + <path> + <filelist dir="@{destdir}" files="${javac.includes}"/> + </path> + <globmapper from="*.java" to="*.class"/> + </pathconvert> + <tempfile deleteonexit="true" property="javac.includesfile.binary"/> + <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/> + <delete> + <files includesfile="${javac.includesfile.binary}"/> + </delete> + <delete> + <fileset file="${javac.includesfile.binary}"/> + </delete> + </sequential> + </macrodef> + </target> + <target if="${junit.available}" name="-init-macrodef-junit-init"> + <condition else="false" property="nb.junit.batch" value="true"> + <and> + <istrue value="${junit.available}"/> + <not> + <isset property="test.method"/> + </not> + </and> + </condition> + <condition else="false" property="nb.junit.single" value="true"> + <and> + <istrue value="${junit.available}"/> + <isset property="test.method"/> + </and> + </condition> + </target> + <target name="-init-test-properties"> + <property name="test.binaryincludes" value="<nothing>"/> + <property name="test.binarytestincludes" value=""/> + <property name="test.binaryexcludes" value=""/> + </target> + <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}"> + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element name="customize" optional="true"/> + <sequential> + <property name="junit.forkmode" value="perTest"/> + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <formatter type="brief" usefile="false"/> + <formatter type="xml"/> + <jvmarg value="-ea"/> + <customize/> + </junit> + </sequential> + </macrodef> + </target> + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}"> + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element name="customize" optional="true"/> + <sequential> + <property name="junit.forkmode" value="perTest"/> + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> + <batchtest todir="${build.test.results.dir}"> + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> + <filename name="@{testincludes}"/> + </fileset> + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> + <filename name="${test.binarytestincludes}"/> + </fileset> + </batchtest> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <formatter type="brief" usefile="false"/> + <formatter type="xml"/> + <jvmarg value="-ea"/> + <customize/> + </junit> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/> + <target if="${testng.available}" name="-init-macrodef-testng"> + <macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element name="customize" optional="true"/> + <sequential> + <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}"> + <isset property="test.method"/> + </condition> + <union id="test.set"> + <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}"> + <filename name="@{testincludes}"/> + </fileset> + </union> + <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> + <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="PassBox" testname="TestNG tests" workingDir="${work.dir}"> + <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> + <propertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </propertyset> + <customize/> + </testng> + </sequential> + </macrodef> + </target> + <target name="-init-macrodef-test-impl"> + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element implicit="true" name="customize" optional="true"/> + <sequential> + <echo>No tests executed.</echo> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl"> + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element implicit="true" name="customize" optional="true"/> + <sequential> + <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> + <customize/> + </j2seproject3:junit> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl"> + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element implicit="true" name="customize" optional="true"/> + <sequential> + <j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> + <customize/> + </j2seproject3:testng> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test"> + <macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <sequential> + <j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> + <customize> + <classpath> + <path path="${run.test.classpath}"/> + </classpath> + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> + <jvmarg line="${run.jvmargs}"/> + <jvmarg line="${run.jvmargs.ide}"/> + </customize> + </j2seproject3:test-impl> + </sequential> + </macrodef> + </target> + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}"> + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element name="customize" optional="true"/> + <sequential> + <property name="junit.forkmode" value="perTest"/> + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <formatter type="brief" usefile="false"/> + <formatter type="xml"/> + <jvmarg value="-ea"/> + <jvmarg line="${debug-args-line}"/> + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> + <customize/> + </junit> + </sequential> + </macrodef> + </target> + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch"> + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element name="customize" optional="true"/> + <sequential> + <property name="junit.forkmode" value="perTest"/> + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> + <batchtest todir="${build.test.results.dir}"> + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> + <filename name="@{testincludes}"/> + </fileset> + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> + <filename name="${test.binarytestincludes}"/> + </fileset> + </batchtest> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <formatter type="brief" usefile="false"/> + <formatter type="xml"/> + <jvmarg value="-ea"/> + <jvmarg line="${debug-args-line}"/> + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> + <customize/> + </junit> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl"> + <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element implicit="true" name="customize" optional="true"/> + <sequential> + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> + <customize/> + </j2seproject3:junit-debug> + </sequential> + </macrodef> + </target> + <target if="${testng.available}" name="-init-macrodef-testng-debug"> + <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${main.class}" name="testClass"/> + <attribute default="" name="testMethod"/> + <element name="customize2" optional="true"/> + <sequential> + <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}"> + <isset property="test.method"/> + </condition> + <condition else="-suitename PassBox -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}"> + <matches pattern=".*\.xml" string="@{testClass}"/> + </condition> + <delete dir="${build.test.results.dir}" quiet="true"/> + <mkdir dir="${build.test.results.dir}"/> + <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}"> + <customize> + <customize2/> + <jvmarg value="-ea"/> + <arg line="${testng.debug.mode}"/> + <arg line="-d ${build.test.results.dir}"/> + <arg line="-listener org.testng.reporters.VerboseReporter"/> + <arg line="${testng.cmd.args}"/> + </customize> + </j2seproject3:debug> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl"> + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${main.class}" name="testClass"/> + <attribute default="" name="testMethod"/> + <element implicit="true" name="customize2" optional="true"/> + <sequential> + <j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}"> + <customize2/> + </j2seproject3:testng-debug> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit"> + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <attribute default="${main.class}" name="testClass"/> + <attribute default="" name="testMethod"/> + <sequential> + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> + <customize> + <classpath> + <path path="${run.test.classpath}"/> + </classpath> + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> + <jvmarg line="${run.jvmargs}"/> + <jvmarg line="${run.jvmargs.ide}"/> + </customize> + </j2seproject3:test-debug-impl> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng"> + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <attribute default="${main.class}" name="testClass"/> + <attribute default="" name="testMethod"/> + <sequential> + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}"> + <customize2> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + </customize2> + </j2seproject3:testng-debug-impl> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/> + <!-- + pre NB7.2 profiling section; consider it deprecated + --> + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/> + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target if="profiler.info.jvmargs.agent" name="-profile-post-init"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile"> + <macrodef name="resolve"> + <attribute name="name"/> + <attribute name="value"/> + <sequential> + <property name="@{name}" value="${env.@{value}}"/> + </sequential> + </macrodef> + <macrodef name="profile"> + <attribute default="${main.class}" name="classname"/> + <element name="customize" optional="true"/> + <sequential> + <property environment="env"/> + <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/> + <java classname="@{classname}" dir="${profiler.info.dir}" failonerror="${java.failonerror}" fork="true" jvm="${profiler.info.jvm}"> + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> + <jvmarg value="${profiler.info.jvmargs.agent}"/> + <jvmarg line="${profiler.info.jvmargs}"/> + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> + <arg line="${application.args}"/> + <classpath> + <path path="${run.classpath}"/> + </classpath> + <syspropertyset> + <propertyref prefix="run-sys-prop."/> + <mapper from="run-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <customize/> + </java> + </sequential> + </macrodef> + </target> + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check"> + <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> + <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> + </target> + <!-- + end of pre NB7.2 profiling section + --> + <target depends="-init-debug-args" name="-init-macrodef-nbjpda"> + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1"> + <attribute default="${main.class}" name="name"/> + <attribute default="${debug.classpath}" name="classpath"/> + <attribute default="" name="stopclassname"/> + <sequential> + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}"> + <classpath> + <path path="@{classpath}"/> + </classpath> + </nbjpdastart> + </sequential> + </macrodef> + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1"> + <attribute default="${build.classes.dir}" name="dir"/> + <sequential> + <nbjpdareload> + <fileset dir="@{dir}" includes="${fix.classes}"> + <include name="${fix.includes}*.class"/> + </fileset> + </nbjpdareload> + </sequential> + </macrodef> + </target> + <target name="-init-debug-args"> + <property name="version-output" value="java version "${ant.java.version}"/> + <condition property="have-jdk-older-than-1.4"> + <or> + <contains string="${version-output}" substring="java version "1.0"/> + <contains string="${version-output}" substring="java version "1.1"/> + <contains string="${version-output}" substring="java version "1.2"/> + <contains string="${version-output}" substring="java version "1.3"/> + </or> + </condition> + <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none"> + <istrue value="${have-jdk-older-than-1.4}"/> + </condition> + <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem"> + <os family="windows"/> + </condition> + <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}"> + <isset property="debug.transport"/> + </condition> + </target> + <target depends="-init-debug-args" name="-init-macrodef-debug"> + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${main.class}" name="classname"/> + <attribute default="${debug.classpath}" name="classpath"/> + <element name="customize" optional="true"/> + <sequential> + <java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true"> + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> + <jvmarg line="${debug-args-line}"/> + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> + <jvmarg line="${run.jvmargs}"/> + <jvmarg line="${run.jvmargs.ide}"/> + <classpath> + <path path="@{classpath}"/> + </classpath> + <syspropertyset> + <propertyref prefix="run-sys-prop."/> + <mapper from="run-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <customize/> + </java> + </sequential> + </macrodef> + </target> + <target name="-init-macrodef-java"> + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1"> + <attribute default="${main.class}" name="classname"/> + <attribute default="${run.classpath}" name="classpath"/> + <attribute default="jvm" name="jvm"/> + <element name="customize" optional="true"/> + <sequential> + <java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true"> + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> + <jvmarg line="${run.jvmargs}"/> + <jvmarg line="${run.jvmargs.ide}"/> + <classpath> + <path path="@{classpath}"/> + </classpath> + <syspropertyset> + <propertyref prefix="run-sys-prop."/> + <mapper from="run-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <customize/> + </java> + </sequential> + </macrodef> + </target> + <target name="-init-macrodef-copylibs"> + <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${manifest.file}" name="manifest"/> + <element name="customize" optional="true"/> + <sequential> + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> + <pathconvert property="run.classpath.without.build.classes.dir"> + <path path="${run.classpath}"/> + <map from="${build.classes.dir.resolved}" to=""/> + </pathconvert> + <pathconvert pathsep=" " property="jar.classpath"> + <path path="${run.classpath.without.build.classes.dir}"/> + <chainedmapper> + <flattenmapper/> + <filtermapper> + <replacestring from=" " to="%20"/> + </filtermapper> + <globmapper from="*" to="lib/*"/> + </chainedmapper> + </pathconvert> + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> + <copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" manifestencoding="UTF-8" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> + <fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> + <manifest> + <attribute name="Class-Path" value="${jar.classpath}"/> + <customize/> + </manifest> + </copylibs> + </sequential> + </macrodef> + </target> + <target name="-init-presetdef-jar"> + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> + <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifestencoding="UTF-8"> + <j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> + </jar> + </presetdef> + </target> + <target name="-init-ap-cmdline-properties"> + <property name="annotation.processing.enabled" value="true"/> + <property name="annotation.processing.processors.list" value=""/> + <property name="annotation.processing.processor.options" value=""/> + <property name="annotation.processing.run.all.processors" value="true"/> + <property name="javac.processorpath" value="${javac.classpath}"/> + <property name="javac.test.processorpath" value="${javac.test.classpath}"/> + <condition property="ap.supported.internal" value="true"> + <not> + <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/> + </not> + </condition> + </target> + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported"> + <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}"> + <isfalse value="${annotation.processing.run.all.processors}"/> + </condition> + <condition else="" property="ap.proc.none.internal" value="-proc:none"> + <isfalse value="${annotation.processing.enabled}"/> + </condition> + </target> + <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> + <property name="ap.cmd.line.internal" value=""/> + </target> + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> + <!-- + =================== + COMPILATION SECTION + =================== + --> + <target name="-deps-jar-init" unless="built-jar.properties"> + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/> + <delete file="${built-jar.properties}" quiet="true"/> + </target> + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar"> + <echo level="warn" message="Cycle detected: PassBox was already built"/> + </target> + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps"> + <mkdir dir="${build.dir}"/> + <touch file="${built-jar.properties}" verbose="false"/> + <property file="${built-jar.properties}" prefix="already.built.jar."/> + <antcall target="-warn-already-built-jar"/> + <propertyfile file="${built-jar.properties}"> + <entry key="${basedir}" value=""/> + </propertyfile> + </target> + <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/> + <target depends="init" name="-check-automatic-build"> + <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/> + </target> + <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build"> + <antcall target="clean"/> + </target> + <target depends="init,deps-jar" name="-pre-pre-compile"> + <mkdir dir="${build.classes.dir}"/> + </target> + <target name="-pre-compile"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target if="do.depend.true" name="-compile-depend"> + <pathconvert property="build.generated.subdirs"> + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false"> + <include name="*"/> + </dirset> + </pathconvert> + <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/> + </target> + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile"> + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/> + <copy todir="${build.classes.dir}"> + <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> + </copy> + </target> + <target if="has.persistence.xml" name="-copy-persistence-xml"> + <mkdir dir="${build.classes.dir}/META-INF"/> + <copy todir="${build.classes.dir}/META-INF"> + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/> + </copy> + </target> + <target name="-post-compile"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/> + <target name="-pre-compile-single"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single"> + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> + <j2seproject3:force-recompile/> + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/> + </target> + <target name="-post-compile-single"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/> + <!-- + ==================== + JAR BUILDING SECTION + ==================== + --> + <target depends="init" name="-pre-pre-jar"> + <dirname file="${dist.jar}" property="dist.jar.dir"/> + <mkdir dir="${dist.jar.dir}"/> + </target> + <target name="-pre-jar"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available"> + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> + <touch file="${tmp.manifest.file}" verbose="false"/> + </target> + <target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest"> + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> + <copy encoding="${manifest.encoding}" file="${manifest.file}" outputencoding="UTF-8" tofile="${tmp.manifest.file}"/> + </target> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass"> + <manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update"> + <attribute name="Main-Class" value="${main.class}"/> + </manifest> + </target> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile"> + <manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update"> + <attribute name="Profile" value="${javac.profile}"/> + </manifest> + </target> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen"> + <basename file="${application.splash}" property="splashscreen.basename"/> + <mkdir dir="${build.classes.dir}/META-INF"/> + <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> + <manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update"> + <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> + </manifest> + </target> + <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.mkdist" name="-do-jar-copylibs"> + <j2seproject3:copylibs manifest="${tmp.manifest.file}"/> + <echo level="info">To run this application from the command line without Ant, try:</echo> + <property location="${dist.jar}" name="dist.jar.resolved"/> + <echo level="info">java -jar "${dist.jar.resolved}"</echo> + </target> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist"> + <j2seproject1:jar manifest="${tmp.manifest.file}"/> + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> + <property location="${dist.jar}" name="dist.jar.resolved"/> + <pathconvert property="run.classpath.with.dist.jar"> + <path path="${run.classpath}"/> + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> + </pathconvert> + <condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java} -cp ${run.classpath.with.dist.jar} ${main.class}"> + <isset property="main.class.available"/> + </condition> + <condition else="debug" property="jar.usage.level" value="info"> + <isset property="main.class.available"/> + </condition> + <echo level="${jar.usage.level}" message="${jar.usage.message}"/> + </target> + <target depends="-do-jar-copylibs" if="do.archive" name="-do-jar-delete-manifest"> + <delete> + <fileset file="${tmp.manifest.file}"/> + </delete> + </target> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-jar,-do-jar-delete-manifest" name="-do-jar-without-libraries"/> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-copylibs,-do-jar-delete-manifest" name="-do-jar-with-libraries"/> + <target name="-post-jar"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init,compile,-pre-jar,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/> + <target depends="init,compile,-pre-jar,-do-jar,-post-jar" description="Build JAR." name="jar"/> + <!-- + ================= + EXECUTION SECTION + ================= + --> + <target depends="init,compile" description="Run a main class." name="run"> + <j2seproject1:java> + <customize> + <arg line="${application.args}"/> + </customize> + </j2seproject1:java> + </target> + <target name="-do-not-recompile"> + <property name="javac.includes.binary" value=""/> + </target> + <target depends="init,compile-single" name="run-single"> + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> + <j2seproject1:java classname="${run.class}"/> + </target> + <target depends="init,compile-test-single" name="run-test-with-main"> + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/> + </target> + <!-- + ================= + DEBUGGING SECTION + ================= + --> + <target depends="init" if="netbeans.home" name="-debug-start-debugger"> + <j2seproject1:nbjpdastart name="${debug.class}"/> + </target> + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test"> + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/> + </target> + <target depends="init,compile" name="-debug-start-debuggee"> + <j2seproject3:debug> + <customize> + <arg line="${application.args}"/> + </customize> + </j2seproject3:debug> + </target> + <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/> + <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto"> + <j2seproject1:nbjpdastart stopclassname="${main.class}"/> + </target> + <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/> + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single"> + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> + <j2seproject3:debug classname="${debug.class}"/> + </target> + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/> + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test"> + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/> + </target> + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/> + <target depends="init" name="-pre-debug-fix"> + <fail unless="fix.includes">Must set fix.includes</fail> + <property name="javac.includes" value="${fix.includes}.java"/> + </target> + <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix"> + <j2seproject1:nbjpdareload/> + </target> + <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/> + <!-- + ================= + PROFILING SECTION + ================= + --> + <!-- + pre NB7.2 profiler integration + --> + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72"> + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> + <nbprofiledirect> + <classpath> + <path path="${run.classpath}"/> + </classpath> + </nbprofiledirect> + <profile/> + </target> + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72"> + <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail> + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> + <nbprofiledirect> + <classpath> + <path path="${run.classpath}"/> + </classpath> + </nbprofiledirect> + <profile classname="${profile.class}"/> + </target> + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72"> + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> + <nbprofiledirect> + <classpath> + <path path="${run.classpath}"/> + </classpath> + </nbprofiledirect> + <profile classname="sun.applet.AppletViewer"> + <customize> + <arg value="${applet.url}"/> + </customize> + </profile> + </target> + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72"> + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> + <nbprofiledirect> + <classpath> + <path path="${run.test.classpath}"/> + </classpath> + </nbprofiledirect> + <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true"> + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> + <jvmarg value="${profiler.info.jvmargs.agent}"/> + <jvmarg line="${profiler.info.jvmargs}"/> + <test name="${profile.class}"/> + <classpath> + <path path="${run.test.classpath}"/> + </classpath> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <formatter type="brief" usefile="false"/> + <formatter type="xml"/> + </junit> + </target> + <!-- + end of pre NB72 profiling section + --> + <target if="netbeans.home" name="-profile-check"> + <condition property="profiler.configured"> + <or> + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/> + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/> + </or> + </condition> + </target> + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent"> + <startprofiler/> + <antcall target="run"/> + </target> + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent"> + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> + <startprofiler/> + <antcall target="run-single"/> + </target> + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/> + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs"> + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> + <startprofiler/> + <antcall target="test-single"/> + </target> + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main"> + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> + <startprofiler/> + <antcall target="run-test-with-main"/> + </target> + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent"> + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> + <startprofiler/> + <antcall target="run-applet"/> + </target> + <!-- + =============== + JAVADOC SECTION + =============== + --> + <target depends="init" if="have.sources" name="-javadoc-build"> + <mkdir dir="${dist.javadoc.dir}"/> + <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}"> + <and> + <isset property="endorsed.classpath.cmd.line.arg"/> + <not> + <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/> + </not> + </and> + </condition> + <condition else="" property="bug5101868workaround" value="*.java"> + <matches pattern="1\.[56](\..*)?" string="${java.version}"/> + </condition> + <javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> + <classpath> + <path path="${javac.classpath}"/> + </classpath> + <fileset dir="${src.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}"> + <filename name="**/*.java"/> + </fileset> + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> + <include name="**/*.java"/> + <exclude name="*.java"/> + </fileset> + <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/> + </javadoc> + <copy todir="${dist.javadoc.dir}"> + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> + <filename name="**/doc-files/**"/> + </fileset> + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> + <include name="**/doc-files/**"/> + </fileset> + </copy> + </target> + <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview"> + <nbbrowse file="${dist.javadoc.dir}/index.html"/> + </target> + <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/> + <!-- + ========================= + TEST COMPILATION SECTION + ========================= + --> + <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test"> + <mkdir dir="${build.test.classes.dir}"/> + </target> + <target name="-pre-compile-test"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target if="do.depend.true" name="-compile-test-depend"> + <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/> + </target> + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test"> + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/> + <copy todir="${build.test.classes.dir}"> + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> + </copy> + </target> + <target name="-post-compile-test"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/> + <target name="-pre-compile-test-single"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single"> + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> + <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/> + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/> + <copy todir="${build.test.classes.dir}"> + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> + </copy> + </target> + <target name="-post-compile-test-single"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/> + <!-- + ======================= + TEST EXECUTION SECTION + ======================= + --> + <target depends="init" if="have.tests" name="-pre-test-run"> + <mkdir dir="${build.test.results.dir}"/> + </target> + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run"> + <j2seproject3:test includes="${includes}" testincludes="**/*Test.java"/> + </target> + <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> + </target> + <target depends="init" if="have.tests" name="test-report"/> + <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/> + <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/> + <target depends="init" if="have.tests" name="-pre-test-run-single"> + <mkdir dir="${build.test.results.dir}"/> + </target> + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single"> + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> + <j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/> + </target> + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single"> + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> + </target> + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/> + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method"> + <fail unless="test.class">Must select some files in the IDE or set test.class</fail> + <fail unless="test.method">Must select some method in the IDE or set test.method</fail> + <j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/> + </target> + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method"> + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> + </target> + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/> + <!-- + ======================= + TEST DEBUGGING SECTION + ======================= + --> + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test"> + <fail unless="test.class">Must select one file in the IDE or set test.class</fail> + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/> + </target> + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method"> + <fail unless="test.class">Must select one file in the IDE or set test.class</fail> + <fail unless="test.method">Must select some method in the IDE or set test.method</fail> + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/> + </target> + <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test"> + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/> + </target> + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/> + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/> + <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test"> + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/> + </target> + <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/> + <!-- + ========================= + APPLET EXECUTION SECTION + ========================= + --> + <target depends="init,compile-single" name="run-applet"> + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> + <j2seproject1:java classname="sun.applet.AppletViewer"> + <customize> + <arg value="${applet.url}"/> + </customize> + </j2seproject1:java> + </target> + <!-- + ========================= + APPLET DEBUGGING SECTION + ========================= + --> + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet"> + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> + <j2seproject3:debug classname="sun.applet.AppletViewer"> + <customize> + <arg value="${applet.url}"/> + </customize> + </j2seproject3:debug> + </target> + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/> + <!-- + =============== + CLEANUP SECTION + =============== + --> + <target name="-deps-clean-init" unless="built-clean.properties"> + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/> + <delete file="${built-clean.properties}" quiet="true"/> + </target> + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean"> + <echo level="warn" message="Cycle detected: PassBox was already built"/> + </target> + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps"> + <mkdir dir="${build.dir}"/> + <touch file="${built-clean.properties}" verbose="false"/> + <property file="${built-clean.properties}" prefix="already.built.clean."/> + <antcall target="-warn-already-built-clean"/> + <propertyfile file="${built-clean.properties}"> + <entry key="${basedir}" value=""/> + </propertyfile> + </target> + <target depends="init" name="-do-clean"> + <delete dir="${build.dir}"/> + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/> + </target> + <target name="-post-clean"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/> + <target name="-check-call-dep"> + <property file="${call.built.properties}" prefix="already.built."/> + <condition property="should.call.dep"> + <and> + <not> + <isset property="already.built.${call.subproject}"/> + </not> + <available file="${call.script}"/> + </and> + </condition> + </target> + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep"> + <ant antfile="${call.script}" inheritall="false" target="${call.target}"> + <propertyset> + <propertyref prefix="transfer."/> + <mapper from="transfer.*" to="*" type="glob"/> + </propertyset> + </ant> + </target> +</project> diff --git a/projects/PassBox-master/nbproject/genfiles.properties b/projects/PassBox-master/nbproject/genfiles.properties new file mode 100644 index 0000000..a94fa95 --- /dev/null +++ b/projects/PassBox-master/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=5cedf9ec +build.xml.script.CRC32=f1825515 +build.xml.stylesheet.CRC32=8064a381@1.80.1.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=5cedf9ec +nbproject/build-impl.xml.script.CRC32=05d4b96c +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/projects/PassBox-master/nbproject/private/config.properties b/projects/PassBox-master/nbproject/private/config.properties new file mode 100644 index 0000000..e69de29 diff --git a/projects/PassBox-master/nbproject/private/private.properties b/projects/PassBox-master/nbproject/private/private.properties new file mode 100644 index 0000000..2301659 --- /dev/null +++ b/projects/PassBox-master/nbproject/private/private.properties @@ -0,0 +1,7 @@ +compile.on.save=true +do.depend=false +do.jar=true +file.reference.mail-1.4.7.jar=C:\\Users\\Aykut\\Desktop\\javamail-1.4.7\\mail.jar +javac.debug=true +javadoc.preview=true +user.properties.file=C:\\Users\\HP\\AppData\\Roaming\\NetBeans\\8.2\\build.properties diff --git a/projects/PassBox-master/nbproject/private/private.xml b/projects/PassBox-master/nbproject/private/private.xml new file mode 100644 index 0000000..6807a2b --- /dev/null +++ b/projects/PassBox-master/nbproject/private/private.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project-private xmlns="http://www.netbeans.org/ns/project-private/1"> + <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> + <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> + <group/> + </open-files> +</project-private> diff --git a/projects/PassBox-master/nbproject/project.properties b/projects/PassBox-master/nbproject/project.properties new file mode 100644 index 0000000..6d7b7f2 --- /dev/null +++ b/projects/PassBox-master/nbproject/project.properties @@ -0,0 +1,79 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=PassBox +application.vendor=root +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/PassBox.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.mail-1.4.7.jar=C:\\Users\\root\\Downloads\\mail-1.4.7.jar +includes=** +jar.compress=false +javac.classpath=\ + ${file.reference.mail-1.4.7.jar}:\ + ${libs.MySQLDriver.classpath} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=Login_Page +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/projects/PassBox-master/nbproject/project.xml b/projects/PassBox-master/nbproject/project.xml new file mode 100644 index 0000000..4daad4c --- /dev/null +++ b/projects/PassBox-master/nbproject/project.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://www.netbeans.org/ns/project/1"> + <type>org.netbeans.modules.java.j2seproject</type> + <configuration> + <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> + <name>PassBox</name> + <source-roots> + <root id="src.dir"/> + </source-roots> + <test-roots> + <root id="test.src.dir"/> + </test-roots> + </data> + </configuration> +</project> diff --git a/projects/PassBox-master/src/About_Us_Page.form b/projects/PassBox-master/src/About_Us_Page.form new file mode 100644 index 0000000..cd74734 --- /dev/null +++ b/projects/PassBox-master/src/About_Us_Page.form @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | About Us"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace pref="91" max="32767" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="1" attributes="0"> + <Component id="jButton1" min="-2" pref="338" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="128" max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <Component id="jLabel2" min="-2" pref="124" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="225" max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <Component id="jLabel1" min="-2" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="78" max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <Component id="jButton2" min="-2" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="229" max="-2" attributes="0"/> + </Group> + </Group> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton1" min="-2" pref="321" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="1" max="-2" attributes="0"/> + <Component id="jLabel2" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jLabel1" min="-2" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="jButton2" max="32767" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="This software is developed by Ismail Taşdelen."/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel2"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="30" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="PassBox"/> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton2"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/src/About_Us_Page.java b/projects/PassBox-master/src/About_Us_Page.java new file mode 100644 index 0000000..12746c8 --- /dev/null +++ b/projects/PassBox-master/src/About_Us_Page.java @@ -0,0 +1,147 @@ + +import java.awt.Toolkit; + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author root + */ +public class About_Us_Page extends javax.swing.JFrame { + + /** + * Creates new form About_Us_Page + */ + public About_Us_Page() { + initComponents(); + setIcon(); + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("PassBox | About Us"); + setResizable(false); + + jLabel1.setFont(new java.awt.Font("Yu Gothic UI", 1, 20)); // NOI18N + jLabel1.setText("This software is developed by Ismail Taşdelen."); + + jLabel2.setFont(new java.awt.Font("Yu Gothic UI", 1, 30)); // NOI18N + jLabel2.setText("PassBox"); + + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + + jButton2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/turnback_ico.png"))); // NOI18N + jButton2.setText("Turn Back"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap(91, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 338, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(128, 128, 128)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(225, 225, 225)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(jLabel1) + .addGap(78, 78, 78)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(jButton2) + .addGap(229, 229, 229)))) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 321, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(1, 1, 1) + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + // TODO add your handling code here: + this.setVisible(false); + }//GEN-LAST:event_jButton2ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(About_Us_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(About_Us_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(About_Us_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(About_Us_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + //</editor-fold> + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new About_Us_Page().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + // End of variables declaration//GEN-END:variables + + private void setIcon() { + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("passbox_ico.png"))); + } +} diff --git a/projects/PassBox-master/src/Contact_Me_Page.form b/projects/PassBox-master/src/Contact_Me_Page.form new file mode 100644 index 0000000..e2adc5b --- /dev/null +++ b/projects/PassBox-master/src/Contact_Me_Page.form @@ -0,0 +1,174 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | Contact Me"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton2" min="-2" pref="330" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace min="-2" pref="23" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" attributes="0"> + <Component id="jLabel2" min="-2" max="-2" attributes="0"/> + <Component id="jLabel1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel3" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel4" alignment="1" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="32767" attributes="0"/> + </Group> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="exit_button" max="32767" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + </Group> + </Group> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="jTextField2" pref="180" max="32767" attributes="0"/> + <Component id="jTextField3" alignment="1" max="32767" attributes="0"/> + <Component id="jTextField1" max="32767" attributes="0"/> + <Component id="jButton_MailSend_Button" max="32767" attributes="0"/> + <Component id="jScrollPane1" max="32767" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jTextField1" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="separate" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel2" alignment="3" min="-2" pref="14" max="-2" attributes="0"/> + <Component id="jTextField2" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="11" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jTextField3" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Component id="jLabel4" min="-2" pref="14" max="-2" attributes="0"/> + <EmptySpace min="0" pref="0" max="32767" attributes="0"/> + </Group> + <Component id="jScrollPane1" max="32767" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jButton_MailSend_Button" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="exit_button" alignment="3" min="-2" pref="41" max="-2" attributes="0"/> + </Group> + </Group> + <Component id="jButton2" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JButton" name="jButton_MailSend_Button"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/send_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Send"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_MailSend_ButtonActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton2"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="text" type="java.lang.String" value="Full Name : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel2"> + <Properties> + <Property name="text" type="java.lang.String" value="Mail Address : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel3"> + <Properties> + <Property name="text" type="java.lang.String" value="Subject : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel4"> + <Properties> + <Property name="text" type="java.lang.String" value="Message : "/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField1"> + </Component> + <Component class="javax.swing.JTextField" name="jTextField2"> + </Component> + <Component class="javax.swing.JTextField" name="jTextField3"> + </Component> + <Container class="javax.swing.JScrollPane" name="jScrollPane1"> + <AuxValues> + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> + </AuxValues> + + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> + <SubComponents> + <Component class="javax.swing.JTextArea" name="jTextArea1"> + <Properties> + <Property name="columns" type="int" value="20"/> + <Property name="lineWrap" type="boolean" value="true"/> + <Property name="rows" type="int" value="5"/> + <Property name="wrapStyleWord" type="boolean" value="true"/> + </Properties> + </Component> + </SubComponents> + </Container> + <Component class="javax.swing.JButton" name="exit_button"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exit_buttonActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/src/Contact_Me_Page.java b/projects/PassBox-master/src/Contact_Me_Page.java new file mode 100644 index 0000000..f3b5b94 --- /dev/null +++ b/projects/PassBox-master/src/Contact_Me_Page.java @@ -0,0 +1,212 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +import java.awt.Toolkit; +import javax.swing.JFrame; + + +/** + * + * @author root + */ +public class Contact_Me_Page extends javax.swing.JFrame { + + /** + * Creates new form Contact_Me_Page + */ + public Contact_Me_Page() { + initComponents(); + setIcon(); + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jButton_MailSend_Button = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jTextField2 = new javax.swing.JTextField(); + jTextField3 = new javax.swing.JTextField(); + jScrollPane1 = new javax.swing.JScrollPane(); + jTextArea1 = new javax.swing.JTextArea(); + exit_button = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("PassBox | Contact Me"); + setResizable(false); + + jButton_MailSend_Button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/send_ico.png"))); // NOI18N + jButton_MailSend_Button.setText("Send"); + jButton_MailSend_Button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_MailSend_ButtonActionPerformed(evt); + } + }); + + jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + + jLabel1.setText("Full Name : "); + + jLabel2.setText("Mail Address : "); + + jLabel3.setText("Subject : "); + + jLabel4.setText("Message : "); + + jTextArea1.setColumns(20); + jTextArea1.setLineWrap(true); + jTextArea1.setRows(5); + jTextArea1.setWrapStyleWord(true); + jScrollPane1.setViewportView(jTextArea1); + + exit_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/turnback_ico.png"))); // NOI18N + exit_button.setText("Turn Back"); + exit_button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + exit_buttonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(23, 23, 23) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel2) + .addComponent(jLabel1) + .addComponent(jLabel3) + .addComponent(jLabel4)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(exit_button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE) + .addComponent(jTextField3, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jTextField1) + .addComponent(jButton_MailSend_Button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jScrollPane1)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(11, 11, 11) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(jScrollPane1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jButton_MailSend_Button) + .addComponent(exit_button, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(jButton2)) + .addContainerGap()) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + + private void jButton_MailSend_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_MailSend_ButtonActionPerformed + // TODO add your handling code here: + + + + + }//GEN-LAST:event_jButton_MailSend_ButtonActionPerformed + + private void exit_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exit_buttonActionPerformed + // TODO add your handling code here: + this.setVisible(false); + }//GEN-LAST:event_exit_buttonActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Contact_Me_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Contact_Me_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Contact_Me_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Contact_Me_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + //</editor-fold> + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Contact_Me_Page().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton exit_button; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton_MailSend_Button; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTextArea jTextArea1; + private javax.swing.JTextField jTextField1; + private javax.swing.JTextField jTextField2; + private javax.swing.JTextField jTextField3; + // End of variables declaration//GEN-END:variables + + private void setIcon() { + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("passbox_ico.png"))); + } +} diff --git a/projects/PassBox-master/src/Create_a_New_Account_Page.form b/projects/PassBox-master/src/Create_a_New_Account_Page.form new file mode 100644 index 0000000..4033f69 --- /dev/null +++ b/projects/PassBox-master/src/Create_a_New_Account_Page.form @@ -0,0 +1,235 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <NonVisualComponents> + <Component class="javax.swing.JPasswordField" name="jPasswordField2"> + <Properties> + <Property name="text" type="java.lang.String" value="jPasswordField2"/> + </Properties> + </Component> + </NonVisualComponents> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | Create a New Account"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton2" min="-2" pref="327" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel4" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel3" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel2" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel1" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel7" alignment="1" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="email_address_txt" alignment="1" max="32767" attributes="0"/> + <Component id="password_txt" alignment="1" max="32767" attributes="0"/> + <Component id="username_txt" alignment="1" max="32767" attributes="0"/> + <Component id="mobile_number_txt" alignment="0" max="32767" attributes="0"/> + <Component id="fullname_txt" alignment="0" max="32767" attributes="0"/> + </Group> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Component id="jLabel5" min="-2" max="-2" attributes="0"/> + <EmptySpace type="separate" max="-2" attributes="0"/> + <Component id="jCheckBox1" min="-2" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="24" max="-2" attributes="0"/> + <Component id="jLabel6" min="-2" max="-2" attributes="0"/> + <EmptySpace type="separate" max="-2" attributes="0"/> + <Component id="jCheckBox2" min="-2" max="-2" attributes="0"/> + <EmptySpace min="0" pref="0" max="32767" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <Component id="jButton_Create_a_New_Account_Page_TurnBack_Button" max="32767" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton1" min="-2" pref="220" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton2" max="32767" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" pref="23" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="fullname_txt" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="username_txt" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="password_txt" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="email_address_txt" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="mobile_number_txt" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" max="-2" attributes="0"> + <Component id="jLabel5" max="32767" attributes="0"/> + <Component id="jCheckBox1" min="-2" pref="14" max="-2" attributes="0"/> + <Component id="jLabel6" alignment="1" max="32767" attributes="0"/> + <Component id="jCheckBox2" alignment="1" min="-2" pref="14" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jButton1" alignment="3" min="-2" pref="41" max="-2" attributes="0"/> + <Component id="jButton_Create_a_New_Account_Page_TurnBack_Button" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="text" type="java.lang.String" value="Username : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel2"> + <Properties> + <Property name="text" type="java.lang.String" value="Password : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel3"> + <Properties> + <Property name="text" type="java.lang.String" value="E-Mail Address :"/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel4"> + <Properties> + <Property name="text" type="java.lang.String" value="Mobile Number :"/> + </Properties> + </Component> + <Component class="javax.swing.JPasswordField" name="password_txt"> + </Component> + <Component class="javax.swing.JTextField" name="username_txt"> + </Component> + <Component class="javax.swing.JTextField" name="email_address_txt"> + </Component> + <Component class="javax.swing.JTextField" name="mobile_number_txt"> + </Component> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/register_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Register"/> + <Property name="enabled" type="boolean" value="false"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton2"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + <Property name="disabledIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + <Property name="disabledSelectedIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + <Property name="pressedIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + <Property name="rolloverIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + <Property name="rolloverSelectedIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + <Property name="selectedIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel5"> + <Properties> + <Property name="text" type="java.lang.String" value="Confidentiality Agreement : "/> + </Properties> + </Component> + <Component class="javax.swing.JCheckBox" name="jCheckBox1"> + <Events> + <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="jCheckBox1ItemStateChanged"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="jLabel6"> + <Properties> + <Property name="text" type="java.lang.String" value="Contract : "/> + </Properties> + </Component> + <Component class="javax.swing.JCheckBox" name="jCheckBox2"> + <Properties> + <Property name="enabled" type="boolean" value="false"/> + </Properties> + <Events> + <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="jCheckBox2ItemStateChanged"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_Create_a_New_Account_Page_TurnBack_Button"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_Create_a_New_Account_Page_TurnBack_ButtonActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="jLabel7"> + <Properties> + <Property name="text" type="java.lang.String" value="Full Name : "/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="fullname_txt"> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/src/Create_a_New_Account_Page.java b/projects/PassBox-master/src/Create_a_New_Account_Page.java new file mode 100644 index 0000000..2a45216 --- /dev/null +++ b/projects/PassBox-master/src/Create_a_New_Account_Page.java @@ -0,0 +1,325 @@ + +import java.awt.Toolkit; +import java.awt.event.ItemEvent; +import com.mysql.jdbc.Connection; +import com.mysql.jdbc.Statement; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.*; +import javax.swing.*; +import java.awt.*; +import java.awt.event.ItemEvent; + + + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author root + */ +public class Create_a_New_Account_Page extends javax.swing.JFrame { +String url="jdbc:mysql://localhost:3306/"; //sizde 3306 olabilir +String veritabaniadi="passbox_db"; // ulaşmak istediğiniz veri tabanı ismi +String surucu="com.mysql.jdbc.Driver"; +String kullaniciAdi="root"; // workbench deki kullanıcı adınız ne ise o "root" olabilir +String kullaniciParolası=""; //workbench deki şifreniz ne ise o +java.sql.Connection baglanti=null; +java.sql.Statement komut=null; +ResultSet gelenveri=null; +PreparedStatement pst=null; + /** + * Creates new form Create_a_New_Account_Page + */ + public Create_a_New_Account_Page() { + initComponents(); + setIcon(); + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + try { + Class.forName(surucu); + //baglantı veri tabanı seçimi kullanıcı adı ve parola ile sağlanı + baglanti= DriverManager.getConnection(url+veritabaniadi, kullaniciAdi,kullaniciParolası); + } catch (ClassNotFoundException | SQLException ex) { + System.out.println("HATA 1: Surucu ve Baglantı Hatsı !"+ex); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jPasswordField2 = new javax.swing.JPasswordField(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + password_txt = new javax.swing.JPasswordField(); + username_txt = new javax.swing.JTextField(); + email_address_txt = new javax.swing.JTextField(); + mobile_number_txt = new javax.swing.JTextField(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jLabel5 = new javax.swing.JLabel(); + jCheckBox1 = new javax.swing.JCheckBox(); + jLabel6 = new javax.swing.JLabel(); + jCheckBox2 = new javax.swing.JCheckBox(); + jButton_Create_a_New_Account_Page_TurnBack_Button = new javax.swing.JButton(); + jLabel7 = new javax.swing.JLabel(); + fullname_txt = new javax.swing.JTextField(); + + jPasswordField2.setText("jPasswordField2"); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("PassBox | Create a New Account"); + setResizable(false); + + jLabel1.setText("Username : "); + + jLabel2.setText("Password : "); + + jLabel3.setText("E-Mail Address :"); + + jLabel4.setText("Mobile Number :"); + + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/register_ico.png"))); // NOI18N + jButton1.setText("Register"); + jButton1.setEnabled(false); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + jButton2.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + jButton2.setDisabledSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + jButton2.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + jButton2.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + jButton2.setRolloverSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + jButton2.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + + jLabel5.setText("Confidentiality Agreement : "); + + jCheckBox1.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(java.awt.event.ItemEvent evt) { + jCheckBox1ItemStateChanged(evt); + } + }); + + jLabel6.setText("Contract : "); + + jCheckBox2.setEnabled(false); + jCheckBox2.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(java.awt.event.ItemEvent evt) { + jCheckBox2ItemStateChanged(evt); + } + }); + + jButton_Create_a_New_Account_Page_TurnBack_Button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/turnback_ico.png"))); // NOI18N + jButton_Create_a_New_Account_Page_TurnBack_Button.setText("Turn Back"); + jButton_Create_a_New_Account_Page_TurnBack_Button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_Create_a_New_Account_Page_TurnBack_ButtonActionPerformed(evt); + } + }); + + jLabel7.setText("Full Name : "); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 327, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.TRAILING)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(email_address_txt, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(password_txt, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(username_txt, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(mobile_number_txt) + .addComponent(fullname_txt))) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel5) + .addGap(18, 18, 18) + .addComponent(jCheckBox1) + .addGap(24, 24, 24) + .addComponent(jLabel6) + .addGap(18, 18, 18) + .addComponent(jCheckBox2) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(jButton_Create_a_New_Account_Page_TurnBack_Button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + .addGroup(layout.createSequentialGroup() + .addGap(23, 23, 23) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel7) + .addComponent(fullname_txt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(username_txt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(password_txt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(email_address_txt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent(mobile_number_txt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jCheckBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jCheckBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton_Create_a_New_Account_Page_TurnBack_Button)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void jButton_Create_a_New_Account_Page_TurnBack_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_Create_a_New_Account_Page_TurnBack_ButtonActionPerformed + // TODO add your handling code here: + this.setVisible(false); + Login_Page frame = new Login_Page(); + frame.setVisible(true); + }//GEN-LAST:event_jButton_Create_a_New_Account_Page_TurnBack_ButtonActionPerformed + + private void jCheckBox1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBox1ItemStateChanged + // TODO add your handling code here: + int secili=evt.getStateChange(); + int secili_degil = evt.getStateChange(); + if(secili == ItemEvent.SELECTED) + jCheckBox2.setEnabled(true); + else + jCheckBox2.setEnabled(false); + }//GEN-LAST:event_jCheckBox1ItemStateChanged + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + // TODO add your handling code here: + String sorgu = "INSERT INTO `passbox_db`.`users_tb`(`fullname`,`username`,`password`,`email_address`,`mobile_number`)VALUES(?,?,?,?,?);"; + try { + pst=baglanti.prepareStatement(sorgu); + pst.setString(1, fullname_txt.getText()); + pst.setString(2, username_txt.getText()); + pst.setString(3, password_txt.getText()); + pst.setString(4, email_address_txt.getText()); + pst.setString(5, mobile_number_txt.getText()); + int x= pst.executeUpdate(); + if(x==1) + JOptionPane.showMessageDialog(null,"Başarılı Kayıt"); + else + JOptionPane.showMessageDialog(null,"Başarısız Kayıt"); + } catch (SQLException ex) { + JOptionPane.showConfirmDialog(null, "Sorgu da hata var !"+ex); + } + + }//GEN-LAST:event_jButton1ActionPerformed + + private void jCheckBox2ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBox2ItemStateChanged + int secili=evt.getStateChange(); + int secili_degil = evt.getStateChange(); + if(secili == ItemEvent.SELECTED) + jButton1.setEnabled(true); + else + jButton1.setEnabled(false); + + }//GEN-LAST:event_jCheckBox2ItemStateChanged + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Create_a_New_Account_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Create_a_New_Account_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Create_a_New_Account_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Create_a_New_Account_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + //</editor-fold> + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Create_a_New_Account_Page().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JTextField email_address_txt; + private javax.swing.JTextField fullname_txt; + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton_Create_a_New_Account_Page_TurnBack_Button; + private javax.swing.JCheckBox jCheckBox1; + private javax.swing.JCheckBox jCheckBox2; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JPasswordField jPasswordField2; + private javax.swing.JTextField mobile_number_txt; + private javax.swing.JPasswordField password_txt; + private javax.swing.JTextField username_txt; + // End of variables declaration//GEN-END:variables + + private void setIcon() { + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("passbox_ico.png"))); + } +} diff --git a/projects/PassBox-master/src/Database_View.form b/projects/PassBox-master/src/Database_View.form new file mode 100644 index 0000000..3da8f1f --- /dev/null +++ b/projects/PassBox-master/src/Database_View.form @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | Database View"/> + <Property name="focusable" type="boolean" value="false"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jScrollPane1" pref="813" max="32767" attributes="0"/> + <Group type="102" attributes="0"> + <Component id="turnback_button" min="-2" pref="200" max="-2" attributes="0"/> + <EmptySpace min="0" pref="0" max="32767" attributes="0"/> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jScrollPane1" min="-2" pref="268" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="turnback_button" max="32767" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Container class="javax.swing.JScrollPane" name="jScrollPane1"> + <AuxValues> + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> + </AuxValues> + + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> + <SubComponents> + <Component class="javax.swing.JTable" name="table"> + <Properties> + <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> + <Color blue="fe" green="b5" red="19" type="rgb"/> + </Property> + <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> + <Table columnCount="5" rowCount="4"> + <Column editable="true" title="ID" type="java.lang.Object"/> + <Column editable="true" title="Account Name" type="java.lang.Object"/> + <Column editable="true" title="Username" type="java.lang.Object"/> + <Column editable="true" title="Password" type="java.lang.Object"/> + <Column editable="true" title="Email Address" type="java.lang.Object"/> + </Table> + </Property> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[500, 240]"/> + </Property> + <Property name="rowHeight" type="int" value="30"/> + <Property name="rowMargin" type="int" value="5"/> + </Properties> + </Component> + </SubComponents> + </Container> + <Component class="javax.swing.JButton" name="turnback_button"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="turnback_buttonActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/src/Database_View.java b/projects/PassBox-master/src/Database_View.java new file mode 100644 index 0000000..1d46af9 --- /dev/null +++ b/projects/PassBox-master/src/Database_View.java @@ -0,0 +1,190 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +import java.awt.Toolkit; +import java.sql.*; +import javax.swing.*; +import javax.swing.table.DefaultTableModel; +/** + * + * @author root + */ +public class Database_View extends javax.swing.JFrame { +String url="jdbc:mysql://localhost:3306/"; //sizde 3306 olabilir +String veritabaniadi="passbox_db"; // ulaşmak istediğiniz veri tabanı ismi +String surucu="com.mysql.jdbc.Driver"; +String kullaniciAdi="root"; // workbench deki kullanıcı adınız ne ise o "root" olabilir +String kullaniciParolası=""; //workbench deki şifreniz ne ise o +Connection baglanti=null; +Statement komut=null; +ResultSet gelenveri=null; +PreparedStatement pst=null; + + /** + * Creates new form Database_View + */ + public Database_View() { + initComponents(); + setIcon(); + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + baglantiac(); + verilistele(); + } + public void verilistele() + { try { + Object []baslik={"ID","Account Name","Username","Password","Email Address"}; + Object [][]veri; + String sorgu="select * from passbox_db.password_database_tb"; + PreparedStatement st=baglanti.prepareStatement(sorgu); + try (ResultSet set = st.executeQuery()) { + int count=0; set.last(); count=set.getRow(); + veri=new Object [count][5]; set.first(); + for(int i=0;i<count;i++){ + for(int j=0;j<5;j++) + veri[i][j]=set.getObject(j+1); + set.next(); } + table.setModel(new DefaultTableModel(veri,baslik)); set.close(); + } + } catch (SQLException ex) { + JOptionPane.showInputDialog("veri listeleme hatası"+ex); + } + } + public void baglantiac(){ + try { + Class.forName(surucu); + //baglantı veri tabanı seçimi kullanıcı adı ve parola ile sağlanı + baglanti= DriverManager.getConnection(url+veritabaniadi, kullaniciAdi,kullaniciParolası); + } catch (ClassNotFoundException | SQLException ex) { + JOptionPane.showInputDialog("Hata sunucu ve baglantı hatası"+ex); + } + } + public void baglantikapat() + { + try { + baglanti.close(); + } catch (SQLException e) { + JOptionPane.showInputDialog("Hata sunucu ve baglantı kapama hatası"+e); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jScrollPane1 = new javax.swing.JScrollPane(); + table = new javax.swing.JTable(); + turnback_button = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("PassBox | Database View"); + setFocusable(false); + setResizable(false); + + table.setBackground(new java.awt.Color(25, 181, 254)); + table.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {null, null, null, null, null}, + {null, null, null, null, null}, + {null, null, null, null, null}, + {null, null, null, null, null} + }, + new String [] { + "ID", "Account Name", "Username", "Password", "Email Address" + } + )); + table.setPreferredSize(new java.awt.Dimension(500, 240)); + table.setRowHeight(30); + table.setRowMargin(5); + jScrollPane1.setViewportView(table); + + turnback_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/turnback_ico.png"))); // NOI18N + turnback_button.setText("Turn Back"); + turnback_button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + turnback_buttonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 813, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addComponent(turnback_button, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 268, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(turnback_button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void turnback_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_turnback_buttonActionPerformed + // TODO add your handling code here: + this.setVisible(false); + }//GEN-LAST:event_turnback_buttonActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Database_View.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Database_View.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Database_View.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Database_View.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + //</editor-fold> + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Database_View().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTable table; + private javax.swing.JButton turnback_button; + // End of variables declaration//GEN-END:variables + + private void setIcon() { + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("passbox_ico.png"))); + } +} diff --git a/projects/PassBox-master/src/Delete_Password_Page.form b/projects/PassBox-master/src/Delete_Password_Page.form new file mode 100644 index 0000000..686ce7b --- /dev/null +++ b/projects/PassBox-master/src/Delete_Password_Page.form @@ -0,0 +1,173 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | Delete Password Page"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton1" min="-2" pref="350" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" pref="23" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" attributes="0"> + <Component id="jLabel3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel4" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="9" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="password_txt" max="32767" attributes="0"/> + <Component id="email_address_txt" max="32767" attributes="0"/> + </Group> + </Group> + <Group type="102" attributes="0"> + <Component id="jButton2" min="-2" pref="138" max="-2" attributes="0"/> + <EmptySpace max="32767" attributes="0"/> + <Component id="jButton3" min="-2" pref="130" max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <Group type="103" groupAlignment="1" attributes="0"> + <Component id="jLabel2" min="-2" max="-2" attributes="0"/> + <Component id="jLabel1" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="social_media_name_txt" max="32767" attributes="0"/> + <Component id="username_txt" max="32767" attributes="0"/> + </Group> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="32767" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="social_media_name_txt" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="username_txt" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="password_txt" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="email_address_txt" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="55" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jButton2" min="-2" pref="87" max="-2" attributes="0"/> + <Component id="jButton3" min="-2" pref="87" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Component id="jButton1" min="-2" max="-2" attributes="0"/> + <EmptySpace min="0" pref="9" max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton2"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton3"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/password_delete_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Delete Password"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton3ActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="text" type="java.lang.String" value="Social Media Name : "/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="social_media_name_txt"> + <AuxValues> + <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="9"/> + </AuxValues> + </Component> + <Component class="javax.swing.JTextField" name="username_txt"> + </Component> + <Component class="javax.swing.JTextField" name="password_txt"> + <AuxValues> + <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="9"/> + </AuxValues> + </Component> + <Component class="javax.swing.JTextField" name="email_address_txt"> + <AuxValues> + <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="9"/> + </AuxValues> + </Component> + <Component class="javax.swing.JLabel" name="jLabel2"> + <Properties> + <Property name="text" type="java.lang.String" value="Username : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel3"> + <Properties> + <Property name="text" type="java.lang.String" value="Password : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel4"> + <Properties> + <Property name="text" type="java.lang.String" value="Email Address : "/> + </Properties> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/src/Delete_Password_Page.java b/projects/PassBox-master/src/Delete_Password_Page.java new file mode 100644 index 0000000..3750eba --- /dev/null +++ b/projects/PassBox-master/src/Delete_Password_Page.java @@ -0,0 +1,226 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +import java.sql.*; +import javax.swing.*; +import java.awt.*; +/** + * + * @author q + */ +public class Delete_Password_Page extends javax.swing.JFrame { +String url="jdbc:mysql://localhost:3306/"; //sizde 3306 olabilir +String veritabaniadi="passbox_db"; // ulaşmak istediğiniz veri tabanı ismi +String surucu="com.mysql.jdbc.Driver"; +String kullaniciAdi="root"; // workbench deki kullanıcı adınız ne ise o "root" olabilir +String kullaniciParolası=""; //workbench deki şifreniz ne ise o +Connection baglanti=null; +Statement komut=null; +ResultSet gelenveri=null; +PreparedStatement pst=null; + /** + * Creates new form Delete_Password_Page + */ + public Delete_Password_Page() { + initComponents(); + setIcon(); + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + try { + Class.forName(surucu); + //baglantı veri tabanı seçimi kullanıcı adı ve parola ile sağlanı + baglanti= DriverManager.getConnection(url+veritabaniadi, kullaniciAdi,kullaniciParolası); + } catch (ClassNotFoundException | SQLException ex) { + System.out.println("HATA 1: Surucu ve Baglantı Hatsı !"+ex); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + social_media_name_txt = new javax.swing.JTextField(); + username_txt = new javax.swing.JTextField(); + password_txt = new javax.swing.JTextField(); + email_address_txt = new javax.swing.JTextField(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("PassBox | Delete Password Page"); + setResizable(false); + + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + + jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/turnback_ico.png"))); // NOI18N + jButton2.setText("Turn Back"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/password_delete_ico.png"))); // NOI18N + jButton3.setText("Delete Password"); + jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + + jLabel1.setText("Social Media Name : "); + + jLabel2.setText("Username : "); + + jLabel3.setText("Password : "); + + jLabel4.setText("Email Address : "); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 350, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(23, 23, 23) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel3) + .addComponent(jLabel4)) + .addGap(9, 9, 9) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(password_txt) + .addComponent(email_address_txt))) + .addGroup(layout.createSequentialGroup() + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel2) + .addComponent(jLabel1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(social_media_name_txt) + .addComponent(username_txt)))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(social_media_name_txt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(username_txt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(password_txt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(email_address_txt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel4)) + .addGap(55, 55, 55) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap()) + .addGroup(layout.createSequentialGroup() + .addComponent(jButton1) + .addGap(0, 9, Short.MAX_VALUE)) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + // TODO add your handling code here: + this.setVisible(false); + }//GEN-LAST:event_jButton2ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + String sorgu = "DELETE FROM password_database_tb WHERE account_name=?"; + try { + pst=baglanti.prepareStatement(sorgu); + pst.setString(1,social_media_name_txt.getText() ); + pst.execute(); + JOptionPane.showMessageDialog(null,"Başarılı bir şekilde silme işlemi tamamlandı!"); + } catch (SQLException ex) { + JOptionPane.showConfirmDialog(null, "Sorgu da hata var !"+ex); + } + }//GEN-LAST:event_jButton3ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Delete_Password_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Delete_Password_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Delete_Password_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Delete_Password_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + //</editor-fold> + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Delete_Password_Page().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + public static javax.swing.JTextField email_address_txt; + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + public static javax.swing.JTextField password_txt; + public static javax.swing.JTextField social_media_name_txt; + private javax.swing.JTextField username_txt; + // End of variables declaration//GEN-END:variables + + private void setIcon() { + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("passbox_ico.png"))); + } +} diff --git a/projects/PassBox-master/src/Forgot_Account_Page.form b/projects/PassBox-master/src/Forgot_Account_Page.form new file mode 100644 index 0000000..4750362 --- /dev/null +++ b/projects/PassBox-master/src/Forgot_Account_Page.form @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | Forgot Account ?"/> + <Property name="autoRequestFocus" type="boolean" value="false"/> + <Property name="focusCycleRoot" type="boolean" value="false"/> + <Property name="focusable" type="boolean" value="false"/> + <Property name="focusableWindowState" type="boolean" value="false"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace min="-2" pref="2" max="-2" attributes="0"/> + <Component id="jButton_Forgot_Account_PassBox_Logo" min="-2" pref="321" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Component id="jButton_Forgot_Account_TurnBack_Button" min="-2" pref="136" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="jButton_Forgot_Account_Exit_Button" min="-2" pref="136" max="-2" attributes="0"/> + <EmptySpace min="0" pref="0" max="32767" attributes="0"/> + </Group> + <Component id="jButton_Forgot_Account_ForgotPassword_Button" max="32767" attributes="0"/> + <Component id="jButton_Forgot_Account_ForgotUsername_Button" alignment="0" max="32767" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="1" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" pref="1" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" attributes="0"> + <Group type="102" attributes="0"> + <Component id="jButton_Forgot_Account_ForgotUsername_Button" min="-2" pref="60" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="32" max="-2" attributes="0"/> + <Component id="jButton_Forgot_Account_ForgotPassword_Button" min="-2" pref="60" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="55" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jButton_Forgot_Account_TurnBack_Button" alignment="3" min="-2" pref="60" max="-2" attributes="0"/> + <Component id="jButton_Forgot_Account_Exit_Button" alignment="3" min="-2" pref="60" max="-2" attributes="0"/> + </Group> + </Group> + <Component id="jButton_Forgot_Account_PassBox_Logo" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JButton" name="jButton_Forgot_Account_PassBox_Logo"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton_Forgot_Account_ForgotUsername_Button"> + <Properties> + <Property name="text" type="java.lang.String" value="Forgot Username ?"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_Forgot_Account_ForgotUsername_ButtonActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_Forgot_Account_ForgotPassword_Button"> + <Properties> + <Property name="text" type="java.lang.String" value="Forgot Password ?"/> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton_Forgot_Account_TurnBack_Button"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_Forgot_Account_TurnBack_ButtonActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_Forgot_Account_Exit_Button"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/exit_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Exit"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_Forgot_Account_Exit_ButtonActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/src/Forgot_Account_Page.java b/projects/PassBox-master/src/Forgot_Account_Page.java new file mode 100644 index 0000000..0f72330 --- /dev/null +++ b/projects/PassBox-master/src/Forgot_Account_Page.java @@ -0,0 +1,175 @@ + +import java.awt.Toolkit; + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author root + */ +public class Forgot_Account_Page extends javax.swing.JFrame { + + /** + * Creates new form Forgot_Account_Page + */ + public Forgot_Account_Page() { + initComponents(); + setIcon(); + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jButton_Forgot_Account_PassBox_Logo = new javax.swing.JButton(); + jButton_Forgot_Account_ForgotUsername_Button = new javax.swing.JButton(); + jButton_Forgot_Account_ForgotPassword_Button = new javax.swing.JButton(); + jButton_Forgot_Account_TurnBack_Button = new javax.swing.JButton(); + jButton_Forgot_Account_Exit_Button = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("PassBox | Forgot Account ?"); + setAutoRequestFocus(false); + setFocusCycleRoot(false); + setFocusable(false); + setFocusableWindowState(false); + setResizable(false); + + jButton_Forgot_Account_PassBox_Logo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + + jButton_Forgot_Account_ForgotUsername_Button.setText("Forgot Username ?"); + jButton_Forgot_Account_ForgotUsername_Button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_Forgot_Account_ForgotUsername_ButtonActionPerformed(evt); + } + }); + + jButton_Forgot_Account_ForgotPassword_Button.setText("Forgot Password ?"); + + jButton_Forgot_Account_TurnBack_Button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/turnback_ico.png"))); // NOI18N + jButton_Forgot_Account_TurnBack_Button.setText("Turn Back"); + jButton_Forgot_Account_TurnBack_Button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_Forgot_Account_TurnBack_ButtonActionPerformed(evt); + } + }); + + jButton_Forgot_Account_Exit_Button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/exit_ico.png"))); // NOI18N + jButton_Forgot_Account_Exit_Button.setText("Exit"); + jButton_Forgot_Account_Exit_Button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_Forgot_Account_Exit_ButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(2, 2, 2) + .addComponent(jButton_Forgot_Account_PassBox_Logo, javax.swing.GroupLayout.PREFERRED_SIZE, 321, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jButton_Forgot_Account_TurnBack_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jButton_Forgot_Account_Exit_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(jButton_Forgot_Account_ForgotPassword_Button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton_Forgot_Account_ForgotUsername_Button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addGap(1, 1, 1) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addComponent(jButton_Forgot_Account_ForgotUsername_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(32, 32, 32) + .addComponent(jButton_Forgot_Account_ForgotPassword_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(55, 55, 55) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jButton_Forgot_Account_TurnBack_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton_Forgot_Account_Exit_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(jButton_Forgot_Account_PassBox_Logo)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void jButton_Forgot_Account_Exit_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_Forgot_Account_Exit_ButtonActionPerformed + // TODO add your handling code here: + System.exit(0); + }//GEN-LAST:event_jButton_Forgot_Account_Exit_ButtonActionPerformed + + private void jButton_Forgot_Account_TurnBack_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_Forgot_Account_TurnBack_ButtonActionPerformed + // TODO add your handling code here: + this.setVisible(false); + Login_Page frame = new Login_Page(); + frame.setVisible(true); + }//GEN-LAST:event_jButton_Forgot_Account_TurnBack_ButtonActionPerformed + + private void jButton_Forgot_Account_ForgotUsername_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_Forgot_Account_ForgotUsername_ButtonActionPerformed + + }//GEN-LAST:event_jButton_Forgot_Account_ForgotUsername_ButtonActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Forgot_Account_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Forgot_Account_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Forgot_Account_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Forgot_Account_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + //</editor-fold> + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Forgot_Account_Page().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton_Forgot_Account_Exit_Button; + private javax.swing.JButton jButton_Forgot_Account_ForgotPassword_Button; + private javax.swing.JButton jButton_Forgot_Account_ForgotUsername_Button; + private javax.swing.JButton jButton_Forgot_Account_PassBox_Logo; + private javax.swing.JButton jButton_Forgot_Account_TurnBack_Button; + // End of variables declaration//GEN-END:variables + + private void setIcon() { + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("passbox_ico.png"))); + } +} \ No newline at end of file diff --git a/projects/PassBox-master/src/Home.form b/projects/PassBox-master/src/Home.form new file mode 100644 index 0000000..a19299e --- /dev/null +++ b/projects/PassBox-master/src/Home.form @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | Home Page"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jButton1" alignment="1" max="32767" attributes="0"/> + <Component id="jProgressBar1" alignment="0" max="32767" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace pref="252" max="32767" attributes="0"/> + <Component id="jLabel1" min="-2" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="237" max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton1" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jLabel1" pref="35" max="32767" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jProgressBar1" min="-2" pref="30" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JProgressBar" name="jProgressBar1"> + <Properties> + <Property name="stringPainted" type="boolean" value="true"/> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="24" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="PassBox v1.0.0"/> + </Properties> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/src/Home.java b/projects/PassBox-master/src/Home.java new file mode 100644 index 0000000..0dfdbad --- /dev/null +++ b/projects/PassBox-master/src/Home.java @@ -0,0 +1,125 @@ + +import java.awt.event.ActionListener; +import javax.swing.Timer; + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + + +/** + * + * @author q + */ +public class Home extends javax.swing.JFrame { + + /** + * Creates new form Home + */ + public Home() { + initComponents(); + int value; + for(int i=0;i<=100;i++) + { + + jProgressBar1.setValue(i); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jProgressBar1 = new javax.swing.JProgressBar(); + jButton1 = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("PassBox | Home Page"); + setResizable(false); + + jProgressBar1.setStringPainted(true); + + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + + jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N + jLabel1.setText("PassBox v1.0.0"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jProgressBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(252, Short.MAX_VALUE) + .addComponent(jLabel1) + .addGap(237, 237, 237)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + //</editor-fold> + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Home().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JProgressBar jProgressBar1; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/PassBox-master/src/Log_Control_Page.form b/projects/PassBox-master/src/Log_Control_Page.form new file mode 100644 index 0000000..3e3e091 --- /dev/null +++ b/projects/PassBox-master/src/Log_Control_Page.form @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | Log Control Page"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jScrollPane1" pref="715" max="32767" attributes="0"/> + <Group type="102" attributes="0"> + <Component id="turnback_button" min="-2" pref="275" max="-2" attributes="0"/> + <EmptySpace type="separate" max="-2" attributes="0"/> + <Component id="deletealllogs_button" max="32767" attributes="0"/> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jScrollPane1" min="-2" pref="300" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="turnback_button" pref="50" max="32767" attributes="0"/> + <Component id="deletealllogs_button" max="32767" attributes="0"/> + </Group> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Container class="javax.swing.JScrollPane" name="jScrollPane1"> + <AuxValues> + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> + </AuxValues> + + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> + <SubComponents> + <Component class="javax.swing.JTable" name="table"> + <Properties> + <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> + <Table columnCount="5" rowCount="4"> + <Column editable="true" title="Log Id" type="java.lang.Object"/> + <Column editable="true" title="User Id" type="java.lang.Object"/> + <Column editable="true" title="Fullname" type="java.lang.Object"/> + <Column editable="true" title="Username" type="java.lang.Object"/> + <Column editable="true" title="Entry Time" type="java.lang.Object"/> + </Table> + </Property> + <Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor"> + <TableColumnModel selectionModel="0"> + <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> + <Title/> + <Editor/> + <Renderer/> + </Column> + <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> + <Title/> + <Editor/> + <Renderer/> + </Column> + <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> + <Title/> + <Editor/> + <Renderer/> + </Column> + <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> + <Title/> + <Editor/> + <Renderer/> + </Column> + <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> + <Title/> + <Editor/> + <Renderer/> + </Column> + </TableColumnModel> + </Property> + <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor"> + <TableHeader reorderingAllowed="true" resizingAllowed="true"/> + </Property> + </Properties> + </Component> + </SubComponents> + </Container> + <Component class="javax.swing.JButton" name="turnback_button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="turnback_buttonActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="deletealllogs_button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/password_delete_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Delete All Logs"/> + </Properties> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/src/Log_Control_Page.java b/projects/PassBox-master/src/Log_Control_Page.java new file mode 100644 index 0000000..9440e1f --- /dev/null +++ b/projects/PassBox-master/src/Log_Control_Page.java @@ -0,0 +1,147 @@ + +import java.awt.Toolkit; + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author q + */ +public class Log_Control_Page extends javax.swing.JFrame { + + /** + * Creates new form Log_Control_Page + */ + public Log_Control_Page() { + initComponents(); + setIcon(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jScrollPane1 = new javax.swing.JScrollPane(); + table = new javax.swing.JTable(); + turnback_button = new javax.swing.JButton(); + deletealllogs_button = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("PassBox | Log Control Page"); + setResizable(false); + + table.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {null, null, null, null, null}, + {null, null, null, null, null}, + {null, null, null, null, null}, + {null, null, null, null, null} + }, + new String [] { + "Log Id", "User Id", "Fullname", "Username", "Entry Time" + } + )); + jScrollPane1.setViewportView(table); + + turnback_button.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + turnback_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/turnback_ico.png"))); // NOI18N + turnback_button.setText("Turn Back"); + turnback_button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + turnback_buttonActionPerformed(evt); + } + }); + + deletealllogs_button.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + deletealllogs_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/password_delete_ico.png"))); // NOI18N + deletealllogs_button.setText("Delete All Logs"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 715, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addComponent(turnback_button, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(deletealllogs_button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(turnback_button, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE) + .addComponent(deletealllogs_button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void turnback_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_turnback_buttonActionPerformed + // TODO add your handling code here: + this.setVisible(false); + }//GEN-LAST:event_turnback_buttonActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Log_Control_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Log_Control_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Log_Control_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Log_Control_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + //</editor-fold> + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Log_Control_Page().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton deletealllogs_button; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTable table; + private javax.swing.JButton turnback_button; + // End of variables declaration//GEN-END:variables + + private void setIcon() { + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("passbox_ico.png"))); + } +} diff --git a/projects/PassBox-master/src/Login_Page.form b/projects/PassBox-master/src/Login_Page.form new file mode 100644 index 0000000..2837b6c --- /dev/null +++ b/projects/PassBox-master/src/Login_Page.form @@ -0,0 +1,251 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | Login Panel"/> + <Property name="alwaysOnTop" type="boolean" value="true"/> + <Property name="focusTraversalPolicyProvider" type="boolean" value="true"/> + <Property name="locationByPlatform" type="boolean" value="true"/> + <Property name="name" type="java.lang.String" value="PassBox" noResource="true"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_Login_Panel_Button_Logo" min="-2" pref="326" max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" pref="135" max="-2" attributes="0"/> + <Component id="jLabel_Login_Panel_PassBox_Name" min="-2" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace type="separate" max="-2" attributes="0"/> + <Component id="jPanel_Login_Page" max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jPanel_Login_Page" min="-2" pref="354" max="-2" attributes="0"/> + <Group type="102" attributes="0"> + <Component id="jButton_Login_Panel_Button_Logo" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jLabel_Login_Panel_PassBox_Name" min="-2" pref="22" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Container class="javax.swing.JPanel" name="jPanel_Login_Page"> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" max="-2" attributes="0"> + <Component id="jButton_Login_Page_Login_Button" alignment="0" max="32767" attributes="0"/> + <Group type="102" attributes="0"> + <Group type="103" groupAlignment="1" attributes="0"> + <Component id="jLabel_Login_Page_username" min="-2" max="-2" attributes="0"/> + <Component id="jLabel_Login_Panel_password" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="username_txt" max="32767" attributes="0"/> + <Component id="password_txt" max="32767" attributes="0"/> + </Group> + </Group> + <Component id="jButton_Login_Page_Create_New_Account" max="32767" attributes="0"/> + <Component id="jButton_Login_Page_Exit_Button" max="32767" attributes="0"/> + <Component id="jButton_Login_Page_Forgot_Account_Button" max="32767" attributes="0"/> + <Component id="jButton_Login_Page_Contact_Me" max="32767" attributes="0"/> + </Group> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace min="-2" pref="14" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel_Login_Page_username" alignment="3" max="-2" attributes="0"/> + <Component id="username_txt" alignment="3" min="-2" pref="35" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel_Login_Panel_password" alignment="3" min="-2" pref="30" max="-2" attributes="0"/> + <Component id="password_txt" alignment="3" min="-2" pref="35" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_Login_Page_Login_Button" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_Login_Page_Forgot_Account_Button" min="-2" max="-2" attributes="0"/> + <EmptySpace max="32767" attributes="0"/> + <Component id="jButton_Login_Page_Create_New_Account" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_Login_Page_Contact_Me" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_Login_Page_Exit_Button" min="-2" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="56" max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="jLabel_Login_Page_username"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Username : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel_Login_Panel_password"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Password : "/> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton_Login_Page_Login_Button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/login_button.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Login"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_Login_Page_Login_ButtonActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_Login_Page_Create_New_Account"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/register_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Create a New Account"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_Login_Page_Create_New_AccountActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_Login_Page_Exit_Button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/exit_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Exit"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_Login_Page_Exit_ButtonActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_Login_Page_Forgot_Account_Button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/forgot_password.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Forgot account ?"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_Login_Page_Forgot_Account_ButtonActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JTextField" name="username_txt"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JPasswordField" name="password_txt"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton_Login_Page_Contact_Me"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/contact_us.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Contact Me"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_Login_Page_Contact_MeActionPerformed"/> + </Events> + </Component> + </SubComponents> + </Container> + <Component class="javax.swing.JButton" name="jButton_Login_Panel_Button_Logo"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + <Property name="disabledIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + <Property name="pressedIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + <Property name="rolloverIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel_Login_Panel_PassBox_Name"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="PassBox"/> + </Properties> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/src/Login_Page.java b/projects/PassBox-master/src/Login_Page.java new file mode 100644 index 0000000..2ac70e5 --- /dev/null +++ b/projects/PassBox-master/src/Login_Page.java @@ -0,0 +1,338 @@ +import java.awt.Toolkit; +import java.sql.*; +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyEvent; +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author root + */ +public class Login_Page extends javax.swing.JFrame { +String url="jdbc:mysql://localhost:3306/"; //sizde 3306 olabilir +String veritabaniadi="passbox_db"; // ulaşmak istediğiniz veri tabanı ismi +String surucu="com.mysql.jdbc.Driver"; +String kullaniciAdi="root"; // workbench deki kullanıcı adınız ne ise o "root" olabilir +String kullaniciParolası=""; //workbench deki şifreniz ne ise o +Connection baglanti=null; +Statement komut=null; +ResultSet gelenveri=null; +PreparedStatement pst=null; + private Object e; + /** + * Creates new form Login_Panel + */ + public Login_Page() { + initComponents(); + setIcon(); + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + try { + Class.forName(surucu); + //baglantı veri tabanı seçimi kullanıcı adı ve parola ile sağlanı + baglanti= DriverManager.getConnection(url+veritabaniadi, kullaniciAdi,kullaniciParolası); + } catch (ClassNotFoundException | SQLException ex) { + JOptionPane.showMessageDialog(null,"Bağlantıda hata var!"); + } + + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jPanel_Login_Page = new javax.swing.JPanel(); + jLabel_Login_Page_username = new javax.swing.JLabel(); + jLabel_Login_Panel_password = new javax.swing.JLabel(); + jButton_Login_Page_Login_Button = new javax.swing.JButton(); + jButton_Login_Page_Create_New_Account = new javax.swing.JButton(); + jButton_Login_Page_Exit_Button = new javax.swing.JButton(); + jButton_Login_Page_Forgot_Account_Button = new javax.swing.JButton(); + username_txt = new javax.swing.JTextField(); + password_txt = new javax.swing.JPasswordField(); + jButton_Login_Page_Contact_Me = new javax.swing.JButton(); + jButton_Login_Panel_Button_Logo = new javax.swing.JButton(); + jLabel_Login_Panel_PassBox_Name = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("PassBox | Login Panel"); + setAlwaysOnTop(true); + setFocusTraversalPolicyProvider(true); + setLocationByPlatform(true); + setName("PassBox"); // NOI18N + setResizable(false); + + jLabel_Login_Page_username.setFont(new java.awt.Font("Yu Gothic UI", 1, 20)); // NOI18N + jLabel_Login_Page_username.setText("Username : "); + + jLabel_Login_Panel_password.setFont(new java.awt.Font("Yu Gothic UI", 1, 20)); // NOI18N + jLabel_Login_Panel_password.setText("Password : "); + + jButton_Login_Page_Login_Button.setFont(new java.awt.Font("Yu Gothic UI", 1, 20)); // NOI18N + jButton_Login_Page_Login_Button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/login_button.png"))); // NOI18N + jButton_Login_Page_Login_Button.setText("Login"); + jButton_Login_Page_Login_Button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_Login_Page_Login_ButtonActionPerformed(evt); + } + }); + + jButton_Login_Page_Create_New_Account.setFont(new java.awt.Font("Yu Gothic UI", 1, 20)); // NOI18N + jButton_Login_Page_Create_New_Account.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/register_ico.png"))); // NOI18N + jButton_Login_Page_Create_New_Account.setText("Create a New Account"); + jButton_Login_Page_Create_New_Account.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_Login_Page_Create_New_AccountActionPerformed(evt); + } + }); + + jButton_Login_Page_Exit_Button.setFont(new java.awt.Font("Yu Gothic UI", 1, 20)); // NOI18N + jButton_Login_Page_Exit_Button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/exit_ico.png"))); // NOI18N + jButton_Login_Page_Exit_Button.setText("Exit"); + jButton_Login_Page_Exit_Button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_Login_Page_Exit_ButtonActionPerformed(evt); + } + }); + + jButton_Login_Page_Forgot_Account_Button.setFont(new java.awt.Font("Yu Gothic UI", 1, 20)); // NOI18N + jButton_Login_Page_Forgot_Account_Button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/forgot_password.png"))); // NOI18N + jButton_Login_Page_Forgot_Account_Button.setText("Forgot account ?"); + jButton_Login_Page_Forgot_Account_Button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_Login_Page_Forgot_Account_ButtonActionPerformed(evt); + } + }); + + username_txt.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + + password_txt.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + + jButton_Login_Page_Contact_Me.setFont(new java.awt.Font("Yu Gothic UI", 1, 20)); // NOI18N + jButton_Login_Page_Contact_Me.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/contact_us.png"))); // NOI18N + jButton_Login_Page_Contact_Me.setText("Contact Me"); + jButton_Login_Page_Contact_Me.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_Login_Page_Contact_MeActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel_Login_PageLayout = new javax.swing.GroupLayout(jPanel_Login_Page); + jPanel_Login_Page.setLayout(jPanel_Login_PageLayout); + jPanel_Login_PageLayout.setHorizontalGroup( + jPanel_Login_PageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel_Login_PageLayout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel_Login_PageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jButton_Login_Page_Login_Button, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel_Login_PageLayout.createSequentialGroup() + .addGroup(jPanel_Login_PageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel_Login_Page_username) + .addComponent(jLabel_Login_Panel_password)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel_Login_PageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(username_txt) + .addComponent(password_txt))) + .addComponent(jButton_Login_Page_Create_New_Account, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton_Login_Page_Exit_Button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton_Login_Page_Forgot_Account_Button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton_Login_Page_Contact_Me, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel_Login_PageLayout.setVerticalGroup( + jPanel_Login_PageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel_Login_PageLayout.createSequentialGroup() + .addGap(14, 14, 14) + .addGroup(jPanel_Login_PageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel_Login_Page_username) + .addComponent(username_txt, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel_Login_PageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel_Login_Panel_password, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(password_txt, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton_Login_Page_Login_Button) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton_Login_Page_Forgot_Account_Button) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton_Login_Page_Create_New_Account) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton_Login_Page_Contact_Me) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton_Login_Page_Exit_Button) + .addGap(56, 56, 56)) + ); + + jButton_Login_Panel_Button_Logo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + jButton_Login_Panel_Button_Logo.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + jButton_Login_Panel_Button_Logo.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + jButton_Login_Panel_Button_Logo.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + + jLabel_Login_Panel_PassBox_Name.setFont(new java.awt.Font("Yu Gothic UI", 1, 20)); // NOI18N + jLabel_Login_Panel_PassBox_Name.setText("PassBox"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton_Login_Panel_Button_Logo, javax.swing.GroupLayout.PREFERRED_SIZE, 326, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(135, 135, 135) + .addComponent(jLabel_Login_Panel_PassBox_Name))) + .addGap(18, 18, 18) + .addComponent(jPanel_Login_Page, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel_Login_Page, javax.swing.GroupLayout.PREFERRED_SIZE, 354, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addComponent(jButton_Login_Panel_Button_Logo) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel_Login_Panel_PassBox_Name, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void jButton_Login_Page_Exit_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_Login_Page_Exit_ButtonActionPerformed + // TODO add your handling code here: + System.exit(0); + }//GEN-LAST:event_jButton_Login_Page_Exit_ButtonActionPerformed + + private void jButton_Login_Page_Forgot_Account_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_Login_Page_Forgot_Account_ButtonActionPerformed + // TODO add your handling code here: + this.setVisible(false); + Forgot_Account_Page frame = new Forgot_Account_Page(); + frame.setVisible(true); + }//GEN-LAST:event_jButton_Login_Page_Forgot_Account_ButtonActionPerformed + + private void jButton_Login_Page_Contact_MeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_Login_Page_Contact_MeActionPerformed + // TODO add your handling code here: + Contact_Me_Page frame = new Contact_Me_Page(); + frame.setVisible(true); + }//GEN-LAST:event_jButton_Login_Page_Contact_MeActionPerformed + + private void jButton_Login_Page_Create_New_AccountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_Login_Page_Create_New_AccountActionPerformed + // TODO add your handling code here: + this.setVisible(false); + Create_a_New_Account_Page frame = new Create_a_New_Account_Page(); + frame.setVisible(true); + + }//GEN-LAST:event_jButton_Login_Page_Create_New_AccountActionPerformed + + private void jButton_Login_Page_Login_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_Login_Page_Login_ButtonActionPerformed + // TODO add your handling code here: + String sorgu = "SELECT * FROM passbox_db.users_tb where username=? and password=?;"; + try { + pst=baglanti.prepareStatement(sorgu); + pst.setString(1, username_txt.getText()); + pst.setString(2, password_txt.getText()); + gelenveri=pst.executeQuery(); + if(gelenveri.next()){ + JOptionPane.showMessageDialog(null,"Başarılı giriş!"); + this.setVisible(false); + int id= (Integer) gelenveri.getObject(1); + User_Control_Panel_Page frame = new User_Control_Panel_Page(id); + frame.setVisible(true); + } + else{ + JOptionPane.showMessageDialog(null,"Başarısız giriş!"); + } + } catch (SQLException ex) { + JOptionPane.showConfirmDialog(null, "Sorgu da hata var!"); + } + + }//GEN-LAST:event_jButton_Login_Page_Login_ButtonActionPerformed + public void keyPressed(KeyEvent e) { + if (e.getKeyCode()==KeyEvent.VK_ENTER){ + String sorgu = "SELECT * FROM passbox_db.users_tb where username=? and password=?;"; + try { + pst=baglanti.prepareStatement(sorgu); + pst.setString(1, username_txt.getText()); + pst.setString(2, password_txt.getText()); + gelenveri=pst.executeQuery(); + if(gelenveri.next()){ + JOptionPane.showMessageDialog(null,"Başarılı giriş!"); + this.setVisible(false); + User_Control_Panel_Page frame = new User_Control_Panel_Page(); + frame.setVisible(true); + } + else{ + JOptionPane.showMessageDialog(null,"Başarısız giriş!"); + } + } catch (SQLException ex) { + JOptionPane.showConfirmDialog(null, "Sorgu da hata var!"); + } + } + } + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Login_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Login_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Login_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Login_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + //</editor-fold> + //</editor-fold> + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Login_Page().setVisible(true); + } + }); + } + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton_Login_Page_Contact_Me; + private javax.swing.JButton jButton_Login_Page_Create_New_Account; + private javax.swing.JButton jButton_Login_Page_Exit_Button; + private javax.swing.JButton jButton_Login_Page_Forgot_Account_Button; + private javax.swing.JButton jButton_Login_Page_Login_Button; + private javax.swing.JButton jButton_Login_Panel_Button_Logo; + private javax.swing.JLabel jLabel_Login_Page_username; + private javax.swing.JLabel jLabel_Login_Panel_PassBox_Name; + private javax.swing.JLabel jLabel_Login_Panel_password; + private javax.swing.JPanel jPanel_Login_Page; + private javax.swing.JPasswordField password_txt; + private javax.swing.JTextField username_txt; + // End of variables declaration//GEN-END:variables + + private void setIcon() { + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("passbox_ico.png"))); + } +} \ No newline at end of file diff --git a/projects/PassBox-master/src/Management_Password_Page.form b/projects/PassBox-master/src/Management_Password_Page.form new file mode 100644 index 0000000..dcec0cd --- /dev/null +++ b/projects/PassBox-master/src/Management_Password_Page.form @@ -0,0 +1,157 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | Management Password Page"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_new_add_password_logo" min="-2" pref="413" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jButton_new_password_add" alignment="1" pref="298" max="32767" attributes="0"/> + <Component id="jButton_password_delete" alignment="1" max="32767" attributes="0"/> + <Component id="jButton_database_view" alignment="1" max="32767" attributes="0"/> + <Component id="jButton_TurnBack" alignment="0" max="32767" attributes="0"/> + <Component id="jButton1" alignment="0" max="32767" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jButton_new_add_password_logo" pref="418" max="32767" attributes="0"/> + <Group type="102" attributes="0"> + <Component id="jButton_new_password_add" min="-2" pref="68" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_password_delete" min="-2" pref="64" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton1" min="-2" pref="66" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_database_view" min="-2" pref="66" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="jButton_TurnBack" max="32767" attributes="0"/> + <EmptySpace min="-2" pref="10" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JButton" name="jButton_new_password_add"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/add_password_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="New Password Add"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verifyInputWhenFocusTarget" type="boolean" value="false"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_new_password_addActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_database_view"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/database_password_view_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Database View"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_database_viewActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_password_delete"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/password_delete_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Password Delete"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_password_deleteActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_new_add_password_logo"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton_TurnBack"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_TurnBackActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/database_update_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Password Update"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/src/Management_Password_Page.java b/projects/PassBox-master/src/Management_Password_Page.java new file mode 100644 index 0000000..8bf72a6 --- /dev/null +++ b/projects/PassBox-master/src/Management_Password_Page.java @@ -0,0 +1,218 @@ + +import java.awt.Toolkit; + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author root + */ +public class Management_Password_Page extends javax.swing.JFrame { + + /** + * Creates new form Management_Password_Page + */ + public Management_Password_Page() { + initComponents(); + setIcon(); + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jButton_new_password_add = new javax.swing.JButton(); + jButton_database_view = new javax.swing.JButton(); + jButton_password_delete = new javax.swing.JButton(); + jButton_new_add_password_logo = new javax.swing.JButton(); + jButton_TurnBack = new javax.swing.JButton(); + jButton1 = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("PassBox | Management Password Page"); + setResizable(false); + + jButton_new_password_add.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton_new_password_add.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/add_password_ico.png"))); // NOI18N + jButton_new_password_add.setText("New Password Add"); + jButton_new_password_add.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton_new_password_add.setVerifyInputWhenFocusTarget(false); + jButton_new_password_add.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton_new_password_add.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_new_password_addActionPerformed(evt); + } + }); + + jButton_database_view.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton_database_view.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/database_password_view_ico.png"))); // NOI18N + jButton_database_view.setText("Database View"); + jButton_database_view.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton_database_view.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton_database_view.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_database_viewActionPerformed(evt); + } + }); + + jButton_password_delete.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton_password_delete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/password_delete_ico.png"))); // NOI18N + jButton_password_delete.setText("Password Delete"); + jButton_password_delete.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton_password_delete.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton_password_delete.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_password_deleteActionPerformed(evt); + } + }); + + jButton_new_add_password_logo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + + jButton_TurnBack.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton_TurnBack.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/turnback_ico.png"))); // NOI18N + jButton_TurnBack.setText("Turn Back"); + jButton_TurnBack.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton_TurnBack.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton_TurnBack.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_TurnBackActionPerformed(evt); + } + }); + + jButton1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/database_update_ico.png"))); // NOI18N + jButton1.setText("Password Update"); + jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton_new_add_password_logo, javax.swing.GroupLayout.PREFERRED_SIZE, 413, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jButton_new_password_add, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE) + .addComponent(jButton_password_delete, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton_database_view, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton_TurnBack, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jButton_new_add_password_logo, javax.swing.GroupLayout.DEFAULT_SIZE, 418, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addComponent(jButton_new_password_add, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton_password_delete, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton_database_view, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jButton_TurnBack, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(10, 10, 10))) + .addContainerGap()) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void jButton_new_password_addActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_new_password_addActionPerformed + // TODO add your handling code here: + New_Password_Page frame_newpassword = new New_Password_Page(); + frame_newpassword.setVisible(true); + }//GEN-LAST:event_jButton_new_password_addActionPerformed + + private void jButton_database_viewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_database_viewActionPerformed + // TODO add your handling code here: + Database_View frame_databaseview = new Database_View(); + frame_databaseview.setVisible(true); + }//GEN-LAST:event_jButton_database_viewActionPerformed + + private void jButton_TurnBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_TurnBackActionPerformed + // TODO add your handling code here: + this.setVisible(false); + }//GEN-LAST:event_jButton_TurnBackActionPerformed + + private void jButton_password_deleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_password_deleteActionPerformed + // TODO add your handling code here: + Delete_Password_Page frame_delete = new Delete_Password_Page(); + frame_delete.setVisible(true); + }//GEN-LAST:event_jButton_password_deleteActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + // TODO add your handling code here: + Update_Password_Page frame = new Update_Password_Page(); + frame.setVisible(true); + }//GEN-LAST:event_jButton1ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Management_Password_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Management_Password_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Management_Password_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Management_Password_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + //</editor-fold> + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Management_Password_Page().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton_TurnBack; + private javax.swing.JButton jButton_database_view; + private javax.swing.JButton jButton_new_add_password_logo; + private javax.swing.JButton jButton_new_password_add; + private javax.swing.JButton jButton_password_delete; + // End of variables declaration//GEN-END:variables + + private void setIcon() { + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("passbox_ico.png"))); + } +} diff --git a/projects/PassBox-master/src/New_Password_Page.form b/projects/PassBox-master/src/New_Password_Page.form new file mode 100644 index 0000000..ce658f3 --- /dev/null +++ b/projects/PassBox-master/src/New_Password_Page.form @@ -0,0 +1,201 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | New Add Password "/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton2" min="-2" pref="320" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" attributes="0"> + <Component id="jLabel_socail_media_name" min="-2" max="-2" attributes="0"/> + <Component id="jLabel_username" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel_password" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel_email_address" alignment="1" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" max="-2" attributes="0"> + <Component id="password_txt" alignment="0" pref="205" max="32767" attributes="0"/> + <Component id="socail_media_name_txt" alignment="0" max="32767" attributes="0"/> + <Component id="username_txt" alignment="0" max="32767" attributes="0"/> + <Component id="email_address_txt" alignment="0" max="32767" attributes="0"/> + </Group> + </Group> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" pref="6" max="-2" attributes="0"/> + <Component id="jButton_TurnBack" min="-2" pref="151" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="jButton1" pref="166" max="32767" attributes="0"/> + </Group> + </Group> + <EmptySpace min="-2" max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="32767" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="1" attributes="0"> + <Component id="jButton2" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel_socail_media_name" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="socail_media_name_txt" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="username_txt" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel_username" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="password_txt" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel_password" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel_email_address" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="email_address_txt" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="67" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="jButton_TurnBack" pref="90" max="32767" attributes="0"/> + <Component id="jButton1" max="32767" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="11" max="-2" attributes="0"/> + </Group> + </Group> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="jLabel_socail_media_name"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Social Media Name : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel_username"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Username : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel_password"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Password : "/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="socail_media_name_txt"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="username_txt"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="password_txt"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/add_new_password_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="New Password Add"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="jLabel_email_address"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="E-Mail Address : "/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="email_address_txt"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton2"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton_TurnBack"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_TurnBackActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/src/New_Password_Page.java b/projects/PassBox-master/src/New_Password_Page.java new file mode 100644 index 0000000..33c4569 --- /dev/null +++ b/projects/PassBox-master/src/New_Password_Page.java @@ -0,0 +1,248 @@ +import java.sql.*; +import javax.swing.*; +import java.awt.*; +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author root + */ +public class New_Password_Page extends javax.swing.JFrame { +String url="jdbc:mysql://localhost:3306/"; //sizde 3306 olabilir +String veritabaniadi="passbox_db"; // ulaşmak istediğiniz veri tabanı ismi +String surucu="com.mysql.jdbc.Driver"; +String kullaniciAdi="root"; // workbench deki kullanıcı adınız ne ise o "root" olabilir +String kullaniciParolası=""; //workbench deki şifreniz ne ise o +Connection baglanti=null; +Statement komut=null; +ResultSet gelenveri=null; +PreparedStatement pst=null; + /** + * Creates new form Manage_Passwords_Page + */ + public New_Password_Page() { + initComponents(); + setIcon(); + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + try { + Class.forName(surucu); + //baglantı veri tabanı seçimi kullanıcı adı ve parola ile sağlanı + baglanti= DriverManager.getConnection(url+veritabaniadi, kullaniciAdi,kullaniciParolası); + } catch (ClassNotFoundException | SQLException ex) { + System.out.println("HATA 1: Surucu ve baglantı hatsı !"+ex); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jLabel_socail_media_name = new javax.swing.JLabel(); + jLabel_username = new javax.swing.JLabel(); + jLabel_password = new javax.swing.JLabel(); + socail_media_name_txt = new javax.swing.JTextField(); + username_txt = new javax.swing.JTextField(); + password_txt = new javax.swing.JTextField(); + jButton1 = new javax.swing.JButton(); + jLabel_email_address = new javax.swing.JLabel(); + email_address_txt = new javax.swing.JTextField(); + jButton2 = new javax.swing.JButton(); + jButton_TurnBack = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("PassBox | New Add Password "); + setResizable(false); + + jLabel_socail_media_name.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jLabel_socail_media_name.setText("Social Media Name : "); + + jLabel_username.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jLabel_username.setText("Username : "); + + jLabel_password.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jLabel_password.setText("Password : "); + + socail_media_name_txt.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + + username_txt.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + + password_txt.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + + jButton1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/add_new_password_ico.png"))); // NOI18N + jButton1.setText("New Password Add"); + jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jLabel_email_address.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jLabel_email_address.setText("E-Mail Address : "); + + email_address_txt.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + + jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + + jButton_TurnBack.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton_TurnBack.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/turnback_ico.png"))); // NOI18N + jButton_TurnBack.setText("Turn Back"); + jButton_TurnBack.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton_TurnBack.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton_TurnBack.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_TurnBackActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel_socail_media_name) + .addComponent(jLabel_username) + .addComponent(jLabel_password) + .addComponent(jLabel_email_address)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(password_txt, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 205, Short.MAX_VALUE) + .addComponent(socail_media_name_txt, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(username_txt, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(email_address_txt, javax.swing.GroupLayout.Alignment.LEADING))) + .addGroup(layout.createSequentialGroup() + .addGap(6, 6, 6) + .addComponent(jButton_TurnBack, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(jButton2) + .addContainerGap()) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel_socail_media_name) + .addComponent(socail_media_name_txt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(username_txt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel_username)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(password_txt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel_password)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel_email_address) + .addComponent(email_address_txt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(67, 67, 67) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jButton_TurnBack, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(11, 11, 11)))) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void jButton_TurnBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_TurnBackActionPerformed + // TODO add your handling code here: + this.setVisible(false); + }//GEN-LAST:event_jButton_TurnBackActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + // TODO add your handling code here: + String sorgu = "INSERT INTO `passbox_db`.`password_database_tb`(`account_name`,`username`,`password`,`email_address`)VALUES(?,?,?,?)"; + try { + pst=baglanti.prepareStatement(sorgu); + pst.setString(1, socail_media_name_txt.getText()); + pst.setString(2, username_txt.getText()); + pst.setString(3, password_txt.getText()); + pst.setString(4, email_address_txt.getText()); + int x= pst.executeUpdate(); + if(x==1) + JOptionPane.showMessageDialog(null,"Başarılı Kayıt"); + else + JOptionPane.showMessageDialog(null,"Başarısız Kayıt"); + } catch (SQLException ex) { + JOptionPane.showConfirmDialog(null, "Sorgu da hata var !"+ex); + } + }//GEN-LAST:event_jButton1ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(New_Password_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(New_Password_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(New_Password_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(New_Password_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + //</editor-fold> + //</editor-fold> + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new New_Password_Page().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JTextField email_address_txt; + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton_TurnBack; + private javax.swing.JLabel jLabel_email_address; + private javax.swing.JLabel jLabel_password; + private javax.swing.JLabel jLabel_socail_media_name; + private javax.swing.JLabel jLabel_username; + private javax.swing.JTextField password_txt; + private javax.swing.JTextField socail_media_name_txt; + private javax.swing.JTextField username_txt; + // End of variables declaration//GEN-END:variables + + private void setIcon() { + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("passbox_ico.png"))); + } +} diff --git a/projects/PassBox-master/src/Software_Update_Page.form b/projects/PassBox-master/src/Software_Update_Page.form new file mode 100644 index 0000000..df472a9 --- /dev/null +++ b/projects/PassBox-master/src/Software_Update_Page.form @@ -0,0 +1,114 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | Software Update Page"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton1" min="-2" pref="325" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="github_button" pref="299" max="32767" attributes="0"/> + <Component id="jButton2" max="32767" attributes="0"/> + <Component id="turnback_button" alignment="0" max="32767" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="32767" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jButton1" min="-2" max="-2" attributes="0"/> + <Group type="102" attributes="0"> + <Component id="github_button" min="-2" pref="115" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="jButton2" min="-2" pref="115" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="13" max="-2" attributes="0"/> + <Component id="turnback_button" min="-2" pref="67" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="github_button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/github-logo.png"/> + </Property> + <Property name="text" type="java.lang.String" value="GitHub"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="github_buttonActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="turnback_button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="turnback_buttonActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton2"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/website.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Website"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/src/Software_Update_Page.java b/projects/PassBox-master/src/Software_Update_Page.java new file mode 100644 index 0000000..a07c268 --- /dev/null +++ b/projects/PassBox-master/src/Software_Update_Page.java @@ -0,0 +1,176 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +import java.awt.Desktop; +import static java.awt.Desktop.getDesktop; +import java.awt.Toolkit; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.logging.Level; +import java.util.logging.Logger; +/** + * + * @author q + */ +public class Software_Update_Page extends javax.swing.JFrame { + + /** + * Creates new form Software_Update_Page + */ + public Software_Update_Page() { + initComponents(); + setIcon(); + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jButton1 = new javax.swing.JButton(); + github_button = new javax.swing.JButton(); + turnback_button = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("PassBox | Software Update Page"); + + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + + github_button.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + github_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/github-logo.png"))); // NOI18N + github_button.setText("GitHub"); + github_button.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + github_button.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + github_button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + github_buttonActionPerformed(evt); + } + }); + + turnback_button.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + turnback_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/turnback_ico.png"))); // NOI18N + turnback_button.setText("Turn Back"); + turnback_button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + turnback_buttonActionPerformed(evt); + } + }); + + jButton2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/website.png"))); // NOI18N + jButton2.setText("Website"); + jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 325, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(github_button, javax.swing.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE) + .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(turnback_button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jButton1) + .addGroup(layout.createSequentialGroup() + .addComponent(github_button, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(13, 13, 13) + .addComponent(turnback_button, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void turnback_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_turnback_buttonActionPerformed + // TODO add your handling code here: + this.setVisible(false); + }//GEN-LAST:event_turnback_buttonActionPerformed + + private void github_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_github_buttonActionPerformed + try { + // TODO add your handling code here: + Desktop desktop = getDesktop(); + desktop.browse(new URI("https://github.com/ismailtasdelen/PassBox")); + } catch (URISyntaxException | IOException ex) { + Logger.getLogger(Software_Update_Page.class.getName()).log(Level.SEVERE, null, ex); + } + + }//GEN-LAST:event_github_buttonActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jButton2ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Software_Update_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Software_Update_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Software_Update_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Software_Update_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + //</editor-fold> + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Software_Update_Page().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton github_button; + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton turnback_button; + // End of variables declaration//GEN-END:variables + + private void setIcon() { + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("passbox_ico.png"))); + } +} diff --git a/projects/PassBox-master/src/Update_Password_Page.form b/projects/PassBox-master/src/Update_Password_Page.form new file mode 100644 index 0000000..d873e4b --- /dev/null +++ b/projects/PassBox-master/src/Update_Password_Page.form @@ -0,0 +1,197 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <NonVisualComponents> + <Component class="javax.swing.JSpinner" name="jSpinner1"> + </Component> + </NonVisualComponents> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton1" min="-2" pref="323" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Component id="jButton2" min="-2" pref="124" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton3" pref="153" max="32767" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Group type="103" groupAlignment="1" attributes="0"> + <Component id="jLabel2" min="-2" max="-2" attributes="0"/> + <Component id="jLabel1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel3" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel4" alignment="1" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jTextField1" max="32767" attributes="0"/> + <Component id="jTextField2" alignment="0" max="32767" attributes="0"/> + <Component id="jTextField3" max="32767" attributes="0"/> + <Component id="jTextField4" alignment="0" max="32767" attributes="0"/> + </Group> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton1" min="-2" max="-2" attributes="0"/> + <EmptySpace max="32767" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace max="32767" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jTextField1" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel2" min="-2" max="-2" attributes="0"/> + <Component id="jTextField2" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel3" min="-2" max="-2" attributes="0"/> + <Component id="jTextField3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel4" min="-2" max="-2" attributes="0"/> + <Component id="jTextField4" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="67" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="jButton2" max="32767" attributes="0"/> + <Component id="jButton3" pref="75" max="32767" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton2"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton3"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/database_update_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Update Password"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton3ActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Socail Media Name : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel2"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Username : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel3"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Password : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel4"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Email Address : "/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField2"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField3"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField4"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/src/Update_Password_Page.java b/projects/PassBox-master/src/Update_Password_Page.java new file mode 100644 index 0000000..1c83d96 --- /dev/null +++ b/projects/PassBox-master/src/Update_Password_Page.java @@ -0,0 +1,249 @@ + +import java.sql.SQLException; +import javax.swing.JOptionPane; +import java.awt.Toolkit; +import java.awt.event.ItemEvent; +import com.mysql.jdbc.Connection; +import java.sql.DriverManager; +import java.sql.*; +import javax.swing.*; + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author q + */ +public class Update_Password_Page extends javax.swing.JFrame { +String url="jdbc:mysql://localhost:3306/"; //sizde 3306 olabilir +String veritabaniadi="passbox_db"; // ulaşmak istediğiniz veri tabanı ismi +String surucu="com.mysql.jdbc.Driver"; +String kullaniciAdi="root"; // workbench deki kullanıcı adınız ne ise o "root" olabilir +String kullaniciParolası=""; //workbench deki şifreniz ne ise o +java.sql.Connection baglanti=null; +java.sql.Statement komut=null; +ResultSet gelenveri=null; +PreparedStatement pst=null; + /** + * Creates new form Update_Password_Page + */ + public Update_Password_Page() { + initComponents(); + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + try { + Class.forName(surucu); + //baglantı veri tabanı seçimi kullanıcı adı ve parola ile sağlanı + baglanti= DriverManager.getConnection(url+veritabaniadi, kullaniciAdi,kullaniciParolası); + } catch (ClassNotFoundException | SQLException ex) { + System.out.println("HATA 1: Surucu ve Baglantı Hatsı !"+ex); + } + } + int updateId=0; + public Update_Password_Page(int gelenid) { + initComponents(); + updateId=gelenid; + + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jSpinner1 = new javax.swing.JSpinner(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jTextField2 = new javax.swing.JTextField(); + jTextField3 = new javax.swing.JTextField(); + jTextField4 = new javax.swing.JTextField(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + + jButton2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/turnback_ico.png"))); // NOI18N + jButton2.setText("Turn Back"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + jButton3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/database_update_ico.png"))); // NOI18N + jButton3.setText("Update Password"); + jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + + jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jLabel1.setText("Socail Media Name : "); + + jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jLabel2.setText("Username : "); + + jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jLabel3.setText("Password : "); + + jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jLabel4.setText("Email Address : "); + + jTextField1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + + jTextField2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + + jTextField3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + + jTextField4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 323, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel2) + .addComponent(jLabel1) + .addComponent(jLabel3) + .addComponent(jLabel4)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField1) + .addComponent(jTextField2) + .addComponent(jTextField3) + .addComponent(jTextField4)))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton1) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel4) + .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(67, 67, 67) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE)) + .addContainerGap()) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + // TODO add your handling code here: + this.setVisible(false); + }//GEN-LAST:event_jButton2ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + try{ + String değer1=jTextField1.getText(); + String değer2=jTextField2.getText(); + String değer3=jTextField3.getText(); + String değer4=jTextField4.getText(); + String sorgu = "UPDATE password_database_tb SET account_name='"+değer1+"',username='"+değer2 + +"',password='"+değer3+"',email_address='"+değer4+"' where username='"+değer2+"'"; + pst=baglanti.prepareStatement(sorgu); + pst.execute(); + JOptionPane.showMessageDialog(null,"Güncelleme işlemi gerçekleşti"); + + } catch (SQLException ex) { + JOptionPane.showConfirmDialog(null, "Sorgu da hata var "+ex); + } + }//GEN-LAST:event_jButton3ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Update_Password_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Update_Password_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Update_Password_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Update_Password_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + //</editor-fold> + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Update_Password_Page().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JSpinner jSpinner1; + private javax.swing.JTextField jTextField1; + private javax.swing.JTextField jTextField2; + private javax.swing.JTextField jTextField3; + private javax.swing.JTextField jTextField4; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/PassBox-master/src/User_Control_Panel_Page.form b/projects/PassBox-master/src/User_Control_Panel_Page.form new file mode 100644 index 0000000..8d9c178 --- /dev/null +++ b/projects/PassBox-master/src/User_Control_Panel_Page.form @@ -0,0 +1,280 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <NonVisualComponents> + <Component class="javax.swing.JButton" name="jButton7"> + <Properties> + <Property name="text" type="java.lang.String" value="jButton7"/> + </Properties> + </Component> + </NonVisualComponents> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | User Control Page"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jLabel_User_Control_Panel_Page_usercontrolpanel" min="-2" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="158" max="-2" attributes="0"/> + <Component id="jLabel2" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="giris_saati_label" min="-2" pref="222" max="-2" attributes="0"/> + <EmptySpace max="32767" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace max="32767" attributes="0"/> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="software_update_button" min="-2" pref="140" max="-2" attributes="0"/> + <Component id="jButton_UserEdit" min="-2" pref="140" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Component id="jButton_AboutUs" min="-2" pref="141" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_ContactMe" min="-2" pref="125" max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Component id="jButton_AddPassword" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton_Database" min="-2" pref="125" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Component id="jButton_Exit" min="-2" pref="125" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="67" max="-2" attributes="0"/> + <Component id="jLabel1" min="-2" max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Component id="jButton1" min="-2" pref="124" max="-2" attributes="0"/> + <EmptySpace type="separate" max="-2" attributes="0"/> + <Component id="jButton4" min="-2" pref="134" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel_User_Control_Panel_Page_usercontrolpanel" alignment="3" min="-2" pref="42" max="-2" attributes="0"/> + <Component id="jLabel2" alignment="3" pref="47" max="32767" attributes="0"/> + <Component id="giris_saati_label" alignment="3" min="-2" pref="42" max="-2" attributes="0"/> + </Group> + <EmptySpace type="separate" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Component id="jButton4" min="-2" pref="90" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="jLabel1" min="-2" max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="jButton_UserEdit" max="32767" attributes="0"/> + <Component id="jButton_AddPassword" alignment="0" max="32767" attributes="0"/> + <Component id="jButton_Database" alignment="0" max="32767" attributes="0"/> + <Component id="jButton1" min="-2" pref="90" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" attributes="0"> + <Group type="103" alignment="1" groupAlignment="0" max="-2" attributes="0"> + <Component id="jButton_AboutUs" max="32767" attributes="0"/> + <Component id="jButton_ContactMe" alignment="0" max="32767" attributes="0"/> + <Component id="jButton_Exit" min="-2" pref="90" max="-2" attributes="0"/> + </Group> + <Component id="software_update_button" min="-2" pref="90" max="-2" attributes="0"/> + </Group> + </Group> + </Group> + <EmptySpace min="-2" pref="24" max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JButton" name="jButton_AboutUs"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/about_me_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="About Us"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_AboutUsActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_ContactMe"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/contact_me_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Contact Me"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ContactMeActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_Exit"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/exit_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Exit"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_ExitActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="jLabel_User_Control_Panel_Page_usercontrolpanel"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Yu Gothic UI" size="20" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="User Control Panel"/> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton_UserEdit"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/user_edit_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="User Edit"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_UserEditActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_Database"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/database_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Database"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_DatabaseActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_AddPassword"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/password_management_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Manage passwords"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_AddPasswordActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton4"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/default_user_ico.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="text" type="java.lang.String" value="........."/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel2"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="15" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="System Entry Time : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="giris_saati_label"> + <Properties> + <Property name="text" type="java.lang.String" value=" "/> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/log_file.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Log Control"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="software_update_button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/software-update.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Software Update"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="software_update_buttonActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/src/User_Control_Panel_Page.java b/projects/PassBox-master/src/User_Control_Panel_Page.java new file mode 100644 index 0000000..492705d --- /dev/null +++ b/projects/PassBox-master/src/User_Control_Panel_Page.java @@ -0,0 +1,358 @@ + +import java.awt.Toolkit; +import java.util.Calendar; +import java.util.Date; +import java.sql.*; +import javax.swing.*; +import java.awt.*; + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author root + */ +public class User_Control_Panel_Page extends javax.swing.JFrame { +String url="jdbc:mysql://localhost:3306/"; //sizde 3306 olabilir +String veritabaniadi="passbox_db"; // ulaşmak istediğiniz veri tabanı ismi +String surucu="com.mysql.jdbc.Driver"; +String kullaniciAdi="root"; // workbench deki kullanıcı adınız ne ise o "root" olabilir +String kullaniciParolası="Aykutaylin1998"; //workbench deki şifreniz ne ise o +Connection baglanti=null; +Statement komut=null; +ResultSet gelenveri=null; +PreparedStatement pst=null; + /** + * Creates new form User_Control_Panel_Page + */ + public void baglanti(){ + try { + Class.forName(surucu); + //baglantı veri tabanı seçimi kullanıcı adı ve parola ile sağlanı + baglanti= DriverManager.getConnection(url+veritabaniadi, kullaniciAdi,kullaniciParolası); + } catch (ClassNotFoundException | SQLException ex) { + System.out.println("HATA 1: Surucu ve Baglantı Hatsı !"+ex); + } + } + int id=-1; + public User_Control_Panel_Page() { + initComponents(); + } + public User_Control_Panel_Page(int gid) { + initComponents(); + setIcon(); + Date today = new Date(); + giris_saati_label.setText(today.toString()); + id=gid; + + } + User_Control_Panel_Page(int gidenid, String gidenad) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jButton7 = new javax.swing.JButton(); + jButton_AboutUs = new javax.swing.JButton(); + jButton_ContactMe = new javax.swing.JButton(); + jButton_Exit = new javax.swing.JButton(); + jLabel_User_Control_Panel_Page_usercontrolpanel = new javax.swing.JLabel(); + jButton_UserEdit = new javax.swing.JButton(); + jButton_Database = new javax.swing.JButton(); + jButton_AddPassword = new javax.swing.JButton(); + jButton4 = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + giris_saati_label = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + software_update_button = new javax.swing.JButton(); + + jButton7.setText("jButton7"); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("PassBox | User Control Page"); + setResizable(false); + + jButton_AboutUs.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton_AboutUs.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/about_me_ico.png"))); // NOI18N + jButton_AboutUs.setText("About Us"); + jButton_AboutUs.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton_AboutUs.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton_AboutUs.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_AboutUsActionPerformed(evt); + } + }); + + jButton_ContactMe.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton_ContactMe.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/contact_me_ico.png"))); // NOI18N + jButton_ContactMe.setText("Contact Me"); + jButton_ContactMe.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton_ContactMe.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton_ContactMe.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_ContactMeActionPerformed(evt); + } + }); + + jButton_Exit.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton_Exit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/exit_ico.png"))); // NOI18N + jButton_Exit.setText("Exit"); + jButton_Exit.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_ExitActionPerformed(evt); + } + }); + + jLabel_User_Control_Panel_Page_usercontrolpanel.setFont(new java.awt.Font("Yu Gothic UI", 1, 20)); // NOI18N + jLabel_User_Control_Panel_Page_usercontrolpanel.setText("User Control Panel"); + + jButton_UserEdit.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton_UserEdit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/user_edit_ico.png"))); // NOI18N + jButton_UserEdit.setText("User Edit"); + jButton_UserEdit.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton_UserEdit.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton_UserEdit.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_UserEditActionPerformed(evt); + } + }); + + jButton_Database.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton_Database.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/database_ico.png"))); // NOI18N + jButton_Database.setText("Database"); + jButton_Database.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton_Database.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton_Database.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_DatabaseActionPerformed(evt); + } + }); + + jButton_AddPassword.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton_AddPassword.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/password_management_ico.png"))); // NOI18N + jButton_AddPassword.setText("Manage passwords"); + jButton_AddPassword.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton_AddPassword.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton_AddPassword.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_AddPasswordActionPerformed(evt); + } + }); + + jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/default_user_ico.png"))); // NOI18N + + jLabel1.setText("........."); + + jLabel2.setFont(new java.awt.Font("Tahoma", 1, 15)); // NOI18N + jLabel2.setText("System Entry Time : "); + + giris_saati_label.setText(" "); + + jButton1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/log_file.png"))); // NOI18N + jButton1.setText("Log Control"); + jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + software_update_button.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + software_update_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/software-update.png"))); // NOI18N + software_update_button.setText("Software Update"); + software_update_button.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + software_update_button.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + software_update_button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + software_update_buttonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel_User_Control_Panel_Page_usercontrolpanel) + .addGap(158, 158, 158) + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(giris_saati_label, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(software_update_button, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton_UserEdit, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(jButton_AboutUs, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton_ContactMe, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(jButton_AddPassword) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton_Database, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jButton_Exit, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(67, 67, 67) + .addComponent(jLabel1)) + .addGroup(layout.createSequentialGroup() + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel_User_Control_Panel_Page_usercontrolpanel, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) + .addComponent(giris_saati_label, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jLabel1)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jButton_UserEdit, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton_AddPassword, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton_Database, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jButton_AboutUs, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton_ContactMe, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton_Exit, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(software_update_button, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addGap(24, 24, 24)) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void jButton_ExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ExitActionPerformed + // TODO add your handling code here: + System.exit(0); + }//GEN-LAST:event_jButton_ExitActionPerformed + + private void jButton_UserEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_UserEditActionPerformed + // TODO add your handling code here: + User_Edit_Page frame = new User_Edit_Page(id); + frame.setVisible(true); + }//GEN-LAST:event_jButton_UserEditActionPerformed + + private void jButton_AboutUsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_AboutUsActionPerformed + // TODO add your handling code here: + About_Us_Page frame = new About_Us_Page(); + frame.setVisible(true); + }//GEN-LAST:event_jButton_AboutUsActionPerformed + + private void jButton_AddPasswordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_AddPasswordActionPerformed + // TODO add your handling code here: + Management_Password_Page frame = new Management_Password_Page(); + frame.setVisible(true); + }//GEN-LAST:event_jButton_AddPasswordActionPerformed + + private void jButton_DatabaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_DatabaseActionPerformed + // TODO add your handling code here: + Database_View frame = new Database_View(); + frame.setVisible(true); + }//GEN-LAST:event_jButton_DatabaseActionPerformed + + private void jButton_ContactMeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ContactMeActionPerformed + // TODO add your handling code here: + Contact_Me_Page frame = new Contact_Me_Page(); + frame.setVisible(true); + }//GEN-LAST:event_jButton_ContactMeActionPerformed + + private void software_update_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_software_update_buttonActionPerformed + // TODO add your handling code here: + Software_Update_Page frame_softwareupdatepage = new Software_Update_Page(); + frame_softwareupdatepage.setVisible(true); + }//GEN-LAST:event_software_update_buttonActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + // TODO add your handling code here: + Log_Control_Page frame_logcontrolpage = new Log_Control_Page(); + frame_logcontrolpage.setVisible(true); + }//GEN-LAST:event_jButton1ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(User_Control_Panel_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(User_Control_Panel_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(User_Control_Panel_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(User_Control_Panel_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + //</editor-fold> + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new User_Control_Panel_Page().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel giris_saati_label; + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton4; + private javax.swing.JButton jButton7; + private javax.swing.JButton jButton_AboutUs; + private javax.swing.JButton jButton_AddPassword; + private javax.swing.JButton jButton_ContactMe; + private javax.swing.JButton jButton_Database; + private javax.swing.JButton jButton_Exit; + private javax.swing.JButton jButton_UserEdit; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel_User_Control_Panel_Page_usercontrolpanel; + private javax.swing.JButton software_update_button; + // End of variables declaration//GEN-END:variables + + private void setIcon() { + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("passbox_ico.png"))); + } +} diff --git a/projects/PassBox-master/src/User_Database_View_Page.form b/projects/PassBox-master/src/User_Database_View_Page.form new file mode 100644 index 0000000..adad035 --- /dev/null +++ b/projects/PassBox-master/src/User_Database_View_Page.form @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | User Database View"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jScrollPane1" pref="665" max="32767" attributes="0"/> + <Group type="102" alignment="0" attributes="0"> + <Component id="turnback_button" min="-2" pref="145" max="-2" attributes="0"/> + <EmptySpace min="0" pref="0" max="32767" attributes="0"/> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jScrollPane1" min="-2" pref="150" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="turnback_button" min="-2" pref="60" max="-2" attributes="0"/> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Container class="javax.swing.JScrollPane" name="jScrollPane1"> + <AuxValues> + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> + </AuxValues> + + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> + <SubComponents> + <Component class="javax.swing.JTable" name="table_userdatabasview"> + <Properties> + <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> + <Table columnCount="4" rowCount="4"> + <Column editable="true" title="Title 1" type="java.lang.Object"/> + <Column editable="true" title="Title 2" type="java.lang.Object"/> + <Column editable="true" title="Title 3" type="java.lang.Object"/> + <Column editable="true" title="Title 4" type="java.lang.Object"/> + </Table> + </Property> + </Properties> + </Component> + </SubComponents> + </Container> + <Component class="javax.swing.JButton" name="turnback_button"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="turnback_buttonActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/src/User_Database_View_Page.java b/projects/PassBox-master/src/User_Database_View_Page.java new file mode 100644 index 0000000..92de898 --- /dev/null +++ b/projects/PassBox-master/src/User_Database_View_Page.java @@ -0,0 +1,187 @@ + +import java.awt.Toolkit; +import java.sql.*; +import javax.swing.*; +import javax.swing.table.DefaultTableModel; +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author q + */ +public class User_Database_View_Page extends javax.swing.JFrame { +String url="jdbc:mysql://localhost:3306/"; //sizde 3306 olabilir +String veritabaniadi="passbox_db"; // ulaşmak istediğiniz veri tabanı ismi +String surucu="com.mysql.jdbc.Driver"; +String kullaniciAdi="root"; // workbench deki kullanıcı adınız ne ise o "root" olabilir +String kullaniciParolası=""; //workbench deki şifreniz ne ise o +Connection baglanti=null; +Statement komut=null; +ResultSet gelenveri=null; +PreparedStatement pst=null; + /** + * Creates new form User_Database_View + */ + public User_Database_View_Page() { + initComponents(); + setIcon(); + baglantiac(); + verilistele(); + } + public void verilistele() + { try { + Object []baslik={"ID","Full Name","Username","Password","Email Address","Mobile Number"}; + Object [][]veri; + String sorgu="select * from passbox_db.users_tb"; + PreparedStatement st=baglanti.prepareStatement(sorgu); + try (ResultSet set = st.executeQuery()) { + int count=0; set.last(); count=set.getRow(); + veri=new Object [count][6]; set.first(); + for(int i=0;i<count;i++){ + for(int j=0;j<6;j++) + veri[i][j]=set.getObject(j+1); + set.next(); } + table_userdatabasview.setModel(new DefaultTableModel(veri,baslik)); set.close(); + } + } catch (SQLException ex) { + JOptionPane.showInputDialog("veri listeleme hatası"+ex); + } + } + public void baglantiac(){ + try { + Class.forName(surucu); + //baglantı veri tabanı seçimi kullanıcı adı ve parola ile sağlanı + baglanti= DriverManager.getConnection(url+veritabaniadi, kullaniciAdi,kullaniciParolası); + } catch (ClassNotFoundException | SQLException ex) { + JOptionPane.showInputDialog("Hata sunucu ve baglantı hatası"+ex); + } + } + public void baglantikapat() + { + try { + baglanti.close(); + } catch (SQLException e) { + JOptionPane.showInputDialog("Hata sunucu ve baglantı kapama hatası"+e); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jScrollPane1 = new javax.swing.JScrollPane(); + table_userdatabasview = new javax.swing.JTable(); + turnback_button = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("PassBox | User Database View"); + setResizable(false); + + table_userdatabasview.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null} + }, + new String [] { + "Title 1", "Title 2", "Title 3", "Title 4" + } + )); + jScrollPane1.setViewportView(table_userdatabasview); + + turnback_button.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + turnback_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/turnback_ico.png"))); // NOI18N + turnback_button.setText("Turn Back"); + turnback_button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + turnback_buttonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 665, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addComponent(turnback_button, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(turnback_button, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void turnback_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_turnback_buttonActionPerformed + // TODO add your handling code here: + this.setVisible(false); + }//GEN-LAST:event_turnback_buttonActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(User_Database_View_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(User_Database_View_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(User_Database_View_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(User_Database_View_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + //</editor-fold> + //</editor-fold> + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new User_Database_View_Page().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTable table_userdatabasview; + private javax.swing.JButton turnback_button; + // End of variables declaration//GEN-END:variables + + private void setIcon() { + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("passbox_ico.png"))); + } +} diff --git a/projects/PassBox-master/src/User_Edit_Page.form b/projects/PassBox-master/src/User_Edit_Page.form new file mode 100644 index 0000000..c9589cb --- /dev/null +++ b/projects/PassBox-master/src/User_Edit_Page.form @@ -0,0 +1,247 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="PassBox | User Edit"/> + <Property name="resizable" type="boolean" value="false"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + <SyntheticProperty name="generateCenter" type="boolean" value="false"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton2" min="-2" max="-2" attributes="0"/> + <EmptySpace min="18" pref="18" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Component id="jButton_TurnBack" min="-2" pref="100" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="18" max="-2" attributes="0"/> + <Component id="jButton1" min="-2" pref="99" max="-2" attributes="0"/> + <EmptySpace type="separate" max="-2" attributes="0"/> + <Component id="jButton_Update" pref="100" max="32767" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <Group type="103" groupAlignment="1" attributes="0"> + <Component id="jLabel2" min="-2" max="-2" attributes="0"/> + <Component id="jLabel1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel3" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel4" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel5" alignment="1" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="14" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="jTextField1" max="32767" attributes="0"/> + <Component id="jTextField2" max="32767" attributes="0"/> + <Component id="jPasswordField1" alignment="1" max="32767" attributes="0"/> + <Component id="jTextField3" max="32767" attributes="0"/> + <Component id="jTextField4" pref="175" max="32767" attributes="0"/> + </Group> + </Group> + </Group> + <EmptySpace min="-2" pref="19" max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Group type="103" groupAlignment="1" attributes="0"> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton2" max="32767" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace min="-2" pref="25" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jTextField1" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jTextField2" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jPasswordField1" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jTextField3" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jTextField4" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="16" pref="16" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jButton_Update" max="32767" attributes="0"/> + <Component id="jButton1" max="32767" attributes="0"/> + <Component id="jButton_TurnBack" alignment="0" max="32767" attributes="0"/> + </Group> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JButton" name="jButton_TurnBack"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/turnback_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Turn Back"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_TurnBackActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton_Update"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/database_update_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="Update"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_UpdateActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/ico/database_view_ico.png"/> + </Property> + <Property name="text" type="java.lang.String" value="DB View"/> + <Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor"> + <Color id="Default Cursor"/> + </Property> + <Property name="hideActionText" type="boolean" value="true"/> + <Property name="horizontalTextPosition" type="int" value="0"/> + <Property name="verifyInputWhenFocusTarget" type="boolean" value="false"/> + <Property name="verticalTextPosition" type="int" value="3"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="jButton2"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/logo/PassBox.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Full Name : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel2"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Username : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel3"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Password : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel4"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="E-Mail Address : "/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel5"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Mobile Number : "/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField2"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="enabled" type="boolean" value="false"/> + </Properties> + </Component> + <Component class="javax.swing.JPasswordField" name="jPasswordField1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField3"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField4"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + </Properties> + </Component> + </SubComponents> +</Form> diff --git a/projects/PassBox-master/src/User_Edit_Page.java b/projects/PassBox-master/src/User_Edit_Page.java new file mode 100644 index 0000000..62f419c --- /dev/null +++ b/projects/PassBox-master/src/User_Edit_Page.java @@ -0,0 +1,296 @@ + +import java.awt.Toolkit; +import java.sql.*; +import javax.swing.*; +import javax.swing.table.DefaultTableModel; + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author root + */ +public class User_Edit_Page extends javax.swing.JFrame { +String url="jdbc:mysql://localhost:3306/"; +String veritabaniadi="passbox_db"; +String surucu="com.mysql.jdbc.Driver"; +String kullaniciAdi="root"; +String kullaniciParolası=""; +Connection baglanti=null; +Statement komut=null; +ResultSet gelenveri=null; +PreparedStatement pst=null; + /** + * Creates new form User_Edit_PAge + */ +int id=-1; +public User_Edit_Page( ) { + initComponents(); +} + public User_Edit_Page( int gid) { + initComponents(); + id=gid; + jTextField2.setText(String.valueOf(gid)); + setIcon(); + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + try { + Class.forName(surucu); + //baglantı veri tabanı seçimi kullanıcı adı ve parola ile sağlanı + baglanti= DriverManager.getConnection(url+veritabaniadi, kullaniciAdi,kullaniciParolası); + } catch (ClassNotFoundException | SQLException ex) { + System.out.println("HATA 1: Surucu ve Baglantı Hatsı !"+ex); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jButton_TurnBack = new javax.swing.JButton(); + jButton_Update = new javax.swing.JButton(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jTextField2 = new javax.swing.JTextField(); + jPasswordField1 = new javax.swing.JPasswordField(); + jTextField3 = new javax.swing.JTextField(); + jTextField4 = new javax.swing.JTextField(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("PassBox | User Edit"); + setResizable(false); + + jButton_TurnBack.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton_TurnBack.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/turnback_ico.png"))); // NOI18N + jButton_TurnBack.setText("Turn Back"); + jButton_TurnBack.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton_TurnBack.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton_TurnBack.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_TurnBackActionPerformed(evt); + } + }); + + jButton_Update.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton_Update.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/database_update_ico.png"))); // NOI18N + jButton_Update.setText("Update"); + jButton_Update.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton_Update.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton_Update.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_UpdateActionPerformed(evt); + } + }); + + jButton1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ico/database_view_ico.png"))); // NOI18N + jButton1.setText("DB View"); + jButton1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); + jButton1.setHideActionText(true); + jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton1.setVerifyInputWhenFocusTarget(false); + jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/PassBox.png"))); // NOI18N + + jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jLabel1.setText("Full Name : "); + + jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jLabel2.setText("Username : "); + + jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jLabel3.setText("Password : "); + + jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jLabel4.setText("E-Mail Address : "); + + jLabel5.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jLabel5.setText("Mobile Number : "); + + jTextField1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + + jTextField2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + jTextField2.setEnabled(false); + + jPasswordField1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + + jTextField3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + + jTextField4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton2) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jButton_TurnBack, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jButton_Update, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel2) + .addComponent(jLabel1) + .addComponent(jLabel3) + .addComponent(jLabel4) + .addComponent(jLabel5)) + .addGap(14, 14, 14) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jTextField1) + .addComponent(jTextField2) + .addComponent(jPasswordField1, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jTextField3) + .addComponent(jTextField4, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)))) + .addGap(19, 19, 19)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addGap(25, 25, 25) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel4)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5) + .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(16, 16, 16) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jButton_Update, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton_TurnBack, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + .addContainerGap()) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void jButton_TurnBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_TurnBackActionPerformed + // TODO add your handling code here: + this.setVisible(false); + }//GEN-LAST:event_jButton_TurnBackActionPerformed + + private void jButton_UpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_UpdateActionPerformed + try{ + String değer1=jTextField1.getText(); + String değer2=jTextField2.getText(); + String değer3=jPasswordField1.getText(); + String değer4=jTextField3.getText(); + String değer5=jTextField4.getText(); + String sorgu = "UPDATE users_tb SET fullname='"+değer1+"',username='"+değer2 + +"',password='"+değer3+"',email_address='"+değer4+"',mobile_number='"+değer5+"' where fullname='"+değer1+"'"; + pst=baglanti.prepareStatement(sorgu); + pst.execute(); + JOptionPane.showMessageDialog(null,"Güncelleme işlemi gerçekleşti"); + + } catch (SQLException ex) { + JOptionPane.showConfirmDialog(null, "Sorgu da hata var "+ex); + } + }//GEN-LAST:event_jButton_UpdateActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + // TODO add your handling code here: + User_Database_View_Page frame_userdatabaseview = new User_Database_View_Page(); + frame_userdatabaseview.setVisible(true); + }//GEN-LAST:event_jButton1ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(User_Edit_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(User_Edit_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(User_Edit_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(User_Edit_Page.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + //</editor-fold> + //</editor-fold> + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new User_Edit_Page().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton_TurnBack; + private javax.swing.JButton jButton_Update; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JPasswordField jPasswordField1; + private javax.swing.JTextField jTextField1; + private javax.swing.JTextField jTextField2; + private javax.swing.JTextField jTextField3; + private javax.swing.JTextField jTextField4; + // End of variables declaration//GEN-END:variables + + private void setIcon() { + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("passbox_ico.png"))); + } +} diff --git a/projects/PassBox-master/src/ico/about_me_ico.png b/projects/PassBox-master/src/ico/about_me_ico.png new file mode 100644 index 0000000..1cd68af Binary files /dev/null and b/projects/PassBox-master/src/ico/about_me_ico.png differ diff --git a/projects/PassBox-master/src/ico/add_new_password_ico.png b/projects/PassBox-master/src/ico/add_new_password_ico.png new file mode 100644 index 0000000..a833115 Binary files /dev/null and b/projects/PassBox-master/src/ico/add_new_password_ico.png differ diff --git a/projects/PassBox-master/src/ico/add_password_ico.png b/projects/PassBox-master/src/ico/add_password_ico.png new file mode 100644 index 0000000..464ac3e Binary files /dev/null and b/projects/PassBox-master/src/ico/add_password_ico.png differ diff --git a/projects/PassBox-master/src/ico/contact_me_ico.png b/projects/PassBox-master/src/ico/contact_me_ico.png new file mode 100644 index 0000000..5c67b82 Binary files /dev/null and b/projects/PassBox-master/src/ico/contact_me_ico.png differ diff --git a/projects/PassBox-master/src/ico/contact_us.png b/projects/PassBox-master/src/ico/contact_us.png new file mode 100644 index 0000000..537ae25 Binary files /dev/null and b/projects/PassBox-master/src/ico/contact_us.png differ diff --git a/projects/PassBox-master/src/ico/database_ico.png b/projects/PassBox-master/src/ico/database_ico.png new file mode 100644 index 0000000..15ed448 Binary files /dev/null and b/projects/PassBox-master/src/ico/database_ico.png differ diff --git a/projects/PassBox-master/src/ico/database_password_view_ico.png b/projects/PassBox-master/src/ico/database_password_view_ico.png new file mode 100644 index 0000000..2380dc8 Binary files /dev/null and b/projects/PassBox-master/src/ico/database_password_view_ico.png differ diff --git a/projects/PassBox-master/src/ico/database_update_ico.png b/projects/PassBox-master/src/ico/database_update_ico.png new file mode 100644 index 0000000..c7ae743 Binary files /dev/null and b/projects/PassBox-master/src/ico/database_update_ico.png differ diff --git a/projects/PassBox-master/src/ico/database_view_ico.png b/projects/PassBox-master/src/ico/database_view_ico.png new file mode 100644 index 0000000..ab1f55d Binary files /dev/null and b/projects/PassBox-master/src/ico/database_view_ico.png differ diff --git a/projects/PassBox-master/src/ico/default_user_ico.png b/projects/PassBox-master/src/ico/default_user_ico.png new file mode 100644 index 0000000..477d43c Binary files /dev/null and b/projects/PassBox-master/src/ico/default_user_ico.png differ diff --git a/projects/PassBox-master/src/ico/exit_ico.png b/projects/PassBox-master/src/ico/exit_ico.png new file mode 100644 index 0000000..11bd12c Binary files /dev/null and b/projects/PassBox-master/src/ico/exit_ico.png differ diff --git a/projects/PassBox-master/src/ico/forgot_password.png b/projects/PassBox-master/src/ico/forgot_password.png new file mode 100644 index 0000000..5271061 Binary files /dev/null and b/projects/PassBox-master/src/ico/forgot_password.png differ diff --git a/projects/PassBox-master/src/ico/github-logo.png b/projects/PassBox-master/src/ico/github-logo.png new file mode 100644 index 0000000..f8e08f6 Binary files /dev/null and b/projects/PassBox-master/src/ico/github-logo.png differ diff --git a/projects/PassBox-master/src/ico/log_file.png b/projects/PassBox-master/src/ico/log_file.png new file mode 100644 index 0000000..cf81c31 Binary files /dev/null and b/projects/PassBox-master/src/ico/log_file.png differ diff --git a/projects/PassBox-master/src/ico/login_button.png b/projects/PassBox-master/src/ico/login_button.png new file mode 100644 index 0000000..3c88150 Binary files /dev/null and b/projects/PassBox-master/src/ico/login_button.png differ diff --git a/projects/PassBox-master/src/ico/password_delete_ico.png b/projects/PassBox-master/src/ico/password_delete_ico.png new file mode 100644 index 0000000..ff90309 Binary files /dev/null and b/projects/PassBox-master/src/ico/password_delete_ico.png differ diff --git a/projects/PassBox-master/src/ico/password_management_ico.png b/projects/PassBox-master/src/ico/password_management_ico.png new file mode 100644 index 0000000..98d3a24 Binary files /dev/null and b/projects/PassBox-master/src/ico/password_management_ico.png differ diff --git a/projects/PassBox-master/src/ico/register_ico.png b/projects/PassBox-master/src/ico/register_ico.png new file mode 100644 index 0000000..df0c75a Binary files /dev/null and b/projects/PassBox-master/src/ico/register_ico.png differ diff --git a/projects/PassBox-master/src/ico/send_ico.png b/projects/PassBox-master/src/ico/send_ico.png new file mode 100644 index 0000000..537ae25 Binary files /dev/null and b/projects/PassBox-master/src/ico/send_ico.png differ diff --git a/projects/PassBox-master/src/ico/software-update.png b/projects/PassBox-master/src/ico/software-update.png new file mode 100644 index 0000000..910a3bb Binary files /dev/null and b/projects/PassBox-master/src/ico/software-update.png differ diff --git a/projects/PassBox-master/src/ico/turnback_ico.png b/projects/PassBox-master/src/ico/turnback_ico.png new file mode 100644 index 0000000..2c1c8be Binary files /dev/null and b/projects/PassBox-master/src/ico/turnback_ico.png differ diff --git a/projects/PassBox-master/src/ico/update_database_ico.png b/projects/PassBox-master/src/ico/update_database_ico.png new file mode 100644 index 0000000..efd7d7c Binary files /dev/null and b/projects/PassBox-master/src/ico/update_database_ico.png differ diff --git a/projects/PassBox-master/src/ico/user_edit_ico.png b/projects/PassBox-master/src/ico/user_edit_ico.png new file mode 100644 index 0000000..6188837 Binary files /dev/null and b/projects/PassBox-master/src/ico/user_edit_ico.png differ diff --git a/projects/PassBox-master/src/ico/website.png b/projects/PassBox-master/src/ico/website.png new file mode 100644 index 0000000..09f21be Binary files /dev/null and b/projects/PassBox-master/src/ico/website.png differ diff --git a/projects/PassBox-master/src/logo/PassBox.png b/projects/PassBox-master/src/logo/PassBox.png new file mode 100644 index 0000000..0a591f9 Binary files /dev/null and b/projects/PassBox-master/src/logo/PassBox.png differ diff --git a/projects/PassBox-master/src/passbox_ico.png b/projects/PassBox-master/src/passbox_ico.png new file mode 100644 index 0000000..0a591f9 Binary files /dev/null and b/projects/PassBox-master/src/passbox_ico.png differ diff --git a/projects/PassBox-master/src/progressbar_class/Login_Page.java b/projects/PassBox-master/src/progressbar_class/Login_Page.java new file mode 100644 index 0000000..6553217 --- /dev/null +++ b/projects/PassBox-master/src/progressbar_class/Login_Page.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package progressbar_class; + +/** + * + * @author q + */ +class Login_Page { + +} diff --git a/projects/connect globe/.classpath b/projects/connect globe/.classpath new file mode 100644 index 0000000..c229b99 --- /dev/null +++ b/projects/connect globe/.classpath @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"> + <attributes> + <attribute name="owner.project.facets" value="java"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> + <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> + <classpathentry kind="output" path="build/classes"/> +</classpath> diff --git a/projects/connect globe/.project b/projects/connect globe/.project new file mode 100644 index 0000000..286fe4d --- /dev/null +++ b/projects/connect globe/.project @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>connect globe</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.wst.jsdt.core.javascriptValidator</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.common.project.facet.core.builder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.validation.validationbuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> + <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> + <nature>org.eclipse.wst.common.project.facet.core.nature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.wst.jsdt.core.jsNature</nature> + </natures> +</projectDescription> diff --git a/projects/connect globe/WebContent/META-INF/MANIFEST.MF b/projects/connect globe/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 0000000..254272e --- /dev/null +++ b/projects/connect globe/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/projects/connect globe/WebContent/admin.jsp b/projects/connect globe/WebContent/admin.jsp new file mode 100644 index 0000000..9017fbb --- /dev/null +++ b/projects/connect globe/WebContent/admin.jsp @@ -0,0 +1,241 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> + + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="content-type" content="text/html; charset=utf-8" /> +<title>Test + + + + + + + + + + + + + + + + + + + + +<%session.invalidate(); %> +
+
+ + + + + + +
Best selection of premium Joomla 1.6 templates
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

+ +
+
+ +
+
+
+
+ +
+
+
+
+
+

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+
+

Now You can Share Your Social Problem such as some kind of Harassment,Bribe matters.

+

Simply just Register Yourself and Do login After that click on Post Report Link as shown above.And After selecting Your subject and location YOu can post Your matter Simply .This will be visible to every visitors and our Supporters will try to proceed it further

+ +
+
+
+ + +
+
+ +

Latest News

+
+ Apr. 10, 2010
+

Suspendisse rutrum interdum lacinia.
+ Suspendisse tempus aliquet elit sit amet pellentesque. Donec iaculis pulvinar mauris,

+ +
+
+ Apr. 10, 2010
+

Suspendisse rutrum interdum lacinia.
+ Suspendisse tempus aliquet elit sit amet pellentesque. Donec iaculis pulvinar mauris,

+ +
+
+
+ +

Recent Discovery


+

+ +
+
+ +

Login Form

+
+ + <% + if(request.getAttribute("notlogin_msg")!=null){ + out.print(""); + out.print(request.getAttribute("notlogin_msg")); + out.print(""); + } + %> + <% + if(request.getAttribute("Error")!=null){ + out.print(""); + out.print(request.getAttribute("Error")); + out.print(""); + } + %> + + +
+ User Name:
+ Password:
+ + +
+ +
+
+
+
+
+
+
+ +
+ + + + + \ No newline at end of file diff --git a/projects/connect globe/WebContent/advice.jsp b/projects/connect globe/WebContent/advice.jsp new file mode 100644 index 0000000..0a2b949 --- /dev/null +++ b/projects/connect globe/WebContent/advice.jsp @@ -0,0 +1,330 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Connection"%> +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.ResultSet"%> + + + + + +Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
Best selection of premium Joomla 1.6 templates
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

+ +
+
+ +
+
+
+
+ +
+
+
+
+
+

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +
+
+ +
+
+ + +
+
+ +
+
+<% +String islogin=(String)session.getAttribute("islogin"); +if(islogin==null){ +request.setAttribute("notlogin_msg","Sorry,Please do Login first"); + +%> + +<% +} +%> + + +
+
+
+

Now You can Share Your Social Problem such as some kind of Harassment,Bribe matters.

+

Simply just Register Yourself and Do login After that click on Post Report Link as shown above.And After selecting Your subject and location YOu can post Your matter Simply .This will be visible to every visitors and our Supporters will try to proceed it further

+ +
+
+
+ + + <% + try{ + Class.forName("oracle.jdbc.driver.OracleDriver"); + Connection con =DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); + PreparedStatement ps= con.prepareStatement("select country,state,district,police_station,report,status,email,postedon,id from forumrep order by postedon desc"); + ResultSet rs=ps.executeQuery(); + + while(rs.next()){ + out.print("
"); + out.print("
"); + out.print("Country:    "+rs.getString(1)+"
"); + out.print("State:    "+rs.getString(2)+"
"); + out.print("District:    "+rs.getString(3)+"
"); + out.print("Police Station:    "+rs.getString(4)+"
"); + out.print("Report:    
"+rs.getString(5)+"
"); + out.print("Status:    "+rs.getString(6)+"
"); + out.print("Email:    "+rs.getString(7)+"                                                                                                                                                                                                 Posted On:    "+rs.getDate(8)+"
"); + ps= con.prepareStatement("SELECT max(id) FROM FORUMADVC where rid='"+rs.getString(9)+"' "); + ResultSet rs3= ps.executeQuery(); + rs3.next(); + int limit=rs3.getInt(1); + ps= con.prepareStatement("SELECT count(rid) FROM FORUMADVC where rid='"+rs.getString(9)+"' "); + ResultSet rs5= ps.executeQuery(); + rs5.next(); + int count=rs5.getInt(1); + System.out.print(count); + if(count>3 ){ out.print("View All Comments"); + out.print("
"); + } + + ps= con.prepareStatement("SELECT max(id) FROM FORUMADVC where rid='"+rs.getString(9)+"' "); + ResultSet rs4= ps.executeQuery(); + rs4.next(); + int limit2=rs3.getInt(1)-5; + System.out.print(limit2); + PreparedStatement ps1= con.prepareStatement("SELECT * FROM FORUMADVC WHERE id > '"+limit2+"' and rid = '"+rs.getString(9)+"' " ); + ResultSet rs2= ps1.executeQuery(); + while(rs2.next()){ + + + + out.print("
"+rs2.getString(3)); + + out.print("
By:-"+rs2.getString(4)); + out.print("
"); + + + + } + out.print("
Give Your Advice"); + + out.print("
"); + out.print("
"); + } + + } + catch(Exception e){e.printStackTrace(); + } + + %> + +
+ +
+
+ +
+
+ +
+

+ + \ No newline at end of file diff --git a/projects/connect globe/WebContent/aloginprocess.jsp b/projects/connect globe/WebContent/aloginprocess.jsp new file mode 100644 index 0000000..1e1b32c --- /dev/null +++ b/projects/connect globe/WebContent/aloginprocess.jsp @@ -0,0 +1,24 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<%@page import="org.omg.CORBA.PUBLIC_MEMBER"%> +<% + String username=getServletContext().getInitParameter("Username"); + String password=getServletContext().getInitParameter("Password"); + +if(request.getParameter("username").equalsIgnoreCase(username)&& request.getParameter("userpass").equalsIgnoreCase(password)) +{ +session.setAttribute("islogin","plz sign in first"); +session.setAttribute("username","Administrator"); +%> + +<% +} + +else{ +request.setAttribute("Error","Sorry! Username or Password Error."); +session.setAttribute("Loginmsg","plz sign in first"); +%> + +<% +} +%> + diff --git a/projects/connect globe/WebContent/area.jsp b/projects/connect globe/WebContent/area.jsp new file mode 100644 index 0000000..3dc5781 --- /dev/null +++ b/projects/connect globe/WebContent/area.jsp @@ -0,0 +1,368 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> + + + + + + +Test + + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
Best selection of premium Joomla 1.6 templates
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

+ +
+
+ +
+
+
+
+ +
+
+
+
+
+

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+
+

Now You can Share Your Social Problem such as some kind of Harassment,Bribe matters.

+

Simply just Register Yourself and Do login After that click on Post Report Link as shown above.And After selecting Your subject and location YOu can post Your matter Simply .This will be visible to every visitors and our Supporters will try to proceed it further

+ +
+
+ + +
+ +
+ +

View Reports

+
+ +
+ + + + + + + + + + + +
Country:
+ + + + + + +
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+ + + \ No newline at end of file diff --git a/projects/connect globe/WebContent/astatus.jsp b/projects/connect globe/WebContent/astatus.jsp new file mode 100644 index 0000000..e338879 --- /dev/null +++ b/projects/connect globe/WebContent/astatus.jsp @@ -0,0 +1,267 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Connection"%> +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.ResultSet"%> + + + + + +Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
Best selection of premium Joomla 1.6 templates
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

+ +
+
+ +
+
+
+
+ +
+
+
+
+
+

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +
+
+ +
+
+ + +
+
+ +
+
+ + + +<% +String islogin=(String)session.getAttribute("islogin"); +if(islogin==null){ +request.setAttribute("notlogin_msg","Sorry,Please do Login first"); + +%> + +<% +} +%> + +
+
+
+

Now You can Share Your Social Problem such as some kind of Harassment,Bribe matters.

+

Simply just Register Yourself and Do login After that click on Post Report Link as shown above.And After selecting Your subject and location YOu can post Your matter Simply .This will be visible to every visitors and our Supporters will try to proceed it further

+ +
+
+
+ + + <% + try{ + Class.forName("oracle.jdbc.driver.OracleDriver"); + Connection con =DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); + PreparedStatement ps= con.prepareStatement("select country,state,district,police_station,report,status,email,postedon,id from forumrep order by postedon desc"); + ResultSet rs=ps.executeQuery(); + out.print("
"); + while(rs.next()){ + out.print("
"); + out.print("
"); + out.print("Country:    "+rs.getString(1)+"                                                                                                                                                                                                                                                              Delete
"); + out.print("State:    "+rs.getString(2)+"
"); + out.print("District:    "+rs.getString(3)+"
"); + out.print("Police Station:    "+rs.getString(4)+"
"); + out.print("Report:    
"+rs.getString(5)+"
"); + out.print("Status:    "+rs.getString(6)+"
"); + out.print("Email:    "+rs.getString(7)+"                                                                                                                                                                                                 Posted On:    "+rs.getDate(8)+"
"); + out.print("
"); + out.print("
"); + } + + } + catch(Exception e){e.printStackTrace(); + } + + %> + +
+ +
+
+ +
+
+ +
+

+ + \ No newline at end of file diff --git a/projects/connect globe/WebContent/createtopic.jsp b/projects/connect globe/WebContent/createtopic.jsp new file mode 100644 index 0000000..48294da --- /dev/null +++ b/projects/connect globe/WebContent/createtopic.jsp @@ -0,0 +1,55 @@ +<%@ page import="java.sql.*"%> +<%@ page import="java.io.*"%> +<%@ page import="java.util.*"%> +<% +String islogin=(String)session.getAttribute("islogin"); +if(islogin==null){ +request.setAttribute("notlogin_msg","Sorry,Please do Login first"); + +%> + +<% +} +%> +<% +java.util.Date sqdate=Calendar.getInstance().getTime(); + java.sql.Date dat =new java.sql.Date(sqdate.getTime()); + +String topic=(String)request.getParameter("topic"); +String email=(String)session.getAttribute("email"); +try{ + Class.forName("oracle.jdbc.driver.OracleDriver"); + Connection con= DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); + PreparedStatement ps =con.prepareStatement("select topic from forumtpc where topic='"+topic+"'"); + ResultSet rs=ps.executeQuery(); + if(rs.next()){ + request.setAttribute("created","Topic Already Exist"); + %> + + + + <% + } + else{ + ps =con.prepareStatement("insert into forumtpc(topic,email,createdon)"+"values(?,?,?)"); +ps.setString(1,topic); +ps.setString(2,email); + + ps.setDate(3,dat); + +int s= ps.executeUpdate(); +if(s>0){ +System.out.print("save"); +request.setAttribute("created","Topic has been successfully created,view your topic"); +%> + + + +<% +} +else{System.out.print("sorry!try again");} + } + }catch(Exception e){} + %> + + diff --git a/projects/connect globe/WebContent/db table.txt b/projects/connect globe/WebContent/db table.txt new file mode 100644 index 0000000..9f8fcca --- /dev/null +++ b/projects/connect globe/WebContent/db table.txt @@ -0,0 +1,112 @@ +CREATE TABLE "FORUMREG" + ( "ID" NUMBER, + "USERNAME" VARCHAR2(4000), + "USERPASS" VARCHAR2(4000), + "EMAIL" VARCHAR2(4000), + "MOBILE" NUMBER, + "ADDRESS" VARCHAR2(4000), + CONSTRAINT "FORUMREG_PK" PRIMARY KEY ("ID") ENABLE + ) +/ + +CREATE OR REPLACE TRIGGER "BI_FORUMREG" + before insert on "FORUMREG" + for each row +begin + select "FORUMREG_SEQ".nextval into :NEW.ID from dual; +end; + +/ +ALTER TRIGGER "BI_FORUMREG" ENABLE +/ +-------------------------------------------------------------- + +CREATE TABLE "FORUMREP" + ( "ID" NUMBER, + "COUNTRY" VARCHAR2(4000), + "STATE" VARCHAR2(4000), + "DISTRICT" VARCHAR2(4000), + "POLICE_STATION" VARCHAR2(4000), + "REPORT" VARCHAR2(4000), + "STATUS" VARCHAR2(4000), + "IMAGE" BLOB, + "EMAIL" VARCHAR2(4000), + "POSTEDON" DATE, + CONSTRAINT "FORUMREP_PK" PRIMARY KEY ("ID") ENABLE + ) +/ + +CREATE OR REPLACE TRIGGER "BI_FORUMREP" + before insert on "FORUMREP" + for each row +begin + select "FORUMREP_SEQ".nextval into :NEW.ID from dual; +end; + +/ +ALTER TRIGGER "BI_FORUMREP" ENABLE +/ + +-------------------------------------------------------------- + +CREATE TABLE "FORUMADVC" + ( "RID" NUMBER, + "ID" NUMBER, + "CMT" VARCHAR2(4000), + "EMAIL" VARCHAR2(4000), + CONSTRAINT "FORUMADVC_PK" PRIMARY KEY ("ID") ENABLE + ) +/ + +CREATE OR REPLACE TRIGGER "BI_FORUMADVC" + before insert on "FORUMADVC" + for each row +begin + select "FORUMADVC_SEQ".nextval into :NEW.ID from dual; +end; + +/ +ALTER TRIGGER "BI_FORUMADVC" ENABLE +/ +---------------------------------------------------------------- + +CREATE TABLE "FORUMTPC" + ( "ID" NUMBER, + "TOPIC" VARCHAR2(4000), + "EMAIL" VARCHAR2(4000), + "CREATEDON" DATE NOT NULL ENABLE, + CONSTRAINT "FORUMTPC_PK" PRIMARY KEY ("ID") ENABLE + ) +/ + +CREATE OR REPLACE TRIGGER "BI_FORUMTPC" + before insert on "FORUMTPC" + for each row +begin + select "FORUMTPC_SEQ".nextval into :NEW.ID from dual; +end; + +/ +ALTER TRIGGER "BI_FORUMTPC" ENABLE +/ +------------------------------------------------------------------ + +CREATE TABLE "FORUMTADVC" + ( "ID" NUMBER, + "TID" NUMBER, + "CMT" VARCHAR2(4000), + "EMAIL" VARCHAR2(4000), + CONSTRAINT "FORUMTADVC_PK" PRIMARY KEY ("ID") ENABLE + ) +/ + +CREATE OR REPLACE TRIGGER "BI_FORUMTADVC" + before insert on "FORUMTADVC" + for each row +begin + select "FORUMTADVC_SEQ".nextval into :NEW.ID from dual; +end; + +/ +ALTER TRIGGER "BI_FORUMTADVC" ENABLE +/ \ No newline at end of file diff --git a/projects/connect globe/WebContent/delete.jsp b/projects/connect globe/WebContent/delete.jsp new file mode 100644 index 0000000..55a1ecd --- /dev/null +++ b/projects/connect globe/WebContent/delete.jsp @@ -0,0 +1,27 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<%@ page import="java.sql.*" %> + + +<% +String n=request.getParameter("id"); +System.out.println(n); + +try{ +Class.forName("oracle.jdbc.driver.OracleDriver"); +Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); +System.out.print(n); +PreparedStatement ps=con.prepareStatement("delete from forumrep where id='"+n+"'"); +//ps.setString(1,n); +out.print("
"); +int rs=ps.executeUpdate(); + +ps=con.prepareStatement("delete from forumadvc where rid='"+n+"'"); +ps.executeUpdate(); + +con.close(); +%> + + +<% +}catch(Exception e){e.printStackTrace();} +%> diff --git a/projects/connect globe/WebContent/discuss.jsp b/projects/connect globe/WebContent/discuss.jsp new file mode 100644 index 0000000..8a63bd5 --- /dev/null +++ b/projects/connect globe/WebContent/discuss.jsp @@ -0,0 +1,59 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> + + + +<% +String islogin=(String)session.getAttribute("islogin"); +if(islogin==null){ +request.setAttribute("notlogin_msg","Sorry,Please do Login first"); + +%> + +<% +} +%> + +
+
+
+

Now You can Share Your Social Problem such as some kind of Harassment,Bribe matters.

+

Simply just Register Yourself and Do login After that click on Post Report Link as shown above.And After selecting Your subject and location YOu can post Your matter Simply .This will be visible to every visitors and our Supporters will try to proceed it further

+ +
+
+ + +
+ + + +

Create a Topic

+
+
+
+ Enter the Topic Name: + +
+
+ <% + if(request.getAttribute("created")!=null){ + out.print("             "+request.getAttribute("created")); + + } + %> +
+              View All Previously created topic +
+ +
+ + + + +
+ + + + " + + \ No newline at end of file diff --git a/projects/connect globe/WebContent/findname.jsp b/projects/connect globe/WebContent/findname.jsp new file mode 100644 index 0000000..f015c96 --- /dev/null +++ b/projects/connect globe/WebContent/findname.jsp @@ -0,0 +1,23 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<%@ page import="java.sql.*" %> + + +<% +String n=request.getParameter("val"); +System.out.println(n); +if(n.length()>0){ +try{ +Class.forName("oracle.jdbc.driver.OracleDriver"); +Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); + +PreparedStatement ps=con.prepareStatement("select * from forumreg where username ='"+n+"'"); +//ps.setString(1,n); +out.print("
"); +ResultSet rs=ps.executeQuery(); +if(rs.next()){ +out.print("Already Exist"); +} +con.close(); +}catch(Exception e){e.printStackTrace();} +}//end of if +%> \ No newline at end of file diff --git a/projects/connect globe/WebContent/findname1.jsp b/projects/connect globe/WebContent/findname1.jsp new file mode 100644 index 0000000..ea85f02 --- /dev/null +++ b/projects/connect globe/WebContent/findname1.jsp @@ -0,0 +1,26 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<%@ page import="java.sql.*" %> + + +<% +String n=request.getParameter("val"); +System.out.println(n); +if(n.length()>0){ +try{ +Class.forName("oracle.jdbc.driver.OracleDriver"); +Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); + +PreparedStatement ps=con.prepareStatement("select * from forumreg where email ='"+n+"'"); +//ps.setString(1,n); +out.print("
"); +ResultSet rs=ps.executeQuery(); +if(rs.next()){ +out.print("Already Exist"); +} + + + +con.close(); +}catch(Exception e){e.printStackTrace();} +}//end of if +%> \ No newline at end of file diff --git a/projects/connect globe/WebContent/findname3.jsp b/projects/connect globe/WebContent/findname3.jsp new file mode 100644 index 0000000..9c42dec --- /dev/null +++ b/projects/connect globe/WebContent/findname3.jsp @@ -0,0 +1,26 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<%@ page import="java.sql.*" %> + + +<% +String n=request.getParameter("val"); +System.out.println(n); +if(n.length()>0){ +try{ +Class.forName("oracle.jdbc.driver.OracleDriver"); +Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); + +PreparedStatement ps=con.prepareStatement("select userpass from forumreg where email ='"+n+"'"); +//ps.setString(1,n); +out.print("
"); +ResultSet rs=ps.executeQuery(); +if(rs.next()){ +String email=rs.getString(1); +out.print("Your Password is: "+email+""); +out.print("

Login Again"); + +} +con.close(); +}catch(Exception e){e.printStackTrace();} +}//end of if +%> \ No newline at end of file diff --git a/projects/connect globe/WebContent/findname4.jsp b/projects/connect globe/WebContent/findname4.jsp new file mode 100644 index 0000000..3c4ca9a --- /dev/null +++ b/projects/connect globe/WebContent/findname4.jsp @@ -0,0 +1,36 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<%@ page import="java.sql.*" %> + + +<% +String country=request.getParameter("country"); +String state=request.getParameter("state"); +String district=request.getParameter("district"); +String police=request.getParameter("police"); +System.out.println(state); +if(country.length()>0){ +try{ +Class.forName("oracle.jdbc.driver.OracleDriver"); +Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); + +PreparedStatement ps=con.prepareStatement("select * from forumrep where country='"+country+"' and state='"+state+"' and district='"+district+"'and police_station='"+police+"' order by postedon desc"); +//ps.setString(1,n); +out.print("
"); +ResultSet rs=ps.executeQuery(); +while(rs.next()){ + +out.print("
"); + out.print("
"); + out.print("Report:    
"+rs.getString(6)+"
"); + out.print("Status:    "+rs.getString(7)+"
"); + out.print("Email:    "+rs.getString(9)+"                                                                                                                                                                                                 Posted On:    "+rs.getDate(10)+"
"); + out.print("
"); + out.print("
"); +} + + + +con.close(); +}catch(Exception e){e.printStackTrace();} +}//end of if +%> \ No newline at end of file diff --git a/projects/connect globe/WebContent/findname5.jsp b/projects/connect globe/WebContent/findname5.jsp new file mode 100644 index 0000000..86deae0 --- /dev/null +++ b/projects/connect globe/WebContent/findname5.jsp @@ -0,0 +1,38 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<%@ page import="java.sql.*" %> + + +<% +String n=request.getParameter("id"); +String cmt=request.getParameter("cmt"); +String email=(String)session.getAttribute("email"); +System.out.println(n); +System.out.println(cmt); +System.out.println(email); +if(n.length()>0){ +try{ + +Class.forName("oracle.jdbc.driver.OracleDriver"); +Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); +PreparedStatement ps=con.prepareStatement("insert into forumadvc(rid,cmt,email) values(?,?,?)"); +ps.setString(1,n); +ps.setString(2,cmt); +ps.setString(3,email); + +int rs=ps.executeUpdate(); +if(rs>0){ + +} +else{ +%> + + +<% + +} +con.close(); + + +}catch(Exception e){e.printStackTrace();} +}//end of if +%> diff --git a/projects/connect globe/WebContent/findname6.jsp b/projects/connect globe/WebContent/findname6.jsp new file mode 100644 index 0000000..1273885 --- /dev/null +++ b/projects/connect globe/WebContent/findname6.jsp @@ -0,0 +1,38 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<%@ page import="java.sql.*" %> + + +<% +String n=request.getParameter("id"); +String cmt=request.getParameter("cmt"); +String email=(String)session.getAttribute("email"); +System.out.println(n); +System.out.println(cmt); +System.out.println(email); +if(n.length()>0){ +try{ + +Class.forName("oracle.jdbc.driver.OracleDriver"); +Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); +PreparedStatement ps=con.prepareStatement("insert into forumtadvc(tid,cmt,email) values(?,?,?)"); +ps.setString(1,n); +ps.setString(2,cmt); +ps.setString(3,email); + +int rs=ps.executeUpdate(); +if(rs>0){ + +} +else{ +%> + + +<% + +} +con.close(); + + +}catch(Exception e){e.printStackTrace();} +}//end of if +%> diff --git a/projects/connect globe/WebContent/footer.html b/projects/connect globe/WebContent/footer.html new file mode 100644 index 0000000..a05a927 --- /dev/null +++ b/projects/connect globe/WebContent/footer.html @@ -0,0 +1,43 @@ + \ No newline at end of file diff --git a/projects/connect globe/WebContent/forgot.jsp b/projects/connect globe/WebContent/forgot.jsp new file mode 100644 index 0000000..3b9eb9d --- /dev/null +++ b/projects/connect globe/WebContent/forgot.jsp @@ -0,0 +1,254 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> + + + + + + +Test + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
Best selection of premium Joomla 1.6 templates
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

+ +
+
+ +
+
+
+
+ +
+
+
+
+
+

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+
+

Now You can Share Your Social Problem such as some kind of Harassment,Bribe matters.

+

Simply just Register Yourself and Do login After that click on Post Report Link as shown above.And After selecting Your subject and location YOu can post Your matter Simply .This will be visible to every visitors and our Supporters will try to proceed it further

+ +
+
+
+ + +
+
+ +

Latest News

+
+ Apr. 10, 2010
+

Suspendisse rutrum interdum lacinia.
+ Suspendisse tempus aliquet elit sit amet pellentesque. Donec iaculis pulvinar mauris,

+ +
+
+ Apr. 10, 2010
+

Suspendisse rutrum interdum lacinia.
+ Suspendisse tempus aliquet elit sit amet pellentesque. Donec iaculis pulvinar mauris,

+ +
+
+
+ +

Recent Discovery


+

+ +
+
+ +

Recover Password

+
+ + +
+
+ Enter Your Email:
+

+ +
+
+
+
+
+
+
+
+
+ +
+ + + + + \ No newline at end of file diff --git a/projects/connect globe/WebContent/header.jsp b/projects/connect globe/WebContent/header.jsp new file mode 100644 index 0000000..e4d8ac4 --- /dev/null +++ b/projects/connect globe/WebContent/header.jsp @@ -0,0 +1,168 @@ + + + + +Test + + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
Best selection of premium Joomla 1.6 templates
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

+ +
+
+ +
+
+
+
+ +
+
+
+
+
+

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +
+
+ +
+
+ + +
+
+ +
+
\ No newline at end of file diff --git a/projects/connect globe/WebContent/image/141.jpg b/projects/connect globe/WebContent/image/141.jpg new file mode 100644 index 0000000..9aba4d5 Binary files /dev/null and b/projects/connect globe/WebContent/image/141.jpg differ diff --git a/projects/connect globe/WebContent/images/ajax-loader.gif b/projects/connect globe/WebContent/images/ajax-loader.gif new file mode 100644 index 0000000..53dd589 Binary files /dev/null and b/projects/connect globe/WebContent/images/ajax-loader.gif differ diff --git a/projects/connect globe/WebContent/images/b_c.png b/projects/connect globe/WebContent/images/b_c.png new file mode 100644 index 0000000..35e5e93 Binary files /dev/null and b/projects/connect globe/WebContent/images/b_c.png differ diff --git a/projects/connect globe/WebContent/images/b_l.png b/projects/connect globe/WebContent/images/b_l.png new file mode 100644 index 0000000..2831f31 Binary files /dev/null and b/projects/connect globe/WebContent/images/b_l.png differ diff --git a/projects/connect globe/WebContent/images/b_r.png b/projects/connect globe/WebContent/images/b_r.png new file mode 100644 index 0000000..ff3a1f2 Binary files /dev/null and b/projects/connect globe/WebContent/images/b_r.png differ diff --git a/projects/connect globe/WebContent/images/bg.jpg b/projects/connect globe/WebContent/images/bg.jpg new file mode 100644 index 0000000..e2006c1 Binary files /dev/null and b/projects/connect globe/WebContent/images/bg.jpg differ diff --git a/projects/connect globe/WebContent/images/bg_grad.jpg b/projects/connect globe/WebContent/images/bg_grad.jpg new file mode 100644 index 0000000..98a1fa0 Binary files /dev/null and b/projects/connect globe/WebContent/images/bg_grad.jpg differ diff --git a/projects/connect globe/WebContent/images/blog_title_right.png b/projects/connect globe/WebContent/images/blog_title_right.png new file mode 100644 index 0000000..21e220f Binary files /dev/null and b/projects/connect globe/WebContent/images/blog_title_right.png differ diff --git a/projects/connect globe/WebContent/images/c_l.png b/projects/connect globe/WebContent/images/c_l.png new file mode 100644 index 0000000..6d40600 Binary files /dev/null and b/projects/connect globe/WebContent/images/c_l.png differ diff --git a/projects/connect globe/WebContent/images/c_r.png b/projects/connect globe/WebContent/images/c_r.png new file mode 100644 index 0000000..ebd8b77 Binary files /dev/null and b/projects/connect globe/WebContent/images/c_r.png differ diff --git a/projects/connect globe/WebContent/images/close_btn.png b/projects/connect globe/WebContent/images/close_btn.png new file mode 100644 index 0000000..3014bfd Binary files /dev/null and b/projects/connect globe/WebContent/images/close_btn.png differ diff --git a/projects/connect globe/WebContent/images/close_btn_h.png b/projects/connect globe/WebContent/images/close_btn_h.png new file mode 100644 index 0000000..d6b9d5d Binary files /dev/null and b/projects/connect globe/WebContent/images/close_btn_h.png differ diff --git a/projects/connect globe/WebContent/images/col_bg.png b/projects/connect globe/WebContent/images/col_bg.png new file mode 100644 index 0000000..68cb174 Binary files /dev/null and b/projects/connect globe/WebContent/images/col_bg.png differ diff --git a/projects/connect globe/WebContent/images/coments_bg.png b/projects/connect globe/WebContent/images/coments_bg.png new file mode 100644 index 0000000..0a00103 Binary files /dev/null and b/projects/connect globe/WebContent/images/coments_bg.png differ diff --git a/projects/connect globe/WebContent/images/contact.png b/projects/connect globe/WebContent/images/contact.png new file mode 100644 index 0000000..c68e64e Binary files /dev/null and b/projects/connect globe/WebContent/images/contact.png differ diff --git a/projects/connect globe/WebContent/images/contact_input.png b/projects/connect globe/WebContent/images/contact_input.png new file mode 100644 index 0000000..69edd33 Binary files /dev/null and b/projects/connect globe/WebContent/images/contact_input.png differ diff --git a/projects/connect globe/WebContent/images/contactus_bg.png b/projects/connect globe/WebContent/images/contactus_bg.png new file mode 100644 index 0000000..c7dc609 Binary files /dev/null and b/projects/connect globe/WebContent/images/contactus_bg.png differ diff --git a/projects/connect globe/WebContent/images/footer.png b/projects/connect globe/WebContent/images/footer.png new file mode 100644 index 0000000..d157903 Binary files /dev/null and b/projects/connect globe/WebContent/images/footer.png differ diff --git a/projects/connect globe/WebContent/images/footer_grad.png b/projects/connect globe/WebContent/images/footer_grad.png new file mode 100644 index 0000000..c77f7c5 Binary files /dev/null and b/projects/connect globe/WebContent/images/footer_grad.png differ diff --git a/projects/connect globe/WebContent/images/gal1.jpg b/projects/connect globe/WebContent/images/gal1.jpg new file mode 100644 index 0000000..116aacc Binary files /dev/null and b/projects/connect globe/WebContent/images/gal1.jpg differ diff --git a/projects/connect globe/WebContent/images/gal2.jpg b/projects/connect globe/WebContent/images/gal2.jpg new file mode 100644 index 0000000..e637c31 Binary files /dev/null and b/projects/connect globe/WebContent/images/gal2.jpg differ diff --git a/projects/connect globe/WebContent/images/gal3.jpg b/projects/connect globe/WebContent/images/gal3.jpg new file mode 100644 index 0000000..be33033 Binary files /dev/null and b/projects/connect globe/WebContent/images/gal3.jpg differ diff --git a/projects/connect globe/WebContent/images/gal4.jpg b/projects/connect globe/WebContent/images/gal4.jpg new file mode 100644 index 0000000..4b9328f Binary files /dev/null and b/projects/connect globe/WebContent/images/gal4.jpg differ diff --git a/projects/connect globe/WebContent/images/gal5.jpg b/projects/connect globe/WebContent/images/gal5.jpg new file mode 100644 index 0000000..ff21584 Binary files /dev/null and b/projects/connect globe/WebContent/images/gal5.jpg differ diff --git a/projects/connect globe/WebContent/images/gal6.jpg b/projects/connect globe/WebContent/images/gal6.jpg new file mode 100644 index 0000000..423b516 Binary files /dev/null and b/projects/connect globe/WebContent/images/gal6.jpg differ diff --git a/projects/connect globe/WebContent/images/gal7.jpg b/projects/connect globe/WebContent/images/gal7.jpg new file mode 100644 index 0000000..5284b64 Binary files /dev/null and b/projects/connect globe/WebContent/images/gal7.jpg differ diff --git a/projects/connect globe/WebContent/images/gal8.jpg b/projects/connect globe/WebContent/images/gal8.jpg new file mode 100644 index 0000000..2565190 Binary files /dev/null and b/projects/connect globe/WebContent/images/gal8.jpg differ diff --git a/projects/connect globe/WebContent/images/gal9.jpg b/projects/connect globe/WebContent/images/gal9.jpg new file mode 100644 index 0000000..bd99535 Binary files /dev/null and b/projects/connect globe/WebContent/images/gal9.jpg differ diff --git a/projects/connect globe/WebContent/images/gallery_big1.jpg b/projects/connect globe/WebContent/images/gallery_big1.jpg new file mode 100644 index 0000000..275d883 Binary files /dev/null and b/projects/connect globe/WebContent/images/gallery_big1.jpg differ diff --git a/projects/connect globe/WebContent/images/gallery_big2.jpg b/projects/connect globe/WebContent/images/gallery_big2.jpg new file mode 100644 index 0000000..b1e27bd Binary files /dev/null and b/projects/connect globe/WebContent/images/gallery_big2.jpg differ diff --git a/projects/connect globe/WebContent/images/gallery_big3.jpg b/projects/connect globe/WebContent/images/gallery_big3.jpg new file mode 100644 index 0000000..fa0d8b9 Binary files /dev/null and b/projects/connect globe/WebContent/images/gallery_big3.jpg differ diff --git a/projects/connect globe/WebContent/images/gallery_big4.jpg b/projects/connect globe/WebContent/images/gallery_big4.jpg new file mode 100644 index 0000000..2ac5d47 Binary files /dev/null and b/projects/connect globe/WebContent/images/gallery_big4.jpg differ diff --git a/projects/connect globe/WebContent/images/gallery_big5.jpg b/projects/connect globe/WebContent/images/gallery_big5.jpg new file mode 100644 index 0000000..9e0a8b5 Binary files /dev/null and b/projects/connect globe/WebContent/images/gallery_big5.jpg differ diff --git a/projects/connect globe/WebContent/images/gallery_big6.jpg b/projects/connect globe/WebContent/images/gallery_big6.jpg new file mode 100644 index 0000000..21f9e17 Binary files /dev/null and b/projects/connect globe/WebContent/images/gallery_big6.jpg differ diff --git a/projects/connect globe/WebContent/images/gallery_big7.jpg b/projects/connect globe/WebContent/images/gallery_big7.jpg new file mode 100644 index 0000000..5cfab9a Binary files /dev/null and b/projects/connect globe/WebContent/images/gallery_big7.jpg differ diff --git a/projects/connect globe/WebContent/images/gallery_big8.jpg b/projects/connect globe/WebContent/images/gallery_big8.jpg new file mode 100644 index 0000000..48ae04d Binary files /dev/null and b/projects/connect globe/WebContent/images/gallery_big8.jpg differ diff --git a/projects/connect globe/WebContent/images/gallery_big9.jpg b/projects/connect globe/WebContent/images/gallery_big9.jpg new file mode 100644 index 0000000..7900142 Binary files /dev/null and b/projects/connect globe/WebContent/images/gallery_big9.jpg differ diff --git a/projects/connect globe/WebContent/images/green.png b/projects/connect globe/WebContent/images/green.png new file mode 100644 index 0000000..d978199 Binary files /dev/null and b/projects/connect globe/WebContent/images/green.png differ diff --git a/projects/connect globe/WebContent/images/header_scroll.jpg b/projects/connect globe/WebContent/images/header_scroll.jpg new file mode 100644 index 0000000..ca4dc0e Binary files /dev/null and b/projects/connect globe/WebContent/images/header_scroll.jpg differ diff --git a/projects/connect globe/WebContent/images/header_scroll2.jpg b/projects/connect globe/WebContent/images/header_scroll2.jpg new file mode 100644 index 0000000..54e3c6d Binary files /dev/null and b/projects/connect globe/WebContent/images/header_scroll2.jpg differ diff --git a/projects/connect globe/WebContent/images/header_scroll3.jpg b/projects/connect globe/WebContent/images/header_scroll3.jpg new file mode 100644 index 0000000..376364a Binary files /dev/null and b/projects/connect globe/WebContent/images/header_scroll3.jpg differ diff --git a/projects/connect globe/WebContent/images/img_bg_ind3.png b/projects/connect globe/WebContent/images/img_bg_ind3.png new file mode 100644 index 0000000..7f5e4f5 Binary files /dev/null and b/projects/connect globe/WebContent/images/img_bg_ind3.png differ diff --git a/projects/connect globe/WebContent/images/img_bor_prev.png b/projects/connect globe/WebContent/images/img_bor_prev.png new file mode 100644 index 0000000..0f03c49 Binary files /dev/null and b/projects/connect globe/WebContent/images/img_bor_prev.png differ diff --git a/projects/connect globe/WebContent/images/index_box_bg.png b/projects/connect globe/WebContent/images/index_box_bg.png new file mode 100644 index 0000000..ef87b87 Binary files /dev/null and b/projects/connect globe/WebContent/images/index_box_bg.png differ diff --git a/projects/connect globe/WebContent/images/index_box_bot.png b/projects/connect globe/WebContent/images/index_box_bot.png new file mode 100644 index 0000000..61ccaf8 Binary files /dev/null and b/projects/connect globe/WebContent/images/index_box_bot.png differ diff --git a/projects/connect globe/WebContent/images/index_box_top.png b/projects/connect globe/WebContent/images/index_box_top.png new file mode 100644 index 0000000..aaedb4a Binary files /dev/null and b/projects/connect globe/WebContent/images/index_box_top.png differ diff --git a/projects/connect globe/WebContent/images/index_main_top.png b/projects/connect globe/WebContent/images/index_main_top.png new file mode 100644 index 0000000..fa867b1 Binary files /dev/null and b/projects/connect globe/WebContent/images/index_main_top.png differ diff --git a/projects/connect globe/WebContent/images/index_prev_bot.png b/projects/connect globe/WebContent/images/index_prev_bot.png new file mode 100644 index 0000000..3b5cdcd Binary files /dev/null and b/projects/connect globe/WebContent/images/index_prev_bot.png differ diff --git a/projects/connect globe/WebContent/images/index_prev_grad.png b/projects/connect globe/WebContent/images/index_prev_grad.png new file mode 100644 index 0000000..34a9683 Binary files /dev/null and b/projects/connect globe/WebContent/images/index_prev_grad.png differ diff --git a/projects/connect globe/WebContent/images/input_bg.png b/projects/connect globe/WebContent/images/input_bg.png new file mode 100644 index 0000000..8af4767 Binary files /dev/null and b/projects/connect globe/WebContent/images/input_bg.png differ diff --git a/projects/connect globe/WebContent/images/link1.png b/projects/connect globe/WebContent/images/link1.png new file mode 100644 index 0000000..20ee657 Binary files /dev/null and b/projects/connect globe/WebContent/images/link1.png differ diff --git a/projects/connect globe/WebContent/images/link2.png b/projects/connect globe/WebContent/images/link2.png new file mode 100644 index 0000000..387226b Binary files /dev/null and b/projects/connect globe/WebContent/images/link2.png differ diff --git a/projects/connect globe/WebContent/images/link3.png b/projects/connect globe/WebContent/images/link3.png new file mode 100644 index 0000000..026a002 Binary files /dev/null and b/projects/connect globe/WebContent/images/link3.png differ diff --git a/projects/connect globe/WebContent/images/link4.png b/projects/connect globe/WebContent/images/link4.png new file mode 100644 index 0000000..36b31bb Binary files /dev/null and b/projects/connect globe/WebContent/images/link4.png differ diff --git a/projects/connect globe/WebContent/images/link_out.png b/projects/connect globe/WebContent/images/link_out.png new file mode 100644 index 0000000..a5019a5 Binary files /dev/null and b/projects/connect globe/WebContent/images/link_out.png differ diff --git a/projects/connect globe/WebContent/images/link_out_h.png b/projects/connect globe/WebContent/images/link_out_h.png new file mode 100644 index 0000000..a4b74a9 Binary files /dev/null and b/projects/connect globe/WebContent/images/link_out_h.png differ diff --git a/projects/connect globe/WebContent/images/location.jpg b/projects/connect globe/WebContent/images/location.jpg new file mode 100644 index 0000000..5bbd5dd Binary files /dev/null and b/projects/connect globe/WebContent/images/location.jpg differ diff --git a/projects/connect globe/WebContent/images/location2.jpg b/projects/connect globe/WebContent/images/location2.jpg new file mode 100644 index 0000000..f7e52af Binary files /dev/null and b/projects/connect globe/WebContent/images/location2.jpg differ diff --git a/projects/connect globe/WebContent/images/ls.png b/projects/connect globe/WebContent/images/ls.png new file mode 100644 index 0000000..f405d31 Binary files /dev/null and b/projects/connect globe/WebContent/images/ls.png differ diff --git a/projects/connect globe/WebContent/images/ls2.png b/projects/connect globe/WebContent/images/ls2.png new file mode 100644 index 0000000..b96afd3 Binary files /dev/null and b/projects/connect globe/WebContent/images/ls2.png differ diff --git a/projects/connect globe/WebContent/images/main_bg.png b/projects/connect globe/WebContent/images/main_bg.png new file mode 100644 index 0000000..e4c837d Binary files /dev/null and b/projects/connect globe/WebContent/images/main_bg.png differ diff --git a/projects/connect globe/WebContent/images/main_bot.png b/projects/connect globe/WebContent/images/main_bot.png new file mode 100644 index 0000000..936ef14 Binary files /dev/null and b/projects/connect globe/WebContent/images/main_bot.png differ diff --git a/projects/connect globe/WebContent/images/main_top.png b/projects/connect globe/WebContent/images/main_top.png new file mode 100644 index 0000000..8a12194 Binary files /dev/null and b/projects/connect globe/WebContent/images/main_top.png differ diff --git a/projects/connect globe/WebContent/images/menu_bg.png b/projects/connect globe/WebContent/images/menu_bg.png new file mode 100644 index 0000000..6bca836 Binary files /dev/null and b/projects/connect globe/WebContent/images/menu_bg.png differ diff --git a/projects/connect globe/WebContent/images/menu_hover.png b/projects/connect globe/WebContent/images/menu_hover.png new file mode 100644 index 0000000..3289369 Binary files /dev/null and b/projects/connect globe/WebContent/images/menu_hover.png differ diff --git a/projects/connect globe/WebContent/images/mess_contact.png b/projects/connect globe/WebContent/images/mess_contact.png new file mode 100644 index 0000000..f5fc649 Binary files /dev/null and b/projects/connect globe/WebContent/images/mess_contact.png differ diff --git a/projects/connect globe/WebContent/images/next.png b/projects/connect globe/WebContent/images/next.png new file mode 100644 index 0000000..3ed316a Binary files /dev/null and b/projects/connect globe/WebContent/images/next.png differ diff --git a/projects/connect globe/WebContent/images/next_h.png b/projects/connect globe/WebContent/images/next_h.png new file mode 100644 index 0000000..8ec09c9 Binary files /dev/null and b/projects/connect globe/WebContent/images/next_h.png differ diff --git a/projects/connect globe/WebContent/images/notebook.png b/projects/connect globe/WebContent/images/notebook.png new file mode 100644 index 0000000..7333c44 Binary files /dev/null and b/projects/connect globe/WebContent/images/notebook.png differ diff --git a/projects/connect globe/WebContent/images/num_bg.png b/projects/connect globe/WebContent/images/num_bg.png new file mode 100644 index 0000000..24058a9 Binary files /dev/null and b/projects/connect globe/WebContent/images/num_bg.png differ diff --git a/projects/connect globe/WebContent/images/page1-img3.png b/projects/connect globe/WebContent/images/page1-img3.png new file mode 100644 index 0000000..623b856 Binary files /dev/null and b/projects/connect globe/WebContent/images/page1-img3.png differ diff --git a/projects/connect globe/WebContent/images/pause.png b/projects/connect globe/WebContent/images/pause.png new file mode 100644 index 0000000..79e9261 Binary files /dev/null and b/projects/connect globe/WebContent/images/pause.png differ diff --git a/projects/connect globe/WebContent/images/pause_h.png b/projects/connect globe/WebContent/images/pause_h.png new file mode 100644 index 0000000..93ed767 Binary files /dev/null and b/projects/connect globe/WebContent/images/pause_h.png differ diff --git a/projects/connect globe/WebContent/images/pic-01.jpg b/projects/connect globe/WebContent/images/pic-01.jpg new file mode 100644 index 0000000..c11a7fa Binary files /dev/null and b/projects/connect globe/WebContent/images/pic-01.jpg differ diff --git a/projects/connect globe/WebContent/images/pic-02.jpg b/projects/connect globe/WebContent/images/pic-02.jpg new file mode 100644 index 0000000..fc84762 Binary files /dev/null and b/projects/connect globe/WebContent/images/pic-02.jpg differ diff --git a/projects/connect globe/WebContent/images/pic-03.jpg b/projects/connect globe/WebContent/images/pic-03.jpg new file mode 100644 index 0000000..9828f90 Binary files /dev/null and b/projects/connect globe/WebContent/images/pic-03.jpg differ diff --git a/projects/connect globe/WebContent/images/pic-04.jpg b/projects/connect globe/WebContent/images/pic-04.jpg new file mode 100644 index 0000000..3215570 Binary files /dev/null and b/projects/connect globe/WebContent/images/pic-04.jpg differ diff --git a/projects/connect globe/WebContent/images/pic-05.jpg b/projects/connect globe/WebContent/images/pic-05.jpg new file mode 100644 index 0000000..0faabbb Binary files /dev/null and b/projects/connect globe/WebContent/images/pic-05.jpg differ diff --git a/projects/connect globe/WebContent/images/pic-06.jpg b/projects/connect globe/WebContent/images/pic-06.jpg new file mode 100644 index 0000000..2f1fc3e Binary files /dev/null and b/projects/connect globe/WebContent/images/pic-06.jpg differ diff --git a/projects/connect globe/WebContent/images/play.png b/projects/connect globe/WebContent/images/play.png new file mode 100644 index 0000000..de95faa Binary files /dev/null and b/projects/connect globe/WebContent/images/play.png differ diff --git a/projects/connect globe/WebContent/images/play_h.png b/projects/connect globe/WebContent/images/play_h.png new file mode 100644 index 0000000..f59c2eb Binary files /dev/null and b/projects/connect globe/WebContent/images/play_h.png differ diff --git a/projects/connect globe/WebContent/images/prev.png b/projects/connect globe/WebContent/images/prev.png new file mode 100644 index 0000000..0830bcf Binary files /dev/null and b/projects/connect globe/WebContent/images/prev.png differ diff --git a/projects/connect globe/WebContent/images/prev_but_left.png b/projects/connect globe/WebContent/images/prev_but_left.png new file mode 100644 index 0000000..aca6ba8 Binary files /dev/null and b/projects/connect globe/WebContent/images/prev_but_left.png differ diff --git a/projects/connect globe/WebContent/images/prev_but_right.png b/projects/connect globe/WebContent/images/prev_but_right.png new file mode 100644 index 0000000..d56673b Binary files /dev/null and b/projects/connect globe/WebContent/images/prev_but_right.png differ diff --git a/projects/connect globe/WebContent/images/prev_h.png b/projects/connect globe/WebContent/images/prev_h.png new file mode 100644 index 0000000..3675b53 Binary files /dev/null and b/projects/connect globe/WebContent/images/prev_h.png differ diff --git a/projects/connect globe/WebContent/images/project1.jpg b/projects/connect globe/WebContent/images/project1.jpg new file mode 100644 index 0000000..eb44898 Binary files /dev/null and b/projects/connect globe/WebContent/images/project1.jpg differ diff --git a/projects/connect globe/WebContent/images/project2.jpg b/projects/connect globe/WebContent/images/project2.jpg new file mode 100644 index 0000000..3f94b3e Binary files /dev/null and b/projects/connect globe/WebContent/images/project2.jpg differ diff --git a/projects/connect globe/WebContent/images/send.png b/projects/connect globe/WebContent/images/send.png new file mode 100644 index 0000000..7d62fc3 Binary files /dev/null and b/projects/connect globe/WebContent/images/send.png differ diff --git a/projects/connect globe/WebContent/images/t_c.png b/projects/connect globe/WebContent/images/t_c.png new file mode 100644 index 0000000..4258784 Binary files /dev/null and b/projects/connect globe/WebContent/images/t_c.png differ diff --git a/projects/connect globe/WebContent/images/t_l.png b/projects/connect globe/WebContent/images/t_l.png new file mode 100644 index 0000000..d46d960 Binary files /dev/null and b/projects/connect globe/WebContent/images/t_l.png differ diff --git a/projects/connect globe/WebContent/images/t_r.png b/projects/connect globe/WebContent/images/t_r.png new file mode 100644 index 0000000..1bd1cfd Binary files /dev/null and b/projects/connect globe/WebContent/images/t_r.png differ diff --git a/projects/connect globe/WebContent/images/text_mess.png b/projects/connect globe/WebContent/images/text_mess.png new file mode 100644 index 0000000..59cade1 Binary files /dev/null and b/projects/connect globe/WebContent/images/text_mess.png differ diff --git a/projects/connect globe/WebContent/index.jsp b/projects/connect globe/WebContent/index.jsp new file mode 100644 index 0000000..33e94ad --- /dev/null +++ b/projects/connect globe/WebContent/index.jsp @@ -0,0 +1,250 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> + + + + + + +Test + + + + + + + + + + + + + + + + + + + + +<%session.invalidate(); %> +
+
+ + + + + + +
Best selection of premium Joomla 1.6 templates
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

+ +
+
+ +
+
+
+
+ +
+
+
+
+
+

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+

Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
+ Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

+ Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+
+

Now You can Share Your Social Problem such as some kind of Harassment,Bribe matters.

+

Simply just Register Yourself and Do login After that click on Post Report Link as shown above.And After selecting Your subject and location YOu can post Your matter Simply .This will be visible to every visitors and our Supporters will try to proceed it further

+ +
+
+
+ + +
+
+ +

Latest News

+
+ Apr. 10, 2010
+

Suspendisse rutrum interdum lacinia.
+ Suspendisse tempus aliquet elit sit amet pellentesque. Donec iaculis pulvinar mauris,

+ +
+
+ Apr. 10, 2010
+

Suspendisse rutrum interdum lacinia.
+ Suspendisse tempus aliquet elit sit amet pellentesque. Donec iaculis pulvinar mauris,

+ +
+
+
+ +

Recent Discovery


+

+ +
+
+ +

Login Form

+
+ + <% + if(request.getAttribute("notlogin_msg")!=null){ + out.print(""); + out.print(request.getAttribute("notlogin_msg")); + out.print(""); + } + %> + <% + if(request.getAttribute("Error")!=null){ + out.print(""); + out.print(request.getAttribute("Error")); + out.print(""); + } + %> + + <% if(request.getAttribute("reg")!=null){ + out.print(""+request.getAttribute("reg")+""); + + } + %> + +
+
+ User Name:
+ Password:
+ + +
+
+
+
+
+
+
+
+
+ +
+ + + + + \ No newline at end of file diff --git a/projects/connect globe/WebContent/lib/jquery-1.3.2.min.js b/projects/connect globe/WebContent/lib/jquery-1.3.2.min.js new file mode 100644 index 0000000..b1ae21d --- /dev/null +++ b/projects/connect globe/WebContent/lib/jquery-1.3.2.min.js @@ -0,0 +1,19 @@ +/* + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/projects/connect globe/WebContent/lib/jquery.coda-slider-2.0.js b/projects/connect globe/WebContent/lib/jquery.coda-slider-2.0.js new file mode 100644 index 0000000..530c11f --- /dev/null +++ b/projects/connect globe/WebContent/lib/jquery.coda-slider-2.0.js @@ -0,0 +1,234 @@ +/* + jQuery Coda-Slider v2.0 - http://www.ndoherty.biz/coda-slider + Copyright (c) 2009 Niall Doherty + This plugin available for use in all personal or commercial projects under both MIT and GPL licenses. +*/ + +$(function(){ + // Remove the coda-slider-no-js class from the body + $("body").removeClass("coda-slider-no-js"); + // Preloader + $(".coda-slider").children('.panel').hide().end().prepend('

Loading...
loading...

'); +}); + +var sliderCount = 1; + +$.fn.codaSlider = function(settings) { + + settings = $.extend({ + autoHeight: true, + autoHeightEaseDuration: 1000, + autoHeightEaseFunction: "easeInOutExpo", + autoSlide: false, + autoSlideInterval: 7000, + autoSlideStopWhenClicked: true, + crossLinking: true, + dynamicArrows: true, + dynamicArrowLeftText: "« left", + dynamicArrowRightText: "right »", + dynamicTabs: true, + dynamicTabsAlign: "center", + dynamicTabsPosition: "top", + externalTriggerSelector: "a.xtrig", + firstPanelToLoad: 1, + panelTitleSelector: "h2.title", + slideEaseDuration: 1000, + slideEaseFunction: "easeInOutExpo" + }, settings); + + return this.each(function(){ + + // Uncomment the line below to test your preloader + // alert("Testing preloader"); + + var slider = $(this); + + // If we need arrows + if (settings.dynamicArrows) { + slider.parent().addClass("arrows"); + slider.before(''); + slider.after(''); + }; + + var panelWidth = slider.find(".panel").width(); + var panelCount = slider.find(".panel").size(); + var panelContainerWidth = panelWidth*panelCount; + var navClicks = 0; // Used if autoSlideStopWhenClicked = true + + // Surround the collection of panel divs with a container div (wide enough for all panels to be lined up end-to-end) + $('.panel', slider).wrapAll('
'); + // Specify the width of the container div (wide enough for all panels to be lined up end-to-end) + $(".panel-container", slider).css({ width: panelContainerWidth }); + + // Specify the current panel. + // If the loaded URL has a hash (cross-linking), we're going to use that hash to give the slider a specific starting position... + if (settings.crossLinking && location.hash && parseInt(location.hash.slice(1)) <= panelCount) { + var currentPanel = parseInt(location.hash.slice(1)); + var offset = - (panelWidth*(currentPanel - 1)); + $('.panel-container', slider).css({ marginLeft: offset }); + // If that's not the case, check to see if we're supposed to load a panel other than Panel 1 initially... + } else if (settings.firstPanelToLoad != 1 && settings.firstPanelToLoad <= panelCount) { + var currentPanel = settings.firstPanelToLoad; + var offset = - (panelWidth*(currentPanel - 1)); + $('.panel-container', slider).css({ marginLeft: offset }); + // Otherwise, we'll just set the current panel to 1... + } else { + var currentPanel = 1; + }; + + // Left arrow click + $("#coda-nav-left-" + sliderCount + " a").click(function(){ + navClicks++; + if (currentPanel == 1) { + offset = - (panelWidth*(panelCount - 1)); + alterPanelHeight(panelCount - 1); + currentPanel = panelCount; + slider.siblings('.coda-nav').find('a.current').removeClass('current').parents('ul').find('li:last a').addClass('current'); + } else { + currentPanel -= 1; + alterPanelHeight(currentPanel - 1); + offset = - (panelWidth*(currentPanel - 1)); + slider.siblings('.coda-nav').find('a.current').removeClass('current').parent().prev().find('a').addClass('current'); + }; + $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction); + if (settings.crossLinking) { location.hash = currentPanel }; // Change the URL hash (cross-linking) + return false; + }); + + // Right arrow click + $('#coda-nav-right-' + sliderCount + ' a').click(function(){ + navClicks++; + if (currentPanel == panelCount) { + offset = 0; + currentPanel = 1; + alterPanelHeight(0); + slider.siblings('.coda-nav').find('a.current').removeClass('current').parents('ul').find('a:eq(0)').addClass('current'); + } else { + offset = - (panelWidth*currentPanel); + alterPanelHeight(currentPanel); + currentPanel += 1; + slider.siblings('.coda-nav').find('a.current').removeClass('current').parent().next().find('a').addClass('current'); + }; + $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction); + if (settings.crossLinking) { location.hash = currentPanel }; // Change the URL hash (cross-linking) + return false; + }); + + // If we need a dynamic menu + if (settings.dynamicTabs) { + var dynamicTabs = '
    '; + switch (settings.dynamicTabsPosition) { + case "bottom": + slider.parent().append(dynamicTabs); + break; + default: + slider.parent().prepend(dynamicTabs); + break; + }; + ul = $('#coda-nav-' + sliderCount + ' ul'); + // Create the nav items + $('.panel', slider).each(function(n) { + ul.append('
  • ' + $(this).find(settings.panelTitleSelector).text() + '
  • '); + }); + navContainerWidth = slider.width() + slider.siblings('.coda-nav-left').width() + slider.siblings('.coda-nav-right').width(); + ul.parent().css({ width: navContainerWidth }); + switch (settings.dynamicTabsAlign) { + case "center": + ul.css({ width: ($("li", ul).width() + 2) * panelCount }); + break; + case "right": + + break; + }; + }; + + // If we need a tabbed nav + $('#coda-nav-' + sliderCount + ' a').each(function(z) { + // What happens when a nav link is clicked + $(this).bind("click", function() { + navClicks++; + $(this).addClass('current').parents('ul').find('a').not($(this)).removeClass('current'); + offset = - (panelWidth*z); + alterPanelHeight(z); + currentPanel = z + 1; + $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction); + if (!settings.crossLinking) { return false }; // Don't change the URL hash unless cross-linking is specified + }); + }); + + // External triggers (anywhere on the page) + $(settings.externalTriggerSelector).each(function() { + // Make sure this only affects the targeted slider + if (sliderCount == parseInt($(this).attr("rel").slice(12))) { + $(this).bind("click", function() { + navClicks++; + targetPanel = parseInt($(this).attr("href").slice(1)); + offset = - (panelWidth*(targetPanel - 1)); + alterPanelHeight(targetPanel - 1); + currentPanel = targetPanel; + // Switch the current tab: + slider.siblings('.coda-nav').find('a').removeClass('current').parents('ul').find('li:eq(' + (targetPanel - 1) + ') a').addClass('current'); + // Slide + $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction); + if (!settings.crossLinking) { return false }; // Don't change the URL hash unless cross-linking is specified + }); + }; + }); + + // Specify which tab is initially set to "current". Depends on if the loaded URL had a hash or not (cross-linking). + if (settings.crossLinking && location.hash && parseInt(location.hash.slice(1)) <= panelCount) { + $("#coda-nav-" + sliderCount + " a:eq(" + (location.hash.slice(1) - 1) + ")").addClass("current"); + // If there's no cross-linking, check to see if we're supposed to load a panel other than Panel 1 initially... + } else if (settings.firstPanelToLoad != 1 && settings.firstPanelToLoad <= panelCount) { + $("#coda-nav-" + sliderCount + " a:eq(" + (settings.firstPanelToLoad - 1) + ")").addClass("current"); + // Otherwise we must be loading Panel 1, so make the first tab the current one. + } else { + $("#coda-nav-" + sliderCount + " a:eq(0)").addClass("current"); + }; + + // Set the height of the first panel + if (settings.autoHeight) { + panelHeight = $('.panel:eq(' + (currentPanel - 1) + ')', slider).height(); + slider.css({ height: panelHeight }); + }; + + // Trigger autoSlide + if (settings.autoSlide) { + slider.ready(function() { + setTimeout(autoSlide,settings.autoSlideInterval); + }); + }; + + function alterPanelHeight(x) { + if (settings.autoHeight) { + panelHeight = $('.panel:eq(' + x + ')', slider).height() + slider.animate({ height: panelHeight }, settings.autoHeightEaseDuration, settings.autoHeightEaseFunction); + }; + }; + + function autoSlide() { + if (navClicks == 0 || !settings.autoSlideStopWhenClicked) { + if (currentPanel == panelCount) { + var offset = 0; + currentPanel = 1; + } else { + var offset = - (panelWidth*currentPanel); + currentPanel += 1; + }; + alterPanelHeight(currentPanel - 1); + // Switch the current tab: + slider.siblings('.coda-nav').find('a').removeClass('current').parents('ul').find('li:eq(' + (currentPanel - 1) + ') a').addClass('current'); + // Slide: + $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction); + setTimeout(autoSlide,settings.autoSlideInterval); + }; + }; + + // Kill the preloader + $('.panel', slider).show().end().find("p.loading").remove(); + slider.removeClass("preload"); + + sliderCount++; + + }); +}; \ No newline at end of file diff --git a/projects/connect globe/WebContent/lib/jquery.easing.1.3.js b/projects/connect globe/WebContent/lib/jquery.easing.1.3.js new file mode 100644 index 0000000..ef74321 --- /dev/null +++ b/projects/connect globe/WebContent/lib/jquery.easing.1.3.js @@ -0,0 +1,205 @@ +/* + * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ + * + * Uses the built in easing capabilities added In jQuery 1.1 + * to offer multiple easing options + * + * TERMS OF USE - jQuery Easing + * + * Open source under the BSD License. + * + * Copyright © 2008 George McGinley Smith + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * +*/ + +// t: current time, b: begInnIng value, c: change In value, d: duration +jQuery.easing['jswing'] = jQuery.easing['swing']; + +jQuery.extend( jQuery.easing, +{ + def: 'easeOutQuad', + swing: function (x, t, b, c, d) { + //alert(jQuery.easing.default); + return jQuery.easing[jQuery.easing.def](x, t, b, c, d); + }, + easeInQuad: function (x, t, b, c, d) { + return c*(t/=d)*t + b; + }, + easeOutQuad: function (x, t, b, c, d) { + return -c *(t/=d)*(t-2) + b; + }, + easeInOutQuad: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t + b; + return -c/2 * ((--t)*(t-2) - 1) + b; + }, + easeInCubic: function (x, t, b, c, d) { + return c*(t/=d)*t*t + b; + }, + easeOutCubic: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t + 1) + b; + }, + easeInOutCubic: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t + b; + return c/2*((t-=2)*t*t + 2) + b; + }, + easeInQuart: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t + b; + }, + easeOutQuart: function (x, t, b, c, d) { + return -c * ((t=t/d-1)*t*t*t - 1) + b; + }, + easeInOutQuart: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t + b; + return -c/2 * ((t-=2)*t*t*t - 2) + b; + }, + easeInQuint: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t*t + b; + }, + easeOutQuint: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t*t*t + 1) + b; + }, + easeInOutQuint: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; + return c/2*((t-=2)*t*t*t*t + 2) + b; + }, + easeInSine: function (x, t, b, c, d) { + return -c * Math.cos(t/d * (Math.PI/2)) + c + b; + }, + easeOutSine: function (x, t, b, c, d) { + return c * Math.sin(t/d * (Math.PI/2)) + b; + }, + easeInOutSine: function (x, t, b, c, d) { + return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; + }, + easeInExpo: function (x, t, b, c, d) { + return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; + }, + easeOutExpo: function (x, t, b, c, d) { + return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; + }, + easeInOutExpo: function (x, t, b, c, d) { + if (t==0) return b; + if (t==d) return b+c; + if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; + return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; + }, + easeInCirc: function (x, t, b, c, d) { + return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; + }, + easeOutCirc: function (x, t, b, c, d) { + return c * Math.sqrt(1 - (t=t/d-1)*t) + b; + }, + easeInOutCirc: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; + return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; + }, + easeInElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + }, + easeOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; + }, + easeInOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; + }, + easeInBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*(t/=d)*t*((s+1)*t - s) + b; + }, + easeOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; + }, + easeInOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; + return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; + }, + easeInBounce: function (x, t, b, c, d) { + return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; + }, + easeOutBounce: function (x, t, b, c, d) { + if ((t/=d) < (1/2.75)) { + return c*(7.5625*t*t) + b; + } else if (t < (2/2.75)) { + return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; + } else if (t < (2.5/2.75)) { + return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; + } else { + return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; + } + }, + easeInOutBounce: function (x, t, b, c, d) { + if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; + return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; + } +}); + +/* + * + * TERMS OF USE - EASING EQUATIONS + * + * Open source under the BSD License. + * + * Copyright © 2001 Robert Penner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ \ No newline at end of file diff --git a/projects/connect globe/WebContent/lib/jquery.js b/projects/connect globe/WebContent/lib/jquery.js new file mode 100644 index 0000000..53a7abc --- /dev/null +++ b/projects/connect globe/WebContent/lib/jquery.js @@ -0,0 +1,2 @@ +/*! jQuery v1.8.2 jquery.com | jquery.org/license */ +(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write(""),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bS[a]=c,c}function ci(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||ce.test(a)?d(a,e):ci(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ci(a+"["+e+"]",b[e],c,d);else d(a,b)}function cz(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.2",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return a!=null?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b
    a",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="
    t
    ",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="
    ",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||p.guid++:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.length,e=c.shift(),f=p._queueHooks(a,b),g=function(){p.dequeue(a,b)};e==="inprogress"&&(e=c.shift(),d--),e&&(b==="fx"&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c=0)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c=0)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,d+""),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j=0:p.find(m,this,null,[f]).length),h[m]&&j.push(l);j.length&&u.push({elem:f,matches:j})}o.length>q&&u.push({elem:this,matches:o.slice(q)});for(d=0;d0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bc(a,b,c,d){c=c||[],b=b||r;var e,f,i,j,k=b.nodeType;if(!a||typeof a!="string")return c;if(k!==1&&k!==9)return[];i=g(b);if(!i&&!d)if(e=P.exec(a))if(j=e[1]){if(k===9){f=b.getElementById(j);if(!f||!f.parentNode)return c;if(f.id===j)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(j))&&h(b,f)&&f.id===j)return c.push(f),c}else{if(e[2])return w.apply(c,x.call(b.getElementsByTagName(a),0)),c;if((j=e[3])&&_&&b.getElementsByClassName)return w.apply(c,x.call(b.getElementsByClassName(j),0)),c}return bp(a.replace(L,"$1"),b,c,d,i)}function bd(a){return function(b){var c=b.nodeName.toLowerCase();return c==="input"&&b.type===a}}function be(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}}function bf(a){return z(function(b){return b=+b,z(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function bg(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}function bh(a,b){var c,d,f,g,h,i,j,k=C[o][a];if(k)return b?0:k.slice(0);h=a,i=[],j=e.preFilter;while(h){if(!c||(d=M.exec(h)))d&&(h=h.slice(d[0].length)),i.push(f=[]);c=!1;if(d=N.exec(h))f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=d[0].replace(L," ");for(g in e.filter)(d=W[g].exec(h))&&(!j[g]||(d=j[g](d,r,!0)))&&(f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=g,c.matches=d);if(!c)break}return b?h.length:h?bc.error(a):C(a,i).slice(0)}function bi(a,b,d){var e=b.dir,f=d&&b.dir==="parentNode",g=u++;return b.first?function(b,c,d){while(b=b[e])if(f||b.nodeType===1)return a(b,c,d)}:function(b,d,h){if(!h){var i,j=t+" "+g+" ",k=j+c;while(b=b[e])if(f||b.nodeType===1){if((i=b[o])===k)return b.sizset;if(typeof i=="string"&&i.indexOf(j)===0){if(b.sizset)return b}else{b[o]=k;if(a(b,d,h))return b.sizset=!0,b;b.sizset=!1}}}else while(b=b[e])if(f||b.nodeType===1)if(a(b,d,h))return b}}function bj(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function bk(a,b,c,d,e){var f,g=[],h=0,i=a.length,j=b!=null;for(;h-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==l)||((b=c).nodeType?j(a,c,d):k(a,c,d))}];for(;i1&&bj(m),i>1&&a.slice(0,i-1).join("").replace(L,"$1"),c,i0,f=a.length>0,g=function(h,i,j,k,m){var n,o,p,q=[],s=0,u="0",x=h&&[],y=m!=null,z=l,A=h||f&&e.find.TAG("*",m&&i.parentNode||i),B=t+=z==null?1:Math.E;y&&(l=i!==r&&i,c=g.el);for(;(n=A[u])!=null;u++){if(f&&n){for(o=0;p=a[o];o++)if(p(n,i,j)){k.push(n);break}y&&(t=B,c=++g.el)}d&&((n=!p&&n)&&s--,h&&x.push(n))}s+=u;if(d&&u!==s){for(o=0;p=b[o];o++)p(x,q,i,j);if(h){if(s>0)while(u--)!x[u]&&!q[u]&&(q[u]=v.call(k));q=bk(q)}w.apply(k,q),y&&!h&&q.length>0&&s+b.length>1&&bc.uniqueSort(k)}return y&&(t=B,l=z),x};return g.el=0,d?z(g):g}function bo(a,b,c,d){var e=0,f=b.length;for(;e2&&(j=h[0]).type==="ID"&&b.nodeType===9&&!f&&e.relative[h[1].type]){b=e.find.ID(j.matches[0].replace(V,""),b,f)[0];if(!b)return c;a=a.slice(h.shift().length)}for(g=W.POS.test(a)?-1:h.length-1;g>=0;g--){j=h[g];if(e.relative[k=j.type])break;if(l=e.find[k])if(d=l(j.matches[0].replace(V,""),R.test(h[0].type)&&b.parentNode||b,f)){h.splice(g,1),a=d.length&&h.join("");if(!a)return w.apply(c,x.call(d,0)),c;break}}}return i(a,m)(d,b,f,c,R.test(a)),c}function bq(){}var c,d,e,f,g,h,i,j,k,l,m=!0,n="undefined",o=("sizcache"+Math.random()).replace(".",""),q=String,r=a.document,s=r.documentElement,t=0,u=0,v=[].pop,w=[].push,x=[].slice,y=[].indexOf||function(a){var b=0,c=this.length;for(;be.cacheLength&&delete a[b.shift()],a[c]=d},a)},B=A(),C=A(),D=A(),E="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",G=F.replace("w","w#"),H="([*^$|!~]?=)",I="\\["+E+"*("+F+")"+E+"*(?:"+H+E+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+G+")|)|)"+E+"*\\]",J=":("+F+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+I+")|[^:]|\\\\.)*|.*))\\)|)",K=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+E+"*((?:-\\d)?\\d*)"+E+"*\\)|)(?=[^-]|$)",L=new RegExp("^"+E+"+|((?:^|[^\\\\])(?:\\\\.)*)"+E+"+$","g"),M=new RegExp("^"+E+"*,"+E+"*"),N=new RegExp("^"+E+"*([\\x20\\t\\r\\n\\f>+~])"+E+"*"),O=new RegExp(J),P=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,Q=/^:not/,R=/[\x20\t\r\n\f]*[+~]/,S=/:not\($/,T=/h\d/i,U=/input|select|textarea|button/i,V=/\\(?!\\)/g,W={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),NAME:new RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:new RegExp("^("+F.replace("w","w*")+")"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+J),POS:new RegExp(K,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+E+"*(even|odd|(([+-]|)(\\d*)n|)"+E+"*(?:([+-]|)"+E+"*(\\d+)|))"+E+"*\\)|)","i"),needsContext:new RegExp("^"+E+"*[>+~]|"+K,"i")},X=function(a){var b=r.createElement("div");try{return a(b)}catch(c){return!1}finally{b=null}},Y=X(function(a){return a.appendChild(r.createComment("")),!a.getElementsByTagName("*").length}),Z=X(function(a){return a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!==n&&a.firstChild.getAttribute("href")==="#"}),$=X(function(a){a.innerHTML="";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),_=X(function(a){return a.innerHTML="",!a.getElementsByClassName||!a.getElementsByClassName("e").length?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length===2)}),ba=X(function(a){a.id=o+0,a.innerHTML="
    ",s.insertBefore(a,s.firstChild);var b=r.getElementsByName&&r.getElementsByName(o).length===2+r.getElementsByName(o+0).length;return d=!r.getElementById(o),s.removeChild(a),b});try{x.call(s.childNodes,0)[0].nodeType}catch(bb){x=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}bc.matches=function(a,b){return bc(a,null,null,b)},bc.matchesSelector=function(a,b){return bc(b,null,null,[a]).length>0},f=bc.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=f(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=f(b);return c},g=bc.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},h=bc.contains=s.contains?function(a,b){var c=a.nodeType===9?a.documentElement:a,d=b&&b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:s.compareDocumentPosition?function(a,b){return b&&!!(a.compareDocumentPosition(b)&16)}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},bc.attr=function(a,b){var c,d=g(a);return d||(b=b.toLowerCase()),(c=e.attrHandle[b])?c(a):d||$?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},e=bc.selectors={cacheLength:50,createPseudo:z,match:W,attrHandle:Z?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},find:{ID:d?function(a,b,c){if(typeof b.getElementById!==n&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==n&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==n&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:Y?function(a,b){if(typeof b.getElementsByTagName!==n)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c},NAME:ba&&function(a,b){if(typeof b.getElementsByName!==n)return b.getElementsByName(name)},CLASS:_&&function(a,b,c){if(typeof b.getElementsByClassName!==n&&!c)return b.getElementsByClassName(a)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(V,""),a[3]=(a[4]||a[5]||"").replace(V,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||bc.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&bc.error(a[0]),a},PSEUDO:function(a){var b,c;if(W.CHILD.test(a[0]))return null;if(a[3])a[2]=a[3];else if(b=a[4])O.test(b)&&(c=bh(b,!0))&&(c=b.indexOf(")",b.length-c)-b.length)&&(b=b.slice(0,c),a[0]=a[0].slice(0,c)),a[2]=b;return a.slice(0,3)}},filter:{ID:d?function(a){return a=a.replace(V,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(V,""),function(b){var c=typeof b.getAttributeNode!==n&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(V,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=B[o][a];return b||(b=B(a,new RegExp("(^|"+E+")"+a+"("+E+"|$)"))),function(a){return b.test(a.className||typeof a.getAttribute!==n&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return function(d,e){var f=bc.attr(d,a);return f==null?b==="!=":b?(f+="",b==="="?f===c:b==="!="?f!==c:b==="^="?c&&f.indexOf(c)===0:b==="*="?c&&f.indexOf(c)>-1:b==="$="?c&&f.substr(f.length-c.length)===c:b==="~="?(" "+f+" ").indexOf(c)>-1:b==="|="?f===c||f.substr(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d){return a==="nth"?function(a){var b,e,f=a.parentNode;if(c===1&&d===0)return!0;if(f){e=0;for(b=f.firstChild;b;b=b.nextSibling)if(b.nodeType===1){e++;if(a===b)break}}return e-=d,e===c||e%c===0&&e/c>=0}:function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b){var c,d=e.pseudos[a]||e.setFilters[a.toLowerCase()]||bc.error("unsupported pseudo: "+a);return d[o]?d(b):d.length>1?(c=[a,a,"",b],e.setFilters.hasOwnProperty(a.toLowerCase())?z(function(a,c){var e,f=d(a,b),g=f.length;while(g--)e=y.call(a,f[g]),a[e]=!(c[e]=f[g])}):function(a){return d(a,0,c)}):d}},pseudos:{not:z(function(a){var b=[],c=[],d=i(a.replace(L,"$1"));return d[o]?z(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)if(f=g[h])a[h]=!(b[h]=f)}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:z(function(a){return function(b){return bc(a,b).length>0}}),contains:z(function(a){return function(b){return(b.textContent||b.innerText||f(b)).indexOf(a)>-1}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!e.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},header:function(a){return T.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:bd("radio"),checkbox:bd("checkbox"),file:bd("file"),password:bd("password"),image:bd("image"),submit:be("submit"),reset:be("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return U.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement},first:bf(function(a,b,c){return[0]}),last:bf(function(a,b,c){return[b-1]}),eq:bf(function(a,b,c){return[c<0?c+b:c]}),even:bf(function(a,b,c){for(var d=0;d=0;)a.push(d);return a}),gt:bf(function(a,b,c){for(var d=c<0?c+b:c;++d",a.querySelectorAll("[selected]").length||e.push("\\["+E+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),X(function(a){a.innerHTML="

    ",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+E+"*(?:\"\"|'')"),a.innerHTML="",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=new RegExp(e.join("|")),bp=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a))){var i,j,k=!0,l=o,m=d,n=d.nodeType===9&&a;if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){i=bh(a),(k=d.getAttribute("id"))?l=k.replace(c,"\\$&"):d.setAttribute("id",l),l="[id='"+l+"'] ",j=i.length;while(j--)i[j]=l+i[j].join("");m=R.test(a)&&d.parentNode||d,n=i.join(",")}if(n)try{return w.apply(f,x.call(m.querySelectorAll(n),0)),f}catch(p){}finally{k||d.removeAttribute("id")}}return b(a,d,f,g,h)},h&&(X(function(b){a=h.call(b,"div");try{h.call(b,"[test!='']:sizzle"),f.push("!=",J)}catch(c){}}),f=new RegExp(f.join("|")),bc.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!g(b)&&!f.test(c)&&(!e||!e.test(c)))try{var i=h.call(b,c);if(i||a||b.document&&b.document.nodeType!==11)return i}catch(j){}return bc(c,null,null,[b]).length>0})}(),e.pseudos.nth=e.pseudos.eq,e.filters=bq.prototype=e.pseudos,e.setFilters=new bq,bc.attr=p.attr,p.find=bc,p.expr=bc.selectors,p.expr[":"]=p.expr.pseudos,p.unique=bc.uniqueSort,p.text=bc.getText,p.isXMLDoc=bc.isXML,p.contains=bc.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b0)for(e=d;e=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*\s*$/g,bz={option:[1,""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X
    ","
    "]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1>");try{for(;d1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=b===e&&bA,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(f=0;(h=a[f])!=null;f++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{s=s||bk(b),l=b.createElement("div"),s.appendChild(l),h=h.replace(bo,"<$1>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]===""&&!m?l.childNodes:[];for(g=n.length-1;g>=0;--g)p.nodeName(n[g],"tbody")&&!n[g].childNodes.length&&n[g].parentNode.removeChild(n[g])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l.parentNode.removeChild(l)}h.nodeType?t.push(h):p.merge(t,h)}l&&(h=l=s=null);if(!p.support.appendChecked)for(f=0;(h=t[f])!=null;f++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(f=0;(h=t[f])!=null;f++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[f+1,0].concat(r)),f+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.chrome?b.webkit=!0:b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^(none|table(?!-c[ea]).+)/,bO=/^margin/,bP=new RegExp("^("+q+")(.*)$","i"),bQ=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bR=new RegExp("^([-+])=("+q+")","i"),bS={},bT={position:"absolute",visibility:"hidden",display:"block"},bU={letterSpacing:0,fontWeight:400},bV=["Top","Right","Bottom","Left"],bW=["Webkit","O","Moz","ms"],bX=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return b$(this,!0)},hide:function(){return b$(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bX.apply(this,arguments):this.each(function(){(c?a:bZ(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bY(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bR.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bY(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bU&&(f=bU[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(b,c){var d,e,f,g,h=a.getComputedStyle(b,null),i=b.style;return h&&(d=h[c],d===""&&!p.contains(b.ownerDocument,b)&&(d=p.style(b,c)),bQ.test(d)&&bO.test(c)&&(e=i.width,f=i.minWidth,g=i.maxWidth,i.minWidth=i.maxWidth=i.width=d,d=h.width,i.width=e,i.minWidth=f,i.maxWidth=g)),d}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bQ.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth===0&&bN.test(bH(a,"display"))?p.swap(a,bT,function(){return cb(a,b,d)}):cb(a,b,d)},set:function(a,c,d){return b_(a,c,d?ca(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bQ.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bV[d]+b]=e[d]||e[d-2]||e[0];return f}},bO.test(a)||(p.cssHooks[a+b].set=b_)});var cd=/%20/g,ce=/\[\]$/,cf=/\r?\n/g,cg=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ch=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ch.test(this.nodeName)||cg.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(cf,"\r\n")}}):{name:b.name,value:c.replace(cf,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ci(d,a[d],c,f);return e.join("&").replace(cd,"+")};var cj,ck,cl=/#.*$/,cm=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,co=/^(?:GET|HEAD)$/,cp=/^\/\//,cq=/\?/,cr=/)<[^<]*)*<\/script>/gi,cs=/([?&])_=[^&]*/,ct=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,cu=p.fn.load,cv={},cw={},cx=["*/"]+["*"];try{ck=f.href}catch(cy){ck=e.createElement("a"),ck.href="",ck=ck.href}cj=ct.exec(ck.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&cu)return cu.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):c&&typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("
    ").append(a.replace(cr,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cB(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cB(a,b),a},ajaxSettings:{url:ck,isLocal:cn.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cx},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cz(cv),ajaxTransport:cz(cw),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cC(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cD(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=(c||y)+"",k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cm.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(cl,"").replace(cp,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=ct.exec(l.url.toLowerCase())||!1,l.crossDomain=i&&i.join(":")+(i[3]?"":i[1]==="http:"?80:443)!==cj.join(":")+(cj[3]?"":cj[1]==="http:"?80:443)),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cA(cv,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!co.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cq.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cs,"$1_="+z);l.url=A+(A===l.url?(cq.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cx+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cA(cw,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cE=[],cF=/\?/,cG=/(=)\?(?=&|$)|\?\?/,cH=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cE.pop()||p.expando+"_"+cH++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cG.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cG.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cG,"$1"+f):m?c.data=i.replace(cG,"$1"+f):k&&(c.url+=(cF.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cE.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cI,cJ=a.ActiveXObject?function(){for(var a in cI)cI[a](0,1)}:!1,cK=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cL()||cM()}:cL,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cJ&&delete cI[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cK,cJ&&(cI||(cI={},p(a).unload(cJ)),cI[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cN,cO,cP=/^(?:toggle|show|hide)$/,cQ=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cR=/queueHooks$/,cS=[cY],cT={"*":[function(a,b){var c,d,e=this.createTween(a,b),f=cQ.exec(b),g=e.cur(),h=+g||0,i=1,j=20;if(f){c=+f[2],d=f[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&h){h=p.css(e.elem,a,!0)||c||1;do i=i||".5",h=h/i,p.style(e.elem,a,h+d);while(i!==(i=e.cur()/g)&&i!==1&&--j)}e.unit=d,e.start=h,e.end=f[1]?h+(f[1]+1)*c:c}return e}]};p.Animation=p.extend(cW,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c_.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c_.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=da(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g,null)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window); \ No newline at end of file diff --git a/projects/connect globe/WebContent/lib/pirobox.js b/projects/connect globe/WebContent/lib/pirobox.js new file mode 100644 index 0000000..2749d4d --- /dev/null +++ b/projects/connect globe/WebContent/lib/pirobox.js @@ -0,0 +1,335 @@ +/** +* Name: piroBox v.1.2.2 +* Date: May 2010 +* Autor: Diego Valobra (http://www.pirolab.it),(http://www.diegovalobra.com) +* Version: 1.2.2 +* Licence: CC-BY-SA http://creativecommons.org/licenses/by-sa/2.5/it/ +**/ + +(function($) { + $.fn.piroBox = function(opt) { + opt = jQuery.extend({ + my_speed : null, + close_speed : 300, + bg_alpha : 0.5, + close_all : '.piro_close,.piro_overlay', + slideShow : null, + slideSpeed : null + }, opt); + + function start_pirobox() { + var corners = + '
    '+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''; + var window_height = $(document).height(); + var bg_overlay = $(jQuery('
    ').hide().css({'opacity':+opt.bg_alpha,'height':window_height+'px'})); + var main_cont = $(jQuery('
    ')); + var caption = $(jQuery('
    ')); + var piro_nav = $(jQuery('
    ')); + var piro_close = $(jQuery('')); + var piro_play = $(jQuery('')); + var piro_stop = $(jQuery('')); + var piro_prev = $(jQuery('')); + var piro_next = $(jQuery('')); + $('body').append(bg_overlay).append(main_cont); + main_cont.append(corners); + $('.pirobox_up').append(piro_close); + $('.pirobox_down').append(piro_nav); + $('.pirobox_down').append(piro_play); + piro_play.hide(); + $('.pirobox_down').append(piro_prev).append(piro_next); + piro_nav.append(caption); + var my_nav_w = piro_prev.width(); + main_cont.hide(); + var my_gall_classes = $("a[class^='pirobox']"); + var map = new Object(); + for (var i=0; i
    +

    + + \ No newline at end of file diff --git a/projects/connect globe/WebContent/opentpost.jsp b/projects/connect globe/WebContent/opentpost.jsp new file mode 100644 index 0000000..4ef9907 --- /dev/null +++ b/projects/connect globe/WebContent/opentpost.jsp @@ -0,0 +1,296 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Connection"%> +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.ResultSet"%> + + + + + +Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    Best selection of premium Joomla 1.6 templates
    +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

    + +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + + + +
    +
    +
    +

    Now You can Share Your Social Problem such as some kind of Harassment,Bribe matters.

    +

    Simply just Register Yourself and Do login After that click on Post Report Link as shown above.And After selecting Your subject and location YOu can post Your matter Simply .This will be visible to every visitors and our Supporters will try to proceed it further

    + +
    +
    +
    + + + <% + + String id=request.getParameter("id"); + try{ + Class.forName("oracle.jdbc.driver.OracleDriver"); + Connection con =DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); + PreparedStatement ps= con.prepareStatement("select topic,email,createdon,id from forumtpc where id='"+id+"'"); + ResultSet rs=ps.executeQuery(); + + while(rs.next()){ + out.print("
    "); + out.print("
    "); + out.print("Topic:    
    "+rs.getString(1)+"
    "); + + out.print("Email:    "+rs.getString(2)+"                                                                                                                                                                                                 Created On:    "+rs.getDate(3)+"
    "); + out.print("
    "); + out.print("
    "); + out.print("
    "); + + out.print("
    "); + out.print("
    "); + } + + } + catch(Exception e){e.printStackTrace(); + } + + %> + +
    + +
    +
    + +
    +
    + +
    +

    + + \ No newline at end of file diff --git a/projects/connect globe/WebContent/post.jsp b/projects/connect globe/WebContent/post.jsp new file mode 100644 index 0000000..86a1fa8 --- /dev/null +++ b/projects/connect globe/WebContent/post.jsp @@ -0,0 +1,166 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> + + + +<% +String islogin=(String)session.getAttribute("islogin"); +if(islogin==null){ +request.setAttribute("notlogin_msg","Sorry,Please do Login first"); + +%> + +<% +} +%> + +
    +
    +
    +

    Now You can Share Your Social Problem such as some kind of Harassment,Bribe matters.

    +

    Simply just Register Yourself and Do login After that click on Post Report Link as shown above.And After selecting Your subject and location YOu can post Your matter Simply .This will be visible to every visitors and our Supporters will try to proceed it further

    + +
    +
    +
    + +
    + +
    + +

    Post Report

    +
    + + +
    +
    + + + + + + + + + + + + + + +
    Country:
    Your Report:
    Status:
    Pending
    Executed
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + + \ No newline at end of file diff --git a/projects/connect globe/WebContent/register.jsp b/projects/connect globe/WebContent/register.jsp new file mode 100644 index 0000000..470782f --- /dev/null +++ b/projects/connect globe/WebContent/register.jsp @@ -0,0 +1,356 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> + + + + + + +Test + + + + + + + + + + + + + + + + + + + + + +<%session.invalidate(); %> +
    +
    + + + + + + +
    Best selection of premium Joomla 1.6 templates
    +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

    + +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + +
    +
    +
    +

    Now You can Share Your Social Problem such as some kind of Harassment,Bribe matters.

    +

    Simply just Register Yourself and Do login After that click on Post Report Link as shown above.And After selecting Your subject and location YOu can post Your matter Simply .This will be visible to every visitors and our Supporters will try to proceed it further

    + +
    +
    +
    + + +
    +
    + +

    Latest News

    +
    + Apr. 10, 2010
    +

    Suspendisse rutrum interdum lacinia.
    + Suspendisse tempus aliquet elit sit amet pellentesque. Donec iaculis pulvinar mauris,

    + +
    +
    + Apr. 10, 2010
    +

    Suspendisse rutrum interdum lacinia.
    + Suspendisse tempus aliquet elit sit amet pellentesque. Donec iaculis pulvinar mauris,

    + +
    +
    +
    + +

    Recent Discovery


    +

    + +
    +
    + +

    Registration

    +
    + + <%if(request.getAttribute("regerr")!=null){ + out.print(""+request.getAttribute("regerr")+""); + } %> +
    +
    + User Name:
    + Password:
    + + Email:
    + Mobile:
    + Address:
    + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    + + + + + \ No newline at end of file diff --git a/projects/connect globe/WebContent/registerprocess.jsp b/projects/connect globe/WebContent/registerprocess.jsp new file mode 100644 index 0000000..c54cfc8 --- /dev/null +++ b/projects/connect globe/WebContent/registerprocess.jsp @@ -0,0 +1,80 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<%@page import="java.sql.*"%> +<%try{ + +String username=request.getParameter("username"); +String userpass=request.getParameter("userpass"); +String email=request.getParameter("email"); +String mobile=request.getParameter("mobile"); +String address=request.getParameter("address"); +Class.forName("oracle.jdbc.driver.OracleDriver"); +Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); + +PreparedStatement ps=con.prepareStatement("select username,email from forumreg where username ='"+username+"' or email='"+email+"'"); +//ps.setString(1,n); +out.print("
    "); +ResultSet rs=ps.executeQuery(); +if(rs.next()){ +if(username.equals(rs.getString(1))|| email.equals(rs.getString(2))){ +request.setAttribute("regerr","Sorry! Username or Email Already Exists"); +%> + + +<% +} + +else{ + +if(email.equals(rs.getString(2))){ +request.setAttribute("regerr","Sorry!Username or Email id Already Exists"); +%> + + +<% +} + +} +} +else{ +PreparedStatement ps1=con.prepareStatement("insert into forumreg values(?,?,?,?,?,?)"); +ps1.setInt(1,3); +ps1.setString(2,username); +ps1.setString(3,userpass); +ps1.setString(4,email); + +ps1.setString(5,mobile); +ps1.setString(6,address); +int s=ps1.executeUpdate(); +System.out.print(s); +if(s>0){ +request.setAttribute("reg","Successfully Registered,Please Login"); +%> + +<% +} +else{ +request.setAttribute("regerr","Sorry! some errors occur,Please follow constraints"); +%> + + +<% +} + + +} + + + +con.close(); + + +}catch(SQLException e2){ +e2.printStackTrace(); +request.setAttribute("regerr","Sorry! some errors occur,Please Fill Correct Detail"); + %> + + +<% + +} +%> \ No newline at end of file diff --git a/projects/connect globe/WebContent/status.jsp b/projects/connect globe/WebContent/status.jsp new file mode 100644 index 0000000..f18a6b0 --- /dev/null +++ b/projects/connect globe/WebContent/status.jsp @@ -0,0 +1,235 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Connection"%> +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.ResultSet"%> + + + + + +Test + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    Best selection of premium Joomla 1.6 templates
    +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

    + +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + + + +
    +
    +
    +

    Now You can Share Your Social Problem such as some kind of Harassment,Bribe matters.

    +

    Simply just Register Yourself and Do login After that click on Post Report Link as shown above.And After selecting Your subject and location YOu can post Your matter Simply .This will be visible to every visitors and our Supporters will try to proceed it further

    + +
    +
    +
    + + + <% + try{ + Class.forName("oracle.jdbc.driver.OracleDriver"); + Connection con =DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); + PreparedStatement ps= con.prepareStatement("select country,state,district,police_station,report,status,email,postedon from forumrep order by postedon desc"); + ResultSet rs=ps.executeQuery(); + + while(rs.next()){ + out.print("
    "); + out.print("
    "); + out.print("Country:    "+rs.getString(1)+"
    "); + out.print("State:    "+rs.getString(2)+"
    "); + out.print("District:    "+rs.getString(3)+"
    "); + out.print("Police Station:    "+rs.getString(4)+"
    "); + out.print("Report:    
    "+rs.getString(5)+"
    "); + out.print("Status:    "+rs.getString(6)+"
    "); + out.print("Email:    "+rs.getString(7)+"                                                                                                                                                                                                 Posted On:    "+rs.getDate(8)+"
    "); + out.print("
    "); + out.print("
    "); + } + + } + catch(Exception e){e.printStackTrace(); + } + + %> + +
    + +
    +
    + +
    +
    + +
    +

    + + \ No newline at end of file diff --git a/projects/connect globe/WebContent/style.css b/projects/connect globe/WebContent/style.css new file mode 100644 index 0000000..f5da22b --- /dev/null +++ b/projects/connect globe/WebContent/style.css @@ -0,0 +1,48 @@ +/*:::::PIROBOX RULES::::::::*/ +.piro_overlay {position:fixed;_position:absolute;top:0;left:0;width:100%;height:100%;background:#fff;display:none;z-index:99997} +.loading span {position:absolute;top:50%;left:50%;margin-top:-15px;margin-left:-15px;width:30px;height:30px;display:block;z-index:100008;background:none } +.loading span span {position:absolute;display:block;width:30px;height:30px;z-index:100009;background:url(ajax-loader.gif) center center no-repeat!important;background:url(ajax-loader.gif) center center no-repeat} +.caption {position:absolute;bottom:0;left:0;margin:0;display:block;padding:0;cursor:text;background:#222} +.piro_nav {position:absolute;bottom:0;left:50%;margin:0;display:block;padding:0;background:none} +.caption p {display:block;margin:0;padding:4px 28px 4px 38px;text-align:center;font-weight:normal;background:black;color:white;font-size:12px} +a.piro_close {position:absolute;top:20px;right:20px;height:35px;width:35px;background:url(close_btn.png) no-repeat;cursor:pointer;z-index:100006} +a:hover.piro_close {background:url(close_btn_h.png) no-repeat} +a.piro_next {position:absolute;top:50%;width:35px;height:35px;right:20px;text-indent:-999em;outline:none;display:block;margin:-18px 0 0 0;background:url(next.png) center right no-repeat;border:none;cursor:pointer;z-index:1000000001} +a:hover.piro_next {background:url(next_h.png) center right no-repeat} +a.piro_prev {position:absolute;top:50%;width:35px;height:35px;left:20px;text-indent:-999em;outline:none;display:block;margin:-18px 0 0 0;background:url(prev.png) center left no-repeat;border:none;cursor:pointer;z-index:1000000000} +a:hover.piro_prev {background:url(prev_h.png) center left no-repeat} + + +.pirobox_content {position:absolute;top:50%;left:50%;padding:0;width:800px;height:600px;margin:-300px 0 0 -400px;display:block;z-index:99998;font-family:Trebuchet MS,Arial} +.pirobox_content table,tbody,tr,th,td {margin:0;padding:0;border:none} +.pirobox_content img {margin:0;padding:0;border:none} +.t_l {background:url(t_l.png) no-repeat;width:20px;height:20px} +.t_r {background:url(t_r.png) no-repeat;width:20px;height:20px} +.t_c {height:20px;background:url(t_c.png) repeat-x} +.c_l {width:20px;background:url(c_l.png) repeat-y} +.c_c {background:white;margin:0;padding:0} +.c_c div {width:760px;height:560px;margin:0;padding:0 0 0px 0} +.c_r {width:20px;background:url(c_r.png) repeat-y} +.b_c {height:20px;background:url(b_c.png) repeat-x} +.b_l {background:url(b_l.png) no-repeat;width:20px;height:20px} +.b_r {background:url(b_r.png) no-repeat;width:20px;height:20px} +/*.t_l {background:#000;width:10px;height:10px} +.t_r {background:#000;width:10px;height:10px} +.t_c {height:10px;background:#000} +.c_l {width:10px;background:#000} +.c_c {background:#000;margin:0;padding:0} +.c_c div {width:380px;height:180px;margin:0;padding:0} +.c_r {width:10px;background:#000} +.b_c {height:10px;background:#000} +.b_l {background:#000;width:10px;height:10px} +.b_r {background:#000;width:10px;height:10px} */ +.box_img {position:absolute;z-index:99995;background:url(img_bg.png);width:100%;top:30px;left:30px;height:100%;padding:0} +.err_mess {position:absolute;bottom:20px;color:white;padding:0;margin:0 0 0 20px;display:block} +.err_mess a {color:red;font-weight:700} +.number {position:absolute;margin-left:3px;height:18px;width:30px;padding:3px;left:0;color:#666;bottom:1px;font-size:11px} +a.link_to {position:absolute;margin-right:6px;height:20px;width:20px;right:0;color:#999;bottom:3px;background:url(link_out.png) no-repeat;text-indent:-999em} +a:hover.link_to {background:url(link_out_h.png) no-repeat} +a.play {position:absolute;top:20px!important;top:20px;left:20px!important;left:20px;width:40px;height:40px;margin:0;outline:none;display:block;background:url(play.png) no-repeat;text-indent:-999em;border:none;cursor:pointer} +a:hover.play {background:url(play_h.png) no-repeat} +a.stop {position:absolute;top:20px!important;top:20px;left:20px!important;left:20px;;width:40px;height:40px;margin:0;outline:none;display:block;background:url(pause.png) no-repeat;text-indent:-999em;border:none;cursor:pointer} +a:hover.stop {background:url(pause_h.png) no-repeat} \ No newline at end of file diff --git a/projects/connect globe/WebContent/styles.css b/projects/connect globe/WebContent/styles.css new file mode 100644 index 0000000..9a98221 --- /dev/null +++ b/projects/connect globe/WebContent/styles.css @@ -0,0 +1,166 @@ +* {margin:0;padding:0} +img {padding:0;border:none} +a {color:#873c02;font-weight:bold;text-decoration:none} +a:hover {text-decoration:none;color:#000} +h2 {font-family:Arial, Helvetica, sans-serif;font-size:18px;font-weight:bold;color:#873c02;text-transform:uppercase;padding-bottom:10px} +h3 {font-family:Arial, Helvetica, sans-serif;font-size:18px;font-weight:bold;color:#873c02} +.row h3 {padding-top:10px;padding-bottom:5px} +h4 {font-family:Arial, Helvetica, sans-serif;font-size:18px;font-weight:bold;color:#873c02;text-transform:uppercase;padding-bottom:10px;padding-top:5px} +h5 {font-family:Arial, Helvetica, sans-serif;font-size:18px;font-weight:bold;color:#fff;background:url(images/blog_title_right.png) no-repeat top left;width:262px;height:32px;padding-left:40px;padding-top:15px} +body {font-family:Arial, Helvetica, sans-serif;font-size:12px;line-height:18px;color:#232323;background:#37cd01 url(images/bg_grad.jpg) repeat-x top} +.inner_copy, .inner_copy a {border:0;float:right;background:#fff;color:#f00;width:50%;line-height:10px;font-size:10px;margin:-220% 0 0 0;overflow:hidden;padding:0} +#bg_img {background:url(images/bg.jpg) no-repeat top center} +#site_div {width:1000px;margin:0 auto} +/*Logo*/ +#logo {padding-top:20px;height:90px} +#logo a {text-decoration:none;color:#fff} +#logo h1 {font-family:Arial, Helvetica, sans-serif;font-size:60px;font-style:normal;color:;font-weight:normal} +#logo small {font-family:Arial, Helvetica, sans-serif;font-size:12px;font-style:italic;color:#fff;font-weight:normal;padding-left:80px} +/*Menu*/ +#menu {background:url(images/menu_bg.png) no-repeat top left;width:1000px;height:49px;padding-bottom:10px} +#menu ul {padding-left:0;width:950px;margin:0 auto} +#menu li {display:inline} +#menu a {font-family:Arial, Helvetica, sans-serif;font-size:18px;font-weight:normal;color:#fff;text-decoration:none;text-align:center;display:block;float:left;width:118px; height:32px;padding-top:17px} +#menu a:hover, #menu .active {height:32px;background:url(images/menu_hover.png) repeat-x top} +/*Main*/ +#main {width:1000px;margin:0 auto} +.index_main_top {background:url(images/index_main_top.png) no-repeat top;height:21px} +.main_top {background:url(images/main_top.png) no-repeat top;height:15px} +.index_prev_grad {background:#c25f0c url(images/index_prev_grad.png) repeat-x top;min-height:205px;padding-top:13px} +.index_prev_bot {background:url(images/index_prev_bot.png) no-repeat top;height:16px;padding-bottom:10px} +.prev_but_left, .prev_but_right {width:30px;float:left;padding-left:10px;padding-right:10px;padding-top:87px} +.prev_but_center {width:845px;padding-left:20px;padding-right:20px;float:left} +.prev_but_center_left {float:left;width:302px} +.prev_but_center_right {float:left;width:510px;padding-left:30px} +.prev_but_center_right p {color:#232323} +.prev_but_center_right a {color:#fff;font-weight:bold} +.prev_img {background:url(images/img_bor_prev.png) no-repeat;width:287px;height:180px;padding:8px} +.read {text-align:right;padding-top:10px;padding-bottom:10px;padding-right:10px} +.read a {font-weight:bold;color:#fff;text-decoration:none;border-bottom:1px dotted #fff} +.readred {text-align:right;padding-top:10px;padding-right:10px} +.readred a {font-weight:bold;color:#873c02;text-decoration:none;border-bottom:1px dotted #873c02} +#index_box_top {background:url(images/index_box_top.png) no-repeat;height:14px} +#index_box_bg {background:url(images/index_box_bg.png);padding-left:20px;padding-right:20px} +#index_box_bot {background:url(images/index_box_bot.png) no-repeat;height:14px} +#table{ width: 1000px;height: auto;} +#index_col {background:url(images/col_bg.png) repeat-y center;clear:both;margin-top:20px} +#index_col1 {width:252px;float:left;padding-left:30px;padding-right:40px} +#index_col2 {width:252px;float:left;padding-left:40px;padding-right:40px} +#index_col3 {width:252px;float:left;padding-left:20px;padding-right:40px} +#report {width:252px;float:left;padding-left:20px;padding-right:40px} +#log {} +#log fieldset {border:none} +#log label {font-family:Arial, Helvetica, sans-serif;font-size:12px;font-weight:normal;color:#fff;text-align:left;padding-left:10px} +#log input {margin-bottom:5px} +#login-submit, #contact-submit {width:106px;height:25px;background:url(images/send.png);background-repeat:no-repeat;background-position:left top;border:none;float:right;font-family:Arial,Helvetica,sans-serif;font-size:14px;font-weight:bold;color:#fff;text-transform:uppercase} +#text1, #text2, #text3 {width:232px;height:27px;padding-top:0;padding-left:10px;padding-right:12px;border:none;background:url(images/input_bg.png);background-repeat:no-repeat;background-position:left top;color:#cfcfcf;font-size:12px;padding-bottom:5px} +#text_mess {width:234px;height:92px;padding-top:4px;padding-left:10px;padding-right:10px;padding-bottom:10px;border:none;background:url(images/text_mess.png);background-repeat:no-repeat;background-position:left top;color:#cfcfcf;font-size:12px;padding-bottom:5px;margin-bottom:10px} +.main_top {background:url(images/main_top.png) no-repeat top;height:15px} +.main_bg {background:url(images/main_bg.png);padding-left:8px;padding-right:7px} +.main_bot {background:url(images/main_bot.png) no-repeat top;height:15px;padding-bottom:10px} +.ls {list-style:none;padding-left:0} +.ls li {background:url(images/ls.png) no-repeat 0px 6px;margin-bottom:4px;padding-left:15px} +.about {padding-left:20px;padding-right:20px} +.contact {padding-left:10px;padding-right:10px;background:url(images/contactus_bg.png) repeat-y} +.news_about {padding-bottom:20px} +.dotted_hr {height:1px;border-top:1px dotted #666666;clear:both;padding-bottom:20px} +#contact_form fieldset {border:none;padding-top:10px} +#contact_form label {font-family:Arial, Helvetica, sans-serif;font-size:12px;font-weight:bold;color:#505050;text-align:left;padding-left:10px} +#contact_form input {margin-bottom:5px} +#contact-submit {width:106px;height:25px;color:#fff;background:url(images/send.png);background-repeat:no-repeat;background-position:left top;border:none;float:right} +#con_name, #con_email, #con_website {width:516px;height:27px;padding-top:0;padding-left:10px;padding-right:12px;border:none;background:url(images/contact_input.png);background-repeat:no-repeat;background-position:left top;color:#000;padding-bottom:5px;font-size:12px} +#con_mess {width:518px;height:176px;padding-top:4px;padding-left:10px;padding-right:10px;padding-bottom:15px;border:none;background:url(images/mess_contact.png);background-repeat:no-repeat;background-position:left top;color:#000;margin-bottom:10px} +.index_left {float:left;width:610px;padding-right:100px;padding-left:0} +.index_right {float:left;width:255px} +.index_right ul {padding-top:10px} +.index_right ul li {padding-bottom:8px} +.index_right h2 {padding-top:6px} +.news {padding-bottom:20px} +.pad_left {padding-left:60px;padding-top:15px} +.blog {padding-left:10px;padding-right:0} +.blog_news {padding-bottom:30px} +.blog_left {float:left;width:620px;padding-right:50px;padding-left:0} +.blog_right {float:left;width:302px} +.blog_right ul {padding-left:40px;list-style:none;padding-top:10px} +.blog_right ul li {padding-left:15px;margin-top:3px;background:url(images/ls2.png) no-repeat 0px 5px;padding-bottom:4px;border-bottom:1px dotted #666666;width:200px} +.news_top {clear:both} +.news_top_left {background:url(images/num_bg.png) no-repeat right;width:67px;height:65px;float:left;text-align:center} +.date_day {color:#fff;font-family:Arial,Helvetica,sans-serif;font-size:18px;font-weight:normal;padding-top:10px;padding-bottom:10px} +.date_month {color:#fff;font-family:Arial,Helvetica,sans-serif;font-size:10px;font-weight:normal;text-transform:lowercase} +.news_top_right {float:left;padding-left:10px;width:540px} +.news_title { padding-top:10px} +.tegs_hr {border-bottom:1px dotted #666666;padding-top:5px} +.publ {float:left;padding-left:10px} +.com {float:right;background:url(images/coments_bg.png) no-repeat 0px 5px;padding-left:15px;padding-right:5px} +.gray {font-size:12px;color:#666666;font-weight:bold} +.news_text {clear:both;padding-top:20px;line-height:20px} +.tegs_box {clear:both;padding-top:5px} +.row {padding-left:1px;height:235px;width:999px} +.box_img2 {width:308px;height:225px;background:url(images/img_bg_ind3.png) 0px 0px no-repeat;padding:10px 0px 0px 10px;float:left} +.box_razd {width:14px;height:50px;float:left} +.box_img2 h1 {font-family:Arial, Helvetica, sans-serif;font-size:24px;font-weight:100;color:#002380;text-align:left;padding:8px 0px 3px 0px} +.rol_over:hover {background:url(images/rol_over_galery.png) left top no-repeat} +.g_size {width:298px;height:123px;display:block} +.g1 {background:url(images/gal1.jpg) left top no-repeat} +.g2 {background:url(images/gal2.jpg) left top no-repeat} +.g3 {background:url(images/gal3.jpg) left top no-repeat} +.g4 {background:url(images/gal4.jpg) left top no-repeat} +.g5 {background:url(images/gal5.jpg) left top no-repeat} +.g6 {background:url(images/gal6.jpg) left top no-repeat} +.g7 {background:url(images/gal7.jpg) left top no-repeat} +.g8 {background:url(images/gal8.jpg) left top no-repeat} +.g9 {background:url(images/gal9.jpg) left top no-repeat} +.pirobox_gal1 {width:298px;height:123px;display:block} +.pirobox_gal1:hover {width:298px;height:123px;display:block;background:url(images/rol_over_galery.png) left top no-repeat} +/*footer*/ +.foot_col {width:941px;margin:0 auto;background:url(images/footer_grad.png) no-repeat top left;padding-top:20px;padding-left:60px;min-height:180px} +#footer_bot {clear:both;background:url(images/footer.png) repeat-x;text-align:center;height:55px;padding-top:20px} +#footer_bot p {font-family:Arial, Helvetica, sans-serif;font-size:10px;color:#873c02;font-weight:bold} +#footer_bot a {color:#873c02} +.foot_col1, .foot_col2 {float:left;width:33.3%} +.foot_col3 {float:left;width:33.3%} +.foot_pad {padding-left:15px} +.link1 {background:url(images/link1.png) no-repeat 0px 2px;padding-left:30px;min-height:18px;padding-bottom:10px} +.link2 {background:url(images/link2.png) no-repeat 0px 2px;padding-left:30px;min-height:18px;padding-bottom:10px} +.link3 {background:url(images/link3.png) no-repeat 0px 2px;padding-left:30px;min-height:18px;padding-bottom:10px} +.link4 {background:url(images/link4.png) no-repeat 0px 2px;padding-left:30px;min-height:18px;padding-bottom:10px} +/* Header Scroller */ +/* jQuery Coda-Slider v2.0 - http://www.ndoherty.biz/coda-slider +Copyright (c) 2009 Niall Doherty +This plugin available for use in all personal or commercial projects under both MIT and GPL licenses. */ +/* Insignificant stuff, for demo purposes */ +.panel h2.title {margin-bottom:10px } +noscript div {background:#ccc;border:1px solid #900;margin:20px 0;padding:15px } +/* Most common stuff you'll need to change */ +.coda-slider-wrapper {padding:0;padding-left:20px } +.coda-slider {background:none} +/* Use this to keep the slider content contained in a box even when JavaScript is disabled */ +.coda-slider-no-js .coda-slider {height:308px;overflow:hidden !important;padding-right:20px } +/* Change the width of the entire slider (without dynamic arrows) */ +.coda-slider, .coda-slider .panel {width:900px } +/* Change margin and width of the slider (with dynamic arrows) */ +.coda-slider-wrapper.arrows .coda-slider, .coda-slider-wrapper.arrows .coda-slider .panel {width:870px } +.coda-slider-wrapper.arrows .coda-slider {margin:0px } +/* Arrow styling */ +.coda-nav-left {padding-top:80px} +.coda-nav-right {padding-top:80px} +.coda-nav-left a {background:url(images/prev_but_left.png) no-repeat;color:#fff;width:28px;height:108px;text-indent:-9000em} +.coda-nav-right a {background:url(images/prev_but_right.png) no-repeat;color:#fff;width:28px;height:108px;text-indent:-9000em} +/* Tab nav */ +.coda-nav ul li a.current {background:#39c } +/* Panel padding */ +.coda-slider .panel-wrapper {padding:0px } +/* Preloader */ +.coda-slider p.loading {padding:20px;text-align:center } +/* Don't change anything below here unless you know what you're doing */ +/* Tabbed nav */ +.coda-nav ul {clear:both;display:block;margin:auto;overflow:hidden } +.coda-nav ul li {display:none } +.coda-nav ul li a {background:#000;color:#fff;display:block;float:left;margin-right:1px;padding:3px 6px;text-decoration:none } +/* Miscellaneous */ +.coda-slider-wrapper {clear:both;overflow:hidden } +.coda-slider {float:left;overflow:hidden;position:relative } +.coda-slider .panel {display:block;float:left } +.coda-slider .panel-container {position:relative } +.coda-nav-left, .coda-nav-right {float:left } +.coda-nav-left a, .coda-nav-right a {display:block;text-align:center;text-decoration:none } diff --git a/projects/connect globe/WebContent/test.jsp b/projects/connect globe/WebContent/test.jsp new file mode 100644 index 0000000..45873d5 --- /dev/null +++ b/projects/connect globe/WebContent/test.jsp @@ -0,0 +1,69 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> + + + + + +
    +
    +
    +

    Now You can Share Your Social Problem such as some kind of Harassment,Bribe matters.

    +

    Simply just Register Yourself and Do login After that click on Post Report Link as shown above.And After selecting Your subject and location YOu can post Your matter Simply .This will be visible to every visitors and our Supporters will try to proceed it further

    + +
    +
    +
    + + +
    +
    + +

    Latest News

    +
    + Apr. 10, 2010
    +

    Suspendisse rutrum interdum lacinia.
    + Suspendisse tempus aliquet elit sit amet pellentesque. Donec iaculis pulvinar mauris,

    + +
    +
    + Apr. 10, 2010
    +

    Suspendisse rutrum interdum lacinia.
    + Suspendisse tempus aliquet elit sit amet pellentesque. Donec iaculis pulvinar mauris,

    + +
    +
    +
    + +

    Recent Discovery


    +

    + +
    +
    + +

    Login Form

    +
    + + +
    +
    + User Name:
    + Password:
    + + +
    +
    +
    +
    +
    +
    + +
    + + + + + + \ No newline at end of file diff --git a/projects/connect globe/WebContent/testdb.jsp b/projects/connect globe/WebContent/testdb.jsp new file mode 100644 index 0000000..5166537 --- /dev/null +++ b/projects/connect globe/WebContent/testdb.jsp @@ -0,0 +1,27 @@ +<%@ page import="java.sql.*"%> +<%@ page import="java.io.*"%> +<% +try{ +Class.forName("oracle.jdbc.driver.OracleDriver"); +Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); +Integer id= (Integer)request.getAttribute("ID"); +PreparedStatement ps=con.prepareStatement("select image from forumrep where id='"+id+"'"); +ResultSet rs=ps.executeQuery(); +rs.next();//now on 1st row + +Blob b=rs.getBlob(1); +byte barr[]=new byte[(int)b.length()];//an array is created but contains no data +barr=b.getBytes(1,(int)b.length()); + +FileOutputStream fout=new FileOutputStream("F:/java eclipse/forum/WebRoot/image/"+id+".jpg"); +fout.write(barr); + +fout.close(); +System.out.println("ok"); + +con.close(); + +}catch (Exception e) {e.printStackTrace(); } + +%> + \ No newline at end of file diff --git a/projects/connect globe/WebContent/upload.jsp b/projects/connect globe/WebContent/upload.jsp new file mode 100644 index 0000000..3fc2b65 --- /dev/null +++ b/projects/connect globe/WebContent/upload.jsp @@ -0,0 +1,73 @@ +<%@ page import="java.io.*" %> +<%@ page import="java.sql.*" %> + +<% String contentType = request.getContentType(); +if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) { +DataInputStream in = new DataInputStream(request.getInputStream()); +int formDataLength = request.getContentLength(); +byte dataBytes[] = new byte[formDataLength]; +int byteRead = 0; +int totalBytesRead = 0; +while (totalBytesRead < formDataLength) { +byteRead = in.read(dataBytes, totalBytesRead,formDataLength); +totalBytesRead += byteRead; +} +String file = new String(dataBytes); +String saveFile = file.substring(file.indexOf("filename=\"") + 10); +saveFile = saveFile.substring(0, saveFile.indexOf("\n")); +saveFile = saveFile.substring(saveFile.lastIndexOf("\\") + 1,saveFile.indexOf("\"")); +int lastIndex = contentType.lastIndexOf("="); +String boundary = contentType.substring(lastIndex + 1,contentType.length()); +int pos; +pos = file.indexOf("filename=\""); +pos = file.indexOf("\n", pos) + 1; +pos = file.indexOf("\n", pos) + 1; +pos = file.indexOf("\n", pos) + 1; +int boundaryLocation = file.indexOf(boundary, pos) - 4; +int startPos = ((file.substring(0, pos)).getBytes()).length; +int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length; +FileOutputStream fileOut = new FileOutputStream(saveFile); +fileOut.write(dataBytes, startPos, (endPos - startPos)); +fileOut.flush(); +fileOut.close(); + + + +Connection connection = null; +String connectionURL = "jdbc:oracle:thin:@localhost:1521:xe";; +ResultSet rs = null; +PreparedStatement psmnt = null; +FileInputStream fis; +try { +Class.forName("oracle.jdbc.driver.OracleDriver"); +connection = DriverManager.getConnection(connectionURL, "system", "oracle"); +File f = new File(saveFile); +psmnt=connection.prepareStatement("select max(id) from forumrep"); +rs = psmnt.executeQuery(); +if(rs.next()){ + +int id= rs.getInt(1); +System.out.print(id); +request.setAttribute("ID",id); +} +Integer id= (Integer)request.getAttribute("ID"); +System.out.print("id after get"+id); +psmnt = connection.prepareStatement("update forumrep set image=? where id='"+id+"'"); +fis = new FileInputStream(f); +psmnt.setBinaryStream(1, (InputStream)fis, (int)(f.length())); +int s = psmnt.executeUpdate(); +if(s>0) { +System.out.print("saved"); +%> + +<% +} +else{ +%> + +<% +} +} +catch(Exception e){e.printStackTrace();} +} +%> \ No newline at end of file diff --git a/projects/connect globe/WebContent/uploadimage.jsp b/projects/connect globe/WebContent/uploadimage.jsp new file mode 100644 index 0000000..79feaad --- /dev/null +++ b/projects/connect globe/WebContent/uploadimage.jsp @@ -0,0 +1,55 @@ +<%@ page import="java.sql.*"%> +<%@ page import="java.io.*"%> +<%@ page import="java.util.*"%> +<% +String islogin=(String)session.getAttribute("islogin"); +if(islogin==null){ +request.setAttribute("notlogin_msg","Sorry,Please do Login first"); + +%> + +<% +} +%> +<% +java.util.Date sqdate=Calendar.getInstance().getTime(); + java.sql.Date dat =new java.sql.Date(sqdate.getTime()); +String country=request.getParameter("slist1"); +String state=request.getParameter("slist2"); +String district=request.getParameter("slist3"); +String police=request.getParameter("slist4"); +String report=request.getParameter("report"); +String status=request.getParameter("status"); +String email=(String)session.getAttribute("email"); +System.out.print(country); +System.out.print(state); +System.out.print(district); +System.out.print(police); +System.out.print(report); +System.out.print(status); +System.out.print(email); + try{ + Class.forName("oracle.jdbc.driver.OracleDriver"); + Connection con= DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); + PreparedStatement ps =con.prepareStatement("insert into forumrep(country,state,district,police_station,report,status,email,postedon)"+"values(?,?,?,?,?,?,?,?)"); +ps.setString(1,country); +ps.setString(2,state); + ps.setString(3,district); + ps.setString(4,police); + ps.setString(5,report); + ps.setString(6,status); + ps.setString(7,email); + ps.setDate(8,dat); + +int s= ps.executeUpdate(); +if(s>0){ +System.out.print("save"); +%> + + + +<% +} +else{System.out.print("sorry!try again");} + }catch(Exception e){} + %> \ No newline at end of file diff --git a/projects/connect globe/WebContent/uploadpic.jsp b/projects/connect globe/WebContent/uploadpic.jsp new file mode 100644 index 0000000..16ebd4c --- /dev/null +++ b/projects/connect globe/WebContent/uploadpic.jsp @@ -0,0 +1,55 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> + + + +<% +String islogin=(String)session.getAttribute("islogin"); +if(islogin==null){ +request.setAttribute("notlogin_msg","Sorry,Please do Login first"); + +%> + +<% +} +%> + +
    +
    +
    +

    Now You can Share Your Social Problem such as some kind of Harassment,Bribe matters.

    +

    Simply just Register Yourself and Do login After that click on Post Report Link as shown above.And After selecting Your subject and location YOu can post Your matter Simply .This will be visible to every visitors and our Supporters will try to proceed it further

    + +
    +
    +
    + +
    + +
    + +

    Post Report

    +
    + + +
    +
    + + + + + +
    Upload pic Please:
    +
    +
    +
    +
    +
    + + +
    + + + + + + \ No newline at end of file diff --git a/projects/connect globe/WebContent/viewallcmt.jsp b/projects/connect globe/WebContent/viewallcmt.jsp new file mode 100644 index 0000000..a2a172a --- /dev/null +++ b/projects/connect globe/WebContent/viewallcmt.jsp @@ -0,0 +1,320 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Connection"%> +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.ResultSet"%> + + + + + +Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    Best selection of premium Joomla 1.6 templates
    +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

    + +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + + + +
    +
    +
    +

    Now You can Share Your Social Problem such as some kind of Harassment,Bribe matters.

    +

    Simply just Register Yourself and Do login After that click on Post Report Link as shown above.And After selecting Your subject and location YOu can post Your matter Simply .This will be visible to every visitors and our Supporters will try to proceed it further

    + +
    +
    +
    + + + <% + + String id=request.getParameter("id"); + try{ + Class.forName("oracle.jdbc.driver.OracleDriver"); + Connection con =DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); + PreparedStatement ps= con.prepareStatement("select country,state,district,police_station,report,status,email,postedon,id from forumrep where id='"+id+"'"); + ResultSet rs=ps.executeQuery(); + + while(rs.next()){ + out.print("
    "); + out.print("
    "); + out.print("Country:    "+rs.getString(1)+"
    "); + out.print("State:    "+rs.getString(2)+"
    "); + out.print("District:    "+rs.getString(3)+"
    "); + out.print("Police Station:    "+rs.getString(4)+"
    "); + out.print("Report:    
    "+rs.getString(5)+"
    "); + out.print("Status:    "+rs.getString(6)+"
    "); + out.print("Email:    "+rs.getString(7)+"                                                                                                                                                                                                 Posted On:    "+rs.getDate(8)+"
    "); + + ps= con.prepareStatement("SELECT max(id) FROM FORUMADVC where rid='"+rs.getString(9)+"' "); + ResultSet rs3= ps.executeQuery(); + rs3.next(); + int limit=rs3.getInt(1); + System.out.print(limit); + PreparedStatement ps1= con.prepareStatement("SELECT * FROM FORUMADVC WHERE id <= '"+limit+"' and rid = '"+rs.getString(9)+"' " ); + ResultSet rs2= ps1.executeQuery(); + while(rs2.next()){ + + + out.print("
    "+rs2.getString(3)); + + out.print("
    By:-"+rs2.getString(4)); + out.print("
    "); + } + + + + + out.print("
    "); + out.print("
    "); + out.print("
    "); + + out.print("
    "); + out.print("
    "); + } + + } + catch(Exception e){e.printStackTrace(); + } + + %> + +
    + +
    +
    + +
    +
    + +
    +

    + + \ No newline at end of file diff --git a/projects/connect globe/WebContent/viewalltcmt.jsp b/projects/connect globe/WebContent/viewalltcmt.jsp new file mode 100644 index 0000000..feb4e97 --- /dev/null +++ b/projects/connect globe/WebContent/viewalltcmt.jsp @@ -0,0 +1,317 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Connection"%> +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.ResultSet"%> + + + + + +Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    Best selection of premium Joomla 1.6 templates
    +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

    + +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + + + +
    +
    +
    +

    Now You can Share Your Social Problem such as some kind of Harassment,Bribe matters.

    +

    Simply just Register Yourself and Do login After that click on Post Report Link as shown above.And After selecting Your subject and location YOu can post Your matter Simply .This will be visible to every visitors and our Supporters will try to proceed it further

    + +
    +
    +
    + + + <% + + String id=request.getParameter("id"); + try{ + Class.forName("oracle.jdbc.driver.OracleDriver"); + Connection con =DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); + PreparedStatement ps= con.prepareStatement("select topic,email,createdon,id from forumtpc where id='"+id+"'"); + ResultSet rs=ps.executeQuery(); + + while(rs.next()){ + out.print("
    "); + out.print("
    "); + + out.print("Topic:    
    "+rs.getString(1)+"
    "); + + out.print("Email:    "+rs.getString(2)+"                                                                                                                                                                                                 Created On:    "+rs.getDate(3)+"
    "); + + ps= con.prepareStatement("SELECT max(id) FROM FORUMTADVC where tid='"+rs.getString(4)+"' "); + ResultSet rs3= ps.executeQuery(); + rs3.next(); + int limit=rs3.getInt(1); + System.out.print(limit); + PreparedStatement ps1= con.prepareStatement("SELECT * FROM FORUMTADVC WHERE id <= '"+limit+"' and tid = '"+rs.getString(4)+"' " ); + ResultSet rs2= ps1.executeQuery(); + while(rs2.next()){ + + + out.print("
    "+rs2.getString(3)); + + out.print("
    By:-"+rs2.getString(4)); + out.print("
    "); + } + + + + + out.print("
    "); + out.print("
    "); + out.print("
    "); + + out.print("
    "); + out.print("
    "); + } + + } + catch(Exception e){e.printStackTrace(); + } + + %> + +
    + +
    +
    + +
    +
    + +
    +

    + + \ No newline at end of file diff --git a/projects/connect globe/WebContent/viewtopic.jsp b/projects/connect globe/WebContent/viewtopic.jsp new file mode 100644 index 0000000..d10313e --- /dev/null +++ b/projects/connect globe/WebContent/viewtopic.jsp @@ -0,0 +1,323 @@ +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Connection"%> +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.ResultSet"%> + + + + + +Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    Best selection of premium Joomla 1.6 templates
    +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

    + +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper

    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Vivamus id lobortis nisi. Duis semper porta justo, vel sodales velit vehicula vel.
    + Donec non vulputate odio. Quisque tellus augue, tristique vel lobortis ut, convallis vel est. Nam vel congue lectus. Suspendisse ullamcorper odio et leo congue eu semper Lorem ipsum dolor sit amet, consectetur adipiscing elit.

    + Nam justo odio, congue id fermentum sit amet, placerat sed nibh. Vestibulum pharetra nibh eu magna accumsan tristique. Sed ac velit urna, venenatis vulputate purus.

    + +
    +
    + +
    +
    + + +
    +
    + +
    +
    +<% +String islogin=(String)session.getAttribute("islogin"); +if(islogin==null){ +request.setAttribute("notlogin_msg","Sorry,Please do Login first"); + +%> + +<% +} +%> + + +
    +
    +
    +

    Now You can Share Your Social Problem such as some kind of Harassment,Bribe matters.

    +

    Simply just Register Yourself and Do login After that click on Post Report Link as shown above.And After selecting Your subject and location YOu can post Your matter Simply .This will be visible to every visitors and our Supporters will try to proceed it further

    + +
    +
    +
    + + + <% + try{ + Class.forName("oracle.jdbc.driver.OracleDriver"); + Connection con =DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); + PreparedStatement ps= con.prepareStatement("select topic,email,createdon,id from forumtpc order by createdon desc"); + ResultSet rs=ps.executeQuery(); + + while(rs.next()){ + out.print("
    "); + out.print("
    "); + out.print("Topic:    
    "+rs.getString(1)+"
    "); + + out.print("Email:    "+rs.getString(2)+"                                                                                                                                                                                                 Created On:    "+rs.getDate(3)+"
    "); + ps= con.prepareStatement("SELECT max(id) FROM FORUMTADVC where tid='"+rs.getString(4)+"' "); + ResultSet rs3= ps.executeQuery(); + rs3.next(); + int limit=rs3.getInt(1); + ps= con.prepareStatement("SELECT count(tid) FROM FORUMTADVC where tid='"+rs.getString(4)+"' "); + ResultSet rs5= ps.executeQuery(); + rs5.next(); + int count=rs5.getInt(1); + System.out.print(count); + if(count>3 ){ out.print("View All Comments"); + out.print("
    "); + } + + int limit2=rs3.getInt(1)-5; + System.out.print(limit2); + PreparedStatement ps1= con.prepareStatement("SELECT * FROM FORUMTADVC WHERE id > '"+limit2+"' and tid = '"+rs.getString(4)+"' " ); + ResultSet rs2= ps1.executeQuery(); + while(rs2.next()){ + + + + out.print("
    "+rs2.getString(3)); + + out.print("
    By:-"+rs2.getString(4)); + out.print("
    "); + + + + } + out.print("
    Give Your Advice"); + + out.print("
    "); + out.print("
    "); + } + + } + catch(Exception e){e.printStackTrace(); + } + + %> + +
    + +
    +
    + +
    +
    + +
    +

    + + \ No newline at end of file diff --git a/projects/connect globe/build/classes/com/javatpoint/MyListener.class b/projects/connect globe/build/classes/com/javatpoint/MyListener.class new file mode 100644 index 0000000..8c0811f Binary files /dev/null and b/projects/connect globe/build/classes/com/javatpoint/MyListener.class differ diff --git a/projects/connect globe/src/com/javatpoint/MyListener.java b/projects/connect globe/src/com/javatpoint/MyListener.java new file mode 100644 index 0000000..1000b98 --- /dev/null +++ b/projects/connect globe/src/com/javatpoint/MyListener.java @@ -0,0 +1,61 @@ +package com.javatpoint; +import javax.servlet.*; +import java.sql.*; + +public class MyListener implements ServletContextListener{ + + public void contextInitialized(ServletContextEvent arg0) { + + Connection con=null; + try{ + ResultSet rs; + Class.forName("oracle.jdbc.driver.OracleDriver"); + con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); + + PreparedStatement ps1=con.prepareStatement("Select * from FORUMREG"); + + rs=ps1.executeQuery(); + if(rs.next()) + {System.out.println("your table name already exist");} + else + {System.out.println("else if part table does not exist new table has created"); + + + PreparedStatement ps2= con.prepareStatement("CREATE SEQUENCE JAVATPOINT MINVALUE 1 MAXVALUE 999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER NOCYCLE"); + ps2.executeUpdate(); + PreparedStatement ps=con.prepareStatement("CREATE TABLE FORUMREG(ID NUMBER,USERNAME VARCHAR2(4000),USERPASS VARCHAR2(4000),EMAIL VARCHAR2(4000),MOBILE NUMBER,ADDRESS VARCHAR2(4000),CONSTRAINT FORUMREG_PK PRIMARY KEY (ID) ENABLE)"); + ps.executeUpdate(); + PreparedStatement ps4=con.prepareStatement("CREATE TABLE FORUMREP(ID NUMBER,COUNTRY VARCHAR2(4000),STATE VARCHAR2(4000),DISTRICT VARCHAR2(4000),POLICE_STATION VARCHAR2(4000),REPORT VARCHAR2(4000),STATUS VARCHAR2(4000),IMAGE BLOB,EMAIL VARCHAR2(4000),POSTEDON DATE,CONSTRAINT FORUMREP_PK PRIMARY KEY (ID) ENABLE)"); + ps4.executeUpdate(); + + + PreparedStatement ps5=con.prepareStatement("CREATE TABLE FORUMADVC(RID NUMBER,ID NUMBER,CMT VARCHAR2(4000),EMAIL VARCHAR2(4000),CONSTRAINT FORUMADVC_PK PRIMARY KEY (ID) ENABLE)"); + ps5.executeUpdate(); + + + ps5= con.prepareStatement("CREATE TABLE FORUMTPC ( ID NUMBER, TOPIC VARCHAR2(4000), EMAIL VARCHAR2(4000),CREATEDON DATE NOT NULL ENABLE,CONSTRAINT FORUMTPC_PK PRIMARY KEY (ID) ENABLE )"); + ps5.executeUpdate(); + + + ps5= con.prepareStatement("CREATE TABLE FORUMTADVC(ID NUMBER, TID NUMBER, CMT VARCHAR2(4000), EMAIL VARCHAR2(4000),CONSTRAINT FORUMTADVC_PK PRIMARY KEY (ID) ENABLE)"); + ps5.executeUpdate(); + Statement stmt=con.createStatement(); + stmt.executeUpdate("CREATE OR REPLACE TRIGGER BI_FORUMREG before insert on FORUMREG for each row begin select JAVATPOINT.nextval into :NEW.ID from dual; end"); + stmt.executeUpdate("CREATE OR REPLACE TRIGGER BI_FORUMREP before insert on FORUMREP for each row begin select JAVATPOINT.nextval into :NEW.ID from dual;end"); + stmt.executeUpdate("CREATE OR REPLACE TRIGGER BI_FORUMADVC before insert on FORUMADVC for each row begin select JAVATPOINT.nextval into :NEW.ID from dual;end"); + stmt.executeUpdate("CREATE OR REPLACE TRIGGER BI_FORUMTADVC before insert on FORUMTADVC for each row begin select JAVATPOINT.nextval into :NEW.ID from dual;end"); + stmt.executeUpdate("CREATE OR REPLACE TRIGGER BI_FORUMTPC before insert on FORUMTPC for each row begin select JAVATPOINT.nextval into :NEW.ID from dual;end"); + } + } + + catch(Exception e){ + e.printStackTrace(); + + } + } + + public void contextDestroyed(ServletContextEvent arg0) { + System.out.println("project undeployed"); + + } +} diff --git a/projects/lan-chat-app-master/README.md b/projects/lan-chat-app-master/README.md new file mode 100644 index 0000000..98775ec --- /dev/null +++ b/projects/lan-chat-app-master/README.md @@ -0,0 +1,10 @@ +# LanChatApp +A Lan chat app built in Java by the use of network programming. Uses UDP (User Datagram Protocol) to send a message to all the clients through multicasting. The desktop application can be used in a Local area network to +connect and text other users. Multiple users can text at the same time. +The project is built using Netbeans IDE. To use this project, just clone the repository and open the project using netbeans IDE. +# App in working + +![alt text](https://github.com/PushpinderSinghGrewal/LanChatApp/blob/master/lanchatapp.jpeg) + + In the **Chat Window** box type the message you want to write and click on **Send**. The message will be sent to all the users who are online and are in the same Local Area Network. + diff --git a/projects/lan-chat-app-master/build.xml b/projects/lan-chat-app-master/build.xml new file mode 100644 index 0000000..3704470 --- /dev/null +++ b/projects/lan-chat-app-master/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project MyProject. + + + diff --git a/projects/lan-chat-app-master/build/built-jar.properties b/projects/lan-chat-app-master/build/built-jar.properties new file mode 100644 index 0000000..1d3a6a1 --- /dev/null +++ b/projects/lan-chat-app-master/build/built-jar.properties @@ -0,0 +1,4 @@ +#Mon, 20 May 2019 19:11:35 +0530 + + +C\:\\Users\\HP\\Downloads\\projects\\lan-chat-app-master= diff --git a/projects/lan-chat-app-master/build/classes/chatapplication/ChatApp$1.class b/projects/lan-chat-app-master/build/classes/chatapplication/ChatApp$1.class new file mode 100644 index 0000000..4f0d665 Binary files /dev/null and b/projects/lan-chat-app-master/build/classes/chatapplication/ChatApp$1.class differ diff --git a/projects/lan-chat-app-master/build/classes/chatapplication/ChatApp$2.class b/projects/lan-chat-app-master/build/classes/chatapplication/ChatApp$2.class new file mode 100644 index 0000000..8c2d59a Binary files /dev/null and b/projects/lan-chat-app-master/build/classes/chatapplication/ChatApp$2.class differ diff --git a/projects/lan-chat-app-master/build/classes/chatapplication/ChatApp$3.class b/projects/lan-chat-app-master/build/classes/chatapplication/ChatApp$3.class new file mode 100644 index 0000000..9c76c6a Binary files /dev/null and b/projects/lan-chat-app-master/build/classes/chatapplication/ChatApp$3.class differ diff --git a/projects/lan-chat-app-master/build/classes/chatapplication/ChatApp.class b/projects/lan-chat-app-master/build/classes/chatapplication/ChatApp.class new file mode 100644 index 0000000..e0309b1 Binary files /dev/null and b/projects/lan-chat-app-master/build/classes/chatapplication/ChatApp.class differ diff --git a/projects/lan-chat-app-master/build/classes/chatapplication/Client.class b/projects/lan-chat-app-master/build/classes/chatapplication/Client.class new file mode 100644 index 0000000..c46de8f Binary files /dev/null and b/projects/lan-chat-app-master/build/classes/chatapplication/Client.class differ diff --git a/projects/lan-chat-app-master/build/classes/chatapplication/MultiClient.class b/projects/lan-chat-app-master/build/classes/chatapplication/MultiClient.class new file mode 100644 index 0000000..ba31432 Binary files /dev/null and b/projects/lan-chat-app-master/build/classes/chatapplication/MultiClient.class differ diff --git a/projects/lan-chat-app-master/build/classes/chatapplication/MulticastClient$1.class b/projects/lan-chat-app-master/build/classes/chatapplication/MulticastClient$1.class new file mode 100644 index 0000000..59b0fec Binary files /dev/null and b/projects/lan-chat-app-master/build/classes/chatapplication/MulticastClient$1.class differ diff --git a/projects/lan-chat-app-master/build/classes/chatapplication/MulticastClient$2.class b/projects/lan-chat-app-master/build/classes/chatapplication/MulticastClient$2.class new file mode 100644 index 0000000..90eebec Binary files /dev/null and b/projects/lan-chat-app-master/build/classes/chatapplication/MulticastClient$2.class differ diff --git a/projects/lan-chat-app-master/build/classes/chatapplication/MulticastClient$3.class b/projects/lan-chat-app-master/build/classes/chatapplication/MulticastClient$3.class new file mode 100644 index 0000000..85cf625 Binary files /dev/null and b/projects/lan-chat-app-master/build/classes/chatapplication/MulticastClient$3.class differ diff --git a/projects/lan-chat-app-master/build/classes/chatapplication/MulticastClient.class b/projects/lan-chat-app-master/build/classes/chatapplication/MulticastClient.class new file mode 100644 index 0000000..e4d9803 Binary files /dev/null and b/projects/lan-chat-app-master/build/classes/chatapplication/MulticastClient.class differ diff --git a/projects/lan-chat-app-master/build/classes/chatapplication/OnlineStatus.class b/projects/lan-chat-app-master/build/classes/chatapplication/OnlineStatus.class new file mode 100644 index 0000000..3098d32 Binary files /dev/null and b/projects/lan-chat-app-master/build/classes/chatapplication/OnlineStatus.class differ diff --git a/projects/lan-chat-app-master/build/classes/chatapplication/ReceiveOnlineStatus.class b/projects/lan-chat-app-master/build/classes/chatapplication/ReceiveOnlineStatus.class new file mode 100644 index 0000000..1f23338 Binary files /dev/null and b/projects/lan-chat-app-master/build/classes/chatapplication/ReceiveOnlineStatus.class differ diff --git a/projects/lan-chat-app-master/lanchatapp.jpeg b/projects/lan-chat-app-master/lanchatapp.jpeg new file mode 100644 index 0000000..a71b800 Binary files /dev/null and b/projects/lan-chat-app-master/lanchatapp.jpeg differ diff --git a/projects/lan-chat-app-master/manifest.mf b/projects/lan-chat-app-master/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/projects/lan-chat-app-master/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/projects/lan-chat-app-master/nbproject/build-impl.xml b/projects/lan-chat-app-master/nbproject/build-impl.xml new file mode 100644 index 0000000..6915e0f --- /dev/null +++ b/projects/lan-chat-app-master/nbproject/build-impl.xml @@ -0,0 +1,1420 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/lan-chat-app-master/nbproject/genfiles.properties b/projects/lan-chat-app-master/nbproject/genfiles.properties new file mode 100644 index 0000000..22a8d8f --- /dev/null +++ b/projects/lan-chat-app-master/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=359a224f +build.xml.script.CRC32=7a743bf7 +build.xml.stylesheet.CRC32=8064a381@1.79.1.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=359a224f +nbproject/build-impl.xml.script.CRC32=653a618c +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/projects/lan-chat-app-master/nbproject/private/private.properties b/projects/lan-chat-app-master/nbproject/private/private.properties new file mode 100644 index 0000000..21b8a24 --- /dev/null +++ b/projects/lan-chat-app-master/nbproject/private/private.properties @@ -0,0 +1 @@ +user.properties.file=C:\\Users\\HP\\AppData\\Roaming\\NetBeans\\8.2\\build.properties diff --git a/projects/lan-chat-app-master/nbproject/private/private.xml b/projects/lan-chat-app-master/nbproject/private/private.xml new file mode 100644 index 0000000..95f97e5 --- /dev/null +++ b/projects/lan-chat-app-master/nbproject/private/private.xml @@ -0,0 +1,12 @@ + + + + + + file:/C:/Users/HP/Downloads/projects/lan-chat-app-master/src/chatapplication/ChatApp.java + file:/C:/Users/HP/Downloads/projects/lan-chat-app-master/src/chatapplication/OnlineStatus.java + file:/C:/Users/HP/Downloads/projects/lan-chat-app-master/src/chatapplication/MultiClient.java + file:/C:/Users/HP/Downloads/projects/lan-chat-app-master/src/chatapplication/MulticastClient.java + + + diff --git a/projects/lan-chat-app-master/nbproject/project.properties b/projects/lan-chat-app-master/nbproject/project.properties new file mode 100644 index 0000000..63334a5 --- /dev/null +++ b/projects/lan-chat-app-master/nbproject/project.properties @@ -0,0 +1,95 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=MyProject +application.vendor=Pinder +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/MyProject.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +includes=** +jar.archive.disabled=${jnlp.enabled} +jar.compress=false +jar.index=${jnlp.enabled} +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +jnlp.codebase.type=no.codebase +jnlp.descriptor=application +jnlp.enabled=false +jnlp.mixed.code=default +jnlp.offline-allowed=false +jnlp.signed=false +jnlp.signing= +jnlp.signing.alias= +jnlp.signing.keystore= +main.class=chatapplication.ChatApp +# Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found. +manifest.custom.application.library.allowable.codebase= +# Optional override of default Caller-Allowable-Codebase attribute identifying the domains from which JavaScript code can make calls to your RIA without security prompts. +manifest.custom.caller.allowable.codebase= +# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed +manifest.custom.codebase= +# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions) +manifest.custom.permissions= +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/projects/lan-chat-app-master/nbproject/project.xml b/projects/lan-chat-app-master/nbproject/project.xml new file mode 100644 index 0000000..6eef124 --- /dev/null +++ b/projects/lan-chat-app-master/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + MyProject + + + + + + + + + diff --git a/projects/lan-chat-app-master/src/chatapplication/ChatApp.form b/projects/lan-chat-app-master/src/chatapplication/ChatApp.form new file mode 100644 index 0000000..989a785 --- /dev/null +++ b/projects/lan-chat-app-master/src/chatapplication/ChatApp.form @@ -0,0 +1,83 @@ + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/lan-chat-app-master/src/chatapplication/ChatApp.java b/projects/lan-chat-app-master/src/chatapplication/ChatApp.java new file mode 100644 index 0000000..b6cd954 --- /dev/null +++ b/projects/lan-chat-app-master/src/chatapplication/ChatApp.java @@ -0,0 +1,145 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package chatapplication; + +import java.awt.Color; + + + +/** + * + * @author Pinder + */ +public class ChatApp extends javax.swing.JFrame { + static String name; + /** + * Creates new form ChatApp + */ + public ChatApp() { + + this.setTitle("ChatApp"); + + this.setUndecorated(true); + initComponents(); + // getContentPane().setBackground(Color.GRAY); + this.setLocationRelativeTo(null); + + + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jButton2 = new javax.swing.JButton(); + jButton3 = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setBackground(new java.awt.Color(255, 255, 153)); + setFont(new java.awt.Font("Cambria Math", 3, 10)); // NOI18N + setForeground(new java.awt.Color(255, 0, 0)); + + jButton2.setFont(new java.awt.Font("Gabriola", 1, 24)); // NOI18N + jButton2.setText("Login to Chat Room"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + jButton3.setFont(new java.awt.Font("Gabriola", 1, 24)); // NOI18N + jButton3.setText("Exit"); + jButton3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton3ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap(382, Short.MAX_VALUE) + .addComponent(jButton3) + .addContainerGap(95, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addGap(161, 161, 161) + .addComponent(jButton2) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap(172, Short.MAX_VALUE) + .addComponent(jButton2) + .addGap(121, 121, 121) + .addComponent(jButton3) + .addGap(37, 37, 37)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + this.setVisible(false); + new MultiClient(); + + + }//GEN-LAST:event_jButton2ActionPerformed + + private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed + + // TODO add your handling code here: + this.setVisible(false); + System.exit(1); + }//GEN-LAST:event_jButton3ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(ChatApp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(ChatApp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(ChatApp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(ChatApp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new ChatApp().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton2; + private javax.swing.JButton jButton3; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/lan-chat-app-master/src/chatapplication/MultiClient.java b/projects/lan-chat-app-master/src/chatapplication/MultiClient.java new file mode 100644 index 0000000..ffe8c72 --- /dev/null +++ b/projects/lan-chat-app-master/src/chatapplication/MultiClient.java @@ -0,0 +1,39 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package chatapplication; + +import static chatapplication.MulticastClient.name; +import javax.swing.JOptionPane; + +/** + * + * @author Pinder + */ +public class MultiClient { + MultiClient() { name= JOptionPane.showInputDialog("Please enter your name"); + int count=0; + while( name==null || name.equals("") ) + { if(name==null) + { + new ChatApp().setVisible(true); + count++; + break;} + else if(name.equals("")) + { JOptionPane.showMessageDialog(new ChatApp(), "Please enter a proper name"); + name=JOptionPane.showInputDialog("Please enter your name"); + } + + } + if(count==0) + { new MulticastClient().setVisible(true); + Thread t1=new Thread(new Client()); + t1.start(); + + + + } +} +} diff --git a/projects/lan-chat-app-master/src/chatapplication/MulticastClient.form b/projects/lan-chat-app-master/src/chatapplication/MulticastClient.form new file mode 100644 index 0000000..6dcc29c --- /dev/null +++ b/projects/lan-chat-app-master/src/chatapplication/MulticastClient.form @@ -0,0 +1,197 @@ + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/lan-chat-app-master/src/chatapplication/MulticastClient.java b/projects/lan-chat-app-master/src/chatapplication/MulticastClient.java new file mode 100644 index 0000000..b3d59dd --- /dev/null +++ b/projects/lan-chat-app-master/src/chatapplication/MulticastClient.java @@ -0,0 +1,330 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package chatapplication; + +import static chatapplication.MulticastClient.name; +import static chatapplication.MulticastClient.s; +import java.net.*; +import java.io.*; +import java.util.*; +import javax.swing.JOptionPane; + + + +/** + * + * @author Pinder + */ +public class MulticastClient extends javax.swing.JFrame { + public static String name; +public static String message; +public static MulticastSocket socket=null; +public static InetAddress address ; +public static DatagramSocket s=null; +/** + * Creates new form MulticastServerThread + */ + public MulticastClient() { + + initComponents(); + this.setLocationRelativeTo(null); + + + + +} + + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jButton1 = new javax.swing.JButton(); + jScrollPane1 = new javax.swing.JScrollPane(); + jTextArea1 = new javax.swing.JTextArea(); + jScrollPane2 = new javax.swing.JScrollPane(); + jTextArea2 = new javax.swing.JTextArea(); + jLabel1 = new javax.swing.JLabel(); + jButton2 = new javax.swing.JButton(); + jLabel2 = new javax.swing.JLabel(); + jScrollPane3 = new javax.swing.JScrollPane(); + jTextArea3 = new javax.swing.JTextArea(); + jLabel3 = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + + jButton1.setText("Send"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jTextArea1.setEditable(false); + jTextArea1.setColumns(20); + jTextArea1.setFont(new java.awt.Font("Calibri Light", 0, 18)); // NOI18N + jTextArea1.setRows(5); + jTextArea1.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR)); + jScrollPane1.setViewportView(jTextArea1); + + jTextArea2.setColumns(20); + jTextArea2.setFont(new java.awt.Font("Gabriola", 1, 24)); // NOI18N + jTextArea2.setRows(5); + jScrollPane2.setViewportView(jTextArea2); + + jLabel1.setFont(new java.awt.Font("Gabriola", 1, 24)); // NOI18N + jLabel1.setText("Enter your message here"); + + jButton2.setText("Exit from Chat"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + jLabel2.setFont(new java.awt.Font("Gabriola", 1, 24)); // NOI18N + jLabel2.setText("Chat Window"); + + jTextArea3.setEditable(false); + jTextArea3.setColumns(20); + jTextArea3.setRows(5); + jScrollPane3.setViewportView(jTextArea3); + + jLabel3.setFont(new java.awt.Font("Gabriola", 1, 24)); // NOI18N + jLabel3.setText("Online users"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(23, 23, 23) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(50, 50, 50) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1) + .addGroup(layout.createSequentialGroup() + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 326, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(73, 73, 73) + .addComponent(jButton2))) + .addGap(0, 163, Short.MAX_VALUE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(jLabel3)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton2))) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + + String x="***** "+name+" has logged out from the chat room *****"; + + byte buf[]=x.getBytes(); + try{ InetAddress group = InetAddress.getByName("230.0.0.1"); + DatagramPacket packet = new DatagramPacket(buf, buf.length, group, 4446); + + + s.send(packet); + }catch(Exception e){} + x="exited"; + buf=x.getBytes(); + try{ + InetAddress group=InetAddress.getByName("230.0.0.2"); + DatagramPacket packet=new DatagramPacket(buf, buf.length,group,5000); + s.send(packet); + + socket.leaveGroup(address); + s.close(); + + } + catch(Exception e){} + this.setVisible(false); + new ChatApp().setVisible(true); + + }//GEN-LAST:event_jButton2ActionPerformed + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + + String text= jTextArea2.getText(); + if(!text.equals("")) + { message=name+": "+text; + + try { + + byte[] buf ; + + + + + buf = message.getBytes(); + + // send it + + InetAddress group = InetAddress.getByName("230.0.0.1"); + DatagramPacket packet = new DatagramPacket(buf, buf.length, group, 4446); + + s.send(packet); + + + } + catch (IOException e) { + // System.out.println(e); + MulticastClient.socket.close(); + } } + }//GEN-LAST:event_jButton1ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + @Override + public void run() { + + new MulticastClient().setVisible(true); + + } + } + ); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JScrollPane jScrollPane3; + public static javax.swing.JTextArea jTextArea1; + public static javax.swing.JTextArea jTextArea2; + public static javax.swing.JTextArea jTextArea3; + // End of variables declaration//GEN-END:variables +} + + + + class Client implements Runnable { + + Client(){ + try{ + MulticastClient.socket = new MulticastSocket(4446) ; + MulticastClient. s=new DatagramSocket(); + + MulticastClient. address=InetAddress.getByName("230.0.0.1"); + MulticastClient.socket.joinGroup(MulticastClient.address); + } + catch(Exception e) + {JOptionPane.showMessageDialog(new ChatApp(), "Sorry,Cannot bind");}} + @Override + public void run(){ + Thread t3=new Thread(new OnlineStatus()); + + t3.start(); + Thread t4=new Thread(new ReceiveOnlineStatus()); + t4.start(); + newUser(); + + + + + + while(true) + { + + try{ + + + + + DatagramPacket packet; + + + + byte[] buf = new byte[256]; + packet = new DatagramPacket(buf, buf.length); + + MulticastClient.socket.receive(packet); + + String received = new String(packet.getData(), 0, packet.getLength()); + + MulticastClient.jTextArea1.setText(MulticastClient.jTextArea1.getText()+received+"\n"); + + MulticastClient.jTextArea2.setText(""); + }catch(IOException e){System.err.println(e);} + } + + + } void newUser(){String x="***** "+name+" has logged into the chat room *****"; + byte buf[]=x.getBytes(); + try{ InetAddress group = InetAddress.getByName("230.0.0.1"); + DatagramPacket packet = new DatagramPacket(buf, buf.length, group, 4446); + + + s.send(packet); + }catch(Exception e){}} + } + + + + + + + + + + + + + + diff --git a/projects/lan-chat-app-master/src/chatapplication/OnlineStatus.java b/projects/lan-chat-app-master/src/chatapplication/OnlineStatus.java new file mode 100644 index 0000000..238848f --- /dev/null +++ b/projects/lan-chat-app-master/src/chatapplication/OnlineStatus.java @@ -0,0 +1,130 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package chatapplication; + +/** + * + * @author Pinder + */ + +import java.io.*; +import static java.lang.Thread.sleep; +import java.net.*; +import java.util.*; +public class OnlineStatus implements Runnable{ + DatagramSocket s; + + OnlineStatus(){ + try { + s=new DatagramSocket(); + } catch (SocketException ex) { + + }} + @Override + public void run(){ + while(true) + { + try { + + byte[] buf ; + + + + + buf=MulticastClient.name.getBytes(); + + // send it + + InetAddress group = InetAddress.getByName("230.0.0.2"); + DatagramPacket packet = new DatagramPacket(buf, buf.length, group, 5000); + + s.send(packet); + //System.out.println(Math.random()); + try{sleep((long)(Math.random() * 20000)); + + }catch(Exception e){} + } + catch (IOException e) { + System.out.println("error in online status class"); + s.close();} + + + + + +}} +}class ReceiveOnlineStatus implements Runnable{ +InetAddress address=null; +MulticastSocket socket=null; +public static ArrayList al=new ArrayList(); +ReceiveOnlineStatus(){ + try{ + socket = new MulticastSocket(5000) ; + + + address=InetAddress.getByName("230.0.0.2"); + socket.joinGroup(address); + } + catch(Exception e) + {System.err.println("error"); + } +} + + + +@Override +public void run(){ + al=new ArrayList(); +while(true){ + + + try{ DatagramPacket packet; + + + + byte[] buf = new byte[256]; + packet = new DatagramPacket(buf, buf.length); + + socket.receive(packet); + +String name=new String(packet.getData(), 0, packet.getLength()); +if(name.equals("exited")) + al=new ArrayList(); + + +if(!al.contains(name)&& !name.equals("exited")) +{ + al.add(name); + + if(MulticastClient.jTextArea3.getText().equals("")) + MulticastClient.jTextArea3.setText(name); + else + { MulticastClient.jTextArea3.setText(""); + for(Object obj:al) + { + MulticastClient.jTextArea3.setText(MulticastClient.jTextArea3.getText()+obj.toString()+"\n"); + } + } +} + + } +catch(Exception e){System.out.println("error in receiveonline status class");} + + + + + + + + + + +}} + + + + +} \ No newline at end of file diff --git a/projects/library management/.classpath b/projects/library management/.classpath new file mode 100644 index 0000000..0ebd05a --- /dev/null +++ b/projects/library management/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/projects/library management/.project b/projects/library management/.project new file mode 100644 index 0000000..3d98d10 --- /dev/null +++ b/projects/library management/.project @@ -0,0 +1,17 @@ + + + library management + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/projects/library management/.settings/org.eclipse.jdt.core.prefs b/projects/library management/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3a21537 --- /dev/null +++ b/projects/library management/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/projects/library management/bin/AddNewBook$1.class b/projects/library management/bin/AddNewBook$1.class new file mode 100644 index 0000000..3e5c3bd Binary files /dev/null and b/projects/library management/bin/AddNewBook$1.class differ diff --git a/projects/library management/bin/AddNewBook$2.class b/projects/library management/bin/AddNewBook$2.class new file mode 100644 index 0000000..0ed7f03 Binary files /dev/null and b/projects/library management/bin/AddNewBook$2.class differ diff --git a/projects/library management/bin/AddNewBook$3.class b/projects/library management/bin/AddNewBook$3.class new file mode 100644 index 0000000..1e3f041 Binary files /dev/null and b/projects/library management/bin/AddNewBook$3.class differ diff --git a/projects/library management/bin/AddNewBook$4.class b/projects/library management/bin/AddNewBook$4.class new file mode 100644 index 0000000..dcc96d7 Binary files /dev/null and b/projects/library management/bin/AddNewBook$4.class differ diff --git a/projects/library management/bin/AddNewBook$5.class b/projects/library management/bin/AddNewBook$5.class new file mode 100644 index 0000000..ff367a8 Binary files /dev/null and b/projects/library management/bin/AddNewBook$5.class differ diff --git a/projects/library management/bin/AddNewBook$6.class b/projects/library management/bin/AddNewBook$6.class new file mode 100644 index 0000000..7b31666 Binary files /dev/null and b/projects/library management/bin/AddNewBook$6.class differ diff --git a/projects/library management/bin/AddNewBook$7.class b/projects/library management/bin/AddNewBook$7.class new file mode 100644 index 0000000..30f7b9f Binary files /dev/null and b/projects/library management/bin/AddNewBook$7.class differ diff --git a/projects/library management/bin/AddNewBook.class b/projects/library management/bin/AddNewBook.class new file mode 100644 index 0000000..189fe6e Binary files /dev/null and b/projects/library management/bin/AddNewBook.class differ diff --git a/projects/library management/bin/AdminSection$1.class b/projects/library management/bin/AdminSection$1.class new file mode 100644 index 0000000..7cae6d7 Binary files /dev/null and b/projects/library management/bin/AdminSection$1.class differ diff --git a/projects/library management/bin/AdminSection$2.class b/projects/library management/bin/AdminSection$2.class new file mode 100644 index 0000000..c392f0e Binary files /dev/null and b/projects/library management/bin/AdminSection$2.class differ diff --git a/projects/library management/bin/AdminSection$3.class b/projects/library management/bin/AdminSection$3.class new file mode 100644 index 0000000..8094cfa Binary files /dev/null and b/projects/library management/bin/AdminSection$3.class differ diff --git a/projects/library management/bin/AdminSection$4.class b/projects/library management/bin/AdminSection$4.class new file mode 100644 index 0000000..f932c20 Binary files /dev/null and b/projects/library management/bin/AdminSection$4.class differ diff --git a/projects/library management/bin/AdminSection.class b/projects/library management/bin/AdminSection.class new file mode 100644 index 0000000..0a2e869 Binary files /dev/null and b/projects/library management/bin/AdminSection.class differ diff --git a/projects/library management/bin/DBInfo.class b/projects/library management/bin/DBInfo.class new file mode 100644 index 0000000..a59b88e Binary files /dev/null and b/projects/library management/bin/DBInfo.class differ diff --git a/projects/library management/bin/HomePage_Login$1.class b/projects/library management/bin/HomePage_Login$1.class new file mode 100644 index 0000000..ffcc4f2 Binary files /dev/null and b/projects/library management/bin/HomePage_Login$1.class differ diff --git a/projects/library management/bin/HomePage_Login$2.class b/projects/library management/bin/HomePage_Login$2.class new file mode 100644 index 0000000..c387cee Binary files /dev/null and b/projects/library management/bin/HomePage_Login$2.class differ diff --git a/projects/library management/bin/HomePage_Login.class b/projects/library management/bin/HomePage_Login.class new file mode 100644 index 0000000..1091410 Binary files /dev/null and b/projects/library management/bin/HomePage_Login.class differ diff --git a/projects/library management/bin/SearchBy$1.class b/projects/library management/bin/SearchBy$1.class new file mode 100644 index 0000000..13575f1 Binary files /dev/null and b/projects/library management/bin/SearchBy$1.class differ diff --git a/projects/library management/bin/SearchBy$2.class b/projects/library management/bin/SearchBy$2.class new file mode 100644 index 0000000..2f9ed17 Binary files /dev/null and b/projects/library management/bin/SearchBy$2.class differ diff --git a/projects/library management/bin/SearchBy.class b/projects/library management/bin/SearchBy.class new file mode 100644 index 0000000..827d0ee Binary files /dev/null and b/projects/library management/bin/SearchBy.class differ diff --git a/projects/library management/bin/SearchUpdateDelete$1.class b/projects/library management/bin/SearchUpdateDelete$1.class new file mode 100644 index 0000000..7489c0a Binary files /dev/null and b/projects/library management/bin/SearchUpdateDelete$1.class differ diff --git a/projects/library management/bin/SearchUpdateDelete$2.class b/projects/library management/bin/SearchUpdateDelete$2.class new file mode 100644 index 0000000..59a45ed Binary files /dev/null and b/projects/library management/bin/SearchUpdateDelete$2.class differ diff --git a/projects/library management/bin/SearchUpdateDelete$3.class b/projects/library management/bin/SearchUpdateDelete$3.class new file mode 100644 index 0000000..e33b9c4 Binary files /dev/null and b/projects/library management/bin/SearchUpdateDelete$3.class differ diff --git a/projects/library management/bin/SearchUpdateDelete$4.class b/projects/library management/bin/SearchUpdateDelete$4.class new file mode 100644 index 0000000..492dcdc Binary files /dev/null and b/projects/library management/bin/SearchUpdateDelete$4.class differ diff --git a/projects/library management/bin/SearchUpdateDelete$5.class b/projects/library management/bin/SearchUpdateDelete$5.class new file mode 100644 index 0000000..950ea1d Binary files /dev/null and b/projects/library management/bin/SearchUpdateDelete$5.class differ diff --git a/projects/library management/bin/SearchUpdateDelete$6.class b/projects/library management/bin/SearchUpdateDelete$6.class new file mode 100644 index 0000000..9176d24 Binary files /dev/null and b/projects/library management/bin/SearchUpdateDelete$6.class differ diff --git a/projects/library management/bin/SearchUpdateDelete.class b/projects/library management/bin/SearchUpdateDelete.class new file mode 100644 index 0000000..20676a4 Binary files /dev/null and b/projects/library management/bin/SearchUpdateDelete.class differ diff --git a/projects/library management/bin/SearchValuesDialogBox$1.class b/projects/library management/bin/SearchValuesDialogBox$1.class new file mode 100644 index 0000000..b349163 Binary files /dev/null and b/projects/library management/bin/SearchValuesDialogBox$1.class differ diff --git a/projects/library management/bin/SearchValuesDialogBox.class b/projects/library management/bin/SearchValuesDialogBox.class new file mode 100644 index 0000000..0452138 Binary files /dev/null and b/projects/library management/bin/SearchValuesDialogBox.class differ diff --git a/projects/library management/bin/StudentRegistration$1.class b/projects/library management/bin/StudentRegistration$1.class new file mode 100644 index 0000000..11db9c4 Binary files /dev/null and b/projects/library management/bin/StudentRegistration$1.class differ diff --git a/projects/library management/bin/StudentRegistration$2.class b/projects/library management/bin/StudentRegistration$2.class new file mode 100644 index 0000000..bb5096a Binary files /dev/null and b/projects/library management/bin/StudentRegistration$2.class differ diff --git a/projects/library management/bin/StudentRegistration$3.class b/projects/library management/bin/StudentRegistration$3.class new file mode 100644 index 0000000..1c599bc Binary files /dev/null and b/projects/library management/bin/StudentRegistration$3.class differ diff --git a/projects/library management/bin/StudentRegistration.class b/projects/library management/bin/StudentRegistration.class new file mode 100644 index 0000000..38fe3e1 Binary files /dev/null and b/projects/library management/bin/StudentRegistration.class differ diff --git a/projects/library management/bin/StudentSection$1.class b/projects/library management/bin/StudentSection$1.class new file mode 100644 index 0000000..214c692 Binary files /dev/null and b/projects/library management/bin/StudentSection$1.class differ diff --git a/projects/library management/bin/StudentSection$2.class b/projects/library management/bin/StudentSection$2.class new file mode 100644 index 0000000..178e423 Binary files /dev/null and b/projects/library management/bin/StudentSection$2.class differ diff --git a/projects/library management/bin/StudentSection.class b/projects/library management/bin/StudentSection.class new file mode 100644 index 0000000..902d3ad Binary files /dev/null and b/projects/library management/bin/StudentSection.class differ diff --git a/projects/library management/libmgnt2.sql b/projects/library management/libmgnt2.sql new file mode 100644 index 0000000..eae7dc3 --- /dev/null +++ b/projects/library management/libmgnt2.sql @@ -0,0 +1,122 @@ +/* +SQLyog Enterprise - MySQL GUI v7.02 +MySQL - 5.0.67-community-nt : Database - libmanagement2 +********************************************************************* +*/ + +/*!40101 SET NAMES utf8 */; + +/*!40101 SET SQL_MODE=''*/; + +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/`libmanagement2` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `libmanagement2`; + +/*Table structure for table `author` */ + +DROP TABLE IF EXISTS `author`; + +CREATE TABLE `author` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1; + +/*Data for the table `author` */ + +insert into `author`(`id`,`name`) values (1,'khalid mugal'),(2,'KAITHY SIERRA'),(3,'BALA GURU SWAMI'),(4,'HERBERT SHCILDTH'),(5,'KORTH'),(6,'ADFADF'),(7,'DENISH'),(8,'RERTERTERTRE'); + +/*Table structure for table `book` */ + +DROP TABLE IF EXISTS `book`; + +CREATE TABLE `book` ( + `bookid` int(10) NOT NULL, + `title` varchar(100) default NULL, + `author` varchar(100) default NULL, + `publisher` varchar(100) default NULL, + `category` varchar(100) default NULL, + `subject` varchar(100) default NULL, + `isbn` int(10) default NULL, + `edition` int(10) default NULL, + `price` int(10) default NULL, + `quantity` int(10) default NULL, + PRIMARY KEY (`bookid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Data for the table `book` */ + +/*Table structure for table `category` */ + +DROP TABLE IF EXISTS `category`; + +CREATE TABLE `category` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; + +/*Data for the table `category` */ + +insert into `category`(`id`,`name`) values (1,'PROGRAMMING LANGUAGE'); + +/*Table structure for table `login` */ + +DROP TABLE IF EXISTS `login`; + +CREATE TABLE `login` ( + `username` varchar(20) default NULL, + `password` varchar(30) default NULL, + `usertype` varchar(10) default NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Data for the table `login` */ + +/*Table structure for table `publisher` */ + +DROP TABLE IF EXISTS `publisher`; + +CREATE TABLE `publisher` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; + +/*Data for the table `publisher` */ + +insert into `publisher`(`id`,`name`) values (1,'TMH'),(2,'VUE'); + +/*Table structure for table `registration` */ + +DROP TABLE IF EXISTS `registration`; + +CREATE TABLE `registration` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + `mobile` varchar(15) default NULL, + `email` varchar(200) default NULL, + `username` varchar(20) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Data for the table `registration` */ + +/*Table structure for table `subject` */ + +DROP TABLE IF EXISTS `subject`; + +CREATE TABLE `subject` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; + +/*Data for the table `subject` */ + +insert into `subject`(`id`,`name`) values (1,'JAVA'),(2,'C'); + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; diff --git a/projects/library management/src/AddNewBook.java b/projects/library management/src/AddNewBook.java new file mode 100644 index 0000000..c94de38 --- /dev/null +++ b/projects/library management/src/AddNewBook.java @@ -0,0 +1,407 @@ +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.JComboBox; +import javax.swing.JButton; +import javax.swing.JMenuBar; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; + +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.awt.event.ActionEvent; + +public class AddNewBook extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JTextField textField_1; + private JTextField textField_2; + private JTextField textField_3; + private JTextField textField_4; + private JTextField textField_5; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + AddNewBook frame = new AddNewBook(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + public String getBookId() + { + String id=""; + for(int i=1;i<=6;i++) + { + id+=(int)(Math.random()*9)+1; + //System.out.println(id); + } + return id; + } + + /** + * Create the frame. + */ + public AddNewBook() + { + setTitle("Add New Book"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 615, 898); + setLocationRelativeTo(this); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnFile = new JMenu("File"); + menuBar.add(mnFile); + + JMenu mnAddNew = new JMenu("Add New"); + menuBar.add(mnAddNew); + + JMenuItem mntmAuthor = new JMenuItem("Author"); + mntmAuthor.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent arg0) + { + String s1=arg0.getActionCommand(); + //getActionCommand() will retrieve the label of menuitem + + String str=JOptionPane.showInputDialog("Enter "+s1+" Name"); + //System.out.println(s1+"::"+str); + + int i=DBInfo.insertValue(s1, str); + if(i==1) + JOptionPane.showMessageDialog(AddNewBook.this, s1+" added!!"); + else + JOptionPane.showMessageDialog(AddNewBook.this,s1+" Not Added!!"); + + dispose(); + new AddNewBook().setVisible(true); + + } + }); + mnAddNew.add(mntmAuthor); + + JMenuItem mntmPublisher = new JMenuItem("Publisher"); + mntmPublisher.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + String s1=e.getActionCommand(); + //getActionCommand() will retrieve the label of menuitem + + String str=JOptionPane.showInputDialog("Enter "+s1+" Name"); + int i=DBInfo.insertValue(s1, str); + if(i==1) + JOptionPane.showMessageDialog(AddNewBook.this, s1+" added!!"); + else + JOptionPane.showMessageDialog(AddNewBook.this,s1+" Not Added!!"); + + dispose(); + new AddNewBook().setVisible(true); + } + }); + mnAddNew.add(mntmPublisher); + + JMenuItem mntmCategory = new JMenuItem("Category"); + mntmCategory.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) + { + String s1=e.getActionCommand(); + //getActionCommand() will retrieve the label of menuitem + + String str=JOptionPane.showInputDialog("Enter "+s1+" Name"); + int i=DBInfo.insertValue(s1, str); + if(i==1) + JOptionPane.showMessageDialog(AddNewBook.this, s1+" added!!"); + else + JOptionPane.showMessageDialog(AddNewBook.this,s1+" Not Added!!"); + + dispose(); + new AddNewBook().setVisible(true); + } + }); + mnAddNew.add(mntmCategory); + + JMenuItem mntmSubject = new JMenuItem("Subject"); + mntmSubject.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + String s1=e.getActionCommand(); + //getActionCommand() will retrieve the label of menuitem + + String str=JOptionPane.showInputDialog("Enter "+s1+" Name"); + int i=DBInfo.insertValue(s1, str); + if(i==1) + JOptionPane.showMessageDialog(AddNewBook.this, s1+" added!!"); + else + JOptionPane.showMessageDialog(AddNewBook.this,s1+" Not Added!!"); + + dispose(); + new AddNewBook().setVisible(true); + } + }); + mnAddNew.add(mntmSubject); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblNewLabel = new JLabel("New label"); + + JLabel lblBookid = new JLabel("BookId"); + + + //System.out.println(id); + + + + textField = new JTextField(getBookId()); + textField.setEditable(false); + textField.setColumns(10); + + JLabel lblTitlename = new JLabel("Title/Name"); + + textField_1 = new JTextField(); + textField_1.setColumns(10); + + JLabel lblAuthorName = new JLabel("Author Name"); + + JComboBox comboBox = new JComboBox(DBInfo.getAuthor()); + comboBox.insertItemAt("Select", 0); + comboBox.setSelectedIndex(0); + + JLabel lblPublisher = new JLabel("Publisher"); + + JComboBox comboBox_1 = new JComboBox(DBInfo.getPublisher()); + comboBox_1.insertItemAt("Select", 0); + comboBox_1.setSelectedIndex(0); + + JLabel lblCategory = new JLabel("Category"); + + JComboBox comboBox_2 = new JComboBox(DBInfo.getCategory()); + comboBox_2.insertItemAt("Select", 0); + comboBox_2.setSelectedIndex(0); + + JLabel lblSubject = new JLabel("Subject"); + + JComboBox comboBox_3 = new JComboBox(DBInfo.getSubject()); + comboBox_3.insertItemAt("Select", 0); + comboBox_3.setSelectedIndex(0); + + JLabel lblIsbnNo = new JLabel("ISBN No"); + + textField_2 = new JTextField(); + textField_2.setColumns(10); + + JLabel lblEdition = new JLabel("Edition"); + + JLabel lblPrice = new JLabel("Price"); + + JLabel lblQuantity = new JLabel("Quantity"); + + textField_3 = new JTextField(); + textField_3.setColumns(10); + + textField_4 = new JTextField(); + textField_4.setColumns(10); + + textField_5 = new JTextField(); + textField_5.setColumns(10); + + JButton btnSave = new JButton("SAVE"); + btnSave.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent arg0) + { + String id=textField.getText(); + String title=textField_1.getText(); + String author=(String)comboBox.getSelectedItem(); + String pub=(String)comboBox_1.getSelectedItem(); + String cat=(String)comboBox_2.getSelectedItem(); + String sub=(String)comboBox_3.getSelectedItem(); + String isbn=textField_2.getText(); + String edition=textField_3.getText(); + String price=textField_4.getText(); + String quantity=textField_5.getText(); + + if(id.length()==0 || title.length()==0 || author.equalsIgnoreCase("select") || pub.equalsIgnoreCase("select") || cat.equalsIgnoreCase("select") || sub.equalsIgnoreCase("select")|| isbn.length()==0 || edition.length()==0 || price.length()==0 || quantity.length()==0) + { + JOptionPane.showMessageDialog(AddNewBook.this, "Pls fill/select all the fields", "Error", JOptionPane.ERROR_MESSAGE); + } + else + { + + + String query="insert into book values(?,?,?,?,?,?,?,?,?,?)"; + int flag=0; + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, id); + ps.setString(2, title); + ps.setString(3, author); + ps.setString(4, pub); + ps.setString(5, cat); + ps.setString(6, sub); + ps.setString(7, isbn); + ps.setString(8, edition); + ps.setString(9, price); + ps.setString(10,quantity); + flag=ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==1) + { + JOptionPane.showMessageDialog(AddNewBook.this, "Book Added", "Added", JOptionPane.INFORMATION_MESSAGE); + textField.setText(getBookId()); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + textField_5.setText(null); + comboBox.setSelectedIndex(0); + comboBox_1.setSelectedIndex(0); + comboBox_2.setSelectedIndex(0); + comboBox_3.setSelectedIndex(0); + + + } + else + { + JOptionPane.showMessageDialog(AddNewBook.this, "Book Not Added", "Error", JOptionPane.ERROR_MESSAGE); + } + } + } + }); + + JButton btnReset = new JButton("RESET"); + btnReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + textField.setText(getBookId()); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + textField_5.setText(null); + comboBox.setSelectedIndex(0); + comboBox_1.setSelectedIndex(0); + comboBox_2.setSelectedIndex(0); + comboBox_3.setSelectedIndex(0); + } + }); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(90) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblBookid) + .addComponent(lblTitlename) + .addComponent(lblAuthorName) + .addComponent(lblPublisher) + .addComponent(lblSubject) + .addComponent(btnReset) + .addComponent(lblQuantity) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addComponent(lblCategory) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblEdition) + .addComponent(lblIsbnNo) + .addComponent(lblPrice)))) + .addPreferredGap(ComponentPlacement.RELATED, 87, Short.MAX_VALUE) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false) + .addComponent(textField_2, GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE) + .addComponent(comboBox_3, 0, 257, Short.MAX_VALUE) + .addComponent(comboBox_2, 0, 257, Short.MAX_VALUE) + .addComponent(comboBox_1, 0, 257, Short.MAX_VALUE) + .addComponent(comboBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(textField_1) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE) + .addComponent(textField_3, GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE) + .addComponent(textField_4, GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE) + .addComponent(textField_5, GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE) + .addComponent(btnSave, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(54)) + .addGroup(Alignment.LEADING, gl_contentPane.createSequentialGroup() + .addGap(224) + .addComponent(lblNewLabel) + .addContainerGap(290, Short.MAX_VALUE)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(56) + .addComponent(lblNewLabel) + .addGap(39) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblBookid) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblTitlename) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblAuthorName) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblPublisher) + .addComponent(comboBox_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblCategory) + .addComponent(comboBox_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblSubject) + .addComponent(comboBox_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblIsbnNo)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblEdition)) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(18) + .addComponent(textField_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(textField_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPane.createSequentialGroup() + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(lblPrice) + .addGap(21) + .addComponent(lblQuantity))) + .addGap(37) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnSave) + .addComponent(btnReset)) + .addContainerGap(238, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/library management/src/AdminSection.java b/projects/library management/src/AdminSection.java new file mode 100644 index 0000000..17baec3 --- /dev/null +++ b/projects/library management/src/AdminSection.java @@ -0,0 +1,101 @@ +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import java.awt.GridLayout; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class AdminSection extends JFrame { + + private JPanel contentPane; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + AdminSection frame = new AdminSection(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public AdminSection() { + setTitle("Admin section"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 957, 440); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + contentPane.setLayout(new GridLayout(3, 4, 0, 0)); + + JButton btnAddNewBook = new JButton("Add New Book"); + btnAddNewBook.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + AddNewBook obj=new AddNewBook(); + obj.setVisible(true); + } + }); + contentPane.add(btnAddNewBook); + + JButton btnSearchBookbyId = new JButton("Search/Delete/Update Book by ID"); + btnSearchBookbyId.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + SearchUpdateDelete obj=new SearchUpdateDelete(); + obj.setVisible(true); + } + }); + contentPane.add(btnSearchBookbyId); + + JButton btnViewupdatedeleteBook = new JButton("View/Search Book"); + btnViewupdatedeleteBook.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + new SearchBy().setVisible(true); + } + }); + contentPane.add(btnViewupdatedeleteBook); + + JButton btnIssuesubmitBook = new JButton("Issue/Submit book"); + contentPane.add(btnIssuesubmitBook); + + JButton btnAddNewUser = new JButton("Add New User"); + contentPane.add(btnAddNewUser); + + JButton btnSearchupdatedeleteUser = new JButton("Search/Update/Delete user"); + contentPane.add(btnSearchupdatedeleteUser); + + JButton btnAddNotice = new JButton("Add Notice"); + contentPane.add(btnAddNotice); + + JButton btnSearchupdatedeleteNotice = new JButton("Search/Update/Delete notice"); + contentPane.add(btnSearchupdatedeleteNotice); + + JButton btnChangeSelfPassword = new JButton("Change Self Password"); + contentPane.add(btnChangeSelfPassword); + + JButton btnNewButton = new JButton("New button"); + contentPane.add(btnNewButton); + + JButton btnNewButton_1 = new JButton("New button"); + contentPane.add(btnNewButton_1); + + JButton btnNewButton_2 = new JButton("New button"); + contentPane.add(btnNewButton_2); + } +} diff --git a/projects/library management/src/DBInfo.java b/projects/library management/src/DBInfo.java new file mode 100644 index 0000000..e54386c --- /dev/null +++ b/projects/library management/src/DBInfo.java @@ -0,0 +1,226 @@ + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.util.Vector; + +public class DBInfo +{ + static Connection con; + static Vector header; + static Vector> outer; + static + { + try + { + Class.forName("com.mysql.jdbc.Driver"); + con=DriverManager.getConnection("jdbc:mysql://localhost:3306/libmanagement2","root","root"); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + public static int insertValue(String s1,String str) + { + int i=0; + String query="insert into "+s1+" values(?,?)"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setInt(1, 0); + ps.setString(2, str.toUpperCase()); + i=ps.executeUpdate(); + } + catch(Exception e) + { + e.printStackTrace(); + } + return i; + + } + + public static Vector getAuthor() + { + Vector v=new Vector<>(); + String query="select name from author order by name"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + v.add(res.getString(1)); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + return v; + } + public static Vector getPublisher() + { + Vector v=new Vector<>(); + String query="select name from publisher order by name"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + v.add(res.getString(1)); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + return v; + } + + public static Vector getCategory() + { + Vector v=new Vector<>(); + String query="select name from category order by name"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + v.add(res.getString(1)); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + return v; + } + + public static Vector getSubject() + { + Vector v=new Vector<>(); + String query="select name from subject order by name"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + v.add(res.getString(1)); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + return v; + } + + public static void getAllBooks() + { + header=new Vector<>();//it will store the cols name of book table + outer=new Vector<>(); + + String query="select * from book"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ResultSet res=ps.executeQuery(); + + //getting MetaData + ResultSetMetaData rsmd=res.getMetaData(); + int colcount=rsmd.getColumnCount(); + for(int i=1;i<=colcount;i++) + { + String colName=rsmd.getColumnName(i); + header.add(colName); + } + + //getting table records + while(res.next()) + { + Vector records=new Vector<>(); + for(int i=1;i<=colcount;i++) + { + String value=res.getString(i); + records.add(value); + } + outer.add(records); + } + + + + + + + + + + } + catch(Exception e) + { + e.printStackTrace(); + } + } + + + + + public static void getValues(String value,String name) + { + header=new Vector<>();//it will store the cols name of book table + outer=new Vector<>(); + + String query="select * from book where "+value+"=?"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, name); + ResultSet res=ps.executeQuery(); + + //getting MetaData + ResultSetMetaData rsmd=res.getMetaData(); + int colcount=rsmd.getColumnCount(); + for(int i=1;i<=colcount;i++) + { + String colName=rsmd.getColumnName(i); + header.add(colName); + } + + //getting table records + while(res.next()) + { + Vector records=new Vector<>(); + for(int i=1;i<=colcount;i++) + { + String v=res.getString(i); + records.add(v); + } + outer.add(records); + } + + + + + + + + + + } + catch(Exception e) + { + e.printStackTrace(); + } + } + + + + + +} diff --git a/projects/library management/src/HomePage_Login.java b/projects/library management/src/HomePage_Login.java new file mode 100644 index 0000000..c0e9992 --- /dev/null +++ b/projects/library management/src/HomePage_Login.java @@ -0,0 +1,169 @@ +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.JPasswordField; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.awt.event.ActionEvent; + +public class HomePage_Login extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JPasswordField passwordField; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + HomePage_Login frame = new HomePage_Login(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public HomePage_Login() { + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 425, 263); + + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblNewLabel = new JLabel("New label"); + + JLabel lblEnterUsername = new JLabel("Enter Username"); + + textField = new JTextField(); + textField.setColumns(10); + + JLabel lblEnterPassword = new JLabel("Enter Password"); + + passwordField = new JPasswordField(); + + JButton btnLoginNow = new JButton("Login Now"); + btnLoginNow.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + String usertype=""; + String s1=textField.getText(); + char ch[]=passwordField.getPassword(); + String s2=String.copyValueOf(ch); //password + String query="select * from login where username=? and password=?"; + Connection con=DBInfo.con; + int i=0; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, s1);ps.setString(2, s2); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + + i=1; + usertype=res.getString(3); + break; + } + } + catch(Exception e) + { + e.printStackTrace(); + } + if(i==1 && usertype.equalsIgnoreCase("admin")) + { + AdminSection ad=new AdminSection(); + ad.setVisible(true); + dispose(); + } + if(i==1 && usertype.equalsIgnoreCase("student")) + { + StudentSection ss=new StudentSection(); + ss.setVisible(true); + } + if(i==1 && usertype.equalsIgnoreCase("staff")) + { + + } + if(i==0) + { + JOptionPane.showMessageDialog(getParent(),"Wrong username or password!","Error",JOptionPane.ERROR_MESSAGE); + } + + } + }); + + JButton btnReset = new JButton("Reset"); + + JButton btnNewUsersignUp = new JButton("New User,Sign Up"); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(182) + .addComponent(lblNewLabel)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(73) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblEnterPassword) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(passwordField)) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblEnterUsername) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE)) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(btnLoginNow) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(btnReset, GroupLayout.PREFERRED_SIZE, 84, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(btnNewUsersignUp))))) + .addContainerGap(33, GroupLayout.PREFERRED_SIZE)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addContainerGap() + .addComponent(lblNewLabel) + .addGap(38) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnterUsername) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnterPassword) + .addComponent(passwordField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnLoginNow) + .addComponent(btnReset) + .addComponent(btnNewUsersignUp)) + .addContainerGap(52, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/library management/src/SearchBy.java b/projects/library management/src/SearchBy.java new file mode 100644 index 0000000..fd09ef6 --- /dev/null +++ b/projects/library management/src/SearchBy.java @@ -0,0 +1,131 @@ +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JComboBox; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class SearchBy extends JFrame { + + private JPanel contentPane; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + SearchBy frame = new SearchBy(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public SearchBy() + { + setTitle("SearchBy"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 560, 376); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblNewLabel = new JLabel("New label"); + + JLabel lblSearchBy = new JLabel("Search By"); + + String values[]={"Select","Author","Publisher","Category","Subject","All"}; + JComboBox comboBox = new JComboBox(values); + + JButton btnNewButton = new JButton("Search"); + btnNewButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + String value=(String)comboBox.getSelectedItem(); + if(value.equalsIgnoreCase("select")) + { +JOptionPane.showMessageDialog(getParent(), "Select a value", "Error", JOptionPane.ERROR_MESSAGE); + } + if(value.equalsIgnoreCase("all")) + { + JFrame frm=new JFrame(); + + frm.setSize(900, 400); + frm.setLocationRelativeTo(frm); + frm.setDefaultCloseOperation(frm.DISPOSE_ON_CLOSE); + + DBInfo.getAllBooks(); + + JTable t=new JTable(DBInfo.outer, DBInfo.header); + JScrollPane pane=new JScrollPane(t); + frm.add(pane); + frm.setVisible(true); + + } + else + { + //String name=JOptionPane.showInputDialog("Enter "+value+" name"); + SearchValuesDialogBox obj=new SearchValuesDialogBox(value); + obj.setVisible(true); + + + + + + + } + } + }); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(Alignment.TRAILING, gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addGroup(Alignment.LEADING, gl_contentPane.createSequentialGroup() + .addGap(314) + .addComponent(lblNewLabel)) + .addGroup(Alignment.LEADING, gl_contentPane.createSequentialGroup() + .addGap(121) + .addComponent(lblSearchBy) + .addGap(76) + .addComponent(comboBox, 0, 117, Short.MAX_VALUE))) + .addGap(369)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(190) + .addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 159, GroupLayout.PREFERRED_SIZE) + .addContainerGap(250, Short.MAX_VALUE)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addContainerGap() + .addComponent(lblNewLabel) + .addGap(75) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblSearchBy) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(39) + .addComponent(btnNewButton) + .addContainerGap(105, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/library management/src/SearchUpdateDelete.java b/projects/library management/src/SearchUpdateDelete.java new file mode 100644 index 0000000..d135f5e --- /dev/null +++ b/projects/library management/src/SearchUpdateDelete.java @@ -0,0 +1,474 @@ +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.JComboBox; +import javax.swing.JButton; +import javax.swing.JMenuBar; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; + +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.awt.event.ActionEvent; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; + +public class SearchUpdateDelete extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JTextField textField_1; + private JTextField textField_2; + private JTextField textField_3; + private JTextField textField_4; + private JTextField textField_5; + private JComboBox comboBox,comboBox_1,comboBox_2,comboBox_3; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + SearchUpdateDelete frame = new SearchUpdateDelete(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + public void reset() + { + textField.setText(null); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + textField_5.setText(null); + comboBox.setSelectedIndex(0); + comboBox_1.setSelectedIndex(0); + comboBox_2.setSelectedIndex(0); + comboBox_3.setSelectedIndex(0); + } + /** + * Create the frame. + */ + public SearchUpdateDelete() + { + setTitle("Search/Update/Delete Book"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 615, 898); + setLocationRelativeTo(this); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblNewLabel = new JLabel("New label"); + + JLabel lblBookid = new JLabel("BookId"); + + String id=""; + for(int i=1;i<=6;i++) + { + id+=(int)(Math.random()*9)+1; + //System.out.println(id); + } + //System.out.println(id); + comboBox = new JComboBox(DBInfo.getAuthor()); + comboBox.insertItemAt("Select", 0); + comboBox.setSelectedIndex(0); + + JLabel lblPublisher = new JLabel("Publisher"); + + comboBox_1 = new JComboBox(DBInfo.getPublisher()); + comboBox_1.insertItemAt("Select", 0); + comboBox_1.setSelectedIndex(0); + + JLabel lblCategory = new JLabel("Category"); + + comboBox_2 = new JComboBox(DBInfo.getCategory()); + comboBox_2.insertItemAt("Select", 0); + comboBox_2.setSelectedIndex(0); + + JLabel lblSubject = new JLabel("Subject"); + + comboBox_3 = new JComboBox(DBInfo.getSubject()); + comboBox_3.insertItemAt("Select", 0); + comboBox_3.setSelectedIndex(0); + + + textField = new JTextField(); + textField.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent arg0) + { + String id=textField.getText(); + if(id.length()!=0) + { + String query="select * from book where bookid=?"; + int flag=0; + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ps.setString(1, id); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + flag=1; + String title=res.getString(2); + String author=res.getString(3); + String pub=res.getString(4); + String cat=res.getString(5); + String sub=res.getString(6); + String isbn=res.getString(7); + String edition=res.getString(8); + String price=res.getString(9); + String quantity=res.getString(10); + textField_1.setText(title); + comboBox.setSelectedItem(author); + comboBox_1.setSelectedItem(pub); + comboBox_2.setSelectedItem(cat); + comboBox_3.setSelectedItem(sub); + textField_2.setText(isbn); + textField_3.setText(edition); + textField_4.setText(price); + textField_5.setText(quantity); + break; + + + } + + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==0) + { + JOptionPane.showMessageDialog(getParent(), "No Book Found!", "Error", JOptionPane.ERROR_MESSAGE); + } + } + if(id.length()==0) + { + + } + + } + }); + + textField.setColumns(10); + + JLabel lblTitlename = new JLabel("Title/Name"); + + textField_1 = new JTextField(); + textField_1.setColumns(10); + + JLabel lblAuthorName = new JLabel("Author Name"); + + + + JLabel lblIsbnNo = new JLabel("ISBN No"); + + textField_2 = new JTextField(); + textField_2.setColumns(10); + + JLabel lblEdition = new JLabel("Edition"); + + JLabel lblPrice = new JLabel("Price"); + + JLabel lblQuantity = new JLabel("Quantity"); + + textField_3 = new JTextField(); + textField_3.setColumns(10); + + textField_4 = new JTextField(); + textField_4.setColumns(10); + + textField_5 = new JTextField(); + textField_5.setColumns(10); + + JButton btnSave = new JButton("SEARCH"); + btnSave.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent arg0) + { + String id=textField.getText(); + String query="select * from book where bookid=?"; + int flag=0; + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ps.setString(1, id); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + flag=1; + String title=res.getString(2); + String author=res.getString(3); + String pub=res.getString(4); + String cat=res.getString(5); + String sub=res.getString(6); + String isbn=res.getString(7); + String edition=res.getString(8); + String price=res.getString(9); + String quantity=res.getString(10); + textField_1.setText(title); + comboBox.setSelectedItem(author); + comboBox_1.setSelectedItem(pub); + comboBox_2.setSelectedItem(cat); + comboBox_3.setSelectedItem(sub); + textField_2.setText(isbn); + textField_3.setText(edition); + textField_4.setText(price); + textField_5.setText(quantity); + break; + + + } + + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==0) + { + JOptionPane.showMessageDialog(getParent(), "No Book Found!", "Error", JOptionPane.ERROR_MESSAGE); + } + + } + }); + + JButton btnReset = new JButton("RESET"); + btnReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + reset(); + } + }); + + JButton button = new JButton("UPDATE"); + button.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent arg0) + { + String id=textField.getText(); + String title=textField_1.getText(); + String author=(String)comboBox.getSelectedItem(); + String pub=(String)comboBox_1.getSelectedItem(); + String cat=(String)comboBox_2.getSelectedItem(); + String sub=(String)comboBox_3.getSelectedItem(); + String isbn=textField_2.getText(); + String edition=textField_3.getText(); + String price=textField_4.getText(); + String quantity=textField_5.getText(); + + if(id.length()==0 || title.length()==0 || author.equalsIgnoreCase("select") || pub.equalsIgnoreCase("select") || cat.equalsIgnoreCase("select") || sub.equalsIgnoreCase("select")|| isbn.length()==0 || edition.length()==0 || price.length()==0 || quantity.length()==0) + { + JOptionPane.showMessageDialog(SearchUpdateDelete.this, "Pls fill/select all the fields", "Error", JOptionPane.ERROR_MESSAGE); + } + else + { + + +String query="update book set title=?,author=?,publisher=?,category=?,subject=?,isbn=?,edition=?,price=?,quantity=? where bookid=?"; + int flag=0; + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + + ps.setString(1, title); + ps.setString(2, author); + ps.setString(3, pub); + ps.setString(4, cat); + ps.setString(5, sub); + ps.setString(6, isbn); + ps.setString(7, edition); + ps.setString(8, price); + ps.setString(9,quantity); + ps.setString(10, id); + flag=ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==1) + { + JOptionPane.showMessageDialog(SearchUpdateDelete.this, "Book updated!!", "Success", JOptionPane.INFORMATION_MESSAGE); + textField.setText(null); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + textField_5.setText(null); + comboBox.setSelectedIndex(0); + comboBox_1.setSelectedIndex(0); + comboBox_2.setSelectedIndex(0); + comboBox_3.setSelectedIndex(0); + + + } + else + { + JOptionPane.showMessageDialog(SearchUpdateDelete.this, "Book Not Updated", "Error", JOptionPane.ERROR_MESSAGE); + } + } + } + + + + }); + + JButton button_1 = new JButton("DELETE"); + button_1.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + String id=textField.getText(); + String query="delete from book where bookid=?"; + int flag=0; + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ps.setString(1, id);; + flag=ps.executeUpdate(); + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag!=0) + { + JOptionPane.showMessageDialog(getParent(), "REecord Deleted!!"); + reset(); + } + if(flag==0) + { + JOptionPane.showMessageDialog(getParent(), "REecord Not Deleted!!"); + } + } + }); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(90) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblBookid) + .addComponent(lblTitlename) + .addComponent(lblAuthorName) + .addComponent(lblPublisher) + .addComponent(lblSubject) + .addComponent(lblQuantity) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addComponent(lblCategory) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblEdition) + .addComponent(lblIsbnNo) + .addComponent(lblPrice)))) + .addPreferredGap(ComponentPlacement.RELATED, 87, Short.MAX_VALUE) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false) + .addComponent(textField_2, GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE) + .addComponent(comboBox_3, 0, 257, Short.MAX_VALUE) + .addComponent(comboBox_2, 0, 257, Short.MAX_VALUE) + .addComponent(comboBox_1, 0, 257, Short.MAX_VALUE) + .addComponent(comboBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(textField_1) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE) + .addComponent(textField_3, GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE) + .addComponent(textField_4, GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE) + .addComponent(textField_5, GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE))) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(btnReset) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(btnSave, GroupLayout.PREFERRED_SIZE, 106, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(button, GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(button_1, GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE))) + .addGap(54)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(224) + .addComponent(lblNewLabel) + .addContainerGap(290, Short.MAX_VALUE)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(56) + .addComponent(lblNewLabel) + .addGap(39) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblBookid) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblTitlename) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblAuthorName) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblPublisher) + .addComponent(comboBox_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblCategory) + .addComponent(comboBox_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblSubject) + .addComponent(comboBox_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblIsbnNo)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblEdition)) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(18) + .addComponent(textField_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(textField_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPane.createSequentialGroup() + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(lblPrice) + .addGap(21) + .addComponent(lblQuantity))) + .addGap(37) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnReset) + .addComponent(btnSave) + .addComponent(button) + .addComponent(button_1)) + .addContainerGap(207, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/library management/src/SearchValuesDialogBox.java b/projects/library management/src/SearchValuesDialogBox.java new file mode 100644 index 0000000..72dd89b --- /dev/null +++ b/projects/library management/src/SearchValuesDialogBox.java @@ -0,0 +1,114 @@ +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JComboBox; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class SearchValuesDialogBox extends JDialog { + + private final JPanel contentPanel = new JPanel(); + Vector vector; + public SearchValuesDialogBox(String value) + { + setBounds(100, 100, 450, 241); + setLocationRelativeTo(this); + getContentPane().setLayout(new BorderLayout()); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel, BorderLayout.CENTER); + JLabel lblSelect = new JLabel("Select "); + if(value.equalsIgnoreCase("author")) + { + vector=DBInfo.getAuthor(); + } + else if(value.equalsIgnoreCase("publisher")) + { + vector=DBInfo.getPublisher(); + } + else if(value.equalsIgnoreCase("category")) + { + vector=DBInfo.getCategory(); + } + else if(value.equalsIgnoreCase("subject")) + { + vector=DBInfo.getSubject(); + } + else + { + + } + + JComboBox comboBox = new JComboBox(vector); + GroupLayout gl_contentPanel = new GroupLayout(contentPanel); + gl_contentPanel.setHorizontalGroup( + gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(48) + .addComponent(lblSelect) + .addGap(43) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 187, GroupLayout.PREFERRED_SIZE) + .addContainerGap(94, Short.MAX_VALUE)) + ); + gl_contentPanel.setVerticalGroup( + gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(53) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.BASELINE) + .addComponent(lblSelect) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addContainerGap(122, Short.MAX_VALUE)) + ); + contentPanel.setLayout(gl_contentPanel); + { + JPanel buttonPane = new JPanel(); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane, BorderLayout.SOUTH); + { + JButton okButton = new JButton("OK"); + okButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent arg0) + { + String s1=(String)comboBox.getSelectedItem(); + //System.out.println(s1+":::"+value); + JFrame frm=new JFrame(); + + frm.setSize(900, 400); + frm.setLocationRelativeTo(frm); + frm.setDefaultCloseOperation(frm.DISPOSE_ON_CLOSE); + + DBInfo.getValues(value,s1); + + JTable t=new JTable(DBInfo.outer, DBInfo.header); + JScrollPane pane=new JScrollPane(t); + frm.add(pane); + frm.setVisible(true); + dispose(); + + + } + }); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + { + JButton cancelButton = new JButton("Cancel"); + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + } + } + } + +} diff --git a/projects/library management/src/StudentRegistration.java b/projects/library management/src/StudentRegistration.java new file mode 100644 index 0000000..05dbbf2 --- /dev/null +++ b/projects/library management/src/StudentRegistration.java @@ -0,0 +1,266 @@ +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.JPasswordField; +import javax.swing.JButton; +import javax.swing.LayoutStyle.ComponentPlacement; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.awt.event.ActionEvent; + +public class StudentRegistration extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JTextField textField_1; + private JTextField textField_2; + private JTextField textField_3; + private JPasswordField passwordField; + private JPasswordField passwordField_1; + private JTextField textField_4; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + StudentRegistration frame = new StudentRegistration(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public StudentRegistration() { + setTitle("Registration page"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 450, 461); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblNewLabel = new JLabel("New label"); + + JLabel lblName = new JLabel("Name"); + + textField = new JTextField(); + textField.setColumns(10); + + JLabel lblMobile = new JLabel("Mobile"); + + textField_1 = new JTextField(); + textField_1.setColumns(10); + + JLabel lblEmail = new JLabel("Email"); + + textField_2 = new JTextField(); + textField_2.setColumns(10); + + JLabel lblUsername = new JLabel("Username"); + + textField_3 = new JTextField(); + textField_3.setColumns(10); + + JLabel lblPassword = new JLabel("Password"); + + passwordField = new JPasswordField(); + + JLabel lblRepassword = new JLabel("RePassword"); + + JLabel lblUsertype = new JLabel("UserType"); + + passwordField_1 = new JPasswordField(); + + textField_4 = new JTextField("Student"); + textField_4.setEditable(false); + textField_4.setColumns(10); + + JButton btnSave = new JButton("SAVE"); + btnSave.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + int flag=0,flag1=0; + String name=textField.getText(); + String mobile=textField_1.getText(); + String email=textField_2.getText(); + String username=textField_3.getText(); + String pass=String.copyValueOf(passwordField.getPassword()); + String repass=String.copyValueOf(passwordField_1.getPassword()); + String usertype=textField_4.getText(); + + if(name.length()==0 || mobile.length()==0 || email.length()==0 || username.length()==0 || pass.length()==0 ) + { +JOptionPane.showMessageDialog(getParent(), "Enter all values", "Error", JOptionPane.ERROR_MESSAGE);; + } + else + { + if(!pass.equals(repass)) + { + JOptionPane.showMessageDialog(getParent(), "Password and repassword are different!!", "Error", JOptionPane.ERROR_MESSAGE);; + } + else + { + String query="insert into registration values(?,?,?,?,?)"; + String query1="insert into login values(?,?,?)"; + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setInt(1, 0); + ps.setString(2, name); + ps.setString(3, mobile); + ps.setString(4, email); + ps.setString(5, username); + flag=ps.executeUpdate(); + } + catch(Exception e) + { + e.printStackTrace(); + } + try + { + + + PreparedStatement ps1=con.prepareStatement(query1); + ps1.setString(1, username); + ps1.setString(2, pass); + ps1.setString(3, usertype); + flag1=ps1.executeUpdate(); + } + catch(Exception e) + { + e.printStackTrace(); + } + + if(flag!=0 && flag1!=0) + { + JOptionPane.showMessageDialog(getParent(), name+ " User Added!!", "registration done!", JOptionPane.INFORMATION_MESSAGE);; + textField.setText(null); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + passwordField.setText(null); + passwordField_1.setText(null); + } + else + { + JOptionPane.showMessageDialog(getParent(), "Registration failed!!", "Error", JOptionPane.ERROR_MESSAGE);; + } + } + } + + + } + }); + + JButton btnReset = new JButton("RESET"); + + JButton btnLogin = new JButton("Login"); + btnLogin.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + HomePage_Login obj=new HomePage_Login(); + obj.setVisible(true); + + } + }); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(168) + .addComponent(lblNewLabel)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(76) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblName) + .addComponent(lblMobile) + .addComponent(lblEmail) + .addComponent(lblUsername) + .addComponent(lblPassword) + .addComponent(lblRepassword) + .addComponent(lblUsertype)) + .addGap(34)) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(btnSave) + .addGap(18))) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(btnReset) + .addGap(30) + .addComponent(btnLogin)) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false) + .addComponent(textField_4) + .addComponent(passwordField_1) + .addComponent(passwordField) + .addComponent(textField_3) + .addComponent(textField_2) + .addComponent(textField_1) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE))))) + .addContainerGap(96, Short.MAX_VALUE)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addContainerGap() + .addComponent(lblNewLabel) + .addGap(27) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblName) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblMobile) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEmail) + .addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(31) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblUsername) + .addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblPassword) + .addComponent(passwordField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblRepassword) + .addComponent(passwordField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblUsertype) + .addComponent(textField_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(36) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnLogin) + .addComponent(btnReset) + .addComponent(btnSave)) + .addContainerGap(40, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } + +} diff --git a/projects/library management/src/StudentSection.java b/projects/library management/src/StudentSection.java new file mode 100644 index 0000000..9e5b6c8 --- /dev/null +++ b/projects/library management/src/StudentSection.java @@ -0,0 +1,65 @@ +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import java.awt.GridLayout; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class StudentSection extends JFrame { + + private JPanel contentPane; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + StudentSection frame = new StudentSection(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public StudentSection() { + setTitle("Student section"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 714, 200); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + contentPane.setLayout(new GridLayout(3, 4, 0, 0)); + + JButton btnViewupdatedeleteBook = new JButton("View/Search Book"); + btnViewupdatedeleteBook.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + new SearchBy().setVisible(true); + } + }); + contentPane.add(btnViewupdatedeleteBook); + + JButton btnAddNotice = new JButton("ViewNotice"); + contentPane.add(btnAddNotice); + + JButton btnSearchupdatedeleteNotice = new JButton("View Profile"); + contentPane.add(btnSearchupdatedeleteNotice); + + JButton btnChangeSelfPassword = new JButton("Change Self Password"); + contentPane.add(btnChangeSelfPassword); + } +} diff --git a/projects/library_management/.classpath b/projects/library_management/.classpath new file mode 100644 index 0000000..da70424 --- /dev/null +++ b/projects/library_management/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/projects/library_management/.project b/projects/library_management/.project new file mode 100644 index 0000000..b469074 --- /dev/null +++ b/projects/library_management/.project @@ -0,0 +1,17 @@ + + + library_management + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/projects/library_management/.settings/org.eclipse.jdt.core.prefs b/projects/library_management/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3a21537 --- /dev/null +++ b/projects/library_management/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/projects/library_management/bin/library_management/AdminSection$1.class b/projects/library_management/bin/library_management/AdminSection$1.class new file mode 100644 index 0000000..014e299 Binary files /dev/null and b/projects/library_management/bin/library_management/AdminSection$1.class differ diff --git a/projects/library_management/bin/library_management/AdminSection$10.class b/projects/library_management/bin/library_management/AdminSection$10.class new file mode 100644 index 0000000..4f43991 Binary files /dev/null and b/projects/library_management/bin/library_management/AdminSection$10.class differ diff --git a/projects/library_management/bin/library_management/AdminSection$11.class b/projects/library_management/bin/library_management/AdminSection$11.class new file mode 100644 index 0000000..2adc284 Binary files /dev/null and b/projects/library_management/bin/library_management/AdminSection$11.class differ diff --git a/projects/library_management/bin/library_management/AdminSection$12.class b/projects/library_management/bin/library_management/AdminSection$12.class new file mode 100644 index 0000000..d1d3554 Binary files /dev/null and b/projects/library_management/bin/library_management/AdminSection$12.class differ diff --git a/projects/library_management/bin/library_management/AdminSection$2.class b/projects/library_management/bin/library_management/AdminSection$2.class new file mode 100644 index 0000000..3e8af9e Binary files /dev/null and b/projects/library_management/bin/library_management/AdminSection$2.class differ diff --git a/projects/library_management/bin/library_management/AdminSection$3.class b/projects/library_management/bin/library_management/AdminSection$3.class new file mode 100644 index 0000000..a7da5e1 Binary files /dev/null and b/projects/library_management/bin/library_management/AdminSection$3.class differ diff --git a/projects/library_management/bin/library_management/AdminSection$4.class b/projects/library_management/bin/library_management/AdminSection$4.class new file mode 100644 index 0000000..a1f7ef8 Binary files /dev/null and b/projects/library_management/bin/library_management/AdminSection$4.class differ diff --git a/projects/library_management/bin/library_management/AdminSection$5.class b/projects/library_management/bin/library_management/AdminSection$5.class new file mode 100644 index 0000000..1d0f711 Binary files /dev/null and b/projects/library_management/bin/library_management/AdminSection$5.class differ diff --git a/projects/library_management/bin/library_management/AdminSection$6.class b/projects/library_management/bin/library_management/AdminSection$6.class new file mode 100644 index 0000000..f278f10 Binary files /dev/null and b/projects/library_management/bin/library_management/AdminSection$6.class differ diff --git a/projects/library_management/bin/library_management/AdminSection$7.class b/projects/library_management/bin/library_management/AdminSection$7.class new file mode 100644 index 0000000..e6f3c31 Binary files /dev/null and b/projects/library_management/bin/library_management/AdminSection$7.class differ diff --git a/projects/library_management/bin/library_management/AdminSection$8.class b/projects/library_management/bin/library_management/AdminSection$8.class new file mode 100644 index 0000000..bd4b067 Binary files /dev/null and b/projects/library_management/bin/library_management/AdminSection$8.class differ diff --git a/projects/library_management/bin/library_management/AdminSection$9.class b/projects/library_management/bin/library_management/AdminSection$9.class new file mode 100644 index 0000000..41f6c69 Binary files /dev/null and b/projects/library_management/bin/library_management/AdminSection$9.class differ diff --git a/projects/library_management/bin/library_management/AdminSection.class b/projects/library_management/bin/library_management/AdminSection.class new file mode 100644 index 0000000..71f1f09 Binary files /dev/null and b/projects/library_management/bin/library_management/AdminSection.class differ diff --git a/projects/library_management/bin/library_management/DBInfo.class b/projects/library_management/bin/library_management/DBInfo.class new file mode 100644 index 0000000..f91a0e0 Binary files /dev/null and b/projects/library_management/bin/library_management/DBInfo.class differ diff --git a/projects/library_management/bin/library_management/SearchBy$1.class b/projects/library_management/bin/library_management/SearchBy$1.class new file mode 100644 index 0000000..0ac4e96 Binary files /dev/null and b/projects/library_management/bin/library_management/SearchBy$1.class differ diff --git a/projects/library_management/bin/library_management/SearchBy.class b/projects/library_management/bin/library_management/SearchBy.class new file mode 100644 index 0000000..4933dd8 Binary files /dev/null and b/projects/library_management/bin/library_management/SearchBy.class differ diff --git a/projects/library_management/bin/library_management/SearchUpdateDelete$1.class b/projects/library_management/bin/library_management/SearchUpdateDelete$1.class new file mode 100644 index 0000000..872107a Binary files /dev/null and b/projects/library_management/bin/library_management/SearchUpdateDelete$1.class differ diff --git a/projects/library_management/bin/library_management/SearchUpdateDelete$2.class b/projects/library_management/bin/library_management/SearchUpdateDelete$2.class new file mode 100644 index 0000000..e58153f Binary files /dev/null and b/projects/library_management/bin/library_management/SearchUpdateDelete$2.class differ diff --git a/projects/library_management/bin/library_management/SearchUpdateDelete$3.class b/projects/library_management/bin/library_management/SearchUpdateDelete$3.class new file mode 100644 index 0000000..728c672 Binary files /dev/null and b/projects/library_management/bin/library_management/SearchUpdateDelete$3.class differ diff --git a/projects/library_management/bin/library_management/SearchUpdateDelete$4.class b/projects/library_management/bin/library_management/SearchUpdateDelete$4.class new file mode 100644 index 0000000..8adef13 Binary files /dev/null and b/projects/library_management/bin/library_management/SearchUpdateDelete$4.class differ diff --git a/projects/library_management/bin/library_management/SearchUpdateDelete$5.class b/projects/library_management/bin/library_management/SearchUpdateDelete$5.class new file mode 100644 index 0000000..e30d3fb Binary files /dev/null and b/projects/library_management/bin/library_management/SearchUpdateDelete$5.class differ diff --git a/projects/library_management/bin/library_management/SearchUpdateDelete.class b/projects/library_management/bin/library_management/SearchUpdateDelete.class new file mode 100644 index 0000000..8290519 Binary files /dev/null and b/projects/library_management/bin/library_management/SearchUpdateDelete.class differ diff --git a/projects/library_management/bin/library_management/SearchUpdateDeleteUser$1.class b/projects/library_management/bin/library_management/SearchUpdateDeleteUser$1.class new file mode 100644 index 0000000..6199bfa Binary files /dev/null and b/projects/library_management/bin/library_management/SearchUpdateDeleteUser$1.class differ diff --git a/projects/library_management/bin/library_management/SearchUpdateDeleteUser$2.class b/projects/library_management/bin/library_management/SearchUpdateDeleteUser$2.class new file mode 100644 index 0000000..0908b1d Binary files /dev/null and b/projects/library_management/bin/library_management/SearchUpdateDeleteUser$2.class differ diff --git a/projects/library_management/bin/library_management/SearchUpdateDeleteUser$3.class b/projects/library_management/bin/library_management/SearchUpdateDeleteUser$3.class new file mode 100644 index 0000000..5326402 Binary files /dev/null and b/projects/library_management/bin/library_management/SearchUpdateDeleteUser$3.class differ diff --git a/projects/library_management/bin/library_management/SearchUpdateDeleteUser$4.class b/projects/library_management/bin/library_management/SearchUpdateDeleteUser$4.class new file mode 100644 index 0000000..4aa69ae Binary files /dev/null and b/projects/library_management/bin/library_management/SearchUpdateDeleteUser$4.class differ diff --git a/projects/library_management/bin/library_management/SearchUpdateDeleteUser.class b/projects/library_management/bin/library_management/SearchUpdateDeleteUser.class new file mode 100644 index 0000000..d4c25be Binary files /dev/null and b/projects/library_management/bin/library_management/SearchUpdateDeleteUser.class differ diff --git a/projects/library_management/bin/library_management/SearchVauesDialogBox$1.class b/projects/library_management/bin/library_management/SearchVauesDialogBox$1.class new file mode 100644 index 0000000..4c2eb2a Binary files /dev/null and b/projects/library_management/bin/library_management/SearchVauesDialogBox$1.class differ diff --git a/projects/library_management/bin/library_management/SearchVauesDialogBox$2.class b/projects/library_management/bin/library_management/SearchVauesDialogBox$2.class new file mode 100644 index 0000000..d65b3dd Binary files /dev/null and b/projects/library_management/bin/library_management/SearchVauesDialogBox$2.class differ diff --git a/projects/library_management/bin/library_management/SearchVauesDialogBox.class b/projects/library_management/bin/library_management/SearchVauesDialogBox.class new file mode 100644 index 0000000..bb2f5d6 Binary files /dev/null and b/projects/library_management/bin/library_management/SearchVauesDialogBox.class differ diff --git a/projects/library_management/bin/library_management/UserSection$1.class b/projects/library_management/bin/library_management/UserSection$1.class new file mode 100644 index 0000000..855a4ba Binary files /dev/null and b/projects/library_management/bin/library_management/UserSection$1.class differ diff --git a/projects/library_management/bin/library_management/UserSection$2.class b/projects/library_management/bin/library_management/UserSection$2.class new file mode 100644 index 0000000..993e610 Binary files /dev/null and b/projects/library_management/bin/library_management/UserSection$2.class differ diff --git a/projects/library_management/bin/library_management/UserSection$3.class b/projects/library_management/bin/library_management/UserSection$3.class new file mode 100644 index 0000000..cb67b87 Binary files /dev/null and b/projects/library_management/bin/library_management/UserSection$3.class differ diff --git a/projects/library_management/bin/library_management/UserSection$4.class b/projects/library_management/bin/library_management/UserSection$4.class new file mode 100644 index 0000000..93ea06f Binary files /dev/null and b/projects/library_management/bin/library_management/UserSection$4.class differ diff --git a/projects/library_management/bin/library_management/UserSection$5.class b/projects/library_management/bin/library_management/UserSection$5.class new file mode 100644 index 0000000..6f6f8d5 Binary files /dev/null and b/projects/library_management/bin/library_management/UserSection$5.class differ diff --git a/projects/library_management/bin/library_management/UserSection$6.class b/projects/library_management/bin/library_management/UserSection$6.class new file mode 100644 index 0000000..e74d261 Binary files /dev/null and b/projects/library_management/bin/library_management/UserSection$6.class differ diff --git a/projects/library_management/bin/library_management/UserSection.class b/projects/library_management/bin/library_management/UserSection.class new file mode 100644 index 0000000..b8f53ec Binary files /dev/null and b/projects/library_management/bin/library_management/UserSection.class differ diff --git a/projects/library_management/bin/library_management/add_new_admin$1.class b/projects/library_management/bin/library_management/add_new_admin$1.class new file mode 100644 index 0000000..3d34a5a Binary files /dev/null and b/projects/library_management/bin/library_management/add_new_admin$1.class differ diff --git a/projects/library_management/bin/library_management/add_new_admin$2.class b/projects/library_management/bin/library_management/add_new_admin$2.class new file mode 100644 index 0000000..ad5a229 Binary files /dev/null and b/projects/library_management/bin/library_management/add_new_admin$2.class differ diff --git a/projects/library_management/bin/library_management/add_new_admin.class b/projects/library_management/bin/library_management/add_new_admin.class new file mode 100644 index 0000000..53bcbdc Binary files /dev/null and b/projects/library_management/bin/library_management/add_new_admin.class differ diff --git a/projects/library_management/bin/library_management/add_new_book$1.class b/projects/library_management/bin/library_management/add_new_book$1.class new file mode 100644 index 0000000..de9134b Binary files /dev/null and b/projects/library_management/bin/library_management/add_new_book$1.class differ diff --git a/projects/library_management/bin/library_management/add_new_book$2.class b/projects/library_management/bin/library_management/add_new_book$2.class new file mode 100644 index 0000000..90d0c40 Binary files /dev/null and b/projects/library_management/bin/library_management/add_new_book$2.class differ diff --git a/projects/library_management/bin/library_management/add_new_book$3.class b/projects/library_management/bin/library_management/add_new_book$3.class new file mode 100644 index 0000000..2994184 Binary files /dev/null and b/projects/library_management/bin/library_management/add_new_book$3.class differ diff --git a/projects/library_management/bin/library_management/add_new_book$4.class b/projects/library_management/bin/library_management/add_new_book$4.class new file mode 100644 index 0000000..40bf77a Binary files /dev/null and b/projects/library_management/bin/library_management/add_new_book$4.class differ diff --git a/projects/library_management/bin/library_management/add_new_book$5.class b/projects/library_management/bin/library_management/add_new_book$5.class new file mode 100644 index 0000000..d17040e Binary files /dev/null and b/projects/library_management/bin/library_management/add_new_book$5.class differ diff --git a/projects/library_management/bin/library_management/add_new_book$6.class b/projects/library_management/bin/library_management/add_new_book$6.class new file mode 100644 index 0000000..17418ef Binary files /dev/null and b/projects/library_management/bin/library_management/add_new_book$6.class differ diff --git a/projects/library_management/bin/library_management/add_new_book.class b/projects/library_management/bin/library_management/add_new_book.class new file mode 100644 index 0000000..8fd88ac Binary files /dev/null and b/projects/library_management/bin/library_management/add_new_book.class differ diff --git a/projects/library_management/bin/library_management/add_new_user$1.class b/projects/library_management/bin/library_management/add_new_user$1.class new file mode 100644 index 0000000..7f9b234 Binary files /dev/null and b/projects/library_management/bin/library_management/add_new_user$1.class differ diff --git a/projects/library_management/bin/library_management/add_new_user$2.class b/projects/library_management/bin/library_management/add_new_user$2.class new file mode 100644 index 0000000..1f9a0bb Binary files /dev/null and b/projects/library_management/bin/library_management/add_new_user$2.class differ diff --git a/projects/library_management/bin/library_management/add_new_user.class b/projects/library_management/bin/library_management/add_new_user.class new file mode 100644 index 0000000..a979642 Binary files /dev/null and b/projects/library_management/bin/library_management/add_new_user.class differ diff --git a/projects/library_management/bin/library_management/cal_fine$1.class b/projects/library_management/bin/library_management/cal_fine$1.class new file mode 100644 index 0000000..640e33a Binary files /dev/null and b/projects/library_management/bin/library_management/cal_fine$1.class differ diff --git a/projects/library_management/bin/library_management/cal_fine$2.class b/projects/library_management/bin/library_management/cal_fine$2.class new file mode 100644 index 0000000..1d209fe Binary files /dev/null and b/projects/library_management/bin/library_management/cal_fine$2.class differ diff --git a/projects/library_management/bin/library_management/cal_fine.class b/projects/library_management/bin/library_management/cal_fine.class new file mode 100644 index 0000000..f35f16a Binary files /dev/null and b/projects/library_management/bin/library_management/cal_fine.class differ diff --git a/projects/library_management/bin/library_management/change_password_dialog$1.class b/projects/library_management/bin/library_management/change_password_dialog$1.class new file mode 100644 index 0000000..c2c9a61 Binary files /dev/null and b/projects/library_management/bin/library_management/change_password_dialog$1.class differ diff --git a/projects/library_management/bin/library_management/change_password_dialog$2.class b/projects/library_management/bin/library_management/change_password_dialog$2.class new file mode 100644 index 0000000..b87b9c9 Binary files /dev/null and b/projects/library_management/bin/library_management/change_password_dialog$2.class differ diff --git a/projects/library_management/bin/library_management/change_password_dialog.class b/projects/library_management/bin/library_management/change_password_dialog.class new file mode 100644 index 0000000..eea10a9 Binary files /dev/null and b/projects/library_management/bin/library_management/change_password_dialog.class differ diff --git a/projects/library_management/bin/library_management/change_password_foruser$1.class b/projects/library_management/bin/library_management/change_password_foruser$1.class new file mode 100644 index 0000000..bf80e71 Binary files /dev/null and b/projects/library_management/bin/library_management/change_password_foruser$1.class differ diff --git a/projects/library_management/bin/library_management/change_password_foruser$2.class b/projects/library_management/bin/library_management/change_password_foruser$2.class new file mode 100644 index 0000000..be19497 Binary files /dev/null and b/projects/library_management/bin/library_management/change_password_foruser$2.class differ diff --git a/projects/library_management/bin/library_management/change_password_foruser.class b/projects/library_management/bin/library_management/change_password_foruser.class new file mode 100644 index 0000000..f72a86c Binary files /dev/null and b/projects/library_management/bin/library_management/change_password_foruser.class differ diff --git a/projects/library_management/bin/library_management/fine.class b/projects/library_management/bin/library_management/fine.class new file mode 100644 index 0000000..e0dba12 Binary files /dev/null and b/projects/library_management/bin/library_management/fine.class differ diff --git a/projects/library_management/bin/library_management/issue$1.class b/projects/library_management/bin/library_management/issue$1.class new file mode 100644 index 0000000..a197ada Binary files /dev/null and b/projects/library_management/bin/library_management/issue$1.class differ diff --git a/projects/library_management/bin/library_management/issue$2.class b/projects/library_management/bin/library_management/issue$2.class new file mode 100644 index 0000000..1cff5c9 Binary files /dev/null and b/projects/library_management/bin/library_management/issue$2.class differ diff --git a/projects/library_management/bin/library_management/issue.class b/projects/library_management/bin/library_management/issue.class new file mode 100644 index 0000000..0c6a30a Binary files /dev/null and b/projects/library_management/bin/library_management/issue.class differ diff --git a/projects/library_management/bin/library_management/login_page_firstpage$1.class b/projects/library_management/bin/library_management/login_page_firstpage$1.class new file mode 100644 index 0000000..3b7fa11 Binary files /dev/null and b/projects/library_management/bin/library_management/login_page_firstpage$1.class differ diff --git a/projects/library_management/bin/library_management/login_page_firstpage$2.class b/projects/library_management/bin/library_management/login_page_firstpage$2.class new file mode 100644 index 0000000..a4c4486 Binary files /dev/null and b/projects/library_management/bin/library_management/login_page_firstpage$2.class differ diff --git a/projects/library_management/bin/library_management/login_page_firstpage$3.class b/projects/library_management/bin/library_management/login_page_firstpage$3.class new file mode 100644 index 0000000..9e7b5f6 Binary files /dev/null and b/projects/library_management/bin/library_management/login_page_firstpage$3.class differ diff --git a/projects/library_management/bin/library_management/login_page_firstpage.class b/projects/library_management/bin/library_management/login_page_firstpage.class new file mode 100644 index 0000000..6a325c5 Binary files /dev/null and b/projects/library_management/bin/library_management/login_page_firstpage.class differ diff --git a/projects/library_management/bin/library_management/password_dialog$1.class b/projects/library_management/bin/library_management/password_dialog$1.class new file mode 100644 index 0000000..587eb51 Binary files /dev/null and b/projects/library_management/bin/library_management/password_dialog$1.class differ diff --git a/projects/library_management/bin/library_management/password_dialog$2.class b/projects/library_management/bin/library_management/password_dialog$2.class new file mode 100644 index 0000000..ba3050a Binary files /dev/null and b/projects/library_management/bin/library_management/password_dialog$2.class differ diff --git a/projects/library_management/bin/library_management/password_dialog$3.class b/projects/library_management/bin/library_management/password_dialog$3.class new file mode 100644 index 0000000..df6c835 Binary files /dev/null and b/projects/library_management/bin/library_management/password_dialog$3.class differ diff --git a/projects/library_management/bin/library_management/password_dialog.class b/projects/library_management/bin/library_management/password_dialog.class new file mode 100644 index 0000000..5835847 Binary files /dev/null and b/projects/library_management/bin/library_management/password_dialog.class differ diff --git a/projects/library_management/bin/library_management/password_dialog_foruser$1.class b/projects/library_management/bin/library_management/password_dialog_foruser$1.class new file mode 100644 index 0000000..74cbbdc Binary files /dev/null and b/projects/library_management/bin/library_management/password_dialog_foruser$1.class differ diff --git a/projects/library_management/bin/library_management/password_dialog_foruser$2.class b/projects/library_management/bin/library_management/password_dialog_foruser$2.class new file mode 100644 index 0000000..f92cf95 Binary files /dev/null and b/projects/library_management/bin/library_management/password_dialog_foruser$2.class differ diff --git a/projects/library_management/bin/library_management/password_dialog_foruser$3.class b/projects/library_management/bin/library_management/password_dialog_foruser$3.class new file mode 100644 index 0000000..07c3a4d Binary files /dev/null and b/projects/library_management/bin/library_management/password_dialog_foruser$3.class differ diff --git a/projects/library_management/bin/library_management/password_dialog_foruser.class b/projects/library_management/bin/library_management/password_dialog_foruser.class new file mode 100644 index 0000000..aebd674 Binary files /dev/null and b/projects/library_management/bin/library_management/password_dialog_foruser.class differ diff --git a/projects/library_management/bin/library_management/submit$1.class b/projects/library_management/bin/library_management/submit$1.class new file mode 100644 index 0000000..1530f8c Binary files /dev/null and b/projects/library_management/bin/library_management/submit$1.class differ diff --git a/projects/library_management/bin/library_management/submit$2.class b/projects/library_management/bin/library_management/submit$2.class new file mode 100644 index 0000000..960def6 Binary files /dev/null and b/projects/library_management/bin/library_management/submit$2.class differ diff --git a/projects/library_management/bin/library_management/submit.class b/projects/library_management/bin/library_management/submit.class new file mode 100644 index 0000000..22f92a8 Binary files /dev/null and b/projects/library_management/bin/library_management/submit.class differ diff --git a/projects/library_management/bin/library_management/view_profile.class b/projects/library_management/bin/library_management/view_profile.class new file mode 100644 index 0000000..a60ce41 Binary files /dev/null and b/projects/library_management/bin/library_management/view_profile.class differ diff --git a/projects/library_management/library_management.sql b/projects/library_management/library_management.sql new file mode 100644 index 0000000..f9cf078 --- /dev/null +++ b/projects/library_management/library_management.sql @@ -0,0 +1,162 @@ +/* +SQLyog Enterprise - MySQL GUI v7.02 +MySQL - 5.0.67-community-nt : Database - library_management +********************************************************************* +*/ + +/*!40101 SET NAMES utf8 */; + +/*!40101 SET SQL_MODE=''*/; + +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/`library_management` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `library_management`; + +/*Table structure for table `admin` */ + +DROP TABLE IF EXISTS `admin`; + +CREATE TABLE `admin` ( + `admin_name` varchar(100) NOT NULL, + `password` varchar(100) NOT NULL, + `user type` varchar(100) NOT NULL, + `mobile` int(100) default NULL, + `email` varchar(100) default NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Data for the table `admin` */ + +insert into `admin`(`admin_name`,`password`,`user type`,`mobile`,`email`) values ('saloni','saloni123','admin',NULL,NULL),('mahak','1234','admin',12345678,'sssss'); + +/*Table structure for table `author` */ + +DROP TABLE IF EXISTS `author`; + +CREATE TABLE `author` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; + +/*Data for the table `author` */ + +insert into `author`(`id`,`name`) values (1,'ASD'),(2,'FWEFWE'),(3,'BALAGURU SWAMI'),(4,'GFGGFVV'); + +/*Table structure for table `book_table` */ + +DROP TABLE IF EXISTS `book_table`; + +CREATE TABLE `book_table` ( + `bookid` int(7) NOT NULL auto_increment, + `title` varchar(100) NOT NULL, + `author` varchar(100) default NULL, + `subject` varchar(100) default NULL, + `category` varchar(100) default NULL, + `publisher` varchar(100) default NULL, + `isbn` int(10) default NULL, + `edition` int(10) default NULL, + `price` int(10) default NULL, + `quantity` int(10) default NULL, + PRIMARY KEY (`bookid`) +) ENGINE=InnoDB AUTO_INCREMENT=5445325 DEFAULT CHARSET=latin1; + +/*Data for the table `book_table` */ + +insert into `book_table`(`bookid`,`title`,`author`,`subject`,`category`,`publisher`,`isbn`,`edition`,`price`,`quantity`) values (139299,'c progrmming','BALAGURU SWAMI','TMP','GCFFXG','C#',4567,2019,233,5),(351671,'learn to code','FWEFWE','JAVA','PROGRAMMING','DFDGSFDS',7689,2018,22,20),(483277,'jquery','ASD','DESIGNING','SCRIPTING2','EERT',6789,1200,6000,0),(582445,'html','FWEFWE','C++','SCRIPTING','EERT',5833,2019,200,12),(685282,'learn to design','FWEFWE','C#','SCRIPTING2','EERT',4590,2016,200,20),(927755,'learning java','BALAGURU SWAMI','JAVA','PROGRAMMING','VUE',4567,2018,200,12); + +/*Table structure for table `category` */ + +DROP TABLE IF EXISTS `category`; + +CREATE TABLE `category` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; + +/*Data for the table `category` */ + +insert into `category`(`id`,`name`) values (1,'PROGRAMMING'),(2,'SCRIPTING'),(3,'SCRIPTING2'),(4,'GCFFXG'); + +/*Table structure for table `issue` */ + +DROP TABLE IF EXISTS `issue`; + +CREATE TABLE `issue` ( + `bookid` int(10) NOT NULL, + `issue_date` date default NULL, + `status` varchar(20) default NULL, + `submit_date` date default NULL, + `username` varchar(100) default NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Data for the table `issue` */ + +insert into `issue`(`bookid`,`issue_date`,`status`,`submit_date`,`username`) values (483277,'2018-12-22','sumitted','2018-12-31','ds'),(483277,'2018-12-22','sumitted','2018-12-31','ds'),(483277,'2018-12-22','sumitted','2018-12-31','ds'),(274253,NULL,'sumitted',NULL,'raj'),(139299,NULL,'sumitted','2018-12-22',NULL),(274253,NULL,'not submitted',NULL,NULL),(483277,NULL,'not submitted',NULL,NULL),(139299,NULL,'sumitted','2018-12-22','chavi'),(139299,NULL,'sumitted','2018-12-22','chavi'),(139299,'2018-12-22','sumitted','2018-12-22','chavi'),(685282,'2018-12-22','sumitted','2018-12-22','raj'); + +/*Table structure for table `login` */ + +DROP TABLE IF EXISTS `login`; + +CREATE TABLE `login` ( + `username` varchar(100) NOT NULL, + `password` varchar(100) default NULL, + `usertype` varchar(100) default NULL, + `id` int(10) NOT NULL, + PRIMARY KEY (`username`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Data for the table `login` */ + +insert into `login`(`username`,`password`,`usertype`,`id`) values ('chavi','123456','student',36659287),('ds','sal','student',29111111),('raj','3456','faculty',97375124); + +/*Table structure for table `publisher` */ + +DROP TABLE IF EXISTS `publisher`; + +CREATE TABLE `publisher` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; + +/*Data for the table `publisher` */ + +insert into `publisher`(`id`,`name`) values (1,'TMP'),(2,'EERT'),(3,'VUE'),(4,'DFDGSFDS'); + +/*Table structure for table `registeration` */ + +DROP TABLE IF EXISTS `registeration`; + +CREATE TABLE `registeration` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + `mobile` varchar(15) default NULL, + `email` varchar(100) default NULL, + `username` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=97375125 DEFAULT CHARSET=latin1; + +/*Data for the table `registeration` */ + +insert into `registeration`(`id`,`name`,`mobile`,`email`,`username`) values (29111111,'sal','1234567','sassssaa','ds'),(36659287,'chavi','12309879','saass','chavi'),(72214667,'dfgd','67678','hjbbjb','ds'),(88913337,'dfd','787','jbj','ds'),(97375124,'rajesj','78787878','sss','raj'); + +/*Table structure for table `subject` */ + +DROP TABLE IF EXISTS `subject`; + +CREATE TABLE `subject` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; + +/*Data for the table `subject` */ + +insert into `subject`(`id`,`name`) values (1,'C'),(2,'C++'),(3,'JAVA'),(4,'DESIGNING'),(5,'C#'),(6,'FDFD'); + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; diff --git a/projects/library_management/src/library_management/AdminSection.java b/projects/library_management/src/library_management/AdminSection.java new file mode 100644 index 0000000..99fa6ea --- /dev/null +++ b/projects/library_management/src/library_management/AdminSection.java @@ -0,0 +1,184 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.border.EmptyBorder; +import java.awt.GridLayout; +import javax.swing.JTextField; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class AdminSection extends JFrame { + + private JPanel contentPane; + + /** + * Launch the application. + + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + AdminSection frame = new AdminSection(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public AdminSection() + { + setTitle("Admin Section"); + getContentPane().setLayout(new GridLayout(1, 0, 0, 0)); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 751, 431); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + contentPane.setLayout(new GridLayout(3, 4, 0, 0)); + + JButton btnAddBook = new JButton("add new book"); + btnAddBook.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + add_new_book obj=new add_new_book(); + obj.setVisible(true); + } + }); + contentPane.add(btnAddBook); + + JButton btnSearchupdatedeleteBook = new JButton("search/update/delete book"); + btnSearchupdatedeleteBook.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + SearchUpdateDelete obj=new SearchUpdateDelete(); + obj.setVisible(true); + } + }); + contentPane.add(btnSearchupdatedeleteBook); + + JButton btnSubmitBook = new JButton("submit book"); + btnSubmitBook.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + new submit().setVisible(true); + } + }); + contentPane.add(btnSubmitBook); + + JButton btnAddNew = new JButton("add new user "); + btnAddNew.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + new add_new_user().setVisible(true); + } + }); + contentPane.add(btnAddNew); + + JButton btnSearchupdatedeleteUser = new JButton("search/update/delete user"); + btnSearchupdatedeleteUser.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + new SearchUpdateDeleteUser().setVisible(true); + } + }); + contentPane.add(btnSearchupdatedeleteUser); + + JButton btnViewAllUsers = new JButton("view all users"); + btnViewAllUsers.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + JFrame frm=new JFrame(); + + frm.setSize(900, 400); + frm.setLocationRelativeTo(frm); + frm.setDefaultCloseOperation(frm.DISPOSE_ON_CLOSE); + + DBInfo.getAllUsers(); + + JTable t=new JTable(DBInfo.outer, DBInfo.header); + JScrollPane pane=new JScrollPane(t); + frm.getContentPane().add(pane); + frm.setVisible(true); + } + }); + contentPane.add(btnViewAllUsers); + String for_whome="admin"; + + + JButton btnNewButton = new JButton("change password for admin"); + btnNewButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + new change_password_dialog().setVisible(true); + + + } + }); + contentPane.add(btnNewButton); + + JButton btnIssueBook = new JButton("issue book"); + btnIssueBook.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + new issue().setVisible(true); + } + }); + contentPane.add(btnIssueBook); + + JButton btnFineCalculation = new JButton("fine calculation"); + btnFineCalculation.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + + new cal_fine().setVisible(true); + + } + }); + contentPane.add(btnFineCalculation); + + JButton btnViewAllBooks = new JButton("view all books"); + btnViewAllBooks.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + JFrame frm=new JFrame(); + + frm.setSize(900, 400); + frm.setLocationRelativeTo(frm); + frm.setDefaultCloseOperation(frm.DISPOSE_ON_CLOSE); + + DBInfo.getAllBooks(); + + JTable t=new JTable(DBInfo.outer, DBInfo.header); + JScrollPane pane=new JScrollPane(t); + frm.getContentPane().add(pane); + frm.setVisible(true); + } + }); + contentPane.add(btnViewAllBooks); + + JButton btnSearchBookBy = new JButton("Search book by "); + btnSearchBookBy.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + + SearchBy obj=new SearchBy(); + obj.setVisible(true); + } + }); + contentPane.add(btnSearchBookBy); + + JButton btnClose = new JButton("add new admin"); + btnClose.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent arg0) { + new add_new_admin().setVisible(true);; + + } + }); + contentPane.add(btnClose); + } + +} diff --git a/projects/library_management/src/library_management/DBInfo.java b/projects/library_management/src/library_management/DBInfo.java new file mode 100644 index 0000000..1c45825 --- /dev/null +++ b/projects/library_management/src/library_management/DBInfo.java @@ -0,0 +1,448 @@ +package library_management; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.util.Vector; + +public class DBInfo +{ + static Connection con; + static Vector header; + static Vector> outer; + static + { try + { + Class.forName("com.mysql.jdbc.Driver"); + con=DriverManager.getConnection("jdbc:mysql://localhost:3306/library_management","root","rat"); + } + catch(Exception e) + { + e.printStackTrace(); + } + } +public static int insertValueA(String str) +{ + int i=0; + String query=("insert into author values(?,?)"); + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setInt(1, 0); + ps.setString(2, str.toUpperCase()); + i=ps.executeUpdate(); + } + catch(Exception e) + { + e.printStackTrace(); + } + return i; + + } +public static int insertValueC(String str) +{ + int i=0; + String query=("insert into category values(?,?)"); + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setInt(1, 0); + ps.setString(2, str.toUpperCase()); + i=ps.executeUpdate(); + } + catch(Exception e) + { + e.printStackTrace(); + } + return i; + + } +public static int insertValueP(String str) +{ + int i=0; + String query=("insert into publisher values(?,?)"); + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setInt(1, 0); + ps.setString(2, str.toUpperCase()); + i=ps.executeUpdate(); + } + catch(Exception e) + { + e.printStackTrace(); + } + return i; + + } +public static int insertValueS(String str) +{ + int i=0; + String query=("insert into subject values(?,?)"); + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setInt(1, 0); + ps.setString(2, str.toUpperCase()); + i=ps.executeUpdate(); + } + catch(Exception e) + { + e.printStackTrace(); + } + return i; + + } +public static Vector getAuthor() +{ + Vector v=new Vector<>(); + String query="select name from author order by name"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + v.add(res.getString(1)); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + return v; +} +public static Vector getPublisher() +{ + Vector v=new Vector<>(); + String query="select name from publisher order by name"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + v.add(res.getString(1)); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + return v; +} + +public static Vector getCategory() +{ + Vector v=new Vector<>(); + String query="select name from category order by name"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + v.add(res.getString(1)); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + return v; +} + +public static Vector getSubject() +{ + Vector v=new Vector<>(); + String query="select name from subject order by name"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + v.add(res.getString(1)); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + return v; +} + +public static void getAllBooks() +{ + header=new Vector<>();//it will store the cols name of book table + outer=new Vector<>(); + + String query="select * from book_table"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ResultSet res=ps.executeQuery(); + + //getting MetaData + ResultSetMetaData rsmd=res.getMetaData(); + int colcount=rsmd.getColumnCount(); + for(int i=1;i<=colcount;i++) + { + String colName=rsmd.getColumnName(i); + header.add(colName); + } + + //getting table records + while(res.next()) + { + Vector records=new Vector<>(); + for(int i=1;i<=colcount;i++) + { + String value=res.getString(i); + records.add(value); + } + outer.add(records); + } + } + catch(Exception e) + { + e.printStackTrace(); + } +} + +public static void getValuesP(String name) +{ + header=new Vector<>();//it will store the cols name of book table + outer=new Vector<>(); + + String query="select * from book_table where publisher =?"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, name); + ResultSet res=ps.executeQuery(); + + //getting MetaData + ResultSetMetaData rsmd=res.getMetaData(); + int colcount=rsmd.getColumnCount(); + for(int i=1;i<=colcount;i++) + { + String colName=rsmd.getColumnName(i); + header.add(colName); + } + + //getting table records + while(res.next()) + { + Vector records=new Vector<>(); + for(int i=1;i<=colcount;i++) + { + String v=res.getString(i); + records.add(v); + } + outer.add(records); + } + } + catch(Exception e) + { + e.printStackTrace(); + } +} + +public static void getValuesA(String name) +{ + header=new Vector<>();//it will store the cols name of book table + outer=new Vector<>(); + + String query="select * from book_table where author =?"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, name); + ResultSet res=ps.executeQuery(); + + //getting MetaData + ResultSetMetaData rsmd=res.getMetaData(); + int colcount=rsmd.getColumnCount(); + for(int i=1;i<=colcount;i++) + { + String colName=rsmd.getColumnName(i); + header.add(colName); + } + + //getting table records + while(res.next()) + { + Vector records=new Vector<>(); + for(int i=1;i<=colcount;i++) + { + String v=res.getString(i); + records.add(v); + } + outer.add(records); + } + } + catch(Exception e) + { + e.printStackTrace(); + } +} + +public static void getValuesC(String name) +{ + header=new Vector<>();//it will store the cols name of book table + outer=new Vector<>(); + + String query="select * from book_table where category =?"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, name); + ResultSet res=ps.executeQuery(); + + //getting MetaData + ResultSetMetaData rsmd=res.getMetaData(); + int colcount=rsmd.getColumnCount(); + for(int i=1;i<=colcount;i++) + { + String colName=rsmd.getColumnName(i); + header.add(colName); + } + + //getting table records + while(res.next()) + { + Vector records=new Vector<>(); + for(int i=1;i<=colcount;i++) + { + String v=res.getString(i); + records.add(v); + } + outer.add(records); + } + } + catch(Exception e) + { + e.printStackTrace(); + } +} +public static void getValuesS(String name) +{ + header=new Vector<>();//it will store the cols name of book table + outer=new Vector<>(); + + String query="select * from book_table where subject =?"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, name); + ResultSet res=ps.executeQuery(); + + //getting MetaData + ResultSetMetaData rsmd=res.getMetaData(); + int colcount=rsmd.getColumnCount(); + for(int i=1;i<=colcount;i++) + { + String colName=rsmd.getColumnName(i); + header.add(colName); + } + + //getting table records + while(res.next()) + { + Vector records=new Vector<>(); + for(int i=1;i<=colcount;i++) + { + String v=res.getString(i); + records.add(v); + } + outer.add(records); + } + } + catch(Exception e) + { + e.printStackTrace(); + } +} +public static void getAllUsers() { + // TODO Auto-generated method stub + + header=new Vector<>();//it will store the cols name of book table + outer=new Vector<>(); + + String query="select * from registeration"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ResultSet res=ps.executeQuery(); + + //getting MetaData + ResultSetMetaData rsmd=res.getMetaData(); + int colcount=rsmd.getColumnCount(); + for(int i=1;i<=colcount;i++) + { + String colName=rsmd.getColumnName(i); + header.add(colName); + } + + //getting table records + while(res.next()) + { + Vector records=new Vector<>(); + for(int i=1;i<=colcount;i++) + { + String value=res.getString(i); + records.add(value); + } + outer.add(records); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + +} + +public static void Books(String nm) +{ + header=new Vector<>();//it will store the cols name of book table + outer=new Vector<>(); + + String query="select * from issue where username=?"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1,nm); + ResultSet res=ps.executeQuery(); + + //getting MetaData + ResultSetMetaData rsmd=res.getMetaData(); + int colcount=rsmd.getColumnCount(); + for(int i=1;i<=colcount;i++) + { + String colName=rsmd.getColumnName(i); + header.add(colName); + } + + //getting table records + while(res.next()) + { + Vector records=new Vector<>(); + for(int i=1;i<=colcount;i++) + { + String value=res.getString(i); + records.add(value); + } + outer.add(records); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + +} +} \ No newline at end of file diff --git a/projects/library_management/src/library_management/SearchBy.java b/projects/library_management/src/library_management/SearchBy.java new file mode 100644 index 0000000..a238ac6 --- /dev/null +++ b/projects/library_management/src/library_management/SearchBy.java @@ -0,0 +1,102 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.border.EmptyBorder; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JButton; +import javax.swing.LayoutStyle.ComponentPlacement; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class SearchBy extends JFrame { + + private JPanel contentPane; + + /** + * Launch the application. + + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + SearchBy frame = new SearchBy(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public SearchBy() { + setTitle("Search By"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 439, 300); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblSearchBy = new JLabel("Search By"); + + String values[]= {"Select","Author","Category","Subject","Publisher"}; + + JComboBox comboBox = new JComboBox(values); + + JButton btnSearch = new JButton("SEARCH"); + btnSearch.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String value=(String)comboBox.getSelectedItem(); + if(value.equalsIgnoreCase("Select")) + { +JOptionPane.showMessageDialog(getParent(), "Select a value", "Error", JOptionPane.ERROR_MESSAGE); + } + else + { + new SearchVauesDialogBox(value).setVisible(true); + } + + } + }); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(120) + .addComponent(lblSearchBy) + .addGap(18) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 128, GroupLayout.PREFERRED_SIZE) + .addContainerGap(57, Short.MAX_VALUE)) + .addGroup(Alignment.TRAILING, gl_contentPane.createSequentialGroup() + .addContainerGap(169, Short.MAX_VALUE) + .addComponent(btnSearch, GroupLayout.PREFERRED_SIZE, 109, GroupLayout.PREFERRED_SIZE) + .addGap(146)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(66) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblSearchBy) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addComponent(btnSearch) + .addContainerGap(124, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/library_management/src/library_management/SearchUpdateDelete.java b/projects/library_management/src/library_management/SearchUpdateDelete.java new file mode 100644 index 0000000..bc6de02 --- /dev/null +++ b/projects/library_management/src/library_management/SearchUpdateDelete.java @@ -0,0 +1,379 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JMenuBar; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.awt.event.ActionEvent; + +public class SearchUpdateDelete extends JFrame +{ + private JPanel contentPane; + private JTextField textField; + private JTextField textField_1; + private JTextField textField_2; + private JTextField textField_3; + private JTextField textField_4; + private JTextField textField_5; + private JComboBox comboBox,comboBox_1,comboBox_2,comboBox_3; + /** + * Launch the application. + */ + public void reset() + { + textField.setText(null); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + textField_5.setText(null); + comboBox.setSelectedIndex(0); + comboBox_1.setSelectedIndex(0); + comboBox_2.setSelectedIndex(0); + comboBox_3.setSelectedIndex(0); + } + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + SearchUpdateDelete frame = new SearchUpdateDelete(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + + + public SearchUpdateDelete() { + setTitle("search Update Delete"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 520, 567); + setLocationRelativeTo(this); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblBookId = new JLabel("Book Id"); + + + // System.out.println(id); + + textField = new JTextField(); + textField.setEditable(true); + textField.setColumns(10); + + JLabel lblName = new JLabel("Name"); + + textField_1 = new JTextField(); + textField_1.setColumns(10); + + JLabel lblAuthor = new JLabel("author"); + + JLabel lblPublisher = new JLabel("publisher"); + + comboBox = new JComboBox(DBInfo.getPublisher()); + + comboBox.insertItemAt("Select",0); + comboBox.setSelectedIndex(0); + + comboBox_1 = new JComboBox(DBInfo.getAuthor()); + + comboBox_1.insertItemAt("Select",0); + comboBox_1.setSelectedIndex(0); + JLabel lblCategory = new JLabel("category"); + + comboBox_2 = new JComboBox(DBInfo.getCategory()); + comboBox_2.insertItemAt("Select",0); + comboBox_2.setSelectedIndex(0); + + JLabel lblSubject = new JLabel("subject"); + + comboBox_3 = new JComboBox(DBInfo.getSubject()); + comboBox_3.insertItemAt("Select",0); + comboBox_3.setSelectedIndex(0); + + JLabel lblIsbnNumber = new JLabel("ISBN number"); + + textField_2 = new JTextField(); + textField_2.setColumns(10); + + JLabel lblEdition = new JLabel("edition"); + + textField_3 = new JTextField(); + textField_3.setColumns(10); + + JLabel lblPrice = new JLabel("price"); + + textField_4 = new JTextField(); + textField_4.setColumns(10); + + JLabel lblQuantity = new JLabel("quantity"); + + textField_5 = new JTextField(); + textField_5.setColumns(10); + + JButton btnReset = new JButton("RESET"); + btnReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + reset(); + + } + }); + + JButton btnSearch = new JButton("SEARCH"); + btnSearch.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String id=textField.getText(); + String query="select * from book_table where bookid=?"; + int flag=0; + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ps.setString(1, id); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + flag=1; + String title=res.getString(2); + String author=res.getString(3); + String sub=res.getString(4); + String cat=res.getString(5); + String pub=res.getString(6); + String isbn=res.getString(7); + String edition=res.getString(8); + String price=res.getString(9); + String quantity=res.getString(10); + textField_1.setText(title); + comboBox.setSelectedItem(pub); + comboBox_1.setSelectedItem(author); + comboBox_2.setSelectedItem(cat); + comboBox_3.setSelectedItem(sub); + textField_2.setText(isbn); + textField_3.setText(edition); + textField_4.setText(price); + textField_5.setText(quantity); + break; + + + } + + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==0) + { + JOptionPane.showMessageDialog(getParent(), "No Book Found!", "Error", JOptionPane.ERROR_MESSAGE); + } + } + }); + + JButton btnUpdate = new JButton("UPDATE"); + btnUpdate.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String id=textField.getText(); + String title=textField_1.getText(); + String pub=(String)comboBox.getSelectedItem(); + String author=(String)comboBox_1.getSelectedItem(); + String cat=(String)comboBox_2.getSelectedItem(); + String sub=(String)comboBox_3.getSelectedItem(); + String isbn=textField_2.getText(); + String edition=textField_3.getText(); + String price=textField_4.getText(); + String quantity=textField_5.getText(); + + if(id.length()==0 || title.length()==0 || author.equalsIgnoreCase("select") || pub.equalsIgnoreCase("select") || cat.equalsIgnoreCase("select") || sub.equalsIgnoreCase("select")|| isbn.length()==0 || edition.length()==0 || price.length()==0 || quantity.length()==0) + { + JOptionPane.showMessageDialog(SearchUpdateDelete.this, "Pls fill/select all the fields", "Error", JOptionPane.ERROR_MESSAGE); + } + else + { + + +String query="update book_table set title=?,author=?,publisher=?,category=?,subject=?,isbn=?,edition=?,price=?,quantity=? where bookid=?"; + int flag=0; + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + + ps.setString(1, title); + ps.setString(2, author); + ps.setString(3, sub); + ps.setString(4, cat); + ps.setString(5, pub); + ps.setString(6, isbn); + ps.setString(7, edition); + ps.setString(8, price); + ps.setString(9,quantity); + ps.setString(10, id); + flag=ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==1) + { + JOptionPane.showMessageDialog(SearchUpdateDelete.this, "Book updated!!", "Success", JOptionPane.INFORMATION_MESSAGE); + reset(); + + } + else + { + JOptionPane.showMessageDialog(SearchUpdateDelete.this, "Book Not Updated", "Error", JOptionPane.ERROR_MESSAGE); + } + }} + }); + + JButton btnDelete = new JButton("DELETE"); + btnDelete.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String id=textField.getText(); + String query="delete from book_table where bookid=?"; + int flag=0; + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ps.setString(1, id);; + flag=ps.executeUpdate(); + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag!=0) + { + JOptionPane.showMessageDialog(getParent(), "REecord Deleted!!"); + reset(); + } + if(flag==0) + { + JOptionPane.showMessageDialog(getParent(), "REecord Not Deleted!!"); + } + } + }); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(94) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblBookId, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE) + .addComponent(lblName, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE) + .addComponent(lblAuthor) + .addComponent(lblPublisher) + .addComponent(lblCategory) + .addComponent(lblIsbnNumber) + .addComponent(lblSubject) + .addComponent(lblPrice) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addComponent(lblEdition, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE) + .addComponent(lblQuantity, Alignment.LEADING))) + .addGap(36) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(textField_5, GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE) + .addComponent(textField_4, GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE) + .addComponent(textField_3, GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE) + .addComponent(textField_2, GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE) + .addComponent(comboBox_3, 0, 250, Short.MAX_VALUE) + .addComponent(comboBox_2, 0, 250, Short.MAX_VALUE) + .addComponent(comboBox, 0, 250, Short.MAX_VALUE) + .addComponent(comboBox_1, 0, 250, Short.MAX_VALUE) + .addComponent(textField_1, 184, 250, Short.MAX_VALUE) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)) + .addGap(52)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(103) + .addComponent(btnReset) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(btnSearch) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(btnUpdate) + .addGap(18) + .addComponent(btnDelete) + .addContainerGap(85, Short.MAX_VALUE)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(66) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblBookId, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblName) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblAuthor) + .addComponent(comboBox_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblPublisher) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblCategory) + .addComponent(comboBox_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(comboBox_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblSubject)) + .addGap(22) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblIsbnNumber) + .addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEdition) + .addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblPrice) + .addComponent(textField_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblQuantity) + .addComponent(textField_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED, 30, Short.MAX_VALUE) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnReset) + .addComponent(btnSearch) + .addComponent(btnUpdate) + .addComponent(btnDelete)) + .addGap(24)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/library_management/src/library_management/SearchUpdateDeleteUser.java b/projects/library_management/src/library_management/SearchUpdateDeleteUser.java new file mode 100644 index 0000000..89e2547 --- /dev/null +++ b/projects/library_management/src/library_management/SearchUpdateDeleteUser.java @@ -0,0 +1,388 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.JTextPane; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.JPasswordField; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.awt.event.ActionEvent; + +public class SearchUpdateDeleteUser extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JTextField textField_1; + private JTextField textField_2; + private JTextField textField_3; + private JTextField textField_4; + private JTextField textField_5; + + /** + * Launch the application. + + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + SearchUpdateDeleteUser frame = new SearchUpdateDeleteUser(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } +*/ + public SearchUpdateDeleteUser() { + setTitle("Search Update Delete User"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 444, 488); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblUserId = new JLabel("User Id"); + + textField = new JTextField(); + textField.setEditable(true); + + textField.setColumns(10); + + JLabel lblName = new JLabel("Name"); + + textField_1 = new JTextField(); + textField_1.setColumns(10); + + JLabel label = new JLabel(""); + + JLabel lblMobileNo = new JLabel("Mobile No."); + + textField_2 = new JTextField(); + textField_2.setColumns(10); + + JLabel lblEmail = new JLabel("Email"); + + textField_3 = new JTextField(); + textField_3.setColumns(10); + + JLabel lblUserName = new JLabel("User Name"); + + textField_4 = new JTextField(); + textField_4.setColumns(10); + + JLabel label_1 = new JLabel(""); + + JButton btnReset = new JButton("RESET"); + btnReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + textField.setText(null); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + textField_5.setText(null); + + + } + }); + + JButton btnSearch = new JButton("SEARCH"); + btnSearch.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + + String id=textField.getText(); + String query="select * from registeration where id=?"; + String query1="select * from login where id=?"; + int flag=0,flag1=0; + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ps.setString(1, id); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + flag=1; + String name=res.getString(2); + String mob=res.getString(3); + String email=res.getString(4); + String uname=res.getString(5); + textField_1.setText(name); + textField_2.setText(mob); + textField_3.setText(email); + textField_4.setText(uname); + break; + + + } + + } + catch(Exception e) + { + e.printStackTrace(); + } + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query1); + ps.setString(1, id); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + flag1=1; + String utype=res.getString(3); + textField_5.setText(utype); + break; + + + } + + } + catch(Exception e) + { + e.printStackTrace(); + } + + if(flag==0 && flag1==0) + { + JOptionPane.showMessageDialog(getParent(), "No such user Found!", "Error", JOptionPane.ERROR_MESSAGE); + } + } + }); + + JButton btnUpdate = new JButton("UPDATE"); + btnUpdate.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + + String id=textField.getText(); + String name=textField_1.getText(); + String mob=textField_2.getText(); + String email=textField_3.getText(); + String uname=textField_4.getText(); + String utype=textField_5.getText(); + + if(id.length()==0 || name.length()==0 || mob.length()==0 || email.length()==0 || uname.length()==0 || utype.length()==0 ) + { + JOptionPane.showMessageDialog(SearchUpdateDeleteUser.this, "Pls fill/select all the fields", "Error", JOptionPane.ERROR_MESSAGE); + } + else + { + String query="update registeration set name=?,mobile=?,email=?,username=? where id=?"; + int flag=0,flag1=0; + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + + ps.setString(1,name); + ps.setString(2, mob); + ps.setString(3, email); + ps.setString(4, uname); + ps.setString(5, id); + flag=ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + String query1="update login set usertype=? where id=?"; + try + { + PreparedStatement ps=con.prepareStatement(query1); + + ps.setString(1, utype); + ps.setString(2, id); + flag1=ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==1 && flag1==1) + { + JOptionPane.showMessageDialog(SearchUpdateDeleteUser.this, "User Details updated!!", "Success", JOptionPane.INFORMATION_MESSAGE); + textField.setText(null); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + textField_5.setText(null); + + + + } + else + { + JOptionPane.showMessageDialog(SearchUpdateDeleteUser.this, "User Details Not Updated", "Error", JOptionPane.ERROR_MESSAGE); + } + } + } + } + ); + + JButton btnDelete = new JButton("DELETE"); + btnDelete.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String id=textField.getText(); + String query="delete from registeration where id=?"; + String query1="delete from login where id=?"; + int flag=0,flag1=0; + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ps.setString(1, id);; + flag=ps.executeUpdate(); + } + catch(Exception e) + { + e.printStackTrace(); + } + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query1); + ps.setString(1, id);; + flag=ps.executeUpdate(); + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag!=0 && flag1!=0) + { + JOptionPane.showMessageDialog(getParent(), "REecord Deleted!!"); + textField.setText(null); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + textField_5.setText(null); + + } + if(flag==0) + { + JOptionPane.showMessageDialog(getParent(), "REecord Not Deleted!!"); + } + } + }); + + JLabel lblUserType = new JLabel("User Type"); + + textField_5 = new JTextField(); + textField_5.setColumns(10); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(217) + .addComponent(label_1)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(37) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(label) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblUserId, GroupLayout.PREFERRED_SIZE, 73, GroupLayout.PREFERRED_SIZE) + .addGap(26)) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblEmail, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(ComponentPlacement.RELATED)) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblName) + .addPreferredGap(ComponentPlacement.RELATED))) + .addGap(33) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 185, Short.MAX_VALUE) + .addComponent(textField_1) + .addComponent(textField_4) + .addComponent(textField_5, GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE) + .addComponent(textField_3) + .addComponent(textField_2)))))) + .addContainerGap(56, Short.MAX_VALUE)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(26) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(btnReset) + .addGap(33) + .addComponent(btnSearch) + .addGap(18) + .addComponent(btnUpdate) + .addGap(18) + .addComponent(btnDelete) + .addContainerGap()) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblUserType) + .addContainerGap()) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblUserName) + .addContainerGap()) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblMobileNo, GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE) + .addGap(297)))))) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(78) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblUserId) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblName) + .addPreferredGap(ComponentPlacement.RELATED, 24, Short.MAX_VALUE) + .addComponent(label) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(lblMobileNo)) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) + .addGap(16) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblEmail) + .addGap(32)) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGap(18))) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblUserName) + .addComponent(textField_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(27) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblUserType) + .addComponent(textField_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED, 61, Short.MAX_VALUE) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnReset) + .addComponent(btnSearch) + .addComponent(btnUpdate) + .addComponent(btnDelete)) + .addGap(52) + .addComponent(label_1)) + ); + contentPane.setLayout(gl_contentPane); + } +} \ No newline at end of file diff --git a/projects/library_management/src/library_management/SearchVauesDialogBox.java b/projects/library_management/src/library_management/SearchVauesDialogBox.java new file mode 100644 index 0000000..268228b --- /dev/null +++ b/projects/library_management/src/library_management/SearchVauesDialogBox.java @@ -0,0 +1,135 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JComboBox; +import java.awt.event.ActionListener; +import java.util.Vector; +import java.awt.event.ActionEvent; + +public class SearchVauesDialogBox extends JDialog { + + private final JPanel contentPanel = new JPanel(); + Vector vector; + public SearchVauesDialogBox(String value) { + setTitle("Dilaog Box"); + setBounds(100, 100, 393, 177); + setLocationRelativeTo(this); + getContentPane().setLayout(new BorderLayout()); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel, BorderLayout.CENTER); + + JLabel lblSelect = new JLabel("select "); + if(value.equalsIgnoreCase("author")) + { + vector=DBInfo.getAuthor(); + } + else if(value.equalsIgnoreCase("publisher")) + { + vector=DBInfo.getPublisher(); + } + else if(value.equalsIgnoreCase("category")) + { + vector=DBInfo.getCategory(); + } + else if(value.equalsIgnoreCase("subject")) + { + vector=DBInfo.getSubject(); + } + else + { + + } + + JComboBox comboBox = new JComboBox(vector); + GroupLayout gl_contentPanel = new GroupLayout(contentPanel); + gl_contentPanel.setHorizontalGroup( + gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(90) + .addComponent(lblSelect) + .addGap(39) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE) + .addContainerGap(133, Short.MAX_VALUE)) + ); + gl_contentPanel.setVerticalGroup( + gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(54) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.BASELINE) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblSelect)) + .addContainerGap(150, Short.MAX_VALUE)) + ); + contentPanel.setLayout(gl_contentPanel); + { + JPanel buttonPane = new JPanel(); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane, BorderLayout.SOUTH); + { + JButton okButton = new JButton("OK"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + + String s1=(String)comboBox.getSelectedItem(); + JFrame frm=new JFrame(); + + frm.setSize(900, 400); + frm.setLocationRelativeTo(frm); + frm.setDefaultCloseOperation(frm.DISPOSE_ON_CLOSE); + if(value.equalsIgnoreCase("author")) + { + DBInfo.getValuesA(s1); + } + else if(value.equalsIgnoreCase("publisher")) + { + DBInfo.getValuesP(s1); + } + else if(value.equalsIgnoreCase("category")) + { + DBInfo.getValuesC(s1); + } + else if(value.equalsIgnoreCase("subject")) + { + DBInfo.getValuesS(s1); + } + else + { + + } + JTable t=new JTable(DBInfo.outer, DBInfo.header); + JScrollPane pane=new JScrollPane(t); + frm.add(pane); + frm.setVisible(true); + dispose(); + + } + }); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + { + JButton cancelButton = new JButton("Cancel"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + dispose(); + } + }); + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + } + } + } +} diff --git a/projects/library_management/src/library_management/UserSection.java b/projects/library_management/src/library_management/UserSection.java new file mode 100644 index 0000000..5e36de1 --- /dev/null +++ b/projects/library_management/src/library_management/UserSection.java @@ -0,0 +1,143 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import java.awt.GridLayout; +import javax.swing.JButton; +import java.awt.Component; +import javax.swing.Box; +import java.awt.Button; +import javax.swing.LayoutStyle.ComponentPlacement; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class UserSection extends JFrame { + + private JPanel contentPane; + + /** + * Launch the application. + */ + + /** + * Create the frame. + */ + public UserSection(String nm) { + setTitle("USER SECTION"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 682, 446); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JButton btnViewAllBooks = new JButton("view all books"); + btnViewAllBooks.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + JFrame frm=new JFrame(); + + frm.setSize(900, 400); + frm.setLocationRelativeTo(frm); + frm.setDefaultCloseOperation(frm.DISPOSE_ON_CLOSE); + + DBInfo.getAllBooks(); + + JTable t=new JTable(DBInfo.outer, DBInfo.header); + JScrollPane pane=new JScrollPane(t); + frm.getContentPane().add(pane); + frm.setVisible(true); + } + }); + + JButton btnSearchBook = new JButton("search book"); + btnSearchBook.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + SearchBy obj=new SearchBy(); + obj.setVisible(true); + } + }); + + JButton btnViewProfile = new JButton("view profile"); + btnViewProfile.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String num=nm; + new view_profile(num).setVisible(true);; + + } + }); + + JButton btnChangePassword = new JButton("change password"); + btnChangePassword.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + new change_password_foruser().setVisible(true); + dispose(); + } + }); + + JButton btnFineToBe = new JButton("fine to be paid"); + btnFineToBe.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + new fine(nm).setVisible(true); + } + }); + + JButton btnNewButton = new JButton("books issued and submitted"); + btnNewButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + JFrame frm=new JFrame(); + + frm.setSize(900, 400); + frm.setLocationRelativeTo(frm); + frm.setDefaultCloseOperation(frm.DISPOSE_ON_CLOSE); + + DBInfo.Books(nm); + + JTable t=new JTable(DBInfo.outer, DBInfo.header); + JScrollPane pane=new JScrollPane(t); + frm.getContentPane().add(pane); + frm.setVisible(true); + dispose(); + } + }); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addComponent(btnViewAllBooks, GroupLayout.DEFAULT_SIZE, 311, Short.MAX_VALUE) + .addComponent(btnFineToBe, GroupLayout.DEFAULT_SIZE, 311, Short.MAX_VALUE) + .addComponent(btnViewProfile, GroupLayout.DEFAULT_SIZE, 311, Short.MAX_VALUE)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(btnSearchBook, GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE) + .addComponent(btnNewButton, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE) + .addComponent(btnChangePassword, GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE)) + .addContainerGap()) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false) + .addComponent(btnSearchBook, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(btnViewAllBooks, GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(btnChangePassword, GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE) + .addComponent(btnViewProfile, GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addComponent(btnNewButton, GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE) + .addComponent(btnFineToBe, GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE)) + .addContainerGap()) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/library_management/src/library_management/add_new_admin.java b/projects/library_management/src/library_management/add_new_admin.java new file mode 100644 index 0000000..f742161 --- /dev/null +++ b/projects/library_management/src/library_management/add_new_admin.java @@ -0,0 +1,262 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; + +import com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException; + +import javax.swing.JTextPane; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.JPasswordField; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.awt.event.ActionEvent; + +public class add_new_admin extends JFrame { + + private JPanel contentPane; + private JTextField textField_1; + private JTextField textField_2; + private JTextField textField_3; + private JPasswordField passwordField; + private JPasswordField passwordField_1; + private JTextField textField_5; + + /** + * Launch the application. + + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + add_new_admin frame = new add_new_admin(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + */ + public add_new_admin() { + setTitle("ADD NEW USER"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 444, 498); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblAddNewUser = new JLabel("Add New Admin"); + + JLabel lblName = new JLabel(" Admin Name"); + + textField_1 = new JTextField(); + textField_1.setColumns(10); + + JLabel label = new JLabel(""); + + JLabel lblMobileNo = new JLabel("Mobile No."); + + textField_2 = new JTextField(); + textField_2.setColumns(10); + + JLabel lblEmail = new JLabel("Email"); + + textField_3 = new JTextField(); + textField_3.setColumns(10); + + JLabel lblPassword = new JLabel("Password"); + + passwordField = new JPasswordField(); + + JLabel lblRetypePassword = new JLabel("ReType Password"); + + passwordField_1 = new JPasswordField(); + + JLabel label_1 = new JLabel(""); + + JLabel lblUserType = new JLabel("User Type"); + + textField_5 = new JTextField("admin"); + textField_5.setEditable(false); + textField_5.setColumns(10); + + JButton btnReset = new JButton("RESET"); + btnReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + + textField_5.setEditable(false); + passwordField.setText(null); + passwordField_1.setText(null); + + } + }); + + JButton btnAdd = new JButton("ADD"); + btnAdd.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + + String name=textField_1.getText(); + String no=textField_2.getText(); + String email=textField_3.getText(); + String utype=textField_5.getText(); + String pas=(String)passwordField.getText(); + String pas1=(String)passwordField_1.getText(); + + if(name.length()==0 || no.length()==0 || email.length()==0 || pas.length()==0 ) + { + JOptionPane.showMessageDialog(add_new_admin.this, "Pls fill/select all the fields", "Error", JOptionPane.ERROR_MESSAGE); + } + else if(!pas.equals(pas1)) + { + JOptionPane.showMessageDialog(add_new_admin.this, "password do not match", "Error", JOptionPane.ERROR_MESSAGE); + } + else + { + String query="insert into admin values(?,?,?,?,?)"; + + int flag=0; + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + + ps.setString(1, name); + ps.setString(2, pas); + ps.setString(3, utype); + ps.setString(4, no); + ps.setString(5, email); + flag=ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + + if(flag==1) + { + JOptionPane.showMessageDialog(add_new_admin.this, "Admin Added", "Added", JOptionPane.INFORMATION_MESSAGE); + + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + + textField_5.setText(null); + passwordField.setText(null); + passwordField_1.setText(null); + + + + + } + else + { + JOptionPane.showMessageDialog(add_new_admin.this, "Admin Not Added", "Error", JOptionPane.ERROR_MESSAGE); + } + + } + } + }); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(37) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(label) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblName) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING, false) + .addComponent(lblEmail, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(lblMobileNo, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(lblPassword, Alignment.LEADING) + .addComponent(lblRetypePassword, Alignment.LEADING) + .addComponent(lblUserType, Alignment.LEADING))) + .addGap(33) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(textField_5) + .addComponent(passwordField_1) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(textField_2) + .addComponent(lblAddNewUser) + .addComponent(textField_1) + .addComponent(textField_3, GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE)) + .addComponent(passwordField, GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE))))) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(217) + .addComponent(label_1)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(127) + .addComponent(btnReset) + .addGap(18) + .addComponent(btnAdd))) + .addGap(157)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(21) + .addComponent(lblAddNewUser) + .addGap(75) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addComponent(lblName) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(label) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(lblMobileNo)) + .addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(30) + .addComponent(lblEmail)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(18) + .addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblPassword) + .addComponent(passwordField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(25) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblRetypePassword) + .addComponent(passwordField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblUserType) + .addComponent(textField_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(53) + .addComponent(label_1) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnAdd) + .addComponent(btnReset)) + .addContainerGap(35, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/library_management/src/library_management/add_new_book.java b/projects/library_management/src/library_management/add_new_book.java new file mode 100644 index 0000000..9511278 --- /dev/null +++ b/projects/library_management/src/library_management/add_new_book.java @@ -0,0 +1,390 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JMenuBar; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.awt.event.ActionEvent; + +public class add_new_book extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JTextField textField_1; + private JTextField textField_2; + private JTextField textField_3; + private JTextField textField_4; + private JTextField textField_5; + + /** + * Launch the application. + + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + add_new_book frame = new add_new_book(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + + public String getBookId() + { + String id=" "; + for(int i=1;i<=6;i++) + { + id+=(int)(Math.random()*9)+1; + //System.out.println(id); + } + return id; + } + public add_new_book() { + setTitle("Add New Book"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 450, 567); + setLocationRelativeTo(this); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnAdd = new JMenu("add"); + menuBar.add(mnAdd); + + JMenuItem mntmAuthor = new JMenuItem("author"); + mntmAuthor.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String s1=arg0.getActionCommand(); + String str=JOptionPane.showInputDialog("Enter "+s1+" Name"); + int i=DBInfo.insertValueA(str); + if(i==1) + JOptionPane.showMessageDialog(add_new_book.this,s1+" added!!"); + else + JOptionPane.showMessageDialog(add_new_book.this,s1+" Not Added!!"); + dispose(); + new add_new_book().setVisible(true); + + + } + }); + mnAdd.add(mntmAuthor); + + JMenuItem mntmCategory = new JMenuItem("category"); + mntmCategory.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String s1=arg0.getActionCommand(); + String str=JOptionPane.showInputDialog("Enter "+s1+" Name"); + int i=DBInfo.insertValueC(str); + if(i==1) + JOptionPane.showMessageDialog(add_new_book.this,s1+" added!!"); + else + JOptionPane.showMessageDialog(add_new_book.this,s1+" Not Added!!"); + dispose(); + new add_new_book().setVisible(true); + } + }); + mnAdd.add(mntmCategory); + + JMenuItem mntmPublisher = new JMenuItem("publisher"); + mntmPublisher.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String s1=arg0.getActionCommand(); + String str=JOptionPane.showInputDialog("Enter "+s1+" Name"); + int i=DBInfo.insertValueP(str); + if(i==1) + JOptionPane.showMessageDialog(add_new_book.this,s1+" added!!"); + else + JOptionPane.showMessageDialog(add_new_book.this,s1+" Not Added!!"); + dispose(); + new add_new_book().setVisible(true); + } + }); + mnAdd.add(mntmPublisher); + + JMenuItem mntmSubject = new JMenuItem("subject"); + mntmSubject.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String s1=arg0.getActionCommand(); + String str=JOptionPane.showInputDialog("Enter "+s1+" Name"); + int i=DBInfo.insertValueS(str); + if(i==1) + JOptionPane.showMessageDialog(add_new_book.this,s1+" added!!"); + else + JOptionPane.showMessageDialog(add_new_book.this,s1+" Not Added!!"); + dispose(); + new add_new_book().setVisible(true); + } + }); + mnAdd.add(mntmSubject); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblAddBook = new JLabel("add book"); + + JLabel lblBookId = new JLabel("Book Id"); + + + // System.out.println(id); + + textField = new JTextField(getBookId()); + textField.setEditable(false); + textField.setColumns(10); + + JLabel lblName = new JLabel("Name"); + + textField_1 = new JTextField(); + textField_1.setColumns(10); + + JLabel lblAuthor = new JLabel("author"); + + JLabel lblPublisher = new JLabel("publisher"); + + JComboBox comboBox = new JComboBox(DBInfo.getPublisher()); + + comboBox.insertItemAt("Select",0); + comboBox.setSelectedIndex(0); + + JComboBox comboBox_1 = new JComboBox(DBInfo.getAuthor()); + + comboBox_1.insertItemAt("Select",0); + comboBox_1.setSelectedIndex(0); + JLabel lblCategory = new JLabel("category"); + + JComboBox comboBox_2 = new JComboBox(DBInfo.getCategory()); + comboBox_2.insertItemAt("Select",0); + comboBox_2.setSelectedIndex(0); + + JLabel lblSubject = new JLabel("subject"); + + JComboBox comboBox_3 = new JComboBox(DBInfo.getSubject()); + comboBox_3.insertItemAt("Select",0); + comboBox_3.setSelectedIndex(0); + + JLabel lblIsbnNumber = new JLabel("ISBN number"); + + textField_2 = new JTextField(); + textField_2.setColumns(10); + + JLabel lblEdition = new JLabel("edition"); + + textField_3 = new JTextField(); + textField_3.setColumns(10); + + JLabel lblPrice = new JLabel("price"); + + textField_4 = new JTextField(); + textField_4.setColumns(10); + + JLabel lblQuantity = new JLabel("quantity"); + + textField_5 = new JTextField(); + textField_5.setColumns(10); + + JButton btnReset = new JButton("RESET"); + btnReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + textField.setText(getBookId()); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + textField_5.setText(null); + comboBox.setSelectedIndex(0); + comboBox_1.setSelectedIndex(0); + comboBox_2.setSelectedIndex(0); + comboBox_3.setSelectedIndex(0); + } + }); + + JButton btnSave = new JButton("SAVE"); + btnSave.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent arg0) + { + + String id=textField.getText(); + String title=textField_1.getText(); + String author=(String)comboBox_1.getSelectedItem(); + String pub=(String)comboBox.getSelectedItem(); + String cat=(String)comboBox_2.getSelectedItem(); + String sub=(String)comboBox_3.getSelectedItem(); + String isbn=textField_2.getText(); + String edition=textField_3.getText(); + String price=textField_4.getText(); + String quantity=textField_5.getText(); + + if(id.length()==0 || title.length()==0 || author.equalsIgnoreCase("select") || pub.equalsIgnoreCase("select") || cat.equalsIgnoreCase("select") || sub.equalsIgnoreCase("select")|| isbn.length()==0 || edition.length()==0 || price.length()==0 || quantity.length()==0) + { + JOptionPane.showMessageDialog(add_new_book.this, "Pls fill/select all the fields", "Error", JOptionPane.ERROR_MESSAGE); + } + else + { + + + String query="insert into book_table values(?,?,?,?,?,?,?,?,?,?)"; + int flag=0; + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, id); + ps.setString(2, title); + ps.setString(3, author); + ps.setString(4, sub); + ps.setString(5, cat); + ps.setString(6, pub); + ps.setString(7, isbn); + ps.setString(8, edition); + ps.setString(9, price); + ps.setString(10,quantity); + flag=ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==1) + { + JOptionPane.showMessageDialog(add_new_book.this, "Book Added", "Added", JOptionPane.INFORMATION_MESSAGE); + textField.setText(getBookId()); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + textField_5.setText(null); + comboBox.setSelectedIndex(0); + comboBox_1.setSelectedIndex(0); + comboBox_2.setSelectedIndex(0); + comboBox_3.setSelectedIndex(0); + + + } + else + { + JOptionPane.showMessageDialog(add_new_book.this, "Book Not Added", "Error", JOptionPane.ERROR_MESSAGE); + } + + } + } + }); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(186) + .addComponent(lblAddBook) + .addContainerGap(194, Short.MAX_VALUE)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(94) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblBookId, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE) + .addComponent(lblName, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE) + .addComponent(lblAuthor) + .addComponent(lblPublisher) + .addComponent(lblCategory) + .addComponent(lblIsbnNumber) + .addComponent(lblSubject) + .addComponent(lblPrice) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addComponent(lblEdition, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE) + .addComponent(lblQuantity, Alignment.LEADING))) + .addGap(36) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(comboBox_1, 0, 184, Short.MAX_VALUE) + .addComponent(textField_5, GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE) + .addComponent(textField_4, GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE) + .addComponent(textField_3, GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE) + .addComponent(textField_2, GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE) + .addComponent(comboBox_3, 0, 184, Short.MAX_VALUE) + .addComponent(comboBox_2, 0, 184, Short.MAX_VALUE) + .addComponent(comboBox, 0, 184, Short.MAX_VALUE) + .addComponent(textField_1, 184, 184, Short.MAX_VALUE) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE)) + .addGap(52)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(103) + .addComponent(btnReset) + .addGap(65) + .addComponent(btnSave) + .addContainerGap(140, Short.MAX_VALUE)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(26) + .addComponent(lblAddBook) + .addGap(26) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblBookId, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblName) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblAuthor) + .addComponent(comboBox_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblPublisher) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblCategory) + .addComponent(comboBox_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(comboBox_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblSubject)) + .addGap(22) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblIsbnNumber) + .addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEdition) + .addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblPrice) + .addComponent(textField_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblQuantity) + .addComponent(textField_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED, 30, Short.MAX_VALUE) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnReset) + .addComponent(btnSave)) + .addGap(24)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/library_management/src/library_management/add_new_user.java b/projects/library_management/src/library_management/add_new_user.java new file mode 100644 index 0000000..5912fbf --- /dev/null +++ b/projects/library_management/src/library_management/add_new_user.java @@ -0,0 +1,313 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; + +import com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException; + +import javax.swing.JTextPane; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.JPasswordField; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.awt.event.ActionEvent; + +public class add_new_user extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JTextField textField_1; + private JTextField textField_2; + private JTextField textField_3; + private JTextField textField_4; + private JPasswordField passwordField; + private JPasswordField passwordField_1; + private JTextField textField_5; + + /** + * Launch the application. + + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + add_new_user frame = new add_new_user(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public String getUserId() + { + String id=" "; + for(int i=1;i<=8;i++) + { + id+=(int)(Math.random()*9)+1; + //System.out.println(id); + } + return id; + } + public add_new_user() { + setTitle("ADD NEW USER"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 444, 498); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblAddNewUser = new JLabel("Add New User"); + + JLabel lblUserId = new JLabel("User Id"); + + textField = new JTextField( getUserId()); + textField.setEditable(false); + + textField.setColumns(10); + + JLabel lblName = new JLabel("Name"); + + textField_1 = new JTextField(); + textField_1.setColumns(10); + + JLabel label = new JLabel(""); + + JLabel lblMobileNo = new JLabel("Mobile No."); + + textField_2 = new JTextField(); + textField_2.setColumns(10); + + JLabel lblEmail = new JLabel("Email"); + + textField_3 = new JTextField(); + textField_3.setColumns(10); + + JLabel lblUserName = new JLabel("User Name"); + + textField_4 = new JTextField(); + textField_4.setColumns(10); + + JLabel lblPassword = new JLabel("Password"); + + passwordField = new JPasswordField(); + + JLabel lblRetypePassword = new JLabel("ReType Password"); + + passwordField_1 = new JPasswordField(); + + JLabel label_1 = new JLabel(""); + + JLabel lblUserType = new JLabel("User Type"); + + textField_5 = new JTextField(); + textField_5.setColumns(10); + + JButton btnReset = new JButton("RESET"); + btnReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + textField.setText(getUserId()); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + textField_5.setText(null); + passwordField.setText(null); + passwordField_1.setText(null); + + } + }); + + JButton btnAdd = new JButton("ADD"); + btnAdd.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + String id=textField.getText(); + String name=textField_1.getText(); + String no=textField_2.getText(); + String email=textField_3.getText(); + String uname=textField_4.getText(); + String utype=textField_5.getText(); + String pas=(String)passwordField.getText(); + String pas1=(String)passwordField_1.getText(); + + if(id.length()==0 || name.length()==0 || no.length()==0 || email.length()==0 || uname.length()==0 || utype.length()==0 || pas.length()==0 ) + { + JOptionPane.showMessageDialog(add_new_user.this, "Pls fill/select all the fields", "Error", JOptionPane.ERROR_MESSAGE); + } + else if(!pas.equals(pas1)) + { + JOptionPane.showMessageDialog(add_new_user.this, "password do not match", "Error", JOptionPane.ERROR_MESSAGE); + } + else + { + String query="insert into registeration values(?,?,?,?,?)"; + String query1="insert into login values(?,?,?,?)"; + int flag=0; + int flag1=0; + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, id); + ps.setString(2, name); + ps.setString(3, no); + ps.setString(4, email); + ps.setString(5, uname); + flag=ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + try + { + PreparedStatement ps=con.prepareStatement(query1); + ps.setString(1, uname); + ps.setString(2, pas); + ps.setString(3, utype); + ps.setString(4, id); + flag1=ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + + } + if(flag==1&& flag1==1) + { + JOptionPane.showMessageDialog(add_new_user.this, "User Added", "Added", JOptionPane.INFORMATION_MESSAGE); + textField.setText(getUserId()); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + textField_5.setText(null); + passwordField.setText(null); + passwordField_1.setText(null); + + + + + } + else + { + JOptionPane.showMessageDialog(add_new_user.this, "User Not Added", "Error", JOptionPane.ERROR_MESSAGE); + } + + } + } + }); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(37) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(label) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblUserId, GroupLayout.PREFERRED_SIZE, 73, GroupLayout.PREFERRED_SIZE) + .addComponent(lblName) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING, false) + .addComponent(lblEmail, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(lblMobileNo, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(lblUserName)) + .addComponent(lblPassword) + .addComponent(lblRetypePassword) + .addComponent(lblUserType)) + .addGap(33) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false) + .addComponent(textField_5) + .addComponent(passwordField_1) + .addComponent(passwordField) + .addComponent(textField_4, Alignment.TRAILING) + .addComponent(textField_3) + .addComponent(textField_2) + .addComponent(lblAddNewUser) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 185, Short.MAX_VALUE) + .addComponent(textField_1))))) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(217) + .addComponent(label_1)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(127) + .addComponent(btnReset) + .addGap(18) + .addComponent(btnAdd))) + .addContainerGap(77, Short.MAX_VALUE)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(21) + .addComponent(lblAddNewUser) + .addGap(43) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblUserId) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addComponent(lblName) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(label) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(lblMobileNo)) + .addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(30) + .addComponent(lblEmail)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(18) + .addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblUserName) + .addComponent(textField_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblPassword) + .addComponent(passwordField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblRetypePassword) + .addComponent(passwordField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblUserType) + .addComponent(textField_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(10) + .addComponent(label_1) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnAdd) + .addComponent(btnReset)) + .addContainerGap(23, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/library_management/src/library_management/cal_fine.java b/projects/library_management/src/library_management/cal_fine.java new file mode 100644 index 0000000..218b028 --- /dev/null +++ b/projects/library_management/src/library_management/cal_fine.java @@ -0,0 +1,98 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.JTextField; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; +import javax.swing.JLabel; +import javax.swing.LayoutStyle.ComponentPlacement; + +public class cal_fine extends JDialog { + + private final JPanel contentPanel = new JPanel(); + private JTextField textField; + + /** + * Launch the application. + + public static void main(String[] args) { + try { + cal_fine dialog = new cal_fine(); + dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + dialog.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Create the dialog. + */ + public cal_fine() { + setBounds(100, 100, 450, 300); + getContentPane().setLayout(new BorderLayout()); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel, BorderLayout.CENTER); + JLabel lblEnterUserName = new JLabel("enter user name"); + textField = new JTextField(); + textField.setColumns(10); + GroupLayout gl_contentPanel = new GroupLayout(contentPanel); + gl_contentPanel.setHorizontalGroup( + gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(52) + .addComponent(lblEnterUserName, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, 192, GroupLayout.PREFERRED_SIZE) + .addContainerGap(62, Short.MAX_VALUE)) + ); + gl_contentPanel.setVerticalGroup( + gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(88) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnterUserName, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addContainerGap(100, Short.MAX_VALUE)) + ); + contentPanel.setLayout(gl_contentPanel); + { + JPanel buttonPane = new JPanel(); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane, BorderLayout.SOUTH); + { + JButton okButton = new JButton("OK"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + + String mm=textField.getText(); + new fine(mm).setVisible(true); + } + + }); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + { + JButton cancelButton = new JButton("Cancel"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + dispose(); + } + }); + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + } + } + } + +} diff --git a/projects/library_management/src/library_management/change_password_dialog.java b/projects/library_management/src/library_management/change_password_dialog.java new file mode 100644 index 0000000..1e48ef6 --- /dev/null +++ b/projects/library_management/src/library_management/change_password_dialog.java @@ -0,0 +1,140 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import java.awt.event.ActionListener; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.awt.event.ActionEvent; + +public class change_password_dialog extends JDialog { + + private final JPanel contentPanel = new JPanel(); + private JLabel label; + private JTextField textField; + private JTextField textField_1; + + + public change_password_dialog() { + setTitle("CHANGE PASSWORD"); + setBounds(100, 100, 450, 221); + setLocationRelativeTo(this); + getContentPane().setLayout(new BorderLayout()); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel, BorderLayout.CENTER); + { + label = new JLabel(""); + } + JLabel lblEnterUserName = new JLabel("Enter User Name"); + textField = new JTextField(); + textField.setColumns(10); + JLabel lblEnterPassword = new JLabel("Enter password"); + textField_1 = new JTextField(); + textField_1.setColumns(10); + GroupLayout gl_contentPanel = new GroupLayout(contentPanel); + gl_contentPanel.setHorizontalGroup( + gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(212) + .addComponent(label)) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(21) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addComponent(lblEnterUserName, GroupLayout.PREFERRED_SIZE, 141, GroupLayout.PREFERRED_SIZE) + .addComponent(lblEnterPassword, GroupLayout.PREFERRED_SIZE, 124, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING, false) + .addComponent(textField_1) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE)))) + .addContainerGap(60, Short.MAX_VALUE)) + ); + gl_contentPanel.setVerticalGroup( + gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(5) + .addComponent(label) + .addGap(39) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnterUserName, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnterPassword) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addContainerGap(24, Short.MAX_VALUE)) + ); + contentPanel.setLayout(gl_contentPanel); + { + JPanel buttonPane = new JPanel(); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane, BorderLayout.SOUTH); + { + JButton okButton = new JButton("OK"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String unm=textField.getText(); + String pas=textField_1.getText(); + String pass=""; + String query= "select * from admin where admin_name=?"; + int flag=0; + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ps.setString(1,unm );; + ResultSet res=ps.executeQuery(); + while(res.next()) + { + flag=1; + pass=res.getString(2); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==0) + { + JOptionPane.showMessageDialog(getParent(), "No User name Found!", "Error", JOptionPane.ERROR_MESSAGE); + } + else if(!pas.equals(pass)) + { + JOptionPane.showMessageDialog(getParent(), "password do not match", "Error", JOptionPane.ERROR_MESSAGE); + } + else + { + new password_dialog(unm).setVisible(true); + dispose(); + } + } + }); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + { + JButton cancelButton = new JButton("Cancel"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + dispose(); + } + }); + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + } + } + } + +} diff --git a/projects/library_management/src/library_management/change_password_foruser.java b/projects/library_management/src/library_management/change_password_foruser.java new file mode 100644 index 0000000..741a6a6 --- /dev/null +++ b/projects/library_management/src/library_management/change_password_foruser.java @@ -0,0 +1,140 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import java.awt.event.ActionListener; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.awt.event.ActionEvent; + +public class change_password_foruser extends JDialog { + + private final JPanel contentPanel = new JPanel(); + private JLabel label; + private JTextField textField; + private JTextField textField_1; + + + public change_password_foruser() { + setTitle("CHANGE PASSWORD"); + setBounds(100, 100, 450, 221); + setLocationRelativeTo(this); + getContentPane().setLayout(new BorderLayout()); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel, BorderLayout.CENTER); + { + label = new JLabel(""); + } + JLabel lblEnterUserName = new JLabel("Enter User Name"); + textField = new JTextField(); + textField.setColumns(10); + JLabel lblEnterPassword = new JLabel("Enter password"); + textField_1 = new JTextField(); + textField_1.setColumns(10); + GroupLayout gl_contentPanel = new GroupLayout(contentPanel); + gl_contentPanel.setHorizontalGroup( + gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(212) + .addComponent(label)) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(21) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addComponent(lblEnterUserName, GroupLayout.PREFERRED_SIZE, 141, GroupLayout.PREFERRED_SIZE) + .addComponent(lblEnterPassword, GroupLayout.PREFERRED_SIZE, 124, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING, false) + .addComponent(textField_1) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE)))) + .addContainerGap(60, Short.MAX_VALUE)) + ); + gl_contentPanel.setVerticalGroup( + gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(5) + .addComponent(label) + .addGap(39) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnterUserName, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnterPassword) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addContainerGap(24, Short.MAX_VALUE)) + ); + contentPanel.setLayout(gl_contentPanel); + { + JPanel buttonPane = new JPanel(); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane, BorderLayout.SOUTH); + { + JButton okButton = new JButton("OK"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String unm=textField.getText(); + String pas=textField_1.getText(); + String pass=""; + String query= "select * from login where username=?"; + int flag=0; + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ps.setString(1,unm );; + ResultSet res=ps.executeQuery(); + while(res.next()) + { + flag=1; + pass=res.getString(2); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==0) + { + JOptionPane.showMessageDialog(getParent(), "No User name Found!", "Error", JOptionPane.ERROR_MESSAGE); + } + else if(!pas.equals(pass)) + { + JOptionPane.showMessageDialog(getParent(), "password do not match", "Error", JOptionPane.ERROR_MESSAGE); + } + else + { + new password_dialog_foruser(unm).setVisible(true); + dispose(); + } + } + }); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + { + JButton cancelButton = new JButton("Cancel"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + dispose(); + } + }); + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + } + } + } + +} diff --git a/projects/library_management/src/library_management/fine.java b/projects/library_management/src/library_management/fine.java new file mode 100644 index 0000000..a967eaf --- /dev/null +++ b/projects/library_management/src/library_management/fine.java @@ -0,0 +1,111 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.EventQueue; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.JLabel; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; + +public class fine extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JLabel lblFine; + private JTextField textField_1; + + + + /** + * Create the frame. + */ + public fine(String nm) { + setTitle("FINE TO BE PAID"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 450, 300); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblUserName = new JLabel("USER NAME"); + + textField = new JTextField(nm); + textField.setEditable(false); + textField.setColumns(10); + + + Date idate = null; + Date sdate = null; + int f=0;; + int days=0; + String query="select * from issue where username=? "; + int flag=0; + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ps.setString(1, nm); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + flag=1; + idate=res.getDate(2); + sdate=res.getDate(4); + break; + } + } + catch(Exception e) + { + e.printStackTrace(); + } + days=sdate.getDate()-idate.getDate(); + //System.out.println(days); + if(days>7) + { + days=days-7; + f=days*10; + } + //System.out.println(f); + + lblFine = new JLabel("fine"); + textField_1 = new JTextField(""+f); + textField_1.setEditable(false); + textField_1.setColumns(10); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(47) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblUserName, GroupLayout.PREFERRED_SIZE, 101, GroupLayout.PREFERRED_SIZE) + .addComponent(lblFine, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false) + .addComponent(textField_1) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 211, Short.MAX_VALUE)) + .addContainerGap(61, Short.MAX_VALUE)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(64) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblUserName, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(36) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addComponent(lblFine) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addContainerGap(108, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/library_management/src/library_management/issue.java b/projects/library_management/src/library_management/issue.java new file mode 100644 index 0000000..b342a33 --- /dev/null +++ b/projects/library_management/src/library_management/issue.java @@ -0,0 +1,219 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.awt.event.ActionEvent; + +public class issue extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JTextField textField_1; + + /** + * Launch the application. + + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + issue frame = new issue(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public issue() { + setTitle("ISSUE BOOK"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 450, 251); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblEnterBookId = new JLabel("Enter book id"); + + JLabel label = new JLabel(""); + + textField = new JTextField(); + textField.setColumns(10); + + JButton btnIssue = new JButton("ISSUE"); + btnIssue.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String id=textField.getText(); + String usrn=textField_1.getText(); + int qty=0; + int flag=0; + String qty1; + LocalDate d1=java.time.LocalDate.now(); + String s=d1.toString(); + System.out.println(d1); + + String query="select * from book_table where bookid=?"; + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ps.setString(1, id); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + + qty=res.getInt(10); + break; + } + + } + catch(Exception e) + { + e.printStackTrace(); + } + + if(qty>0) + { + flag=1; + } + if(flag==0) + { + JOptionPane.showMessageDialog(issue.this, "book currently not available", "Error", JOptionPane.ERROR_MESSAGE); + } + else + { + JOptionPane.showMessageDialog(issue.this, "book issued", "Success", JOptionPane.INFORMATION_MESSAGE); + textField.setText(null); + textField_1.setText(null); + String query1=" update book_table set quantity=? where bookid=?"; + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query1); + qty--; + ps.setLong(1, qty); + ps.setString(2, id); + ps.executeUpdate(); + } + catch(Exception e) + { + e.printStackTrace(); + } + String query2="insert into issue values(?,?,?,?,?) "; + + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query2); + ps.setString(1, id); + ps.setString(2, s); + ps.setString(3, "not submitted"); + ps.setDate(4, null); + ps.setString(5, usrn); + + ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + } + } + + private Date valueOf(LocalDate d1) { + // TODO Auto-generated method stub + return null; + } + + private Date sysdate() { + // TODO Auto-generated method stub + return null; + } + }); + + JButton btnReset = new JButton("RESET"); + btnReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + textField.setText(null); + + + } + }); + + JLabel lblEnterUserName = new JLabel("enter user name"); + + textField_1 = new JTextField(); + textField_1.setColumns(10); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(Alignment.TRAILING, gl_contentPane.createSequentialGroup() + .addGap(54) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblEnterBookId) + .addGap(59) + .addComponent(label)) + .addComponent(lblEnterUserName, GroupLayout.PREFERRED_SIZE, 94, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false) + .addComponent(textField_1) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE))) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(btnIssue, GroupLayout.PREFERRED_SIZE, 123, GroupLayout.PREFERRED_SIZE) + .addGap(39) + .addComponent(btnReset, GroupLayout.PREFERRED_SIZE, 117, GroupLayout.PREFERRED_SIZE) + .addGap(21))) + .addGap(74)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(52) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnterBookId) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(60) + .addComponent(label))) + .addGap(37) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnterUserName) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnIssue) + .addComponent(btnReset)) + .addGap(32)) + ); + contentPane.setLayout(gl_contentPane); + } + +} diff --git a/projects/library_management/src/library_management/login_page_firstpage.java b/projects/library_management/src/library_management/login_page_firstpage.java new file mode 100644 index 0000000..c2a5daf --- /dev/null +++ b/projects/library_management/src/library_management/login_page_firstpage.java @@ -0,0 +1,209 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.awt.event.ActionEvent; +import javax.swing.JComboBox; + +public class login_page_firstpage extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JTextField textField_1; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + login_page_firstpage frame = new login_page_firstpage(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public login_page_firstpage() { + setTitle("LOGIN PAGE"); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 450, 300); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblEnterUserName = new JLabel("Enter user name"); + + textField = new JTextField(); + textField.setColumns(10); + + JLabel lblEnterPassword = new JLabel("Enter password"); + + textField_1 = new JTextField(); + textField_1.setColumns(10); + + JButton btnLogin = new JButton("LOGIN"); + String values[]= {"admin","other"}; + JComboBox comboBox = new JComboBox(values); + btnLogin.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String nm=textField.getText(); + String pass=textField_1.getText(); + String ut=(String)comboBox.getSelectedItem(); + if(ut.equalsIgnoreCase("admin")) + { + String query="select * from admin where admin_name=? and password=?"; + int flag=0; + + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + + ps.setString(1, nm); + ps.setString(2, pass); + ResultSet p =ps.executeQuery(); + if(p.next()) + flag=1; + + + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==1) + { + new AdminSection().setVisible(true); + textField.setText(null); + textField_1.setText(null); + comboBox.setSelectedIndex(0); + } + else + { + JOptionPane.showMessageDialog(login_page_firstpage.this, "SORRY!no such admin found", "Error", JOptionPane.ERROR_MESSAGE); + textField.setText(null); + textField_1.setText(null); + comboBox.setSelectedIndex(0); + } + } + else + { + + String query="select * from login where username=? and password=?"; + int flag=0; + + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + + ps.setString(1, nm); + ps.setString(2, pass); + ResultSet p =ps.executeQuery(); + if(p.next()) + flag=1; + + + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==1) + { + new UserSection(nm).setVisible(true); + textField.setText(null); + textField_1.setText(null); + comboBox.setSelectedIndex(0); + } + else + { + JOptionPane.showMessageDialog(login_page_firstpage.this, "SORRY!no such user found", "Error", JOptionPane.ERROR_MESSAGE); + textField.setText(null); + textField_1.setText(null); + comboBox.setSelectedIndex(0); + } + }} + }); + + JButton btnNewUser = new JButton("NEW USER"); + btnNewUser.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + new add_new_user().setVisible(true); + + } + }); + + JLabel lblUserType = new JLabel("User type"); + + + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(34) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING, false) + .addComponent(lblEnterPassword, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(lblEnterUserName, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE) + .addComponent(lblUserType, Alignment.LEADING)) + .addGap(32) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false) + .addComponent(comboBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(textField_1, Alignment.TRAILING) + .addComponent(textField, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 195, Short.MAX_VALUE))) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(86) + .addComponent(btnLogin, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE) + .addGap(51) + .addComponent(btnNewUser))) + .addContainerGap(32, Short.MAX_VALUE)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(41) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnterUserName) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(28) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnterPassword) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(32) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblUserType) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(43) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnLogin) + .addComponent(btnNewUser)) + .addContainerGap(24, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/library_management/src/library_management/password_dialog.java b/projects/library_management/src/library_management/password_dialog.java new file mode 100644 index 0000000..ec9f724 --- /dev/null +++ b/projects/library_management/src/library_management/password_dialog.java @@ -0,0 +1,150 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.awt.event.ActionEvent; + +public class password_dialog extends JDialog { + + private final JPanel contentPanel = new JPanel(); + private JTextField textField; + private JTextField textField_1; + + /** + * Launch the application. + */ + + + /** + * Create the dialog. + */ + public password_dialog(String name) { + setTitle("change password"); + setBounds(100, 100, 450, 212); + getContentPane().setLayout(new BorderLayout()); + setLocationRelativeTo(this); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel, BorderLayout.CENTER); + JLabel lblEnterNewPassword = new JLabel("Enter new password"); + textField = new JTextField(); + textField.setColumns(10); + JLabel lblRetypePassword = new JLabel("Retype Password"); + textField_1 = new JTextField(); + textField_1.setColumns(10); + GroupLayout gl_contentPanel = new GroupLayout(contentPanel); + gl_contentPanel.setHorizontalGroup( + gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(33) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addComponent(lblEnterNewPassword, GroupLayout.PREFERRED_SIZE, 148, GroupLayout.PREFERRED_SIZE) + .addComponent(lblRetypePassword, GroupLayout.PREFERRED_SIZE, 179, GroupLayout.PREFERRED_SIZE)) + .addGap(30) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING, false) + .addComponent(textField_1) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)) + .addContainerGap(23, Short.MAX_VALUE)) + ); + gl_contentPanel.setVerticalGroup( + gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(38) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnterNewPassword) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(18) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(29) + .addComponent(lblRetypePassword))) + .addContainerGap(29, Short.MAX_VALUE)) + ); + contentPanel.setLayout(gl_contentPanel); + { + JPanel buttonPane = new JPanel(); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane, BorderLayout.SOUTH); + { + JButton okButton = new JButton("OK"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String pass=textField.getText(); + String pass_1=textField_1.getText(); + if(!pass.equals(pass_1)| pass.length()==0 || pass_1.length()==0) + { + JOptionPane.showMessageDialog(getParent(), "password do not match", "Error", JOptionPane.ERROR_MESSAGE); + textField.setText(null); + textField_1.setText(null); + } + else + { + String query="update admin set password=? where admin_name=?"; + int flag=0; + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + + ps.setString(1, pass); + ps.setString(2, name); + flag=ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==1) + { + JOptionPane.showMessageDialog(password_dialog.this, "password changed!!", "Success", JOptionPane.INFORMATION_MESSAGE); + dispose(); + + } + + } + } + }); + + JButton btnReset = new JButton("RESET"); + btnReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + textField.setText(null); + textField_1.setText(null); + } + + }); + buttonPane.add(btnReset); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + { + JButton cancelButton = new JButton("Cancel"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + dispose(); + } + }); + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + } + } + } + +} diff --git a/projects/library_management/src/library_management/password_dialog_foruser.java b/projects/library_management/src/library_management/password_dialog_foruser.java new file mode 100644 index 0000000..be5cc35 --- /dev/null +++ b/projects/library_management/src/library_management/password_dialog_foruser.java @@ -0,0 +1,150 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.awt.event.ActionEvent; + +public class password_dialog_foruser extends JDialog { + + private final JPanel contentPanel = new JPanel(); + private JTextField textField; + private JTextField textField_1; + + /** + * Launch the application. + */ + + + /** + * Create the dialog. + */ + public password_dialog_foruser(String name) { + setTitle("change password"); + setBounds(100, 100, 450, 212); + getContentPane().setLayout(new BorderLayout()); + setLocationRelativeTo(this); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel, BorderLayout.CENTER); + JLabel lblEnterNewPassword = new JLabel("Enter new password"); + textField = new JTextField(); + textField.setColumns(10); + JLabel lblRetypePassword = new JLabel("Retype Password"); + textField_1 = new JTextField(); + textField_1.setColumns(10); + GroupLayout gl_contentPanel = new GroupLayout(contentPanel); + gl_contentPanel.setHorizontalGroup( + gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(33) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addComponent(lblEnterNewPassword, GroupLayout.PREFERRED_SIZE, 148, GroupLayout.PREFERRED_SIZE) + .addComponent(lblRetypePassword, GroupLayout.PREFERRED_SIZE, 179, GroupLayout.PREFERRED_SIZE)) + .addGap(30) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING, false) + .addComponent(textField_1) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)) + .addContainerGap(23, Short.MAX_VALUE)) + ); + gl_contentPanel.setVerticalGroup( + gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(38) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnterNewPassword) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(18) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(29) + .addComponent(lblRetypePassword))) + .addContainerGap(29, Short.MAX_VALUE)) + ); + contentPanel.setLayout(gl_contentPanel); + { + JPanel buttonPane = new JPanel(); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane, BorderLayout.SOUTH); + { + JButton okButton = new JButton("OK"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String pass=textField.getText(); + String pass_1=textField_1.getText(); + if(!pass.equals(pass_1)| pass.length()==0 || pass_1.length()==0) + { + JOptionPane.showMessageDialog(getParent(), "password do not match", "Error", JOptionPane.ERROR_MESSAGE); + textField.setText(null); + textField_1.setText(null); + } + else + { + String query="update login set password=? where username=?"; + int flag=0; + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + + ps.setString(1, pass); + ps.setString(2, name); + flag=ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==1) + { + JOptionPane.showMessageDialog(password_dialog_foruser.this, "password changed!!", "Success", JOptionPane.INFORMATION_MESSAGE); + dispose(); + + } + + } + } + }); + + JButton btnReset = new JButton("RESET"); + btnReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + textField.setText(null); + textField_1.setText(null); + } + + }); + buttonPane.add(btnReset); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + { + JButton cancelButton = new JButton("Cancel"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + dispose(); + } + }); + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + } + } + } + +} diff --git a/projects/library_management/src/library_management/submit.java b/projects/library_management/src/library_management/submit.java new file mode 100644 index 0000000..37417e8 --- /dev/null +++ b/projects/library_management/src/library_management/submit.java @@ -0,0 +1,151 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.JButton; +import javax.swing.LayoutStyle.ComponentPlacement; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.time.LocalDate; +import java.awt.event.ActionEvent; + +public class submit extends JFrame { + + private JPanel contentPane; + private JTextField textField; + + /** + * Launch the application. + + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + submit frame = new submit(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public submit() { + setTitle("SUBMIT BOOK"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 450, 300); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblEnterBookId = new JLabel("Enter book id"); + + textField = new JTextField(); + textField.setColumns(10); + + JButton btnSubmit = new JButton("SUBMIT"); + btnSubmit.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String id=textField.getText(); + int flag=0; + LocalDate d1=java.time.LocalDate.now(); + String s=d1.toString(); + String query="update issue set status=?,submit_date=? where bookid=?"; + + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1,"sumitted"); + ps.setString(2, s); + ps.setString(3, id); + flag=ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==1) + { + + String query2=" update book_table set quantity=quantity+1 where bookid=?"; + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query2); + ps.setString(1, id); + ps.executeUpdate(); + } + catch(Exception e) + { + e.printStackTrace(); + } + JOptionPane.showMessageDialog(submit.this, "book submitted", "Success", JOptionPane.INFORMATION_MESSAGE); + } + else + { + JOptionPane.showMessageDialog(submit.this, "book not submitted", "Failure", JOptionPane.ERROR_MESSAGE); + } + } + + private String sysdate() { + // TODO Auto-generated method stub + return null; + } + }); + + JButton btnReset = new JButton("RESET"); + btnReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + textField.setText(null); + } + }); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(43) + .addComponent(lblEnterBookId, GroupLayout.PREFERRED_SIZE, 106, GroupLayout.PREFERRED_SIZE) + .addGap(37) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, 203, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(64) + .addComponent(btnSubmit, GroupLayout.PREFERRED_SIZE, 139, GroupLayout.PREFERRED_SIZE) + .addGap(42) + .addComponent(btnReset, GroupLayout.PREFERRED_SIZE, 116, GroupLayout.PREFERRED_SIZE))) + .addContainerGap(35, Short.MAX_VALUE)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(80) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnterBookId) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(45) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnSubmit) + .addComponent(btnReset)) + .addContainerGap(83, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/library_management/src/library_management/view_profile.java b/projects/library_management/src/library_management/view_profile.java new file mode 100644 index 0000000..3db5cdd --- /dev/null +++ b/projects/library_management/src/library_management/view_profile.java @@ -0,0 +1,159 @@ +package library_management; + +import java.awt.BorderLayout; +import java.awt.EventQueue; +import java.sql.PreparedStatement; +import java.sql.ResultSet; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; + +public class view_profile extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JTextField textField_1; + private JTextField textField_2; + private JTextField textField_3; + private JTextField textField_4; + + + public view_profile(String num) { + setTitle("VIEW PROFILE"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 450, 429); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + + JLabel lblUserName = new JLabel("User name"); + + JLabel label = new JLabel(""); + + textField = new JTextField(num); + textField.setEditable(false); + textField.setColumns(10); + + JLabel lblUserId = new JLabel("User Id"); + + textField_1 = new JTextField(); + textField_1.setColumns(10); + textField_1.setEditable(false); + + JLabel lblName = new JLabel("Name"); + + textField_2 = new JTextField(); + textField_2.setColumns(10); + textField_2.setEditable(false); + JLabel lblMobileNo = new JLabel("Mobile No."); + + textField_3 = new JTextField(); + textField_3.setColumns(10); + textField_3.setEditable(false); + JLabel lblEmail = new JLabel("Email."); + + textField_4 = new JTextField(); + textField_4.setColumns(10); + textField_4.setEditable(false); + String query="select * from registeration where username=?"; + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ps.setString(1, num); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + String name=res.getString(2); + String mob=res.getString(3); + String email=res.getString(4); + String id=res.getString(1); + textField_1.setText(id); + textField_2.setText(name); + textField_3.setText(mob); + textField_4.setText(email); + break; + + + } + + } + catch(Exception e) + { + e.printStackTrace(); + } + + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(53) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblEmail) + .addContainerGap()) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblName, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblUserName, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(45) + .addComponent(label) + .addContainerGap(245, Short.MAX_VALUE)) + .addGroup(gl_contentPane.createSequentialGroup() + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING, false) + .addComponent(textField_1, Alignment.LEADING) + .addComponent(textField, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 182, Short.MAX_VALUE) + .addComponent(textField_2, Alignment.LEADING) + .addComponent(textField_3, Alignment.LEADING) + .addComponent(textField_4, Alignment.LEADING)) + .addGap(63)))) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING, false) + .addComponent(lblMobileNo, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(lblUserId, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE)) + .addContainerGap()))))) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(62) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblUserName) + .addComponent(label) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(27) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblUserId) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(29) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblName) + .addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(35) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblMobileNo) + .addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(34) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEmail) + .addComponent(textField_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addContainerGap(99, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } + +} diff --git a/projects/onlinebookstore-gh-pages/.classpath b/projects/onlinebookstore-gh-pages/.classpath new file mode 100644 index 0000000..09995db --- /dev/null +++ b/projects/onlinebookstore-gh-pages/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/projects/onlinebookstore-gh-pages/.project b/projects/onlinebookstore-gh-pages/.project new file mode 100644 index 0000000..1331010 --- /dev/null +++ b/projects/onlinebookstore-gh-pages/.project @@ -0,0 +1,17 @@ + + + onlinebookstore-gh-pages + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/AddBook.html b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/AddBook.html new file mode 100644 index 0000000..f86223b --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/AddBook.html @@ -0,0 +1,125 @@ + + + + Book Store + + + +
    +

    Welcome to Online Book Store

    +
    + +
    + Home +
    + +
    + Login +
    + + + +
    + Logout +
    + + + + + +
    Add Books
    + + + + + +
    +
    + Book Code :

    + Book Name :

    + BookAuthor:

    + Book Price:

    + Book Qnty :

    + +
    +
    + + + + + +
    Back To Home Page
    + + + + \ No newline at end of file diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/AdminLogin.html b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/AdminLogin.html new file mode 100644 index 0000000..ab8a7ea --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/AdminLogin.html @@ -0,0 +1,119 @@ + + + + Book Store + + + + +
    +

    Welcome to Online Book Store

    +
    + +
    + Home +
    + +
    + Login +
    + + + +
    + Logout +
    + + + + + +
    ADMIN LOGIN
    + + + + + + + +
    +
    + Username:

    + Password:

    + +
    +
    + + + + \ No newline at end of file diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/META-INF/MANIFEST.MF b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 0000000..254272e --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/Photo.jpg b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/Photo.jpg new file mode 100644 index 0000000..9c07b8c Binary files /dev/null and b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/Photo.jpg differ diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/RemoveBooks.html b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/RemoveBooks.html new file mode 100644 index 0000000..e19f826 --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/RemoveBooks.html @@ -0,0 +1,103 @@ + + + + Book Store + + + +
    +

    Welcome to Online Book Store

    +
    +
    + Home +
    + +
    + Login +
    + + + +
    + Logout +
    + +
    +
    + Book Code: + +
    +
    + + + \ No newline at end of file diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/Sample.html b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/Sample.html new file mode 100644 index 0000000..78baaed --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/Sample.html @@ -0,0 +1,96 @@ + + + + Book Store + + + +
    +

    Welcome to Online Book Store

    +
    +
    + Home +
    + +
    + Login +
    + + + +
    + Logout +
    + + + \ No newline at end of file diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/UserLogin.html b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/UserLogin.html new file mode 100644 index 0000000..12e04ae --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/UserLogin.html @@ -0,0 +1,117 @@ + + + + Book Store + + + +
    +

    Welcome to Online Book Store

    +
    +
    + Home +
    + +
    + Login +
    + + + +
    + Logout +
    + + + + + +
    USER LOGIN
    + + + + + + + +
    +
    + Username:

    + Password:

    + +
    +
    + + + + \ No newline at end of file diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/UserRegister.html b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/UserRegister.html new file mode 100644 index 0000000..7dd1cca --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/UserRegister.html @@ -0,0 +1,127 @@ + + + + Book Store + + + + +
    +

    Welcome to Online Book Store

    +
    +
    + Home +
    + +
    + Login +
    + + + +
    + Logout +
    + + + + + +
    Register Here
    + + + + + + + +
    +
    + Username :

    + Password :

    + FirstName:

    + Last Name:

    + Addrress :

    + Phone No :

    + Email Id :

    + +
    +
    + + + + + \ No newline at end of file diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/ViewBooks.html b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/ViewBooks.html new file mode 100644 index 0000000..a920f24 --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/ViewBooks.html @@ -0,0 +1,116 @@ + + + + Book Store + + + +
    +

    Welcome to Online Book Store

    +
    +
    + Home +
    + +
    + Login +
    + + + +
    + Logout +
    + + + \ No newline at end of file diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/WEB-INF/lib/ojdbc5.jar b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/WEB-INF/lib/ojdbc5.jar new file mode 100644 index 0000000..1b899e6 Binary files /dev/null and b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/WEB-INF/lib/ojdbc5.jar differ diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/WEB-INF/web.xml b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/WEB-INF/web.xml new file mode 100644 index 0000000..a2ba354 --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/WEB-INF/web.xml @@ -0,0 +1,78 @@ + + + + AdminLoginServlet + test.AdminLoginServlet + + +AdminLoginServlet +/adminlog + + + +UserLoginServlet +test.UserLoginServlet + + +UserLoginServlet +/userlog + + + +UserRegisterServlet +test.UserRegisterServlet + + +UserRegisterServlet +/userreg + + + +RemoveBookServlet +test.RemoveBookServlet + + +RemoveBookServlet +/remove + + + +AddBookServlet +test.AddBookServlet + + +AddBookServlet +/addbook + + + +ViewBookServlet +test.ViewBookServlet + + +ViewBookServlet +/viewbook + + + +BuyBooksServlet +test.BuyBooksServlet + + +BuyBooksServlet +/buybook + + + +ReceiptServlet +test.ReceiptServlet + + +ReceiptServlet +/buys + + + + index.html + + \ No newline at end of file diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/index.html b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/index.html new file mode 100644 index 0000000..813528f --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/WebContent/index.html @@ -0,0 +1,122 @@ + + + + Book Store + + + + +
    +

    Welcome to Online Book Store

    +
    + +
    + Home +
    + +
    + Login +
    + + + +
    + Logout +
    + + + + + +
    Login or Signup Below
    + + + + + + +
    Login As Admin
    + + + + + +
    Login As User
    + + + + +
    New user ! Register Here
    + + + \ No newline at end of file diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/AddBookServlet.class b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/AddBookServlet.class new file mode 100644 index 0000000..95211d6 Binary files /dev/null and b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/AddBookServlet.class differ diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/AdminLoginServlet.class b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/AdminLoginServlet.class new file mode 100644 index 0000000..710a8d6 Binary files /dev/null and b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/AdminLoginServlet.class differ diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/BuyBooksServlet.class b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/BuyBooksServlet.class new file mode 100644 index 0000000..5adf941 Binary files /dev/null and b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/BuyBooksServlet.class differ diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/DBConnection.class b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/DBConnection.class new file mode 100644 index 0000000..2c9310f Binary files /dev/null and b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/DBConnection.class differ diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/ReceiptServlet.class b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/ReceiptServlet.class new file mode 100644 index 0000000..f997692 Binary files /dev/null and b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/ReceiptServlet.class differ diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/RemoveBookServlet.class b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/RemoveBookServlet.class new file mode 100644 index 0000000..75c43bc Binary files /dev/null and b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/RemoveBookServlet.class differ diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/UserLoginServlet.class b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/UserLoginServlet.class new file mode 100644 index 0000000..d996da0 Binary files /dev/null and b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/UserLoginServlet.class differ diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/UserRegisterServlet.class b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/UserRegisterServlet.class new file mode 100644 index 0000000..5554c92 Binary files /dev/null and b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/UserRegisterServlet.class differ diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/ViewBookServlet.class b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/ViewBookServlet.class new file mode 100644 index 0000000..e8bc4c3 Binary files /dev/null and b/projects/onlinebookstore-gh-pages/OnlineBookStore/build/classes/test/ViewBookServlet.class differ diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/AddBookServlet.java b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/AddBookServlet.java new file mode 100644 index 0000000..73c5ad8 --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/AddBookServlet.java @@ -0,0 +1,46 @@ +package test; +import test.DBConnection; +import java.sql.*; +import javax.servlet.*; +import java.io.*; +public class AddBookServlet extends GenericServlet{ + public void service(ServletRequest req,ServletResponse res) throws IOException,ServletException + { + PrintWriter pw = res.getWriter(); + res.setContentType("text/html"); + String bCode = req.getParameter("bcode"); + String bName = req.getParameter("bname"); + String bAuthor = req.getParameter("bauthor"); + int bPrice =Integer.parseInt(req.getParameter("bprice")); + int bQty = Integer.parseInt(req.getParameter("bqty")); + try { + Connection con = DBConnection.getCon(); + PreparedStatement ps = con.prepareStatement("insert into book6 values(?,?,?,?,?)"); + ps.setString(1, bCode); + ps.setString(2, bName); + ps.setString(3, bAuthor); + ps.setInt(4, bPrice); + ps.setInt(5, bQty); + int k = ps.executeUpdate(); + if(k==1) + { + RequestDispatcher rd = req.getRequestDispatcher("AddBook.html"); + rd.include(req, res); + pw.println("
    Book Detail Updated Successfully!
    Add More Books
    "); + + + + } + else + { + RequestDispatcher rd = req.getRequestDispatcher("AddBook.html"); + pw.println("
    Failed to Add Books! Fill up CareFully
    "); + rd.include(req, res); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + } +} diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/AdminLoginServlet.java b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/AdminLoginServlet.java new file mode 100644 index 0000000..f078298 --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/AdminLoginServlet.java @@ -0,0 +1,42 @@ +package test; +import test.DBConnection; +import javax.servlet.*; +import java.io.*; +import java.sql.*; +public class AdminLoginServlet extends GenericServlet{ + public void service(ServletRequest req, ServletResponse res) throws IOException,ServletException + { + PrintWriter pw = res.getWriter(); + res.setContentType("text/html"); + String uName = req.getParameter("uname"); + String pWord = req.getParameter("pword"); + try { + Connection con = DBConnection.getCon(); + PreparedStatement ps = con.prepareStatement("SELECT * FROM ADMIN6 WHERE UNAME=? AND PWORD=?"); + ps.setString(1, uName); + ps.setString(2, pWord); + ResultSet rs = ps.executeQuery(); + if(rs.next()) + { + RequestDispatcher rd = req.getRequestDispatcher("Sample.html"); + rd.include(req, res); + pw.println("
    Admin login Successful
    "); + pw.println(""); + pw.println(""); + pw.println(""); + } + else + { + + RequestDispatcher rd = req.getRequestDispatcher("AdminLogin.html"); + rd.include(req,res); + pw.println("
    Incorrect UserName or PassWord
    "); + } + + } + catch(Exception e) + { + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/BuyBooksServlet.java b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/BuyBooksServlet.java new file mode 100644 index 0000000..9e10958 --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/BuyBooksServlet.java @@ -0,0 +1,64 @@ +package test; +import test.DBConnection; +import java.io.*; +import java.sql.*; +import javax.servlet.*; +public class BuyBooksServlet extends GenericServlet{ + public void service(ServletRequest req,ServletResponse res) throws IOException,ServletException + { + PrintWriter pw = res.getWriter(); + res.setContentType("text/html"); + try { + Connection con = DBConnection.getCon(); + //ArrayList al = new ArrayList(); + PreparedStatement ps = con.prepareStatement("Select * from book6"); + ResultSet rs = ps.executeQuery(); + RequestDispatcher rd = req.getRequestDispatcher("ViewBooks.html"); + rd.include(req, res); + pw.println("
    Books Available In Our Store
    "); + pw.println("
    "); + pw.println("\r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " "); + int i=0; + while(rs.next()) + { + String bCode = rs.getString(1); + String bName = rs.getString(2); + String bAuthor = rs.getString(3); + int bPrice = rs.getInt(4); + int bAvl = rs.getInt(5); + i=i+1; + String n = "checked"+ Integer.toString(i); + String q = "qty"+Integer.toString(i); + pw.println("\r\n" + + " "); + pw.println(""); + pw.println(""); + pw.println(""); + pw.println(""); + pw.println(""); + pw.println(""); + + } + pw.println("
    BooksCodeNameAuthorPriceAvailQty
    \r\n" + + " \r\n" + //Value is made equal to bcode + " "+bCode+""+bName+""+bAuthor+""+bPrice+""+bAvl+"
    \r\n" + ""+"
    "+ + "
    \r\n" + + "
    "); + //pw.println(""); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + +} diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/DBConnection.java b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/DBConnection.java new file mode 100644 index 0000000..929121c --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/DBConnection.java @@ -0,0 +1,21 @@ +package test; +import java.sql.*; +public class DBConnection { + private static Connection con; + private DBConnection(){}; + static { + try { + Class.forName("oracle.jdbc.driver.OracleDriver"); + con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","SHASHI","MANAGER"); + }//End of try + catch(Exception e) + { + e.printStackTrace(); + } + }//End of static block + + public static Connection getCon() + { + return con; + } +} diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/ReceiptServlet.java b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/ReceiptServlet.java new file mode 100644 index 0000000..cbf9478 --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/ReceiptServlet.java @@ -0,0 +1,75 @@ +package test; +import test.DBConnection; +import java.sql.*; +import java.io.*; +import javax.servlet.*; +public class ReceiptServlet extends GenericServlet{ + public void service(ServletRequest req,ServletResponse res) throws IOException,ServletException + { + PrintWriter pw = res.getWriter(); + res.setContentType("text/html"); + try { + Connection con = DBConnection.getCon(); + PreparedStatement ps = con.prepareStatement("select * from book6"); + ResultSet rs = ps.executeQuery(); + int i=0; + RequestDispatcher rd = req.getRequestDispatcher("ViewBooks.html"); + rd.include(req, res); + pw.println("
    You Successfully Paid for Following Books
    "); + pw.println("
    \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + "
    \r\n" + + " "); + double total=0.0; + while(rs.next()) + { + int bPrice =rs.getInt("bprice"); + String bCode=rs.getString("bcode"); + String bName = rs.getString("bname"); + String bAuthor = rs.getString("bauthor"); + int bQty = rs.getInt("bqty"); + i=i+1; + + String qt = "qty"+Integer.toString(i); + int quantity = Integer.parseInt(req.getParameter(qt)); + try { + String check1 = "checked"+Integer.toString(i); + String getChecked = req.getParameter(check1); + if(bQty
    Please Select the Qty less than Available Books Quantity
    "); + break; + } + + if(getChecked.equals("pay")) + { + pw.println("
    "); + pw.println(""); + pw.println(""); + pw.println(""); + pw.println(""); + total = total + bPrice * quantity; + bQty = bQty - quantity; + PreparedStatement ps1 = con.prepareStatement("update book6 set bqty=? where bcode=?"); + ps1.setInt(1, bQty); + ps1.setString(2,bCode); + ps1.executeQuery(); + } + }catch(Exception e) {} + } + pw.println("
    Book CodeBook NameBook AuthorBook PriceQuantity
    "+bCode+""+bName+""+bAuthor+""+bPrice+""+quantity+"

    Total Paid Amount: "+total+"
    "); + String fPay = req.getParameter("f_pay"); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + +} diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/RemoveBookServlet.java b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/RemoveBookServlet.java new file mode 100644 index 0000000..d0d6b9a --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/RemoveBookServlet.java @@ -0,0 +1,39 @@ +package test; +import test.DBConnection; +import java.sql.*; +import javax.servlet.*; +import java.io.*; +public class RemoveBookServlet extends GenericServlet{ + public void service(ServletRequest req,ServletResponse res) throws IOException,ServletException + { + PrintWriter pw = res.getWriter(); + res.setContentType("text/html"); + String bkid= req.getParameter("book_code"); + try { + Connection con = DBConnection.getCon(); + PreparedStatement ps = con.prepareStatement("delete from book6 where bcode=?"); + ps.setString(1, bkid); + int k = ps.executeUpdate(); + if(k==1) + { + RequestDispatcher rd = req.getRequestDispatcher("Sample.html"); + rd.include(req, res); + pw.println("
    Book Removed Successfully
    "); + pw.println(""); + + } + else + { + RequestDispatcher rd = req.getRequestDispatcher("Sample.html"); + rd.include(req, res); + pw.println("
    Book Not Available In The Store
    "); + pw.println(""); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + } + +} diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/UserLoginServlet.java b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/UserLoginServlet.java new file mode 100644 index 0000000..71a64f7 --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/UserLoginServlet.java @@ -0,0 +1,42 @@ +package test; +import test.DBConnection; +import javax.servlet.*; +import java.io.*; +import java.sql.*; +public class UserLoginServlet extends GenericServlet{ + public void service(ServletRequest req, ServletResponse res) throws IOException,ServletException + { + PrintWriter pw = res.getWriter(); + res.setContentType("text/html"); + String uName = req.getParameter("uname"); + String pWord = req.getParameter("pword"); + try { + Connection con = DBConnection.getCon(); + PreparedStatement ps = con.prepareStatement("SELECT * FROM REGISTER WHERE UNAME=? AND PWORD=?"); + ps.setString(1, uName); + ps.setString(2, pWord); + ResultSet rs = ps.executeQuery(); + if(rs.next()) + { + RequestDispatcher rd = req.getRequestDispatcher("Sample.html"); + rd.include(req, res); + pw.println("
    Welcome ! "+uName+"

    "); + pw.println("
    User Login Successful !

    "); + pw.println(""); + pw.println(""); + } + else + { + + RequestDispatcher rd = req.getRequestDispatcher("UserLogin.html"); + rd.include(req,res); + pw.println("
    Incorrect UserName or PassWord
    "); + } + + } + catch(Exception e) + { + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/UserRegisterServlet.java b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/UserRegisterServlet.java new file mode 100644 index 0000000..fa2d760 --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/UserRegisterServlet.java @@ -0,0 +1,47 @@ +package test; +import test.DBConnection; +import java.sql.*; +import javax.servlet.*; +import java.io.*; +public class UserRegisterServlet extends GenericServlet{ + public void service(ServletRequest req, ServletResponse res) throws IOException,ServletException + { + PrintWriter pw = res.getWriter(); + res.setContentType("text/html"); + String uName = req.getParameter("uname"); + String pWord = req.getParameter("pword"); + String fName = req.getParameter("firstname"); + String lName = req.getParameter("lastname"); + String addr = req.getParameter("address"); + int phNo = Integer.parseInt(req.getParameter("phoneno")); + String mailId = req.getParameter("mailid"); + try { + Connection con = DBConnection.getCon(); + PreparedStatement ps = con.prepareStatement("insert into register values(?,?,?,?,?,?,?)"); + ps.setString(1, uName); + ps.setString(2, pWord); + ps.setString(3, fName); + ps.setString(4, lName); + ps.setString(5, addr); + ps.setInt(6, phNo); + ps.setString(7, mailId); + int k = ps.executeUpdate(); + if(k==1) + { + RequestDispatcher rd = req.getRequestDispatcher("Sample.html"); + rd.include(req, res); + pw.println("

    User Registered Successfully

    "); + } + else + { + RequestDispatcher rd = req.getRequestDispatcher("userreg"); + rd.include(req, res); + pw.println("Sorry for interruption! Register again"); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/ViewBookServlet.java b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/ViewBookServlet.java new file mode 100644 index 0000000..c11463a --- /dev/null +++ b/projects/onlinebookstore-gh-pages/OnlineBookStore/src/test/ViewBookServlet.java @@ -0,0 +1,64 @@ +package test; +import test.DBConnection; +import java.io.*; +import java.sql.*; +import javax.servlet.*; +/*class Books +{ + public String bName,bCode,bAuthor; + public int bPrice,bQty; + public Books(String bCode,String bName,String bAuthor,int bPrice,int bQty) + { + this.bAuthor=bAuthor; + this.bCode = bCode; + this.bName = bName; + this.bPrice = bPrice; + this.bQty = bQty; + } +}*/ +public class ViewBookServlet extends GenericServlet{ + public void service(ServletRequest req,ServletResponse res) throws IOException,ServletException + { + PrintWriter pw = res.getWriter(); + res.setContentType("text/html"); + try { + Connection con = DBConnection.getCon(); + //ArrayList al = new ArrayList(); + PreparedStatement ps = con.prepareStatement("Select * from book6"); + ResultSet rs = ps.executeQuery(); + RequestDispatcher rd = req.getRequestDispatcher("ViewBooks.html"); + rd.include(req, res); + pw.println("
    Books Available In Our Store
    "); + pw.println("
    \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + "
    \r\n" + + " "); + while(rs.next()) + { + String bCode = rs.getString(1); + String bName = rs.getString(2); + String bAuthor = rs.getString(3); + int bPrice = rs.getInt(4); + int bQty = rs.getInt(5); + pw.println(""); + pw.println(""); + pw.println(""); + pw.println(""); + pw.println(""); + } + pw.println("
    Book CodeBook NameBook AuthorBook PriceQuantity
    "+bCode+""+bName+""+bAuthor+""+bPrice+""+bQty+"
    \r\n" + + "
    "); + //pw.println(""); + } + catch(Exception e) + { + e.printStackTrace(); + } + } +} diff --git a/projects/onlinebookstore-gh-pages/README.md b/projects/onlinebookstore-gh-pages/README.md new file mode 100644 index 0000000..e9b35b6 --- /dev/null +++ b/projects/onlinebookstore-gh-pages/README.md @@ -0,0 +1,15 @@ +# Online Book Store +Welcome to Online Book Store

    +This is a sample made under small mini-project for the online book store.
    +Under this project we have provided the facilities to search for books available in the book store ,anyone can get the details of the book and its price.
    +The users are also provided a profile any anyone can register login and access the onlinebookstore from anywhere. The user will not be allowed to access the website if he logs out from the store
    +We have also provided the facilities to select the books anyone wants to buy and also select the quantity of books to be buy.
    After clicking the final button the books is purchased and the books quantity decreases from the store
    +We provide a final receipt to the user as the books buyed detail and price paid for further uses.
    +To update the book details and quantity and to add more books, we have made our website admin friendly by which the bookstore owner can easily login into the account and updates the details of the books
    +Both the user and admin are provide the profile facility where the details of the user or admin are stored and may be updated or changed by logging in
    +This much is only the start of this project and i am working hard for this project
    +Suggestions are invited!
    + +Thanks a lot
    + Project Manager
    + Shashi Raj diff --git a/projects/pratap nagar lib management/.project b/projects/pratap nagar lib management/.project new file mode 100644 index 0000000..9882a8e --- /dev/null +++ b/projects/pratap nagar lib management/.project @@ -0,0 +1,11 @@ + + + adiiii + + + + + + + + diff --git a/projects/pratap nagar lib management/libmgmt/.classpath b/projects/pratap nagar lib management/libmgmt/.classpath new file mode 100644 index 0000000..460d4f4 --- /dev/null +++ b/projects/pratap nagar lib management/libmgmt/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/projects/pratap nagar lib management/libmgmt/.project b/projects/pratap nagar lib management/libmgmt/.project new file mode 100644 index 0000000..6bfe3b2 --- /dev/null +++ b/projects/pratap nagar lib management/libmgmt/.project @@ -0,0 +1,17 @@ + + + libmgmt + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/projects/pratap nagar lib management/libmgmt/.settings/org.eclipse.jdt.core.prefs b/projects/pratap nagar lib management/libmgmt/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3a21537 --- /dev/null +++ b/projects/pratap nagar lib management/libmgmt/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$1.class b/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$1.class new file mode 100644 index 0000000..edf5724 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$1.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$2.class b/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$2.class new file mode 100644 index 0000000..863a3ce Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$2.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$3.class b/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$3.class new file mode 100644 index 0000000..02224ad Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$3.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$4.class b/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$4.class new file mode 100644 index 0000000..de774dd Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$4.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$5.class b/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$5.class new file mode 100644 index 0000000..3163820 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$5.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$6.class b/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$6.class new file mode 100644 index 0000000..8b5f7dd Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$6.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$7.class b/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$7.class new file mode 100644 index 0000000..6a78676 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/AddNewBook$7.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/AddNewBook.class b/projects/pratap nagar lib management/libmgmt/bin/AddNewBook.class new file mode 100644 index 0000000..cace6e2 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/AddNewBook.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/Admin$1.class b/projects/pratap nagar lib management/libmgmt/bin/Admin$1.class new file mode 100644 index 0000000..557bc08 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/Admin$1.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/Admin$2.class b/projects/pratap nagar lib management/libmgmt/bin/Admin$2.class new file mode 100644 index 0000000..1d21291 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/Admin$2.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/Admin$3.class b/projects/pratap nagar lib management/libmgmt/bin/Admin$3.class new file mode 100644 index 0000000..3a407ec Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/Admin$3.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/Admin$4.class b/projects/pratap nagar lib management/libmgmt/bin/Admin$4.class new file mode 100644 index 0000000..109c8d9 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/Admin$4.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/Admin.class b/projects/pratap nagar lib management/libmgmt/bin/Admin.class new file mode 100644 index 0000000..6999cc9 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/Admin.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/DBInfo.class b/projects/pratap nagar lib management/libmgmt/bin/DBInfo.class new file mode 100644 index 0000000..01396b8 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/DBInfo.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/GetValue.class b/projects/pratap nagar lib management/libmgmt/bin/GetValue.class new file mode 100644 index 0000000..0d77339 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/GetValue.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/Login$1.class b/projects/pratap nagar lib management/libmgmt/bin/Login$1.class new file mode 100644 index 0000000..adb2043 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/Login$1.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/Login$2.class b/projects/pratap nagar lib management/libmgmt/bin/Login$2.class new file mode 100644 index 0000000..c5e1c1e Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/Login$2.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/Login$3.class b/projects/pratap nagar lib management/libmgmt/bin/Login$3.class new file mode 100644 index 0000000..34dbe05 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/Login$3.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/Login.class b/projects/pratap nagar lib management/libmgmt/bin/Login.class new file mode 100644 index 0000000..7edde46 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/Login.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/SearchBy$1.class b/projects/pratap nagar lib management/libmgmt/bin/SearchBy$1.class new file mode 100644 index 0000000..a03c77d Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/SearchBy$1.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/SearchBy$2.class b/projects/pratap nagar lib management/libmgmt/bin/SearchBy$2.class new file mode 100644 index 0000000..15b00e9 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/SearchBy$2.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/SearchBy.class b/projects/pratap nagar lib management/libmgmt/bin/SearchBy.class new file mode 100644 index 0000000..d4fad20 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/SearchBy.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/SearchPanel.class b/projects/pratap nagar lib management/libmgmt/bin/SearchPanel.class new file mode 100644 index 0000000..e804eeb Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/SearchPanel.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$1.class b/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$1.class new file mode 100644 index 0000000..d41abe2 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$1.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$2.class b/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$2.class new file mode 100644 index 0000000..3345550 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$2.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$3.class b/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$3.class new file mode 100644 index 0000000..3459032 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$3.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$4.class b/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$4.class new file mode 100644 index 0000000..3b829f4 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$4.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$5.class b/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$5.class new file mode 100644 index 0000000..9a3d3fa Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$5.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$6.class b/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$6.class new file mode 100644 index 0000000..9246a87 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete$6.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete.class b/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete.class new file mode 100644 index 0000000..7119c01 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/SearchUpdateDelete.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/User$1.class b/projects/pratap nagar lib management/libmgmt/bin/User$1.class new file mode 100644 index 0000000..a455484 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/User$1.class differ diff --git a/projects/pratap nagar lib management/libmgmt/bin/User.class b/projects/pratap nagar lib management/libmgmt/bin/User.class new file mode 100644 index 0000000..48234b5 Binary files /dev/null and b/projects/pratap nagar lib management/libmgmt/bin/User.class differ diff --git a/projects/pratap nagar lib management/libmgmt/src/AddNewBook.java b/projects/pratap nagar lib management/libmgmt/src/AddNewBook.java new file mode 100644 index 0000000..beda049 --- /dev/null +++ b/projects/pratap nagar lib management/libmgmt/src/AddNewBook.java @@ -0,0 +1,364 @@ +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.print.attribute.standard.MediaSize.Other; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.JComboBox; +import javax.swing.JButton; +import javax.swing.JMenuBar; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; + +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.awt.event.ActionEvent; + +public class AddNewBook extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JTextField textField_1; + private JTextField textField_2; + private JTextField textField_3; + private JTextField textField_4; + + JComboBox comboBox,comboBox_1,comboBox_2,comboBox_3; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + AddNewBook frame = new AddNewBook(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + public void reset() + { + textField.setText(bookID()); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + comboBox.setSelectedIndex(0); + comboBox_1.setSelectedIndex(0); + comboBox_2.setSelectedIndex(0); + comboBox_3.setSelectedIndex(0); + + + } + + public String bookID() + { + String id=""; + for(int i=1;i<=7;i++) + { + id+=(int)(Math.random()*9)+1; + //System.out.println(id); + } + return id; + } + + public void setValue(String option) + { + + String value=JOptionPane.showInputDialog("Enter "+option+" name"); + System.out.println(value); + if(value.length()==0) + { + JOptionPane.showMessageDialog(getParent(), "Enter value"); + } + else + { + Connection con=DBInfo.con; + String query="insert into "+option+"(name) values(?)"; + System.out.println(query); + + int i=0; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, value.toUpperCase()); + i=ps.executeUpdate(); + } + catch(Exception e) + { + e.printStackTrace(); + } + + if(i==1) + { + JOptionPane.showMessageDialog(getParent(),option+" Added!!","Success",JOptionPane.INFORMATION_MESSAGE); + } + if(i==0) + { + JOptionPane.showMessageDialog(getParent(),option+"Not Added!!","Error",JOptionPane.ERROR_MESSAGE); + } + + dispose(); + new AddNewBook().setVisible(true); + } + } + + + public AddNewBook() { + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 504, 562); + setLocationRelativeTo(this); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnFile = new JMenu("FILE"); + menuBar.add(mnFile); + + JMenu mnAddNew = new JMenu("Add New"); + menuBar.add(mnAddNew); + + JMenuItem mntmAuthor = new JMenuItem("Author"); + mntmAuthor.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent arg0) + { + + setValue(arg0.getActionCommand()); + + } + }); + mnAddNew.add(mntmAuthor); + + JMenuItem mntmSubject = new JMenuItem("Subject"); + mntmSubject.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + setValue(arg0.getActionCommand()); + } + }); + mnAddNew.add(mntmSubject); + + JMenuItem mntmCategory = new JMenuItem("Category"); + mntmCategory.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + setValue(arg0.getActionCommand()); + } + }); + mnAddNew.add(mntmCategory); + + JMenuItem mntmPublication = new JMenuItem("Publication"); + mntmPublication.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + setValue(arg0.getActionCommand()); + } + }); + mnAddNew.add(mntmPublication); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblAddNewBook = new JLabel("Add New Book"); + + JLabel lblBookId = new JLabel("Book id"); + + textField = new JTextField(bookID()); + textField.setEditable(false); + textField.setColumns(10); + + JLabel lblTitle = new JLabel("Title"); + + JLabel lblAuthor = new JLabel("Author"); + + JLabel lblSubject = new JLabel("Subject"); + + JLabel lblCategory = new JLabel("Category"); + + JLabel lblPublication = new JLabel("Publication"); + + JLabel lblIsbn = new JLabel("ISBN"); + + JLabel lblProce = new JLabel("Price"); + + JLabel lblQuantity = new JLabel("Quantity"); + + textField_1 = new JTextField(); + textField_1.setColumns(10); + + textField_2 = new JTextField(); + textField_2.setColumns(10); + + textField_3 = new JTextField(); + textField_3.setColumns(10); + + textField_4 = new JTextField(); + textField_4.setColumns(10); + + comboBox = new JComboBox(GetValue.getValue("author")); + + comboBox_1 = new JComboBox(GetValue.getValue("subject")); + + comboBox_2 = new JComboBox(GetValue.getValue("category")); + + comboBox_3 = new JComboBox(GetValue.getValue("publication")); + + JButton btnSave = new JButton("SAVE"); + btnSave.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent arg0) + { + String bid=textField.getText(); + String title=textField_1.getText(); + String isbn=textField_2.getText(); + String price=textField_3.getText(); + String quantity=textField_4.getText(); + + String author=(String)comboBox.getSelectedItem(); + String subject=(String)comboBox_1.getSelectedItem(); + String cat=(String)comboBox_2.getSelectedItem(); + String pub=(String)comboBox_3.getSelectedItem(); + String query="insert into book values(?,?,?,?,?,?,?,?,?)"; + + Connection con=DBInfo.con; + int i=0; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, bid); + ps.setString(2, title); + ps.setString(3, author); + ps.setString(4, subject); + ps.setString(5, cat); + ps.setString(6, pub); + ps.setString(7, isbn); + ps.setString(8, price); + ps.setString(9, quantity); + i=ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + + if(i==0) + { + JOptionPane.showMessageDialog(getParent(), "Book not added!!", "Error", JOptionPane.ERROR_MESSAGE); + } + if(i==1) + { + JOptionPane.showMessageDialog(getParent(), "Book added!!", "Success", JOptionPane.INFORMATION_MESSAGE); + reset(); + } + + + + } + }); + + JButton btnReset = new JButton("RESET"); + btnReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + reset(); + } + }); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(177) + .addComponent(lblAddNewBook)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(94) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblBookId) + .addComponent(lblTitle, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE) + .addComponent(lblIsbn, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE) + .addComponent(lblProce, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE) + .addComponent(lblQuantity) + .addComponent(lblAuthor, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE) + .addComponent(lblSubject, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING, false) + .addComponent(lblPublication, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(lblCategory, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE)) + .addComponent(btnSave, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)) + .addGap(9) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(comboBox_3, 0, 196, Short.MAX_VALUE) + .addComponent(comboBox_2, 0, 196, Short.MAX_VALUE) + .addComponent(comboBox_1, 0, 196, Short.MAX_VALUE) + .addComponent(comboBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(textField_4) + .addComponent(textField_3) + .addComponent(textField_2) + .addComponent(textField_1) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE) + .addComponent(btnReset, GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE)))) + .addGap(68)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(27) + .addComponent(lblAddNewBook) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblBookId)) + .addGap(34) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblTitle) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblAuthor) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblSubject) + .addComponent(comboBox_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblCategory) + .addComponent(comboBox_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblPublication) + .addComponent(comboBox_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblIsbn) + .addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblProce) + .addGap(18) + .addComponent(lblQuantity)) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(textField_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) + .addGap(31) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnSave) + .addComponent(btnReset)) + .addContainerGap(50, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/pratap nagar lib management/libmgmt/src/Admin.java b/projects/pratap nagar lib management/libmgmt/src/Admin.java new file mode 100644 index 0000000..87d162c --- /dev/null +++ b/projects/pratap nagar lib management/libmgmt/src/Admin.java @@ -0,0 +1,88 @@ +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import java.awt.GridLayout; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class Admin extends JFrame { + + private JPanel contentPane; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + Admin frame = new Admin(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public Admin() + { + super("Admin section"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 715, 339); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + contentPane.setLayout(new GridLayout(3,3,5,5)); + + JButton btnAddNewBook = new JButton("ADD NEW BOOK"); + btnAddNewBook.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + AddNewBook obj=new AddNewBook(); + obj.setVisible(true); + } + }); + contentPane.add(btnAddNewBook); + + JButton btnSearchupdatedeleteBook = new JButton("SEARCH/UPDATE/DELETE BOOK BY ID"); + btnSearchupdatedeleteBook.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + SearchUpdateDelete obj=new SearchUpdateDelete(); + obj.setVisible(true); + } + }); + contentPane.add(btnSearchupdatedeleteBook); + + JButton btnSearchBy = new JButton("SEARCH BY"); + btnSearchBy.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + new SearchBy().setVisible(true); + } + }); + contentPane.add(btnSearchBy); + + JButton btnAddNewUser = new JButton("ADD NEW USER"); + contentPane.add(btnAddNewUser); + + JButton btnSearchupdatedeleteUser = new JButton("SEARCH/UPDATE/DELETE USER"); + contentPane.add(btnSearchupdatedeleteUser); + + JButton btnIssueBook = new JButton("ISSUE BOOK"); + contentPane.add(btnIssueBook); + + JButton btnSubmitBook = new JButton("SUBMIT BOOK"); + contentPane.add(btnSubmitBook); + + JButton btnChangePassword = new JButton("CHANGE PASSWORD"); + contentPane.add(btnChangePassword); + } + +} diff --git a/projects/pratap nagar lib management/libmgmt/src/DBInfo.java b/projects/pratap nagar lib management/libmgmt/src/DBInfo.java new file mode 100644 index 0000000..91df664 --- /dev/null +++ b/projects/pratap nagar lib management/libmgmt/src/DBInfo.java @@ -0,0 +1,24 @@ +import java.sql.Connection; +import java.sql.DriverManager; + +public class DBInfo +{ + static Connection con; + + static + { + try + { + Class.forName("com.mysql.jdbc.Driver"); + con=DriverManager.getConnection("jdbc:mysql://localhost:3306/libmgmt1","root","rat"); + System.out.println("Driver loaded!!"); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + + + +} diff --git a/projects/pratap nagar lib management/libmgmt/src/GetValue.java b/projects/pratap nagar lib management/libmgmt/src/GetValue.java new file mode 100644 index 0000000..7f4241c --- /dev/null +++ b/projects/pratap nagar lib management/libmgmt/src/GetValue.java @@ -0,0 +1,115 @@ +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.util.Vector; + +public class GetValue +{ + public static Vector colNames; + public static Vector> records; + + public static Vector getValue(String value) + { + Vector vector=new Vector<>(); + Connection con=DBInfo.con; + String query="select name from "+value+" order by name"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + vector.add(res.getString(1)); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + return vector; + + } + + public static void searchAllValues() + { + colNames=new Vector<>(); + records=new Vector<>(); + + Connection con=DBInfo.con; + String query="select * from book"; + try + { + PreparedStatement ps=con.prepareStatement(query); + + ResultSet res=ps.executeQuery(); + + //fetching metadata + ResultSetMetaData rsmd=res.getMetaData(); + int count=rsmd.getColumnCount(); + for(int i=1;i<=count;i++) + { + colNames.add(rsmd.getColumnName(i)); + } + + //fetching records + while(res.next()) + { + Vector inner=new Vector<>(); + for(int i=1;i<=count;i++) + { + inner.add(res.getString(i)); + + } + records.add(inner); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + } + + public static void searchValuesBy(String col,String value) + { + colNames=new Vector<>(); + records=new Vector<>(); + + Connection con=DBInfo.con; + String query="select * from book where "+col+"=?"; + System.out.println(query); + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, value); + ResultSet res=ps.executeQuery(); + + //fetching metadata + ResultSetMetaData rsmd=res.getMetaData(); + int count=rsmd.getColumnCount(); + for(int i=1;i<=count;i++) + { + colNames.add(rsmd.getColumnName(i)); + } + + //fetching records + while(res.next()) + { + Vector inner=new Vector<>(); + for(int i=1;i<=count;i++) + { + inner.add(res.getString(i)); + + } + records.add(inner); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + } + + +} diff --git a/projects/pratap nagar lib management/libmgmt/src/Login.java b/projects/pratap nagar lib management/libmgmt/src/Login.java new file mode 100644 index 0000000..a21bf35 --- /dev/null +++ b/projects/pratap nagar lib management/libmgmt/src/Login.java @@ -0,0 +1,185 @@ + + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JTextField; +import javax.swing.JPasswordField; +import javax.swing.JButton; +import javax.swing.LayoutStyle.ComponentPlacement; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.awt.event.ActionEvent; + +public class Login extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JPasswordField passwordField; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + Login frame = new Login(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + + public void reset() + { + textField.setText(null); + passwordField.setText(null); + } + + + public Login() { + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 450, 300); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblLoginPage = new JLabel("Login Page"); + + JLabel lblEnterUsername = new JLabel("Enter Username"); + + textField = new JTextField(); + textField.setColumns(10); + + JLabel lblEnterPassword = new JLabel("Enter Password"); + + passwordField = new JPasswordField(); + + JButton btnLoginNow = new JButton("Login Now"); + btnLoginNow.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent arg0) + { + String uname=textField.getText(); + char ch[]=passwordField.getPassword(); + String pass=String.copyValueOf(ch); + int flag=0; + String usertype=""; + Connection con=DBInfo.con; + String query="select * from login where username=? and password=?"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, uname); + ps.setString(2, pass);; + ResultSet res=ps.executeQuery(); + while(res.next()) + { + flag=1; + usertype=res.getString("usertype"); + break; + } + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==1 && usertype.equalsIgnoreCase("admin")) + { + reset(); + Admin a=new Admin(); + a.setVisible(true); + } + if(flag==1 && usertype.equalsIgnoreCase("user")) + { + reset(); + User u=new User(); + u.setVisible(true); + } + if(flag==0) + { + System.out.println("no record found!!"); + } + + + + + + //System.out.println(uname+"::::"+pass); + + + + } + }); + + JButton btnReset = new JButton("Reset"); + btnReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + reset(); + } + }); + + JButton btnNewUser = new JButton("New User"); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(174) + .addComponent(lblLoginPage)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(71) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblEnterUsername) + .addComponent(lblEnterPassword) + .addComponent(btnLoginNow)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(btnReset) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(btnNewUser)) + .addComponent(textField) + .addComponent(passwordField)))) + .addContainerGap(27, Short.MAX_VALUE)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addContainerGap() + .addComponent(lblLoginPage) + .addGap(34) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnterUsername) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnterPassword) + .addComponent(passwordField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnLoginNow) + .addComponent(btnReset) + .addComponent(btnNewUser)) + .addContainerGap(64, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/pratap nagar lib management/libmgmt/src/SearchBy.java b/projects/pratap nagar lib management/libmgmt/src/SearchBy.java new file mode 100644 index 0000000..ca39773 --- /dev/null +++ b/projects/pratap nagar lib management/libmgmt/src/SearchBy.java @@ -0,0 +1,133 @@ +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.border.EmptyBorder; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.BorderFactory; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JComboBox; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class SearchBy extends JFrame { + + private JPanel contentPane; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + SearchBy frame = new SearchBy(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public SearchBy() { + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 450, 277); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblNewLabel = new JLabel("New label"); + + JLabel lblSearchBy = new JLabel("Search By"); + + + + String value[]={"Select","All","Author","Subject","Categrory","Publication"}; + JComboBox comboBox = new JComboBox(value); + + JButton btnNewButton = new JButton("SEARCH"); + btnNewButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent arg0) + { + String str=(String)comboBox.getSelectedItem(); + if(str.equalsIgnoreCase("select")) + JOptionPane.showMessageDialog(getParent(), "Pls select any option", "Information", JOptionPane.WARNING_MESSAGE); + else if(str.equalsIgnoreCase("all")) + { + + JFrame frm=new JFrame("All Records"); + frm.setSize(1000, 600); + frm.setLocationRelativeTo(frm); + + + GetValue.searchAllValues(); + JTable table=new JTable(GetValue.records, GetValue.colNames); + JScrollPane pane=new JScrollPane(table); + frm.add(pane); + frm.setVisible(true); + + } + else + { + JFrame frm=new JFrame("Search by"); + frm.setSize(400, 150); + frm.setLocationRelativeTo(frm); + + + SearchPanel obj=new SearchPanel(str); + + frm.add(obj); + frm.setVisible(true); + + + + + } + + } + }); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(165) + .addComponent(lblNewLabel)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(80) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false) + .addComponent(btnNewButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblSearchBy) + .addGap(28) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 183, GroupLayout.PREFERRED_SIZE))))) + .addContainerGap(64, Short.MAX_VALUE)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblNewLabel) + .addGap(32) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblSearchBy) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(32) + .addComponent(btnNewButton) + .addContainerGap(112, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/pratap nagar lib management/libmgmt/src/SearchPanel.java b/projects/pratap nagar lib management/libmgmt/src/SearchPanel.java new file mode 100644 index 0000000..c83dab1 --- /dev/null +++ b/projects/pratap nagar lib management/libmgmt/src/SearchPanel.java @@ -0,0 +1,52 @@ +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; + +public class SearchPanel extends JPanel implements ActionListener +{ + JLabel lbl; + JComboBox combo; + JButton btn; + String str; + public SearchPanel(String str) + { + setLayout(new FlowLayout() ); + + lbl=new JLabel("Select Value"); + this.str=str; + + combo=new JComboBox(GetValue.getValue(str)); + btn=new JButton("Search"); + + + add(lbl);add(combo);add(btn); + btn.addActionListener(this); + + } + @Override + public void actionPerformed(ActionEvent arg0) { + String value=(String)combo.getSelectedItem(); + System.out.println(str+":::"+value); + GetValue.searchValuesBy(str, value); + JFrame frm=new JFrame(); + frm.setSize(1000, 400); + frm.setLocationRelativeTo(this); + JTable table=new JTable(GetValue.records, GetValue.colNames); + JScrollPane pane=new JScrollPane(table); + frm.add(pane); + frm.setVisible(true); + + + } + + +} diff --git a/projects/pratap nagar lib management/libmgmt/src/SearchUpdateDelete.java b/projects/pratap nagar lib management/libmgmt/src/SearchUpdateDelete.java new file mode 100644 index 0000000..6cedd09 --- /dev/null +++ b/projects/pratap nagar lib management/libmgmt/src/SearchUpdateDelete.java @@ -0,0 +1,396 @@ +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.print.attribute.standard.MediaSize.Other; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.JComboBox; +import javax.swing.JButton; +import javax.swing.JMenuBar; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; + +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.awt.event.ActionEvent; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; + +public class SearchUpdateDelete extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JTextField textField_1; + private JTextField textField_2; + private JTextField textField_3; + private JTextField textField_4; + + JComboBox comboBox,comboBox_1,comboBox_2,comboBox_3; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + SearchUpdateDelete frame = new SearchUpdateDelete(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + public void reset() + { + textField.setText(null); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + comboBox.setSelectedIndex(0); + comboBox_1.setSelectedIndex(0); + comboBox_2.setSelectedIndex(0); + comboBox_3.setSelectedIndex(0); + + + } + + + + + public SearchUpdateDelete() { + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 618, 715); + setLocationRelativeTo(this); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblAddNewBook = new JLabel("Add New Book"); + + JLabel lblBookId = new JLabel("Book id"); + + textField = new JTextField(); + textField.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent arg0) { + + String bid=textField.getText(); + String query="select * from book where id=?"; + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, bid); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + String title=res.getString(2); + String author=res.getString(3); + String subject=res.getString(4); + String category=res.getString(5); + String publication=res.getString(6); + String isbn=res.getString(7); + String price=res.getString(8); + String quantity=res.getString(9); + textField_1.setText(title); + comboBox.setSelectedItem(author); + comboBox_1.setSelectedItem(subject); + comboBox_2.setSelectedItem(category); + comboBox_3.setSelectedItem(publication); + textField_2.setText(isbn); + textField_3.setText(price); + textField_4.setText(quantity); + + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + + + + } + }); + + textField.setColumns(10); + + JLabel lblTitle = new JLabel("Title"); + + JLabel lblAuthor = new JLabel("Author"); + + JLabel lblSubject = new JLabel("Subject"); + + JLabel lblCategory = new JLabel("Category"); + + JLabel lblPublication = new JLabel("Publication"); + + JLabel lblIsbn = new JLabel("ISBN"); + + JLabel lblProce = new JLabel("Price"); + + JLabel lblQuantity = new JLabel("Quantity"); + + textField_1 = new JTextField(); + textField_1.setColumns(10); + + textField_2 = new JTextField(); + textField_2.setColumns(10); + + textField_3 = new JTextField(); + textField_3.setColumns(10); + + textField_4 = new JTextField(); + textField_4.setColumns(10); + + comboBox = new JComboBox(GetValue.getValue("author")); + + comboBox_1 = new JComboBox(GetValue.getValue("subject")); + + comboBox_2 = new JComboBox(GetValue.getValue("category")); + + comboBox_3 = new JComboBox(GetValue.getValue("publication")); + + JButton btnSave = new JButton("SEARCH"); + btnSave.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent arg0) + { + String bid=textField.getText(); + String query="select * from book where id=?"; + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, bid); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + String title=res.getString(2); + String author=res.getString(3); + String subject=res.getString(4); + String category=res.getString(5); + String publication=res.getString(6); + String isbn=res.getString(7); + String price=res.getString(8); + String quantity=res.getString(9); + textField_1.setText(title); + comboBox.setSelectedItem(author); + comboBox_1.setSelectedItem(subject); + comboBox_2.setSelectedItem(category); + comboBox_3.setSelectedItem(publication); + textField_2.setText(isbn); + textField_3.setText(price); + textField_4.setText(quantity); + + } + } + catch(Exception e) + { + e.printStackTrace(); + } + + + + } + }); + + JButton btnReset = new JButton("RESET"); + btnReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + reset(); + } + }); + + JButton btnUpdate = new JButton("UPDATE"); + btnUpdate.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent arg0) + { + String bid=textField.getText(); + String title=textField_1.getText(); + String isbn=textField_2.getText(); + String price=textField_3.getText(); + String quantity=textField_4.getText(); + + String author=(String)comboBox.getSelectedItem(); + String subject=(String)comboBox_1.getSelectedItem(); + String cat=(String)comboBox_2.getSelectedItem(); + String pub=(String)comboBox_3.getSelectedItem(); + String query="update book set title=?,author=?,subject=?,category=?,publication=?,isbn=?, price=?,quantity=? where id=?"; + + Connection con=DBInfo.con; + int i=0; + try + { + PreparedStatement ps=con.prepareStatement(query); + + ps.setString(1, title); + ps.setString(2, author); + ps.setString(3, subject); + ps.setString(4, cat); + ps.setString(5, pub); + ps.setString(6, isbn); + ps.setString(7, price); + ps.setString(8, quantity); + ps.setString(9, bid); + i=ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + + if(i==0) + { + JOptionPane.showMessageDialog(getParent(), "Updation failed!!", "Error", JOptionPane.ERROR_MESSAGE); + } + if(i==1) + { + JOptionPane.showMessageDialog(getParent(), "Updation done!!", "Success", JOptionPane.INFORMATION_MESSAGE); + reset(); + } + + + } + }); + + JButton btnDelete = new JButton("DELETE"); + btnDelete.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + String bid=textField.getText(); + String query="delete from book where id=?"; + Connection con=DBInfo.con; + int i=0; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, bid); + i=ps.executeUpdate(); + } + catch(Exception e) + { + e.printStackTrace(); + } + if(i!=0) + { + JOptionPane.showMessageDialog(getParent(), "Book deleted!!", "Deleted", JOptionPane.INFORMATION_MESSAGE); + reset(); + } + } + }); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(177) + .addComponent(lblAddNewBook)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(94) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblBookId) + .addComponent(lblTitle, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE) + .addComponent(lblIsbn, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE) + .addComponent(lblProce, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE) + .addComponent(lblQuantity) + .addComponent(lblAuthor, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE) + .addComponent(lblSubject, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING, false) + .addComponent(lblPublication, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(lblCategory, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE)) + .addComponent(btnSave, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)) + .addGap(9) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(comboBox_3, 0, 222, Short.MAX_VALUE) + .addComponent(comboBox_2, 0, 222, Short.MAX_VALUE) + .addComponent(comboBox_1, 0, 222, Short.MAX_VALUE) + .addComponent(comboBox, 0, 222, Short.MAX_VALUE) + .addComponent(textField_3, 190, 190, 190) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING, false) + .addGroup(Alignment.LEADING, gl_contentPane.createSequentialGroup() + .addComponent(btnReset, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE) + .addGap(1) + .addComponent(btnUpdate, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(textField_4, Alignment.LEADING, 190, 190, 190)) + .addGap(18) + .addComponent(btnDelete, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)) + .addComponent(textField_1, GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE) + .addComponent(textField_2, GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE)))) + .addGap(74)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(27) + .addComponent(lblAddNewBook) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblBookId)) + .addGap(34) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblTitle) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblAuthor) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblSubject) + .addComponent(comboBox_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblCategory) + .addComponent(comboBox_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblPublication) + .addComponent(comboBox_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblIsbn) + .addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblProce) + .addGap(18) + .addComponent(lblQuantity)) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(textField_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) + .addGap(31) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnSave) + .addComponent(btnReset) + .addComponent(btnUpdate) + .addComponent(btnDelete)) + .addContainerGap(155, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/pratap nagar lib management/libmgmt/src/User.java b/projects/pratap nagar lib management/libmgmt/src/User.java new file mode 100644 index 0000000..5c1aaca --- /dev/null +++ b/projects/pratap nagar lib management/libmgmt/src/User.java @@ -0,0 +1,42 @@ +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; + +public class User extends JFrame { + + private JPanel contentPane; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + User frame = new User(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public User() { + super("User Section"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 450, 300); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + contentPane.setLayout(new BorderLayout(0, 0)); + setContentPane(contentPane); + } + +} diff --git a/projects/pratap nagar lib management/libmgmt1.sql b/projects/pratap nagar lib management/libmgmt1.sql new file mode 100644 index 0000000..b60725b --- /dev/null +++ b/projects/pratap nagar lib management/libmgmt1.sql @@ -0,0 +1,112 @@ +/* +SQLyog Enterprise - MySQL GUI v7.02 +MySQL - 5.0.67-community-nt : Database - libmgmt1 +********************************************************************* +*/ + +/*!40101 SET NAMES utf8 */; + +/*!40101 SET SQL_MODE=''*/; + +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/`libmgmt1` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `libmgmt1`; + +/*Table structure for table `author` */ + +DROP TABLE IF EXISTS `author`; + +CREATE TABLE `author` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1; + +/*Data for the table `author` */ + +insert into `author`(`id`,`name`) values (1,'KAITHY SIERRA'),(2,'KHALID'),(3,'MUGAL'),(4,'HERBERT SHILDTH'),(5,'YASHWANT KANITKAR'),(6,'KORTH'),(9,'DIETAL'); + +/*Table structure for table `book` */ + +DROP TABLE IF EXISTS `book`; + +CREATE TABLE `book` ( + `id` int(10) NOT NULL, + `title` varchar(100) default NULL, + `author` varchar(100) default NULL, + `subject` varchar(100) default NULL, + `category` varchar(100) default NULL, + `publication` varchar(100) default NULL, + `isbn` varchar(50) default NULL, + `price` int(10) default NULL, + `quantity` int(10) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Data for the table `book` */ + +insert into `book`(`id`,`title`,`author`,`subject`,`category`,`publication`,`isbn`,`price`,`quantity`) values (1278356,'c programming','HERBERT SHILDTH','C','PROGRAMMING LANGUAGE','TMH','2323',400,10),(5896788,'programming in java','HERBERT SHILDTH','JAVA','PROGRAMMING LANGUAGE','TMH','23232',450,10),(6966763,'programmin in cpp','DIETAL','CPP','PROGRAMMING LANGUAGE','BPB','3434',300,10); + +/*Table structure for table `category` */ + +DROP TABLE IF EXISTS `category`; + +CREATE TABLE `category` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; + +/*Data for the table `category` */ + +insert into `category`(`id`,`name`) values (1,'PROGRAMMING LANGUAGE'),(2,'GK'); + +/*Table structure for table `login` */ + +DROP TABLE IF EXISTS `login`; + +CREATE TABLE `login` ( + `id` int(10) NOT NULL auto_increment, + `username` varchar(100) default NULL, + `password` varchar(100) default NULL, + `usertype` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; + +/*Data for the table `login` */ + +insert into `login`(`id`,`username`,`password`,`usertype`) values (1,'abhishek','ak123','admin'),(2,'tarun','tk123','user'); + +/*Table structure for table `publication` */ + +DROP TABLE IF EXISTS `publication`; + +CREATE TABLE `publication` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; + +/*Data for the table `publication` */ + +insert into `publication`(`id`,`name`) values (1,'TMH'),(2,'BPB'),(3,'VUE'),(4,'GENIUS'); + +/*Table structure for table `subject` */ + +DROP TABLE IF EXISTS `subject`; + +CREATE TABLE `subject` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; + +/*Data for the table `subject` */ + +insert into `subject`(`id`,`name`) values (1,'JAVA'),(2,'C'),(3,'CPP'),(4,'TOC'),(5,'ITC'),(6,'SE'); + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; diff --git a/projects/pratap nagar lib management/libmgnt2.sql b/projects/pratap nagar lib management/libmgnt2.sql new file mode 100644 index 0000000..80532a6 --- /dev/null +++ b/projects/pratap nagar lib management/libmgnt2.sql @@ -0,0 +1,112 @@ +/* +SQLyog Enterprise - MySQL GUI v7.02 +MySQL - 5.0.67-community-nt : Database - libmgmt1 +********************************************************************* +*/ + +/*!40101 SET NAMES utf8 */; + +/*!40101 SET SQL_MODE=''*/; + +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/`libmgmt1` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `libmgmt1`; + +/*Table structure for table `author` */ + +DROP TABLE IF EXISTS `author`; + +CREATE TABLE `author` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1; + +/*Data for the table `author` */ + +insert into `author`(`id`,`name`) values (1,'KAITHY SIERRA'),(2,'KHALID'),(3,'MUGAL'),(4,'HERBERT SHILDTH'),(5,'YASHWANT KANITKAR'),(6,'KORTH'),(9,'DIETAL'); + +/*Table structure for table `book` */ + +DROP TABLE IF EXISTS `book`; + +CREATE TABLE `book` ( + `id` int(10) NOT NULL, + `title` varchar(100) default NULL, + `author` varchar(100) default NULL, + `subject` varchar(100) default NULL, + `category` varchar(100) default NULL, + `publication` varchar(100) default NULL, + `isbn` varchar(50) default NULL, + `price` int(10) default NULL, + `quantity` int(10) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Data for the table `book` */ + +insert into `book`(`id`,`title`,`author`,`subject`,`category`,`publication`,`isbn`,`price`,`quantity`) values (5896788,'programming in java','HERBERT SHILDTH','JAVA','PROGRAMMING LANGUAGE','TMH','23232',450,10),(6966763,'programmin in cpp','YASHWANT KANITKAR','CPP','PROGRAMMING LANGUAGE','TMH','3434',350,10); + +/*Table structure for table `category` */ + +DROP TABLE IF EXISTS `category`; + +CREATE TABLE `category` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; + +/*Data for the table `category` */ + +insert into `category`(`id`,`name`) values (1,'PROGRAMMING LANGUAGE'),(2,'GK'); + +/*Table structure for table `login` */ + +DROP TABLE IF EXISTS `login`; + +CREATE TABLE `login` ( + `id` int(10) NOT NULL auto_increment, + `username` varchar(100) default NULL, + `password` varchar(100) default NULL, + `usertype` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; + +/*Data for the table `login` */ + +insert into `login`(`id`,`username`,`password`,`usertype`) values (1,'abhishek','ak123','admin'),(2,'tarun','tk123','user'); + +/*Table structure for table `publication` */ + +DROP TABLE IF EXISTS `publication`; + +CREATE TABLE `publication` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; + +/*Data for the table `publication` */ + +insert into `publication`(`id`,`name`) values (1,'TMH'),(2,'BPB'),(3,'VUE'),(4,'GENIUS'); + +/*Table structure for table `subject` */ + +DROP TABLE IF EXISTS `subject`; + +CREATE TABLE `subject` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; + +/*Data for the table `subject` */ + +insert into `subject`(`id`,`name`) values (1,'JAVA'),(2,'C'),(3,'CPP'),(4,'TOC'),(5,'ITC'),(6,'SE'); + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; diff --git a/projects/pratap nagar lib management/library management requirement b/projects/pratap nagar lib management/library management requirement new file mode 100644 index 0000000..2c3d08f --- /dev/null +++ b/projects/pratap nagar lib management/library management requirement @@ -0,0 +1,47 @@ +Lib. management + 1.admin + 2.user(student and faculty) + ----------------------------------------------- + 1.admin + a.add a new book + bookid,title,author,subject,category,publication,isbn,price,quantity + b.search/update/delete a book(by bookid) + c.search by + title + author + category + publisher + d.issue book + e.submit book + f.add a new user + g.search/update/delete any user + h.view account details + i.change self password +2. user + a.view all books + b.search book by title or author or category or publisher + c.view self account + d.change password + +-------------------------------------------------------------------------- + Database designing + 1.book + id,title,author,subject,category,publication,isbn,price,quantity + 2.login + username,password,usertype + 3.author + id,name + 4.subject + id,name + 5.category + id,name + 6.publication + id,name + 7.issuebook + 8.submitbook + + + + + + \ No newline at end of file diff --git a/projects/quiz-master/.classpath b/projects/quiz-master/.classpath new file mode 100644 index 0000000..a880050 --- /dev/null +++ b/projects/quiz-master/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/projects/quiz-master/.project b/projects/quiz-master/.project new file mode 100644 index 0000000..b77856b --- /dev/null +++ b/projects/quiz-master/.project @@ -0,0 +1,17 @@ + + + quiz-master + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/projects/quiz-master/README b/projects/quiz-master/README new file mode 100644 index 0000000..ef7f36c --- /dev/null +++ b/projects/quiz-master/README @@ -0,0 +1,2 @@ +Jogo de Quiz feito em Java, carrega questões a partir de arquivo json + diff --git a/projects/quiz-master/bin/quiz/Quiz$1.class b/projects/quiz-master/bin/quiz/Quiz$1.class new file mode 100644 index 0000000..6a0298c Binary files /dev/null and b/projects/quiz-master/bin/quiz/Quiz$1.class differ diff --git a/projects/quiz-master/bin/quiz/Quiz.class b/projects/quiz-master/bin/quiz/Quiz.class new file mode 100644 index 0000000..029fc76 Binary files /dev/null and b/projects/quiz-master/bin/quiz/Quiz.class differ diff --git a/projects/quiz-master/bin/quiz/channels/ChannelEndPoint.class b/projects/quiz-master/bin/quiz/channels/ChannelEndPoint.class new file mode 100644 index 0000000..e2bcc7a Binary files /dev/null and b/projects/quiz-master/bin/quiz/channels/ChannelEndPoint.class differ diff --git a/projects/quiz-master/bin/quiz/channels/ChannelEndPointList.class b/projects/quiz-master/bin/quiz/channels/ChannelEndPointList.class new file mode 100644 index 0000000..5313e9b Binary files /dev/null and b/projects/quiz-master/bin/quiz/channels/ChannelEndPointList.class differ diff --git a/projects/quiz-master/bin/quiz/channels/MessageChannel.class b/projects/quiz-master/bin/quiz/channels/MessageChannel.class new file mode 100644 index 0000000..3e68ee8 Binary files /dev/null and b/projects/quiz-master/bin/quiz/channels/MessageChannel.class differ diff --git a/projects/quiz-master/bin/quiz/core/Client.class b/projects/quiz-master/bin/quiz/core/Client.class new file mode 100644 index 0000000..f9c3eef Binary files /dev/null and b/projects/quiz-master/bin/quiz/core/Client.class differ diff --git a/projects/quiz-master/bin/quiz/core/ClientListener.class b/projects/quiz-master/bin/quiz/core/ClientListener.class new file mode 100644 index 0000000..71ed511 Binary files /dev/null and b/projects/quiz-master/bin/quiz/core/ClientListener.class differ diff --git a/projects/quiz-master/bin/quiz/core/Player.class b/projects/quiz-master/bin/quiz/core/Player.class new file mode 100644 index 0000000..c5c275a Binary files /dev/null and b/projects/quiz-master/bin/quiz/core/Player.class differ diff --git a/projects/quiz-master/bin/quiz/core/Question.class b/projects/quiz-master/bin/quiz/core/Question.class new file mode 100644 index 0000000..2f27126 Binary files /dev/null and b/projects/quiz-master/bin/quiz/core/Question.class differ diff --git a/projects/quiz-master/bin/quiz/core/Server.class b/projects/quiz-master/bin/quiz/core/Server.class new file mode 100644 index 0000000..479059d Binary files /dev/null and b/projects/quiz-master/bin/quiz/core/Server.class differ diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizMain$1.class b/projects/quiz-master/bin/quiz/dialogs/QuizMain$1.class new file mode 100644 index 0000000..88e085c Binary files /dev/null and b/projects/quiz-master/bin/quiz/dialogs/QuizMain$1.class differ diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizMain$2.class b/projects/quiz-master/bin/quiz/dialogs/QuizMain$2.class new file mode 100644 index 0000000..10663e4 Binary files /dev/null and b/projects/quiz-master/bin/quiz/dialogs/QuizMain$2.class differ diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizMain$3.class b/projects/quiz-master/bin/quiz/dialogs/QuizMain$3.class new file mode 100644 index 0000000..556aedc Binary files /dev/null and b/projects/quiz-master/bin/quiz/dialogs/QuizMain$3.class differ diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizMain.class b/projects/quiz-master/bin/quiz/dialogs/QuizMain.class new file mode 100644 index 0000000..a8b6e9f Binary files /dev/null and b/projects/quiz-master/bin/quiz/dialogs/QuizMain.class differ diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizMain.form b/projects/quiz-master/bin/quiz/dialogs/QuizMain.form new file mode 100644 index 0000000..6226fe0 --- /dev/null +++ b/projects/quiz-master/bin/quiz/dialogs/QuizMain.form @@ -0,0 +1,141 @@ + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizMatch$1.class b/projects/quiz-master/bin/quiz/dialogs/QuizMatch$1.class new file mode 100644 index 0000000..5b0bc43 Binary files /dev/null and b/projects/quiz-master/bin/quiz/dialogs/QuizMatch$1.class differ diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizMatch$2.class b/projects/quiz-master/bin/quiz/dialogs/QuizMatch$2.class new file mode 100644 index 0000000..4ad0559 Binary files /dev/null and b/projects/quiz-master/bin/quiz/dialogs/QuizMatch$2.class differ diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizMatch$3.class b/projects/quiz-master/bin/quiz/dialogs/QuizMatch$3.class new file mode 100644 index 0000000..36b2981 Binary files /dev/null and b/projects/quiz-master/bin/quiz/dialogs/QuizMatch$3.class differ diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizMatch.class b/projects/quiz-master/bin/quiz/dialogs/QuizMatch.class new file mode 100644 index 0000000..aa25b2a Binary files /dev/null and b/projects/quiz-master/bin/quiz/dialogs/QuizMatch.class differ diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizMatch.form b/projects/quiz-master/bin/quiz/dialogs/QuizMatch.form new file mode 100644 index 0000000..38310a8 --- /dev/null +++ b/projects/quiz-master/bin/quiz/dialogs/QuizMatch.form @@ -0,0 +1,199 @@ + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizServer$1.class b/projects/quiz-master/bin/quiz/dialogs/QuizServer$1.class new file mode 100644 index 0000000..5eeb105 Binary files /dev/null and b/projects/quiz-master/bin/quiz/dialogs/QuizServer$1.class differ diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizServer$2.class b/projects/quiz-master/bin/quiz/dialogs/QuizServer$2.class new file mode 100644 index 0000000..211e412 Binary files /dev/null and b/projects/quiz-master/bin/quiz/dialogs/QuizServer$2.class differ diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizServer$3.class b/projects/quiz-master/bin/quiz/dialogs/QuizServer$3.class new file mode 100644 index 0000000..6adfe34 Binary files /dev/null and b/projects/quiz-master/bin/quiz/dialogs/QuizServer$3.class differ diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizServer$4.class b/projects/quiz-master/bin/quiz/dialogs/QuizServer$4.class new file mode 100644 index 0000000..b14e267 Binary files /dev/null and b/projects/quiz-master/bin/quiz/dialogs/QuizServer$4.class differ diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizServer$5.class b/projects/quiz-master/bin/quiz/dialogs/QuizServer$5.class new file mode 100644 index 0000000..79359f7 Binary files /dev/null and b/projects/quiz-master/bin/quiz/dialogs/QuizServer$5.class differ diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizServer.class b/projects/quiz-master/bin/quiz/dialogs/QuizServer.class new file mode 100644 index 0000000..b454aaf Binary files /dev/null and b/projects/quiz-master/bin/quiz/dialogs/QuizServer.class differ diff --git a/projects/quiz-master/bin/quiz/dialogs/QuizServer.form b/projects/quiz-master/bin/quiz/dialogs/QuizServer.form new file mode 100644 index 0000000..376a8cb --- /dev/null +++ b/projects/quiz-master/bin/quiz/dialogs/QuizServer.form @@ -0,0 +1,112 @@ + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/projects/quiz-master/bin/quiz/gui/Dialogs.class b/projects/quiz-master/bin/quiz/gui/Dialogs.class new file mode 100644 index 0000000..9a1149a Binary files /dev/null and b/projects/quiz-master/bin/quiz/gui/Dialogs.class differ diff --git a/projects/quiz-master/bin/quiz/gui/PlayerTableModel.class b/projects/quiz-master/bin/quiz/gui/PlayerTableModel.class new file mode 100644 index 0000000..dcf8a20 Binary files /dev/null and b/projects/quiz-master/bin/quiz/gui/PlayerTableModel.class differ diff --git a/projects/quiz-master/bin/quiz/messages/Message.class b/projects/quiz-master/bin/quiz/messages/Message.class new file mode 100644 index 0000000..9f99b1a Binary files /dev/null and b/projects/quiz-master/bin/quiz/messages/Message.class differ diff --git a/projects/quiz-master/bin/quiz/messages/MessageType.class b/projects/quiz-master/bin/quiz/messages/MessageType.class new file mode 100644 index 0000000..e52fbf7 Binary files /dev/null and b/projects/quiz-master/bin/quiz/messages/MessageType.class differ diff --git a/projects/quiz-master/bin/quiz/messages/MessageTypeAdapter$1.class b/projects/quiz-master/bin/quiz/messages/MessageTypeAdapter$1.class new file mode 100644 index 0000000..b57d2bb Binary files /dev/null and b/projects/quiz-master/bin/quiz/messages/MessageTypeAdapter$1.class differ diff --git a/projects/quiz-master/bin/quiz/messages/MessageTypeAdapter$2.class b/projects/quiz-master/bin/quiz/messages/MessageTypeAdapter$2.class new file mode 100644 index 0000000..30a319c Binary files /dev/null and b/projects/quiz-master/bin/quiz/messages/MessageTypeAdapter$2.class differ diff --git a/projects/quiz-master/bin/quiz/messages/MessageTypeAdapter.class b/projects/quiz-master/bin/quiz/messages/MessageTypeAdapter.class new file mode 100644 index 0000000..90a274f Binary files /dev/null and b/projects/quiz-master/bin/quiz/messages/MessageTypeAdapter.class differ diff --git a/projects/quiz-master/bin/quiz/resources/questoes.json b/projects/quiz-master/bin/quiz/resources/questoes.json new file mode 100644 index 0000000..f6f3429 --- /dev/null +++ b/projects/quiz-master/bin/quiz/resources/questoes.json @@ -0,0 +1,31 @@ +[ + { + "statement" : "É extraido da seringueira", + "answers" : [ + "Laca Vegetal", + "Malte", + "Látex" + ], + "correct": 2 + }, + + { + "statement" : "Qual o coletivo de chave?", + "answers" : [ + "Chaves", + "Chaveiro", + "Molho" + ], + "correct": 2 + }, + + { + "statement" : "Liberdade do estado de escravidão", + "answers" : [ + "Oforria", + "Alforria", + "Halforria" + ], + "correct": 1 + } +] \ No newline at end of file diff --git a/projects/quiz-master/bin/quiz/resources/quiz.png b/projects/quiz-master/bin/quiz/resources/quiz.png new file mode 100644 index 0000000..38f107c Binary files /dev/null and b/projects/quiz-master/bin/quiz/resources/quiz.png differ diff --git a/projects/quiz-master/bin/quiz/util/ChannelHelper.class b/projects/quiz-master/bin/quiz/util/ChannelHelper.class new file mode 100644 index 0000000..8f2a62e Binary files /dev/null and b/projects/quiz-master/bin/quiz/util/ChannelHelper.class differ diff --git a/projects/quiz-master/bin/quiz/util/GsonHelper.class b/projects/quiz-master/bin/quiz/util/GsonHelper.class new file mode 100644 index 0000000..0ed3ae1 Binary files /dev/null and b/projects/quiz-master/bin/quiz/util/GsonHelper.class differ diff --git a/projects/quiz-master/bin/quiz/util/GuiHelper.class b/projects/quiz-master/bin/quiz/util/GuiHelper.class new file mode 100644 index 0000000..b61c8b2 Binary files /dev/null and b/projects/quiz-master/bin/quiz/util/GuiHelper.class differ diff --git a/projects/quiz-master/build-before-profiler.xml b/projects/quiz-master/build-before-profiler.xml new file mode 100644 index 0000000..90da101 --- /dev/null +++ b/projects/quiz-master/build-before-profiler.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + Builds, tests, and runs the project Quiz. + + + diff --git a/projects/quiz-master/build.xml b/projects/quiz-master/build.xml new file mode 100644 index 0000000..be70c6a --- /dev/null +++ b/projects/quiz-master/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project quiz. + + + diff --git a/projects/quiz-master/build/classes/.netbeans_automatic_build b/projects/quiz-master/build/classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/projects/quiz-master/build/classes/.netbeans_update_resources b/projects/quiz-master/build/classes/.netbeans_update_resources new file mode 100644 index 0000000..e69de29 diff --git a/projects/quiz-master/build/classes/quiz/Quiz$1.class b/projects/quiz-master/build/classes/quiz/Quiz$1.class new file mode 100644 index 0000000..23e90a2 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/Quiz$1.class differ diff --git a/projects/quiz-master/build/classes/quiz/Quiz.class b/projects/quiz-master/build/classes/quiz/Quiz.class new file mode 100644 index 0000000..4f8fcd1 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/Quiz.class differ diff --git a/projects/quiz-master/build/classes/quiz/channels/ChannelEndPoint.class b/projects/quiz-master/build/classes/quiz/channels/ChannelEndPoint.class new file mode 100644 index 0000000..c443b42 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/channels/ChannelEndPoint.class differ diff --git a/projects/quiz-master/build/classes/quiz/channels/ChannelEndPointList.class b/projects/quiz-master/build/classes/quiz/channels/ChannelEndPointList.class new file mode 100644 index 0000000..b5603b5 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/channels/ChannelEndPointList.class differ diff --git a/projects/quiz-master/build/classes/quiz/channels/MessageChannel.class b/projects/quiz-master/build/classes/quiz/channels/MessageChannel.class new file mode 100644 index 0000000..ada1810 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/channels/MessageChannel.class differ diff --git a/projects/quiz-master/build/classes/quiz/core/Client$1.class b/projects/quiz-master/build/classes/quiz/core/Client$1.class new file mode 100644 index 0000000..b94e3d7 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/core/Client$1.class differ diff --git a/projects/quiz-master/build/classes/quiz/core/Client.class b/projects/quiz-master/build/classes/quiz/core/Client.class new file mode 100644 index 0000000..7fc5a91 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/core/Client.class differ diff --git a/projects/quiz-master/build/classes/quiz/core/ClientListener.class b/projects/quiz-master/build/classes/quiz/core/ClientListener.class new file mode 100644 index 0000000..912f36a Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/core/ClientListener.class differ diff --git a/projects/quiz-master/build/classes/quiz/core/Player.class b/projects/quiz-master/build/classes/quiz/core/Player.class new file mode 100644 index 0000000..41255c3 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/core/Player.class differ diff --git a/projects/quiz-master/build/classes/quiz/core/Question.class b/projects/quiz-master/build/classes/quiz/core/Question.class new file mode 100644 index 0000000..9293439 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/core/Question.class differ diff --git a/projects/quiz-master/build/classes/quiz/core/Server$1.class b/projects/quiz-master/build/classes/quiz/core/Server$1.class new file mode 100644 index 0000000..23812c8 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/core/Server$1.class differ diff --git a/projects/quiz-master/build/classes/quiz/core/Server.class b/projects/quiz-master/build/classes/quiz/core/Server.class new file mode 100644 index 0000000..a8d0dfa Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/core/Server.class differ diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizMain$1.class b/projects/quiz-master/build/classes/quiz/dialogs/QuizMain$1.class new file mode 100644 index 0000000..250a813 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/dialogs/QuizMain$1.class differ diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizMain$2.class b/projects/quiz-master/build/classes/quiz/dialogs/QuizMain$2.class new file mode 100644 index 0000000..a7fa348 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/dialogs/QuizMain$2.class differ diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizMain$3.class b/projects/quiz-master/build/classes/quiz/dialogs/QuizMain$3.class new file mode 100644 index 0000000..be28a85 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/dialogs/QuizMain$3.class differ diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizMain.class b/projects/quiz-master/build/classes/quiz/dialogs/QuizMain.class new file mode 100644 index 0000000..d3d6efb Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/dialogs/QuizMain.class differ diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizMain.form b/projects/quiz-master/build/classes/quiz/dialogs/QuizMain.form new file mode 100644 index 0000000..6226fe0 --- /dev/null +++ b/projects/quiz-master/build/classes/quiz/dialogs/QuizMain.form @@ -0,0 +1,141 @@ + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizMatch$1.class b/projects/quiz-master/build/classes/quiz/dialogs/QuizMatch$1.class new file mode 100644 index 0000000..13e88f2 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/dialogs/QuizMatch$1.class differ diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizMatch$2.class b/projects/quiz-master/build/classes/quiz/dialogs/QuizMatch$2.class new file mode 100644 index 0000000..d633088 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/dialogs/QuizMatch$2.class differ diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizMatch$3.class b/projects/quiz-master/build/classes/quiz/dialogs/QuizMatch$3.class new file mode 100644 index 0000000..c675dac Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/dialogs/QuizMatch$3.class differ diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizMatch.class b/projects/quiz-master/build/classes/quiz/dialogs/QuizMatch.class new file mode 100644 index 0000000..d75598c Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/dialogs/QuizMatch.class differ diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizMatch.form b/projects/quiz-master/build/classes/quiz/dialogs/QuizMatch.form new file mode 100644 index 0000000..38310a8 --- /dev/null +++ b/projects/quiz-master/build/classes/quiz/dialogs/QuizMatch.form @@ -0,0 +1,199 @@ + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizServer$1.class b/projects/quiz-master/build/classes/quiz/dialogs/QuizServer$1.class new file mode 100644 index 0000000..dc8e726 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/dialogs/QuizServer$1.class differ diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizServer$2.class b/projects/quiz-master/build/classes/quiz/dialogs/QuizServer$2.class new file mode 100644 index 0000000..1033efa Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/dialogs/QuizServer$2.class differ diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizServer$3.class b/projects/quiz-master/build/classes/quiz/dialogs/QuizServer$3.class new file mode 100644 index 0000000..7f688cc Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/dialogs/QuizServer$3.class differ diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizServer$4.class b/projects/quiz-master/build/classes/quiz/dialogs/QuizServer$4.class new file mode 100644 index 0000000..1585de3 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/dialogs/QuizServer$4.class differ diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizServer$5.class b/projects/quiz-master/build/classes/quiz/dialogs/QuizServer$5.class new file mode 100644 index 0000000..b4f36b1 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/dialogs/QuizServer$5.class differ diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizServer.class b/projects/quiz-master/build/classes/quiz/dialogs/QuizServer.class new file mode 100644 index 0000000..b3edd29 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/dialogs/QuizServer.class differ diff --git a/projects/quiz-master/build/classes/quiz/dialogs/QuizServer.form b/projects/quiz-master/build/classes/quiz/dialogs/QuizServer.form new file mode 100644 index 0000000..376a8cb --- /dev/null +++ b/projects/quiz-master/build/classes/quiz/dialogs/QuizServer.form @@ -0,0 +1,112 @@ + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/projects/quiz-master/build/classes/quiz/gui/Dialogs.class b/projects/quiz-master/build/classes/quiz/gui/Dialogs.class new file mode 100644 index 0000000..6a2ae29 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/gui/Dialogs.class differ diff --git a/projects/quiz-master/build/classes/quiz/gui/PlayerTableModel.class b/projects/quiz-master/build/classes/quiz/gui/PlayerTableModel.class new file mode 100644 index 0000000..8d07e93 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/gui/PlayerTableModel.class differ diff --git a/projects/quiz-master/build/classes/quiz/messages/Message.class b/projects/quiz-master/build/classes/quiz/messages/Message.class new file mode 100644 index 0000000..2c6514b Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/messages/Message.class differ diff --git a/projects/quiz-master/build/classes/quiz/messages/MessageType.class b/projects/quiz-master/build/classes/quiz/messages/MessageType.class new file mode 100644 index 0000000..9fb752b Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/messages/MessageType.class differ diff --git a/projects/quiz-master/build/classes/quiz/messages/MessageTypeAdapter$1.class b/projects/quiz-master/build/classes/quiz/messages/MessageTypeAdapter$1.class new file mode 100644 index 0000000..1d7c5c4 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/messages/MessageTypeAdapter$1.class differ diff --git a/projects/quiz-master/build/classes/quiz/messages/MessageTypeAdapter$2.class b/projects/quiz-master/build/classes/quiz/messages/MessageTypeAdapter$2.class new file mode 100644 index 0000000..8e3cc1a Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/messages/MessageTypeAdapter$2.class differ diff --git a/projects/quiz-master/build/classes/quiz/messages/MessageTypeAdapter$3.class b/projects/quiz-master/build/classes/quiz/messages/MessageTypeAdapter$3.class new file mode 100644 index 0000000..f72b2fc Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/messages/MessageTypeAdapter$3.class differ diff --git a/projects/quiz-master/build/classes/quiz/messages/MessageTypeAdapter.class b/projects/quiz-master/build/classes/quiz/messages/MessageTypeAdapter.class new file mode 100644 index 0000000..2e5ca57 Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/messages/MessageTypeAdapter.class differ diff --git a/projects/quiz-master/build/classes/quiz/resources/questoes.json b/projects/quiz-master/build/classes/quiz/resources/questoes.json new file mode 100644 index 0000000..f6f3429 --- /dev/null +++ b/projects/quiz-master/build/classes/quiz/resources/questoes.json @@ -0,0 +1,31 @@ +[ + { + "statement" : "É extraido da seringueira", + "answers" : [ + "Laca Vegetal", + "Malte", + "Látex" + ], + "correct": 2 + }, + + { + "statement" : "Qual o coletivo de chave?", + "answers" : [ + "Chaves", + "Chaveiro", + "Molho" + ], + "correct": 2 + }, + + { + "statement" : "Liberdade do estado de escravidão", + "answers" : [ + "Oforria", + "Alforria", + "Halforria" + ], + "correct": 1 + } +] \ No newline at end of file diff --git a/projects/quiz-master/build/classes/quiz/resources/quiz.png b/projects/quiz-master/build/classes/quiz/resources/quiz.png new file mode 100644 index 0000000..38f107c Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/resources/quiz.png differ diff --git a/projects/quiz-master/build/classes/quiz/util/ChannelHelper.class b/projects/quiz-master/build/classes/quiz/util/ChannelHelper.class new file mode 100644 index 0000000..4b0e52c Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/util/ChannelHelper.class differ diff --git a/projects/quiz-master/build/classes/quiz/util/GsonHelper.class b/projects/quiz-master/build/classes/quiz/util/GsonHelper.class new file mode 100644 index 0000000..9d1892c Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/util/GsonHelper.class differ diff --git a/projects/quiz-master/build/classes/quiz/util/GuiHelper.class b/projects/quiz-master/build/classes/quiz/util/GuiHelper.class new file mode 100644 index 0000000..fd48c1e Binary files /dev/null and b/projects/quiz-master/build/classes/quiz/util/GuiHelper.class differ diff --git a/projects/quiz-master/lib/google-gson-1.7.1/LICENSE b/projects/quiz-master/lib/google-gson-1.7.1/LICENSE new file mode 100644 index 0000000..8763058 --- /dev/null +++ b/projects/quiz-master/lib/google-gson-1.7.1/LICENSE @@ -0,0 +1,203 @@ +Google Gson + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2008-2011 Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/projects/quiz-master/lib/google-gson-1.7.1/README b/projects/quiz-master/lib/google-gson-1.7.1/README new file mode 100644 index 0000000..a0562cc --- /dev/null +++ b/projects/quiz-master/lib/google-gson-1.7.1/README @@ -0,0 +1,7 @@ +Gson is a Java library that can be used to convert a Java object into its +JSON representation. It can also be used to convert a JSON string into an +equivalent Java object. Gson can work with arbitrary Java objects including +pre-existing objects that you do not have source-code of. + +Complete Gson documentation is available at its project page +http://code.google.com/p/google-gson diff --git a/projects/quiz-master/lib/google-gson-1.7.1/gson-1.7.1-javadoc.jar b/projects/quiz-master/lib/google-gson-1.7.1/gson-1.7.1-javadoc.jar new file mode 100644 index 0000000..5936fe6 Binary files /dev/null and b/projects/quiz-master/lib/google-gson-1.7.1/gson-1.7.1-javadoc.jar differ diff --git a/projects/quiz-master/lib/google-gson-1.7.1/gson-1.7.1-sources.jar b/projects/quiz-master/lib/google-gson-1.7.1/gson-1.7.1-sources.jar new file mode 100644 index 0000000..d4854d9 Binary files /dev/null and b/projects/quiz-master/lib/google-gson-1.7.1/gson-1.7.1-sources.jar differ diff --git a/projects/quiz-master/lib/google-gson-1.7.1/gson-1.7.1.jar b/projects/quiz-master/lib/google-gson-1.7.1/gson-1.7.1.jar new file mode 100644 index 0000000..acd16c0 Binary files /dev/null and b/projects/quiz-master/lib/google-gson-1.7.1/gson-1.7.1.jar differ diff --git a/projects/quiz-master/manifest.mf b/projects/quiz-master/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/projects/quiz-master/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/projects/quiz-master/nbproject/build-impl.xml b/projects/quiz-master/nbproject/build-impl.xml new file mode 100644 index 0000000..d204fbc --- /dev/null +++ b/projects/quiz-master/nbproject/build-impl.xml @@ -0,0 +1,1420 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/quiz-master/nbproject/genfiles.properties b/projects/quiz-master/nbproject/genfiles.properties new file mode 100644 index 0000000..c6bbc36 --- /dev/null +++ b/projects/quiz-master/nbproject/genfiles.properties @@ -0,0 +1,11 @@ +build.xml.data.CRC32=6b873036 +build.xml.script.CRC32=177f94b0 +build.xml.stylesheet.CRC32=8064a381@1.80.1.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=6b873036 +nbproject/build-impl.xml.script.CRC32=fe2f44ee +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 +nbproject/profiler-build-impl.xml.data.CRC32=83d40a88 +nbproject/profiler-build-impl.xml.script.CRC32=abda56ed +nbproject/profiler-build-impl.xml.stylesheet.CRC32=f10cf54c@1.11.1 diff --git a/projects/quiz-master/nbproject/private/config.properties b/projects/quiz-master/nbproject/private/config.properties new file mode 100644 index 0000000..e69de29 diff --git a/projects/quiz-master/nbproject/private/private.properties b/projects/quiz-master/nbproject/private/private.properties new file mode 100644 index 0000000..c116194 --- /dev/null +++ b/projects/quiz-master/nbproject/private/private.properties @@ -0,0 +1,7 @@ +#Wed Apr 13 20:00:40 GMT-03:00 2011 +compile.on.save=true +do.depend=false +do.jar=true +javac.debug=true +javadoc.preview=true +user.properties.file=C:\\Users\\HP\\AppData\\Roaming\\NetBeans\\8.2\\build.properties diff --git a/projects/quiz-master/nbproject/private/private.xml b/projects/quiz-master/nbproject/private/private.xml new file mode 100644 index 0000000..75fea1f --- /dev/null +++ b/projects/quiz-master/nbproject/private/private.xml @@ -0,0 +1,11 @@ + + + + + + + file:/C:/Users/HP/Downloads/projects/quiz-master/src/quiz/Quiz.java + file:/C:/Users/HP/Downloads/projects/quiz-master/src/quiz/core/Player.java + + + diff --git a/projects/quiz-master/nbproject/private/profiler/configurations.xml b/projects/quiz-master/nbproject/private/profiler/configurations.xml new file mode 100644 index 0000000..f69c35f --- /dev/null +++ b/projects/quiz-master/nbproject/private/profiler/configurations.xml @@ -0,0 +1,107 @@ + + + +1000 +false +profiler.simple.filter +false + +8 +true + +false +0 +false +2 +false +true +false +profiler.simple.filter +32 +false +1 +true +3 +10 +1 +true +Analisar memória +false +1 +true +20 +0 +profiler.simple.filter +0 +false +true + + +1 + + +false +false +true +false +false +32 +Filtro rápido... +0 +false +0 +{$project.classes.only} +10 +0 +true +true + +true +10 + +1000 +0 +profiler.simple.filter +false +Analisar performance + +1 +0 + +-10 +false +profiler.simple.filter +Filtro rápido... +true +false +0 + +2 +32 + +0 +false +Perfilar apenas classes do projeto +0 +0 +profiler.simple.filter +true +1 +false +10 +false +10 +false +true +true +false +Filtro rápido... +0 +false + +4 +Aplicativo do monitor +1000 +true +true + diff --git a/projects/quiz-master/nbproject/profiler-build-impl.xml b/projects/quiz-master/nbproject/profiler-build-impl.xml new file mode 100644 index 0000000..7c8995d --- /dev/null +++ b/projects/quiz-master/nbproject/profiler-build-impl.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + Must select one file in the IDE or set profile.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/quiz-master/nbproject/project.properties b/projects/quiz-master/nbproject/project.properties new file mode 100644 index 0000000..3100414 --- /dev/null +++ b/projects/quiz-master/nbproject/project.properties @@ -0,0 +1,73 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.run.all.processors=true +application.desc=A simple java desktop application based on Swing Application Framework +application.homepage=http://appframework.dev.java.net +application.title=Basic Application Example +application.vendor=Sun Microsystems Inc. +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/quiz.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.gson-1.7.1.jar=lib/google-gson-1.7.1/gson-1.7.1.jar +includes=** +jar.compress=false +javac.classpath=\ + ${file.reference.gson-1.7.1.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.6 +javac.target=1.6 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.reference.gson-1.7.1.jar=lib/google-gson-1.7.1/gson-1.7.1-javadoc.jar +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=quiz.Quiz +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value +# or test-sys-prop.name=value to set system properties for unit tests): +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +source.reference.gson-1.7.1.jar=lib/google-gson-1.7.1/gson-1.7.1-sources.jar +src.dir=src +test.src.dir=test diff --git a/projects/quiz-master/nbproject/project.xml b/projects/quiz-master/nbproject/project.xml new file mode 100644 index 0000000..74e9083 --- /dev/null +++ b/projects/quiz-master/nbproject/project.xml @@ -0,0 +1,16 @@ + + + org.netbeans.modules.java.j2seproject + + + quiz + 1.6.5 + + + + + + + + + diff --git a/projects/quiz-master/src/quiz/Quiz.java b/projects/quiz-master/src/quiz/Quiz.java new file mode 100644 index 0000000..9f41ea3 --- /dev/null +++ b/projects/quiz-master/src/quiz/Quiz.java @@ -0,0 +1,28 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package quiz; + +import quiz.dialogs.QuizMain; + +/** + * + * @author aluno + */ +public class Quiz { + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + java.awt.EventQueue.invokeLater(new Runnable() { + + @Override + public void run() { + new QuizMain().setVisible(true); + } + }); + } +} diff --git a/projects/quiz-master/src/quiz/channels/ChannelEndPoint.java b/projects/quiz-master/src/quiz/channels/ChannelEndPoint.java new file mode 100644 index 0000000..b274496 --- /dev/null +++ b/projects/quiz-master/src/quiz/channels/ChannelEndPoint.java @@ -0,0 +1,207 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package quiz.channels; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.channels.ClosedChannelException; +import java.nio.channels.SelectionKey; +import java.nio.channels.SocketChannel; +import java.util.Iterator; +import java.util.Scanner; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.logging.Level; +import java.util.logging.Logger; +import quiz.messages.Message; +import quiz.util.GsonHelper; + +/** + * + * @author higor + */ +public final class ChannelEndPoint implements MessageChannel { + + public static final int DEFAULT_BUFSIZE = 8192; + public static final int DELAY = 200; + public static final String DELIMITER = "\r\n"; + private LinkedBlockingQueue sendQueue; + private LinkedBlockingQueue recvQueue; + private SocketChannel channel; + private ByteBuffer buffer; + private SelectionKey key; + + public ChannelEndPoint(SelectionKey key, int bufSize) throws ClosedChannelException { + this.sendQueue = new LinkedBlockingQueue(); + this.recvQueue = new LinkedBlockingQueue(); + this.buffer = ByteBuffer.allocate(bufSize); + this.channel = (SocketChannel) key.channel(); + this.key = key; + + System.out.println("Nó " + this.channel.hashCode() + " conectado."); + } + + public ChannelEndPoint(SelectionKey key) throws ClosedChannelException { + this(key, DEFAULT_BUFSIZE); + } + + @Override + protected void finalize() throws Throwable { + close(); + channel = null; + buffer = null; + sendQueue = null; + recvQueue = null; + super.finalize(); + } + + public void flush() throws IOException { + flush(-1); + } + + public synchronized void flush(int amount) throws IOException { + Iterator messages = sendQueue.iterator(); + + while (amount != 0 && messages.hasNext()) { + Message message = messages.next(); + messages.remove(); + + String json = GsonHelper.toJson(message, Message.class) + DELIMITER; + + getBuffer().clear(); + getBuffer().put(json.getBytes()); + + int sent = -1; + int attempts = 10; + + do { + + /* somente será zero se uma tentativa de escrita tiver sido feita. */ + if (sent == 0) { + attempts--; + } + + if (attempts == 0) { + throw new IOException("Could not write."); + } + + getBuffer().flip(); + sent = getChannel().write(getBuffer()); + //buffer.compact(); + + } while (getBuffer().hasRemaining()); + + //System.out.println(channel.hashCode() + " enviado: " + json.trim()); + + amount--; + } + } + + public boolean hold() throws IOException { + return hold(-1); + } + + public synchronized boolean hold(int amount) throws IOException { + + if (!isOpen()) { + throw new IOException("Channel is closed."); + } + + do { + int read = 0; + + getBuffer().clear(); + read = getChannel().read(getBuffer()); + getBuffer().flip(); + + /* Cliente desconectou */ + if (read == -1) { + close(); + return false; + } + + /* Nada para ler */ + if (read == 0) { + break; + } + + String source = new String(getBuffer().array(), 0, read); + + Scanner scanner = new Scanner(source); + + scanner.useDelimiter(DELIMITER); + + while (scanner.hasNext()) { + String json = scanner.next().trim(); + Message message = GsonHelper.fromJson(json, Message.class); + + //System.out.println(channel.hashCode() + " recebido: " + json); + + recvQueue.add(message); + } + + } while (--amount != 0); + + return true; + } + + public synchronized boolean hasUnread() { + return !recvQueue.isEmpty(); + } + + public synchronized boolean hasUnwritten() { + return !sendQueue.isEmpty(); + } + + @Override + public synchronized boolean isOpen() { + return getChannel().isOpen(); + } + + public synchronized boolean isValid() { + return getKey().isValid(); + } + + @Override + public synchronized void close() throws IOException { + if (getChannel().isOpen()) { + getChannel().close(); + System.out.println("Nó " + this.getChannel().hashCode() + " desconectado."); + } + + if (getKey().isValid()) { + getKey().cancel(); + } + + sendQueue.clear(); + + recvQueue.clear(); + } + + @Override + public synchronized Message read() { + return recvQueue.poll(); + } + + @Override + public synchronized void write(Message message) { + try { + sendQueue.put(message); + } catch (InterruptedException ex) { + Logger.getLogger(ChannelEndPoint.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public SocketChannel getChannel() { + return channel; + } + + public ByteBuffer getBuffer() { + return buffer; + } + + public SelectionKey getKey() { + return key; + } +} diff --git a/projects/quiz-master/src/quiz/channels/ChannelEndPointList.java b/projects/quiz-master/src/quiz/channels/ChannelEndPointList.java new file mode 100644 index 0000000..3e5b393 --- /dev/null +++ b/projects/quiz-master/src/quiz/channels/ChannelEndPointList.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package quiz.channels; + +import java.io.IOException; +import java.nio.channels.SelectionKey; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.logging.Level; +import java.util.logging.Logger; +import quiz.messages.Message; + +/** + * + * @author higor + */ +public class ChannelEndPointList extends CopyOnWriteArrayList { + + public ChannelEndPointList() { + super(); + } + + public void broadcast(Message message) { + broadcast(message, false); + } + + public void broadcast(Message message, boolean flush) { + + for (ChannelEndPoint endPoint : this) { + + endPoint.write(new Message(message)); + if (flush) { + try { + endPoint.flush(); + } catch (IOException ex) { + Logger.getLogger(ChannelEndPointList.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + } + + public ChannelEndPointList getInvalid() { + ChannelEndPointList list = new ChannelEndPointList(); + + for (ChannelEndPoint endPoint : this) { + if (!endPoint.isValid()) { + list.add(endPoint); + remove(endPoint); + } + } + + return list; + } + + public void refreshOps() { + for (ChannelEndPoint endPoint : this) { + + if (endPoint.hasUnwritten()) { + endPoint.getKey().interestOps(SelectionKey.OP_WRITE); + } else { + endPoint.getKey().interestOps(SelectionKey.OP_READ); + } + } + } +} diff --git a/projects/quiz-master/src/quiz/channels/MessageChannel.java b/projects/quiz-master/src/quiz/channels/MessageChannel.java new file mode 100644 index 0000000..13b00a2 --- /dev/null +++ b/projects/quiz-master/src/quiz/channels/MessageChannel.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package quiz.channels; + +import java.nio.channels.Channel; +import quiz.messages.Message; + +/** + * + * @author higor + */ +public interface MessageChannel extends Channel { + public Message read(); + public void write(Message message); +} diff --git a/projects/quiz-master/src/quiz/core/Client.java b/projects/quiz-master/src/quiz/core/Client.java new file mode 100644 index 0000000..f7af621 --- /dev/null +++ b/projects/quiz-master/src/quiz/core/Client.java @@ -0,0 +1,358 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package quiz.core; + +import quiz.messages.Message; +import quiz.messages.MessageType; +import java.io.IOException; +import java.net.ConnectException; +import java.net.InetSocketAddress; +import java.nio.channels.SelectionKey; +import java.nio.channels.Selector; +import java.nio.channels.SocketChannel; +import java.nio.channels.spi.SelectorProvider; +import java.util.Iterator; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import quiz.channels.ChannelEndPoint; + +/** + * + * @author higor + */ +public class Client implements Runnable { + + private boolean leave; + private Selector selector; + private ChannelEndPoint server; + private ClientListener listener; + + public Client(String host, int port) throws IOException { + leave = false; + selector = SelectorProvider.provider().openSelector(); + + SocketChannel sc = SocketChannel.open(); + sc.configureBlocking(false); + sc.connect(new InetSocketAddress(host, port)); + + sc.register(selector, SelectionKey.OP_CONNECT); + } + + public void setListener(ClientListener listener) { + this.listener = listener; + } + + @Override + protected void finalize() throws Throwable { + if (selector.isOpen()) { + selector.close(); + } + super.finalize(); + } + + @Override + public void run() { + + while (!leave && selector.isOpen()) { + int selected = 0; + boolean write = true; + + try { + selected = selector.select(300); + + } catch (IOException ex) { + Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex); + break; + } finally { + /*if (selected == 0 && selector.isOpen()) { + System.out.println("Timeout."); + listener.onTimeout(this); + break; + }*/ + } + + Iterator keys = selector.selectedKeys().iterator(); + SelectionKey key = null; + + /* só há um socket no selector e portanto somente uma chave. + não é necessário um loop aqui. */ + if (keys.hasNext()) { + key = keys.next(); + keys.remove(); + } + + /* nenhuma chave selecionada */ + if (key != null) { + /* só existe um canal. se falhar então acabou-se tudo. */ + if (!key.isValid()) { + disconnect(); + break; + } + + try { + + if (key.isConnectable()) { + handleConnect(key); + + } else if (key.isReadable()) { + handleRead(key); + + } else if (key.isWritable()) { + handleWrite(key); + } + + if (!key.isValid()) { + break; + } + + } catch (IOException ex) { + Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex); + disconnect(); + break; + } + } + + if (server == null || !server.isOpen()) { + continue; + } + + if (!server.isValid()) { + break; + } + + if (server.hasUnwritten()) { + server.getKey().interestOps(SelectionKey.OP_WRITE); + } else { + server.getKey().interestOps(SelectionKey.OP_READ); + } + + if (Thread.interrupted()) { + disconnect(); + continue; + } + } + } + + private void handleConnect(SelectionKey key) throws IOException { + + SocketChannel channel = (SocketChannel) key.channel(); + + try { + + channel.finishConnect(); + + Thread.sleep(110); + + server = new ChannelEndPoint(key); + + + listener.onConnect(this, false); + key.attach(server); + key.interestOps(SelectionKey.OP_WRITE); + + } catch (InterruptedException ex) { + } catch (ConnectException ex) { + listener.onConnect(this, true); + //Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex); + } + } + + private void handleRead(SelectionKey key) throws IOException { + + if (!server.isOpen()) { + return; + } + + if (!server.hold()) { + disconnect(); + return; + } + + while (server.hasUnread()) { + handleCommand(server.read()); + } + } + + private void handleWrite(SelectionKey key) throws IOException { + + if (!server.isOpen()) { + return; + } + + server.flush(); + } + + private void handleCommand(Message inmsg) { + + if (inmsg == null) { + disconnect(); + return; + } + + switch (inmsg.getType()) { + case Login: { + if (!inmsg.hasArgs()) { + synchronized (this) { + listener.onLogin(this, null); + } + break; + } + + Player p = inmsg.getObject(0, Player.class); + + if (p == null) { + synchronized (this) { + listener.onDisconnect(this, true); + } + break; + } + + synchronized (this) { + listener.onLogin(this, p); + } + break; + } + case Join: { + Player p = null; + + p = inmsg.getObject(0, Player.class); + + if (p == null) { + break; + } + + synchronized (this) { + listener.onJoin(this, p); + } + break; + } + case Leave: { + Player p = null; + + p = inmsg.getObject(0, Player.class); + + if (p == null) { + break; + } + + synchronized (this) { + listener.onLeave(this, p); + } + + break; + } + case List: { + List entries; + + entries = inmsg.getObject(0, List.class); + + if (entries == null) { + break; + } + + synchronized (this) { + listener.onList(this, entries); + } + break; + } + case Ready: { + Player p = inmsg.getObject(0, Player.class); + + if (p == null) { + break; + } + synchronized (this) { + listener.onReady(this, p); + } + break; + } + case Idle: { + Player p = inmsg.getObject(0, Player.class); + if (p == null) { + break; + } + + synchronized (this) { + listener.onIdle(this, p); + } + break; + } + case Start: { + List questions = inmsg.getObject(0, List.class); + + if (questions == null || questions.isEmpty()) { + break; + } + + synchronized (this) { + listener.onStart(this, questions); + } + break; + } + case End: { + Player p = inmsg.getObject(0, Player.class); + if (p == null) { + break; + } + + synchronized (this) { + listener.onEnd(this, p); + } + + break; + } + } + } + + public synchronized void disconnect() { + if (leave == true || !selector.isOpen()) { + return; + } + + try { + if (server != null) { + server.close(); + } + + selector.close(); + leave = true; + } catch (IOException ex) { + Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex); + } finally { + listener.onDisconnect(this, false); + } + } + + public void ready() { + server.write(new Message(MessageType.Ready)); + } + + public void login(String nome) { + Message msg = new Message(MessageType.Login); + msg.addArg(nome); + + server.write(msg); + } + + public void list() { + Message msg = new Message(MessageType.List); + + server.write(msg); + } + + public void logout() { + Message msg = new Message(MessageType.Logout); + + server.write(msg); + } + + public void answer(int answer) { + Message msg = new Message(MessageType.Answer); + msg.addArg(answer); + + server.write(msg); + } +} diff --git a/projects/quiz-master/src/quiz/core/ClientListener.java b/projects/quiz-master/src/quiz/core/ClientListener.java new file mode 100644 index 0000000..ef0a05c --- /dev/null +++ b/projects/quiz-master/src/quiz/core/ClientListener.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package quiz.core; + +import java.util.List; + +/** + * + * @author higor + */ +public interface ClientListener { + + public void onConnect(Client source, boolean fail); + + public void onDisconnect(Client source, boolean busy); + + public void onTimeout(Client source); + + public void onLogin(Client source, Player player); + + public void onReady(Client source, Player player); + + public void onList(Client source, List players); + + public void onJoin(Client source, Player player); + + public void onLeave(Client source, Player player); + + public void onStart(Client source, List questions); + + public void onIdle(Client source, Player player); + + public void onEnd(Client source, Player player); + +} diff --git a/projects/quiz-master/src/quiz/core/Player.java b/projects/quiz-master/src/quiz/core/Player.java new file mode 100644 index 0000000..70f2a36 --- /dev/null +++ b/projects/quiz-master/src/quiz/core/Player.java @@ -0,0 +1,133 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package quiz.core; + +import java.io.Serializable; + +/** + * + * @author higor + */ +public class Player implements Serializable { + public static final int INITIAL_TIME = 300; + private String name; + private int points = 0; + private int question = -1; + private int continues = 3; + private long time = INITIAL_TIME; + private boolean ready = false; + private boolean done = false; + + @Override + public boolean equals(Object obj) { + + if (obj == null || !Player.class.isAssignableFrom(obj.getClass())) { + return false; + } + + Player p = (Player) obj; + + return p.getName().equals(this.getName()); + } + + @Override + public int hashCode() { + int hash = 5; + hash = 29 * hash + (this.name != null ? this.name.hashCode() : 0); + return hash; + } + + public Player() { + + } + + public Player(String name) { + setName(name); + } + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getPoints() { + return points; + } + + public void setPoints(int points) { + this.points = points; + } + + public int getQuestion() { + return question; + } + + public void setQuestion(int question) { + this.question = question; + } + + public boolean isReady() { + return ready; + } + + public void setReady(boolean ready) { + this.ready = ready; + } + + public boolean isDone() { + return done; + } + + public void setDone(boolean done) { + this.done = done; + } + + public int getContinues() { + return continues; + } + + public void setContinues(int continues) { + this.continues = continues; + } + + public long getTime() { + return time; + } + + public void setTime(long time) { + this.time = time; + } + + public synchronized void update(Player p) { + if (!name.equals(p.name)) { + return; + } + + name = p.name; + continues = p.continues; + points = p.points; + question = p.question; + done = p.done; + ready = p.ready; + time = p.time; + } + + public void nextQuestion() { + question++; + } + + public void useContinue() { + continues--; + } + + public boolean lost() { + return continues >= 0; + } +} diff --git a/projects/quiz-master/src/quiz/core/Question.java b/projects/quiz-master/src/quiz/core/Question.java new file mode 100644 index 0000000..f8db7d0 --- /dev/null +++ b/projects/quiz-master/src/quiz/core/Question.java @@ -0,0 +1,50 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package quiz.core; + +import java.util.List; + +/** + * + * @author higor + */ +public class Question { + private String statement; + private List answers; + private int correct; + + public Question(String statement) { + setStatement(statement); + } + + public String getStatement() { + return statement; + } + + public void setStatement(String statement) { + this.statement = statement; + } + + public String getAnswer(int n) { + return answers.get(n); + } + + public List getAnswers() { + return answers; + } + + public void setAnswers(List alternative) { + this.answers = alternative; + } + + public int getCorrect() { + return correct; + } + + public void setCorrect(int correct) { + this.correct = correct; + } + +} diff --git a/projects/quiz-master/src/quiz/core/Server.java b/projects/quiz-master/src/quiz/core/Server.java new file mode 100644 index 0000000..a1ae966 --- /dev/null +++ b/projects/quiz-master/src/quiz/core/Server.java @@ -0,0 +1,483 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package quiz.core; + +import java.util.Set; +import quiz.messages.Message; +import quiz.messages.MessageType; +import quiz.channels.ChannelEndPoint; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.nio.channels.ClosedChannelException; +import java.nio.channels.SelectionKey; +import java.nio.channels.Selector; +import java.nio.channels.ServerSocketChannel; +import java.nio.channels.SocketChannel; +import java.nio.channels.spi.SelectorProvider; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.logging.Level; +import java.util.logging.Logger; +import quiz.channels.ChannelEndPointList; +import quiz.util.GsonHelper; + +/** + * + * @author higor + */ +final public class Server implements Runnable { + + public static final int MAX_TRANSFERS = 100; + public static final int TIMEOUT = 5000; + public static final int BUFFER_SIZE = 4096; + private AtomicBoolean quit; + private final Message loginFailMessage = new Message(MessageType.Login); + private ChannelEndPointList clients; + private ConcurrentMap players; + private Selector selector; + private long lastUpdate; + private boolean gameStarted; + private List questions = new ArrayList(); + + //private SocketAddress bindTo; + public Server(String host, int port) throws IOException { + this(new InetSocketAddress(host, port)); + } + + public Server(int port) throws IOException { + this(new InetSocketAddress("0.0.0.0", port)); + } + + public Server(InetSocketAddress bindTo) throws IOException { + quit = new AtomicBoolean(false); + clients = new ChannelEndPointList(); + players = new ConcurrentHashMap(); + //this.bindTo = bindTo; + + selector = SelectorProvider.provider().openSelector(); + + ServerSocketChannel ssc = ServerSocketChannel.open(); + ssc.socket().bind(bindTo); + ssc.configureBlocking(false); + + ssc.register(selector, SelectionKey.OP_ACCEPT); + } + + @Override + public void finalize() throws Throwable { + clients.clear(); + + super.finalize(); + } + + @Override + public void run() { + + players.clear(); + clients.clear(); + + + while (!getQuit()) { + try { + selector.select(100); + } catch (IOException ex) { + Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex); + } + + Iterator keys = selector.selectedKeys().iterator(); + + if (!keys.hasNext()) { + clients.refreshOps(); + + cleanup(); + + updatePlayers(); + } + + while (keys.hasNext()) { + SelectionKey key = keys.next(); + keys.remove(); + + try { + if (!key.isValid()) { + if (key.channel().isOpen()) { + unregisterClient((ChannelEndPoint) key.attachment()); + } + + key = null; + // xxx: talvez desconectar. + continue; + } + + if (key.isAcceptable()) { + + handleAccept(key); + + } else if (key.isReadable()) { + + handleRead(key); + + } else if (key.isWritable()) { + + handleWrite(key); + + } + + cleanup(); + + clients.refreshOps(); + + updatePlayers(); + + + + } catch (IOException ex) { + Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex); + } + } + + if (Thread.interrupted()) { + close(); + break; + } + } + } + + public synchronized void close() { + setQuit(true); + + for (ChannelEndPoint client : clients) { + try { + client.close(); + } catch (IOException ex) { + Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex); + } + } + + Set it = selector.keys(); + + for (SelectionKey key : selector.keys()) { + if (key.isValid()) { + try { + key.channel().close(); + key.cancel(); + } catch (IOException ex) { + Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + + try { + selector.close(); + } catch (IOException ex) { + Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex); + } + } + + private void cleanup() { + //ChannelEndPointList invalid = clients.getInvalid(); + + for (ChannelEndPoint endPoint : clients) { + Player player = players.get(endPoint); + + /* remove invalidos. */ + if (!endPoint.isValid()) { + players.remove(endPoint); + + if (player != null) { + Message msg = new Message(MessageType.Leave); + msg.addArg(player); + + clients.broadcast(msg); + } + + continue; + } else { + if (player == null) { + continue; + } + + if (player.lost()) { + players.remove(player); + } + } + } + + if (players.isEmpty()) { + gameStarted = false; + } + } + + private void handleAccept(SelectionKey serverKey) throws IOException { + ServerSocketChannel serverChannel = (ServerSocketChannel) serverKey.channel(); + + SocketChannel clientChannel = serverChannel.accept(); + clientChannel.configureBlocking(false); + + registerClient(clientChannel.register(selector, SelectionKey.OP_READ)); + } + + private void handleRead(SelectionKey key) throws IOException { + ChannelEndPoint client = (ChannelEndPoint) key.attachment(); + + try { + if (!client.hold()) { + unregisterClient(client); + return; + } + + while (client.hasUnread()) { + handleCommand(client, client.read()); + } + + /*if (client.hasUnwritten()) { + key.interestOps(SelectionKey.OP_WRITE); + }*/ + } catch (IOException ex) { + unregisterClient(client); + } + } + + private void handleWrite(SelectionKey key) throws IOException { + ChannelEndPoint client = (ChannelEndPoint) key.attachment(); + + client.flush(); + } + + private void handleCommand(ChannelEndPoint endPoint, Message inmsg) throws IOException { + Message outmsg = null; + Player player = players.get(endPoint); + + switch (inmsg.getType()) { + case Login: { + if (gameStarted) { + endPoint.write(new Message(MessageType.Login, null)); + break; + } + if (!inmsg.hasArgs()) { + endPoint.write(loginFailMessage); + break; + } + + String name = inmsg.getString(0); + + /* Já existe um jogador com esse nome. */ + if (findPlayer(name) != null) { + endPoint.write(loginFailMessage); + break; + } + + player = new Player(); + player.setName(name); + + players.putIfAbsent(endPoint, player); + + outmsg = new Message(MessageType.Login); + outmsg.addArg(player); + + endPoint.write(outmsg); + + /* Diz aos outros jogadores que existe um novo jogador. */ + + outmsg = new Message(MessageType.Join); + outmsg.addArg(player); + + clients.broadcast(outmsg); + + break; + } + + case Logout: { + if (player == null) { + break; + } + + outmsg = new Message(MessageType.Leave); + outmsg.addArg(player); + + unregisterClient(endPoint); + + clients.broadcast(outmsg); + + + break; + } + case List: { + + outmsg = new Message(MessageType.List); + + outmsg.addArg(players.values()); + + endPoint.write(outmsg); + + break; + } + + case Ready: { + + player.setReady(true); + + outmsg = new Message(MessageType.Ready); + outmsg.addArg(player); + clients.broadcast(outmsg); + + if (allReady()) { + gameStarted = true; + lastUpdate = (int) (System.currentTimeMillis() / 1000L); + outmsg = new Message(MessageType.Start); + outmsg.addArg(questions); + clients.broadcast(outmsg); + } + + break; + } + + case Answer: { + if (!inmsg.hasArgs()) { + break; + } + + int i = inmsg.getInteger(0); + + if (player.getQuestion() > questions.size() - 1) { + unregisterClient(endPoint); + break; + } + + Question q = questions.get(player.getQuestion()); + + if (q.getCorrect() == i) { + player.nextQuestion(); + } else { + player.useContinue(); + } + + /* acabou. */ + if (player.getQuestion() > questions.size() - 1) { + outmsg = new Message(MessageType.End, player); + clients.broadcast(outmsg, true); + } + break; + } + default: + System.err.println("Unknown command: " + GsonHelper.toJson(inmsg)); + } + + outmsg = null; + } + + private synchronized ChannelEndPoint registerClient(SelectionKey key) throws ClosedChannelException { + ChannelEndPoint endPoint = new ChannelEndPoint(key); + + + key.attach(endPoint); + + clients.add(endPoint); + + return endPoint; + } + + private synchronized void unregisterClient(ChannelEndPoint client) throws IOException { + client.close(); + clients.remove(client); + players.remove(client); + } + + private Player findPlayer(String name) { + for (Player player : players.values()) { + if (player.getName().equals(name)) { + return player; + } + } + return null; + } + + private boolean allReady() { + for (Player p : players.values()) { + if (!p.isReady()) { + return false; + } + } + + return true; + } + + private void updatePlayers() { + + if (!gameStarted) { + return; + } + + long time = (long) (System.currentTimeMillis() / 1000L); + long diff = Player.INITIAL_TIME - (time - lastUpdate); + //lastUpdate = time; + + for (ChannelEndPoint client : clients) { + Player p = players.get(client); + + if (p == null) { + continue; + } + + if (p.getQuestion() < 0) { + p.nextQuestion(); + } + + long before = p.getTime(); + + if (diff != before) { + p.setTime(diff); + + client.write(new Message(MessageType.Idle, p)); + } + } + } + + public static void main(String[] args) { + Server s; + + try { + s = new Server(9595); + + s.run(); + //new Thread(s, "ServerWorker").start(); + + } catch (IOException ex) { + Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public boolean getQuit() { + return quit.get(); + } + + public void setQuit(boolean quit) { + this.quit.compareAndSet(!quit, quit); + } + + public List getQuestions() { + return questions; + } + + public void setQuestions(List questions) { + this.questions.clear(); + this.questions.addAll(questions); + } + + private void endMatch() { + for (ChannelEndPoint client : clients) { + try { + client.flush(); + unregisterClient(client); + } catch (IOException ex) { + Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex); + } + } + } +} diff --git a/projects/quiz-master/src/quiz/dialogs/QuizMain.form b/projects/quiz-master/src/quiz/dialogs/QuizMain.form new file mode 100644 index 0000000..6226fe0 --- /dev/null +++ b/projects/quiz-master/src/quiz/dialogs/QuizMain.form @@ -0,0 +1,141 @@ + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/projects/quiz-master/src/quiz/dialogs/QuizMain.java b/projects/quiz-master/src/quiz/dialogs/QuizMain.java new file mode 100644 index 0000000..5673f61 --- /dev/null +++ b/projects/quiz-master/src/quiz/dialogs/QuizMain.java @@ -0,0 +1,189 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * QuizMain.java + * + * Created on 13/04/2011, 20:09:01 + */ +package quiz.dialogs; + +import quiz.gui.Dialogs; + +/** + * + * @author higor + */ +public class QuizMain extends javax.swing.JFrame { + + private QuizMatch matchDialog; + private QuizServer serverDialog; + + /** Creates new form QuizMain */ + public QuizMain() { + super(); + initComponents(); + + setLocationRelativeTo(null); + getRootPane().setDefaultButton(startButton); + + matchDialog = new QuizMatch(this); + serverDialog = new QuizServer(this); + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + quitButton = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + nickText = new javax.swing.JTextField(); + serverCheck = new javax.swing.JCheckBox(); + serverText = new javax.swing.JTextField(); + jLabel3 = new javax.swing.JLabel(); + jSeparator1 = new javax.swing.JSeparator(); + startButton = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("Quiz"); + setResizable(false); + + quitButton.setText("Sair"); + quitButton.setName("quitButton"); // NOI18N + quitButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + quitButtonActionPerformed(evt); + } + }); + + jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/quiz/resources/quiz.png"))); // NOI18N + jLabel1.setName("jLabel1"); // NOI18N + + jLabel2.setText("Seu nome ou apelido:"); + jLabel2.setName("jLabel2"); // NOI18N + + nickText.setText("usuario"); + nickText.setName("nickText"); // NOI18N + + serverCheck.setText("Eu gostaria de ser o servidor."); + serverCheck.setName("serverCheck"); // NOI18N + serverCheck.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + serverCheckStateChanged(evt); + } + }); + + serverText.setText("localhost"); + serverText.setName("serverText"); // NOI18N + + jLabel3.setText("Endereço do servidor:"); + jLabel3.setName("jLabel3"); // NOI18N + + jSeparator1.setName("jSeparator1"); // NOI18N + + startButton.setText("Iniciar"); + startButton.setName("startButton"); // NOI18N + startButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + startButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(serverCheck) + .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE) + .addComponent(jLabel2) + .addComponent(nickText, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE) + .addComponent(jLabel3) + .addComponent(serverText, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE) + .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addComponent(quitButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 129, Short.MAX_VALUE) + .addComponent(startButton))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(nickText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(serverText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(serverCheck) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(quitButton) + .addComponent(startButton)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void quitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_quitButtonActionPerformed + System.exit(0); + }//GEN-LAST:event_quitButtonActionPerformed + + private void serverCheckStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_serverCheckStateChanged + if (serverCheck.isSelected()) { + serverText.setEnabled(false); + serverText.setText("0.0.0.0"); + } else { + serverText.setEnabled(true); + } + }//GEN-LAST:event_serverCheckStateChanged + + private void startButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startButtonActionPerformed + + if (serverCheck.isSelected()) { + serverDialog.showDialog(); + } else { + if (nickText.getText().isEmpty()) { + Dialogs.error(this, "Você precisa informar um apelido para se conectar a um servidor."); + nickText.requestFocusInWindow(); + return; + } + + startButton.setSelected(false); + matchDialog.connect(nickText.getText(), serverText.getText()); + } + }//GEN-LAST:event_startButtonActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JSeparator jSeparator1; + private javax.swing.JTextField nickText; + private javax.swing.JButton quitButton; + private javax.swing.JCheckBox serverCheck; + private javax.swing.JTextField serverText; + private javax.swing.JButton startButton; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/quiz-master/src/quiz/dialogs/QuizMatch.form b/projects/quiz-master/src/quiz/dialogs/QuizMatch.form new file mode 100644 index 0000000..38310a8 --- /dev/null +++ b/projects/quiz-master/src/quiz/dialogs/QuizMatch.form @@ -0,0 +1,199 @@ + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/projects/quiz-master/src/quiz/dialogs/QuizMatch.java b/projects/quiz-master/src/quiz/dialogs/QuizMatch.java new file mode 100644 index 0000000..89e7e9d --- /dev/null +++ b/projects/quiz-master/src/quiz/dialogs/QuizMatch.java @@ -0,0 +1,522 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * PartidaQuiz.java + * + * Created on 14/04/2011, 14:59:26 + */ +package quiz.dialogs; + +import java.io.IOException; +import java.net.ConnectException; +import java.nio.channels.UnresolvedAddressException; +import java.util.Calendar; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JOptionPane; +import quiz.core.Player; +import quiz.core.Client; +import quiz.core.ClientListener; +import quiz.core.Question; +import quiz.gui.Dialogs; +import quiz.gui.PlayerTableModel; +import quiz.util.GuiHelper; + +/** + * + * @author higor + */ +public class QuizMatch extends javax.swing.JFrame implements ClientListener { + + QuizMain parent; + Client client; + private Player player; + String nickname; + Thread thread; + private List questions; + + QuizMatch(QuizMain parent) { + super(); + + this.parent = parent; + + initComponents(); + } + + public void connect(String nickname, String server) { + + + setLocationRelativeTo(null); + + + statusLabel.setText("Conectando..."); + this.nickname = nickname; + + try { + this.client = new Client(server, 9595); + this.client.setListener(this); + + this.thread = new Thread(this.client, "ClientThread"); + this.thread.start(); + + } catch (ConnectException ex) { + Dialogs.error(this, "O servidor não aceitou a conexão."); + return; + + } catch (UnresolvedAddressException ex) { + Dialogs.error(this, "Servidor não encontrado."); + return; + + } catch (IOException ex) { + Dialogs.error(this, "Não foi possível conectar ao servidor."); + Logger.getLogger(QuizMatch.class.getName()).log(Level.SEVERE, null, ex); + return; + } + + parent.setVisible(false); + parent.removeNotify(); + + setVisible(true); + addNotify(); + + refreshUi(); + + + hidePanel(); + enablePanel(); + readyButton.setEnabled(true); + + } + + public void disconnect() { + + if (client != null) { + + ((PlayerTableModel) playerTable.getModel()).clear(); + + player = null; + + client.disconnect(); + client = null; + //thread.interrupt(); + + thread = null; + + if (questions != null) { + questions.clear(); + questions = null; + } + + } + + setVisible(false); + removeNotify(); + + parent.setVisible(true); + parent.addNotify(); + } + + public void refreshUi() { + + if (player != null) { + playerName.setText(player.getName()); + continueLabel.setText(player.getContinues() + " chances."); + timeLabel.setText(player.getTime() + " segundos."); + invalidate(); + + if (questions != null && player.getQuestion() >= 0 && player.getQuestion() < questions.size()) { + + Question q = questions.get(player.getQuestion()); + + questionLabel.setText(q.getStatement()); + answer1.setText(q.getAnswer(0)); + answer2.setText(q.getAnswer(1)); + answer3.setText(q.getAnswer(2)); + } + } + } + + public void showPanel() { + answer1.setVisible(true); + answer2.setVisible(true); + answer3.setVisible(true); + questionLabel.setVisible(true); + answerButton.setVisible(true); + } + + public void hidePanel() { + answer1.setVisible(false); + answer2.setVisible(false); + answer3.setVisible(false); + questionLabel.setVisible(false); + answerButton.setVisible(false); + } + + public void enablePanel() { + answer1.setEnabled(true); + answer2.setEnabled(true); + answer3.setEnabled(true); + questionLabel.setEnabled(true); + answerButton.setEnabled(true); + } + + public void disablePanel() { + answer1.setEnabled(false); + answer2.setEnabled(false); + answer3.setEnabled(false); + questionLabel.setEnabled(false); + answerButton.setEnabled(false); + } + + private String askNickname() { + String nick = (String) GuiHelper.askForSingleInput(this, + "Apelido", "Informe seu apelido", + "Visitante" + Calendar.getInstance().getTimeInMillis()); + + if (nick == null || nick.isEmpty()) { + JOptionPane.showMessageDialog(this, "Login cancelado."); + } + + return nick; + } + + @Override + public void onTimeout(Client source) { + disconnect(); + } + + @Override + public void onConnect(Client source, boolean fail) { + + if (fail) { + Dialogs.error(this, "Não foi possível conectar ao servidor."); + disconnect(); + + return; + } + + statusLabel.setText("Efetuando login..."); + + source.login(nickname); + } + + @Override + public void onDisconnect(Client source, boolean busy) { + if (player != null) { + Dialogs.error(this, "A conexão foi perdida."); + } + + if (busy) { + Dialogs.error(this, "Um jogo está em andamento neste servidor."); + } + + disconnect(); + + } + + @Override + public void onList(Client source, List players) { + PlayerTableModel model = (PlayerTableModel) playerTable.getModel(); + + model.clear(); + model.addAll(players); + + statusLabel.setText(model.size() + " jogador(es) conectado(s)."); + } + + @Override + public void onJoin(Client source, Player p) { + + PlayerTableModel model = (PlayerTableModel) playerTable.getModel(); + + if (!model.contains(p)) { + model.add(p); + + } else { + model.updatePlayers(p); + + } //playerTable.revalidate(); + + statusLabel.setText("Usuário " + p.getName() + " entrou."); + + } + + @Override + public void onLeave(Client source, Player p) { + PlayerTableModel model = (PlayerTableModel) playerTable.getModel(); + model.remove(p); + } + + @Override + public void onLogin(Client source, Player p) { + if (p == null) { + + Dialogs.error(this, "Já existe um usuário com este apelido."); + disconnect(); + + return; + } + + player = p; + + refreshUi(); + + statusLabel.setText("Requisitando lista de jogadores..."); + source.list(); + } + + @Override + public void onReady(Client source, Player p) { + statusLabel.setText("O jogador " + p.getName() + " está pronto."); + PlayerTableModel model = (PlayerTableModel) playerTable.getModel(); + model.add(p); + + model.updatePlayers(p); + + if (p.equals(player)) { + readyButton.setEnabled(false); + player.update(p); + } + } + + @Override + public void onStart(Client source, List questions) { + + this.questions = questions; + + refreshUi(); + showPanel(); + + statusLabel.setText("A partida começou!"); + } + + @Override + public void onEnd(Client source, Player p) { + if (player.getName().equals(p.getName())) { + Dialogs.info(this, "Parabéns! Você ganhou."); + } else { + Dialogs.info(this, "O usuário " + p.getName() + " foi o vencedor da partida."); + } + disconnect(); + } + + @Override + public void onIdle(Client source, Player p) { + PlayerTableModel model = (PlayerTableModel) playerTable.getModel(); + +// model.updatePlayers(p); + + if (player.getQuestion() != p.getQuestion()) { + answer1.setSelected(false); + answer2.setSelected(false); + answer3.setSelected(false); + enablePanel(); + statusLabel.setText("Resposta correta!"); + } + + if (player.getContinues() != p.getContinues()) { + enablePanel(); + statusLabel.setText("Resposta errada, tente novamente."); + } + + player.update(p); + + refreshUi(); + + if (player.getTime() < 1 || player.getContinues() < 1) { + Dialogs.info(this, "Você perdeu. :-(\nMais sorte na próxima vez."); + disconnect(); + } + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + answerGroup = new javax.swing.ButtonGroup(); + jScrollPane1 = new javax.swing.JScrollPane(); + playerTable = new javax.swing.JTable(); + statusLabel = new javax.swing.JLabel(); + readyButton = new javax.swing.JButton(); + playerName = new javax.swing.JLabel(); + timeLabel = new javax.swing.JLabel(); + continueLabel = new javax.swing.JLabel(); + answer1 = new javax.swing.JRadioButton(); + questionLabel = new javax.swing.JLabel(); + answer2 = new javax.swing.JRadioButton(); + answer3 = new javax.swing.JRadioButton(); + answerButton = new javax.swing.JButton(); + jSeparator1 = new javax.swing.JSeparator(); + + setTitle("Partida"); + setResizable(false); + addWindowListener(new java.awt.event.WindowAdapter() { + public void windowClosing(java.awt.event.WindowEvent evt) { + formWindowClosing(evt); + } + }); + + playerTable.setAutoCreateRowSorter(true); + playerTable.setModel(new PlayerTableModel()); + playerTable.setFillsViewportHeight(true); + jScrollPane1.setViewportView(playerTable); + + statusLabel.setText("Estado"); + statusLabel.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING); + + readyButton.setText("Pronto"); + readyButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + readyButtonActionPerformed(evt); + } + }); + + playerName.setText("Jogador"); + + timeLabel.setText("Tempo"); + + continueLabel.setText("Chances"); + + answerGroup.add(answer1); + answer1.setText("Alternativa A"); + + questionLabel.setText("Enunciado"); + + answerGroup.add(answer2); + answer2.setText("Alternativa B"); + + answerGroup.add(answer3); + answer3.setText("Alternativa C"); + + answerButton.setText("Responder"); + answerButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + answerButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addGap(8, 8, 8) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(answer1) + .addComponent(questionLabel) + .addComponent(answer2) + .addComponent(answer3) + .addGroup(layout.createSequentialGroup() + .addComponent(playerName) + .addGap(151, 151, 151) + .addComponent(continueLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(timeLabel)))) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addGap(6, 6, 6) + .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 466, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(statusLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(readyButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(answerButton)))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(timeLabel) + .addComponent(continueLabel)) + .addGroup(layout.createSequentialGroup() + .addComponent(playerName) + .addGap(18, 18, 18) + .addComponent(questionLabel) + .addGap(18, 18, 18) + .addComponent(answer1) + .addGap(18, 18, 18) + .addComponent(answer2) + .addGap(18, 18, 18) + .addComponent(answer3))) + .addGap(8, 8, 8) + .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(answerButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(statusLabel) + .addComponent(readyButton))) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 251, Short.MAX_VALUE)) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + + private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing + disconnect(); + }//GEN-LAST:event_formWindowClosing + private void readyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_readyButtonActionPerformed + // TODO add your handling code here: + client.ready(); + }//GEN-LAST:event_readyButtonActionPerformed + private void answerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_answerButtonActionPerformed + // TODO add your handling code here: + int answer = -1; + + if (answer1.isSelected()) { + answer = 0; + + } else if (answer2.isSelected()) { + answer = 1; + + } else if (answer3.isSelected()) { + answer = 2; + } + + if (answer < 0) { + Dialogs.error(this, "Você precisa escolher uma das opções."); + return; + + } + + client.answer(answer); + + answerButton.setEnabled(false); + }//GEN-LAST:event_answerButtonActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JRadioButton answer1; + private javax.swing.JRadioButton answer2; + private javax.swing.JRadioButton answer3; + private javax.swing.JButton answerButton; + private javax.swing.ButtonGroup answerGroup; + private javax.swing.JLabel continueLabel; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JSeparator jSeparator1; + private javax.swing.JLabel playerName; + private javax.swing.JTable playerTable; + private javax.swing.JLabel questionLabel; + private javax.swing.JButton readyButton; + private javax.swing.JLabel statusLabel; + private javax.swing.JLabel timeLabel; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/quiz-master/src/quiz/dialogs/QuizServer.form b/projects/quiz-master/src/quiz/dialogs/QuizServer.form new file mode 100644 index 0000000..376a8cb --- /dev/null +++ b/projects/quiz-master/src/quiz/dialogs/QuizServer.form @@ -0,0 +1,112 @@ + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/projects/quiz-master/src/quiz/dialogs/QuizServer.java b/projects/quiz-master/src/quiz/dialogs/QuizServer.java new file mode 100644 index 0000000..95a3e0f --- /dev/null +++ b/projects/quiz-master/src/quiz/dialogs/QuizServer.java @@ -0,0 +1,273 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * QuizServer.java + * + * Created on Apr 30, 2011, 8:54:23 PM + */ +package quiz.dialogs; + +import com.google.gson.JsonSyntaxException; +import com.google.gson.reflect.TypeToken; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.Reader; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JFileChooser; +import quiz.core.Question; +import quiz.core.Server; +import quiz.gui.Dialogs; +import quiz.util.GsonHelper; + +/** + * + * @author higor + */ +public class QuizServer extends javax.swing.JFrame { + + private static final java.lang.reflect.Type questionListType = new TypeToken>() { }.getType(); + private List questions; + private QuizMain parent; + private Server server; + private Thread thread; + private boolean running = false; + + /** Creates new form QuizServer */ + public QuizServer(QuizMain parent) { + super(); + + initComponents(); + this.parent = parent; + } + + public void showDialog() { + parent.setVisible(false); + parent.removeNotify(); + setLocationRelativeTo(null); + setVisible(true); + addNotify(); + } + + private void connect() { + setLocationRelativeTo(null); + + try { + this.server = new Server(9595); + this.thread = new Thread(this.server); + + server.setQuestions(questions); + + this.thread.start(); + } catch (IOException ex) { + Logger.getLogger(QuizServer.class.getName()).log(Level.SEVERE, null, ex); + } + + } + + private void disconnect() { + if (thread == null) { + return; + } + //server.close(); + thread.interrupt(); + //thread.interrupt(); + server = null; + thread = null; + } + + private void refreshUi() { + if (questions != null) { + questionLabel.setText(String.valueOf(questions.size())); + } + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + fileChooser = new javax.swing.JFileChooser(); + jLabel1 = new javax.swing.JLabel(); + questionLabel = new javax.swing.JLabel(); + loadButton = new javax.swing.JButton(); + runButton = new javax.swing.JToggleButton(); + backButton = new javax.swing.JButton(); + + fileChooser.setDoubleBuffered(true); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle("Servidor"); + setResizable(false); + addWindowListener(new java.awt.event.WindowAdapter() { + public void windowClosing(java.awt.event.WindowEvent evt) { + formWindowClosing(evt); + } + }); + + jLabel1.setText("Questões:"); + + questionLabel.setText("0"); + + loadButton.setText("Carregar"); + loadButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + loadButtonActionPerformed(evt); + } + }); + + runButton.setText("Executar"); + runButton.setEnabled(false); + runButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + runButtonActionPerformed(evt); + } + }); + + backButton.setText("Voltar"); + backButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + backButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(questionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(backButton)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(loadButton) + .addComponent(runButton, 0, 0, Short.MAX_VALUE)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(questionLabel) + .addComponent(loadButton)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(backButton) + .addComponent(runButton)) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + + private void loadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadButtonActionPerformed + // TODO add your handling code here: + switch (fileChooser.showOpenDialog(this)) { + case JFileChooser.ERROR_OPTION: + Dialogs.error(this, "Ocorreu um erro ao tentar abrir o arquivo."); + break; + case JFileChooser.APPROVE_OPTION: + File selected = fileChooser.getSelectedFile(); + + if (!selected.canRead()) { + Dialogs.error(this, "Não é possivel ler este arquivo."); + break; + } + + Reader reader; + try { + reader = new FileReader(selected); + + if (questions != null) { + questions.clear(); + } + + questions = GsonHelper.fromJson(reader, questionListType); + + if (questions != null || !questions.isEmpty()) { + runButton.setEnabled(true); + } + + } catch (JsonSyntaxException ex) { + Dialogs.error(this, "Houve um erro ao carregar o arquivo:\n" + ex.getMessage()); + Logger.getLogger(QuizServer.class.getName()).log(Level.SEVERE, null, ex); + } catch (FileNotFoundException ex) { + Logger.getLogger(QuizServer.class.getName()).log(Level.SEVERE, null, ex); + } + + refreshUi(); + break; + + + default: + break; + } + }//GEN-LAST:event_loadButtonActionPerformed + + private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing + // TODO add your handling code here: + setVisible(false); + removeNotify(); + parent.setVisible(true); + parent.addNotify(); + + }//GEN-LAST:event_formWindowClosing + + private void backButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backButtonActionPerformed + // TODO add your handling code here: + + setVisible(false); + removeNotify(); + parent.setVisible(true); + parent.addNotify(); + }//GEN-LAST:event_backButtonActionPerformed + + private void runButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_runButtonActionPerformed + // TODO add your handling code here: + if (thread != null) { + disconnect(); + loadButton.setEnabled(true); + backButton.setEnabled(true); + //runButton.setVisible(false); + + } else { + + if (questions == null || questions.isEmpty()) { + Dialogs.error(this, "Você precisa carregar algumas questões antes de iniciar o servidor."); + runButton.setSelected(false); + return; + } + + connect(); + + loadButton.setEnabled(false); + backButton.setEnabled(false); + + } + }//GEN-LAST:event_runButtonActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton backButton; + private javax.swing.JFileChooser fileChooser; + private javax.swing.JLabel jLabel1; + private javax.swing.JButton loadButton; + private javax.swing.JLabel questionLabel; + private javax.swing.JToggleButton runButton; + // End of variables declaration//GEN-END:variables +} diff --git a/projects/quiz-master/src/quiz/gui/Dialogs.java b/projects/quiz-master/src/quiz/gui/Dialogs.java new file mode 100644 index 0000000..d38b766 --- /dev/null +++ b/projects/quiz-master/src/quiz/gui/Dialogs.java @@ -0,0 +1,41 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package quiz.gui; + +import java.awt.Component; +import javax.swing.JOptionPane; +import quiz.dialogs.QuizMatch; + +/** + * + * @author higor + */ +public class Dialogs { + + public static JOptionPane connectDialog(Component owner) { + Object[] options = {"Cancel"}; + + JOptionPane dialog = new JOptionPane( + "Conectando, aguarde...", + JOptionPane.INFORMATION_MESSAGE, + JOptionPane.DEFAULT_OPTION, + null, + options, + options[0] + ); + dialog.setVisible(false); + + return dialog; + } + + public static void error(Component owner, String message) { + JOptionPane.showMessageDialog(owner, message, "Erro", JOptionPane.ERROR_MESSAGE); + } + + public static void info(Component owner, String message) { + JOptionPane.showMessageDialog(owner, message, "Informação", JOptionPane.INFORMATION_MESSAGE); + } +} diff --git a/projects/quiz-master/src/quiz/gui/PlayerTableModel.java b/projects/quiz-master/src/quiz/gui/PlayerTableModel.java new file mode 100644 index 0000000..b4a3d8f --- /dev/null +++ b/projects/quiz-master/src/quiz/gui/PlayerTableModel.java @@ -0,0 +1,155 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package quiz.gui; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import javax.swing.table.AbstractTableModel; + +import quiz.core.Player; + +/** + * + * @author higor + */ +public final class PlayerTableModel extends AbstractTableModel { + + private String[] colNames = {"Nome", "Pronto"};//"Tempo", "Terminou"}; + private Class[] colTypes = {String.class, Boolean.class };//Integer.class, Boolean.class}; + private List players = new ArrayList(); + + public PlayerTableModel(List players) { + super(); + //this.players = players; + } + + public PlayerTableModel() { + super(); + } + + @Override + public int getColumnCount() { + return colNames.length; + } + + @Override + public int getRowCount() { + if (players == null) { + return 0; + } + return players.size(); + } + + @Override + public String getColumnName(int column) { + return colNames[column]; + } + + @Override + public Class getColumnClass(int columnIndex) { + return colTypes[columnIndex]; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + if (rowIndex > players.size() - 1) { + return null; + } + + switch (columnIndex) { + case 0: + return players.get(rowIndex).getName(); + case 1: + return players.get(rowIndex).isReady(); + //return players.get(rowIndex).getTime(); + //case 2: +// return players.get(rowIndex).isDone(); + } + return null; + } + + @Override + public void setValueAt(Object aValue, int rowIndex, int columnIndex) { + + if (rowIndex > players.size() - 1) { + throw new IllegalArgumentException("No such row."); + } + + switch (columnIndex) { + case 0: + players.get(rowIndex).setName((String) aValue); + break; + case 1: + players.get(rowIndex) .setReady((Boolean) aValue); +// players.get(rowIndex).setTime((Integer) aValue); + break; +// case 2: +// players.get(rowIndex).setDone((Boolean) aValue); +// break; + default: + throw new IllegalArgumentException("No such column."); + } + + fireTableChanged(null); + } + + public synchronized int size() { + return players.size(); + } + + public synchronized boolean isEmpty() { + return players.isEmpty(); + } + + public synchronized void add(Player p) { + if (players.contains(p)) { + players.set(players.indexOf(p), p); + } else { + players.add(p); + } + + fireTableChanged(null); + } + + public synchronized void addAll(Collection c) { + players.addAll(c); + fireTableChanged(null); + } + + public synchronized void remove(Player p) { + players.remove(p); + fireTableChanged(null); + } + + public synchronized void clear() { + players.clear(); + fireTableChanged(null); + } + + public synchronized boolean contains(Player p) { + return players.contains(p); + } + + public synchronized int indexOf(Player p) { + return players.indexOf(p); + } + + public synchronized Player find(String name) { + for (Player p : players) { + if (p.getName().equals(name)) { + return p; + } + } + return null; + } + + public void updatePlayers(Player player) { + for (Player p : players) { + p.update(player); + } + fireTableDataChanged(); + } +} diff --git a/projects/quiz-master/src/quiz/messages/Message.java b/projects/quiz-master/src/quiz/messages/Message.java new file mode 100644 index 0000000..1281b0a --- /dev/null +++ b/projects/quiz-master/src/quiz/messages/Message.java @@ -0,0 +1,111 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package quiz.messages; + +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author higor + */ +public final class Message { + final private MessageType type; + final private List args; + + public Message() { + this.args = null; + this.type = MessageType.EOF; + } + + public Message(Message message) { + this.args = new ArrayList(message.args); + this.type = message.type; + } + + public Message(MessageType type) { + this.args = new ArrayList(); + this.type = type; + } + + public Message(MessageType type, Object arg) { + this.args = new ArrayList(); + this.type = type; + + addArg(arg); + } + + @Override + protected void finalize() throws Throwable { + args.clear(); + super.finalize(); + } + + public boolean hasArgs() { + return !args.isEmpty(); + } + + public int getArgCount() { + return args.size(); + } + + public int getInteger(int index) { + return ((Number)args.get(index)).intValue(); + } + + public String getString(int index) { + if (index > args.size()-1) { + return null; + } + return (String) args.get(index); + } + + public float getFloat(int index) { + return ((Number)args.get(index)).floatValue(); + } + + public T getObject(int index, Class classOfT) { + if (index > args.size()-1) { + return null; + } + + return classOfT.cast(args.get(index)); + } + + public void addArg(Object arg) { + args.add(arg); + } + + public void addArg(String arg) { + args.add(arg); + } + + private void addNumber(int arg) { + } + + public void addArg(int arg) { + args.add(arg); + } + + public void addArg(float arg) { + args.add(arg); + } + + public void addArg(boolean arg) { + args.add(arg); + } + + public MessageType getType() { + return type; + } + + public boolean isEOF() { + return type == MessageType.EOF; + } + + /*public List getArgs() { + return args; + }*/ +} diff --git a/projects/quiz-master/src/quiz/messages/MessageType.java b/projects/quiz-master/src/quiz/messages/MessageType.java new file mode 100644 index 0000000..37b63fa --- /dev/null +++ b/projects/quiz-master/src/quiz/messages/MessageType.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package quiz.messages; + +/** + * + * @author higor + */ +public enum MessageType { + Idle, + Login, Logout, + Join, Leave, Ready, + User, List, + Fail, Success, + Start, End, + Answer, + EOF + +}; diff --git a/projects/quiz-master/src/quiz/messages/MessageTypeAdapter.java b/projects/quiz-master/src/quiz/messages/MessageTypeAdapter.java new file mode 100644 index 0000000..8bd1950 --- /dev/null +++ b/projects/quiz-master/src/quiz/messages/MessageTypeAdapter.java @@ -0,0 +1,78 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package quiz.messages; + +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonPrimitive; +import com.google.gson.reflect.TypeToken; +import java.lang.reflect.Type; +import java.util.Iterator; +import java.util.List; +import quiz.core.Player; +import quiz.core.Question; + +/** + * + * @author aluno + */ +public class MessageTypeAdapter implements JsonDeserializer { + + private static final Type playerListType = new TypeToken>() { + }.getType(); + private static final Type questionListType = new TypeToken>() { + }.getType(); + + @Override + public Message deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + JsonObject obj = json.getAsJsonObject(); + Message msg = new Message((MessageType) context.deserialize(obj.get("type"), MessageType.class)); + JsonArray arr = obj.getAsJsonArray("args"); + + Iterator it = arr.iterator(); + //System.out.println(json.toString()); + + while (it.hasNext()) { + JsonElement el = it.next(); + + if (el.isJsonNull()) { + msg.addArg(null); + } else if (el.isJsonPrimitive()) { + JsonPrimitive primitive = el.getAsJsonPrimitive(); + + if (primitive.isString()) { + msg.addArg(primitive.getAsString()); + } else if (primitive.isBoolean()) { + msg.addArg(primitive.getAsBoolean()); + } else if (primitive.isNumber()) { + msg.addArg(primitive.getAsNumber().floatValue()); + } + } else { + switch (msg.getType()) { + case Login: + case Join: + case Idle: + case Ready: + case End: + msg.addArg(context.deserialize(el, Player.class)); + break; + + case List: + msg.addArg(context.deserialize(el, playerListType)); + break; + case Start: + msg.addArg(context.deserialize(el, questionListType)); + break; + } + } + } + + return msg; + } +} diff --git a/projects/quiz-master/src/quiz/resources/questoes.json b/projects/quiz-master/src/quiz/resources/questoes.json new file mode 100644 index 0000000..f6f3429 --- /dev/null +++ b/projects/quiz-master/src/quiz/resources/questoes.json @@ -0,0 +1,31 @@ +[ + { + "statement" : "É extraido da seringueira", + "answers" : [ + "Laca Vegetal", + "Malte", + "Látex" + ], + "correct": 2 + }, + + { + "statement" : "Qual o coletivo de chave?", + "answers" : [ + "Chaves", + "Chaveiro", + "Molho" + ], + "correct": 2 + }, + + { + "statement" : "Liberdade do estado de escravidão", + "answers" : [ + "Oforria", + "Alforria", + "Halforria" + ], + "correct": 1 + } +] \ No newline at end of file diff --git a/projects/quiz-master/src/quiz/resources/quiz.png b/projects/quiz-master/src/quiz/resources/quiz.png new file mode 100644 index 0000000..38f107c Binary files /dev/null and b/projects/quiz-master/src/quiz/resources/quiz.png differ diff --git a/projects/quiz-master/src/quiz/util/ChannelHelper.java b/projects/quiz-master/src/quiz/util/ChannelHelper.java new file mode 100644 index 0000000..0ba3947 --- /dev/null +++ b/projects/quiz-master/src/quiz/util/ChannelHelper.java @@ -0,0 +1,84 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package quiz.util; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.channels.SocketChannel; +import quiz.messages.Message; + +/** + * + * @author aluno + */ +public class ChannelHelper { + public static final int MAX_ATTEMPTS = 3; + public static final Message nullMessage = new Message(); + + public static synchronized int receive(SocketChannel channel, ByteBuffer buffer) throws IOException { + int length = -1; + + buffer.clear(); + length = channel.read(buffer); + + buffer.flip(); + + return length; + } + + public static synchronized int send(SocketChannel channel, ByteBuffer buffer) throws IOException { + int length = -1; + int attempts = MAX_ATTEMPTS; + + do { + buffer.flip(); + length = channel.write(buffer); + buffer.compact(); + + } while (buffer.hasRemaining() && --attempts != 0); + + + return length; + } + + public static String receiveString(SocketChannel channel, ByteBuffer buffer) throws IOException { + if (receive(channel, buffer) == -1) { + return null; + } + + String input = new String(buffer.array(), 0, buffer.limit()); + + System.out.println("Recebido : " + input); + + return input; + } + + + public static int sendString(SocketChannel channel, ByteBuffer buffer, String string) throws IOException { + + buffer.clear(); + buffer.put(string.getBytes()); + + int length = send(channel, buffer); + + System.out.println("Enviado: " + string); + + return length; + } + + public static Message receiveMessage(SocketChannel channel, ByteBuffer buffer) throws IOException { + String str = receiveString(channel, buffer); + + if (str == null) { + return nullMessage; + } + + return GsonHelper.fromJson(str, Message.class); + } + + public static int sendMessage(SocketChannel channel, ByteBuffer buffer, Message message) throws IOException { + return sendString(channel, buffer, GsonHelper.toJson(message)); + } +} diff --git a/projects/quiz-master/src/quiz/util/GsonHelper.java b/projects/quiz-master/src/quiz/util/GsonHelper.java new file mode 100644 index 0000000..c56d275 --- /dev/null +++ b/projects/quiz-master/src/quiz/util/GsonHelper.java @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package quiz.util; + +import quiz.messages.MessageTypeAdapter; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import java.io.Reader; +import java.lang.reflect.Type; +import quiz.messages.Message; + +/** + * + * @author higor + */ +public class GsonHelper { + + private static Gson gson; + + static { + gson = new GsonBuilder() + .registerTypeAdapter(Message.class, new MessageTypeAdapter()) + .serializeNulls() + //.setPrettyPrinting() + .create(); + } + + public static T fromJson(String json, Class classOfT) { + return gson.fromJson(json, classOfT); + } + + public static T fromJson(Reader reader, Class classOfT) { + return gson.fromJson(reader, classOfT); + } + + public static T fromJson(String json, Type typeOfT) { + return gson.fromJson(json, typeOfT); + } + + public static T fromJson(Reader reader, Type typeOfT) { + return gson.fromJson(reader, typeOfT); + } + + public static String toJson(T src) { + return gson.toJson(src, src.getClass()); + } + + public static String toJson(T src, Type typeOfT) { + return gson.toJson(src, typeOfT); + } +} diff --git a/projects/quiz-master/src/quiz/util/GuiHelper.java b/projects/quiz-master/src/quiz/util/GuiHelper.java new file mode 100644 index 0000000..c43c54a --- /dev/null +++ b/projects/quiz-master/src/quiz/util/GuiHelper.java @@ -0,0 +1,28 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package quiz.util; + +import java.awt.Component; +import javax.swing.JOptionPane; + +/** + * + * @author higor + */ +public class GuiHelper { + + public static Object askForSingleInput(Component parent, String title, String message, String init) { + return JOptionPane.showInputDialog(parent, + message, + title, + JOptionPane.OK_CANCEL_OPTION, + null, null, + init); + } + + public static void showError(Component parent, String string) { + JOptionPane.showMessageDialog(parent, string, "Erro", JOptionPane.ERROR_MESSAGE); + } +} diff --git a/projects/student management sytsem/project/.classpath b/projects/student management sytsem/project/.classpath new file mode 100644 index 0000000..460d4f4 --- /dev/null +++ b/projects/student management sytsem/project/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/projects/student management sytsem/project/.project b/projects/student management sytsem/project/.project new file mode 100644 index 0000000..69f7e78 --- /dev/null +++ b/projects/student management sytsem/project/.project @@ -0,0 +1,17 @@ + + + project + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/projects/student management sytsem/project/.settings/org.eclipse.jdt.core.prefs b/projects/student management sytsem/project/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3a21537 --- /dev/null +++ b/projects/student management sytsem/project/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/projects/student management sytsem/project/bin/project/AddNotice$1.class b/projects/student management sytsem/project/bin/project/AddNotice$1.class new file mode 100644 index 0000000..2cf1f78 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/AddNotice$1.class differ diff --git a/projects/student management sytsem/project/bin/project/AddNotice$2.class b/projects/student management sytsem/project/bin/project/AddNotice$2.class new file mode 100644 index 0000000..888175e Binary files /dev/null and b/projects/student management sytsem/project/bin/project/AddNotice$2.class differ diff --git a/projects/student management sytsem/project/bin/project/AddNotice.class b/projects/student management sytsem/project/bin/project/AddNotice.class new file mode 100644 index 0000000..2ac6172 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/AddNotice.class differ diff --git a/projects/student management sytsem/project/bin/project/Admin$1.class b/projects/student management sytsem/project/bin/project/Admin$1.class new file mode 100644 index 0000000..6649b13 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/Admin$1.class differ diff --git a/projects/student management sytsem/project/bin/project/Admin$2.class b/projects/student management sytsem/project/bin/project/Admin$2.class new file mode 100644 index 0000000..14fbad3 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/Admin$2.class differ diff --git a/projects/student management sytsem/project/bin/project/Admin$3.class b/projects/student management sytsem/project/bin/project/Admin$3.class new file mode 100644 index 0000000..b6c3088 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/Admin$3.class differ diff --git a/projects/student management sytsem/project/bin/project/Admin$4.class b/projects/student management sytsem/project/bin/project/Admin$4.class new file mode 100644 index 0000000..0dc38ec Binary files /dev/null and b/projects/student management sytsem/project/bin/project/Admin$4.class differ diff --git a/projects/student management sytsem/project/bin/project/Admin$5.class b/projects/student management sytsem/project/bin/project/Admin$5.class new file mode 100644 index 0000000..bc54ed6 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/Admin$5.class differ diff --git a/projects/student management sytsem/project/bin/project/Admin.class b/projects/student management sytsem/project/bin/project/Admin.class new file mode 100644 index 0000000..60f6678 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/Admin.class differ diff --git a/projects/student management sytsem/project/bin/project/DBInfo.class b/projects/student management sytsem/project/bin/project/DBInfo.class new file mode 100644 index 0000000..8f9a890 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/DBInfo.class differ diff --git a/projects/student management sytsem/project/bin/project/GetValues.class b/projects/student management sytsem/project/bin/project/GetValues.class new file mode 100644 index 0000000..e97d267 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/GetValues.class differ diff --git a/projects/student management sytsem/project/bin/project/LoginPage$1.class b/projects/student management sytsem/project/bin/project/LoginPage$1.class new file mode 100644 index 0000000..eec1712 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/LoginPage$1.class differ diff --git a/projects/student management sytsem/project/bin/project/LoginPage$2.class b/projects/student management sytsem/project/bin/project/LoginPage$2.class new file mode 100644 index 0000000..e360c8e Binary files /dev/null and b/projects/student management sytsem/project/bin/project/LoginPage$2.class differ diff --git a/projects/student management sytsem/project/bin/project/LoginPage.class b/projects/student management sytsem/project/bin/project/LoginPage.class new file mode 100644 index 0000000..02170d2 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/LoginPage.class differ diff --git a/projects/student management sytsem/project/bin/project/Student.class b/projects/student management sytsem/project/bin/project/Student.class new file mode 100644 index 0000000..035e811 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/Student.class differ diff --git a/projects/student management sytsem/project/bin/project/StudentReg$1.class b/projects/student management sytsem/project/bin/project/StudentReg$1.class new file mode 100644 index 0000000..30c5e50 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/StudentReg$1.class differ diff --git a/projects/student management sytsem/project/bin/project/StudentReg$2.class b/projects/student management sytsem/project/bin/project/StudentReg$2.class new file mode 100644 index 0000000..06bc0bf Binary files /dev/null and b/projects/student management sytsem/project/bin/project/StudentReg$2.class differ diff --git a/projects/student management sytsem/project/bin/project/StudentReg$3.class b/projects/student management sytsem/project/bin/project/StudentReg$3.class new file mode 100644 index 0000000..fe17907 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/StudentReg$3.class differ diff --git a/projects/student management sytsem/project/bin/project/StudentReg.class b/projects/student management sytsem/project/bin/project/StudentReg.class new file mode 100644 index 0000000..5cf8d9e Binary files /dev/null and b/projects/student management sytsem/project/bin/project/StudentReg.class differ diff --git a/projects/student management sytsem/project/bin/project/ViewStudent$1.class b/projects/student management sytsem/project/bin/project/ViewStudent$1.class new file mode 100644 index 0000000..bb056c6 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/ViewStudent$1.class differ diff --git a/projects/student management sytsem/project/bin/project/ViewStudent$2.class b/projects/student management sytsem/project/bin/project/ViewStudent$2.class new file mode 100644 index 0000000..64c0d3d Binary files /dev/null and b/projects/student management sytsem/project/bin/project/ViewStudent$2.class differ diff --git a/projects/student management sytsem/project/bin/project/ViewStudent$3.class b/projects/student management sytsem/project/bin/project/ViewStudent$3.class new file mode 100644 index 0000000..beca909 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/ViewStudent$3.class differ diff --git a/projects/student management sytsem/project/bin/project/ViewStudent$4.class b/projects/student management sytsem/project/bin/project/ViewStudent$4.class new file mode 100644 index 0000000..0363a1b Binary files /dev/null and b/projects/student management sytsem/project/bin/project/ViewStudent$4.class differ diff --git a/projects/student management sytsem/project/bin/project/ViewStudent$5.class b/projects/student management sytsem/project/bin/project/ViewStudent$5.class new file mode 100644 index 0000000..895b88c Binary files /dev/null and b/projects/student management sytsem/project/bin/project/ViewStudent$5.class differ diff --git a/projects/student management sytsem/project/bin/project/ViewStudent.class b/projects/student management sytsem/project/bin/project/ViewStudent.class new file mode 100644 index 0000000..7d3e447 Binary files /dev/null and b/projects/student management sytsem/project/bin/project/ViewStudent.class differ diff --git a/projects/student management sytsem/project/src/project/AddNotice.java b/projects/student management sytsem/project/src/project/AddNotice.java new file mode 100644 index 0000000..8deac37 --- /dev/null +++ b/projects/student management sytsem/project/src/project/AddNotice.java @@ -0,0 +1,169 @@ +package project; + +import java.awt.BorderLayout; +import java.awt.EventQueue; +import java.awt.TextArea; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.JComboBox; +import javax.swing.JTextArea; +import javax.swing.JButton; +import javax.swing.LayoutStyle.ComponentPlacement; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.util.Date; +import java.awt.event.ActionEvent; + +public class AddNotice extends JFrame { + + private JPanel contentPane; + private JTextField textField; + /* public static void main(String[] args) { + new AddNotice().setVisible(true); +}*/ + + public AddNotice() { + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 601, 441); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblNewLabel = new JLabel("New label"); + + JLabel lblDate = new JLabel("Date"); + + JLabel lblSubject = new JLabel("Course"); + + JLabel lblBranch = new JLabel("branch"); + + JLabel lblNotice = new JLabel("Notice"); + + Date d=new Date(); + textField = new JTextField(""+d); + textField.setEditable(false); + textField.setColumns(10); + + JComboBox comboBox = new JComboBox(GetValues.getCourse()); + + JComboBox comboBox_1 = new JComboBox(GetValues.getBranch()); + + TextArea textArea = new TextArea(); + //textArea.setLineWrap(true); + + JButton btnSubmit = new JButton("SUBMIT"); + btnSubmit.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + String date=textField.getText(); + String course=(String)comboBox.getSelectedItem(); + String stream=(String)comboBox_1.getSelectedItem(); + String notice=textArea.getText(); + String id=Admin.id; + String query="insert into notice values(?,?,?,?,?,?)"; + Connection con=DBInfo.con; + int flag=0; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setInt(1, 0); + ps.setString(2, date); + ps.setString(3,course); + ps.setString(4, stream); + ps.setString(5, notice); + ps.setString(6, id); + flag=ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + + if(flag==1) + JOptionPane.showMessageDialog(AddNotice.this, "Notice Added!!", "Added", JOptionPane.INFORMATION_MESSAGE); + else + JOptionPane.showMessageDialog(AddNotice.this, "Notice Not Added!!", "Not Added", JOptionPane.ERROR_MESSAGE); + } + }); + + JButton button = new JButton("RESET"); + button.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + } + }); + + JButton btnNewButton = new JButton("View All notices"); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(Alignment.TRAILING, gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(36) + .addComponent(btnSubmit) + .addGap(18) + .addComponent(button, GroupLayout.PREFERRED_SIZE, 89, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(btnNewButton, GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE)) + .addGroup(Alignment.LEADING, gl_contentPane.createSequentialGroup() + .addGap(215) + .addComponent(lblNewLabel)) + .addGroup(Alignment.LEADING, gl_contentPane.createSequentialGroup() + .addGap(55) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblDate) + .addComponent(lblSubject) + .addComponent(lblBranch) + .addComponent(lblNotice)) + .addGap(94) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(textArea, GroupLayout.PREFERRED_SIZE, 270, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(comboBox, 0, 270, Short.MAX_VALUE) + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE) + .addComponent(comboBox_1, 0, 270, Short.MAX_VALUE))))) + .addGap(107)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addContainerGap() + .addComponent(lblNewLabel) + .addGap(42) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblDate) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblSubject) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblBranch) + .addGap(18) + .addComponent(lblNotice)) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(comboBox_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(textArea, GroupLayout.PREFERRED_SIZE, 128, GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnSubmit) + .addComponent(button) + .addComponent(btnNewButton)) + .addContainerGap()) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/student management sytsem/project/src/project/Admin.java b/projects/student management sytsem/project/src/project/Admin.java new file mode 100644 index 0000000..a23638b --- /dev/null +++ b/projects/student management sytsem/project/src/project/Admin.java @@ -0,0 +1,124 @@ +package project; + +import java.awt.BorderLayout; +import java.awt.EventQueue; +import java.awt.FlowLayout; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.border.EmptyBorder; +import java.awt.GridLayout; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class Admin extends JFrame { + + private JPanel contentPane; + + static String id; + public static void main(String[] args) { + new Admin(null, null).setVisible(true); + } + + public Admin(String title,String userid) + { + id=userid; + setTitle(title); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 777, 600);setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + contentPane.setLayout(new GridLayout(4, 3, 0, 0)); + + JButton btnRegisterANew = new JButton("Register a new student"); + btnRegisterANew.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + StudentReg obj=new StudentReg(); + obj.setVisible(true); + } + }); + contentPane.add(btnRegisterANew); + + JButton btnViewupdatedeleteAStudent = new JButton("View/Update/Delete a student"); + btnViewupdatedeleteAStudent.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + new ViewStudent().setVisible(true); + } + }); + contentPane.add(btnViewupdatedeleteAStudent); + + JButton btnNewButton = new JButton("Upload a new notice"); + btnNewButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + AddNotice notice=new AddNotice(); + notice.setVisible(true); + } + }); + contentPane.add(btnNewButton); + + JButton btnViewupdatedeleteANotice = new JButton("View/Update/Delete a notice"); + contentPane.add(btnViewupdatedeleteANotice); + + JButton btnViewAllStudents = new JButton("View All students"); + btnViewAllStudents.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + + JFrame frm=new JFrame("View All Students"); + //frm.setLayout(new FlowLayout()); + + frm.setSize(800, 600); + frm.setLocationRelativeTo(Admin.this); + + GetValues.getStudents(); + System.out.println(GetValues.records); + JTable t=new JTable(GetValues.records, GetValues.header); + JScrollPane pane=new JScrollPane(t); + frm.getContentPane().add(pane); + frm.setVisible(true); + + + } + }); + contentPane.add(btnViewAllStudents); + + JButton btnViewAllNotices = new JButton("View All notices"); + btnViewAllNotices.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + JFrame frm=new JFrame("View All notices"); + //frm.setLayout(new FlowLayout()); + + frm.setSize(800, 600); + frm.setLocationRelativeTo(Admin.this); + + GetValues.getNotices(); + //System.out.println(GetValues.records); + JTable t=new JTable(GetValues.records, GetValues.header); + JScrollPane pane=new JScrollPane(t); + frm.getContentPane().add(pane); + frm.setVisible(true); + + } + }); + contentPane.add(btnViewAllNotices); + + JButton btnSearchAnyStudent = new JButton("Search Any student"); + contentPane.add(btnSearchAnyStudent); + + JButton btnSearchAnyNotice = new JButton("Search any notice"); + contentPane.add(btnSearchAnyNotice); + + JButton btnViewStudentFeedback = new JButton("View student feedback"); + contentPane.add(btnViewStudentFeedback); + + JButton btnChangeSelfPassword = new JButton("Change self password"); + contentPane.add(btnChangeSelfPassword); + } + +} diff --git a/projects/student management sytsem/project/src/project/DBInfo.java b/projects/student management sytsem/project/src/project/DBInfo.java new file mode 100644 index 0000000..8e3c0a2 --- /dev/null +++ b/projects/student management sytsem/project/src/project/DBInfo.java @@ -0,0 +1,20 @@ +package project; + +import java.sql.Connection; +import java.sql.DriverManager; + +public class DBInfo +{ + static Connection con; + static + { + try + { + Class.forName("com.mysql.jdbc.Driver"); + con=DriverManager.getConnection("jdbc:mysql://localhost:3306/student1","root","rat"); + } + catch(Exception e) + { + } + } +} diff --git a/projects/student management sytsem/project/src/project/GetValues.java b/projects/student management sytsem/project/src/project/GetValues.java new file mode 100644 index 0000000..f9a511c --- /dev/null +++ b/projects/student management sytsem/project/src/project/GetValues.java @@ -0,0 +1,128 @@ +package project; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.util.Vector; + +public class GetValues +{ + public static Vector> records; + public static Vector header; + public static Vector getCourse() + { + Vector v=new Vector<>(); + try + { + String query="select * from course order by name"; + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + String course=res.getString(2); + v.add(course); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + System.out.println(v); + return v; + } + public static Vector getBranch() + { + Vector v=new Vector<>(); + try + { + String query="select * from branch order by name"; + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + String branch=res.getString(2); + v.add(branch); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + System.out.println(v); + return v; + } + + public static void getStudents() + { + records=new Vector<>(); + header=new Vector<>(); + String query="select * from student_registration"; + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + ResultSet res=ps.executeQuery();//metadata and records + + //only meta data + ResultSetMetaData rsmd=res.getMetaData(); + int colcount=rsmd.getColumnCount(); + for(int i=1;i<=colcount;i++) + { + header.add(rsmd.getColumnName(i)); + } + + + //only records + while(res.next()) + { + Vector v=new Vector<>(); //inner vector + for(int i=1;i<=colcount;i++) + { + v.add(res.getString(i)); + } + records.add(v); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + } + public static void getNotices() + { + records=new Vector<>(); + header=new Vector<>(); + String query="select * from notice"; + Connection con=DBInfo.con; + try + { + PreparedStatement ps=con.prepareStatement(query); + ResultSet res=ps.executeQuery();//metadata and records + + //only meta data + ResultSetMetaData rsmd=res.getMetaData(); + int colcount=rsmd.getColumnCount(); + for(int i=1;i<=colcount;i++) + { + header.add(rsmd.getColumnName(i)); + } + + + //only records + while(res.next()) + { + Vector v=new Vector<>(); //inner vector + for(int i=1;i<=colcount;i++) + { + v.add(res.getString(i)); + } + records.add(v); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + } +} diff --git a/projects/student management sytsem/project/src/project/LoginPage.java b/projects/student management sytsem/project/src/project/LoginPage.java new file mode 100644 index 0000000..aa9373e --- /dev/null +++ b/projects/student management sytsem/project/src/project/LoginPage.java @@ -0,0 +1,211 @@ +package project; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.JPasswordField; +import javax.swing.JButton; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.JComboBox; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.awt.event.ActionEvent; + +public class LoginPage extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JPasswordField passwordField; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + LoginPage frame = new LoginPage(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public LoginPage() { + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 478, 300); + setLocationRelativeTo(this); + setResizable(false); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblNewLabel = new JLabel("New label"); + + JLabel lblUsernameenrollmentempid = new JLabel("Username(enrollment/empid)"); + + textField = new JTextField(); + textField.setColumns(10); + + JLabel lblPassword = new JLabel("Password"); + + passwordField = new JPasswordField(); + String type[]={"Select","Admin","Student"}; + + JComboBox comboBox = new JComboBox(type); + + JButton btnLoginNow = new JButton("Login Now"); + btnLoginNow.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + String userid=textField.getText(); + + char ch[]=passwordField.getPassword();//it returns char array + String password=String.valueOf(ch); + String type=(String)comboBox.getSelectedItem(); + System.out.println(userid+"::"+password+"::"+type); + Connection con=DBInfo.con; + int flag=0; + + if(type.equalsIgnoreCase("admin")) + { + String query="select * from faculty_registration where empid=? and password=?"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, userid); + ps.setString(2, password); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + flag=1; + break; + } + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==1) + { + Admin a=new Admin("Admin page",userid); + a.setVisible(true);dispose(); + } + else + { + JOptionPane.showMessageDialog(LoginPage.this, "Wrong usename or password", "Error", JOptionPane.ERROR_MESSAGE); + } + + } + if(type.equalsIgnoreCase("student")) + { + String query="select * from student_registration where enrollment=? and password=?"; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, userid); + ps.setString(2, password); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + flag=1; + break; + } + } + catch(Exception e) + { + e.printStackTrace(); + } + if(flag==1) + { + Student s=new Student("Student page"); + s.setVisible(true);dispose(); + } + else + { + JOptionPane.showMessageDialog(LoginPage.this, "Wrong usename or password", "Error", JOptionPane.ERROR_MESSAGE); + } + } + + } + }); + + JButton btnReset = new JButton("RESET"); + + JButton btnNewUserSignup = new JButton("New User SignUp"); + + JLabel lblUsertype = new JLabel("UserType"); + + + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(202) + .addComponent(lblNewLabel)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(42) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblUsernameenrollmentempid) + .addComponent(lblPassword) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(btnLoginNow) + .addGap(1) + .addComponent(btnReset, GroupLayout.PREFERRED_SIZE, 109, GroupLayout.PREFERRED_SIZE)) + .addComponent(lblUsertype)) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(32) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false) + .addComponent(passwordField) + .addComponent(textField) + .addComponent(comboBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addGroup(gl_contentPane.createSequentialGroup() + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(btnNewUserSignup, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))) + .addContainerGap(73, Short.MAX_VALUE)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addContainerGap() + .addComponent(lblNewLabel) + .addGap(26) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblUsernameenrollmentempid) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblPassword) + .addComponent(passwordField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblUsertype) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(20) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnLoginNow) + .addComponent(btnReset) + .addComponent(btnNewUserSignup)) + .addContainerGap(38, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/student management sytsem/project/src/project/Student.java b/projects/student management sytsem/project/src/project/Student.java new file mode 100644 index 0000000..9277e6a --- /dev/null +++ b/projects/student management sytsem/project/src/project/Student.java @@ -0,0 +1,44 @@ +package project; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JLabel; + +public class Student extends JFrame { + + private JPanel contentPane; + + + public Student(String title) + { + super(title); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 580, 300);setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + contentPane.setLayout(new BorderLayout(0, 0)); + setContentPane(contentPane); + + JButton btnViewSelfProfile = new JButton("View Self profile"); + contentPane.add(btnViewSelfProfile, BorderLayout.NORTH); + + JButton btnUpdateProfile = new JButton("Update profile"); + contentPane.add(btnUpdateProfile, BorderLayout.SOUTH); + + JButton btnViewAllNotices = new JButton("View All notices"); + contentPane.add(btnViewAllNotices, BorderLayout.WEST); + + JButton btnSubmitFeedback = new JButton("Submit feedback"); + contentPane.add(btnSubmitFeedback, BorderLayout.EAST); + + JLabel lblImage = new JLabel(new ImageIcon("student.png")); + contentPane.add(lblImage, BorderLayout.CENTER); + } + +} diff --git a/projects/student management sytsem/project/src/project/StudentReg.java b/projects/student management sytsem/project/src/project/StudentReg.java new file mode 100644 index 0000000..6461eb4 --- /dev/null +++ b/projects/student management sytsem/project/src/project/StudentReg.java @@ -0,0 +1,399 @@ +package project; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.JComboBox; +import javax.swing.JTextArea; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.awt.event.ActionEvent; + +public class StudentReg extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JLabel lblName; + private JLabel lblRoll; + private JLabel lblDob; + private JLabel lblGender; + private JLabel lblMobile; + private JLabel lblEmail; + private JLabel lblBranch; + private JLabel lblSemester; + private JLabel lblAdmissionDate; + private JLabel lblAddress; + private JLabel lblChoosePassword; + private JTextField textField_1; + private JTextField textField_2; + private JTextField textField_3; + private JTextField textField_4; + private JTextField textField_5; + private JButton btnReset; + private JButton btnLoginNow; + private JLabel lblCourse; + private JComboBox comboBox_9; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + StudentReg frame = new StudentReg(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public StudentReg() + { + setTitle("Student Registration Form"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 509, 698); + setResizable(false); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblNewLabel = new JLabel("New label"); + + JLabel lblEnrollmentNumber = new JLabel("Enrollment Number"); + + textField = new JTextField(); + textField.setColumns(10); + + lblName = new JLabel("Name"); + + lblRoll = new JLabel("Roll"); + + lblDob = new JLabel("DOB"); + + lblGender = new JLabel("Gender"); + + lblMobile = new JLabel("Mobile"); + + lblEmail = new JLabel("Email"); + + lblBranch = new JLabel("Branch"); + + lblSemester = new JLabel("Semester"); + + lblAdmissionDate = new JLabel("Admission Date"); + + lblAddress = new JLabel("Address"); + + lblChoosePassword = new JLabel("Choose Password"); + + textField_1 = new JTextField(); + textField_1.setColumns(10); + + textField_2 = new JTextField(); + textField_2.setColumns(10); + + textField_3 = new JTextField(); + textField_3.setColumns(10); + + textField_4 = new JTextField(); + textField_4.setColumns(10); + + textField_5 = new JTextField(); + textField_5.setColumns(10); + Integer dd[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; + Integer mm[]={1,2,3,4,5,6,7,8,9,10,11,12}; + Integer yy[]={2010,2011,2012,2013,2014,2015,2016}; + + JComboBox comboBox = new JComboBox(dd); + + JComboBox comboBox_1 = new JComboBox(mm); + + JComboBox comboBox_2 = new JComboBox(yy); + + String gender[]={"Select","Male","Female"}; + JComboBox comboBox_3 = new JComboBox(gender); + + + + JComboBox comboBox_4 = new JComboBox(GetValues.getBranch()); + comboBox_4.insertItemAt("Select", 0); + comboBox_4.setSelectedIndex(0); + + Integer sem[]={1,2,3,4,5,6,7,8,9,10}; + JComboBox comboBox_5 = new JComboBox(sem); + + JComboBox comboBox_6 = new JComboBox(dd); + + JComboBox comboBox_7 = new JComboBox(mm); + + JComboBox comboBox_8 = new JComboBox(yy); + + + comboBox_9 = new JComboBox(GetValues.getCourse()); + comboBox_9.insertItemAt("Select", 0); + comboBox_9.setSelectedIndex(0); + + JTextArea textArea = new JTextArea(); + + JButton btnSave = new JButton("SAVE"); + btnSave.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent arg0) + { + String enroll=textField.getText(); + String name=textField_1.getText(); + String roll=textField_2.getText(); + String mobile=textField_3.getText(); + String email=textField_4.getText(); + String password=textField_5.getText(); + int d1=(int) comboBox.getSelectedItem(); + int m1=(int) comboBox_1.getSelectedItem(); + int y1=(int) comboBox_2.getSelectedItem(); + String dob=d1+"/"+m1+"/"+y1; + String gender=(String)comboBox_3.getSelectedItem(); + String branch=(String)comboBox_4.getSelectedItem(); + String course=(String)comboBox_9.getSelectedItem(); + String address=textArea.getText(); + int sem=(int) comboBox_5.getSelectedItem(); + int d2=(int) comboBox_6.getSelectedItem(); + int m2=(int) comboBox_7.getSelectedItem(); + int y2=(int) comboBox_8.getSelectedItem(); + String doj=d2+"/"+m2+"/"+y2; + + Connection con=DBInfo.con; + String query="insert into student_registration values(?,?,?,?,?,?,?,?,?,?,?,?,?)"; + int i=0; + try + { + PreparedStatement ps=con.prepareStatement(query); + ps.setString(1, enroll); + ps.setString(2, name); + ps.setString(3, roll); + ps.setString(4, dob); + ps.setString(5, gender); + ps.setString(6, mobile); + ps.setString(7, email); + ps.setString(8, branch); + ps.setString(9, course); + ps.setInt(10, sem); + ps.setString(11, doj); + ps.setString(12, address); + ps.setString(13, password); + i=ps.executeUpdate(); + + } + catch(Exception e) + { + e.printStackTrace(); + } + if(i==1) + { + JOptionPane.showMessageDialog(StudentReg.this,"Records inseted"); + textField.setText(null); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + textField_5.setText(null); + textArea.setText(null); + comboBox.setSelectedIndex(0); + comboBox_1.setSelectedIndex(0); + comboBox_2.setSelectedIndex(0); + comboBox_3.setSelectedIndex(0); + comboBox_4.setSelectedIndex(0); + comboBox_5.setSelectedIndex(0); + comboBox_6.setSelectedIndex(0); + comboBox_7.setSelectedIndex(0); + comboBox_8.setSelectedIndex(0); + comboBox_9.setSelectedIndex(0); + + } + if(i==0) + { + JOptionPane.showMessageDialog(StudentReg.this,"Registration failed!!"); + } + } + + }); + + btnReset = new JButton("RESET"); + btnReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + textField.setText(null); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + textField_5.setText(null); + textArea.setText(null); + comboBox.setSelectedIndex(0); + comboBox_1.setSelectedIndex(0); + comboBox_2.setSelectedIndex(0); + comboBox_3.setSelectedIndex(0); + comboBox_4.setSelectedIndex(0); + comboBox_5.setSelectedIndex(0); + comboBox_6.setSelectedIndex(0); + comboBox_7.setSelectedIndex(0); + comboBox_8.setSelectedIndex(0); + comboBox_9.setSelectedIndex(0); + } + }); + + btnLoginNow = new JButton("Login Now"); + + lblCourse = new JLabel("Course"); + + + + + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(185) + .addComponent(lblNewLabel)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(61) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblEnrollmentNumber) + .addComponent(lblName) + .addComponent(lblRoll) + .addComponent(lblMobile) + .addComponent(lblEmail) + .addComponent(lblDob) + .addComponent(lblGender) + .addComponent(lblBranch) + .addComponent(lblSemester) + .addComponent(lblAdmissionDate) + .addComponent(lblAddress) + .addComponent(lblChoosePassword) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(btnSave) + .addGap(18) + .addComponent(btnReset, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE))) + .addGap(15) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(btnLoginNow, GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE) + .addComponent(textField_5, 183, 183, 183) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(comboBox_6, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(comboBox_7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(comboBox_8, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addComponent(comboBox_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(comboBox_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(lblCourse) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(comboBox_9, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE)) + .addComponent(comboBox_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(comboBox_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(comboBox_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addComponent(textField_4) + .addComponent(textField_3) + .addComponent(textField_2) + .addComponent(textField_1) + .addComponent(textField)) + .addComponent(textArea, GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE)))) + .addContainerGap()) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addContainerGap() + .addComponent(lblNewLabel) + .addGap(74) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnrollmentNumber) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblName) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblRoll) + .addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblDob) + .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(comboBox_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(comboBox_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblGender) + .addComponent(comboBox_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblMobile) + .addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEmail) + .addComponent(textField_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblBranch) + .addComponent(comboBox_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblCourse) + .addComponent(comboBox_9, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblSemester) + .addComponent(comboBox_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblAdmissionDate) + .addComponent(comboBox_6, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(comboBox_7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(comboBox_8, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(18) + .addComponent(lblAddress)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(19) + .addComponent(textArea, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblChoosePassword) + .addComponent(textField_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnSave) + .addComponent(btnReset) + .addComponent(btnLoginNow)) + .addGap(32)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/student management sytsem/project/src/project/ViewStudent.java b/projects/student management sytsem/project/src/project/ViewStudent.java new file mode 100644 index 0000000..9cba104 --- /dev/null +++ b/projects/student management sytsem/project/src/project/ViewStudent.java @@ -0,0 +1,406 @@ +package project; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.JComboBox; +import javax.swing.JTextArea; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.awt.event.ActionEvent; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; + +public class ViewStudent extends JFrame { + + private JPanel contentPane; + private JTextField textField; + private JLabel lblName; + private JLabel lblRoll; + private JLabel lblDob; + private JLabel lblGender; + private JLabel lblMobile; + private JLabel lblEmail; + private JLabel lblBranch; + private JLabel lblSemester; + private JLabel lblAdmissionDate; + private JLabel lblAddress; + private JTextField textField_1; + private JTextField textField_2; + private JTextField textField_3; + private JTextField textField_4; + private JTextField textField_5; + private JButton btnReset; + private JButton btnLoginNow; + private JLabel lblCourse; + private JComboBox comboBox_9,comboBox_4,comboBox_5; + private JTextField textField_6; + private JTextField textField_7; + private JTextArea textArea; + int flag=0; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + ViewStudent frame = new ViewStudent(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + public void reset() + { + textField.setText(null); + textField_1.setText(null); + textField_2.setText(null); + textField_3.setText(null); + textField_4.setText(null); + textField_5.setText(null); + textField_6.setText(null); + textField_7.setText(null); + comboBox_4.setSelectedIndex(0); + comboBox_9.setSelectedIndex(0); + comboBox_5.setSelectedIndex(0); + textArea.setText(null); + + } + /** + * Create the frame. + */ + public ViewStudent() + { + setTitle("Student Registration Form"); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setBounds(100, 100, 648, 752); + setResizable(false); + setLocationRelativeTo(this); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblNewLabel = new JLabel("New label"); + + JLabel lblEnrollmentNumber = new JLabel("Enrollment Number"); + + + lblName = new JLabel("Name"); + + lblRoll = new JLabel("Roll"); + + lblDob = new JLabel("DOB"); + + lblGender = new JLabel("Gender"); + + lblMobile = new JLabel("Mobile"); + + lblEmail = new JLabel("Email"); + + lblBranch = new JLabel("Branch"); + + lblSemester = new JLabel("Semester"); + + lblAdmissionDate = new JLabel("Admission Date"); + + lblAddress = new JLabel("Address"); + + textField = new JTextField(); + textField.setColumns(10); + comboBox_4 = new JComboBox(GetValues.getBranch()); + comboBox_4.insertItemAt("Select", 0); + comboBox_4.setSelectedIndex(0); + + Integer sem[]={1,2,3,4,5,6,7,8,9,10}; + comboBox_5 = new JComboBox(sem); + + + comboBox_9 = new JComboBox(GetValues.getCourse()); + comboBox_9.insertItemAt("Select", 0); + comboBox_9.setSelectedIndex(0); + + textArea = new JTextArea(); + + + textField_1 = new JTextField(); + textField_1.addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent arg0) + { + String enroll=textField.getText(); + String query="select * from student_registration where enrollment=?"; + + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ps.setString(1, enroll); + ResultSet res=ps.executeQuery(); + + while(res.next()) + { + textField_1.setText(res.getString(2)); + textField_2.setText(res.getString(3)); + textField_3.setText(res.getString(4)); + textField_4.setText(res.getString(5)); + textField_5.setText(res.getString(6)); + textField_6.setText(res.getString(7)); + comboBox_4.setSelectedItem(res.getString(8)); + comboBox_9.setSelectedItem(res.getString(9)); + comboBox_5.setSelectedItem(res.getString(10)); + textField_7.setText(res.getString(11)); + textArea.setText(res.getString(12)); + flag=1; + break; + + } + } + + catch(Exception e) + { + e.printStackTrace(); + } + + if(flag==0) + { + + JOptionPane.showMessageDialog(ViewStudent.this,"No match found!!","Error",JOptionPane.ERROR_MESSAGE); + + } + } + }); + textField_1.setColumns(10); + + textField_2 = new JTextField(); + textField_2.setColumns(10); + + textField_3 = new JTextField(); + textField_3.setColumns(10); + + textField_4 = new JTextField(); + textField_4.setColumns(10); + + textField_5 = new JTextField(); + textField_5.setColumns(10); + + textField_6 = new JTextField(); + textField_6.setColumns(10); + + textField_7 = new JTextField(); + textField_7.setColumns(10); + + + + + + + + JButton btnSave = new JButton("SEARCH"); + btnSave.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent arg0) + { + String enroll=textField.getText(); + String query="select * from student_registration where enrollment=?"; + int flag=0; + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ps.setString(1, enroll); + ResultSet res=ps.executeQuery(); + while(res.next()) + { + textField_1.setText(res.getString(2)); + textField_2.setText(res.getString(3)); + textField_3.setText(res.getString(4)); + textField_4.setText(res.getString(5)); + textField_5.setText(res.getString(6)); + textField_6.setText(res.getString(7)); + comboBox_4.setSelectedItem(res.getString(8)); + comboBox_9.setSelectedItem(res.getString(9)); + comboBox_5.setSelectedItem(res.getString(10)); + textField_7.setText(res.getString(11)); + textArea.setText(res.getString(12)); + flag=1; + break; + + } + } + catch(Exception e) + { + e.printStackTrace(); + } + } + + }); + + btnReset = new JButton("RESET"); + btnReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) + { + reset(); + } + }); + + btnLoginNow = new JButton("Update"); + + lblCourse = new JLabel("Course"); + + + + JButton btnDelete = new JButton("Delete"); + btnDelete.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String enroll=textField.getText(); + String query="delete from student_registration where enrollment=?"; + try + { + PreparedStatement ps=DBInfo.con.prepareStatement(query); + ps.setString(1, enroll); + ps.executeUpdate(); + } + catch(Exception e) + { + e.printStackTrace(); + } + + JOptionPane.showMessageDialog(ViewStudent.this, "Record Deleted!!"); + + reset(); + } + }); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(185) + .addComponent(lblNewLabel)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(61) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblEnrollmentNumber) + .addComponent(lblName) + .addComponent(lblRoll) + .addComponent(lblMobile) + .addComponent(lblEmail) + .addComponent(lblDob) + .addComponent(lblGender) + .addComponent(lblBranch) + .addComponent(lblSemester) + .addComponent(lblAdmissionDate) + .addComponent(lblAddress) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(btnSave) + .addGap(18) + .addComponent(btnReset, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE))) + .addGap(15) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(textField_4, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE) + .addComponent(textField_3, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false) + .addComponent(comboBox_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(comboBox_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(lblCourse) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(comboBox_9, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE)) + .addComponent(textField_2) + .addComponent(textField_1) + .addComponent(textField) + .addComponent(textField_7, GroupLayout.PREFERRED_SIZE, 183, GroupLayout.PREFERRED_SIZE)) + .addComponent(textArea, GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE) + .addComponent(textField_5, 183, 183, 183) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(btnLoginNow, GroupLayout.PREFERRED_SIZE, 87, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(btnDelete, GroupLayout.PREFERRED_SIZE, 87, GroupLayout.PREFERRED_SIZE)) + .addComponent(textField_6, GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE)))) + .addContainerGap()) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addContainerGap() + .addComponent(lblNewLabel) + .addGap(74) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblEnrollmentNumber) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblName) + .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblRoll) + .addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblDob) + .addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(12) + .addComponent(lblGender) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(lblMobile) + .addGap(18) + .addComponent(lblEmail)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(9) + .addComponent(textField_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(textField_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(textField_6, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) + .addGap(15) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblBranch) + .addComponent(comboBox_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblCourse) + .addComponent(comboBox_9, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblSemester) + .addComponent(comboBox_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblAdmissionDate) + .addComponent(textField_7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(18) + .addComponent(lblAddress)) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(19) + .addComponent(textArea, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(ComponentPlacement.RELATED, 62, Short.MAX_VALUE) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(btnSave) + .addComponent(btnReset) + .addComponent(btnLoginNow) + .addComponent(btnDelete)) + .addGap(32)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/projects/student management sytsem/project/student.png b/projects/student management sytsem/project/student.png new file mode 100644 index 0000000..2705cba Binary files /dev/null and b/projects/student management sytsem/project/student.png differ diff --git a/projects/student management sytsem/student.sql b/projects/student management sytsem/student.sql new file mode 100644 index 0000000..be23a52 --- /dev/null +++ b/projects/student management sytsem/student.sql @@ -0,0 +1,110 @@ +/* +SQLyog Enterprise - MySQL GUI v7.02 +MySQL - 5.0.67-community-nt : Database - student1 +********************************************************************* +*/ + +/*!40101 SET NAMES utf8 */; + +/*!40101 SET SQL_MODE=''*/; + +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/`student1` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `student1`; + +/*Table structure for table `branch` */ + +DROP TABLE IF EXISTS `branch`; + +CREATE TABLE `branch` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1; + +/*Data for the table `branch` */ + +insert into `branch`(`id`,`name`) values (1,'IT'),(2,'CS'),(3,'EC'),(4,'MEC'),(5,'EE'),(6,'CIVIL'),(7,'ARCH.'); + +/*Table structure for table `course` */ + +DROP TABLE IF EXISTS `course`; + +CREATE TABLE `course` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; + +/*Data for the table `course` */ + +insert into `course`(`id`,`name`) values (1,'BAC'),(2,'MCA'),(3,'BTECH'),(4,'MTECH'),(5,'BBA'),(6,'MBA'); + +/*Table structure for table `faculty_registration` */ + +DROP TABLE IF EXISTS `faculty_registration`; + +CREATE TABLE `faculty_registration` ( + `empid` varchar(25) NOT NULL, + `name` varchar(50) default NULL, + `dob` varchar(12) default NULL, + `mobile` varchar(14) default NULL, + `email` varchar(40) default NULL, + `dateofjoining` varchar(15) default NULL, + `address` varchar(150) default NULL, + `password` varchar(20) default NULL, + PRIMARY KEY (`empid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Data for the table `faculty_registration` */ + +insert into `faculty_registration`(`empid`,`name`,`dob`,`mobile`,`email`,`dateofjoining`,`address`,`password`) values ('123','abhishek','00/00/0000','9090909090','a@gmail.com','00-00-0000','jaipur','faculty123'); + +/*Table structure for table `notice` */ + +DROP TABLE IF EXISTS `notice`; + +CREATE TABLE `notice` ( + `id` int(10) NOT NULL auto_increment, + `date` varchar(100) default NULL, + `course` varchar(100) default NULL, + `branch` varchar(100) default NULL, + `notice` varchar(1000) default NULL, + `uploaded_by` varchar(20) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; + +/*Data for the table `notice` */ + +insert into `notice`(`id`,`date`,`course`,`branch`,`notice`,`uploaded_by`) values (1,'Thu Aug 25 19:04:40 IST 2016','BAC','ARCH.','exam date disclosed!!','123'); + +/*Table structure for table `student_registration` */ + +DROP TABLE IF EXISTS `student_registration`; + +CREATE TABLE `student_registration` ( + `enrollment` varchar(25) NOT NULL, + `name` varchar(50) default NULL, + `roll` varchar(15) default NULL, + `dob` varchar(12) default NULL, + `gender` varchar(10) default NULL, + `mobile` varchar(14) default NULL, + `email` varchar(40) default NULL, + `branch` varchar(10) default NULL, + `course` varchar(10) default NULL, + `sem` int(5) default NULL, + `dateofjoining` varchar(15) default NULL, + `address` varchar(150) default NULL, + `password` varchar(20) default NULL, + PRIMARY KEY (`enrollment`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Data for the table `student_registration` */ + +insert into `student_registration`(`enrollment`,`name`,`roll`,`dob`,`gender`,`mobile`,`email`,`branch`,`course`,`sem`,`dateofjoining`,`address`,`password`) values ('00/44444','abhishek','1','3/12/2010','Male','9090909090','abhishek.roadaheadtech@gmail.com','IT','BTECH',1,'1/1/2010','vikas marg,jaipur ','rat123'),('22/3333','adfadf','2','66/66/6666','male','898989898','a@gmail.com','it','mtech',2,'5/5/5555','jaipur','kuchbhi'); + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; diff --git a/projects/student management sytsem/student1.sql b/projects/student management sytsem/student1.sql new file mode 100644 index 0000000..8427a2e --- /dev/null +++ b/projects/student management sytsem/student1.sql @@ -0,0 +1,108 @@ +/* +SQLyog Enterprise - MySQL GUI v7.02 +MySQL - 5.0.67-community-nt : Database - student1 +********************************************************************* +*/ + +/*!40101 SET NAMES utf8 */; + +/*!40101 SET SQL_MODE=''*/; + +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/`student1` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `student1`; + +/*Table structure for table `branch` */ + +DROP TABLE IF EXISTS `branch`; + +CREATE TABLE `branch` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1; + +/*Data for the table `branch` */ + +insert into `branch`(`id`,`name`) values (1,'IT'),(2,'CS'),(3,'EC'),(4,'MEC'),(5,'EE'),(6,'CIVIL'),(7,'ARCH.'); + +/*Table structure for table `course` */ + +DROP TABLE IF EXISTS `course`; + +CREATE TABLE `course` ( + `id` int(10) NOT NULL auto_increment, + `name` varchar(100) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; + +/*Data for the table `course` */ + +insert into `course`(`id`,`name`) values (1,'BAC'),(2,'MCA'),(3,'BTECH'),(4,'MTECH'),(5,'BBA'),(6,'MBA'); + +/*Table structure for table `faculty_registration` */ + +DROP TABLE IF EXISTS `faculty_registration`; + +CREATE TABLE `faculty_registration` ( + `empid` varchar(25) NOT NULL, + `name` varchar(50) default NULL, + `dob` varchar(12) default NULL, + `mobile` varchar(14) default NULL, + `email` varchar(40) default NULL, + `dateofjoining` varchar(15) default NULL, + `address` varchar(150) default NULL, + `password` varchar(20) default NULL, + PRIMARY KEY (`empid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Data for the table `faculty_registration` */ + +insert into `faculty_registration`(`empid`,`name`,`dob`,`mobile`,`email`,`dateofjoining`,`address`,`password`) values ('123','abhishek','00/00/0000','9090909090','a@gmail.com','00-00-0000','jaipur','faculty123'); + +/*Table structure for table `notice` */ + +DROP TABLE IF EXISTS `notice`; + +CREATE TABLE `notice` ( + `id` int(10) NOT NULL auto_increment, + `date` varchar(15) default NULL, + `subject` varchar(50) default NULL, + `notice` varchar(300) default NULL, + `branch` int(10) default NULL, + `uploaded_by` varchar(20) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Data for the table `notice` */ + +/*Table structure for table `student_registration` */ + +DROP TABLE IF EXISTS `student_registration`; + +CREATE TABLE `student_registration` ( + `enrollment` varchar(25) NOT NULL, + `name` varchar(50) default NULL, + `roll` varchar(15) default NULL, + `dob` varchar(12) default NULL, + `gender` varchar(10) default NULL, + `mobile` varchar(14) default NULL, + `email` varchar(40) default NULL, + `branch` varchar(10) default NULL, + `course` varchar(10) default NULL, + `sem` int(5) default NULL, + `dateofjoining` varchar(15) default NULL, + `address` varchar(150) default NULL, + `password` varchar(20) default NULL, + PRIMARY KEY (`enrollment`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/*Data for the table `student_registration` */ + +insert into `student_registration`(`enrollment`,`name`,`roll`,`dob`,`gender`,`mobile`,`email`,`branch`,`course`,`sem`,`dateofjoining`,`address`,`password`) values ('00/44444','abhishek','1','3/12/2010','Male','9090909090','abhishek.roadaheadtech@gmail.com','IT','BTECH',1,'1/1/2010','vikas marg,jaipur ','rat123'); + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; diff --git a/python_ipynb/1.txt b/python_ipynb/1.txt new file mode 100644 index 0000000..7fa42b1 --- /dev/null +++ b/python_ipynb/1.txt @@ -0,0 +1,8 @@ +0b1101010100101 +0o101010101 +0c11010101001 +1234565 +0b101010100101 +0o10101001011 +123455 + diff --git a/python_ipynb/Assignment1 (1).docx b/python_ipynb/Assignment1 (1).docx new file mode 100644 index 0000000..78cdf23 Binary files /dev/null and b/python_ipynb/Assignment1 (1).docx differ diff --git a/python_ipynb/Assignment1.docx b/python_ipynb/Assignment1.docx new file mode 100644 index 0000000..78cdf23 Binary files /dev/null and b/python_ipynb/Assignment1.docx differ diff --git a/python_ipynb/Assignment10.docx b/python_ipynb/Assignment10.docx new file mode 100644 index 0000000..0c5a148 Binary files /dev/null and b/python_ipynb/Assignment10.docx differ diff --git a/python_ipynb/Assignment11.docx b/python_ipynb/Assignment11.docx new file mode 100644 index 0000000..843dc22 Binary files /dev/null and b/python_ipynb/Assignment11.docx differ diff --git a/python_ipynb/Assignment2.docx b/python_ipynb/Assignment2.docx new file mode 100644 index 0000000..0050145 Binary files /dev/null and b/python_ipynb/Assignment2.docx differ diff --git a/python_ipynb/Assignment3 (1).docx b/python_ipynb/Assignment3 (1).docx new file mode 100644 index 0000000..c9af5e2 Binary files /dev/null and b/python_ipynb/Assignment3 (1).docx differ diff --git a/python_ipynb/Assignment3.docx b/python_ipynb/Assignment3.docx new file mode 100644 index 0000000..c9af5e2 Binary files /dev/null and b/python_ipynb/Assignment3.docx differ diff --git a/python_ipynb/Assignment4.docx b/python_ipynb/Assignment4.docx new file mode 100644 index 0000000..f4ea6f3 Binary files /dev/null and b/python_ipynb/Assignment4.docx differ diff --git a/python_ipynb/Assignment5.docx b/python_ipynb/Assignment5.docx new file mode 100644 index 0000000..0e049d9 Binary files /dev/null and b/python_ipynb/Assignment5.docx differ diff --git a/python_ipynb/Assignment6.docx b/python_ipynb/Assignment6.docx new file mode 100644 index 0000000..26be310 Binary files /dev/null and b/python_ipynb/Assignment6.docx differ diff --git a/python_ipynb/Assignment7.docx b/python_ipynb/Assignment7.docx new file mode 100644 index 0000000..c734755 Binary files /dev/null and b/python_ipynb/Assignment7.docx differ diff --git a/python_ipynb/Assignment8.docx b/python_ipynb/Assignment8.docx new file mode 100644 index 0000000..da672ae Binary files /dev/null and b/python_ipynb/Assignment8.docx differ diff --git a/python_ipynb/Assignment9.docx b/python_ipynb/Assignment9.docx new file mode 100644 index 0000000..80f51d1 Binary files /dev/null and b/python_ipynb/Assignment9.docx differ diff --git a/python_ipynb/BD0211EN-Exercise-Getting-Started-py.ipynb b/python_ipynb/BD0211EN-Exercise-Getting-Started-py.ipynb new file mode 100644 index 0000000..64009e5 --- /dev/null +++ b/python_ipynb/BD0211EN-Exercise-Getting-Started-py.ipynb @@ -0,0 +1,638 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + " " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "

    Spark Fundamentals I - Introduction to Spark

    \n", + "

    Getting Started

    \n", + "
    \n", + "\n", + "**Related free online courses:**\n", + "\n", + "Related courses can be found in the following learning paths:\n", + "\n", + "- [Spark Fundamentals path](http://cocl.us/Spark_Fundamentals_Path)\n", + "- [Big Data Fundamentals path](http://cocl.us/Big_Data_Fundamentals_Path) \n", + "\n", + "" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + " ## Spark is built around speed and the ease of use. In these labs you will see for yourself how easy it is to get started using Spark. \n", + "\n", + "Spark’s primary abstraction is a distributed collection of items called a Resilient Distributed Dataset or RDD. In a subsequent lab exercise, you will learn more about the details of RDD. RDDs have actions, which return values, and transformations, which return pointers to new RDD.\n", + "\n", + "This set of labs uses Cognitive Class Labs (formerly known as BDU Labs) to provide an interactive environment to develop applications and analyze data. It is available in either Scala or Python shells. Scala runs on the Java VM and is thus a good way to use existing Java libraries. In this lab exercise, we will set up our environment in preparation for the later labs.\n", + "\n", + "After completing this set of hands-on labs, you should be able to:\n", + "\n", + "1. Perform basic RDD actions and transformations\n", + "2. Use caching to speed up repeated operations\n", + "\n", + "\n", + "### Using this notebook\n", + "\n", + "This is an interactive environment where you can show your code through cells, and documentation through markdown.\n", + "\n", + "Look at the top right corner. Do you see \"Python 3\"? This indicates that you are running Python in this notebook.\n", + "\n", + "**To run a cell:** Shift + Enter\n", + "\n", + "### Try creating a new cell below.\n", + "\n", + "**To create a new cell:** In the menu, go to _\"Insert\" > \"Insert Cell Below\"_. Or, click outside of a cell, and press \"a\" (insert cell above) or \"b\" (insert cell below)." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "# Lab Setup\n", + "\n", + "Run the following cells to get the lab data." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "# download the data from the IBM server\n", + "# this may take ~30 seconds depending on your internet speed\n", + "!wget --quiet https://ibm.box.com/shared/static/j8skrriqeqw66f51iyz911zyqai64j2g.zip\n", + "print(\"Data Downloaded!\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Let's unzip the data that we just downloaded into a directory dedicated for this course. Let's choose the directory **/resources/jupyter/labs/BD0211EN/**." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "# this may take ~30 seconds depending on your internet speed\n", + "!unzip -q -o -d /resources/jupyter/labs/BD0211EN/ j8skrriqeqw66f51iyz911zyqai64j2g.zip\n", + "print(\"Data Extracted!\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The data is in a folder called **LabData**. Let's list all the files in the data that we just downloaded and extracted." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "# list the extracted files\n", + "!ls -1 /resources/jupyter/labs/BD0211EN/LabData" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "Should have:\n", + " \n", + "* followers.txt\n", + "* notebook.log\n", + "* nyctaxi100.csv\n", + "* nyctaxi.csv\n", + "* nyctaxisub.csv\n", + "* nycweather.csv\n", + "* pom.xml\n", + "* README.md\n", + "* taxistreams.py\n", + "* users.txt" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "### Starting with Spark\n", + "\n", + "The notebooks provide code assist. For example, type in \"sc.\" followed by the Tab key to get the list of options associated with the spark context:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "sc." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "To run a command as code, simple select the cell you want to run and either:\n", + "\n", + "* Click the play button in the toolbar above\n", + "* Press \"_Shift+Enter_\"\n", + "\n", + "Let's run a basic command and check the version of Spark running:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "sc.version" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Add in the path to the *README.md* file in **LabData**." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "readme = sc.textFile(\"/resources/jupyter/labs/BD0211EN/LabData/README.md\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "Let’s perform some RDD actions on this text file. Count the number of items in the RDD using this command:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "readme.count()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "You should see that this RDD action returned a value of 103.\n", + "\n", + "Let’s run another action. Run this command to find the first item in the RDD:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "readme.first()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "Now let’s try a transformation. Use the filter transformation to return a new RDD with a subset of the items in the file. Type in this command:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "linesWithSpark = readme.filter(lambda line: \"Spark\" in line)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "You can even chain together transformations and actions. To find out how many lines contains the word “Spark”, type in:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "linesWithSpark = readme.filter(lambda line: \"Spark\" in line)\n", + "readme.filter(lambda line: \"Spark\" in line).count()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "# More on RDD Operations\n", + "\n", + "This section builds upon the previous section. In this section, you will see that RDD can be used for more complex computations. You will find the line from that \"README.md\" file with the most words in it.\n", + "\n", + "Run the following cell." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "readme.map(lambda line: len(line.split())).reduce(lambda a, b: a if (a > b) else b)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "There are two parts to this. The first maps a line to an integer value, the number of words in that line. In the second part reduce is called to find the line with the most words in it. The arguments to map and reduce are Python anonymous functions (lambdas), but you can use any top level Python functions. In the next step, you’ll define a max function to illustrate this feature.\n", + "\n", + "Define the max function. You will need to type this in:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "def max(a, b):\n", + " if a > b:\n", + " return a\n", + " else:\n", + " return b" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "Now run the following with the max function:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "readme.map(lambda line: len(line.split())).reduce(max)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "Spark has a MapReduce data flow pattern. We can use this to do a word count on the readme file." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "wordCounts = readme.flatMap(lambda line: line.split()).map(lambda word: (word, 1)).reduceByKey(lambda a, b: a+b)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "Here we combined the flatMap, map, and the reduceByKey functions to do a word count of each word in the readme file.\n", + "\n", + "To collect the word counts, use the _collect_ action.\n", + "\n", + "#### It should be noted that the collect function brings all of the data into the driver node. For a small dataset, this is acceptable but, for a large dataset this can cause an Out Of Memory error. It is recommended to use collect() for testing only. The safer approach is to use the take() function e.g. print take(n)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "wordCounts.collect()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "### YOUR TURN: \n", + "\n", + "#### In the cell below, determine what is the most frequent word in the README, and how many times was it used?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "# WRITE YOUR CODE BELOW\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "source": [ + "Highlight text field for answer:\n", + "\n", + " b[1]) else b)\" style=\"color: white\">" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "## Using Spark caching\n", + "\n", + "In this short section, you’ll see how Spark caching can be used to pull data sets into a cluster-wide in-memory cache. This is very useful for accessing repeated data, such as querying a small “hot” dataset or when running an iterative algorithm. Both Python and Scala use the same commands.\n", + "\n", + "As a simple example, let’s mark our linesWithSpark dataset to be cached and then invoke the first count operation to tell Spark to cache it. Remember that transformation operations such as cache does not get processed until some action like count() is called. Once you run the second count() operation, you should notice a small increase in speed.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "print(linesWithSpark.count())" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "from timeit import Timer\n", + "def count():\n", + " return linesWithSpark.count()\n", + "t = Timer(lambda: count())" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "print(t.timeit(number=50))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "linesWithSpark.cache()\n", + "print(t.timeit(number=50))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "It may seem silly to cache such a small file, but for larger data sets across tens or hundreds of nodes, this would still work. The second linesWithSpark.count() action runs against the cache and would perform significantly better for large datasets." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "
    \n", + "**Tip**: Enjoyed using Jupyter notebooks with Spark? Get yourself a free \n", + " IBM Cloud account where you can use Data Science Experience notebooks\n", + " and have *two* Spark executors for free!\n", + "
    " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Summary\n", + "Having completed this exercise, you should now be able to log in to your environment and use the Spark shell to run simple actions and transformations for Scala and/or Python. You understand that Spark caching can be used to cache large datasets and subsequent operations on it will utilize the data in the cache rather than re-fetching it from HDFS." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "This notebook is part of the free course on **Cognitive Class** called *Spark Fundamentals I*. If you accessed this notebook outside the course, you can take this free self-paced course, online by going to: http://cocl.us/Spark_Fundamentals_I" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "### About the Authors: \n", + "Hi! It's [Alex Aklson](https://www.linkedin.com/in/aklson/), one of the authors of this notebook. I hope you found this lab educational! There is much more to learn about Spark but you are well on your way. Feel free to connect with me if you have any questions.\n", + "
    " + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.5.2" + }, + "widgets": { + "state": {}, + "version": "1.1.2" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/python_ipynb/Basic_Data_Type.html b/python_ipynb/Basic_Data_Type.html new file mode 100644 index 0000000..1157b47 --- /dev/null +++ b/python_ipynb/Basic_Data_Type.html @@ -0,0 +1,20615 @@ + + + +Basic_Data_Type + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +
    +

    Basic Data Type

    +

    Data types are just some kind of rules that are used to categorized the data into different different maaner of zones.
    Data type only denotes type data we can store in a particular container.

    +
    +
    +
    +
    +
    +
    +
    +

    DATA Structures or DATA Types in python

    +
    +
    +
    +
    +
    +
    +
    +

      +
    1. Numbers --> int, float, char
    2. +
    3. Strings --> 'hi am a string'
    4. +
    5. List --> collection of items like [1,2,'hi','hello']
    6. +
    7. Tuple --> same as list but i am constant (1,2,'hi','hello')
    8. +
    9. Dictionary --> I am just awesome { 'name':'python','type':'programming language'}
    10. +
    11. Sets --> you know math you know me ? { 1,2,'hi','bye','bye bye'}
    12. + +
    +
    +
    +
    +
    +
    In [2]:
    +
    +
    +
    x = 45
    +print("Type of x = ",type(x))
    +print("Value of x = ",x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Type of x =  <class 'int'>
    +Value of x =  45
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    y = 50 
    +print("Type of y = ",type(y))
    +print("Value of y = ",y)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Type of y =  <class 'int'>
    +Value of y =  50
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    print(dir(x))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    help(x.to_bytes)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Help on built-in function to_bytes:
    +
    +to_bytes(...) method of builtins.int instance
    +    int.to_bytes(length, byteorder, *, signed=False) -> bytes
    +    
    +    Return an array of bytes representing an integer.
    +    
    +    The integer is represented using length bytes.  An OverflowError is
    +    raised if the integer is not representable with the given number of
    +    bytes.
    +    
    +    The byteorder argument determines the byte order used to represent the
    +    integer.  If byteorder is 'big', the most significant byte is at the
    +    beginning of the byte array.  If byteorder is 'little', the most
    +    significant byte is at the end of the byte array.  To request the native
    +    byte order of the host system, use `sys.byteorder' as the byte order value.
    +    
    +    The signed keyword-only argument determines whether two's complement is
    +    used to represent the integer.  If signed is False and a negative integer
    +    is given, an OverflowError is raised.
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    x.denominator
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[9]:
    + + + + +
    +
    1
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    x.numerator
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[10]:
    + + + + +
    +
    45
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    x.bit_length()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[11]:
    + + + + +
    +
    6
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    print(print("I also return None you can see it"))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    I also return None you can see it
    +None
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    print(print())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +None
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    x = print(print(print(print(print()))))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +None
    +None
    +None
    +None
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    None
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    x = 5
    +y = 31
    +print(x.bit_length())
    +print(y.bit_length())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    3
    +5
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    x = 1.23
    +print(type(x))
    +x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    <class 'float'>
    +
    +
    +
    + +
    + +
    Out[20]:
    + + + + +
    +
    1.23
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [21]:
    +
    +
    +
    x  = 1.23 + 6.4j
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [22]:
    +
    +
    +
    print(type(x))
    +x 
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    <class 'complex'>
    +
    +
    +
    + +
    + +
    Out[22]:
    + + + + +
    +
    (1.23+6.4j)
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    56**56
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[23]:
    + + + + +
    +
    79164324866862966607842406018063254671922245312646690223362402918484170424104310169552592050323456
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    x = 999**999
    +print(x.bit_length())
    +print(x.__sizeof__())
    +print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    9955
    +1352
    +368063488259223267894700840060521865838338232037353204655959621437025609300472231530103873614505175218691345257589896391130393189447969771645832382192366076536631132001776175977932178658703660778465765811830827876982014124022948671975678131724958064427949902810498973271030787716781467419524180040734398996952930832508934116945966120176735120823151959779536852290090377452502236990839453416790640456116471139751546750048602189291028640970574762600185950226138244530187489211615864021135312077912018844630780307462205252807737757672094320692373101032517459518497524015120165166724189816766397247824175394802028228160027100623998873667435799073054618906855460488351426611310634023489044291860510352301912426608488807462312126590206830413782664554260411266378866626653755763627796569082931785645600816236891168141774993267488171702172191072731069216881668294625679492696148976999868715671440874206427212056717373099639711168901197440416590226524192782842896415414611688187391232048327738965820265934093108172054875188246591760877131657895633586576611857277011782497943522945011248430439201297015119468730712364007639373910811953430309476832453230123996750235710787086641070310288725389595138936784715274150426495416196669832679980253436807864187160054589045664027158817958549374490512399055448819148487049363674611664609890030088549591992466360050042566270348330911795487647045949301286614658650071299695652245266080672989921799342509291635330827874264789587306974472327718704306352445925996155619153783913237212716010410294999877569745287353422903443387562746452522860420416689019732913798073773281533570910205207767157128174184873357050830752777900041943256738499067821488421053870869022738698816059810579221002560882999884763252161747566893835178558961142349304466506402373556318707175710866983035313122068321102457824112014969387225476259342872866363550383840720010832906695360553556647545295849966279980830561242960013654529514995113584909050813015198928283202189194615501403435553060147713139766323195743324848047347575473228198492343231496580885057330510949058490527738662697480293583612233134502078182014347192522391449087738579081585795613547198599661273567662441490401862839817822686573112998663038868314974259766039340894024308383451039874674061160538242392803580758232755749310843694194787991556647907091849600704712003371103926967137408125713631396699343733288014254084819379380555174777020843568689927348949484201042595271932630685747613835385434424807024615161848223715989797178155169951121052285149157137697718850449708843330475301440373094611119631361702936342263219382793996895988331701890693689862459020775599439506870005130750427949747071390095256759203426671803377068109744629909769176319526837824364926844730545524646494321826241925107158040561607706364484910978348669388142016838792902926158979355432483611517588605967745393958061959024834251565197963477521095821435651996730128376734574843289089682710350244222290017891280419782767803785277960834729869249991658417000499998999
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    x = input("Enter x : ")
    +print("Type of x ",type(x))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter x : 5
    +Type of x  <class 'str'>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    x  = input("X : ") #string not int
    +y = input("Y : ") #string not int
    +print("Addition of x and y : ",x+y)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    X : 5
    +Y : 5
    +Addition of x and y :  55
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    s = 'Hello ' + 'world '+'12334' #concatination of strings
    +print(repr(s))
    +print(type(s))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    'Hello world 12334'
    +<class 'str'>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    x  = input("X : ") #string not int
    +x = int(x) #now x is int
    +y = input("Y : ") #string not int
    +y = int(y) #now y is int
    +print("Addition of x and y : ",x+y)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    X : 
    +
    +
    +
    + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +ValueError                                Traceback (most recent call last)
    +<ipython-input-6-6a8a159b575b> in <module>()
    +      1 x  = input("X : ") #string not int
    +----> 2 x = int(x) #now x is int
    +      3 y = input("Y : ") #string not int
    +      4 y = int(y) #now y is int
    +      5 print("Addition of x and y : ",x+y)
    +
    +ValueError: invalid literal for int() with base 10: ''
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
    x = int(input("Enter number : "))
    +p = int(input("Enter power : "))
    +print("number = ",x,end='  ')
    +print("power = ",p,end='  ')
    +print(x,'ki power',p,'=',x**p)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
    print("x",x,sep=' = ',end='\t')
    +print("y",y,sep=' = ')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
    help(print)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
    l = [ var for var in range(999999999999999999999999999999999999999999999999999) ]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    x = 5654.67+567j
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    print(type(x))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    <class 'complex'>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    print(dir(x))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__abs__', '__add__', '__bool__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__int__', '__le__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__pos__', '__pow__', '__radd__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rmod__', '__rmul__', '__rpow__', '__rsub__', '__rtruediv__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', 'conjugate', 'imag', 'real']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    x.imag
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[10]:
    + + + + +
    +
    567.0
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    x.real
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[12]:
    + + + + +
    +
    5654.67
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[13]:
    + + + + +
    +
    (5654.67+567j)
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Strings in Python

    +
    +
    +
    +
    +
    +
    In [14]:
    +
    +
    +
    x = input("Bhai kuch b likh do : ")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Bhai kuch b likh do : 123123132131
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    print(type(x))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    <class 'str'>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[16]:
    + + + + +
    +
    '123123132131'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    x = 456
    +y = '456'
    +print("Type of x ",type(x))
    +print("Type of y ",type(y))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Type of x  <class 'int'>
    +Type of y  <class 'str'>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    y[0]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[18]:
    + + + + +
    +
    '4'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    y[1]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[19]:
    + + + + +
    +
    '5'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [21]:
    +
    +
    +
    y[2]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[21]:
    + + + + +
    +
    '6'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    s = 'hello World'
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [24]:
    +
    +
    +
    k = "Hello World"
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    print(s)
    +print('Type of s = ',type(s))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    hello World
    +Type of s =  <class 'str'>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [28]:
    +
    +
    +
    print('Type of k = ',type(k))
    +print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Type of k =  <class 'str'>
    +Hello World
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    he said,"Python is Awesome"

    +
    +
    +
    +
    +
    +
    In [34]:
    +
    +
    +
    s = "\ He said,\"Python is Awesome\""
    +print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    	 He said,"Python is Awesome"
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [37]:
    +
    +
    +
    print("\\")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    \
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [38]:
    +
    +
    +
    s = 'He said,"Python is Awesome"'
    +print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    He said,"Python is Awesome"
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [39]:
    +
    +
    +
    s = "hello bhai,
    +tu bta ky haal chaal"
    +print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +  File "<ipython-input-39-c89ee1bb9386>", line 1
    +    s = "hello bhai,
    +                    ^
    +SyntaxError: EOL while scanning string literal
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [40]:
    +
    +
    +
    s = "hello bhai,\n\tky haal chaal hai"
    +print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    hello bhai,
    +	ky haal chaal hai
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [41]:
    +
    +
    +
    s = """
    +Hello world,
    +            This is awesome feature of python.
    +where i can write my own paragraph.
    +    without any worries
    +so let's go
    +"""
    +print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +Hello world,
    +            This is awesome feature of python.
    +where i can write my own paragraph.
    +    without any worries
    +so let's go
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [42]:
    +
    +
    +
    #single line comment
    +"""
    +i can write.
    +    multiple line of comments
    +using triple quotes
    +
    +it"s Awesome"""
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[42]:
    + + + + +
    +
    '\ni can write.\n    multiple line of comments\nusing triple quotes\n\nit"s Awesome'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [43]:
    +
    +
    +
    s = "Hello World!"
    +print(len(s))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    12
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
    print(s[6])
    +print(s[-6])
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
    print(s[4])
    +print(s[-8])
    +
    + +
    +
    +
    + +
    mutable ---> those data type in which we can make chage +immutable --. those which are not mutable or we can not change them +
    +
    +
    In [46]:
    +
    +
    +
    # String is Sequential and Immutable data-type
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [48]:
    +
    +
    +
    s[2] = 'k'
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +TypeError                                 Traceback (most recent call last)
    +<ipython-input-48-42ee09417777> in <module>()
    +----> 1 s[2] = 'k'
    +
    +TypeError: 'str' object does not support item assignment
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [49]:
    +
    +
    +
    s
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[49]:
    + + + + +
    +
    'Hello World!'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [50]:
    +
    +
    +
    x = s[3] # x = 'l'
    +y = s[1] # y = 'e'
    +z = s[6] # z = 'W'
    +r  = x + y + z # 'l' + 'e' + 'W' --> r = 'leW'
    +print(r)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    leW
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [51]:
    +
    +
    +
    #s[start:end:jump]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [52]:
    +
    +
    +
    s[:]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[52]:
    + + + + +
    +
    'Hello World!'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [54]:
    +
    +
    +
    x = s[4:]
    +print(s)
    +print("s[4:] = ",x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World!
    +s[4:] =  o World!
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [55]:
    +
    +
    +
    s = "Hello World!"
    +s[:5]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[55]:
    + + + + +
    +
    'Hello'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [56]:
    +
    +
    +
    s[6:9]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[56]:
    + + + + +
    +
    'Wor'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [57]:
    +
    +
    +
    s[-5:-1]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[57]:
    + + + + +
    +
    'orld'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [59]:
    +
    +
    +
    s[1:10:2]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[59]:
    + + + + +
    +
    'el ol'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [1]:
    +
    +
    +
    s = "Hello World!! how are you"
    +len(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[1]:
    + + + + +
    +
    25
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    x = s[22:5:-2]
    +print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    yeawh!drW
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    s = "Hello World"
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    s[-2]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[4]:
    + + + + +
    +
    'l'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    s[3]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[5]:
    + + + + +
    +
    'l'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    print(s[8])
    +print(s[-6])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    r
    + 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    s[:3]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[7]:
    + + + + +
    +
    'Hel'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    s[4:]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[8]:
    + + + + +
    +
    'o World'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    s = "Hello World"
    +print(s[4::-1])
    +print(s[:4:-1])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    olleH
    +dlroW 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    s = "Hello World"
    +s[-10:-1:-2]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[10]:
    + + + + +
    +
    ''
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    s = "Hello World"
    +s[-10:100:2]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[11]:
    + + + + +
    +
    'el ol'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    print(dir(s))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    print(help(s.swapcase))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Help on built-in function swapcase:
    +
    +swapcase(...) method of builtins.str instance
    +    S.swapcase() -> str
    +    
    +    Return a copy of S with uppercase characters converted to lowercase
    +    and vice versa.
    +
    +None
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    s.swapcase()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[14]:
    + + + + +
    +
    'hELLO wORLD'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    s = "Hi I am Original String"
    +s1 = s.swapcase()
    +print("Original ",s,sep='--->')
    +print("SwapCase String ",s1,sep='--->')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Original --->Hi I am Original String
    +SwapCase String --->hI i AM oRIGINAL sTRING
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    print(dir(s))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    print(s.replace.__doc__)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    S.replace(old, new[, count]) -> str
    +
    +Return a copy of S with all occurrences of substring
    +old replaced by new.  If the optional argument count is
    +given, only the first count occurrences are replaced.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    s = "All Dogs are Dogs.\
    +But some humans Behave like a Dog.\
    +Some dogs are very cute like humans.\
    +Actually Dogs are far better than humnas.\
    +"
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    s.find('Dog')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[20]:
    + + + + +
    +
    4
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [21]:
    +
    +
    +
    s
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[21]:
    + + + + +
    +
    'All Dogs are Dogs.\nBut some humans Behave like a Dog.\nSome dogs are very cute like humans.\nActually Dogs are far better than humnas.\n'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [24]:
    +
    +
    +
    s1 = s.replace('Dog','Animal')
    +print(s)
    +print(s1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    All Dogs are Dogs.
    +But some humans Behave like a Dog.
    +Some dogs are very cute like humans.
    +Actually Dogs are far better than humnas.
    +
    +All Animals are Animals.
    +But some humans Behave like a Animal.
    +Some dogs are very cute like humans.
    +Actually Animals are far better than humnas.
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [31]:
    +
    +
    +
    s2 = s.replace('Dog','Animal',3)
    +print(s)
    +print(s2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    All Dogs are Dogs.
    +But some humans Behave like a Dog.
    +Some dogs are very cute like humans.
    +Actually Dogs are far better than humnas.
    +
    +All Animals are Animals.
    +But some humans Behave like a Animal.
    +Some dogs are very cute like humans.
    +Actually Dogs are far better than humnas.
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [33]:
    +
    +
    +
    s = "Hello World"
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [34]:
    +
    +
    +
    s.lower()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[34]:
    + + + + +
    +
    'hello world'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [35]:
    +
    +
    +
    s.upper()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[35]:
    + + + + +
    +
    'HELLO WORLD'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [38]:
    +
    +
    +
    x = 4\
    +5
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [39]:
    +
    +
    +
    x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[39]:
    + + + + +
    +
    45
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [1]:
    +
    +
    +
    s = "Hello World"
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    print(dir(s))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    print(s.capitalize.__doc__) #doc-string
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    S.capitalize() -> str
    +
    +Return a capitalized version of S, i.e. make the first character
    +have upper case and the rest lower case.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    s = "He Is a BOY who got some real Skills in programminG"
    +print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    He Is a BOY who got some real Skills in programminG
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    s1 = s.capitalize()
    +print(s)
    +print(s1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    He Is a BOY who got some real Skills in programminG
    +He is a boy who got some real skills in programming
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    'hello'.casefold() == 'Hello'.casefold()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[9]:
    + + + + +
    +
    True
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    s = "My name is KHAN."
    +print(len(s))
    +s1 = s.center(len(s)+100,'*')
    +print(s)
    +print(s1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    16
    +My name is KHAN.
    +**************************************************My name is KHAN.**************************************************
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    a = s.count(r'[a]')
    +i = s.count('i')
    +o  = s.count('o')
    +u  = s.count('u')
    +y = s.count('y')
    +print(s)
    +print("a = ",a)
    +print("i = ",i)
    +print("o = ",o)
    +print("u = ",u)
    +print("y = ",y)
    +print("Toatal vowels in string = ",a+i+o+u+y)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    My name is KHAN.
    +a =  0
    +i =  1
    +o =  0
    +u =  0
    +y =  1
    +Toatal vowels in string =  2
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [28]:
    +
    +
    +
    s  = "dog and cat are best animals. dog is dog as cat is cat."
    +dog = s.count('dog')
    +cat = s.count('cat')
    +print("Dog counting = ",dog)
    +print("Cat counting = ",cat)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Dog counting =  3
    +Cat counting =  3
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [31]:
    +
    +
    +
    s = "Hello World"
    +k  = s.encode('ascii')
    +print(s)
    +print("type of s ",type(s))
    +print(k)
    +print("type of s ",type(k))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World
    +type of s  <class 'str'>
    +b'Hello World'
    +type of s  <class 'bytes'>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [38]:
    +
    +
    +
    s = "Hello i am ending with sachin and python."
    +k = s.endswith('python')
    +k
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[38]:
    + + + + +
    +
    False
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [39]:
    +
    +
    +
    for var in range(1,1000):
    +    print(chr(var),end=',')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ,,,,,,,,	,
    +,,,,,,,,,,,,,,,,,,, ,!,",#,$,%,&,',(,),*,+,,,-,.,/,0,1,2,3,4,5,6,7,8,9,:,;,<,=,>,?,@,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,[,\,],^,_,`,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,{,|,},~,,€,,‚,ƒ,„,…,†,‡,ˆ,‰,Š,‹,Œ,,Ž,,,‘,’,“,”,•,–,—,˜,™,š,›,œ,,ž,Ÿ, ,¡,¢,£,¤,¥,¦,§,¨,©,ª,«,¬,­,®,¯,°,±,²,³,´,µ,¶,·,¸,¹,º,»,¼,½,¾,¿,À,Á,Â,Ã,Ä,Å,Æ,Ç,È,É,Ê,Ë,Ì,Í,Î,Ï,Ð,Ñ,Ò,Ó,Ô,Õ,Ö,×,Ø,Ù,Ú,Û,Ü,Ý,Þ,ß,à,á,â,ã,ä,å,æ,ç,è,é,ê,ë,ì,í,î,ï,ð,ñ,ò,ó,ô,õ,ö,÷,ø,ù,ú,û,ü,ý,þ,ÿ,Ā,ā,Ă,ă,Ą,ą,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č,Ď,ď,Đ,đ,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě,Ĝ,ĝ,Ğ,ğ,Ġ,ġ,Ģ,ģ,Ĥ,ĥ,Ħ,ħ,Ĩ,ĩ,Ī,ī,Ĭ,ĭ,Į,į,İ,ı,IJ,ij,Ĵ,ĵ,Ķ,ķ,ĸ,Ĺ,ĺ,Ļ,ļ,Ľ,ľ,Ŀ,ŀ,Ł,ł,Ń,ń,Ņ,ņ,Ň,ň,ʼn,Ŋ,ŋ,Ō,ō,Ŏ,ŏ,Ő,ő,Œ,œ,Ŕ,ŕ,Ŗ,ŗ,Ř,ř,Ś,ś,Ŝ,ŝ,Ş,ş,Š,š,Ţ,ţ,Ť,ť,Ŧ,ŧ,Ũ,ũ,Ū,ū,Ŭ,ŭ,Ů,ů,Ű,ű,Ų,ų,Ŵ,ŵ,Ŷ,ŷ,Ÿ,Ź,ź,Ż,ż,Ž,ž,ſ,ƀ,Ɓ,Ƃ,ƃ,Ƅ,ƅ,Ɔ,Ƈ,ƈ,Ɖ,Ɗ,Ƌ,ƌ,ƍ,Ǝ,Ə,Ɛ,Ƒ,ƒ,Ɠ,Ɣ,ƕ,Ɩ,Ɨ,Ƙ,ƙ,ƚ,ƛ,Ɯ,Ɲ,ƞ,Ɵ,Ơ,ơ,Ƣ,ƣ,Ƥ,ƥ,Ʀ,Ƨ,ƨ,Ʃ,ƪ,ƫ,Ƭ,ƭ,Ʈ,Ư,ư,Ʊ,Ʋ,Ƴ,ƴ,Ƶ,ƶ,Ʒ,Ƹ,ƹ,ƺ,ƻ,Ƽ,ƽ,ƾ,ƿ,ǀ,ǁ,ǂ,ǃ,DŽ,Dž,dž,LJ,Lj,lj,NJ,Nj,nj,Ǎ,ǎ,Ǐ,ǐ,Ǒ,ǒ,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ,ǝ,Ǟ,ǟ,Ǡ,ǡ,Ǣ,ǣ,Ǥ,ǥ,Ǧ,ǧ,Ǩ,ǩ,Ǫ,ǫ,Ǭ,ǭ,Ǯ,ǯ,ǰ,DZ,Dz,dz,Ǵ,ǵ,Ƕ,Ƿ,Ǹ,ǹ,Ǻ,ǻ,Ǽ,ǽ,Ǿ,ǿ,Ȁ,ȁ,Ȃ,ȃ,Ȅ,ȅ,Ȇ,ȇ,Ȉ,ȉ,Ȋ,ȋ,Ȍ,ȍ,Ȏ,ȏ,Ȑ,ȑ,Ȓ,ȓ,Ȕ,ȕ,Ȗ,ȗ,Ș,ș,Ț,ț,Ȝ,ȝ,Ȟ,ȟ,Ƞ,ȡ,Ȣ,ȣ,Ȥ,ȥ,Ȧ,ȧ,Ȩ,ȩ,Ȫ,ȫ,Ȭ,ȭ,Ȯ,ȯ,Ȱ,ȱ,Ȳ,ȳ,ȴ,ȵ,ȶ,ȷ,ȸ,ȹ,Ⱥ,Ȼ,ȼ,Ƚ,Ⱦ,ȿ,ɀ,Ɂ,ɂ,Ƀ,Ʉ,Ʌ,Ɇ,ɇ,Ɉ,ɉ,Ɋ,ɋ,Ɍ,ɍ,Ɏ,ɏ,ɐ,ɑ,ɒ,ɓ,ɔ,ɕ,ɖ,ɗ,ɘ,ə,ɚ,ɛ,ɜ,ɝ,ɞ,ɟ,ɠ,ɡ,ɢ,ɣ,ɤ,ɥ,ɦ,ɧ,ɨ,ɩ,ɪ,ɫ,ɬ,ɭ,ɮ,ɯ,ɰ,ɱ,ɲ,ɳ,ɴ,ɵ,ɶ,ɷ,ɸ,ɹ,ɺ,ɻ,ɼ,ɽ,ɾ,ɿ,ʀ,ʁ,ʂ,ʃ,ʄ,ʅ,ʆ,ʇ,ʈ,ʉ,ʊ,ʋ,ʌ,ʍ,ʎ,ʏ,ʐ,ʑ,ʒ,ʓ,ʔ,ʕ,ʖ,ʗ,ʘ,ʙ,ʚ,ʛ,ʜ,ʝ,ʞ,ʟ,ʠ,ʡ,ʢ,ʣ,ʤ,ʥ,ʦ,ʧ,ʨ,ʩ,ʪ,ʫ,ʬ,ʭ,ʮ,ʯ,ʰ,ʱ,ʲ,ʳ,ʴ,ʵ,ʶ,ʷ,ʸ,ʹ,ʺ,ʻ,ʼ,ʽ,ʾ,ʿ,ˀ,ˁ,˂,˃,˄,˅,ˆ,ˇ,ˈ,ˉ,ˊ,ˋ,ˌ,ˍ,ˎ,ˏ,ː,ˑ,˒,˓,˔,˕,˖,˗,˘,˙,˚,˛,˜,˝,˞,˟,ˠ,ˡ,ˢ,ˣ,ˤ,˥,˦,˧,˨,˩,˪,˫,ˬ,˭,ˮ,˯,˰,˱,˲,˳,˴,˵,˶,˷,˸,˹,˺,˻,˼,˽,˾,˿,̀,́,̂,̃,̄,̅,̆,̇,̈,̉,̊,̋,̌,̍,̎,̏,̐,̑,̒,̓,̔,̕,̖,̗,̘,̙,̚,̛,̜,̝,̞,̟,̠,̡,̢,̣,̤,̥,̦,̧,̨,̩,̪,̫,̬,̭,̮,̯,̰,̱,̲,̳,̴,̵,̶,̷,̸,̹,̺,̻,̼,̽,̾,̿,̀,́,͂,̓,̈́,ͅ,͆,͇,͈,͉,͊,͋,͌,͍,͎,͏,͐,͑,͒,͓,͔,͕,͖,͗,͘,͙,͚,͛,͜,͝,͞,͟,͠,͡,͢,ͣ,ͤ,ͥ,ͦ,ͧ,ͨ,ͩ,ͪ,ͫ,ͬ,ͭ,ͮ,ͯ,Ͱ,ͱ,Ͳ,ͳ,ʹ,͵,Ͷ,ͷ,͸,͹,ͺ,ͻ,ͼ,ͽ,;,Ϳ,΀,΁,΂,΃,΄,΅,Ά,·,Έ,Ή,Ί,΋,Ό,΍,Ύ,Ώ,ΐ,Α,Β,Γ,Δ,Ε,Ζ,Η,Θ,Ι,Κ,Λ,Μ,Ν,Ξ,Ο,Π,Ρ,΢,Σ,Τ,Υ,Φ,Χ,Ψ,Ω,Ϊ,Ϋ,ά,έ,ή,ί,ΰ,α,β,γ,δ,ε,ζ,η,θ,ι,κ,λ,μ,ν,ξ,ο,π,ρ,ς,σ,τ,υ,φ,χ,ψ,ω,ϊ,ϋ,ό,ύ,ώ,Ϗ,ϐ,ϑ,ϒ,ϓ,ϔ,ϕ,ϖ,ϗ,Ϙ,ϙ,Ϛ,ϛ,Ϝ,ϝ,Ϟ,ϟ,Ϡ,ϡ,Ϣ,ϣ,Ϥ,ϥ,Ϧ,ϧ,
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [40]:
    +
    +
    +
    print(dir(s))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [51]:
    +
    +
    +
    s = "hello World\tHow are you\tgood to go."
    +print(s)
    +s1 = s.expandtabs(13)
    +print(s1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    hello World	How are you	good to go.
    +hello World  How are you  good to go.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [52]:
    +
    +
    +
    #it will find sub-string into string s
    +s = "Hi atal was a great person as well as he really atal"
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [63]:
    +
    +
    +
    index = s.find('atal')
    +print(s)
    +print(index)
    +help(s.find)
    +i = s.find('atal',7,len(s))
    +print(i)
    +print(s[i:i+4])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hi atal was a great person as well as he really atal
    +3
    +Help on built-in function find:
    +
    +find(...) method of builtins.str instance
    +    S.find(sub[, start[, end]]) -> int
    +    
    +    Return the lowest index in S where substring sub is found,
    +    such that sub is contained within S[start:end].  Optional
    +    arguments start and end are interpreted as in slice notation.
    +    
    +    Return -1 on failure.
    +
    +48
    +atal
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [56]:
    +
    +
    +
    k =  s.replace('atal','Mr Atal ji')
    +print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hi Mr Atal ji was a great person as well as he really Mr Atal ji
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [64]:
    +
    +
    +
    s = "Hi python is an Awesome language and python is super easy to learn.\
    +python as some cool features."
    +print(s)
    +k = s.replace('python','PYTHON',2)
    +print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hi python is an Awesome language and python is super easy to learn.python as some cool features.
    +Hi PYTHON is an Awesome language and PYTHON is super easy to learn.python as some cool features.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [66]:
    +
    +
    +
    name = input("Enter name of the person")
    +spec  = input("Enter Qulification ")
    +s = "%s is a good person. %s has a good knowledge of %s."%(name,name,spec)
    +print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter name of the personatal
    +Enter Qulification politics
    +atal is a good person. atal has a good knowledge of politics.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [69]:
    +
    +
    +
    name = input("Enter name of the person")
    +spec  = input("Enter Qulification ")
    +s = "{0} is a good person. {0} has a good knowledge of {1}.".format(name,spec)
    +print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter name of the personsachin
    +Enter Qulification cricket
    +sachin is a good person. sachin has a good knowledge of cricket.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [70]:
    +
    +
    +
    name = input("Enter name of the person")
    +spec  = input("Enter Qulification ")
    +s = "{name} is a good person. {name} has a good knowledge of {spec}.".format(name=name,spec=spec)
    +print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter name of the personDravid
    +Enter Qulification Cricket
    +Dravid is a good person. Dravid has a good knowledge of Cricket.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [71]:
    +
    +
    +
    name = input("Enter name of the person")
    +spec  = input("Enter Qulification ")
    +s = name+" is a good person." + name + " has a good knowledge of "+ spec + "."
    +print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter name of the personhello
    +Enter Qulification bye
    +hello is a good person.hello has a good knowledge of bye.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [78]:
    +
    +
    +
    s = "Hello hi by how are you by what's up."
    +print(s[s.index('what\'s'):])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    what's up.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [79]:
    +
    +
    +
    print(dir(s))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [87]:
    +
    +
    +
    s = input("Type something : ")
    +print(s)
    +print("Does String have Alphabates : ",s.isalpha())
    +print("Does String Alpha Numeric : ",s.isalnum())
    +print("Does String Has only Numbers : ",s.isnumeric())
    +print("Does String Has only spaces : ",s.isspace())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Type something : 1245
    +1245
    +Does String have Alphabates :  False
    +Does String Alpha Numeric :  True
    +Does String Has only Numbers :  True
    +Does String Has only spaces :  False
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [82]:
    +
    +
    +
    s = "¼"
    +s = "12.4"
    +print(s.isdigit())
    +print(s.isdecimal())
    +print(s.isnumeric())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    False
    +False
    +False
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [94]:
    +
    +
    +
    print("Can you Declare it in Python ? ",input("Enter var you want to declear : ").isidentifier(),flush=True)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter var you want to declearhello
    +Can you Declare it in Python ?  True
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [97]:
    +
    +
    +
    len = 'hi world'
    +print("len = ",len)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    len =  hi world
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [98]:
    +
    +
    +
    len("Hello")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +TypeError                                 Traceback (most recent call last)
    +<ipython-input-98-4e51e1733236> in <module>()
    +----> 1 len("Hello")
    +
    +TypeError: 'str' object is not callable
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [99]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +  File "<ipython-input-99-ea18e9793355>", line 1
    +    if = 'hello'
    +       ^
    +SyntaxError: invalid syntax
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [100]:
    +
    +
    +
    s = "hello World How Are You ? "
    +print(s)
    +print(s.capitalize())
    +print(s.title())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    hello World How Are You ? 
    +Hello world how are you ? 
    +Hello World How Are You ? 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [103]:
    +
    +
    +
    x = input("Enter something   : ")
    +print("your string is = {} is that right.".format(x))
    +print()
    +print("your string is = {!r} is that right.".format(x))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter something   : hello\nI am genious\nye karke dikhao ? 
    +your string is = hello\nI am genious\nye karke dikhao ?  is that right.
    +
    +your string is = 'hello\\nI am genious\\nye karke dikhao ? ' is that right.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [107]:
    +
    +
    +
    s = input("Enter a string : ")
    +print("{!r}".format(s))
    +print("{!r}".format(s.rstrip())) # right side white spaces will be removed
    +print("{!r}".format(s.lstrip())) #left side white spaces will be removed
    +print("{!r}".format(s.strip())) # all leading (left) and trailing (right) white spaces will removed
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter a string :        hello python how are you        
    +'       hello python how are you        '
    +'       hello python how are you'
    +'hello python how are you        '
    +'hello python how are you'
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [115]:
    +
    +
    +
    #bar --> foo | foo --> bar --> | foo|bar
    +
    +x = input("Enter foo or bar : ").strip().lower()
    +if x == 'foo' : #indentation operator --> space
    +    print('bar')
    +elif x == 'bar' : 
    +    print('foo')
    +else : 
    +    print("foo|bar")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter foo or bar :      Bar   
    +foo
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [1]:
    +
    +
    +
    s  = "Hello World"
    +k = s[-4:-1]
    +print(s)
    +print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World
    +orl
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    s[-5:-10:-1]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[2]:
    + + + + +
    +
    'W oll'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    s[-5:]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[3]:
    + + + + +
    +
    'World'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    s = "oh my god."
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    s.endswith('god')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[7]:
    + + + + +
    +
    False
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    s = "Hey hello how are you\noh my dog"
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hey hello how are you
    +oh my dog
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    s.endswith('dog')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[10]:
    + + + + +
    +
    True
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +
    +

    List

    +

    List are just collection of items. items can be homogenous or hetrogenous.

    If all items in a list are homogenous than it known as array such as int array, char array so on.

    So all arrays are list but all lists are not array.

    +
    +
    +
    +
    +
    +
    In [11]:
    +
    +
    +
    mylist = [ 21,25,27,19,88,45,67] #int array
    +mylist1 = [ 'x','y','z','p','q','r','s'] #char array  
    +#both are homogenous list
    +print("Type of mylist = ",type(mylist))
    +print("Value of mylist = ",mylist)
    +print("Type of mylist1 = ",type(mylist))
    +print("Value of mylist1 = ",mylist1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Type of mylist =  <class 'list'>
    +Value of mylist =  [21, 25, 27, 19, 88, 45, 67]
    +Type of mylist1 =  <class 'list'>
    +Value of mylist1 =  ['x', 'y', 'z', 'p', 'q', 'r', 's']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    all_sum = 'sachin' #camlecase
    +def all_Sum(x):
    +    print("Sum is ",sum(x))
    +class All_Sum:
    +    def show(self):
    +        print("Hello World")
    +print(all_sum)
    +all_Sum([1,2,3,4,5,6,7,8,9,10])
    +All_Sum().show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    sachin
    +Sum is  55
    +Hello World
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    details = [
    +    [ 'name','age','occupation','country','language'],
    +    [ 'sachin',38,'crickter','india','engilsh'],
    +    ['john',25,'engineer','USA','english'],
    +]
    +print(*details,sep='\n')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['name', 'age', 'occupation', 'country', 'language']
    +['sachin', 38, 'crickter', 'india', 'engilsh']
    +['john', 25, 'engineer', 'USA', 'english']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    matrix = [
    +    [ 1,2,3],
    +    [4,5,6],
    +    [7,8,9]
    +]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [21]:
    +
    +
    +
    from pprint import pprint
    +print(matrix)
    +pprint(matrix)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
    +[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [22]:
    +
    +
    +
    mylist = [ 1,2,'hello','hi',67,'python']
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    one = mylist[2] ; two = mylist[-4]
    +print(one) ; print(two)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    hello
    +hello
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [24]:
    +
    +
    +
    mylist = [ 1,2,'hello','hi',67,'python']
    +print(mylist[-1]+mylist[-4]+mylist[-3],mylist[0]+mylist[1]+mylist[4])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    pythonhellohi 70
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    from random import randint
    +mylist = [ randint(1,100) for var in range(20)]
    +mylist
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[25]:
    + + + + +
    +
    [96, 14, 35, 95, 97, 32, 74, 61, 22, 86, 48, 56, 56, 81, 28, 66, 91, 44, 6, 9]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [26]:
    +
    +
    +
    newlist = mylist[3:17:3]
    +print(newlist)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [95, 74, 86, 56, 66]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    l = [ var for var in range(1,101) ]
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 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, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [30]:
    +
    +
    +
    x = l[1::2]
    +y = l[0::2]
    +z = l[4::5]
    +new = l[4::5][6::7]
    +p = l[2::3] + l[6::7]
    +new1 = sorted(l[2::3]+l[6::7])
    +q = l[12::13]
    +print(x,y,z,new,p,new1,q,sep='\n\n')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100]
    +
    +[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99]
    +
    +[5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]
    +
    +[35, 70]
    +
    +[3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98]
    +
    +[3, 6, 7, 9, 12, 14, 15, 18, 21, 21, 24, 27, 28, 30, 33, 35, 36, 39, 42, 42, 45, 48, 49, 51, 54, 56, 57, 60, 63, 63, 66, 69, 70, 72, 75, 77, 78, 81, 84, 84, 87, 90, 91, 93, 96, 98, 99]
    +
    +[13, 26, 39, 52, 65, 78, 91]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    mylist = [ 'hello',1,2,3,4,'bye bye']
    +print(mylist)
    +mylist[2] = 'sachin' #--> [ 'hello',1,'sachin',3,4,'bye bye']
    +items = len(mylist)
    +eve = mylist[::2]
    +print(mylist)
    +print(eve)
    +print("total items = ",items)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['hello', 1, 2, 3, 4, 'bye bye']
    +['hello', 1, 'sachin', 3, 4, 'bye bye']
    +['hello', 'sachin', 4]
    +total items =  6
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    print(dir(mylist))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    help(mylist.append)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Help on built-in function append:
    +
    +append(...) method of builtins.list instance
    +    L.append(object) -> None -- append object to end
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    mylist
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[7]:
    + + + + +
    +
    ['hello', 1, 'sachin', 3, 4, 'bye bye']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    mylist.append('grras')
    +mylist
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[8]:
    + + + + +
    +
    ['hello', 1, 'sachin', 3, 4, 'bye bye', 'grras']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Built-in Functions of List

    +
      +

      To add items to list

      +
    1. append --> mylist.append(item) --> add item at the end
    2. +
    3. insert --> mylist.insert(index,item) --> add item to position index
    4. +
    5. extend --> mylist.extend(sequence) --> will add each item of sequence at end of list
    6. +

      To remove item from list

      +
    7. pop --> mylist.pop() --> it will delete item from last
    8. +
    9. pop --> mylist.pop(index) --> it will delete item from index
    10. +
    11. remove --> mylist.remove(item) --> it will delete first occurence of item from list
    12. +

      Some common function of list

      +
    13. copy --> mylist.copy() --> return a copy of list
    14. +
    15. reverse --> mylist.reverse() --> reverse the list
    16. +
    17. sort --> mylist.sort() --> will sort homogenous list into accending order
    18. +
    19. sort --> mylist.sort(reverse=True) --> will sort homogenous list into descending order
    20. +
    21. count --> mylist.count(item) --> will return repeatation of item in list
    22. +
    23. index --> mylist.index(item) --> will return index of item from list
    24. +
    25. clear --> mylist.clear() --> will delete all items from list and make it empty list
    26. +
    +
    +
    +
    +
    +
    +
    In [9]:
    +
    +
    +
    x = [ 1,2,'hi','hello',3,4]
    +x.append('india')
    +x.append(4)
    +print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 'hi', 'hello', 3, 4, 'india', 4]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    hello_index = x.index('hello')
    +print(hello_index)
    +x.insert(hello_index,'grras')
    +print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    3
    +[1, 2, 'hi', 'grras', 'hello', 3, 4, 'india', 4]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    seq = [ 1,2,3,4,5,6,7,'hello','hi','bye']
    +x.extend(seq)
    +print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 'hi', 'grras', 'hello', 3, 4, 'india', 4, 1, 2, 3, 4, 5, 6, 7, 'hello', 'hi', 'bye']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    x = [ 1,'hi','hello',3,4,5]
    +x.append(5)
    +x[2] = 'sachin'
    +x.insert(2,'hi')
    +x.append('wow')
    +x.insert(5,786)
    +x.append(['hey','hi','hello'])
    +x.extend('python')
    +print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 'hi', 'hi', 'sachin', 3, 786, 4, 5, 5, 'wow', ['hey', 'hi', 'hello'], 'p', 'y', 't', 'h', 'o', 'n']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    x = [ 1,'hi','hello',3,4,5]
    +x.pop()
    +x.pop()
    +x.pop(1)
    +print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 'hello', 3]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    x.remove('hello')
    +print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 3]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    oldlist = [ 1,23,35,232,13,45,3224,4,54,23,56,465,542,12,67,4542]
    +newlist = oldlist.copy()
    +print(oldlist)
    +print(newlist)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 23, 35, 232, 13, 45, 3224, 4, 54, 23, 56, 465, 542, 12, 67, 4542]
    +[1, 23, 35, 232, 13, 45, 3224, 4, 54, 23, 56, 465, 542, 12, 67, 4542]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    newlist.sort()
    +oldlist.sort(reverse=True)
    +
    +print(newlist)
    +print(oldlist)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 4, 12, 13, 23, 23, 35, 45, 54, 56, 67, 232, 465, 542, 3224, 4542]
    +[4542, 3224, 542, 465, 232, 67, 56, 54, 45, 35, 23, 23, 13, 12, 4, 1]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    r_23 = newlist.count(100)
    +print(r_23)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    0
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    newlist.clear()
    +print(newlist)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    []
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    oldlist.append('sachin')
    +oldlist.reverse()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    print(oldlist)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['sachin', 'sachin', 4542, 3224, 542, 465, 232, 67, 56, 54, 45, 35, 23, 23, 13, 12, 4, 1]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    #sort
    +from random import randint
    +mylist = [randint(1,100) for _ in range(20) ]
    +mylist_copy = mylist.copy()
    +print(mylist)
    +print(mylist_copy)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 99, 2, 73, 87, 73, 38, 9, 11, 7, 20, 38, 77, 45, 79, 37, 2, 75, 61, 86]
    +[1, 99, 2, 73, 87, 73, 38, 9, 11, 7, 20, 38, 77, 45, 79, 37, 2, 75, 61, 86]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [21]:
    +
    +
    +
    sum(mylist)/len(mylist)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[21]:
    + + + + +
    +
    46.0
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    height = [ 5.11,6, 5.10,5.7,6,5.8,5.9,5.6,5.7,5.10 ]
    +avg_height = sum(height)/len(height)
    +avg_height = round(avg_height,2)
    +print(avg_height)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    5.6
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [22]:
    +
    +
    +
    mylist.sort()
    +mylist
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[22]:
    + + + + +
    +
    [1, 2, 2, 7, 9, 11, 20, 37, 38, 38, 45, 61, 73, 73, 75, 77, 79, 86, 87, 99]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [24]:
    +
    +
    +
    mylist_copy.sort(reverse=True)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    mylist_copy
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[25]:
    + + + + +
    +
    [99, 87, 86, 79, 77, 75, 73, 73, 61, 45, 38, 38, 37, 20, 11, 9, 7, 2, 2, 1]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [30]:
    +
    +
    +
    import keyword
    +print(dir(keyword))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'iskeyword', 'kwlist', 'main']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [32]:
    +
    +
    +
    kwlist = keyword.kwlist
    +print(kwlist)
    +len(kwlist)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
    +
    +
    +
    + +
    + +
    Out[32]:
    + + + + +
    +
    33
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [35]:
    +
    +
    +
    from random import choice
    +names = [ 'sachin','ajay','vipul','suraj','divyanshu','praval','rishav','deepesh','yash','manish']
    +newlist = [ choice(names) for _ in range(5) ]
    +newlist
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[35]:
    + + + + +
    +
    ['praval', 'rishav', 'deepesh', 'sachin', 'suraj']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [38]:
    +
    +
    +
    names = [ input("Name = [{}]".format(counter)) for counter in range(1,11) ]
    +names
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Name = [1]sachin
    +Name = [2]ajay
    +Name = [3]vipual
    +Name = [4]suraj
    +Name = [5]divyanshu
    +Name = [6]praval
    +Name = [7]rishav
    +Name = [8]deepesh
    +Name = [9]yash
    +Name = [10]manish
    +
    +
    +
    + +
    + +
    Out[38]:
    + + + + +
    +
    ['sachin',
    + 'ajay',
    + 'vipual',
    + 'suraj',
    + 'divyanshu',
    + 'praval',
    + 'rishav',
    + 'deepesh',
    + 'yash',
    + 'manish']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [48]:
    +
    +
    +
    names.sort(reverse=True)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [49]:
    +
    +
    +
    print(*names,sep='\t')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    yash	vipual	suraj	sachin	rishav	praval	manish	divyanshu	deepesh	ajay
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [50]:
    +
    +
    +
    s = [ 'a','A','b','B','12','34']
    +s.sort()
    +print(s)
    +s.sort(reverse=True)
    +print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['12', '34', 'A', 'B', 'a', 'b']
    +['b', 'a', 'B', 'A', '34', '12']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [56]:
    +
    +
    +
    l = [ chr(var) for var in range(1,150)]
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\t', '\n', '\x0b', '\x0c', '\r', '\x0e', '\x0f', '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', ' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', '\x7f', '\x80', '\x81', '\x82', '\x83', '\x84', '\x85', '\x86', '\x87', '\x88', '\x89', '\x8a', '\x8b', '\x8c', '\x8d', '\x8e', '\x8f', '\x90', '\x91', '\x92', '\x93', '\x94', '\x95']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [55]:
    +
    +
    +
    chr(97)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[55]:
    + + + + +
    +
    'a'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Dictionary

    +
    +
    +
    +
    +
    +
    In [1]:
    +
    +
    +
    info_python = { 'name':'Python Programming Language', 'current_version':3.7,
    +               'awesome':True,'creator':'Guido Van Rossum', }
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    print(info_python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'name': 'Python Programming Language', 'current_version': 3.7, 'awesome': True, 'creator': 'Guido Van Rossum'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    info_python['name']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[5]:
    + + + + +
    +
    'Python Programming Language'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    frame_work = {
    +    'web': [ 'Django','Flask','Web2py','Pyramid'],
    +    'gui':[ 'tkinter','kivy','wxpython','PyQt'],
    +    'automation' : ['ansible','openstack','salt'],
    +    'data-science' : ['pandas','stats','io','numpy','matplotlib'],
    +    'machine-learning' : ['sckit-learn','scipy','seaborn'],
    +}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    print(info_python)
    +print(frame_work)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'name': 'Python Programming Language', 'current_version': 3.7, 'awesome': True, 'creator': 'Guido Van Rossum'}
    +{'web': ['Django', 'Flask', 'Web2py', 'Pyramid'], 'gui': ['tkinter', 'kivy', 'wxpython', 'PyQt'], 'automation': ['ansible', 'openstack', 'salt'], 'data-science': ['pandas', 'stats', 'io', 'numpy', 'matplotlib'], 'machine-learning': ['sckit-learn', 'scipy', 'seaborn']}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    frame_work['data-science']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[9]:
    + + + + +
    +
    ['pandas', 'stats', 'io', 'numpy', 'matplotlib']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    info_python
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[10]:
    + + + + +
    +
    {'name': 'Python Programming Language',
    + 'current_version': 3.7,
    + 'awesome': True,
    + 'creator': 'Guido Van Rossum'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    info_python['frame_work'] = frame_work
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    print(info_python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'name': 'Python Programming Language', 'current_version': 3.7, 'awesome': True, 'creator': 'Guido Van Rossum', 'frame_work': {'web': ['Django', 'Flask', 'Web2py', 'Pyramid'], 'gui': ['tkinter', 'kivy', 'wxpython', 'PyQt'], 'automation': ['ansible', 'openstack', 'salt'], 'data-science': ['pandas', 'stats', 'io', 'numpy', 'matplotlib'], 'machine-learning': ['sckit-learn', 'scipy', 'seaborn']}}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    from pprint import pprint
    +pprint(info_python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'awesome': True,
    + 'creator': 'Guido Van Rossum',
    + 'current_version': 3.7,
    + 'frame_work': {'automation': ['ansible', 'openstack', 'salt'],
    +                'data-science': ['pandas',
    +                                 'stats',
    +                                 'io',
    +                                 'numpy',
    +                                 'matplotlib'],
    +                'gui': ['tkinter', 'kivy', 'wxpython', 'PyQt'],
    +                'machine-learning': ['sckit-learn', 'scipy', 'seaborn'],
    +                'web': ['Django', 'Flask', 'Web2py', 'Pyramid']},
    + 'name': 'Python Programming Language'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    info_python['frame_work']['web'][1]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[19]:
    + + + + +
    +
    'Flask'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    import matplotlib.pyplot as plt
    +from random import randint
    +x = [ randint(1,100) for var in range(100) ]
    +y = [ randint(50,100) for var in range(100)]
    +plt.plot(x,sorted(y)
    +plt.show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +  File "<ipython-input-25-9cff62cead29>", line 6
    +    plt.show()
    +      ^
    +SyntaxError: invalid syntax
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [22]:
    +
    +
    +
    print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [12, 41, 90, 86, 89, 60, 68, 21, 21, 35, 10, 46, 19, 34, 97, 44, 9, 78, 7, 17, 61, 32, 17, 7, 12, 43, 32, 31, 64, 61, 60, 94, 13, 99, 95, 64, 31, 94, 100, 20, 60, 70, 17, 35, 93, 55, 83, 79, 46, 21, 100, 85, 97, 39, 40, 48, 1, 56, 41, 71, 56, 42, 22, 100, 89, 15, 36, 17, 2, 62, 62, 96, 1, 83, 15, 59, 88, 12, 77, 75, 39, 82, 37, 35, 82, 100, 78, 74, 14, 92, 89, 7, 19, 22, 93, 72, 60, 29, 67, 48]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    print(y)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [71, 54, 78, 93, 66, 75, 98, 71, 60, 53, 66, 58, 100, 88, 71, 58, 71, 54, 63, 68, 70, 93, 76, 72, 53, 96, 84, 53, 73, 79, 90, 91, 88, 77, 84, 84, 96, 63, 100, 84, 93, 51, 59, 90, 66, 78, 75, 76, 85, 61, 98, 81, 77, 56, 63, 95, 87, 64, 94, 56, 95, 66, 73, 100, 56, 53, 98, 95, 84, 79, 95, 58, 69, 86, 60, 79, 63, 87, 72, 81, 76, 73, 80, 94, 74, 65, 79, 97, 88, 88, 67, 91, 52, 71, 58, 90, 97, 84, 73, 92]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    info = { 
    +    'name' : 'sachin',
    +    'country': 'india',
    +    'email' : "sachin@grras.com",
    +    'language' : 'hindi',
    +    'graduation' : "b.tech"
    +    }
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    print(dir(info))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    from pprint import pprint
    +info_copy = info.copy()
    +pprint(info)
    +pprint(info_copy)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'country': 'india',
    + 'email': 'sachin@grras.com',
    + 'graduation': 'b.tech',
    + 'language': 'hindi',
    + 'name': 'sachin'}
    +{'country': 'india',
    + 'email': 'sachin@grras.com',
    + 'graduation': 'b.tech',
    + 'language': 'hindi',
    + 'name': 'sachin'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    info.clear()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    pprint(info)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    pprint(info_copy)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'country': 'india',
    + 'email': 'sachin@grras.com',
    + 'graduation': 'b.tech',
    + 'language': 'hindi',
    + 'name': 'sachin'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    print(help(info_copy.fromkeys))
    +
    +info = info_copy.fromkeys(info_copy,'default')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Help on built-in function fromkeys:
    +
    +fromkeys(iterable, value=None, /) method of builtins.type instance
    +    Returns a new dict with keys from iterable and values equal to value.
    +
    +None
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    pprint(info)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'country': 'default',
    + 'email': 'default',
    + 'graduation': 'default',
    + 'language': 'default',
    + 'name': 'default'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    info_copy.get('name',False)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[12]:
    + + + + +
    +
    'sachin'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    info_copy.items()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[13]:
    + + + + +
    +
    dict_items([('name', 'sachin'), ('country', 'india'), ('email', 'sachin@grras.com'), ('language', 'hindi'), ('graduation', 'b.tech')])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    info_copy.keys()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[14]:
    + + + + +
    +
    dict_keys(['name', 'country', 'email', 'language', 'graduation'])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    info_copy.values()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[15]:
    + + + + +
    +
    dict_values(['sachin', 'india', 'sachin@grras.com', 'hindi', 'b.tech'])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    info_copy
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[16]:
    + + + + +
    +
    {'name': 'sachin',
    + 'country': 'india',
    + 'email': 'sachin@grras.com',
    + 'language': 'hindi',
    + 'graduation': 'b.tech'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    info_copy.pop('language')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[17]:
    + + + + +
    +
    'hindi'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    info_copy
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[18]:
    + + + + +
    +
    {'name': 'sachin',
    + 'country': 'india',
    + 'email': 'sachin@grras.com',
    + 'graduation': 'b.tech'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    print("This ",info_copy.popitem(),"Item is deleted")
    +info_copy
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    This  ('graduation', 'b.tech') Item is deleted
    +
    +
    +
    + +
    + +
    Out[19]:
    + + + + +
    +
    {'name': 'sachin', 'country': 'india', 'email': 'sachin@grras.com'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    info_copy
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[20]:
    + + + + +
    +
    {'name': 'sachin', 'country': 'india', 'email': 'sachin@grras.com'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [21]:
    +
    +
    +
    info_copy.setdefault('name','hello world')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[21]:
    + + + + +
    +
    'sachin'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [22]:
    +
    +
    +
    info_copy
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[22]:
    + + + + +
    +
    {'name': 'sachin', 'country': 'india', 'email': 'sachin@grras.com'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    info_copy.update([ ('name','sachin yadav'),('langauage','english'),('email','sachin@gmail.com')])
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [24]:
    +
    +
    +
    info_copy
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[24]:
    + + + + +
    +
    {'name': 'sachin yadav',
    + 'country': 'india',
    + 'email': 'sachin@gmail.com',
    + 'langauage': 'english'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    data =  [ ('height',5.11), ('blood_group','B+ive') ]
    +info_copy.update(data)
    +info_copy
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[25]:
    + + + + +
    +
    {'name': 'sachin yadav',
    + 'country': 'india',
    + 'email': 'sachin@gmail.com',
    + 'langauage': 'english',
    + 'height': 5.11,
    + 'blood_group': 'B+ive'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Sets

    +
    +
    +
    +
    +
    +
    In [2]:
    +
    +
    +
    s1 = { 1,5,7,3,4}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    print(type(s1))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    <class 'set'>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    print(dir(s1))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__iand__', '__init__', '__init_subclass__', '__ior__', '__isub__', '__iter__', '__ixor__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'add', 'clear', 'copy', 'difference', 'difference_update', 'discard', 'intersection', 'intersection_update', 'isdisjoint', 'issubset', 'issuperset', 'pop', 'remove', 'symmetric_difference', 'symmetric_difference_update', 'union', 'update']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    print(s1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {1, 3, 4, 5, 7}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    s1 = { 1,5,7,3,4}
    +s2 ={ 8,9,15,1,3,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    print(s1)
    +print(s2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {1, 3, 4, 5, 7}
    +{1, 3, 4, 8, 9, 15}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    s1.intersection(s2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[9]:
    + + + + +
    +
    {1, 3, 4}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    s1.difference(s2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[10]:
    + + + + +
    +
    {5, 7}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    s2 = s1.union(s2)
    +s1.issubset(s2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[13]:
    + + + + +
    +
    True
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    from keyword import kwlist
    +print(kwlist)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    print("Hello World")
    +s = 'hi world'
    +pritn = print
    +pritn("Hello World",s)
    +print(sachin)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World
    +Hello World hi world
    +
    +
    +
    + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +NameError                                 Traceback (most recent call last)
    +<ipython-input-15-3c970f348d31> in <module>()
    +      3 pritn = print
    +      4 pritn("Hello World",s)
    +----> 5 print(sachin)
    +
    +NameError: name 'sachin' is not defined
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [33]:
    +
    +
    +
    #Data Structre
    +data = {
    +    'name' : [],
    +    'age' : [],
    +    'graduation' : [],
    +    'party' : [],
    +}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [34]:
    +
    +
    +
    #Data Entry
    +for var in range(10):
    +    data['name'].append(input("Enter your name : "))
    +    data['age'].append(int(input("Enter your age : ")))
    +    data['graduation'].append(input("Are you Graduate (yes or no) : "))
    +    data['party'].append(input("Will you vote for BJP in 2k19 (yes or no ) : "))
    +    print("\n\n")
    +    print(data)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter your name : a
    +Enter your age : 1
    +Are you Graduate (yes or no) : yes
    +Will you vote for BJP in 2k19 (yes or no ) : yes
    +
    +
    +
    +{'name': ['a'], 'age': [1], 'graduation': ['yes'], 'party': ['yes']}
    +Enter your name : b
    +Enter your age : 22
    +Are you Graduate (yes or no) : yes
    +Will you vote for BJP in 2k19 (yes or no ) : no
    +
    +
    +
    +{'name': ['a', 'b'], 'age': [1, 22], 'graduation': ['yes', 'yes'], 'party': ['yes', 'no']}
    +Enter your name : hello
    +Enter your age : 
    +
    +
    +
    + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +ValueError                                Traceback (most recent call last)
    +<ipython-input-34-40178a64511c> in <module>()
    +      2 for var in range(10):
    +      3     data['name'].append(input("Enter your name : "))
    +----> 4     data['age'].append(int(input("Enter your age : ")))
    +      5     data['graduation'].append(input("Are you Graduate (yes or no) : "))
    +      6     data['party'].append(input("Will you vote for BJP in 2k19 (yes or no ) : "))
    +
    +ValueError: invalid literal for int() with base 10: ''
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [31]:
    +
    +
    +
    data
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[31]:
    + + + + +
    +
    {'name': ['sachin', 'rahul', 'rajat', 'alskdjf'],
    + 'age': [22, 50, 29, 44],
    + 'graduation': ['yes', 'no', 'yes', 'es'],
    + 'party': ['es', 'no', 'yes', 'no']}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [37]:
    +
    +
    +
    bank = { 
    +    'user' : [],
    +    'balance' : [],
    +    'password' : [],
    +    'account_number' : [],
    +    }
    +acc = 10001
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [40]:
    +
    +
    +
    from getpass import getpass
    +user = input("Enter user name : ")
    +password = getpass("Enter your password : ")
    +balance = float(input("Enter your Balance : "))
    +acc_no = acc
    +acc = acc + 1
    +bank['user'].append(user)
    +bank['balance'].append(balance)
    +bank['password'].append(password)
    +bank['account_number'].append(acc_no)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter user name : grras
    +Enter your password : ········
    +Enter your Balance : 1982732918312987982139829832193929382932983
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [42]:
    +
    +
    +
    from pprint import pprint
    +pprint(bank)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'account_number': [10001, 10002, 10003],
    + 'balance': [14000.0, 83939.23, 1.982732918312988e+42],
    + 'password': ['redhat', 'myworld', 'grras'],
    + 'user': ['sachin', 'rajat', 'grras']}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [46]:
    +
    +
    +
    acc_no = int(input("Enter your account number : "))
    +index = bank['account_number'].index(acc_no)
    +print("Name = ",bank['user'][index])
    +print("Balance = ",bank['balance'][index])
    +print("Password = ",bank['password'][index])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter your account number : 10003
    +Name =  grras
    +Balance =  1.982732918312988e+42
    +Password =  grras
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [1]:
    +
    +
    +
    data = list(map(int,input("Five number : ").split(',')))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Five number : 1,2,3,4,5,6,7,8,9,10
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    data
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[2]:
    + + + + +
    +
    [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Type Conversion

    +
    +
    +
    +
    +
    +
    In [6]:
    +
    +
    +
    x = eval(input("X: "))
    +y = eval(input("Y: "))
    +result = x + y 
    +print("Result = ",result)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    X: 4.5+6j
    +Y: 55.5
    +Result =  (60+6j)
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    #int
    +x =int(input("X : "),base=16)
    +y = int(input("X : "),base=16)
    +x+y
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    X : abcd
    +X : ef
    +
    +
    +
    + +
    + +
    Out[15]:
    + + + + +
    +
    44220
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    print(int.__doc__) #doc-string
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    int(x=0) -> integer
    +int(x, base=10) -> integer
    +
    +Convert a number or string to an integer, or return 0 if no arguments
    +are given.  If x is a number, return x.__int__().  For floating point
    +numbers, this truncates towards zero.
    +
    +If x is not a number or if base is given, then x must be a string,
    +bytes, or bytearray instance representing an integer literal in the
    +given base.  The literal can be preceded by '+' or '-' and be surrounded
    +by whitespace.  The base defaults to 10.  Valid bases are 0 and 2-36.
    +Base 0 means to interpret the base from the string as an integer literal.
    +>>> int('0b100', base=0)
    +4
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    x = '10101'
    +print(int(x,base=2))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    21
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    x = '123765'
    +r = int(x,base=8)
    +print(r)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    42997
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    int('1001',base=2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[25]:
    + + + + +
    +
    9
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    hex(15)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[27]:
    + + + + +
    +
    '0xf'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [29]:
    +
    +
    +
    bin(163)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[29]:
    + + + + +
    +
    '0b10100011'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [30]:
    +
    +
    +
    oct(9)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[30]:
    + + + + +
    +
    '0o11'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [32]:
    +
    +
    +
    print(float(input("X  : ")))
    +input("X : ")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    X  : 4.5
    +4.5
    +X : 4.5
    +
    +
    +
    + +
    + +
    Out[32]:
    + + + + +
    +
    '4.5'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [35]:
    +
    +
    +
    float('101.45')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[35]:
    + + + + +
    +
    101.45
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [41]:
    +
    +
    +
    complex('10')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[41]:
    + + + + +
    +
    (10+0j)
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [44]:
    +
    +
    +
    #Create a Program to take input x as int, y as float and z as complex
    +#first print their types and values as x = 5 and x is interger
    +#at last print result as addition of x+y+z
    +x = int(input("X : "))
    +y = float(input("Y : "))
    +z = complex(input("Z : "))
    +print("X = {} and type of x = {}".format(x,type(x)))
    +print("Y = {} and type of y = {}".format(y,type(y)))
    +print("Z = {} and type of z = {}".format(z,type(z)))
    +print("Result {} + {} + {} = {} ".format(x,y,z,x+y+z))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    X : 1
    +Y : 2
    +Z : 3
    +X = 1 and type of x = <class 'int'>
    +Y = 2.0 and type of y = <class 'float'>
    +Z = (3+0j) and type of z = <class 'complex'>
    +Result 1 + 2.0 + (3+0j) = (6+0j) 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [60]:
    +
    +
    +
    #string
    +x = str(123)
    +y = str(4.5)
    +z = str(4+5j)
    +p = str([1,2,3,'hello','bye'])
    +q = str(('hello','i am tuple',[1,2,3]))
    +r = str({'key':'value','name':'python'})
    +ab = str({1,2,'i','am','set'})
    +s = "{!r}\n"*7
    +print(s.format(x,y,z,p,q,r,ab))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    '123'
    +'4.5'
    +'(4+5j)'
    +"[1, 2, 3, 'hello', 'bye']"
    +"('hello', 'i am tuple', [1, 2, 3])"
    +"{'key': 'value', 'name': 'python'}"
    +"{'set', 1, 'i', 2, 'am'}"
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [54]:
    +
    +
    +
    print("{!r}\n{!r}".format(x,y))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    '123'
    +'4.5'
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [63]:
    +
    +
    +
    k = list('python')
    +print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['p', 'y', 't', 'h', 'o', 'n']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [65]:
    +
    +
    +
    k = list(('hello','one',1,2,3))
    +k
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[65]:
    + + + + +
    +
    ['hello', 'one', 1, 2, 3]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [66]:
    +
    +
    +
    info = { 'name':'python','version':3.7,'father':'guido'}
    +k = list(info)
    +print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['name', 'version', 'father']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [68]:
    +
    +
    +
    k = list(info.items())
    +k
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[68]:
    + + + + +
    +
    [('name', 'python'), ('version', 3.7), ('father', 'guido')]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [70]:
    +
    +
    +
    k = list(info.values())
    +k
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[70]:
    + + + + +
    +
    ['python', 3.7, 'guido']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [71]:
    +
    +
    +
    keys = list(info.keys())
    +values = list(info.values())
    +print(keys)
    +print(values)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['name', 'version', 'father']
    +['python', 3.7, 'guido']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [73]:
    +
    +
    +
    key_value_list = list(zip(keys,values))
    +key_value_list
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[73]:
    + + + + +
    +
    [('name', 'python'), ('version', 3.7), ('father', 'guido')]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [74]:
    +
    +
    +
    #tuple()--> same as list
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [80]:
    +
    +
    +
    info.items()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[80]:
    + + + + +
    +
    dict_items([('name', 'python'), ('version', 3.7), ('father', 'guido')])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [82]:
    +
    +
    +
    d = dict(['1a','2b','3c','4d'])
    +print(d)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'1': 'a', '2': 'b', '3': 'c', '4': 'd'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [85]:
    +
    +
    +
    x = input("Enter key ")
    +print(d[x])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter key 2
    +b
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [86]:
    +
    +
    +
    d = dict([ ('one','ek'),('two','dau'),('three','teen'),('four','chaar')])
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [87]:
    +
    +
    +
    d
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[87]:
    + + + + +
    +
    {'one': 'ek', 'two': 'dau', 'three': 'teen', 'four': 'chaar'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [88]:
    +
    +
    +
    keys = [ 1,2,3,4,5]
    +values =  [ ['one','ek'], ['two','dau'], ['three','teen'], ['four','chaar'], ['five','paanch'] ]
    +number = dict(zip(keys,values))
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [90]:
    +
    +
    +
    number
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[90]:
    + + + + +
    +
    {1: ['one', 'ek'],
    + 2: ['two', 'dau'],
    + 3: ['three', 'teen'],
    + 4: ['four', 'chaar'],
    + 5: ['five', 'paanch']}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [103]:
    +
    +
    +
    s = "Hello,!!,hi,how,are,you,?"
    +print(s)
    +k = s.split(',')
    +print(k)
    +s = ' '.join(k)
    +print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello,!!,hi,how,are,you,?
    +['Hello', '!!', 'hi', 'how', 'are', 'you', '?']
    +Hello !! hi how are you ?
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [102]:
    +
    +
    +
    n = ','.join(k)
    +print(n)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello,!!,hi,how,are,you,?
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [109]:
    +
    +
    +
     d = dict(zip(input("Enter keys by space seprated : ").split(),input("Enter values by space sepated : ").split()))
    + print(d)   
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter keys by space seprated : 1 2 3
    +Enter values by space sepated : one two
    +{'1': 'one', '2': 'two'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [111]:
    +
    +
    +
    list(zip([1,2,3],['one','two']))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[111]:
    + + + + +
    +
    [(1, 'one'), (2, 'two')]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [106]:
    +
    +
    +
    values
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[106]:
    + + + + +
    +
    ['python', '2018', 'programming_language', 'byeee']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [116]:
    +
    +
    +
    s = set(info.items())
    +s
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[116]:
    + + + + +
    +
    {('father', 'guido'), ('name', 'python'), ('version', 3.7)}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [117]:
    +
    +
    +
    s = { [1,2], 'hello', [1,3]}
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +TypeError                                 Traceback (most recent call last)
    +<ipython-input-117-641c92017be6> in <module>()
    +----> 1 s = { [1,2], 'hello', [1,3]}
    +
    +TypeError: unhashable type: 'list'
    +
    +
    + +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/Basic_Data_Types.html b/python_ipynb/Basic_Data_Types.html new file mode 100644 index 0000000..f1f2581 --- /dev/null +++ b/python_ipynb/Basic_Data_Types.html @@ -0,0 +1,20418 @@ + + + + +Basic_Data_Types + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +

    Data Types in Python

    +
    +
    +
    +
    +
    +
    +

    Data Types are just set of rules that are used classify data

    +
      +
    1. Numbers
    2. +
    3. String
    4. +
    5. List
    6. +
    7. Tuple
    8. +
    9. Dictionary
    10. +
    11. Sets
    12. +
    +
    +
    +
    +
    +
    +
    In [1]:
    +
    +
    +
    #int,float and comples these are the numbers
    +x = 5
    +y = 6
    +print(type(x))
    +print(type(y))
    +print(x+y)
    +print(x-y)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    <class 'int'>
    +<class 'int'>
    +11
    +-1
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    x = 6.5
    +print(type(x))
    +print(x*y)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    <class 'float'>
    +39.0
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    k = 6.6+3.5j
    +print(type(k))
    +k
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    <class 'complex'>
    +
    +
    +
    + +
    + +
    Out[3]:
    + + + + +
    +
    (6.6+3.5j)
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    n = 1j
    +print(n*n)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    (-1+0j)
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    s = "Hello world"
    +k = 'hi how are you'
    +x = 'hi \'hi'
    +y = "he said, 'she is beautiful'"
    +z = """
    +hi hello,
    +        jaipur,11-jul-2018,
    +                            we are learning python.
    +python is a good language.
    +"""
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    s
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[6]:
    + + + + +
    +
    'Hello world'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello world
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    hi how are you
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    hi 'hi
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    print(y)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    he said, 'she is beautiful'
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    print(z)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +hi hello,
    +        jaipur,11-jul-2018,
    +                            we are learning python.
    +python is a good language.
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    print(dir(x))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [1]:
    +
    +
    +
    s = "Hello World"
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    len(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[2]:
    + + + + +
    +
    11
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    s[3]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[3]:
    + + + + +
    +
    'l'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    s[-3]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[4]:
    + + + + +
    +
    'r'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    #slicing
    +# a[start:end:jump]
    +s = "Hello World"
    +newstring = s[0:5]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    print(s)
    +print(newstring)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World
    +Hello
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    s = "Hello World"
    +print(s[-5:])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    World
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    s[:]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[13]:
    + + + + +
    +
    'Hello World'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    s[:5]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[14]:
    + + + + +
    +
    'Hello'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    s[::2]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[15]:
    + + + + +
    +
    'HloWrd'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    s[8:1:-1]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[16]:
    + + + + +
    +
    'roW oll'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    s[-3:-10:-1]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[17]:
    + + + + +
    +
    'roW oll'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    s[::-1]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[18]:
    + + + + +
    +
    'dlroW olleH'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    s = "AakjdflkjsdlfjlkjflsjlkjflsajfldsjfljsalkfslaflkdjljaslljZ"
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [21]:
    +
    +
    +
    s[:-3]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[21]:
    + + + + +
    +
    'Aakjdflkjsdlfjlkjflsjlkjflsajfldsjfljsalkfslaflkdjljasl'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [22]:
    +
    +
    +
    s = "Hello World"
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [24]:
    +
    +
    +
    print(dir(s))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [26]:
    +
    +
    +
    help(s.swapcase)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Help on built-in function swapcase:
    +
    +swapcase(...) method of builtins.str instance
    +    S.swapcase() -> str
    +    
    +    Return a copy of S with uppercase characters converted to lowercase
    +    and vice versa.
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    n = s.swapcase()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [28]:
    +
    +
    +
    s
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[28]:
    + + + + +
    +
    'Hello World'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [29]:
    +
    +
    +
    n
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[29]:
    + + + + +
    +
    'hELLO wORLD'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [30]:
    +
    +
    +
    s.lower()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[30]:
    + + + + +
    +
    'hello world'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [31]:
    +
    +
    +
    s.upper()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[31]:
    + + + + +
    +
    'HELLO WORLD'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [37]:
    +
    +
    +
    s = "      Hello World       "
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [38]:
    +
    +
    +
    s.lstrip()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[38]:
    + + + + +
    +
    'Hello World       '
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [39]:
    +
    +
    +
    s.rstrip()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[39]:
    + + + + +
    +
    '      Hello World'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [40]:
    +
    +
    +
    s.strip()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[40]:
    + + + + +
    +
    'Hello World'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [46]:
    +
    +
    +
    name = input()
    +print(type(name))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
         Sachin YADAV     
    +<class 'str'>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [47]:
    +
    +
    +
    name
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[47]:
    + + + + +
    +
    '     Sachin YADAV     '
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [50]:
    +
    +
    +
    n = name.strip()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [52]:
    +
    +
    +
    n.lower()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[52]:
    + + + + +
    +
    'sachin yadav'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [53]:
    +
    +
    +
    name = input("Enter your name : ").strip().lower()
    +name
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter your name :       Hello WoRLD    
    +
    +
    +
    + +
    + +
    Out[53]:
    + + + + +
    +
    'hello world'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [56]:
    +
    +
    +
    s = "Hello World Welcome to python."
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [57]:
    +
    +
    +
    s.split(" ")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[57]:
    + + + + +
    +
    ['Hello', 'World', 'Welcome', 'to', 'python.']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [59]:
    +
    +
    +
    s.partition("Welcome")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[59]:
    + + + + +
    +
    ('Hello World ', 'Welcome', ' to python.')
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [60]:
    +
    +
    +
    s = [ "Hello","World","Welcome","to","python"]
    +s
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[60]:
    + + + + +
    +
    ['Hello', 'World', 'Welcome', 'to', 'python']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [61]:
    +
    +
    +
    s = [ 
    +        [
    +            [ 1,2,3],
    +            [4,5,6],
    +        ],
    +        
    +        [
    +            [7,8,9],
    +            [10,11,12]
    +        ]
    +    ]
    +s = [   [ [1,2,3], [4,5,6] ],   [ [7,8,9],[10,11,12] ]  ]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [64]:
    +
    +
    +
    s[0][1][1]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[64]:
    + + + + +
    +
    5
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [65]:
    +
    +
    +
    s[1][0][2]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[65]:
    + + + + +
    +
    9
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [66]:
    +
    +
    +
    s = [ 'hey','bye','hello','he','how','abc','are','k','you']
    +k = s[0::2]
    +k
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[66]:
    + + + + +
    +
    ['hey', 'hello', 'how', 'are', 'you']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [67]:
    +
    +
    +
    r = '-'.join(k)
    +r
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[67]:
    + + + + +
    +
    'hey-hello-how-are-you'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [68]:
    +
    +
    +
    s = "ram,radha,mohan,meera,krishna"
    +l = s.split(',')
    +l
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[68]:
    + + + + +
    +
    ['ram', 'radha', 'mohan', 'meera', 'krishna']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [70]:
    +
    +
    +
    n = l[::2]
    +n
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[70]:
    + + + + +
    +
    ['ram', 'mohan', 'krishna']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [71]:
    +
    +
    +
    s = ','.join(n)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [72]:
    +
    +
    +
    s
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[72]:
    + + + + +
    +
    'ram,mohan,krishna'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [73]:
    +
    +
    +
    s = "ram,radha,mohan,meera,krishna"
    +r = ','.join(s.split(',')[::2])
    +r
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[73]:
    + + + + +
    +
    'ram,mohan,krishna'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [74]:
    +
    +
    +
    l = [ 1,2,'hi',3,4,5,'hello']
    +print(dir(l))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [75]:
    +
    +
    +
    l = [ 1,2,3]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [79]:
    +
    +
    +
    l.append(4)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [80]:
    +
    +
    +
    l
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[80]:
    + + + + +
    +
    [1, 2, 3, 4, 4]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [81]:
    +
    +
    +
    l.insert(2,'hi')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [82]:
    +
    +
    +
    l
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[82]:
    + + + + +
    +
    [1, 2, 'hi', 3, 4, 4]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [83]:
    +
    +
    +
    l.extend(['hey',6,7,8])
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [84]:
    +
    +
    +
    l
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[84]:
    + + + + +
    +
    [1, 2, 'hi', 3, 4, 4, 'hey', 6, 7, 8]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [85]:
    +
    +
    +
    l.append([1,2,3])
    +l.extend('python')
    +l
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[85]:
    + + + + +
    +
    [1, 2, 'hi', 3, 4, 4, 'hey', 6, 7, 8, [1, 2, 3], 'p', 'y', 't', 'h', 'o', 'n']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [86]:
    +
    +
    +
    l = [ 'hey','hello',1,2,3,'bye','bye']
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [87]:
    +
    +
    +
    l.pop()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[87]:
    + + + + +
    +
    'bye'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [88]:
    +
    +
    +
    l
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[88]:
    + + + + +
    +
    ['hey', 'hello', 1, 2, 3, 'bye']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [89]:
    +
    +
    +
    l.pop(3)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[89]:
    + + + + +
    +
    2
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [91]:
    +
    +
    +
    l.append('hello')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [92]:
    +
    +
    +
    l
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[92]:
    + + + + +
    +
    ['hey', 'hello', 1, 3, 'bye', 'hello']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [93]:
    +
    +
    +
    l.remove('hello')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [94]:
    +
    +
    +
    l
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[94]:
    + + + + +
    +
    ['hey', 1, 3, 'bye', 'hello']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [95]:
    +
    +
    +
    s = [ 1,1,1,1,3,1,1,11,1,3,1,1,12,11,12,1,12,1,1,1,34,1,1,34,1,1]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [97]:
    +
    +
    +
    print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 1, 1, 1, 3, 1, 1, 11, 1, 3, 1, 1, 12, 11, 12, 1, 12, 1, 1, 1, 34, 1, 1, 34, 1, 1]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [99]:
    +
    +
    +
    s.count(1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[99]:
    + + + + +
    +
    17
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [100]:
    +
    +
    +
    s.count(12)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[100]:
    + + + + +
    +
    3
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [101]:
    +
    +
    +
    l = [ 'hello','hello','hello','hi']
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [102]:
    +
    +
    +
    c = l.count('hello')
    +c1 = l.count('hi')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [103]:
    +
    +
    +
    c
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[103]:
    + + + + +
    +
    3
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [104]:
    +
    +
    +
    c1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[104]:
    + + + + +
    +
    1
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [106]:
    +
    +
    +
    l = [ 23,23,2,33,2434,23,3,43,4,2,4,232432,42424,23,2,3,23,2,3,23,2,3,23,2]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [107]:
    +
    +
    +
    i = l.index(42424)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [108]:
    +
    +
    +
    i
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[108]:
    + + + + +
    +
    12
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [109]:
    +
    +
    +
    x = [ 1,2,3]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [110]:
    +
    +
    +
    y = x
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [111]:
    +
    +
    +
    y
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[111]:
    + + + + +
    +
    [1, 2, 3]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [112]:
    +
    +
    +
    x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[112]:
    + + + + +
    +
    [1, 2, 3]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [113]:
    +
    +
    +
    x.append('hello')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [114]:
    +
    +
    +
    x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[114]:
    + + + + +
    +
    [1, 2, 3, 'hello']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [115]:
    +
    +
    +
    y
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[115]:
    + + + + +
    +
    [1, 2, 3, 'hello']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [116]:
    +
    +
    +
    x = [ 1,2,3]
    +y = x
    +z = x.copy()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [117]:
    +
    +
    +
    x.append('hi')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [118]:
    +
    +
    +
    x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[118]:
    + + + + +
    +
    [1, 2, 3, 'hi']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [119]:
    +
    +
    +
    y
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[119]:
    + + + + +
    +
    [1, 2, 3, 'hi']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [120]:
    +
    +
    +
    z
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[120]:
    + + + + +
    +
    [1, 2, 3]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [121]:
    +
    +
    +
    x = [ 1,23,5,23,23,353,232,23,34,3]
    +y = [ 'hello','bye','soehting','sachin','rajat','grras']
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [125]:
    +
    +
    +
    x.sort()
    +y.sort(reverse=True)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [126]:
    +
    +
    +
    x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[126]:
    + + + + +
    +
    [1, 3, 5, 23, 23, 23, 23, 34, 232, 353]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [127]:
    +
    +
    +
    y
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[127]:
    + + + + +
    +
    ['soehting', 'sachin', 'rajat', 'hello', 'grras', 'bye']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [128]:
    +
    +
    +
    y.reverse()
    +y
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[128]:
    + + + + +
    +
    ['bye', 'grras', 'hello', 'rajat', 'sachin', 'soehting']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [130]:
    +
    +
    +
    y.clear()
    +y
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[130]:
    + + + + +
    +
    []
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [131]:
    +
    +
    +
    x = []
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [132]:
    +
    +
    +
    x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[132]:
    + + + + +
    +
    []
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [133]:
    +
    +
    +
    y = list('python')
    +y
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[133]:
    + + + + +
    +
    ['p', 'y', 't', 'h', 'o', 'n']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [134]:
    +
    +
    +
    y[3] = 'sachin'
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [135]:
    +
    +
    +
    y
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[135]:
    + + + + +
    +
    ['p', 'y', 't', 'sachin', 'o', 'n']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [1]:
    +
    +
    +
    mylist = [ 1,2,3,4,5,6,7,8,9,10]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    #x = mylist[start?:end?:jump?]
    +x = mylist[-2::-2]
    +print(*x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    9 7 5 3 1
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    s = 'Hello World'
    +print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    print(*s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    H e l l o   W o r l d
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    t = ( 1,3.14,6.5+7j,'hello world',['hey',1,3],(1,2,3,4),6)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    t[4][0]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[8]:
    + + + + +
    +
    'hey'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    t[5][2]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[10]:
    + + + + +
    +
    3
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    print(dir(t))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    l = list(t)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    t
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[14]:
    + + + + +
    +
    (1, 3.14, (6.5+7j), 'hello world', ['hey', 1, 3], (1, 2, 3, 4), 6)
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    l
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[15]:
    + + + + +
    +
    [1, 3.14, (6.5+7j), 'hello world', ['hey', 1, 3], (1, 2, 3, 4), 6]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    k = tuple(l)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    k
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[17]:
    + + + + +
    +
    (1, 3.14, (6.5+7j), 'hello world', ['hey', 1, 3], (1, 2, 3, 4), 6)
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    s = str(k)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    s
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[19]:
    + + + + +
    +
    "(1, 3.14, (6.5+7j), 'hello world', ['hey', 1, 3], (1, 2, 3, 4), 6)"
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    #Dictionary in Python
    +python = { 
    +            'Name' : 'Python',
    +            'Versions' : [ '1.X', '2.X', '3.X' ],
    +            'Author' : 'Guido Van Rossum', 
    +        }
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [21]:
    +
    +
    +
    python
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[21]:
    + + + + +
    +
    {'Author': 'Guido Van Rossum',
    + 'Name': 'Python',
    + 'Versions': ['1.X', '2.X', '3.X']}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    python['Versions']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[23]:
    + + + + +
    +
    ['1.X', '2.X', '3.X']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [24]:
    +
    +
    +
    python['Author']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[24]:
    + + + + +
    +
    'Guido Van Rossum'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    python['Web_Framework'] = [ 'Django', 'Flask', 'Pyramid', 'Web2py' ]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [26]:
    +
    +
    +
    python
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[26]:
    + + + + +
    +
    {'Author': 'Guido Van Rossum',
    + 'Name': 'Python',
    + 'Versions': ['1.X', '2.X', '3.X'],
    + 'Web_Framework': ['Django', 'Flask', 'Pyramid', 'Web2py']}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    python['Name'] = 'Python Programming Language'
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [28]:
    +
    +
    +
    python
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[28]:
    + + + + +
    +
    {'Author': 'Guido Van Rossum',
    + 'Name': 'Python Programming Language',
    + 'Versions': ['1.X', '2.X', '3.X'],
    + 'Web_Framework': ['Django', 'Flask', 'Pyramid', 'Web2py']}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [29]:
    +
    +
    +
    print(dir(python))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [30]:
    +
    +
    +
    python['sachin']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +KeyError                                  Traceback (most recent call last)
    +<ipython-input-30-94d72af76c9d> in <module>()
    +----> 1 python['sachin']
    +
    +KeyError: 'sachin'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [32]:
    +
    +
    +
    python.get('sachin')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [33]:
    +
    +
    +
    print(dir(python))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [34]:
    +
    +
    +
    python.items()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[34]:
    + + + + +
    +
    dict_items([('Name', 'Python Programming Language'), ('Versions', ['1.X', '2.X', '3.X']), ('Author', 'Guido Van Rossum'), ('Web_Framework', ['Django', 'Flask', 'Pyramid', 'Web2py'])])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [35]:
    +
    +
    +
    python.keys()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[35]:
    + + + + +
    +
    dict_keys(['Name', 'Versions', 'Author', 'Web_Framework'])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [36]:
    +
    +
    +
    python.values()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[36]:
    + + + + +
    +
    dict_values(['Python Programming Language', ['1.X', '2.X', '3.X'], 'Guido Van Rossum', ['Django', 'Flask', 'Pyramid', 'Web2py']])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [38]:
    +
    +
    +
    python.pop('Name')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[38]:
    + + + + +
    +
    'Python Programming Language'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [39]:
    +
    +
    +
    python
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[39]:
    + + + + +
    +
    {'Author': 'Guido Van Rossum',
    + 'Versions': ['1.X', '2.X', '3.X'],
    + 'Web_Framework': ['Django', 'Flask', 'Pyramid', 'Web2py']}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [40]:
    +
    +
    +
    python['newkey'] =  'newvalue'
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [41]:
    +
    +
    +
    python
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[41]:
    + + + + +
    +
    {'Author': 'Guido Van Rossum',
    + 'Versions': ['1.X', '2.X', '3.X'],
    + 'Web_Framework': ['Django', 'Flask', 'Pyramid', 'Web2py'],
    + 'newkey': 'newvalue'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [42]:
    +
    +
    +
    python.update([('one',1),('two',2)])
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [43]:
    +
    +
    +
    python
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[43]:
    + + + + +
    +
    {'Author': 'Guido Van Rossum',
    + 'Versions': ['1.X', '2.X', '3.X'],
    + 'Web_Framework': ['Django', 'Flask', 'Pyramid', 'Web2py'],
    + 'newkey': 'newvalue',
    + 'one': 1,
    + 'two': 2}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [44]:
    +
    +
    +
    d = { 
    +    'name':'python',
    +    
    +    'framework': { 
    +    'web':['web2py','django','flask'],
    +    'gui':['tkinter','wxpython','kivi','pygame'],
    +    'automation':['ansible','salt','openstack'],
    +    'AI':['pandas','numpy','scipy','scikitlearn'], },
    +    
    +    'author':'Guido Van Rossum',
    +     }
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [47]:
    +
    +
    +
    d['framework']['AI'][2]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[47]:
    + + + + +
    +
    'scipy'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [48]:
    +
    +
    +
    s = { 1,1,1,1,1,1,1,1,11,1,2,2,2,2,2,2,23,4,5,3,}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [49]:
    +
    +
    +
    s
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[49]:
    + + + + +
    +
    {1, 2, 3, 4, 5, 11, 23}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [51]:
    +
    +
    +
    s = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [52]:
    +
    +
    +
    s1 = { 1,2,3,4,5}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [53]:
    +
    +
    +
    s2 = { 4,5,6,7,8,9,10}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [54]:
    +
    +
    +
    s3 = { 9,10,11,12}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [56]:
    +
    +
    +
    print(dir(s))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__iand__', '__init__', '__init_subclass__', '__ior__', '__isub__', '__iter__', '__ixor__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'add', 'clear', 'copy', 'difference', 'difference_update', 'discard', 'intersection', 'intersection_update', 'isdisjoint', 'issubset', 'issuperset', 'pop', 'remove', 'symmetric_difference', 'symmetric_difference_update', 'union', 'update']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [58]:
    +
    +
    +
    s.issuperset(s2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[58]:
    + + + + +
    +
    True
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [60]:
    +
    +
    +
    s1.issubset(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[60]:
    + + + + +
    +
    True
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [62]:
    +
    +
    +
    s1.intersection(s2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[62]:
    + + + + +
    +
    {4, 5}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [64]:
    +
    +
    +
    s3.intersection(s2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[64]:
    + + + + +
    +
    {9, 10}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [65]:
    +
    +
    +
    s4 = s1.union(s2)
    +s4
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[65]:
    + + + + +
    +
    {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [66]:
    +
    +
    +
    s4 = s4.union(s3)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [67]:
    +
    +
    +
    s4
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[67]:
    + + + + +
    +
    {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [68]:
    +
    +
    +
    s.difference(s4)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[68]:
    + + + + +
    +
    {13, 14, 15}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +

    Type Conversion

    +
    +
    +
    +
    +
    +
    In [69]:
    +
    +
    +
    #int
    +x = input("Enter a number : ")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter a number :        1232312321     
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [70]:
    +
    +
    +
    type(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[70]:
    + + + + +
    +
    str
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [71]:
    +
    +
    +
    x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[71]:
    + + + + +
    +
    '       1232312321     '
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [72]:
    +
    +
    +
    x = int(x)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [73]:
    +
    +
    +
    x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[73]:
    + + + + +
    +
    1232312321
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [74]:
    +
    +
    +
    x = 'abcdef12321a'
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [76]:
    +
    +
    +
    int(x) #int(num,base)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +ValueError                                Traceback (most recent call last)
    +<ipython-input-76-e06f25c72d39> in <module>()
    +----> 1 int(x) #int(num,base)
    +
    +ValueError: invalid literal for int() with base 10: 'abcdef12321a'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [77]:
    +
    +
    +
    y = int(x,16)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [78]:
    +
    +
    +
    x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[78]:
    + + + + +
    +
    'abcdef12321a'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [79]:
    +
    +
    +
    y
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[79]:
    + + + + +
    +
    188900967592474
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [80]:
    +
    +
    +
    y = int('1264412417',8)
    +y
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[80]:
    + + + + +
    +
    181540111
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [81]:
    +
    +
    +
    x = '101010100101010010100101010101010101010100100101010'
    +int(x,2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[81]:
    + + + + +
    +
    1498244222462250
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [82]:
    +
    +
    +
    x = 1238392349823983248923
    +bin(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[82]:
    + + + + +
    +
    '0b10000110010001000100101011100001110000110001011110011010110011000011011'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [83]:
    +
    +
    +
    x= 01
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +  File "<ipython-input-83-eb41fc69b993>", line 1
    +    x= 01
    +        ^
    +SyntaxError: invalid token
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [84]:
    +
    +
    +
    oct(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[84]:
    + + + + +
    +
    '0o206210453416061363263033'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [85]:
    +
    +
    +
    hex(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[85]:
    + + + + +
    +
    '0x43222570e18bcd661b'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [86]:
    +
    +
    +
    float('12749812794812984792874.12984298')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[86]:
    + + + + +
    +
    1.2749812794812986e+22
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [88]:
    +
    +
    +
    x = 987907987498294789498279239849874983298439842398473947983274982374983297483279847329842379847328947983249782394327472394
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [89]:
    +
    +
    +
    x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[89]:
    + + + + +
    +
    987907987498294789498279239849874983298439842398473947983274982374983297483279847329842379847328947983249782394327472394
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [91]:
    +
    +
    +
    print(dir(x))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [92]:
    +
    +
    +
    x.__sizeof__()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[92]:
    + + + + +
    +
    80
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [94]:
    +
    +
    +
    x.bit_length()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[94]:
    + + + + +
    +
    399
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [95]:
    +
    +
    +
    399/8
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[95]:
    + + + + +
    +
    49.875
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [96]:
    +
    +
    +
    x = 1
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [97]:
    +
    +
    +
    x.__sizeof__()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[97]:
    + + + + +
    +
    28
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [98]:
    +
    +
    +
    complex('234.34')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[98]:
    + + + + +
    +
    (234.34+0j)
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [99]:
    +
    +
    +
    x = int(input("Integer  : "))
    +y = float(input("Float : "))
    +z = complex(input("Complex : "))
    +print(type(x))
    +print(type(y))
    +print(type(z))
    +print(x)
    +print(y)
    +print(z)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Integer  : 24862842842
    +Float : 98374.2934
    +Complex : 32523.23+45j
    +<class 'int'>
    +<class 'float'>
    +<class 'complex'>
    +24862842842
    +98374.2934
    +(32523.23+45j)
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [100]:
    +
    +
    +
    str(124343)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[100]:
    + + + + +
    +
    '124343'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [101]:
    +
    +
    +
    str([129492,2424,24,24,])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[101]:
    + + + + +
    +
    '[129492, 2424, 24, 24]'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [102]:
    +
    +
    +
    str((234,34,343,))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[102]:
    + + + + +
    +
    '(234, 34, 343)'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [103]:
    +
    +
    +
    str({'helo':'hi','bye':'bye bye'})
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[103]:
    + + + + +
    +
    "{'helo': 'hi', 'bye': 'bye bye'}"
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [104]:
    +
    +
    +
    list('python')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[104]:
    + + + + +
    +
    ['p', 'y', 't', 'h', 'o', 'n']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [107]:
    +
    +
    +
    d = { 'hello':'hi','bye':'bye bye'}
    +list(d)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[107]:
    + + + + +
    +
    ['hello', 'bye']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [108]:
    +
    +
    +
    list(d.items())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[108]:
    + + + + +
    +
    [('hello', 'hi'), ('bye', 'bye bye')]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [109]:
    +
    +
    +
    list(d.keys())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[109]:
    + + + + +
    +
    ['hello', 'bye']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [110]:
    +
    +
    +
    list(d.values())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[110]:
    + + + + +
    +
    ['hi', 'bye bye']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [113]:
    +
    +
    +
    tuple(d.values())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[113]:
    + + + + +
    +
    ('hi', 'bye bye')
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [118]:
    +
    +
    +
    t = ( ['name','python'],('version',3.7),('future',None) )
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [119]:
    +
    +
    +
    t
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[119]:
    + + + + +
    +
    (['name', 'python'], ('version', 3.7), ('future', None))
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [116]:
    +
    +
    +
    d = dict(t)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [117]:
    +
    +
    +
    d
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[117]:
    + + + + +
    +
    {'name': 'python', 'version': 3.7}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [120]:
    +
    +
    +
    l = ['hi','ab','cd','de']
    +d = dict(l)
    +d
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[120]:
    + + + + +
    +
    {'a': 'b', 'c': 'd', 'd': 'e', 'h': 'i'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [121]:
    +
    +
    +
    set([12,34,3424,5,3,2,3,423,24,23,24,2,1,1,1,111])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[121]:
    + + + + +
    +
    {1, 2, 3, 5, 12, 23, 24, 34, 111, 423, 3424}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [129]:
    +
    +
    +
    x = 5
    +y = 6
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [130]:
    +
    +
    +
    id(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[130]:
    + + + + +
    +
    1626366240
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [131]:
    +
    +
    +
    id(y)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[131]:
    + + + + +
    +
    1626366272
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [132]:
    +
    +
    +
    x is y
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[132]:
    + + + + +
    +
    False
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [1]:
    +
    +
    +
    #Dictionary 
    +info = { 'name':'sachin','age':22,'country':'india','language':'hindi'}
    +print("Name of Candidate : ",info['name'])
    +print("Age of Candidate : ",info['age'])
    +print("Candidate Blongs to  : ",info['country'])
    +print("Language that person speaks : ",info['language'])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Name of Candidate :  sachin
    +Age of Candidate :  22
    +Candidate Blongs to  :  india
    +Language that person speaks :  hindi
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    print(dir(info))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    info.keys()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[3]:
    + + + + +
    +
    dict_keys(['name', 'age', 'country', 'language'])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    info.values()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[4]:
    + + + + +
    +
    dict_values(['sachin', 22, 'india', 'hindi'])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    info.items()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[5]:
    + + + + +
    +
    dict_items([('name', 'sachin'), ('age', 22), ('country', 'india'), ('language', 'hindi')])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    info.get('hariom','raam raam')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[9]:
    + + + + +
    +
    'raam raam'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    info.get('name','hari om')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[11]:
    + + + + +
    +
    'sachin'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    info['name'] = 'sachin yadav'
    +info
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[12]:
    + + + + +
    +
    {'age': 22, 'country': 'india', 'language': 'hindi', 'name': 'sachin yadav'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    info.update([('one',1),])
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    info
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[20]:
    + + + + +
    +
    {'name': 'sachin yadav',
    + 'age': 22,
    + 'country': 'india',
    + 'language': 'hindi',
    + 'one': 1,
    + 1: 2}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [21]:
    +
    +
    +
    info.update([('name','python'),('age',21),])
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [22]:
    +
    +
    +
    info
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[22]:
    + + + + +
    +
    {'name': 'python',
    + 'age': 21,
    + 'country': 'india',
    + 'language': 'hindi',
    + 'one': 1,
    + 1: 2}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    #set
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [30]:
    +
    +
    +
    myset = { 'hello','hi','hello','hi',1,1,1,1,1,1,1,1,1,2,3,4,5,'jai','bhole','ki'}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [31]:
    +
    +
    +
    myset
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[31]:
    + + + + +
    +
    {'hi', 2, 3, 'hello', 1, 4, 5, 'jai', 'bhole', 'ki'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [32]:
    +
    +
    +
    print(dir(myset))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__iand__', '__init__', '__init_subclass__', '__ior__', '__isub__', '__iter__', '__ixor__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'add', 'clear', 'copy', 'difference', 'difference_update', 'discard', 'intersection', 'intersection_update', 'isdisjoint', 'issubset', 'issuperset', 'pop', 'remove', 'symmetric_difference', 'symmetric_difference_update', 'union', 'update']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [33]:
    +
    +
    +
    s1 = { 1,2,3,4,5,6,7}
    +s2 = { 5,6,7,8,9,10,11,12}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [34]:
    +
    +
    +
    s1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[34]:
    + + + + +
    +
    {1, 2, 3, 4, 5, 6, 7}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [35]:
    +
    +
    +
    s2
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[35]:
    + + + + +
    +
    {5, 6, 7, 8, 9, 10, 11, 12}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [36]:
    +
    +
    +
    s1.intersection(s2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[36]:
    + + + + +
    +
    {5, 6, 7}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [37]:
    +
    +
    +
    s2.difference(s1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[37]:
    + + + + +
    +
    {8, 9, 10, 11, 12}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [38]:
    +
    +
    +
    s1.union(s2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[38]:
    + + + + +
    +
    {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [39]:
    +
    +
    +
    s1.issubset(s2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[39]:
    + + + + +
    +
    False
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [41]:
    +
    +
    +
    s = { 1,2,3,4,5,6,7,8,9,10,11,12}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [42]:
    +
    +
    +
    s.issuperset(s1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[42]:
    + + + + +
    +
    True
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [43]:
    +
    +
    +
    s2.issubset(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[43]:
    + + + + +
    +
    True
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +

    Type conversion

    +
    +
    +
    +
    +
    +
    In [45]:
    +
    +
    +
    x = input("Enter a integer : ")
    +print(type(x))
    +x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter a integer : 123234
    +<class 'str'>
    +
    +
    +
    + +
    + +
    Out[45]:
    + + + + +
    +
    '123234'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [46]:
    +
    +
    +
    y = int(x)
    +print(type(y))
    +y
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    <class 'int'>
    +
    +
    +
    + +
    + +
    Out[46]:
    + + + + +
    +
    123234
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [48]:
    +
    +
    +
    y = int('abcdef',16)
    +print(type(y))
    +y
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    <class 'int'>
    +
    +
    +
    + +
    + +
    Out[48]:
    + + + + +
    +
    11259375
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [49]:
    +
    +
    +
    y = int('010101',2)
    +print(y)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    21
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [50]:
    +
    +
    +
    y = int('1234567',8)
    +print(y)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    342391
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [52]:
    +
    +
    +
    x = bin(172)
    +x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[52]:
    + + + + +
    +
    '0b10101100'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [53]:
    +
    +
    +
    type(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[53]:
    + + + + +
    +
    str
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [57]:
    +
    +
    +
    hex(10)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[57]:
    + + + + +
    +
    '0xa'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [58]:
    +
    +
    +
    oct(1235645)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[58]:
    + + + + +
    +
    '0o4555275'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [59]:
    +
    +
    +
    float(input("Enter a number : "))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter a number : 12343456.234232
    +
    +
    +
    + +
    + +
    Out[59]:
    + + + + +
    +
    12343456.234232
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [60]:
    +
    +
    +
    complex('35434+3434j')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[60]:
    + + + + +
    +
    (35434+3434j)
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [63]:
    +
    +
    +
    s = str([1,23,34,4])
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [64]:
    +
    +
    +
    s[::-1]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[64]:
    + + + + +
    +
    ']4 ,43 ,32 ,1['
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [65]:
    +
    +
    +
    list('python')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[65]:
    + + + + +
    +
    ['p', 'y', 't', 'h', 'o', 'n']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [66]:
    +
    +
    +
    d = { 'hey':'hello','bye':'bye bye','x':1234 }
    +list(d)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[66]:
    + + + + +
    +
    ['hey', 'bye', 'x']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [67]:
    +
    +
    +
    tuple([1,2,3,'hello','hi'])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[67]:
    + + + + +
    +
    (1, 2, 3, 'hello', 'hi')
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [68]:
    +
    +
    +
    set('pythobn')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[68]:
    + + + + +
    +
    {'b', 'h', 'n', 'o', 'p', 't', 'y'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [69]:
    +
    +
    +
    k = [ ('name','python'), ('version',3.7), ('father','Guido Van Rossum'),'hi','ab']
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [71]:
    +
    +
    +
    dict(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[71]:
    + + + + +
    +
    {'a': 'b',
    + 'father': 'Guido Van Rossum',
    + 'h': 'i',
    + 'name': 'python',
    + 'version': 3.7}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/Basic_Data_Types.ipynb b/python_ipynb/Basic_Data_Types.ipynb new file mode 100644 index 0000000..7d5d0c3 --- /dev/null +++ b/python_ipynb/Basic_Data_Types.ipynb @@ -0,0 +1,4671 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Data Types in Python

    " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Data Types are just set of rules that are used classify data

    \n", + "
      \n", + "
    1. Numbers
    2. \n", + "
    3. String
    4. \n", + "
    5. List
    6. \n", + "
    7. Tuple
    8. \n", + "
    9. Dictionary
    10. \n", + "
    11. Sets
    12. \n", + "
    " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\n", + "11\n", + "-1\n" + ] + } + ], + "source": [ + "#int,float and comples these are the numbers\n", + "x = 5\n", + "y = 6\n", + "print(type(x))\n", + "print(type(y))\n", + "print(x+y)\n", + "print(x-y)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "39.0\n" + ] + } + ], + "source": [ + "x = 6.5\n", + "print(type(x))\n", + "print(x*y)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + }, + { + "data": { + "text/plain": [ + "(6.6+3.5j)" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "k = 6.6+3.5j\n", + "print(type(k))\n", + "k" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(-1+0j)\n" + ] + } + ], + "source": [ + "n = 1j\n", + "print(n*n)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = \"Hello world\"\n", + "k = 'hi how are you'\n", + "x = 'hi \\'hi'\n", + "y = \"he said, 'she is beautiful'\"\n", + "z = \"\"\"\n", + "hi hello,\n", + " jaipur,11-jul-2018,\n", + " we are learning python.\n", + "python is a good language.\n", + "\"\"\"" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Hello world'" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello world\n" + ] + } + ], + "source": [ + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hi how are you\n" + ] + } + ], + "source": [ + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hi 'hi\n" + ] + } + ], + "source": [ + "print(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "he said, 'she is beautiful'\n" + ] + } + ], + "source": [ + "print(y)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "hi hello,\n", + " jaipur,11-jul-2018,\n", + " we are learning python.\n", + "python is a good language.\n", + "\n" + ] + } + ], + "source": [ + "print(z)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']\n" + ] + } + ], + "source": [ + "print(dir(x))" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = \"Hello World\"" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "11" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'l'" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s[3]\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'r'" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s[-3]" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "#slicing\n", + "# a[start:end:jump]\n", + "s = \"Hello World\"\n", + "newstring = s[0:5]" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\n", + "Hello\n" + ] + } + ], + "source": [ + "print(s)\n", + "print(newstring)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "World\n" + ] + } + ], + "source": [ + "s = \"Hello World\"\n", + "print(s[-5:])" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Hello World'" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s[:]\n" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Hello'" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s[:5]" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'HloWrd'" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s[::2]" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'roW oll'" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s[8:1:-1]" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'roW oll'" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s[-3:-10:-1]" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'dlroW olleH'" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s[::-1]" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = \"AakjdflkjsdlfjlkjflsjlkjflsajfldsjfljsalkfslaflkdjljaslljZ\"" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Aakjdflkjsdlfjlkjflsjlkjflsajfldsjfljsalkfslaflkdjljasl'" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s[:-3]" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = \"Hello World\"" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']\n" + ] + } + ], + "source": [ + "print(dir(s))" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Help on built-in function swapcase:\n", + "\n", + "swapcase(...) method of builtins.str instance\n", + " S.swapcase() -> str\n", + " \n", + " Return a copy of S with uppercase characters converted to lowercase\n", + " and vice versa.\n", + "\n" + ] + } + ], + "source": [ + "help(s.swapcase)" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "n = s.swapcase()" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Hello World'" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'hELLO wORLD'" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "n" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'hello world'" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.lower()" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'HELLO WORLD'" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.upper()" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = \" Hello World \"" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Hello World '" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.lstrip()" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "' Hello World'" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.rstrip()" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Hello World'" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.strip()" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Sachin YADAV \n", + "\n" + ] + } + ], + "source": [ + "name = input()\n", + "print(type(name))" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "' Sachin YADAV '" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "name" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "n = name.strip()" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'sachin yadav'" + ] + }, + "execution_count": 52, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "n.lower()" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your name : Hello WoRLD \n" + ] + }, + { + "data": { + "text/plain": [ + "'hello world'" + ] + }, + "execution_count": 53, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "name = input(\"Enter your name : \").strip().lower()\n", + "name" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = \"Hello World Welcome to python.\"" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Hello', 'World', 'Welcome', 'to', 'python.']" + ] + }, + "execution_count": 57, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.split(\" \")" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "('Hello World ', 'Welcome', ' to python.')" + ] + }, + "execution_count": 59, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.partition(\"Welcome\")" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Hello', 'World', 'Welcome', 'to', 'python']" + ] + }, + "execution_count": 60, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = [ \"Hello\",\"World\",\"Welcome\",\"to\",\"python\"]\n", + "s" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = [ \n", + " [\n", + " [ 1,2,3],\n", + " [4,5,6],\n", + " ],\n", + " \n", + " [\n", + " [7,8,9],\n", + " [10,11,12]\n", + " ]\n", + " ]\n", + "s = [ [ [1,2,3], [4,5,6] ], [ [7,8,9],[10,11,12] ] ]" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "5" + ] + }, + "execution_count": 64, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s[0][1][1]" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "9" + ] + }, + "execution_count": 65, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s[1][0][2]" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['hey', 'hello', 'how', 'are', 'you']" + ] + }, + "execution_count": 66, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = [ 'hey','bye','hello','he','how','abc','are','k','you']\n", + "k = s[0::2]\n", + "k" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'hey-hello-how-are-you'" + ] + }, + "execution_count": 67, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "r = '-'.join(k)\n", + "r" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['ram', 'radha', 'mohan', 'meera', 'krishna']" + ] + }, + "execution_count": 68, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = \"ram,radha,mohan,meera,krishna\"\n", + "l = s.split(',')\n", + "l" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['ram', 'mohan', 'krishna']" + ] + }, + "execution_count": 70, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "n = l[::2]\n", + "n" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = ','.join(n)" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'ram,mohan,krishna'" + ] + }, + "execution_count": 72, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'ram,mohan,krishna'" + ] + }, + "execution_count": 73, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = \"ram,radha,mohan,meera,krishna\"\n", + "r = ','.join(s.split(',')[::2])\n", + "r" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']\n" + ] + } + ], + "source": [ + "l = [ 1,2,'hi',3,4,5,'hello']\n", + "print(dir(l))" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "l = [ 1,2,3]" + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "l.append(4)" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 3, 4, 4]" + ] + }, + "execution_count": 80, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "l\n" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "l.insert(2,'hi')" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 'hi', 3, 4, 4]" + ] + }, + "execution_count": 82, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "l" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "l.extend(['hey',6,7,8])" + ] + }, + { + "cell_type": "code", + "execution_count": 84, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 'hi', 3, 4, 4, 'hey', 6, 7, 8]" + ] + }, + "execution_count": 84, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "l" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 'hi', 3, 4, 4, 'hey', 6, 7, 8, [1, 2, 3], 'p', 'y', 't', 'h', 'o', 'n']" + ] + }, + "execution_count": 85, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "l.append([1,2,3])\n", + "l.extend('python')\n", + "l" + ] + }, + { + "cell_type": "code", + "execution_count": 86, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "l = [ 'hey','hello',1,2,3,'bye','bye']" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'bye'" + ] + }, + "execution_count": 87, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "l.pop()" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['hey', 'hello', 1, 2, 3, 'bye']" + ] + }, + "execution_count": 88, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "l" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2" + ] + }, + "execution_count": 89, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "l.pop(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 91, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "l.append('hello')" + ] + }, + { + "cell_type": "code", + "execution_count": 92, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['hey', 'hello', 1, 3, 'bye', 'hello']" + ] + }, + "execution_count": 92, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "l" + ] + }, + { + "cell_type": "code", + "execution_count": 93, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "l.remove('hello')" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['hey', 1, 3, 'bye', 'hello']" + ] + }, + "execution_count": 94, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "l" + ] + }, + { + "cell_type": "code", + "execution_count": 95, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = [ 1,1,1,1,3,1,1,11,1,3,1,1,12,11,12,1,12,1,1,1,34,1,1,34,1,1]" + ] + }, + { + "cell_type": "code", + "execution_count": 97, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 1, 1, 1, 3, 1, 1, 11, 1, 3, 1, 1, 12, 11, 12, 1, 12, 1, 1, 1, 34, 1, 1, 34, 1, 1]\n" + ] + } + ], + "source": [ + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 99, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "17" + ] + }, + "execution_count": 99, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.count(1)" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3" + ] + }, + "execution_count": 100, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.count(12)" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "l = [ 'hello','hello','hello','hi']\n" + ] + }, + { + "cell_type": "code", + "execution_count": 102, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "c = l.count('hello')\n", + "c1 = l.count('hi')" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3" + ] + }, + "execution_count": 103, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "c" + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 104, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "c1" + ] + }, + { + "cell_type": "code", + "execution_count": 106, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "l = [ 23,23,2,33,2434,23,3,43,4,2,4,232432,42424,23,2,3,23,2,3,23,2,3,23,2]" + ] + }, + { + "cell_type": "code", + "execution_count": 107, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "i = l.index(42424)" + ] + }, + { + "cell_type": "code", + "execution_count": 108, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "12" + ] + }, + "execution_count": 108, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "i" + ] + }, + { + "cell_type": "code", + "execution_count": 109, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "x = [ 1,2,3]" + ] + }, + { + "cell_type": "code", + "execution_count": 110, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "y = x" + ] + }, + { + "cell_type": "code", + "execution_count": 111, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 3]" + ] + }, + "execution_count": 111, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "y" + ] + }, + { + "cell_type": "code", + "execution_count": 112, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 3]" + ] + }, + "execution_count": 112, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x" + ] + }, + { + "cell_type": "code", + "execution_count": 113, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "x.append('hello')" + ] + }, + { + "cell_type": "code", + "execution_count": 114, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 3, 'hello']" + ] + }, + "execution_count": 114, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x" + ] + }, + { + "cell_type": "code", + "execution_count": 115, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 3, 'hello']" + ] + }, + "execution_count": 115, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "y" + ] + }, + { + "cell_type": "code", + "execution_count": 116, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "x = [ 1,2,3]\n", + "y = x\n", + "z = x.copy()" + ] + }, + { + "cell_type": "code", + "execution_count": 117, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "x.append('hi')" + ] + }, + { + "cell_type": "code", + "execution_count": 118, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 3, 'hi']" + ] + }, + "execution_count": 118, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x" + ] + }, + { + "cell_type": "code", + "execution_count": 119, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 3, 'hi']" + ] + }, + "execution_count": 119, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "y" + ] + }, + { + "cell_type": "code", + "execution_count": 120, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 3]" + ] + }, + "execution_count": 120, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "z" + ] + }, + { + "cell_type": "code", + "execution_count": 121, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "x = [ 1,23,5,23,23,353,232,23,34,3]\n", + "y = [ 'hello','bye','soehting','sachin','rajat','grras']" + ] + }, + { + "cell_type": "code", + "execution_count": 125, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "x.sort()\n", + "y.sort(reverse=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 126, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 3, 5, 23, 23, 23, 23, 34, 232, 353]" + ] + }, + "execution_count": 126, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x" + ] + }, + { + "cell_type": "code", + "execution_count": 127, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['soehting', 'sachin', 'rajat', 'hello', 'grras', 'bye']" + ] + }, + "execution_count": 127, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "y" + ] + }, + { + "cell_type": "code", + "execution_count": 128, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['bye', 'grras', 'hello', 'rajat', 'sachin', 'soehting']" + ] + }, + "execution_count": 128, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "y.reverse()\n", + "y" + ] + }, + { + "cell_type": "code", + "execution_count": 130, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[]" + ] + }, + "execution_count": 130, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "y.clear()\n", + "y" + ] + }, + { + "cell_type": "code", + "execution_count": 131, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "x = []" + ] + }, + { + "cell_type": "code", + "execution_count": 132, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[]" + ] + }, + "execution_count": 132, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x" + ] + }, + { + "cell_type": "code", + "execution_count": 133, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['p', 'y', 't', 'h', 'o', 'n']" + ] + }, + "execution_count": 133, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "y = list('python')\n", + "y" + ] + }, + { + "cell_type": "code", + "execution_count": 134, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "y[3] = 'sachin'" + ] + }, + { + "cell_type": "code", + "execution_count": 135, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['p', 'y', 't', 'sachin', 'o', 'n']" + ] + }, + "execution_count": 135, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "y" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "mylist = [ 1,2,3,4,5,6,7,8,9,10]" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "9 7 5 3 1\n" + ] + } + ], + "source": [ + "#x = mylist[start?:end?:jump?]\n", + "x = mylist[-2::-2]\n", + "print(*x)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\n" + ] + } + ], + "source": [ + "s = 'Hello World'\n", + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "H e l l o W o r l d\n" + ] + } + ], + "source": [ + "print(*s)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "t = ( 1,3.14,6.5+7j,'hello world',['hey',1,3],(1,2,3,4),6)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'hey'" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "t[4][0]" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "t[5][2]" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index']\n" + ] + } + ], + "source": [ + "print(dir(t))" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "l = list(t)" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(1, 3.14, (6.5+7j), 'hello world', ['hey', 1, 3], (1, 2, 3, 4), 6)" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "t" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 3.14, (6.5+7j), 'hello world', ['hey', 1, 3], (1, 2, 3, 4), 6]" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "l" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "k = tuple(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(1, 3.14, (6.5+7j), 'hello world', ['hey', 1, 3], (1, 2, 3, 4), 6)" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "k" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = str(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "\"(1, 3.14, (6.5+7j), 'hello world', ['hey', 1, 3], (1, 2, 3, 4), 6)\"" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "#Dictionary in Python\n", + "python = { \n", + " 'Name' : 'Python',\n", + " 'Versions' : [ '1.X', '2.X', '3.X' ],\n", + " 'Author' : 'Guido Van Rossum', \n", + " }" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'Author': 'Guido Van Rossum',\n", + " 'Name': 'Python',\n", + " 'Versions': ['1.X', '2.X', '3.X']}" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['1.X', '2.X', '3.X']" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python['Versions']" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Guido Van Rossum'" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python['Author']" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "python['Web_Framework'] = [ 'Django', 'Flask', 'Pyramid', 'Web2py' ]" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'Author': 'Guido Van Rossum',\n", + " 'Name': 'Python',\n", + " 'Versions': ['1.X', '2.X', '3.X'],\n", + " 'Web_Framework': ['Django', 'Flask', 'Pyramid', 'Web2py']}" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "python['Name'] = 'Python Programming Language'" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'Author': 'Guido Van Rossum',\n", + " 'Name': 'Python Programming Language',\n", + " 'Versions': ['1.X', '2.X', '3.X'],\n", + " 'Web_Framework': ['Django', 'Flask', 'Pyramid', 'Web2py']}" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(python))" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "ename": "KeyError", + "evalue": "'sachin'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mpython\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'sachin'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m: 'sachin'" + ] + } + ], + "source": [ + "python['sachin']" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "python.get('sachin')" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(python))" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_items([('Name', 'Python Programming Language'), ('Versions', ['1.X', '2.X', '3.X']), ('Author', 'Guido Van Rossum'), ('Web_Framework', ['Django', 'Flask', 'Pyramid', 'Web2py'])])" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.items()" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_keys(['Name', 'Versions', 'Author', 'Web_Framework'])" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.keys()" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_values(['Python Programming Language', ['1.X', '2.X', '3.X'], 'Guido Van Rossum', ['Django', 'Flask', 'Pyramid', 'Web2py']])" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.values()" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Python Programming Language'" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.pop('Name')" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'Author': 'Guido Van Rossum',\n", + " 'Versions': ['1.X', '2.X', '3.X'],\n", + " 'Web_Framework': ['Django', 'Flask', 'Pyramid', 'Web2py']}" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "python['newkey'] = 'newvalue'" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'Author': 'Guido Van Rossum',\n", + " 'Versions': ['1.X', '2.X', '3.X'],\n", + " 'Web_Framework': ['Django', 'Flask', 'Pyramid', 'Web2py'],\n", + " 'newkey': 'newvalue'}" + ] + }, + "execution_count": 41, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "python.update([('one',1),('two',2)])" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'Author': 'Guido Van Rossum',\n", + " 'Versions': ['1.X', '2.X', '3.X'],\n", + " 'Web_Framework': ['Django', 'Flask', 'Pyramid', 'Web2py'],\n", + " 'newkey': 'newvalue',\n", + " 'one': 1,\n", + " 'two': 2}" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "d = { \n", + " 'name':'python',\n", + " \n", + " 'framework': { \n", + " 'web':['web2py','django','flask'],\n", + " 'gui':['tkinter','wxpython','kivi','pygame'],\n", + " 'automation':['ansible','salt','openstack'],\n", + " 'AI':['pandas','numpy','scipy','scikitlearn'], },\n", + " \n", + " 'author':'Guido Van Rossum',\n", + " }" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'scipy'" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "d['framework']['AI'][2]" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = { 1,1,1,1,1,1,1,1,11,1,2,2,2,2,2,2,23,4,5,3,}" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{1, 2, 3, 4, 5, 11, 23}" + ] + }, + "execution_count": 49, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s1 = { 1,2,3,4,5}" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s2 = { 4,5,6,7,8,9,10}" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s3 = { 9,10,11,12}" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__iand__', '__init__', '__init_subclass__', '__ior__', '__isub__', '__iter__', '__ixor__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'add', 'clear', 'copy', 'difference', 'difference_update', 'discard', 'intersection', 'intersection_update', 'isdisjoint', 'issubset', 'issuperset', 'pop', 'remove', 'symmetric_difference', 'symmetric_difference_update', 'union', 'update']\n" + ] + } + ], + "source": [ + "print(dir(s))" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 58, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.issuperset(s2)" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 60, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s1.issubset(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{4, 5}" + ] + }, + "execution_count": 62, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s1.intersection(s2)" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{9, 10}" + ] + }, + "execution_count": 64, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s3.intersection(s2)" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}" + ] + }, + "execution_count": 65, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s4 = s1.union(s2)\n", + "s4" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s4 = s4.union(s3)" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}" + ] + }, + "execution_count": 67, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s4" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{13, 14, 15}" + ] + }, + "execution_count": 68, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.difference(s4)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Type Conversion

    " + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a number : 1232312321 \n" + ] + } + ], + "source": [ + "#int\n", + "x = input(\"Enter a number : \")" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "str" + ] + }, + "execution_count": 70, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "type(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "' 1232312321 '" + ] + }, + "execution_count": 71, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "x = int(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1232312321" + ] + }, + "execution_count": 73, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "x = 'abcdef12321a'" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": {}, + "outputs": [ + { + "ename": "ValueError", + "evalue": "invalid literal for int() with base 10: 'abcdef12321a'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;31m#int(num,base)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mValueError\u001b[0m: invalid literal for int() with base 10: 'abcdef12321a'" + ] + } + ], + "source": [ + "int(x) #int(num,base)" + ] + }, + { + "cell_type": "code", + "execution_count": 77, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "y = int(x,16)" + ] + }, + { + "cell_type": "code", + "execution_count": 78, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'abcdef12321a'" + ] + }, + "execution_count": 78, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x" + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "188900967592474" + ] + }, + "execution_count": 79, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "y" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "181540111" + ] + }, + "execution_count": 80, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "y = int('1264412417',8)\n", + "y" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1498244222462250" + ] + }, + "execution_count": 81, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x = '101010100101010010100101010101010101010100100101010'\n", + "int(x,2)" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'0b10000110010001000100101011100001110000110001011110011010110011000011011'" + ] + }, + "execution_count": 82, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x = 1238392349823983248923\n", + "bin(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid token (, line 1)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m x= 01\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid token\n" + ] + } + ], + "source": [ + "x= 01" + ] + }, + { + "cell_type": "code", + "execution_count": 84, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'0o206210453416061363263033'" + ] + }, + "execution_count": 84, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "oct(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'0x43222570e18bcd661b'" + ] + }, + "execution_count": 85, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "hex(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 86, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1.2749812794812986e+22" + ] + }, + "execution_count": 86, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "float('12749812794812984792874.12984298')" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "x = 987907987498294789498279239849874983298439842398473947983274982374983297483279847329842379847328947983249782394327472394" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "987907987498294789498279239849874983298439842398473947983274982374983297483279847329842379847328947983249782394327472394" + ] + }, + "execution_count": 89, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x" + ] + }, + { + "cell_type": "code", + "execution_count": 91, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']\n" + ] + } + ], + "source": [ + "print(dir(x))" + ] + }, + { + "cell_type": "code", + "execution_count": 92, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "80" + ] + }, + "execution_count": 92, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x.__sizeof__()" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "399" + ] + }, + "execution_count": 94, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x.bit_length()" + ] + }, + { + "cell_type": "code", + "execution_count": 95, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "49.875" + ] + }, + "execution_count": 95, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "399/8" + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "x = 1\n" + ] + }, + { + "cell_type": "code", + "execution_count": 97, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "28" + ] + }, + "execution_count": 97, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x.__sizeof__()" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(234.34+0j)" + ] + }, + "execution_count": 98, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "complex('234.34')" + ] + }, + { + "cell_type": "code", + "execution_count": 99, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Integer : 24862842842\n", + "Float : 98374.2934\n", + "Complex : 32523.23+45j\n", + "\n", + "\n", + "\n", + "24862842842\n", + "98374.2934\n", + "(32523.23+45j)\n" + ] + } + ], + "source": [ + "x = int(input(\"Integer : \"))\n", + "y = float(input(\"Float : \"))\n", + "z = complex(input(\"Complex : \"))\n", + "print(type(x))\n", + "print(type(y))\n", + "print(type(z))\n", + "print(x)\n", + "print(y)\n", + "print(z)" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'124343'" + ] + }, + "execution_count": 100, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "str(124343)" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'[129492, 2424, 24, 24]'" + ] + }, + "execution_count": 101, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "str([129492,2424,24,24,])" + ] + }, + { + "cell_type": "code", + "execution_count": 102, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'(234, 34, 343)'" + ] + }, + "execution_count": 102, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "str((234,34,343,))" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "\"{'helo': 'hi', 'bye': 'bye bye'}\"" + ] + }, + "execution_count": 103, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "str({'helo':'hi','bye':'bye bye'})" + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['p', 'y', 't', 'h', 'o', 'n']" + ] + }, + "execution_count": 104, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "list('python')" + ] + }, + { + "cell_type": "code", + "execution_count": 107, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['hello', 'bye']" + ] + }, + "execution_count": 107, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "d = { 'hello':'hi','bye':'bye bye'}\n", + "list(d)" + ] + }, + { + "cell_type": "code", + "execution_count": 108, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('hello', 'hi'), ('bye', 'bye bye')]" + ] + }, + "execution_count": 108, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "list(d.items())" + ] + }, + { + "cell_type": "code", + "execution_count": 109, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['hello', 'bye']" + ] + }, + "execution_count": 109, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "list(d.keys())" + ] + }, + { + "cell_type": "code", + "execution_count": 110, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['hi', 'bye bye']" + ] + }, + "execution_count": 110, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "list(d.values())" + ] + }, + { + "cell_type": "code", + "execution_count": 113, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "('hi', 'bye bye')" + ] + }, + "execution_count": 113, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tuple(d.values())" + ] + }, + { + "cell_type": "code", + "execution_count": 118, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "t = ( ['name','python'],('version',3.7),('future',None) )" + ] + }, + { + "cell_type": "code", + "execution_count": 119, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(['name', 'python'], ('version', 3.7), ('future', None))" + ] + }, + "execution_count": 119, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "t" + ] + }, + { + "cell_type": "code", + "execution_count": 116, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "d = dict(t)" + ] + }, + { + "cell_type": "code", + "execution_count": 117, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'name': 'python', 'version': 3.7}" + ] + }, + "execution_count": 117, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "d" + ] + }, + { + "cell_type": "code", + "execution_count": 120, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'a': 'b', 'c': 'd', 'd': 'e', 'h': 'i'}" + ] + }, + "execution_count": 120, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "l = ['hi','ab','cd','de']\n", + "d = dict(l)\n", + "d" + ] + }, + { + "cell_type": "code", + "execution_count": 121, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{1, 2, 3, 5, 12, 23, 24, 34, 111, 423, 3424}" + ] + }, + "execution_count": 121, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "set([12,34,3424,5,3,2,3,423,24,23,24,2,1,1,1,111])" + ] + }, + { + "cell_type": "code", + "execution_count": 129, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "x = 5\n", + "y = 6" + ] + }, + { + "cell_type": "code", + "execution_count": 130, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1626366240" + ] + }, + "execution_count": 130, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "id(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 131, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1626366272" + ] + }, + "execution_count": 131, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "id(y)" + ] + }, + { + "cell_type": "code", + "execution_count": 132, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 132, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x is y" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Name of Candidate : sachin\n", + "Age of Candidate : 22\n", + "Candidate Blongs to : india\n", + "Language that person speaks : hindi\n" + ] + } + ], + "source": [ + "#Dictionary \n", + "info = { 'name':'sachin','age':22,'country':'india','language':'hindi'}\n", + "print(\"Name of Candidate : \",info['name'])\n", + "print(\"Age of Candidate : \",info['age'])\n", + "print(\"Candidate Blongs to : \",info['country'])\n", + "print(\"Language that person speaks : \",info['language'])" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(info))" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_keys(['name', 'age', 'country', 'language'])" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info.keys()" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_values(['sachin', 22, 'india', 'hindi'])" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info.values()" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_items([('name', 'sachin'), ('age', 22), ('country', 'india'), ('language', 'hindi')])" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info.items()" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'raam raam'" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info.get('hariom','raam raam')" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'sachin'" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info.get('name','hari om')" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'age': 22, 'country': 'india', 'language': 'hindi', 'name': 'sachin yadav'}" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['name'] = 'sachin yadav'\n", + "info" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [], + "source": [ + "info.update([('one',1),])" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'name': 'sachin yadav',\n", + " 'age': 22,\n", + " 'country': 'india',\n", + " 'language': 'hindi',\n", + " 'one': 1,\n", + " 1: 2}" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "info.update([('name','python'),('age',21),])" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'name': 'python',\n", + " 'age': 21,\n", + " 'country': 'india',\n", + " 'language': 'hindi',\n", + " 'one': 1,\n", + " 1: 2}" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "#set" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "myset = { 'hello','hi','hello','hi',1,1,1,1,1,1,1,1,1,2,3,4,5,'jai','bhole','ki'}" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'hi', 2, 3, 'hello', 1, 4, 5, 'jai', 'bhole', 'ki'}" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "myset" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__iand__', '__init__', '__init_subclass__', '__ior__', '__isub__', '__iter__', '__ixor__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'add', 'clear', 'copy', 'difference', 'difference_update', 'discard', 'intersection', 'intersection_update', 'isdisjoint', 'issubset', 'issuperset', 'pop', 'remove', 'symmetric_difference', 'symmetric_difference_update', 'union', 'update']\n" + ] + } + ], + "source": [ + "print(dir(myset))" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s1 = { 1,2,3,4,5,6,7}\n", + "s2 = { 5,6,7,8,9,10,11,12}" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{1, 2, 3, 4, 5, 6, 7}" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s1" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{5, 6, 7, 8, 9, 10, 11, 12}" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s2" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{5, 6, 7}" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s1.intersection(s2)" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{8, 9, 10, 11, 12}" + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s2.difference(s1)" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s1.union(s2)" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s1.issubset(s2)" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [], + "source": [ + "s = { 1,2,3,4,5,6,7,8,9,10,11,12}" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.issuperset(s1)" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s2.issubset(s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Type conversion

    " + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a integer : 123234\n", + "\n" + ] + }, + { + "data": { + "text/plain": [ + "'123234'" + ] + }, + "execution_count": 45, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x = input(\"Enter a integer : \")\n", + "print(type(x))\n", + "x" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + }, + { + "data": { + "text/plain": [ + "123234" + ] + }, + "execution_count": 46, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "y = int(x)\n", + "print(type(y))\n", + "y" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + }, + { + "data": { + "text/plain": [ + "11259375" + ] + }, + "execution_count": 48, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "y = int('abcdef',16)\n", + "print(type(y))\n", + "y" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "21\n" + ] + } + ], + "source": [ + "y = int('010101',2)\n", + "print(y)" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "342391\n" + ] + } + ], + "source": [ + "y = int('1234567',8)\n", + "print(y)" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'0b10101100'" + ] + }, + "execution_count": 52, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x = bin(172)\n", + "x" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "str" + ] + }, + "execution_count": 53, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "type(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'0xa'" + ] + }, + "execution_count": 57, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "hex(10)" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'0o4555275'" + ] + }, + "execution_count": 58, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "oct(1235645)" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a number : 12343456.234232\n" + ] + }, + { + "data": { + "text/plain": [ + "12343456.234232" + ] + }, + "execution_count": 59, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "float(input(\"Enter a number : \"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(35434+3434j)" + ] + }, + "execution_count": 60, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "complex('35434+3434j')" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": {}, + "outputs": [], + "source": [ + "s = str([1,23,34,4])" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "']4 ,43 ,32 ,1['" + ] + }, + "execution_count": 64, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s[::-1]" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['p', 'y', 't', 'h', 'o', 'n']" + ] + }, + "execution_count": 65, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "list('python')" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['hey', 'bye', 'x']" + ] + }, + "execution_count": 66, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "d = { 'hey':'hello','bye':'bye bye','x':1234 }\n", + "list(d)" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(1, 2, 3, 'hello', 'hi')" + ] + }, + "execution_count": 67, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tuple([1,2,3,'hello','hi'])" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'b', 'h', 'n', 'o', 'p', 't', 'y'}" + ] + }, + "execution_count": 68, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "set('pythobn')" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "k = [ ('name','python'), ('version',3.7), ('father','Guido Van Rossum'),'hi','ab']" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'a': 'b',\n", + " 'father': 'Guido Van Rossum',\n", + " 'h': 'i',\n", + " 'name': 'python',\n", + " 'version': 3.7}" + ] + }, + "execution_count": 71, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dict(k)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Control_Statements (1).html b/python_ipynb/Control_Statements (1).html new file mode 100644 index 0000000..234665e --- /dev/null +++ b/python_ipynb/Control_Statements (1).html @@ -0,0 +1,13495 @@ + + + + +Control_Statements + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +

    Decesion Statements

    +
    +
    +
    +
    +
    +
    In [9]:
    +
    +
    +
    #if-else
    +print("Helloo") 
    +    print("good to go")
    +print("hi")
    +print("bye")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +  File "<ipython-input-9-53d4eb834bc2>", line 3
    +    print("good to go")
    +    ^
    +IndentationError: unexpected indent
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    print("Hello World")
    +if 0:
    +    print("hi")
    +    print("This is indentation")
    +    print("Python is beautiful beacuse of indentation")
    +    
    +print("I am out")
    +print("Bye")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World
    +I am out
    +Bye
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    print("Start")
    +if 'None' : 
    +    print("Good to go ")
    +    if 3 > 5 or 5 < 6 : 
    +        print("I am good")
    +        if (25/5)+(5*6)-35 : 
    +            print("hey")
    +        elif 6 % 2 : 
    +            print("hi")
    +        else :
    +            print("hello")
    +    elif 'something' : 
    +        print("by by")
    +else :
    +    print("BYE BYE")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Start
    +Good to go 
    +I am good
    +hello
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    if print("Hello World") :
    +    print("Hey how are you ")
    +else :
    +    print("bye bye world")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World
    +bye bye world
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    x = print("hello")
    +print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    hello
    +None
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    if int(input("Enter a number : ")) % 2 : 
    +    print("Hello World")
    +else :
    +    print("Bye World")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter a number : 5
    +Hello World
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    x = int(input("Enter a number : "))
    +if x % 2 : 
    +    print("%d is an odd number."%(x))
    +else :
    +    print("%d is an even number."%(x))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter a number : 7
    +7 is an odd number.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    p = int(input("P : "))
    +q = int(input("Q : "))
    +r = int(input("R : "))
    +s = int(input("S : "))
    +
    +#write code to print greatest number ? 
    +
    +if p >= q and p >= r and p >= s : 
    +    print("{} is greatest".format(p))
    +elif q >= p and q >= r and q >= s : 
    +    print("{} is greatest".format(q))
    +elif r >= p and r >= q and r >= s : 
    +    print("{} is greatest".format(r))
    +else :
    +    print("{} is greatest".format(s))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    P : 1
    +Q : 1
    +R : 3
    +S : 1
    +3 is greatest
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [22]:
    +
    +
    +
    from getpass import getpass
    +
    +x = getpass("x : ")
    +y = getpass("Y  : ")
    +z = getpass()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    x : ········
    +Y  : ········
    +········
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/Control_Statements (1).ipynb b/python_ipynb/Control_Statements (1).ipynb new file mode 100644 index 0000000..264804d --- /dev/null +++ b/python_ipynb/Control_Statements (1).ipynb @@ -0,0 +1,264 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Decesion Statements" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "ename": "IndentationError", + "evalue": "unexpected indent (, line 3)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m3\u001b[0m\n\u001b[1;33m print(\"good to go\")\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mIndentationError\u001b[0m\u001b[1;31m:\u001b[0m unexpected indent\n" + ] + } + ], + "source": [ + "#if-else\n", + "print(\"Helloo\") \n", + " print(\"good to go\")\n", + "print(\"hi\")\n", + "print(\"bye\")" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\n", + "I am out\n", + "Bye\n" + ] + } + ], + "source": [ + "print(\"Hello World\")\n", + "if 0:\n", + " print(\"hi\")\n", + " print(\"This is indentation\")\n", + " print(\"Python is beautiful beacuse of indentation\")\n", + " \n", + "print(\"I am out\")\n", + "print(\"Bye\")" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Start\n", + "Good to go \n", + "I am good\n", + "hello\n" + ] + } + ], + "source": [ + "print(\"Start\")\n", + "if 'None' : \n", + " print(\"Good to go \")\n", + " if 3 > 5 or 5 < 6 : \n", + " print(\"I am good\")\n", + " if (25/5)+(5*6)-35 : \n", + " print(\"hey\")\n", + " elif 6 % 2 : \n", + " print(\"hi\")\n", + " else :\n", + " print(\"hello\")\n", + " elif 'something' : \n", + " print(\"by by\")\n", + "else :\n", + " print(\"BYE BYE\")" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\n", + "bye bye world\n" + ] + } + ], + "source": [ + "if print(\"Hello World\") :\n", + " print(\"Hey how are you \")\n", + "else :\n", + " print(\"bye bye world\")" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello\n", + "None\n" + ] + } + ], + "source": [ + "x = print(\"hello\")\n", + "print(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a number : 5\n", + "Hello World\n" + ] + } + ], + "source": [ + "if int(input(\"Enter a number : \")) % 2 : \n", + " print(\"Hello World\")\n", + "else :\n", + " print(\"Bye World\")" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a number : 7\n", + "7 is an odd number.\n" + ] + } + ], + "source": [ + "x = int(input(\"Enter a number : \"))\n", + "if x % 2 : \n", + " print(\"%d is an odd number.\"%(x))\n", + "else :\n", + " print(\"%d is an even number.\"%(x))" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "P : 1\n", + "Q : 1\n", + "R : 3\n", + "S : 1\n", + "3 is greatest\n" + ] + } + ], + "source": [ + "p = int(input(\"P : \"))\n", + "q = int(input(\"Q : \"))\n", + "r = int(input(\"R : \"))\n", + "s = int(input(\"S : \"))\n", + "\n", + "#write code to print greatest number ? \n", + "\n", + "if p >= q and p >= r and p >= s : \n", + " print(\"{} is greatest\".format(p))\n", + "elif q >= p and q >= r and q >= s : \n", + " print(\"{} is greatest\".format(q))\n", + "elif r >= p and r >= q and r >= s : \n", + " print(\"{} is greatest\".format(r))\n", + "else :\n", + " print(\"{} is greatest\".format(s))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x : ········\n", + "Y : ········\n", + "········\n" + ] + } + ], + "source": [ + "from getpass import getpass\n", + "\n", + "x = getpass(\"x : \")\n", + "y = getpass(\"Y : \")\n", + "z = getpass()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Control_Statements.html b/python_ipynb/Control_Statements.html new file mode 100644 index 0000000..234665e --- /dev/null +++ b/python_ipynb/Control_Statements.html @@ -0,0 +1,13495 @@ + + + + +Control_Statements + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +

    Decesion Statements

    +
    +
    +
    +
    +
    +
    In [9]:
    +
    +
    +
    #if-else
    +print("Helloo") 
    +    print("good to go")
    +print("hi")
    +print("bye")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +  File "<ipython-input-9-53d4eb834bc2>", line 3
    +    print("good to go")
    +    ^
    +IndentationError: unexpected indent
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    print("Hello World")
    +if 0:
    +    print("hi")
    +    print("This is indentation")
    +    print("Python is beautiful beacuse of indentation")
    +    
    +print("I am out")
    +print("Bye")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World
    +I am out
    +Bye
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    print("Start")
    +if 'None' : 
    +    print("Good to go ")
    +    if 3 > 5 or 5 < 6 : 
    +        print("I am good")
    +        if (25/5)+(5*6)-35 : 
    +            print("hey")
    +        elif 6 % 2 : 
    +            print("hi")
    +        else :
    +            print("hello")
    +    elif 'something' : 
    +        print("by by")
    +else :
    +    print("BYE BYE")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Start
    +Good to go 
    +I am good
    +hello
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    if print("Hello World") :
    +    print("Hey how are you ")
    +else :
    +    print("bye bye world")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World
    +bye bye world
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    x = print("hello")
    +print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    hello
    +None
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    if int(input("Enter a number : ")) % 2 : 
    +    print("Hello World")
    +else :
    +    print("Bye World")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter a number : 5
    +Hello World
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    x = int(input("Enter a number : "))
    +if x % 2 : 
    +    print("%d is an odd number."%(x))
    +else :
    +    print("%d is an even number."%(x))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter a number : 7
    +7 is an odd number.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    p = int(input("P : "))
    +q = int(input("Q : "))
    +r = int(input("R : "))
    +s = int(input("S : "))
    +
    +#write code to print greatest number ? 
    +
    +if p >= q and p >= r and p >= s : 
    +    print("{} is greatest".format(p))
    +elif q >= p and q >= r and q >= s : 
    +    print("{} is greatest".format(q))
    +elif r >= p and r >= q and r >= s : 
    +    print("{} is greatest".format(r))
    +else :
    +    print("{} is greatest".format(s))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    P : 1
    +Q : 1
    +R : 3
    +S : 1
    +3 is greatest
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [22]:
    +
    +
    +
    from getpass import getpass
    +
    +x = getpass("x : ")
    +y = getpass("Y  : ")
    +z = getpass()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    x : ········
    +Y  : ········
    +········
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/Control_Statements.ipynb b/python_ipynb/Control_Statements.ipynb new file mode 100644 index 0000000..264804d --- /dev/null +++ b/python_ipynb/Control_Statements.ipynb @@ -0,0 +1,264 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Decesion Statements" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "ename": "IndentationError", + "evalue": "unexpected indent (, line 3)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m3\u001b[0m\n\u001b[1;33m print(\"good to go\")\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mIndentationError\u001b[0m\u001b[1;31m:\u001b[0m unexpected indent\n" + ] + } + ], + "source": [ + "#if-else\n", + "print(\"Helloo\") \n", + " print(\"good to go\")\n", + "print(\"hi\")\n", + "print(\"bye\")" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\n", + "I am out\n", + "Bye\n" + ] + } + ], + "source": [ + "print(\"Hello World\")\n", + "if 0:\n", + " print(\"hi\")\n", + " print(\"This is indentation\")\n", + " print(\"Python is beautiful beacuse of indentation\")\n", + " \n", + "print(\"I am out\")\n", + "print(\"Bye\")" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Start\n", + "Good to go \n", + "I am good\n", + "hello\n" + ] + } + ], + "source": [ + "print(\"Start\")\n", + "if 'None' : \n", + " print(\"Good to go \")\n", + " if 3 > 5 or 5 < 6 : \n", + " print(\"I am good\")\n", + " if (25/5)+(5*6)-35 : \n", + " print(\"hey\")\n", + " elif 6 % 2 : \n", + " print(\"hi\")\n", + " else :\n", + " print(\"hello\")\n", + " elif 'something' : \n", + " print(\"by by\")\n", + "else :\n", + " print(\"BYE BYE\")" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\n", + "bye bye world\n" + ] + } + ], + "source": [ + "if print(\"Hello World\") :\n", + " print(\"Hey how are you \")\n", + "else :\n", + " print(\"bye bye world\")" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello\n", + "None\n" + ] + } + ], + "source": [ + "x = print(\"hello\")\n", + "print(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a number : 5\n", + "Hello World\n" + ] + } + ], + "source": [ + "if int(input(\"Enter a number : \")) % 2 : \n", + " print(\"Hello World\")\n", + "else :\n", + " print(\"Bye World\")" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a number : 7\n", + "7 is an odd number.\n" + ] + } + ], + "source": [ + "x = int(input(\"Enter a number : \"))\n", + "if x % 2 : \n", + " print(\"%d is an odd number.\"%(x))\n", + "else :\n", + " print(\"%d is an even number.\"%(x))" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "P : 1\n", + "Q : 1\n", + "R : 3\n", + "S : 1\n", + "3 is greatest\n" + ] + } + ], + "source": [ + "p = int(input(\"P : \"))\n", + "q = int(input(\"Q : \"))\n", + "r = int(input(\"R : \"))\n", + "s = int(input(\"S : \"))\n", + "\n", + "#write code to print greatest number ? \n", + "\n", + "if p >= q and p >= r and p >= s : \n", + " print(\"{} is greatest\".format(p))\n", + "elif q >= p and q >= r and q >= s : \n", + " print(\"{} is greatest\".format(q))\n", + "elif r >= p and r >= q and r >= s : \n", + " print(\"{} is greatest\".format(r))\n", + "else :\n", + " print(\"{} is greatest\".format(s))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x : ········\n", + "Y : ········\n", + "········\n" + ] + } + ], + "source": [ + "from getpass import getpass\n", + "\n", + "x = getpass(\"x : \")\n", + "y = getpass(\"Y : \")\n", + "z = getpass()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/DataType (1).html b/python_ipynb/DataType (1).html new file mode 100644 index 0000000..41d610b --- /dev/null +++ b/python_ipynb/DataType (1).html @@ -0,0 +1,15080 @@ + + + + +DataType + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    In [1]:
    +
    +
    +
    print("Hello world")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello world
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    import matplotlib.pyplot as plt 
    +import numpy as np 
    +
    +x = np.linspace(0,2*np.pi,360)
    +sin = np.sin(x)
    +cos = np.cos(x)
    +plt.plot(x,sin,'r')
    +plt.plot(x,cos,'g')
    +plt.show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + + + +
    + +
    + +
    + +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
    import os
    +print(os.path)
    +
    + +
    +
    +
    + +
    +
    +
    +
    +

    DataTypes

    +
      +
    1. Numbers --> int,float,complex
    2. +
    3. Strings
    4. +
    5. List
    6. +
    7. Tuples
    8. +
    9. Dictionary
    10. +
    11. Set
    12. +
    13. FrozenSets
    14. +
    15. Boolean-->True, False
    16. +
    +
    +
    +
    +
    +
    +
    In [1]:
    +
    +
    +
    0.1+0.2-0.3
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[1]:
    + + + + +
    +
    5.551115123125783e-17
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    import decimal
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    decimal.getcontext()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[3]:
    + + + + +
    +
    Context(prec=28, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999, capitals=1, clamp=0, flags=[], traps=[InvalidOperation, DivisionByZero, Overflow])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    decimal.getcontext().prec = 2
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    decimal.Decimal('0.1')+decimal.Decimal('0.2')-decimal.Decimal('0.3')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[5]:
    + + + + +
    +
    Decimal('0.0')
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    python = { 
    +    'name' : 'python',
    +    'version' : 3.7,
    +    'release':1994,
    +    'scope' : [ 's/w dev','ml','data science'],
    +    'modules' : {
    +        'web' : ['flask','django','web2py'],
    +        'gui' : ['tkinter','kivi','wxpython'],
    +        'data' : ['pandas','numpy','stats','Decimal'],
    +        'ml' : ['scikit-learn','tenserflow'],
    +        'automation' : ['ansible','salt']
    +    },
    +    'father' : 'Guido Van Rossum'
    +     }
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'name': 'python', 'version': 3.7, 'release': 1994, 'scope': ['s/w dev', 'ml', 'data science'], 'modules': {'web': ['flask', 'django', 'web2py'], 'gui': ['tkinter', 'kivi', 'wxpython'], 'data': ['pandas', 'numpy', 'stats', 'Decimal'], 'ml': ['scikit-learn', 'tenserflow'], 'automation': ['ansible', 'salt']}, 'father': 'Guido Van Rossum'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    from pprint import pprint
    +pprint(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'father': 'Guido Van Rossum',
    + 'modules': {'automation': ['ansible', 'salt'],
    +             'data': ['pandas', 'numpy', 'stats', 'Decimal'],
    +             'gui': ['tkinter', 'kivi', 'wxpython'],
    +             'ml': ['scikit-learn', 'tenserflow'],
    +             'web': ['flask', 'django', 'web2py']},
    + 'name': 'python',
    + 'release': 1994,
    + 'scope': ['s/w dev', 'ml', 'data science'],
    + 'version': 3.7}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    python['name'].upper()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[6]:
    + + + + +
    +
    'PYTHON'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    python['scope'].sort()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    python['scope']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[10]:
    + + + + +
    +
    ['data science', 'ml', 's/w dev']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    python['modules']['data'][::-1]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[13]:
    + + + + +
    +
    ['Decimal', 'stats', 'numpy', 'pandas']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    dir(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[14]:
    + + + + +
    +
    ['__class__',
    + '__contains__',
    + '__delattr__',
    + '__delitem__',
    + '__dir__',
    + '__doc__',
    + '__eq__',
    + '__format__',
    + '__ge__',
    + '__getattribute__',
    + '__getitem__',
    + '__gt__',
    + '__hash__',
    + '__init__',
    + '__init_subclass__',
    + '__iter__',
    + '__le__',
    + '__len__',
    + '__lt__',
    + '__ne__',
    + '__new__',
    + '__reduce__',
    + '__reduce_ex__',
    + '__repr__',
    + '__setattr__',
    + '__setitem__',
    + '__sizeof__',
    + '__str__',
    + '__subclasshook__',
    + 'clear',
    + 'copy',
    + 'fromkeys',
    + 'get',
    + 'items',
    + 'keys',
    + 'pop',
    + 'popitem',
    + 'setdefault',
    + 'update',
    + 'values']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    python['Name']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +-----------------------------------------------
    +KeyError      Traceback (most recent call last)
    +<ipython-input-16-fad93d760fcf> in <module>()
    +----> 1 python['Name']
    +
    +KeyError: 'Name'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    hash('name')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[17]:
    + + + + +
    +
    7628194596339931819
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [29]:
    +
    +
    +
    hash("Name")
    +print(*'python')
    +print(*[1,2,3])
    +python.keys()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    p y t h o n
    +1 2 3
    +
    +
    +
    + +
    + +
    Out[29]:
    + + + + +
    +
    dict_keys(['name', 'version', 'release', 'scope', 'modules', 'father'])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [30]:
    +
    +
    +
    print("Here are keys of python : ",*python.keys())
    +python[input("Enter key to find value : ")]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Here are keys of python :  name version release scope modules father
    +Enter key to find value : salkf
    +
    +
    +
    + +
    + +
    + + +
    +
    +-----------------------------------------------
    +KeyError      Traceback (most recent call last)
    +<ipython-input-30-d9105e6c78b0> in <module>()
    +      1 print("Here are keys of python : ",*python.keys())
    +----> 2 python[input("Enter key to find value : ")]
    +
    +KeyError: 'salkf'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [33]:
    +
    +
    +
    help(print)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Help on built-in function print in module builtins:
    +
    +print(...)
    +    print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
    +    
    +    Prints the values to a stream, or to sys.stdout by default.
    +    Optional keyword arguments:
    +    file:  a file-like object (stream); defaults to the current sys.stdout.
    +    sep:   string inserted between values, default a space.
    +    end:   string appended after the last value, default a newline.
    +    flush: whether to forcibly flush the stream.
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [37]:
    +
    +
    +
    print('value1','value2',1,2,3,4,sep='\n')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    value1
    +value2
    +1
    +2
    +3
    +4
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [41]:
    +
    +
    +
    print("Hello","World",end='\t')
    +print("Bye","World")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World	Bye World
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [42]:
    +
    +
    +
    print('python')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    python
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [45]:
    +
    +
    +
    print(*'pyhton',sep='\n')#print('p','y','h','t','o','n')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    p
    +y
    +h
    +t
    +o
    +n
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [46]:
    +
    +
    +
    print(*python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    name version release scope modules father
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [47]:
    +
    +
    +
    fp = open('C:/users/sachin/desktop/arya.txt','w')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [49]:
    +
    +
    +
    print("Hello World","This is Awesom.","Python is \
    +easy",sep='\n',file=fp)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [50]:
    +
    +
    +
    fp.close()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [51]:
    +
    +
    +
    python['abccadre']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +-----------------------------------------------
    +KeyError      Traceback (most recent call last)
    +<ipython-input-51-6b52b6c67615> in <module>()
    +----> 1 python['abccadre']
    +
    +KeyError: 'abccadre'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [56]:
    +
    +
    +
    #python.get('key','msg')
    +
    +python.get(input("key : ").strip().lower(),"NO such key exists")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    key : abracadara
    +
    +
    +
    + +
    + +
    Out[56]:
    + + + + +
    +
    'NO such key exists'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [1]:
    +
    +
    +
    l = [ 'hello',1,2,'hi','bye',name]
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +NameError                                 Traceback (most recent call last)
    +<ipython-input-1-5b46cf157e35> in <module>()
    +----> 1 l = [ 'hello',1,2,'hi','bye',name]
    +      2 print(l)
    +
    +NameError: name 'name' is not defined
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    name = 'sachin'
    +data = [ 1,2,3,4,5,5]
    +x = [1,2,3]
    +y  = 'my name'
    +z = { 'hello':'bye','hi':'hi'}
    +
    +mylist = [ 'python','is',name,data,x,y,z]
    +print(mylist)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['python', 'is', 'sachin', [1, 2, 3, 4, 5, 5], [1, 2, 3], 'my name', {'hello': 'bye', 'hi': 'hi'}]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    print(data)
    +mylist[3][3]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 3, 4, 5, 5]
    +
    +
    +
    + +
    + +
    Out[5]:
    + + + + +
    +
    4
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    data.extend('python')
    +print(data)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 3, 4, 5, 5, 'p', 'y', 't', 'h', 'o', 'n']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    print(mylist)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['python', 'is', 'sachin', [1, 2, 3, 4, 5, 5, 'p', 'y', 't', 'h', 'o', 'n'], [1, 2, 3], 'my name', {'hello': 'bye', 'hi': 'hi'}]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    d = { (1,2) : 'hello'}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    d
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[9]:
    + + + + +
    +
    {(1, 2): 'hello'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    d.get((1,3),'bye')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[11]:
    + + + + +
    +
    'bye'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    d = { [1,2] : 'hi'}
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +TypeError                                 Traceback (most recent call last)
    +<ipython-input-12-dbf6ad030b81> in <module>()
    +----> 1 d = { [1,2] : 'hi'}
    +
    +TypeError: unhashable type: 'list'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    enc_key  = { 'a':'b','b':'c','c':'d',}
    +dec_key = {}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    #leap year
    +year = int(input("Enter a year : "))
    +if year % 4 == 0 and year % 100 == 0 and year % 400 == 0 : 
    +    print("Leap Year")
    +else : 
    +    print("Not a Leap Year")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter a year : 2016
    +Not a Leap Year
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    year = int(input("Enter a Year : "))
    +
    +if year % 4 : 
    +    print("Not a Leap Year")
    +    
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter a Year : 2013
    +Not a Leap Year
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    num = int(input("Enter a number : "))
    +if num % 2 : 
    +    print(f"{num} is an Odd Number.")
    +else : 
    +    print(f'{num} is an EVen Number.')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter a number : 23
    +23 is an Odd Number.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    while input() : 
    +    print("Hello World")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    k
    +Hello World
    +h
    +Hello World
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [21]:
    +
    +
    +
    year = int(input("Enter a Year : "))
    +if year % 4 : 
    +    print(f"{year} is Not a Leap Year.")
    +else : 
    +    if year % 100 : 
    +        print(f"{year} is a Leap Year.")
    +    else : 
    +        if year % 400 : 
    +            print(f"{year} is not a Leap Year.")
    +        else : 
    +            print(f"{year} is a Leap Year.")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter a Year : 2011
    +2011 is Not a Leap Year.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    year = int(input("Enter a Year : "))
    +if year % 4 : 
    +    print(f"{year} is Not a Leap Year.")
    +else : 
    +    if (year % 100 ) or (year % 100 == 0 and year % 400 == 0 ) : 
    +        print(f"{year} is a Leap Year.")
    +    else : 
    +        print(f"{year} is not a Leap Year.")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter a Year : 2013
    +2013 is Not a Leap Year.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [31]:
    +
    +
    +
    year = int(input("Enter a Year : "))
    +if year % 4 == 0 and ( year % 100 or year % 400 == 0) : 
    +    print(f"{year} is a Leap Year.")
    +else : 
    +    print(f"{year} is Not a Leap Year.")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter a Year : 2013
    +2013 is Not a Leap Year.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [36]:
    +
    +
    +
    c = 1
    +while c <= 10 : 
    +    if c == 5 : 
    +        break
    +    print(f"{c} Times Hello World ")
    +    c = c + 1
    +else : 
    +    print("Loop is Successfully Executed")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    1 Times Hello World 
    +2 Times Hello World 
    +3 Times Hello World 
    +4 Times Hello World 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [40]:
    +
    +
    +
    i = 0
    +while i <= 10 : 
    +    j = 0 
    +    print(f"i={i}",end=', ')
    +    while j <= 10 : 
    +        print(f"j={j}",end=', ')
    +        if j == 5 : 
    +            break
    +        j = j + 1
    +    print()
    +    i = i + 1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    i=0, j=0, j=1, j=2, j=3, j=4, j=5, 
    +i=1, j=0, j=1, j=2, j=3, j=4, j=5, 
    +i=2, j=0, j=1, j=2, j=3, j=4, j=5, 
    +i=3, j=0, j=1, j=2, j=3, j=4, j=5, 
    +i=4, j=0, j=1, j=2, j=3, j=4, j=5, 
    +i=5, j=0, j=1, j=2, j=3, j=4, j=5, 
    +i=6, j=0, j=1, j=2, j=3, j=4, j=5, 
    +i=7, j=0, j=1, j=2, j=3, j=4, j=5, 
    +i=8, j=0, j=1, j=2, j=3, j=4, j=5, 
    +i=9, j=0, j=1, j=2, j=3, j=4, j=5, 
    +i=10, j=0, j=1, j=2, j=3, j=4, j=5, 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [41]:
    +
    +
    +
    c = 1 
    +while c <= 10 : 
    +    print("*"*c)
    +    c = c  + 1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    *
    +**
    +***
    +****
    +*****
    +******
    +*******
    +********
    +*********
    +**********
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [42]:
    +
    +
    +
    c = 1 
    +while c <= 10 : 
    +    print("*"*(10-c))
    +    c = c  + 1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    *********
    +********
    +*******
    +******
    +*****
    +****
    +***
    +**
    +*
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [1]:
    +
    +
    +
    c = 1 
    +while c <= 10 : 
    +    print(" "*(10-c),end='')
    +    print("*"*c)
    +    c = c + 1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
             *
    +        **
    +       ***
    +      ****
    +     *****
    +    ******
    +   *******
    +  ********
    + *********
    +**********
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    c = 1 
    +while c <= 10 : 
    +    print(" "*c,end='')
    +    print("*"*(10-c))
    +    c = c + 1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
     *********
    +  ********
    +   *******
    +    ******
    +     *****
    +      ****
    +       ***
    +        **
    +         *
    +          
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    row = 1
    +while row <= 10 : 
    +    col = 1
    +    while col <= row : 
    +        print("*",end='')
    +        col = col + 1
    +    print()
    +    row += 1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    *
    +**
    +***
    +****
    +*****
    +******
    +*******
    +********
    +*********
    +**********
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    row = 1
    +while row <= 10 : 
    +    col = 1
    +    while col <= 10-row : 
    +        print("*",end='')
    +        col = col + 1
    +    print()
    +    row += 1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    *********
    +********
    +*******
    +******
    +*****
    +****
    +***
    +**
    +*
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/DataType (1).ipynb b/python_ipynb/DataType (1).ipynb new file mode 100644 index 0000000..c61ace3 --- /dev/null +++ b/python_ipynb/DataType (1).ipynb @@ -0,0 +1,1284 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello world\n" + ] + } + ], + "source": [ + "print(\"Hello world\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAD8CAYAAABzTgP2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3Xd4k9X7x/H33c3ee09BHCBlg4IMUZHxY4osQRBliewl0DJlOXAwHAzZCrKRjYogLXtT9ihQprKhPb8/Tuq3QKFpm+RJ2vO6rlxtkid5PmX0znnOEqUUhmEYhhHNy+oAhmEYhnsxhcEwDMN4iCkMhmEYxkNMYTAMwzAeYgqDYRiG8RBTGAzDMIyHmMJgGIZhPMQUBsMwDOMhpjAYhmEYD/GxOkBCZM6cWeXPn9/qGIZhGB4lNDT0klIqS1zHeWRhyJ8/PyEhIVbHMAzD8CgictKe48ylJMMwDOMhpjAYhmEYDzGFwTAMw3iIKQyGYRjGQ0xhMAzDMB7ikMIgIt+LyEUR2fuE50VEvhCRMBHZLSIvxXiutYgcsd1aOyKPYRiGkXCOajH8CNR+yvOvA0Vstw7ANwAikhEYDJQDygKDRSSDgzIZhmEYCeCQeQxKqU0ikv8ph9QDpiu9j+gWEUkvIjmAqsBqpdQVABFZjS4wsx2R61Ezds3g5PWTpPVPSzr/dBTKWIhimYuROWVmZ5zO8/zzDxw6BEeOwOXLcOMG3L8PadNC+vSQNy889xxkzWp1UsNI8u5F3iPsShgHLx3k4s2L/HP3H/65+w/dy3cnU8pMTj23qya45QJOx7h/xvbYkx5/jIh0QLc2yJs3b4JCzN03l2VHlj32eO60ualeoDo1CtagTtE6pA9In6D39zh378LKlbB6NaxdCwcP2ve6rFnh1VfhtdfgjTdMoTAMB1BKseXMFlaErWDNsTVsO7eNB1EPHjrGS7xo/nzzJFMYJJbH1FMef/xBpSYDkwECAwNjPSYuS5sv5X7kff699y9Xbl/hyOUj7I/Yz9azW1lyeAnTdk3D39uf+sXq065UO2oUrIFIbBE93I4d8O23MG8eXLsGqVJBlSrQsiUULw7PPKN/2adODb6+uiVx9SocOwb79kFICKxZA3PmgI8PvPkmtG2rv3p7W/3TGYZHCf83nKnbpzJ993TCroThJV6UyVmGHhV68HzW5ymepTg50+QkjV8aUvqmdMnvJFcVhjNAnhj3cwPnbI9XfeTxDc4M4uvtS8YUGcmYIiOFMxbm9SKvAxCloth2dhszd89k1t5ZzN03l1LZS9G/Sn8aFGuAt1cS+IW3YQOMHAm//QYpU0KDBroYvPqqLgBPkiGDvhUsCDVq6MeUgl27YNYsmD4dfv1VF5T+/aF5c10wDMN4ouNXjzP6z9H8sPMH7kXeo1r+agysMpC6z9QlQwqLu1qVUg65AfmBvU947k1gBbqFUB742/Z4RuA4kMF2Ow5kjOtcpUuXVs505/4d9f3271WRL4oohqBemvSS+uPkH049p1MdPKjUG28oBUply6bUyJFKXb3quPe/d0+puXOVeuEFfY6iRZVavtxx728YSci129fUxys/Vj5BPsov2E+9v+R9FXY5zCXnBkKUPb/P7TkozjfRncXhwH10K6Ad0BHoaHtegK+Ao8AeIDDGa9sCYbbbu/acz9mFIdqDyAdq5q6ZKvf43IohqOY/N1cRNyNccm6HuH1bqd69lfLxUSpNGqU+/VSpW7ecd77ISKUWLlSqSBH9T+utt5Q6edJ55zMMDxIVFaVm7Jqhso7JqmSIqPd+fU+duX7GpRlcWhhcfXNVYYh24+4NNWjdIOUb5KuyjcmmFh9c7NLzJ8jffytVvLj+K27bVqnz51137rt3lRo9WqlUqZRKm1ap6dOViopy3fkNw81cuHFBNZjTQDEEVX5qeRVyNsSSHPYWBjPz2Q6p/FIRVC2IkA4hZE+dnbpz6tJxaUfuPrhrdbTHKQVjx0KFCvDvv7BqFXz3HWTL5roMfn7Quzfs3g3PPw+tWkHTpjqPYSQza4+t5bmvn2PZkWV8WuNT/nj3D0rnLG11rKcyhSEeXsj2An+3/5veFXszKXQSVX6owqnrp6yO9T///AONGkGvXrpjec8eqFXLujwFC8LGjbrD+5dfoGxZ+4fEGoaHU0ox6o9R1JpZiyypshDaIZRelXp5xEAWUxjiyc/bj9E1R/NLk184eOkgpSeXZvPpzVbHghMnoHx5PTpo/Hg9FDW9G8zH8PaGvn31XInLl3VxWL7c6lSG4VR3Htyh6YKm9Fvbj0bPNmLre1t5LutzVseymykMCdSgeAO2td9G+oD0VJ9enYUHFloXJiREF4XwcD2/oHt3cLf5F9WqQWgoFCkCdevqy1uGkQRdvnWZGtNrMH//fEbXGM2chnNI7Zfa6ljxYgpDIjyT+Rk2t91MyewlaTivIV/9/ZXrQ6xeDa+8AilSwObNULWq6zPYK08efWmpRg147z0YOlT3iRhGEnH6+mkqfV+Jbee2MbfRXHpX6u2Rk2RNYUikLKmysLbVWt565i06r+jM+L/Gu+7kK1fCW29B4cLw11961rK7S50aliyB1q1hyBB9mckUByMJOHX9FFWnVSX8RjirW66mSYkmVkdKMDM91QFS+qZkQeMFvPPLO/T4rQf3Iu/Rt3Jf55506VJo2BBKlNCthkzOXTvFoXx94fvv9ezrTz+FBw/0SCoP/GRlGAAnrp2g2rRqXL19ldUtV1M2V1mrIyWKKQwO4uvty6yGs/D19qXf2n74efvxcYWPnXOyJUt0UXjxRb28RQYPXKncywu++koXifHjdVEYM8YUB8PjnLh2gqo/VuX63eusabWGwJyBVkdKNFMYHMjHy4fp9adzL/IePX7rQaYUmWhd0sF7D23aBI0bQ8mSuii4w8ijhBKBzz6DyEgYN04v3Ne7t9WpDMNuF29epOaMmvxz9x/WtlrLSzleivtFHsAUBgfz9vJmZoOZXL9znXaL25E+ID31itVzzJvv2aNH9BQoACtWeHZRiCYCX3yhh7L26QOZM+uVWg3Dzd24d4M3Z73J2X/Osq71uiRTFMB0PjuFv48/vzT9hdI5S9N0QVM2ntiY+Dc9eRJq19adt6tWeVafQly8vGDaND0Zr317WLTI6kSG8VT3I+/TaF4jdoTvYF7jeZTPXd7qSA5lCoOTpPZLzfLmyymYoSAN5jYg7EpYwt/s6lW9Kc6tW3okUgI3KnJrfn7w889Qpgy8/baem2EYbkgpxXtL3mPV0VVMqjOJOkXrWB3J4UxhcKJMKTOxtPlSvMSLt2a/xbU71+L/Jg8eQLNmepOcX3/VW2smValTw+LFel2nevXg3DmrExnGY0b/OZrpu6YztOpQ2r3Uzuo4TmEKg5MVzFCQBU0WEHYljGYLmj22VV+c+vTRnczffAMvv+yckO4ka1ZdHK5fh/r14fZtqxMZxn+WHV5G/7X9afZcMwa9PMjqOE5jCoMLVM1fla/f+JpVR1fRY1UP+184bZoeytmlC7RLmp9MYvXCCzBzJmzbpmdImwlwhhs4eOkgzX9pTsnsJfmu7nceOaPZXg4pDCJSW0QOiUiYiDw2s0tEJojITtvtsIhci/FcZIznFjsijztqX7o93cp144u/v2DWnllxv2DrVujQQW+7OW6c8wO6m/r1YdgwvXXoeBfOJjeMWFy7c416c+rh7+3PomaLSOmb0upITiUqkZ/GRMQbOAzURO/etg14Wym1/wnHdwFKKaXa2u7fUErFa4WpwMBAFeKBnZP3I+/z6vRX2RG+g23tt1E8yxOWsLhyBUqV0qN1QkKS1gik+FBKT+RbskSvsVSxotWJjGRIKcX/zfs/lh5eyrpW66iSr4rVkRJMREKVUnHOwHNEi6EsEKaUOqaUugfMAZ42cP9t9FagyY6vty9zGs4hpW9KGs1vxM17Nx8/SClo00avlDpvXvItCqDnOHz/vV58r2lTuHTJ6kRGMjTx74ksOriI0TVGe3RRiA9HFIZcwOkY98/YHnuMiOQDCgDrYjwcICIhIrJFROo7II9by5U2F7MazuJAxAE+WPYBj7XYJkzQn5DHjtVDN5O79Olh/ny4eFHvBBcVZXUiIxkJPRdKz9U9qVO0Dt3Ld7c6jss4ojDE1gPzpOtTzYAFSqnIGI/ltTVtmgOfiUihWE8i0sFWQEIiIiISl9hiNQrWYPArg5mxewY/7vzxf09s2aJHITVooDucDa10ab10xooVetE9w3CB63eu02RBE7KlysaP9X5M0p3Nj3JEYTgD5IlxPzfwpAHozXjkMpJS6pzt6zFgA1AqthcqpSYrpQKVUoFZsmRJbGbLDXx5INXyV6Pryq4cvXJUb8vZrBnkzq03sUlG/wjt0rEjNGkCgwaZyW+G0ymleH/p+5y8dpI5jeaQKWXyuqTriMKwDSgiIgVExA/9y/+x0UUi8gyQAfgrxmMZRMTf9n1moBIQa6d1UuPt5c20+tPwFm9aLGzBg25d4PRpPQrHE1dLdTYR+PZbyJ4dWrTQs8ANw0lm7ZnF3H1zCaoWRMU8yW/QQ6ILg1LqAdAZWAUcAOYppfaJSJCI1I1x6NvAHPXwRfXiQIiI7ALWA6OeNJopKcqTLg/f1vmWLWe2MOL4dOjfHypUsDqW+8qQAX78EQ4dgl69rE5jJFGnr5+m0/JOVMxTkT6V+lgdxxKJHq5qBU8drhqr8+dp2T0fs4ve4493f6d8/spWJ3J/PXrouQ3LlsEbb1idxkhColQUtWbUYsuZLezquItCGWPt8vRYrhyuaiSUUtCuHRNXCLlS56DVkrbcum8ukcRp+HB4/nm9PPfly1anMZKQiX9PZO3xtYx/bXySKwrxYQqDlX74AZYvJ13Qp/zQaCZHrhxh8PrBVqdyfwEBMGOGLgoffWR1GiOJOHz5MH3W9OHNIm/S/qX2VsexlCkMVgkP15dEXn4ZOnfm1QKv0uGlDozfMp6tZ7Zanc79vfii7pOZOVPvf20YiRClonhv8XsE+AQw5a0pyWpoamxMYbBKly565dApU/TSF8CYWmPImSYn7/76Lncf3LU4oAcYMEAvQ/7++3AtAUuaG4bNlNAp/H7qd8bVGkeONDmsjmM5Uxis8MsvelOaIUOgaNH/Hk7rn5Ypb03hwKUDBG0Msi6fp/Dz00tmnD9vRikZCXb2n7P0XtOb6gWq827Jd62O4xZMYXC1q1ehUye9SF6Px5fgrl24Nm1KtmH0n6PZeX6nBQE9TJky0LMnTJ0Ka9ZYncbwMEopPlz+Ifcj7zOpzqRkfwkpmikMrtarF0RE6NnNvr6xHjK+1ngypcxEx6UdiVJmbaA4DRkChQvDBx/AnTtWpzE8yPz981l8aDFB1YKS9SikR5nC4Err1umC0LOnbjE8QYYUGRhXaxxbz25lSugUFwb0UClSwNdfQ1gYjBpldRrDQ1y5fYUuK7pQOkdpPipvRrfFZAqDq9y9Cx9+CIUKweC4h6S+8/w7VMtfjb5r+3LhxgUXBPRwNWvqtaZGjoQjR6xOY3iAvmv6cvnWZb6r+x0+Xj5Wx3ErpjC4yoQJeimHiRP1J9w4iAhfv/k1N+/dpOfqni4ImASMH6/nOHTqZLYDNZ7q77N/M3X7VLqV68aL2V+0Oo7bMYXBFU6dguBgvZx27dp2v6xY5mL0qdSHmbtnsu74urhfkNzlyKFnRa9eDXPnWp3GcFORUZF0Wt6J7KmzM7iqmVAaG1MYXKF7d/0J9rPP4v3S/lX6UzBDQT5c9qGZ22CPDz7Q+zd07w7Xr1udxnBDU7dPJeRcCONqjSOtf1qr47glUxicbeVKPW9h0CDImzfeL0/hm4Kv3/iaQ5cPMe6vcU4ImMR4e+vluS9c0H/mhhHDpVuX6Le2H1XzV6XZc82sjuO2TGFwpjt39AznokXh448T/DavFX6NBsUaMOL3EZz956wDAyZRgYF6Y5+vv4a9e61OY7iRfmv68e+9f5n4+kQzZ+EpTGFwprFj9RDKiRPB3z9xb1VrLA+iHtB3bV8HhUvigoMhbVq9yJ7piDaALWe2MHWH7nAukbWE1XHcmikMznL2rB462bChHkqZSAUzFKRHhR7M3D2Tv07/FfcLkrtMmWDoUFi7FhY/tqGgkcxEqSi6ruhKjtQ5GPyK6XCOi0MKg4jUFpFDIhImIo99pBWRNiISISI7bbf3YjzXWkSO2G6tHZHHLfTvDw8ewJgxDnvLflX6kTNNTrqu7GpmRNvjgw+gRAl9Ge+u6bhPzmbtmcW2c9sYVWMUafzTWB3H7SW6MIiIN/AV8DrwLPC2iDwby6FzlVIlbbepttdmBAYD5YCywGAR8fwNj0NCYPp0PTKmQAGHvW1qv9SMrjGakHMhTNs5zWHvm2T5+OiRYMeOJWhEmJE03Lp/i35r+1E6R2lavNDC6jgewREthrJAmFLqmFLqHjAHqGfna18DViulriilrgKrAfsH+rsjpXRByJpVtxoc7J3n36FC7gr0W9uPf+7+4/D3T3Jq1IB69WDYML0HhpHsjN08ljP/nGHCaxPwEnP13B6O+FPKBZyOcf+M7bFHNRSR3SKyQETyxPO1nuPnn+GPP/7X+elgIsLntT/nws0LDNs0zOHvnySNHQv37kFf03Gf3Jz95yyj/xxNw+INqZKvitVxPIYjCkNsY74eHQayBMivlHoBWANEXwex57X6QJEOIhIiIiEREREJDutUd+5A7956P+J27Zx2mjK5ytD6xdZ8vvVzTlw74bTzJBmFC+tW3PTpsGOH1WkMFxq4fiAPoh7wac1PrY7iURxRGM4AeWLczw2ci3mAUuqyUiq6928KUNre18Z4j8lKqUClVGCWLFkcENsJvvgCjh/Xa/Z4ezv1VMHVgvESLwauG+jU8yQZ/frpkUq9epnhq8nE9vDtTNs5jW7lulEwQ0Gr43gURxSGbUARESkgIn5AM+Ch8YEiEnOvvLrAAdv3q4BaIpLB1ulcy/aY57l4UV/HrlNHX9d2sjzp8vBRuY/4ac9PhJ4Ldfr5PF66dPDJJ3r46irP/Cdm2E8pRfdV3cmUMhMDqgywOo7HSXRhUEo9ADqjf6EfAOYppfaJSJCI1LUd1lVE9onILqAr0Mb22itAMLq4bAOCbI95nk8+0Xs4jx3rslP2rdyXzCkz02t1L5T5FBy3jh31sue9e0NkpNVpDCdaeHAhm05uIqhqEOkC0lkdx+OIJ/5CCQwMVCEhIVbH+J+DB/V4+U6d9OUkF/py65d0XdmVZc2X8UaRN1x6bo80fz40aaL3in7X7O+bFN2PvM+zXz+Ln7cfuzruMnstxCAioUqpwLiOM2O3HGHAAEiVypJF294PfJ/CGQvTe3VvIqPMp+A4NWoE5crpv6tbt6xOYzjB1O1TCbsSxugao01RSCBTGBJryxa9emrPnmBBp7iftx8jq49kX8Q+ftz5o8vP73FE9Gz0s2fh88+tTmM42M17NwnaFETlvJV5s8ibVsfxWKYwJIZSemx81qyJWj01sRoWb0j53OUZtH4QN+/dtCyHx6hSRU96GzkS3HXos5Egn235jPM3zjO6xmizemoimMKQGCtXwsaNuuM5dWrLYogIY2uOJfxGOOP/Gm9ZDo8yapS+lBQcbHUSw0Eu37rMp5s/pe4zdamYp6LVcTyaKQwJFRWlWwsFC0L79lanoVLeStQvVp8xm8dw+dZlq+O4v2LF9N/bN9/otZQMjzfi9xHcuHeDEa+OsDqKxzOFIaFmzYLdu/Uew35+VqcBYFi1Ydy4d4PRf462Oopn+OQT8PWFIUOsTmIk0qnrp5i4bSKtX2xt9lpwAFMYEuLuXRg4EEqV0kMf3USJrCVo8UILvvz7S879G+sEciOmHDn0DnszZ8K+fVanMRJh8IbBCMLQqkOtjpIkmMKQEN9+CydPwujR4OVef4RDqg7hQdQDs8CevXr3hjRpdOvB8Eh7L+5l2s5pdC7bmTzp8sT9AiNO7vVbzRPcuKGXvqhe3SE7szlawQwFaf9Se6Zsn8Kxq+baeZwyZYIePfSQ423brE5jJMCAdQNI45+GfpX7WR0lyTCFIb6++AIuXYIR7tvBNfDlgfh4+TBkwxCro3iG7t0hc2Z9edDwKKHnQll8aDG9KvYiU8pMVsdJMkxhiI9r1/TkqLfegrJlrU7zRDnT5KRL2S7M3D2TfRfNtfM4pUmjV1/97Tc9/NjwGEM3DiVDQAa6lutqdZQkxRSG+Bg/XheHoCCrk8SpT6U+pPZLzScbzLVzu3zwAeTMqZc38cD1w5Kj7eHbWXJ4CR9X+Ji0/o7fFCs5M4XBXpcuwYQJ0LgxlCxpdZo4ZUqZiZ4Ve/LLgV/YdtZcO49TihS6A/rPP2HFCqvTGHYYunEo6QPS06VsF6ujJDmmMNhrzBi4edOjxrx3L9+dzCkzM3C9uXZul7Zt9YTFgQP1BEbDbW0P387iQ4v5uPzHZlltJzCFwR7nz8OXX8I778Czz1qdxm5p/NPQt1Jffjv6GxtObLA6jvvz9YWhQ/X2nz//bHUa4ymCNgaRPiC96VtwElMY7DFypN5MfvBgq5PE24dlPiRnmpwMXDfQbOZjj7ff1ntrDBpkNvNxUzvCd/DroV/pXr67aS04iUMKg4jUFpFDIhImIn1jef5jEdkvIrtFZK2I5IvxXKSI7LTdFj/6WsudPq0ntLVpozeV9zApfFMwoMoA/jz9J2uPr7U6jvvz9taDCw4dgtmzrU5jxCJok2ktOFuiC4OIeANfAa8DzwJvi8ij11t2AIFKqReABcCnMZ67rZQqabvVxd0MH65HqViwCY+jtCvVjtxpczN4w2DTarBH/frw4ou6QDx4YHUaI4ad53ey6OAiPir3EekD0lsdJ8lyRIuhLBCmlDqmlLoHzAHqxTxAKbVeKRW9XdYWILcDzut8x47Bd99Bhw6QL1/cx7spfx9/+lfuz+bTm1l9bLXVcdyfl5ceZHDkiGk1uJmgjUGk809Ht/LdrI6SpDmiMOQCTse4f8b22JO0A2KOBwwQkRAR2SIi9Z/0IhHpYDsuJMJVm6sEBYGPD/Tv75rzOVHbUm3JkzaPaTXYq149PSzZtBrcxq7zu1h4cCEflTetBWdzRGGIbZukWH/ziEgLIBAYE+PhvLbNqZsDn4lIodheq5SarJQKVEoFZnHFFpphYXrVzeiJTx7O38efAVUGsOXMFn47+pvVcdyfiG41hIXBTz9ZncZA9y2k80/HR+U/sjpKkueIwnAGiLmkYW7gsTWfRaQGMACoq5S6G/24Uuqc7esxYANQygGZEm/4cD18sXdvq5M4zLul3iVvurym1WCvunX10urBwabVYLFd53fxy4FfTGvBRRxRGLYBRUSkgIj4Ac2Ah0YXiUgpYBK6KFyM8XgGEfG3fZ8ZqATsd0CmxDl2DGbMgPffh+zZrU7jMH7efgyoMoCtZ7eyMmyl1XHcX3Sr4ehR3Xo0LBO0KYi0/mnpVs70LbhCoguDUuoB0BlYBRwA5iml9olIkIhEjzIaA6QG5j8yLLU4ECIiu4D1wCillPWFYcQI3beQhFoL0dqUbEO+dPlMq8Feb70FL72kWw3371udJlnafWG3bi2U+4gMKTJYHSdZEE/85RAYGKhCQkKc8+YnTkCRItCxo57tnARN3T6V9kvas6z5Mt4o8obVcdzfkiX6stJ33+llMwyXajSvEauPreZEtxOmMCSSiITa+nSfysx8ftSIEXq4Yp8+VidxmtYvtiZ/+vym1WCvOnWgdGm9QZNpNbjUngt7+PnAz3Qr180UBRcyhSGmkyfhxx/hvfcgt2dMtUgIX29fBlYZSMi5EJYdWWZ1HPcX3ddw/DhMn251mmQlaFMQafzSmJFILmYKQ0yjRumvfR9b1SPJafViKwpmKMiQDUNMq8Eeb74JgYG61XDvntVpkoW9F/eyYP8CupXrRsYUGa2Ok6yYwhDt9On/XUPOk/Q3FI9uNYSGh7Lk8BKr47i/6FbDiROm1eAiQRt1a6F7he5WR0l2TGGINnq0/tov+Wwo3vLFlhTKUIihG4eaVoM93nhDb+lqWg1Ot/fiXubvn0/Xcl1Na8ECpjAAnD0LU6boFVQ9eE2k+PLx8mFAlQFsD99u+hrsIaKXXj950rQanCx4U7BuLZQ3rQUrmMIAurUQFZUk1kSKrxYvtKBA+gKm1WCv11/XfQ3Dh5sRSk6y7+I+5u+bT5eyXciUMpPVcZIlUxjOnYPJk6FVK8if3+o0Lufr7cuAKgMIORfC8iPLrY7j/qJbDaavwWmCNwWTyi8VH1f42OooyZYpDGPG6HVwBgywOollWr3Yivzp85tWg73efFPPazCtBofbH7GfefvmmdaCxZJ3YTh/Xu/O1rKl3gQ+mYpuNWw7t82soWSP6FbD8eNmDSUHM60F95C8C8OYMXp0STLsW3hUqxdbkS9dPtNqsFedOnoNpeHDzcqrDrI/Yj9z986lc5nOZE6Z2eo4yVryLQwXL8I338A77+i1kZI5P28/+lfpz9azW1l1dJXVcdxfdKvBrLzqMMM2DSOlb0p6VOxhdZRkL/kWhrFj4e5dGDjQ6iRuo03JNuRNl9e0Guz11lt6v4Zhw0yrIZEORBxgzt45dCnbxbQW3EDyLAwREfDVV/D221C0qNVp3Iaftx/9K/dny5ktZm9oe4jAJ5/oVsOsWVan8WjBm4JNa8GNJM/CMG4c3L6drEciPcm7pd4lT9o8ptVgr+i9oc0ubwl28NJB5uydQ+eypm/BXTikMIhIbRE5JCJhIvLYCnQi4i8ic23PbxWR/DGe62d7/JCIvOaIPE916RJMnAhNm0Lx4k4/nafx8/ajX+V+bD69mTXH1lgdx/1FtxrCwmD2bKvTeKTgTcGk8E1BjwqmteAuEl0YRMQb+Ap4HXgWeFtEnn3ksHbAVaVUYWACMNr22mfRW4GWAGoDX9vez3kmTIBbt0zfwlO0LdWW3Glzm1aDverVgxdeMH0NCfBfa6FMZ7KkymJ1HMPGES2GskCYUuqYUuoeMAeo98gx9YBptu8XANVFRGyPz1FK3VVKHQfCbO/nHFeu6F3ZGjWCEiWcdhpP5+/jT7/K/fjz9J+sO77O6jjuz8v20UXwAAAgAElEQVRLtxoOH4Y5c6xO41GGbRpGgE8APSv2tDqKEYMjCkMu4HSM+2dsj8V6jG2P6OtAJjtf6zgTJsC//8KgQU47RVLRrlQ7cqXJZVoN9mrQAJ5/XrcaIiOtTuMRDl06xOy9s+lUppNpLdjj4EE96/7YMaefyhGFQWJ57NHfJE86xp7X6jcQ6SAiISISEhEREc+INpcuQZMm+j+w8VTRrYbfT/3O+hPrrY7j/qJbDYcOwdy5VqfxCMN+N62FeBk2DDZuhLRpnX4qRxSGM0DMnW1yA+eedIyI+ADpgCt2vhYApdRkpVSgUiowS5YEfrr45hszrDAe2r3UjpxpcjJ041Cro3iG//s/eO45CAoyrYY4HL58mFl7ZvFh4IdkTZXV6jju7/BhPbjhww8hs/NHbjmiMGwDiohIARHxQ3cmL37kmMVAa9v3jYB1Sl+fWAw0s41aKgAUAf52QKYn83Zu33ZSEuATQN9Kfdl0chMbTmywOo77i9lqmDfP6jRubdimYfh7+9OrUi+ro3iGESPA3x96uGbkVqILg63PoDOwCjgAzFNK7RORIBGpazvsOyCTiIQBHwN9ba/dB8wD9gMrgU5KKfNRy420L92eHKlzMGTDEKujeIaGDfXAhuBg02p4gsOXD/PTnp/4sIxpLdgletmVjh0hWzaXnNIh8xiUUsuVUkWVUoWUUsNtj32ilFps+/6OUqqxUqqwUqqsUupYjNcOt73uGaXUCkfkMRwnwCeAvpX7svHkRjae2Gh1HPfn5aUHNxw4APPnW53GLQ3/fbhuLVQ0rQW7jBgBvr7Qy3V/Xslz5rMRL+1fak/21NlNX4O9GjWCZ5/VrYaoKKvTuJUjl48wc/dMPgj8gGypXfPp16MdP643hOrQAXLkcNlpTWEw4pTCNwV9KvVh/Yn1bDq5yeo47s/bW7ca9u+HBQusTuNW/mstmL4F+4wapVuhvXu79LSmMBh2eb/0+2RLlc20GuzVuDEUK6ZHKJlWAwBhV8L+ay1kT53d6jju79Qp+OEHeO89yOW86V2xMYXBsEt0q2Hd8XX8ceoPq+O4P29vPUJp3z74+Wer07iF4b8Px9fb17QW7DVqlP7ap4/LT20Kg2G39wNNqyFemjQxrQabsCthzNg1w7QW7HXmDHz3HbRtC3nzuvz0pjAYdkvpm5JeFXux5tga/jz1p9Vx3J+3t16sce9e+OUXq9NYKrq10LuSa6+Ve6xPP9UfJvo+tli1S5jCYMRLx8COZEmZxbQa7NWsmd4MKhm3Go5eOcqMXTPoWLqjaS3YIzwcJk+G1q0hf35LIpjCYMRLKr9U9K7Um9XHVvPX6b+sjuP+okco7dkDixZZncYSprUQT2PG6OXb+/e3LIIpDEa8fRD4gWk1xEezZlCkSLJsNRy7eozpu6bzfun3yZHGdePwPdaFC/Dtt9CyJRQsaFkMUxiMeEvll4qeFXuy6ugqtpzZYnUc9+fjo1sNu3bBr79ancalhm/SrYU+lVw/ssYjjR0Ld+9a2loAUxiMBPqwzIdkTpnZtBrs9fbbULiwbjUkk/0tjl89zvTd0+nwUgfTWrBHRAR8/TU0b65bmBYyhcFIkNR+qelZoScrw1by91nnLoibJPj46BFKO3fC4kcXH06ahm0ahrd406eyaS3YZfx4uH0bBgywOokpDEbCdSrbiUwpMplWg73eeQcKFYKhQ5N8q+HolaNM2zWNjoEdyZkmp9Vx3N/lyzBxou6PKlbM6jSmMBgJl9ovNT0q9GD5keWm1WCP6FbDjh2wZInVaZwqeFOw6VuIjwkT4OZNt2gtgCkMRiJ1LtuZjCkyErQxyOoonqFFCz3aJAm3Go5cPsKM3XqWs+lbsMPly/D553pV3hIlrE4DmMJgJFIa/zT0qNCDZUeWEXIuxOo47i+61bB9OyxdanUapwjeFIy/t79pLdhr7FjdWhgyxOok/0lUYRCRjCKyWkSO2L5miOWYkiLyl4jsE5HdItI0xnM/ishxEdlpu5VMTB7DGp3LdiZDQAbTarBXixZQoECSbDUcunTov93ZzH4Ldrh4Eb78Uo9ae/ZZq9P8J7Ethr7AWqVUEWCt7f6jbgGtlFIlgNrAZyKSPsbzvZRSJW23nYnMY1ggrX9aPq7wMUsOLyH0XKjVcdyfr6++lhwaCsuXW53GoYI3BRPgE2BmOdtrzBg9EumTT6xO8pDEFoZ6wDTb99OA+o8eoJQ6rJQ6Yvv+HHARyJLI8xpupkvZLrrVsMm0GuzSqpVeB2fIkCTTajh46SCz986mU5lOZi9ne5w/D199pVuQzzxjdZqHJLYwZFNKhQPYvj71X4OIlAX8gKMxHh5uu8Q0QUT8E5nHsEi6gHR0L9+dxYcWsyN8h9Vx3F90qyEkBFYkja3OgzYGkcInhdnL2V6jR8O9e3pWvJuJszCIyBoR2RvLrV58TiQiOYAZwLtKqegFY/oBxYAyQEbgib1VItJBREJEJCQiIiI+pzZcpGu5rqQPSG9aDfZq1Qry5UsSfQ37I/YzZ+8cOpftTJZU5oJAnM6dg2++0SuoFi5sdZrHxFkYlFI1lFLPxXL7Fbhg+4Uf/Yv/YmzvISJpgWXAQKXUlhjvHa60u8APQNmn5JislApUSgVmyWL+4bmjdAHp+KjcRyw6uIid5013UZz8/PSaOH//DStXWp0mUYI2Bv23hpZhh5EjITJSj1BzQ4m9lLQYaG37vjXw2AphIuIHLASmK6XmP/JcdFERdP/E3kTmMSzWrXw30vmnMyOU7NWmjd6hy4NbDfsu7mPevnl0KduFzCkzWx3H/Z0+rfdbaNtWj05zQ4ktDKOAmiJyBKhpu4+IBIrIVNsxTYCXgTaxDEv9SUT2AHuAzMCwROYxLJY+ID0flf+IhQcXsuv8LqvjuL/oVsPWrfDbb1anSZChG4f+NwvesMOIEfpDgJvMco6NKA/8lBIYGKhCQsxkKnd19fZV8n+enxoFa/Bzk5+tjuP+7t3T15lz5YLNm0HE6kR223V+FyUnlWRAlQEMe9V8rovTiRN6R7/27fWIJBcTkVClVGBcx5mZz4bDZUiRgY/KfcQvB35h94XdVsdxf9Gthi1bYPVqq9PEy8D1A0kfkN60Fuw1fDh4eUG/flYneSpTGAyn+Kj8R6T1T0vwpmCro3iGd9+F3Lk9qq9h8+nNLD28lN4Ve5MhxWOLHhiPOnoUfvgB3n9f/127MVMYDKfIkCIDXct2ZcH+BabVYA9/f/0pcvNmWLPG6jRxUkrRf21/sqXKRtdyXa2O4xmGDtXzV/rGtkCEezGFwXCajyt8TPqA9AxY576dbG6lXTvIk0cPYXTzVsPqY6vZeHIjA18eSCq/VFbHcX979sDMmdC1K+Rw/xVnTWEwnCZDigz0qdSHpYeX8sepP6yO4/78/fUSGX//DYsWWZ3miaJbC/nS5aP9S+2tjuMZBg6EtGmhj2esOGsKg+FUXct1JUfqHPRd0xdPHAHncq1a6R28BgyABw+sThOrhQcXEhoeypCqQ/D3MavYxGnzZr2da+/ekDGj1WnsYgqD4VQpfVMy+JXB/Hn6T5YdWWZ1HPfn46NHrhw4ADNmWJ3mMZFRkQxcN5DimYvT8oWWVsdxf0rpvqNs2aBbN6vT2M0UBsPp2pZqS+GMhem3th+RUZFWx3F/DRpAmTIweDDcuWN1mofM3D2TA5cOEFwtGG8vb6vjuL9Vq2DTJr1QXirP6YsxhcFwOl9vX4ZVG8bei3uZvXe21XHcn4heS+f0ab3Qmpu4++AugzcMpnSO0vxf8f+zOo77i4rS81MKFNAT2jyIKQyGSzQu0ZhS2UsxaP0g7kXeszqO+6teHWrU0JeV/vnH6jQATN0+lZPXTzKi+gjEg2ZnW2b+fNixA4KC9CRGD2IKg+ESXuLFyOojOXHtBJNCJlkdxzOMGKE3ih83zuok3Lh3g+BNwbyS7xVqFqxpdRz3d/++vnz03HN6204PYwqD4TK1CtWiav6qBG8K5t+7/1odx/2VKQONGunCcDHWFe1dZuzmsVy4eYFRNUaZ1oI9fvgBjhzRxd3b8/piTGEwXEZEGFV9FBG3Ivhsy2dWx/EMw4bpDuhg65YWCf83nDGbx9D42caUz13eshwe48YNvYdzpUpQp47VaRLEFAbDpcrlLkeDYg0Ys3kMETfNTnxxeuYZPSP622/h8GFLIgzeMJj7kfcZWX2kJef3OJ9+Chcu6Jaeh7auTGEwXG74q8O5df8WQzYMsTqKZwgKgoAAPUHKxfZd3Md3O76jU5lOFMpYyOXn9zhnz8LYsdC0KZQrZ3WaBDOFwXC54lmK0zGwI5NCJ7E/Yr/Vcdxftmx64bVff4WNG1166t5repPGLw0DX3bPLSjdzqBBesvOkZ7dukpUYRCRjCKyWkSO2L7GuvauiETG2L1tcYzHC4jIVtvr59q2ATWSgcGvDCa1X2p6re5ldRTP0L27Xqr544/1+HgXWHtsLcuPLGdAlQFkSpnJJef0aLt2wY8/Qpcubrtlp70S22LoC6xVShUB1trux+a2Uqqk7VY3xuOjgQm2118F2iUyj+EhsqTKwsCXB7L8yHJ+O+qZW1q6VMqUeoTL9u3w009OP12UiqLX6l7kS5ePLuW6OP18Hk8p6NkTMmRw6y077ZXYwlAPmGb7fhpQ394Xih7z9iqwICGvNzxfl7JdKJC+AD1+62GWyrDHO+9A6dJ6Nu3t20491U+7f2LH+R2MqD6CAJ8Ap54rSVi5Uu+j8cknujh4uMQWhmxKqXAA29esTzguQERCRGSLiET/8s8EXFNKRS8heQbI9aQTiUgH23uERESY0SxJgb+PP5/W/JS9F/fy/Y7vrY7j/ry89EiXM2dgwgSnnebW/VsMWDeAwJyBNHuumdPOk2Q8eKBbC4UKwQcfWJ3GIeIsDCKyRkT2xnKrF4/z5LVtQN0c+ExECgGxjeN64rrMSqnJSqlApVRglixZ4nFqw501LN6QSnkqMXD9QDPpzR6vvAL16unOzQsXnHKKMX+O4fQ/pxlXaxxeYsanxOn772H/fhg92uOWvniSOP/WlVI1lFLPxXL7FbggIjkAbF9jnZ6plDpn+3oM2ACUAi4B6UXEx3ZYbuBcon8iw6OICONfG8/FmxcZ9ccoq+N4hk8/1ZPeBg1y+FufvHaSUX+OokmJJryc72WHv3+Sc+2a3oSncmX4v6SzsGBiPw4sBlrbvm8N/ProASKSQUT8bd9nBioB+5XetWU90OhprzeSvrK5yvLO8+8w7q9xnLh2wuo47q9oUejcGaZOhdBQh751r9W9EIQxNcc49H2TrMGD4dIl+OILj53MFpvEFoZRQE0ROQLUtN1HRAJFZKrtmOJAiIjsQheCUUqp6MHrfYCPRSQM3efwXSLzGB5qZPWReHt50+O3HlZH8QxDhkCWLHpopIOGr244sYH5++fTt3Jf8qbL65D3TNL27oWvvoL334dSpaxO41DiidstBgYGqpCQEKtjGA424vcRDFg3gFUtVlGrUC2r47i/H3+Ed9/VX1u3juvop3oQ9YDSk0tz/c51DnQ6QArfFA6JmGQppZdG37lTL5aXyTPmeYhIqK2/96lMz5LhNnpU6EGRjEXosqILdx/ctTqO+2vVCsqX1xvMX7+eqLeaHDqZ3Rd2M7bWWFMU7PHzz7B+vV7k0EOKQnyYwmC4DX8ff754/QsOXz7MhC3OG46ZZHh5wcSJeknuoUMT/DZXbl9h0PpBVMtfjYbFGzowYBJ16xb06AEvvqgvIyVBpjAYbqV24drUL1af4E3BnL5+2uo47q90ab1t5Jdf6iGTCdB3TV+u37nO57U/N3st2GPUKDh1Sv+Ze+BeC/YwhcFwOxNem0CUijId0fYaPhzSpNEd0fHsM/zz1J9M2T6Fj8p/xPPZnndSwCTk8GE9XLh5c6hSxeo0TmMKg+F28qfPT//K/Zm/fz5rjq2xOo77y5xZr6O0bh3MnGn3y+5F3uP9pe+TJ20ehlQd4rx8SYVS0LEjpEjhFtutOpMpDIZb6lWpF4UzFqbj0o7cvu/cdYGShA4doGJFvQrrpUt2vWT8X+PZF7GPiW9MJLVfaicHTAKmTdMdzqNHQ/bsVqdxKlMYDLcU4BPA5DqTOXr1KEM3JrxjNdnw8oJJk/TopJ494zz8+NXjBG0Mon6x+tR9pm6cxyd7ly7pP9dKleC996xO43SmMBhuq1qBarQr1Y6xm8ey8/xOq+O4v+ee00NXp02DtWufeJhSik7LO+Ht5c0Xtb9wYUAP1qOHLrqTJukinMQl/Z/Q8Ghjao4hc8rMvLf4PR5EPYj7BcndwIFQpIgeRvmEpbkX7F/AirAVBFUNIk+6PC4O6IHWroXp0/XWqiVKWJ3GJUxhMNxahhQZ+PL1LwkND+WLrebTbZwCAuDbb+HoUQgOfuzpS7cu0XlFZ17K8ZLZgMcet2/rDudChXTRTSZMYTDcXqNnG/FW0bcYtH4Qx68etzqO+3v1VWjTBsaM0Us2xNB1RVeu3r7KD/V+wMfLJ/bXG/8zaBCEhelimyL5zAg3hcFweyLC129+jbd4035Je6KUa/Y89mjjxulhrK1bw129vMiig4uYvXc2g14exAvZXrA4oAf4808YP163GGrUsDqNS5nCYHiE3GlzM7bWWNYeX8vX2762Oo77y5gRpkyB3bshKIgrt6/QcWlHSmYvSd/KT9qa3fjPrVu61ZUvn57QlsyYtqThMdq/1J5FBxfRe3VvahWqRdFMRa2O5N7q1NGrr44aRdd8oVy+fZmVLVbi6+1rdTL317+/voS0bp2eVZ7MmBaD4TFEhKl1pxLgE0Crha3MKCV7TJjA3MoZ+Cl8FQPK96Zk9pJWJ3J/mzbB55/rzZCqVbM6jSVMYTA8Ss40Ofn6za/ZenYro/8YbXUct3eK63SseZfyp2HgMrOndpyuXoUWLfQopFHJd6vZRBUGEckoIqtF5Ijta4ZYjqkmIjtj3O6ISH3bcz+KyPEYz5mPM0acmj3XjKYlmjJk4xC2nd1mdRy3FRkVqVtW3jAzTSt8Pv8Sli2zOpb7UkovLRIeDrNnQ6pUVieyTGJbDH2BtUqpIsBa2/2HKKXWK6VKKqVKAq8Ct4DfYhzSK/p5pZSZ3mrY5es3vyZnmpw0XdCU63cSt0lNUjVm8xg2ntzIxNcnUmjkJL1/QJs2cO6c1dHc0w8/wIIFevOdMmWsTmOpxBaGesA02/fTgPpxHN8IWKGUupXI8xrJXMYUGZndcDanrp+iw9IOeOIWtc607ew2Bq0fRONnG9PqxVZ64tucOXq0TcuWEBlpdUT3cuiQXrb81VehVy+r01gusYUhm1IqHMD2NWscxzcDZj/y2HAR2S0iE0TE/0kvFJEOIhIiIiERERGJS20kCRXzVCS4WjDz9s1jyvYpVsdxG5dvXabx/MbkTJOTb+t8+7/Nd4oVgy++0CNtkuEQzCe6fRvefltPYJs+PVmshRSXOP8ERGSNiOyN5VYvPicSkRzA88CqGA/3A4oBZYCMQJ8nvV4pNVkpFaiUCsySJUt8Tm0kYX0q96FGwRp0W9mNPRf2WB3HclEqipYLWxJ+I5wFjReQMUXGhw9o2xaaNNEzejdssCSjW1EKOnWCHTvgxx8hVy6rE7mFOAuDUqqGUuq5WG6/Ahdsv/Cjf/FffMpbNQEWKqXux3jvcKXdBX4AyibuxzGSGy/xYkaDGaQPSE+DuQ24evuq1ZEsNeL3EawIW8Fnr31GmVyxXCcX0RPfihTRBeLMGdeHdCdTpui+hUGD9LwPA0j8paTFQGvb962BX59y7Ns8chkpRlERdP/E3kTmMZKh7Kmzs6DxAk5dP0XzX5oTGZU8r5+vObaGT9Z/QvPnm9MxsOOTD0ybFhYuhDt3oGHD/5bMSHb+/lv3K7z2GgwebHUat5LYwjAKqCkiR4CatvuISKCITI0+SETyA3mAjY+8/icR2QPsATIDwxKZx0imKuWtxJevf8nKsJUMXJd8VsGMFnYljKYLmlI8S3Em1Zn0v36FJylWTO/bEP3LMbm5eBEaNYIcOeCnn8Db2+pEbiVRS2IopS4D1WN5PAR4L8b9E8BjF++UUq8m5vyGEdP7ge+zPXw7o/4cRakcpWhSoonVkVzi6u2r1JlVB0FY3Gyx/dt0NmgA/frByJF6KGunTs4N6i7u3IH69SEiAv74AzJlsjqR2zFrJRlJypdvfMneiL20WdSGvOnyUj53easjOdX9yPs0WdCEY1ePsabVGgplLBS/NwgOhr17oWtXyJsX3nrLOUHdRVSUnsvx118wfz6ULm11IrdkxmUZSYqftx8Lmy4kZ5qcvDX7LY5cPmJ1JKdRStF1RVfWHFvD5Lcm83K+l+P/Jt7eepZvqVLQrBmEhjo+qDsZNAjmzoXRo/WlJCNWpjAYSU7WVFlZ2WIlALV/qs2FGxcsTuQcwzYN49vQb+ldsTdtSrZJ+BulSgVLl0KWLHpkzsmTDsvoVr7/HkaMgPbtzSS2OJjCYCRJhTMWZunbSwn/N5w6s+tw494NqyM51Jdbv+STDZ/Q6sVWjKwxMvFvmD07LF+uJ3vVqgXnzyf+Pd3JvHm6INSqBV99pYftGk9kCoORZJXLXY55jeexI3wHb/z0RpIpDtN3Tafryq7UL1af7+p+h5c46L/xs8/qRfbOnoXq1XXnbFKwZAm88w5UrAi//AK+Zj+KuJjCYCRpdYrWYVbDWWw+vZk3Z73JzXs3rY6UKD/v/5m2v7aleoHqzG442/H7NleqpH+RHjsGNWvClSuOfX9XW7NG9yWUKqWLXjJeMTU+TGEwkrwmJZow8/9m8sepP6gzu47HFodZe2bRdEFTyuYqy6JmiwjwCXDOiapVg0WL4MABPfnLU4vDqlVQt66es7FypZ7YZ9jFFAYjWWj2XDNmNJjBppObqP1TbY9bOuO77d/R4pcWVMlXhd9a/mb/XIWEeu01+PlnvWf0yy/ry0ueZMECPfS2aFFYvVrvgW3YzRQGI9lo/nxzZjeczd9n/6bKD1U4ff201ZHipJQieGMw7y15j9cKv8by5sudXxSi1amjP2mfPKkvMR0+7JrzJtaUKdC0KZQtqxcKzBrXos/Go0xhMJKVJiWasPKdlZz+5zQVv6/IjvAdVkd6onuR92i7uC2fbPiEli+0ZFHTRaTwTeHaENWqwfr1cPMmlC+vl+x2V5GR0KOH3oXttdf0paT06a1O5ZFMYTCSnWoFqrGpzSYAKn5fkZ92/2Rxosed+/ccNabX4MedPzLklSFMqz8Nf58nblfiXIGBsGWLXlcoerinu22MdO2aXuZi/Hi99tPixaajORFMYTCSpRezv0hoh1DK5SpHi4Ut6LK8C7fv37Y6FgBrj62l1KRShIaHMuv/ZjG46uC4F8VztkKF9DISr78OnTtD8+Zw3U22VN26VY86WrlSF60vvgAfs9pPYpjCYCRbWVNlZXXL1XQv352J2yYSOCWQneet23b89v3b9PytJzVn1CRjioxsa7+Nt59/27I8j0mbVo9WGj5crzNUsiRs3mxdnvv39QKAlSvr+3/8AR9+aF2eJMQUBiNZ8/X2Zfxr41n5zkqu3r5K2SllGbB2gMuHtP5+8ndKTirJuL/G0aF0B7a138azWZ51aQa7eHtD//7w++/6fuXK+pfxtWuuzREaqjuX+/fXq8Tu2AHlyrk2QxJmCoNhAK8Vfo09H+yh2XPNGPHHCIp/VZy5e+cSpaKcet5jV4/RZH4TXv7xZe4+uMvqlqv5ts63rht5lFAVKuihrN26waRJULw4TJ6sP8U709mzemmLsmXhwgU9pHbePNPJ7GhKqQTfgMbAPiAKCHzKcbWBQ0AY0DfG4wWArcARYC7gZ895S5curQzDWX4/+bt64ZsXFENQJb4qoebsmaPuR9536DkORBxQ7X5tp3yDfFXK4SnV0A1D1Y27Nxx6DpcJDVWqYkWlQKmCBZX6/nulbt927DmOH1eqe3elAgKU8vVVqls3pa5edew5kgEgRNnzu92eg574YigOPANseFJhALyBo0BBwA/YBTxre24e0Mz2/bfAB/ac1xQGw9keRD5Qs3bPUsUnFlcMQeUal0sNXDtQHbl8JMHveePuDTVz10xVe2ZtxRBUwLAA9cHSD9SZ62ccmNwiUVFKLV2qVMmS+tdKpkxK9eql1M6d+rmEuHVLqYULlWrQQCkvL6W8vZVq0UKpY8ccmz0ZsbcwiHLAsDMR2QD0VHrntkefqwAMUUq9Zrvfz/bUKCACyK6UevDocU8TGBioQkIeO5VhOFxkVCRLDi9hyvYprAxbSZSKomimotQuVJsKeSrwfNbnKZqpKL7eDy/MppQi/EY4hy8fZsuZLWw4sYHfT/3Orfu3yJM2D++WfJfOZTuTJVUWi34yJ1FKz3v46iv49Vc9tyBfPnjjDX35p0wZKFgQUqR4/HWXLulJdH/9pTu1f/tNz5/InFlfPvrwQ8id25qfK4kQkVClVGCcx7mgMDQCaiul3rPdbwmUA4YAW5RShW2P5wFWKKWei+t8pjAYVjh9/TQLDy5kRdgKNpzYwJ0Hd/57Ln1AejKm0Msu3Lp/i+t3rnP7wf+Gv5bIUoJq+avRuERjKuet7LgVUd3ZxYt6Qb6FC2HjRrgRY3XbdOn0lppRUbp4REToLTejFSwINWpA48bwyitmRVQHsbcwxDnYV0TWANljeWqAUupXe7LE8ph6yuNPytEB6ACQN29eO05rGI6VJ10eupbrStdyXbkXeY+Dlw6y58Iejlw5wpXbV7hy+woiQgqfFKTxS0OhjIUonLEwJbOXJGuqZLgsQ9as0K6dvkVG6tZAaCicOgXh4XD1Knh56VuWLHpr0QIFdKsiWzar0ydrcRYGpVSNRJ7jDJAnxv3cwDngEpBeRHyUUg9iPP6kHJOByaBbDInMZBiJ4uftxwvZXuCFbC9YHUyh56IAAARDSURBVMUzeHvrkUvFi1udxLCDK9qz24AiIlJARPyAZsBiW0fIeiB649XWgD0tEMMwDMOJElUYRKSBiJwBKgDLRGSV7fGcIrIcwNYa6AysAg4A85RS+2xv0Qf4WETCgEzAd4nJYxiGYSSeQzqfXc10PhuGYcSfvZ3PyWBohGEYhhEfpjAYhmEYDzGFwTAMw3iIKQyGYRjGQ0xhMAzDMB7ikaOSRCQCOJnAl2dGT67zVJ6eHzz/Z/D0/OD5P4On5wdrfoZ8Sqk4F+jyyMKQGCISYs9wLXfl6fnB838GT88Pnv8zeHp+cO+fwVxKMgzDMB5iCoNhGIbxkORYGCZbHSCRPD0/eP7P4On5wfN/Bk/PD278MyS7PgbDMAzj6ZJji8EwDMN4imRVGESktogcEpEwEelrdZ74EJHvReSiiOy1OktCiEgeEVkvIgdEZJ+IdLM6U3yJSICI/C0iu2w/w1CrMyWEiHiLyA4RWWp1loQQkRMiskdEdoqIx62mKSLpRWSBiBy0/X+oYHWmRyWbS0ki4g0cBmqiNw/aBrytlNpvaTA7icjLwA1guj3bn7obEckB5FBKbReRNEAoUN9T/vwBRESAVEqpGyLiC/wBdFNKbbE4WryIyMdAIJBWKVXH6jzxJSIngECllEfOYxCRacDvSqmptj1qUiqlrlmdK6bk1GIoC4QppY4ppe4Bc4B6Fmeym1JqE3DF6hwJpZQKV0ptt33/L3pvjlzWpoofpUVvXOxru3nUJysRyQ28CUy1OktyJCJpgZex7T2jlLrnbkUBkldhyAWcjnH/DB72iympEJH8QClgq7VJ4s92GWYncBFYrZTytJ/hM6A3EGV1kERQwG8iEmrbC96TFAQigB9sl/Omikgqq0M9KjkVBonlMY/6tJcUiEhq4GfgI6XUP1bniS+lVKRSqiR6j/KyIuIxl/VEpA5wUSkVanWWRKqklHoJeB3oZLvM6il8gJeAb5RSpYCbgNv1dyanwnAGyBPjfm7gnEVZkiXbdfmfgZ+UUr9YnScxbM3/DUBti6PERyWgru0a/RzgVRGZaW2k+FNKnbN9vQgsRF8m9hRngDMxWpoL0IXCrSSnwrANKCIiBWwdPs2AxRZnSjZsHbffAQeUUuOtzpMQIpJFRNLbvk8B1AAOWpvKfkqpfkqp3Eqp/Oh//+uUUi0sjhUvIpLKNngB2yWYWoDHjNRTSp0HTovIM7aHqgNuNwDDx+oArqKUeiAinYFVgDfwvVJqn8Wx7CYis4GqQGYROQMMVkp9Z22qeKkEtAT22K7RA/RXSi23MFN85QCm2Ua4eQHzlFIeOeTTg2UDFurPGfgAs5RSK62NFG9dgJ9sH1CPAe9anOcxyWa4qmEYhmGf5HQpyTAMw7CDKQyGYRjGQ0xhMAzDMB5iCoNhGIbxEFMYDMMwjIeYwmAYhmE8xBQGwzAM4yGmMBiGYRgP+X9GN9bsS7cSZQAAAABJRU5ErkJggg==\n", + "text/plain": [ + "
    " + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "import matplotlib.pyplot as plt \n", + "import numpy as np \n", + "\n", + "x = np.linspace(0,2*np.pi,360)\n", + "sin = np.sin(x)\n", + "cos = np.cos(x)\n", + "plt.plot(x,sin,'r')\n", + "plt.plot(x,cos,'g')\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "print(os.path)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    DataTypes

    \n", + "
      \n", + "
    1. Numbers --> int,float,complex
    2. \n", + "
    3. Strings
    4. \n", + "
    5. List
    6. \n", + "
    7. Tuples
    8. \n", + "
    9. Dictionary
    10. \n", + "
    11. Set
    12. \n", + "
    13. FrozenSets
    14. \n", + "
    15. Boolean-->True, False
    16. \n", + "
    \n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "5.551115123125783e-17" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "0.1+0.2-0.3" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "import decimal" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Context(prec=28, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999, capitals=1, clamp=0, flags=[], traps=[InvalidOperation, DivisionByZero, Overflow])" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "decimal.getcontext()" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "decimal.getcontext().prec = 2" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Decimal('0.0')" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "decimal.Decimal('0.1')+decimal.Decimal('0.2')-decimal.Decimal('0.3')" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "python = { \n", + " 'name' : 'python',\n", + " 'version' : 3.7,\n", + " 'release':1994,\n", + " 'scope' : [ 's/w dev','ml','data science'],\n", + " 'modules' : {\n", + " 'web' : ['flask','django','web2py'],\n", + " 'gui' : ['tkinter','kivi','wxpython'],\n", + " 'data' : ['pandas','numpy','stats','Decimal'],\n", + " 'ml' : ['scikit-learn','tenserflow'],\n", + " 'automation' : ['ansible','salt']\n", + " },\n", + " 'father' : 'Guido Van Rossum'\n", + " }" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'python', 'version': 3.7, 'release': 1994, 'scope': ['s/w dev', 'ml', 'data science'], 'modules': {'web': ['flask', 'django', 'web2py'], 'gui': ['tkinter', 'kivi', 'wxpython'], 'data': ['pandas', 'numpy', 'stats', 'Decimal'], 'ml': ['scikit-learn', 'tenserflow'], 'automation': ['ansible', 'salt']}, 'father': 'Guido Van Rossum'}\n" + ] + } + ], + "source": [ + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'father': 'Guido Van Rossum',\n", + " 'modules': {'automation': ['ansible', 'salt'],\n", + " 'data': ['pandas', 'numpy', 'stats', 'Decimal'],\n", + " 'gui': ['tkinter', 'kivi', 'wxpython'],\n", + " 'ml': ['scikit-learn', 'tenserflow'],\n", + " 'web': ['flask', 'django', 'web2py']},\n", + " 'name': 'python',\n", + " 'release': 1994,\n", + " 'scope': ['s/w dev', 'ml', 'data science'],\n", + " 'version': 3.7}\n" + ] + } + ], + "source": [ + "from pprint import pprint\n", + "pprint(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'PYTHON'" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python['name'].upper()" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "python['scope'].sort()" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['data science', 'ml', 's/w dev']" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python['scope']" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Decimal', 'stats', 'numpy', 'pandas']" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python['modules']['data'][::-1]" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['__class__',\n", + " '__contains__',\n", + " '__delattr__',\n", + " '__delitem__',\n", + " '__dir__',\n", + " '__doc__',\n", + " '__eq__',\n", + " '__format__',\n", + " '__ge__',\n", + " '__getattribute__',\n", + " '__getitem__',\n", + " '__gt__',\n", + " '__hash__',\n", + " '__init__',\n", + " '__init_subclass__',\n", + " '__iter__',\n", + " '__le__',\n", + " '__len__',\n", + " '__lt__',\n", + " '__ne__',\n", + " '__new__',\n", + " '__reduce__',\n", + " '__reduce_ex__',\n", + " '__repr__',\n", + " '__setattr__',\n", + " '__setitem__',\n", + " '__sizeof__',\n", + " '__str__',\n", + " '__subclasshook__',\n", + " 'clear',\n", + " 'copy',\n", + " 'fromkeys',\n", + " 'get',\n", + " 'items',\n", + " 'keys',\n", + " 'pop',\n", + " 'popitem',\n", + " 'setdefault',\n", + " 'update',\n", + " 'values']" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dir(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "ename": "KeyError", + "evalue": "'Name'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m-----------------------------------------------\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mpython\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'Name'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m: 'Name'" + ] + } + ], + "source": [ + "python['Name']" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "7628194596339931819" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "hash('name')" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "p y t h o n\n", + "1 2 3\n" + ] + }, + { + "data": { + "text/plain": [ + "dict_keys(['name', 'version', 'release', 'scope', 'modules', 'father'])" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "hash(\"Name\")\n", + "print(*'python')\n", + "print(*[1,2,3])\n", + "python.keys()" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Here are keys of python : name version release scope modules father\n", + "Enter key to find value : salkf\n" + ] + }, + { + "ename": "KeyError", + "evalue": "'salkf'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m-----------------------------------------------\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Here are keys of python : \"\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0mpython\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mpython\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0minput\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Enter key to find value : \"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m: 'salkf'" + ] + } + ], + "source": [ + "print(\"Here are keys of python : \",*python.keys())\n", + "python[input(\"Enter key to find value : \")]" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Help on built-in function print in module builtins:\n", + "\n", + "print(...)\n", + " print(value, ..., sep=' ', end='\\n', file=sys.stdout, flush=False)\n", + " \n", + " Prints the values to a stream, or to sys.stdout by default.\n", + " Optional keyword arguments:\n", + " file: a file-like object (stream); defaults to the current sys.stdout.\n", + " sep: string inserted between values, default a space.\n", + " end: string appended after the last value, default a newline.\n", + " flush: whether to forcibly flush the stream.\n", + "\n" + ] + } + ], + "source": [ + "help(print)" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "value1\n", + "value2\n", + "1\n", + "2\n", + "3\n", + "4\n" + ] + } + ], + "source": [ + "print('value1','value2',1,2,3,4,sep='\\n')" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\tBye World\n" + ] + } + ], + "source": [ + "print(\"Hello\",\"World\",end='\\t')\n", + "print(\"Bye\",\"World\")" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "python\n" + ] + } + ], + "source": [ + "print('python')" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "p\n", + "y\n", + "h\n", + "t\n", + "o\n", + "n\n" + ] + } + ], + "source": [ + "print(*'pyhton',sep='\\n')#print('p','y','h','t','o','n')" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "name version release scope modules father\n" + ] + } + ], + "source": [ + "print(*python)" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": {}, + "outputs": [], + "source": [ + "fp = open('C:/users/sachin/desktop/arya.txt','w')" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": {}, + "outputs": [], + "source": [ + "print(\"Hello World\",\"This is Awesom.\",\"Python is \\\n", + "easy\",sep='\\n',file=fp)" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": {}, + "outputs": [], + "source": [ + "fp.close()" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": {}, + "outputs": [ + { + "ename": "KeyError", + "evalue": "'abccadre'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m-----------------------------------------------\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mpython\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'abccadre'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m: 'abccadre'" + ] + } + ], + "source": [ + "python['abccadre']" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "key : abracadara\n" + ] + }, + { + "data": { + "text/plain": [ + "'NO such key exists'" + ] + }, + "execution_count": 56, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#python.get('key','msg')\n", + "\n", + "python.get(input(\"key : \").strip().lower(),\"NO such key exists\")" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'name' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0ml\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m \u001b[1;34m'hello'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'hi'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'bye'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ml\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mNameError\u001b[0m: name 'name' is not defined" + ] + } + ], + "source": [ + "l = [ 'hello',1,2,'hi','bye',name]\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['python', 'is', 'sachin', [1, 2, 3, 4, 5, 5], [1, 2, 3], 'my name', {'hello': 'bye', 'hi': 'hi'}]\n" + ] + } + ], + "source": [ + "name = 'sachin'\n", + "data = [ 1,2,3,4,5,5]\n", + "x = [1,2,3]\n", + "y = 'my name'\n", + "z = { 'hello':'bye','hi':'hi'}\n", + "\n", + "mylist = [ 'python','is',name,data,x,y,z]\n", + "print(mylist)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 3, 4, 5, 5]\n" + ] + }, + { + "data": { + "text/plain": [ + "4" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "print(data)\n", + "mylist[3][3]" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 3, 4, 5, 5, 'p', 'y', 't', 'h', 'o', 'n']\n" + ] + } + ], + "source": [ + "data.extend('python')\n", + "print(data)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['python', 'is', 'sachin', [1, 2, 3, 4, 5, 5, 'p', 'y', 't', 'h', 'o', 'n'], [1, 2, 3], 'my name', {'hello': 'bye', 'hi': 'hi'}]\n" + ] + } + ], + "source": [ + "print(mylist)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "d = { (1,2) : 'hello'}" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{(1, 2): 'hello'}" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "d" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'bye'" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "d.get((1,3),'bye')" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "ename": "TypeError", + "evalue": "unhashable type: 'list'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0md\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m{\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m:\u001b[0m \u001b[1;34m'hi'\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m: unhashable type: 'list'" + ] + } + ], + "source": [ + "d = { [1,2] : 'hi'}" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], + "source": [ + "enc_key = { 'a':'b','b':'c','c':'d',}\n", + "dec_key = {}" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a year : 2016\n", + "Not a Leap Year\n" + ] + } + ], + "source": [ + "#leap year\n", + "year = int(input(\"Enter a year : \"))\n", + "if year % 4 == 0 and year % 100 == 0 and year % 400 == 0 : \n", + " print(\"Leap Year\")\n", + "else : \n", + " print(\"Not a Leap Year\")" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a Year : 2013\n", + "Not a Leap Year\n" + ] + } + ], + "source": [ + "year = int(input(\"Enter a Year : \"))\n", + "\n", + "if year % 4 : \n", + " print(\"Not a Leap Year\")\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a number : 23\n", + "23 is an Odd Number.\n" + ] + } + ], + "source": [ + "num = int(input(\"Enter a number : \"))\n", + "if num % 2 : \n", + " print(f\"{num} is an Odd Number.\")\n", + "else : \n", + " print(f'{num} is an EVen Number.')\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "k\n", + "Hello World\n", + "h\n", + "Hello World\n", + "\n" + ] + } + ], + "source": [ + "while input() : \n", + " print(\"Hello World\")" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a Year : 2011\n", + "2011 is Not a Leap Year.\n" + ] + } + ], + "source": [ + "year = int(input(\"Enter a Year : \"))\n", + "if year % 4 : \n", + " print(f\"{year} is Not a Leap Year.\")\n", + "else : \n", + " if year % 100 : \n", + " print(f\"{year} is a Leap Year.\")\n", + " else : \n", + " if year % 400 : \n", + " print(f\"{year} is not a Leap Year.\")\n", + " else : \n", + " print(f\"{year} is a Leap Year.\")" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a Year : 2013\n", + "2013 is Not a Leap Year.\n" + ] + } + ], + "source": [ + "year = int(input(\"Enter a Year : \"))\n", + "if year % 4 : \n", + " print(f\"{year} is Not a Leap Year.\")\n", + "else : \n", + " if (year % 100 ) or (year % 100 == 0 and year % 400 == 0 ) : \n", + " print(f\"{year} is a Leap Year.\")\n", + " else : \n", + " print(f\"{year} is not a Leap Year.\")" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a Year : 2013\n", + "2013 is Not a Leap Year.\n" + ] + } + ], + "source": [ + "year = int(input(\"Enter a Year : \"))\n", + "if year % 4 == 0 and ( year % 100 or year % 400 == 0) : \n", + " print(f\"{year} is a Leap Year.\")\n", + "else : \n", + " print(f\"{year} is Not a Leap Year.\")" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1 Times Hello World \n", + "2 Times Hello World \n", + "3 Times Hello World \n", + "4 Times Hello World \n" + ] + } + ], + "source": [ + "c = 1\n", + "while c <= 10 : \n", + " if c == 5 : \n", + " break\n", + " print(f\"{c} Times Hello World \")\n", + " c = c + 1\n", + "else : \n", + " print(\"Loop is Successfully Executed\")" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "i=0, j=0, j=1, j=2, j=3, j=4, j=5, \n", + "i=1, j=0, j=1, j=2, j=3, j=4, j=5, \n", + "i=2, j=0, j=1, j=2, j=3, j=4, j=5, \n", + "i=3, j=0, j=1, j=2, j=3, j=4, j=5, \n", + "i=4, j=0, j=1, j=2, j=3, j=4, j=5, \n", + "i=5, j=0, j=1, j=2, j=3, j=4, j=5, \n", + "i=6, j=0, j=1, j=2, j=3, j=4, j=5, \n", + "i=7, j=0, j=1, j=2, j=3, j=4, j=5, \n", + "i=8, j=0, j=1, j=2, j=3, j=4, j=5, \n", + "i=9, j=0, j=1, j=2, j=3, j=4, j=5, \n", + "i=10, j=0, j=1, j=2, j=3, j=4, j=5, \n" + ] + } + ], + "source": [ + "i = 0\n", + "while i <= 10 : \n", + " j = 0 \n", + " print(f\"i={i}\",end=', ')\n", + " while j <= 10 : \n", + " print(f\"j={j}\",end=', ')\n", + " if j == 5 : \n", + " break\n", + " j = j + 1\n", + " print()\n", + " i = i + 1" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "*\n", + "**\n", + "***\n", + "****\n", + "*****\n", + "******\n", + "*******\n", + "********\n", + "*********\n", + "**********\n" + ] + } + ], + "source": [ + "c = 1 \n", + "while c <= 10 : \n", + " print(\"*\"*c)\n", + " c = c + 1" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "*********\n", + "********\n", + "*******\n", + "******\n", + "*****\n", + "****\n", + "***\n", + "**\n", + "*\n", + "\n" + ] + } + ], + "source": [ + "c = 1 \n", + "while c <= 10 : \n", + " print(\"*\"*(10-c))\n", + " c = c + 1" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " *\n", + " **\n", + " ***\n", + " ****\n", + " *****\n", + " ******\n", + " *******\n", + " ********\n", + " *********\n", + "**********\n" + ] + } + ], + "source": [ + "c = 1 \n", + "while c <= 10 : \n", + " print(\" \"*(10-c),end='')\n", + " print(\"*\"*c)\n", + " c = c + 1" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " *********\n", + " ********\n", + " *******\n", + " ******\n", + " *****\n", + " ****\n", + " ***\n", + " **\n", + " *\n", + " \n" + ] + } + ], + "source": [ + "c = 1 \n", + "while c <= 10 : \n", + " print(\" \"*c,end='')\n", + " print(\"*\"*(10-c))\n", + " c = c + 1" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "*\n", + "**\n", + "***\n", + "****\n", + "*****\n", + "******\n", + "*******\n", + "********\n", + "*********\n", + "**********\n" + ] + } + ], + "source": [ + "row = 1\n", + "while row <= 10 : \n", + " col = 1\n", + " while col <= row : \n", + " print(\"*\",end='')\n", + " col = col + 1\n", + " print()\n", + " row += 1" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "*********\n", + "********\n", + "*******\n", + "******\n", + "*****\n", + "****\n", + "***\n", + "**\n", + "*\n", + "\n" + ] + } + ], + "source": [ + "row = 1\n", + "while row <= 10 : \n", + " col = 1\n", + " while col <= 10-row : \n", + " print(\"*\",end='')\n", + " col = col + 1\n", + " print()\n", + " row += 1" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/DataType.html b/python_ipynb/DataType.html new file mode 100644 index 0000000..785797c --- /dev/null +++ b/python_ipynb/DataType.html @@ -0,0 +1,14145 @@ + + + + +DataType + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    In [1]:
    +
    +
    +
    print("Hello world")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello world
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    import matplotlib.pyplot as plt 
    +import numpy as np 
    +
    +x = np.linspace(0,2*np.pi,360)
    +sin = np.sin(x)
    +cos = np.cos(x)
    +plt.plot(x,sin,'r')
    +plt.plot(x,cos,'g')
    +plt.show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + + + +
    + +
    + +
    + +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
    import os
    +print(os.path)
    +
    + +
    +
    +
    + +
    +
    +
    +
    +

    DataTypes

    +
      +
    1. Numbers --> int,float,complex
    2. +
    3. Strings
    4. +
    5. List
    6. +
    7. Tuples
    8. +
    9. Dictionary
    10. +
    11. Set
    12. +
    13. FrozenSets
    14. +
    15. Boolean-->True, False
    16. +
    +
    +
    +
    +
    +
    +
    In [1]:
    +
    +
    +
    0.1+0.2-0.3
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[1]:
    + + + + +
    +
    5.551115123125783e-17
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    import decimal
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    decimal.getcontext()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[3]:
    + + + + +
    +
    Context(prec=28, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999, capitals=1, clamp=0, flags=[], traps=[InvalidOperation, DivisionByZero, Overflow])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    decimal.getcontext().prec = 2
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    decimal.Decimal('0.1')+decimal.Decimal('0.2')-decimal.Decimal('0.3')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[5]:
    + + + + +
    +
    Decimal('0.0')
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    python = { 
    +    'name' : 'python',
    +    'version' : 3.7,
    +    'release':1994,
    +    'scope' : [ 's/w dev','ml','data science'],
    +    'modules' : {
    +        'web' : ['flask','django','web2py'],
    +        'gui' : ['tkinter','kivi','wxpython'],
    +        'data' : ['pandas','numpy','stats','Decimal'],
    +        'ml' : ['scikit-learn','tenserflow'],
    +        'automation' : ['ansible','salt']
    +    },
    +    'father' : 'Guido Van Rossum'
    +     }
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'name': 'python', 'version': 3.7, 'release': 1994, 'scope': ['s/w dev', 'ml', 'data science'], 'modules': {'web': ['flask', 'django', 'web2py'], 'gui': ['tkinter', 'kivi', 'wxpython'], 'data': ['pandas', 'numpy', 'stats', 'Decimal'], 'ml': ['scikit-learn', 'tenserflow'], 'automation': ['ansible', 'salt']}, 'father': 'Guido Van Rossum'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    from pprint import pprint
    +pprint(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'father': 'Guido Van Rossum',
    + 'modules': {'automation': ['ansible', 'salt'],
    +             'data': ['pandas', 'numpy', 'stats', 'Decimal'],
    +             'gui': ['tkinter', 'kivi', 'wxpython'],
    +             'ml': ['scikit-learn', 'tenserflow'],
    +             'web': ['flask', 'django', 'web2py']},
    + 'name': 'python',
    + 'release': 1994,
    + 'scope': ['s/w dev', 'ml', 'data science'],
    + 'version': 3.7}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    python['name'].upper()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[6]:
    + + + + +
    +
    'PYTHON'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    python['scope'].sort()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    python['scope']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[10]:
    + + + + +
    +
    ['data science', 'ml', 's/w dev']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    python['modules']['data'][::-1]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[13]:
    + + + + +
    +
    ['Decimal', 'stats', 'numpy', 'pandas']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    dir(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[14]:
    + + + + +
    +
    ['__class__',
    + '__contains__',
    + '__delattr__',
    + '__delitem__',
    + '__dir__',
    + '__doc__',
    + '__eq__',
    + '__format__',
    + '__ge__',
    + '__getattribute__',
    + '__getitem__',
    + '__gt__',
    + '__hash__',
    + '__init__',
    + '__init_subclass__',
    + '__iter__',
    + '__le__',
    + '__len__',
    + '__lt__',
    + '__ne__',
    + '__new__',
    + '__reduce__',
    + '__reduce_ex__',
    + '__repr__',
    + '__setattr__',
    + '__setitem__',
    + '__sizeof__',
    + '__str__',
    + '__subclasshook__',
    + 'clear',
    + 'copy',
    + 'fromkeys',
    + 'get',
    + 'items',
    + 'keys',
    + 'pop',
    + 'popitem',
    + 'setdefault',
    + 'update',
    + 'values']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    python['Name']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +-----------------------------------------------
    +KeyError      Traceback (most recent call last)
    +<ipython-input-16-fad93d760fcf> in <module>()
    +----> 1 python['Name']
    +
    +KeyError: 'Name'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    hash('name')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[17]:
    + + + + +
    +
    7628194596339931819
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [29]:
    +
    +
    +
    hash("Name")
    +print(*'python')
    +print(*[1,2,3])
    +python.keys()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    p y t h o n
    +1 2 3
    +
    +
    +
    + +
    + +
    Out[29]:
    + + + + +
    +
    dict_keys(['name', 'version', 'release', 'scope', 'modules', 'father'])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [30]:
    +
    +
    +
    print("Here are keys of python : ",*python.keys())
    +python[input("Enter key to find value : ")]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Here are keys of python :  name version release scope modules father
    +Enter key to find value : salkf
    +
    +
    +
    + +
    + +
    + + +
    +
    +-----------------------------------------------
    +KeyError      Traceback (most recent call last)
    +<ipython-input-30-d9105e6c78b0> in <module>()
    +      1 print("Here are keys of python : ",*python.keys())
    +----> 2 python[input("Enter key to find value : ")]
    +
    +KeyError: 'salkf'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [33]:
    +
    +
    +
    help(print)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Help on built-in function print in module builtins:
    +
    +print(...)
    +    print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
    +    
    +    Prints the values to a stream, or to sys.stdout by default.
    +    Optional keyword arguments:
    +    file:  a file-like object (stream); defaults to the current sys.stdout.
    +    sep:   string inserted between values, default a space.
    +    end:   string appended after the last value, default a newline.
    +    flush: whether to forcibly flush the stream.
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [37]:
    +
    +
    +
    print('value1','value2',1,2,3,4,sep='\n')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    value1
    +value2
    +1
    +2
    +3
    +4
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [41]:
    +
    +
    +
    print("Hello","World",end='\t')
    +print("Bye","World")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World	Bye World
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [42]:
    +
    +
    +
    print('python')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    python
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [45]:
    +
    +
    +
    print(*'pyhton',sep='\n')#print('p','y','h','t','o','n')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    p
    +y
    +h
    +t
    +o
    +n
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [46]:
    +
    +
    +
    print(*python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    name version release scope modules father
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [47]:
    +
    +
    +
    fp = open('C:/users/sachin/desktop/arya.txt','w')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [49]:
    +
    +
    +
    print("Hello World","This is Awesom.","Python is \
    +easy",sep='\n',file=fp)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [50]:
    +
    +
    +
    fp.close()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [51]:
    +
    +
    +
    python['abccadre']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +-----------------------------------------------
    +KeyError      Traceback (most recent call last)
    +<ipython-input-51-6b52b6c67615> in <module>()
    +----> 1 python['abccadre']
    +
    +KeyError: 'abccadre'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [56]:
    +
    +
    +
    #python.get('key','msg')
    +
    +python.get(input("key : ").strip().lower(),"NO such key exists")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    key : abracadara
    +
    +
    +
    + +
    + +
    Out[56]:
    + + + + +
    +
    'NO such key exists'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/DataType.ipynb b/python_ipynb/DataType.ipynb new file mode 100644 index 0000000..139b3d8 --- /dev/null +++ b/python_ipynb/DataType.ipynb @@ -0,0 +1,683 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello world\n" + ] + } + ], + "source": [ + "print(\"Hello world\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAD8CAYAAABzTgP2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3Xd4k9X7x/H33c3ee09BHCBlg4IMUZHxY4osQRBliewl0DJlOXAwHAzZCrKRjYogLXtT9ihQprKhPb8/Tuq3QKFpm+RJ2vO6rlxtkid5PmX0znnOEqUUhmEYhhHNy+oAhmEYhnsxhcEwDMN4iCkMhmEYxkNMYTAMwzAeYgqDYRiG8RBTGAzDMIyHmMJgGIZhPMQUBsMwDOMhpjAYhmEYD/GxOkBCZM6cWeXPn9/qGIZhGB4lNDT0klIqS1zHeWRhyJ8/PyEhIVbHMAzD8CgictKe48ylJMMwDOMhpjAYhmEYDzGFwTAMw3iIKQyGYRjGQ0xhMAzDMB7ikMIgIt+LyEUR2fuE50VEvhCRMBHZLSIvxXiutYgcsd1aOyKPYRiGkXCOajH8CNR+yvOvA0Vstw7ANwAikhEYDJQDygKDRSSDgzIZhmEYCeCQeQxKqU0ikv8ph9QDpiu9j+gWEUkvIjmAqsBqpdQVABFZjS4wsx2R61Ezds3g5PWTpPVPSzr/dBTKWIhimYuROWVmZ5zO8/zzDxw6BEeOwOXLcOMG3L8PadNC+vSQNy889xxkzWp1UsNI8u5F3iPsShgHLx3k4s2L/HP3H/65+w/dy3cnU8pMTj23qya45QJOx7h/xvbYkx5/jIh0QLc2yJs3b4JCzN03l2VHlj32eO60ualeoDo1CtagTtE6pA9In6D39zh378LKlbB6NaxdCwcP2ve6rFnh1VfhtdfgjTdMoTAMB1BKseXMFlaErWDNsTVsO7eNB1EPHjrGS7xo/nzzJFMYJJbH1FMef/xBpSYDkwECAwNjPSYuS5sv5X7kff699y9Xbl/hyOUj7I/Yz9azW1lyeAnTdk3D39uf+sXq065UO2oUrIFIbBE93I4d8O23MG8eXLsGqVJBlSrQsiUULw7PPKN/2adODb6+uiVx9SocOwb79kFICKxZA3PmgI8PvPkmtG2rv3p7W/3TGYZHCf83nKnbpzJ993TCroThJV6UyVmGHhV68HzW5ymepTg50+QkjV8aUvqmdMnvJFcVhjNAnhj3cwPnbI9XfeTxDc4M4uvtS8YUGcmYIiOFMxbm9SKvAxCloth2dhszd89k1t5ZzN03l1LZS9G/Sn8aFGuAt1cS+IW3YQOMHAm//QYpU0KDBroYvPqqLgBPkiGDvhUsCDVq6MeUgl27YNYsmD4dfv1VF5T+/aF5c10wDMN4ouNXjzP6z9H8sPMH7kXeo1r+agysMpC6z9QlQwqLu1qVUg65AfmBvU947k1gBbqFUB742/Z4RuA4kMF2Ow5kjOtcpUuXVs505/4d9f3271WRL4oohqBemvSS+uPkH049p1MdPKjUG28oBUply6bUyJFKXb3quPe/d0+puXOVeuEFfY6iRZVavtxx728YSci129fUxys/Vj5BPsov2E+9v+R9FXY5zCXnBkKUPb/P7TkozjfRncXhwH10K6Ad0BHoaHtegK+Ao8AeIDDGa9sCYbbbu/acz9mFIdqDyAdq5q6ZKvf43IohqOY/N1cRNyNccm6HuH1bqd69lfLxUSpNGqU+/VSpW7ecd77ISKUWLlSqSBH9T+utt5Q6edJ55zMMDxIVFaVm7Jqhso7JqmSIqPd+fU+duX7GpRlcWhhcfXNVYYh24+4NNWjdIOUb5KuyjcmmFh9c7NLzJ8jffytVvLj+K27bVqnz51137rt3lRo9WqlUqZRKm1ap6dOViopy3fkNw81cuHFBNZjTQDEEVX5qeRVyNsSSHPYWBjPz2Q6p/FIRVC2IkA4hZE+dnbpz6tJxaUfuPrhrdbTHKQVjx0KFCvDvv7BqFXz3HWTL5roMfn7Quzfs3g3PPw+tWkHTpjqPYSQza4+t5bmvn2PZkWV8WuNT/nj3D0rnLG11rKcyhSEeXsj2An+3/5veFXszKXQSVX6owqnrp6yO9T///AONGkGvXrpjec8eqFXLujwFC8LGjbrD+5dfoGxZ+4fEGoaHU0ox6o9R1JpZiyypshDaIZRelXp5xEAWUxjiyc/bj9E1R/NLk184eOkgpSeXZvPpzVbHghMnoHx5PTpo/Hg9FDW9G8zH8PaGvn31XInLl3VxWL7c6lSG4VR3Htyh6YKm9Fvbj0bPNmLre1t5LutzVseymykMCdSgeAO2td9G+oD0VJ9enYUHFloXJiREF4XwcD2/oHt3cLf5F9WqQWgoFCkCdevqy1uGkQRdvnWZGtNrMH//fEbXGM2chnNI7Zfa6ljxYgpDIjyT+Rk2t91MyewlaTivIV/9/ZXrQ6xeDa+8AilSwObNULWq6zPYK08efWmpRg147z0YOlT3iRhGEnH6+mkqfV+Jbee2MbfRXHpX6u2Rk2RNYUikLKmysLbVWt565i06r+jM+L/Gu+7kK1fCW29B4cLw11961rK7S50aliyB1q1hyBB9mckUByMJOHX9FFWnVSX8RjirW66mSYkmVkdKMDM91QFS+qZkQeMFvPPLO/T4rQf3Iu/Rt3Jf55506VJo2BBKlNCthkzOXTvFoXx94fvv9ezrTz+FBw/0SCoP/GRlGAAnrp2g2rRqXL19ldUtV1M2V1mrIyWKKQwO4uvty6yGs/D19qXf2n74efvxcYWPnXOyJUt0UXjxRb28RQYPXKncywu++koXifHjdVEYM8YUB8PjnLh2gqo/VuX63eusabWGwJyBVkdKNFMYHMjHy4fp9adzL/IePX7rQaYUmWhd0sF7D23aBI0bQ8mSuii4w8ijhBKBzz6DyEgYN04v3Ne7t9WpDMNuF29epOaMmvxz9x/WtlrLSzleivtFHsAUBgfz9vJmZoOZXL9znXaL25E+ID31itVzzJvv2aNH9BQoACtWeHZRiCYCX3yhh7L26QOZM+uVWg3Dzd24d4M3Z73J2X/Osq71uiRTFMB0PjuFv48/vzT9hdI5S9N0QVM2ntiY+Dc9eRJq19adt6tWeVafQly8vGDaND0Zr317WLTI6kSG8VT3I+/TaF4jdoTvYF7jeZTPXd7qSA5lCoOTpPZLzfLmyymYoSAN5jYg7EpYwt/s6lW9Kc6tW3okUgI3KnJrfn7w889Qpgy8/baem2EYbkgpxXtL3mPV0VVMqjOJOkXrWB3J4UxhcKJMKTOxtPlSvMSLt2a/xbU71+L/Jg8eQLNmepOcX3/VW2smValTw+LFel2nevXg3DmrExnGY0b/OZrpu6YztOpQ2r3Uzuo4TmEKg5MVzFCQBU0WEHYljGYLmj22VV+c+vTRnczffAMvv+yckO4ka1ZdHK5fh/r14fZtqxMZxn+WHV5G/7X9afZcMwa9PMjqOE5jCoMLVM1fla/f+JpVR1fRY1UP+184bZoeytmlC7RLmp9MYvXCCzBzJmzbpmdImwlwhhs4eOkgzX9pTsnsJfmu7nceOaPZXg4pDCJSW0QOiUiYiDw2s0tEJojITtvtsIhci/FcZIznFjsijztqX7o93cp144u/v2DWnllxv2DrVujQQW+7OW6c8wO6m/r1YdgwvXXoeBfOJjeMWFy7c416c+rh7+3PomaLSOmb0upITiUqkZ/GRMQbOAzURO/etg14Wym1/wnHdwFKKaXa2u7fUErFa4WpwMBAFeKBnZP3I+/z6vRX2RG+g23tt1E8yxOWsLhyBUqV0qN1QkKS1gik+FBKT+RbskSvsVSxotWJjGRIKcX/zfs/lh5eyrpW66iSr4rVkRJMREKVUnHOwHNEi6EsEKaUOqaUugfMAZ42cP9t9FagyY6vty9zGs4hpW9KGs1vxM17Nx8/SClo00avlDpvXvItCqDnOHz/vV58r2lTuHTJ6kRGMjTx74ksOriI0TVGe3RRiA9HFIZcwOkY98/YHnuMiOQDCgDrYjwcICIhIrJFROo7II9by5U2F7MazuJAxAE+WPYBj7XYJkzQn5DHjtVDN5O79Olh/ny4eFHvBBcVZXUiIxkJPRdKz9U9qVO0Dt3Ld7c6jss4ojDE1gPzpOtTzYAFSqnIGI/ltTVtmgOfiUihWE8i0sFWQEIiIiISl9hiNQrWYPArg5mxewY/7vzxf09s2aJHITVooDucDa10ab10xooVetE9w3CB63eu02RBE7KlysaP9X5M0p3Nj3JEYTgD5IlxPzfwpAHozXjkMpJS6pzt6zFgA1AqthcqpSYrpQKVUoFZsmRJbGbLDXx5INXyV6Pryq4cvXJUb8vZrBnkzq03sUlG/wjt0rEjNGkCgwaZyW+G0ymleH/p+5y8dpI5jeaQKWXyuqTriMKwDSgiIgVExA/9y/+x0UUi8gyQAfgrxmMZRMTf9n1moBIQa6d1UuPt5c20+tPwFm9aLGzBg25d4PRpPQrHE1dLdTYR+PZbyJ4dWrTQs8ANw0lm7ZnF3H1zCaoWRMU8yW/QQ6ILg1LqAdAZWAUcAOYppfaJSJCI1I1x6NvAHPXwRfXiQIiI7ALWA6OeNJopKcqTLg/f1vmWLWe2MOL4dOjfHypUsDqW+8qQAX78EQ4dgl69rE5jJFGnr5+m0/JOVMxTkT6V+lgdxxKJHq5qBU8drhqr8+dp2T0fs4ve4493f6d8/spWJ3J/PXrouQ3LlsEbb1idxkhColQUtWbUYsuZLezquItCGWPt8vRYrhyuaiSUUtCuHRNXCLlS56DVkrbcum8ukcRp+HB4/nm9PPfly1anMZKQiX9PZO3xtYx/bXySKwrxYQqDlX74AZYvJ13Qp/zQaCZHrhxh8PrBVqdyfwEBMGOGLgoffWR1GiOJOHz5MH3W9OHNIm/S/qX2VsexlCkMVgkP15dEXn4ZOnfm1QKv0uGlDozfMp6tZ7Zanc79vfii7pOZOVPvf20YiRClonhv8XsE+AQw5a0pyWpoamxMYbBKly565dApU/TSF8CYWmPImSYn7/76Lncf3LU4oAcYMEAvQ/7++3AtAUuaG4bNlNAp/H7qd8bVGkeONDmsjmM5Uxis8MsvelOaIUOgaNH/Hk7rn5Ypb03hwKUDBG0Msi6fp/Dz00tmnD9vRikZCXb2n7P0XtOb6gWq827Jd62O4xZMYXC1q1ehUye9SF6Px5fgrl24Nm1KtmH0n6PZeX6nBQE9TJky0LMnTJ0Ka9ZYncbwMEopPlz+Ifcj7zOpzqRkfwkpmikMrtarF0RE6NnNvr6xHjK+1ngypcxEx6UdiVJmbaA4DRkChQvDBx/AnTtWpzE8yPz981l8aDFB1YKS9SikR5nC4Err1umC0LOnbjE8QYYUGRhXaxxbz25lSugUFwb0UClSwNdfQ1gYjBpldRrDQ1y5fYUuK7pQOkdpPipvRrfFZAqDq9y9Cx9+CIUKweC4h6S+8/w7VMtfjb5r+3LhxgUXBPRwNWvqtaZGjoQjR6xOY3iAvmv6cvnWZb6r+x0+Xj5Wx3ErpjC4yoQJeimHiRP1J9w4iAhfv/k1N+/dpOfqni4ImASMH6/nOHTqZLYDNZ7q77N/M3X7VLqV68aL2V+0Oo7bMYXBFU6dguBgvZx27dp2v6xY5mL0qdSHmbtnsu74urhfkNzlyKFnRa9eDXPnWp3GcFORUZF0Wt6J7KmzM7iqmVAaG1MYXKF7d/0J9rPP4v3S/lX6UzBDQT5c9qGZ22CPDz7Q+zd07w7Xr1udxnBDU7dPJeRcCONqjSOtf1qr47glUxicbeVKPW9h0CDImzfeL0/hm4Kv3/iaQ5cPMe6vcU4ImMR4e+vluS9c0H/mhhHDpVuX6Le2H1XzV6XZc82sjuO2TGFwpjt39AznokXh448T/DavFX6NBsUaMOL3EZz956wDAyZRgYF6Y5+vv4a9e61OY7iRfmv68e+9f5n4+kQzZ+EpTGFwprFj9RDKiRPB3z9xb1VrLA+iHtB3bV8HhUvigoMhbVq9yJ7piDaALWe2MHWH7nAukbWE1XHcmikMznL2rB462bChHkqZSAUzFKRHhR7M3D2Tv07/FfcLkrtMmWDoUFi7FhY/tqGgkcxEqSi6ruhKjtQ5GPyK6XCOi0MKg4jUFpFDIhImIo99pBWRNiISISI7bbf3YjzXWkSO2G6tHZHHLfTvDw8ewJgxDnvLflX6kTNNTrqu7GpmRNvjgw+gRAl9Ge+u6bhPzmbtmcW2c9sYVWMUafzTWB3H7SW6MIiIN/AV8DrwLPC2iDwby6FzlVIlbbepttdmBAYD5YCywGAR8fwNj0NCYPp0PTKmQAGHvW1qv9SMrjGakHMhTNs5zWHvm2T5+OiRYMeOJWhEmJE03Lp/i35r+1E6R2lavNDC6jgewREthrJAmFLqmFLqHjAHqGfna18DViulriilrgKrAfsH+rsjpXRByJpVtxoc7J3n36FC7gr0W9uPf+7+4/D3T3Jq1IB69WDYML0HhpHsjN08ljP/nGHCaxPwEnP13B6O+FPKBZyOcf+M7bFHNRSR3SKyQETyxPO1nuPnn+GPP/7X+elgIsLntT/nws0LDNs0zOHvnySNHQv37kFf03Gf3Jz95yyj/xxNw+INqZKvitVxPIYjCkNsY74eHQayBMivlHoBWANEXwex57X6QJEOIhIiIiEREREJDutUd+5A7956P+J27Zx2mjK5ytD6xdZ8vvVzTlw74bTzJBmFC+tW3PTpsGOH1WkMFxq4fiAPoh7wac1PrY7iURxRGM4AeWLczw2ci3mAUuqyUiq6928KUNre18Z4j8lKqUClVGCWLFkcENsJvvgCjh/Xa/Z4ezv1VMHVgvESLwauG+jU8yQZ/frpkUq9epnhq8nE9vDtTNs5jW7lulEwQ0Gr43gURxSGbUARESkgIn5AM+Ch8YEiEnOvvLrAAdv3q4BaIpLB1ulcy/aY57l4UV/HrlNHX9d2sjzp8vBRuY/4ac9PhJ4Ldfr5PF66dPDJJ3r46irP/Cdm2E8pRfdV3cmUMhMDqgywOo7HSXRhUEo9ADqjf6EfAOYppfaJSJCI1LUd1lVE9onILqAr0Mb22itAMLq4bAOCbI95nk8+0Xs4jx3rslP2rdyXzCkz02t1L5T5FBy3jh31sue9e0NkpNVpDCdaeHAhm05uIqhqEOkC0lkdx+OIJ/5CCQwMVCEhIVbH+J+DB/V4+U6d9OUkF/py65d0XdmVZc2X8UaRN1x6bo80fz40aaL3in7X7O+bFN2PvM+zXz+Ln7cfuzruMnstxCAioUqpwLiOM2O3HGHAAEiVypJF294PfJ/CGQvTe3VvIqPMp+A4NWoE5crpv6tbt6xOYzjB1O1TCbsSxugao01RSCBTGBJryxa9emrPnmBBp7iftx8jq49kX8Q+ftz5o8vP73FE9Gz0s2fh88+tTmM42M17NwnaFETlvJV5s8ibVsfxWKYwJIZSemx81qyJWj01sRoWb0j53OUZtH4QN+/dtCyHx6hSRU96GzkS3HXos5Egn235jPM3zjO6xmizemoimMKQGCtXwsaNuuM5dWrLYogIY2uOJfxGOOP/Gm9ZDo8yapS+lBQcbHUSw0Eu37rMp5s/pe4zdamYp6LVcTyaKQwJFRWlWwsFC0L79lanoVLeStQvVp8xm8dw+dZlq+O4v2LF9N/bN9/otZQMjzfi9xHcuHeDEa+OsDqKxzOFIaFmzYLdu/Uew35+VqcBYFi1Ydy4d4PRf462Oopn+OQT8PWFIUOsTmIk0qnrp5i4bSKtX2xt9lpwAFMYEuLuXRg4EEqV0kMf3USJrCVo8UILvvz7S879G+sEciOmHDn0DnszZ8K+fVanMRJh8IbBCMLQqkOtjpIkmMKQEN9+CydPwujR4OVef4RDqg7hQdQDs8CevXr3hjRpdOvB8Eh7L+5l2s5pdC7bmTzp8sT9AiNO7vVbzRPcuKGXvqhe3SE7szlawQwFaf9Se6Zsn8Kxq+baeZwyZYIePfSQ423brE5jJMCAdQNI45+GfpX7WR0lyTCFIb6++AIuXYIR7tvBNfDlgfh4+TBkwxCro3iG7t0hc2Z9edDwKKHnQll8aDG9KvYiU8pMVsdJMkxhiI9r1/TkqLfegrJlrU7zRDnT5KRL2S7M3D2TfRfNtfM4pUmjV1/97Tc9/NjwGEM3DiVDQAa6lutqdZQkxRSG+Bg/XheHoCCrk8SpT6U+pPZLzScbzLVzu3zwAeTMqZc38cD1w5Kj7eHbWXJ4CR9X+Ji0/o7fFCs5M4XBXpcuwYQJ0LgxlCxpdZo4ZUqZiZ4Ve/LLgV/YdtZcO49TihS6A/rPP2HFCqvTGHYYunEo6QPS06VsF6ujJDmmMNhrzBi4edOjxrx3L9+dzCkzM3C9uXZul7Zt9YTFgQP1BEbDbW0P387iQ4v5uPzHZlltJzCFwR7nz8OXX8I778Czz1qdxm5p/NPQt1Jffjv6GxtObLA6jvvz9YWhQ/X2nz//bHUa4ymCNgaRPiC96VtwElMY7DFypN5MfvBgq5PE24dlPiRnmpwMXDfQbOZjj7ff1ntrDBpkNvNxUzvCd/DroV/pXr67aS04iUMKg4jUFpFDIhImIn1jef5jEdkvIrtFZK2I5IvxXKSI7LTdFj/6WsudPq0ntLVpozeV9zApfFMwoMoA/jz9J2uPr7U6jvvz9taDCw4dgtmzrU5jxCJok2ktOFuiC4OIeANfAa8DzwJvi8ij11t2AIFKqReABcCnMZ67rZQqabvVxd0MH65HqViwCY+jtCvVjtxpczN4w2DTarBH/frw4ou6QDx4YHUaI4ad53ey6OAiPir3EekD0lsdJ8lyRIuhLBCmlDqmlLoHzAHqxTxAKbVeKRW9XdYWILcDzut8x47Bd99Bhw6QL1/cx7spfx9/+lfuz+bTm1l9bLXVcdyfl5ceZHDkiGk1uJmgjUGk809Ht/LdrI6SpDmiMOQCTse4f8b22JO0A2KOBwwQkRAR2SIi9Z/0IhHpYDsuJMJVm6sEBYGPD/Tv75rzOVHbUm3JkzaPaTXYq149PSzZtBrcxq7zu1h4cCEflTetBWdzRGGIbZukWH/ziEgLIBAYE+PhvLbNqZsDn4lIodheq5SarJQKVEoFZnHFFpphYXrVzeiJTx7O38efAVUGsOXMFn47+pvVcdyfiG41hIXBTz9ZncZA9y2k80/HR+U/sjpKkueIwnAGiLmkYW7gsTWfRaQGMACoq5S6G/24Uuqc7esxYANQygGZEm/4cD18sXdvq5M4zLul3iVvurym1WCvunX10urBwabVYLFd53fxy4FfTGvBRRxRGLYBRUSkgIj4Ac2Ah0YXiUgpYBK6KFyM8XgGEfG3fZ8ZqATsd0CmxDl2DGbMgPffh+zZrU7jMH7efgyoMoCtZ7eyMmyl1XHcX3Sr4ehR3Xo0LBO0KYi0/mnpVs70LbhCoguDUuoB0BlYBRwA5iml9olIkIhEjzIaA6QG5j8yLLU4ECIiu4D1wCillPWFYcQI3beQhFoL0dqUbEO+dPlMq8Feb70FL72kWw3371udJlnafWG3bi2U+4gMKTJYHSdZEE/85RAYGKhCQkKc8+YnTkCRItCxo57tnARN3T6V9kvas6z5Mt4o8obVcdzfkiX6stJ33+llMwyXajSvEauPreZEtxOmMCSSiITa+nSfysx8ftSIEXq4Yp8+VidxmtYvtiZ/+vym1WCvOnWgdGm9QZNpNbjUngt7+PnAz3Qr180UBRcyhSGmkyfhxx/hvfcgt2dMtUgIX29fBlYZSMi5EJYdWWZ1HPcX3ddw/DhMn251mmQlaFMQafzSmJFILmYKQ0yjRumvfR9b1SPJafViKwpmKMiQDUNMq8Eeb74JgYG61XDvntVpkoW9F/eyYP8CupXrRsYUGa2Ok6yYwhDt9On/XUPOk/Q3FI9uNYSGh7Lk8BKr47i/6FbDiROm1eAiQRt1a6F7he5WR0l2TGGINnq0/tov+Wwo3vLFlhTKUIihG4eaVoM93nhDb+lqWg1Ot/fiXubvn0/Xcl1Na8ECpjAAnD0LU6boFVQ9eE2k+PLx8mFAlQFsD99u+hrsIaKXXj950rQanCx4U7BuLZQ3rQUrmMIAurUQFZUk1kSKrxYvtKBA+gKm1WCv11/XfQ3Dh5sRSk6y7+I+5u+bT5eyXciUMpPVcZIlUxjOnYPJk6FVK8if3+o0Lufr7cuAKgMIORfC8iPLrY7j/qJbDaavwWmCNwWTyi8VH1f42OooyZYpDGPG6HVwBgywOollWr3Yivzp85tWg73efFPPazCtBofbH7GfefvmmdaCxZJ3YTh/Xu/O1rKl3gQ+mYpuNWw7t82soWSP6FbD8eNmDSUHM60F95C8C8OYMXp0STLsW3hUqxdbkS9dPtNqsFedOnoNpeHDzcqrDrI/Yj9z986lc5nOZE6Z2eo4yVryLQwXL8I338A77+i1kZI5P28/+lfpz9azW1l1dJXVcdxfdKvBrLzqMMM2DSOlb0p6VOxhdZRkL/kWhrFj4e5dGDjQ6iRuo03JNuRNl9e0Guz11lt6v4Zhw0yrIZEORBxgzt45dCnbxbQW3EDyLAwREfDVV/D221C0qNVp3Iaftx/9K/dny5ktZm9oe4jAJ5/oVsOsWVan8WjBm4JNa8GNJM/CMG4c3L6drEciPcm7pd4lT9o8ptVgr+i9oc0ubwl28NJB5uydQ+eypm/BXTikMIhIbRE5JCJhIvLYCnQi4i8ic23PbxWR/DGe62d7/JCIvOaIPE916RJMnAhNm0Lx4k4/nafx8/ajX+V+bD69mTXH1lgdx/1FtxrCwmD2bKvTeKTgTcGk8E1BjwqmteAuEl0YRMQb+Ap4HXgWeFtEnn3ksHbAVaVUYWACMNr22mfRW4GWAGoDX9vez3kmTIBbt0zfwlO0LdWW3Glzm1aDverVgxdeMH0NCfBfa6FMZ7KkymJ1HMPGES2GskCYUuqYUuoeMAeo98gx9YBptu8XANVFRGyPz1FK3VVKHQfCbO/nHFeu6F3ZGjWCEiWcdhpP5+/jT7/K/fjz9J+sO77O6jjuz8v20UXwAAAgAElEQVRLtxoOH4Y5c6xO41GGbRpGgE8APSv2tDqKEYMjCkMu4HSM+2dsj8V6jG2P6OtAJjtf6zgTJsC//8KgQU47RVLRrlQ7cqXJZVoN9mrQAJ5/XrcaIiOtTuMRDl06xOy9s+lUppNpLdjj4EE96/7YMaefyhGFQWJ57NHfJE86xp7X6jcQ6SAiISISEhEREc+INpcuQZMm+j+w8VTRrYbfT/3O+hPrrY7j/qJbDYcOwdy5VqfxCMN+N62FeBk2DDZuhLRpnX4qRxSGM0DMnW1yA+eedIyI+ADpgCt2vhYApdRkpVSgUiowS5YEfrr45hszrDAe2r3UjpxpcjJ041Cro3iG//s/eO45CAoyrYY4HL58mFl7ZvFh4IdkTZXV6jju7/BhPbjhww8hs/NHbjmiMGwDiohIARHxQ3cmL37kmMVAa9v3jYB1Sl+fWAw0s41aKgAUAf52QKYn83Zu33ZSEuATQN9Kfdl0chMbTmywOo77i9lqmDfP6jRubdimYfh7+9OrUi+ro3iGESPA3x96uGbkVqILg63PoDOwCjgAzFNK7RORIBGpazvsOyCTiIQBHwN9ba/dB8wD9gMrgU5KKfNRy420L92eHKlzMGTDEKujeIaGDfXAhuBg02p4gsOXD/PTnp/4sIxpLdgletmVjh0hWzaXnNIh8xiUUsuVUkWVUoWUUsNtj32ilFps+/6OUqqxUqqwUqqsUupYjNcOt73uGaXUCkfkMRwnwCeAvpX7svHkRjae2Gh1HPfn5aUHNxw4APPnW53GLQ3/fbhuLVQ0rQW7jBgBvr7Qy3V/Xslz5rMRL+1fak/21NlNX4O9GjWCZ5/VrYaoKKvTuJUjl48wc/dMPgj8gGypXfPp16MdP643hOrQAXLkcNlpTWEw4pTCNwV9KvVh/Yn1bDq5yeo47s/bW7ca9u+HBQusTuNW/mstmL4F+4wapVuhvXu79LSmMBh2eb/0+2RLlc20GuzVuDEUK6ZHKJlWAwBhV8L+ay1kT53d6jju79Qp+OEHeO89yOW86V2xMYXBsEt0q2Hd8XX8ceoPq+O4P29vPUJp3z74+Wer07iF4b8Px9fb17QW7DVqlP7ap4/LT20Kg2G39wNNqyFemjQxrQabsCthzNg1w7QW7HXmDHz3HbRtC3nzuvz0pjAYdkvpm5JeFXux5tga/jz1p9Vx3J+3t16sce9e+OUXq9NYKrq10LuSa6+Ve6xPP9UfJvo+tli1S5jCYMRLx8COZEmZxbQa7NWsmd4MKhm3Go5eOcqMXTPoWLqjaS3YIzwcJk+G1q0hf35LIpjCYMRLKr9U9K7Um9XHVvPX6b+sjuP+okco7dkDixZZncYSprUQT2PG6OXb+/e3LIIpDEa8fRD4gWk1xEezZlCkSLJsNRy7eozpu6bzfun3yZHGdePwPdaFC/Dtt9CyJRQsaFkMUxiMeEvll4qeFXuy6ugqtpzZYnUc9+fjo1sNu3bBr79ancalhm/SrYU+lVw/ssYjjR0Ld+9a2loAUxiMBPqwzIdkTpnZtBrs9fbbULiwbjUkk/0tjl89zvTd0+nwUgfTWrBHRAR8/TU0b65bmBYyhcFIkNR+qelZoScrw1by91nnLoibJPj46BFKO3fC4kcXH06ahm0ahrd406eyaS3YZfx4uH0bBgywOokpDEbCdSrbiUwpMplWg73eeQcKFYKhQ5N8q+HolaNM2zWNjoEdyZkmp9Vx3N/lyzBxou6PKlbM6jSmMBgJl9ovNT0q9GD5keWm1WCP6FbDjh2wZInVaZwqeFOw6VuIjwkT4OZNt2gtgCkMRiJ1LtuZjCkyErQxyOoonqFFCz3aJAm3Go5cPsKM3XqWs+lbsMPly/D553pV3hIlrE4DmMJgJFIa/zT0qNCDZUeWEXIuxOo47i+61bB9OyxdanUapwjeFIy/t79pLdhr7FjdWhgyxOok/0lUYRCRjCKyWkSO2L5miOWYkiLyl4jsE5HdItI0xnM/ishxEdlpu5VMTB7DGp3LdiZDQAbTarBXixZQoECSbDUcunTov93ZzH4Ldrh4Eb78Uo9ae/ZZq9P8J7Ethr7AWqVUEWCt7f6jbgGtlFIlgNrAZyKSPsbzvZRSJW23nYnMY1ggrX9aPq7wMUsOLyH0XKjVcdyfr6++lhwaCsuXW53GoYI3BRPgE2BmOdtrzBg9EumTT6xO8pDEFoZ6wDTb99OA+o8eoJQ6rJQ6Yvv+HHARyJLI8xpupkvZLrrVsMm0GuzSqpVeB2fIkCTTajh46SCz986mU5lOZi9ne5w/D199pVuQzzxjdZqHJLYwZFNKhQPYvj71X4OIlAX8gKMxHh5uu8Q0QUT8E5nHsEi6gHR0L9+dxYcWsyN8h9Vx3F90qyEkBFYkja3OgzYGkcInhdnL2V6jR8O9e3pWvJuJszCIyBoR2RvLrV58TiQiOYAZwLtKqegFY/oBxYAyQEbgib1VItJBREJEJCQiIiI+pzZcpGu5rqQPSG9aDfZq1Qry5UsSfQ37I/YzZ+8cOpftTJZU5oJAnM6dg2++0SuoFi5sdZrHxFkYlFI1lFLPxXL7Fbhg+4Uf/Yv/YmzvISJpgWXAQKXUlhjvHa60u8APQNmn5JislApUSgVmyWL+4bmjdAHp+KjcRyw6uIid5013UZz8/PSaOH//DStXWp0mUYI2Bv23hpZhh5EjITJSj1BzQ4m9lLQYaG37vjXw2AphIuIHLASmK6XmP/JcdFERdP/E3kTmMSzWrXw30vmnMyOU7NWmjd6hy4NbDfsu7mPevnl0KduFzCkzWx3H/Z0+rfdbaNtWj05zQ4ktDKOAmiJyBKhpu4+IBIrIVNsxTYCXgTaxDEv9SUT2AHuAzMCwROYxLJY+ID0flf+IhQcXsuv8LqvjuL/oVsPWrfDbb1anSZChG4f+NwvesMOIEfpDgJvMco6NKA/8lBIYGKhCQsxkKnd19fZV8n+enxoFa/Bzk5+tjuP+7t3T15lz5YLNm0HE6kR223V+FyUnlWRAlQEMe9V8rovTiRN6R7/27fWIJBcTkVClVGBcx5mZz4bDZUiRgY/KfcQvB35h94XdVsdxf9Gthi1bYPVqq9PEy8D1A0kfkN60Fuw1fDh4eUG/flYneSpTGAyn+Kj8R6T1T0vwpmCro3iGd9+F3Lk9qq9h8+nNLD28lN4Ve5MhxWOLHhiPOnoUfvgB3n9f/127MVMYDKfIkCIDXct2ZcH+BabVYA9/f/0pcvNmWLPG6jRxUkrRf21/sqXKRtdyXa2O4xmGDtXzV/rGtkCEezGFwXCajyt8TPqA9AxY576dbG6lXTvIk0cPYXTzVsPqY6vZeHIjA18eSCq/VFbHcX979sDMmdC1K+Rw/xVnTWEwnCZDigz0qdSHpYeX8sepP6yO4/78/fUSGX//DYsWWZ3miaJbC/nS5aP9S+2tjuMZBg6EtGmhj2esOGsKg+FUXct1JUfqHPRd0xdPHAHncq1a6R28BgyABw+sThOrhQcXEhoeypCqQ/D3MavYxGnzZr2da+/ekDGj1WnsYgqD4VQpfVMy+JXB/Hn6T5YdWWZ1HPfn46NHrhw4ADNmWJ3mMZFRkQxcN5DimYvT8oWWVsdxf0rpvqNs2aBbN6vT2M0UBsPp2pZqS+GMhem3th+RUZFWx3F/DRpAmTIweDDcuWN1mofM3D2TA5cOEFwtGG8vb6vjuL9Vq2DTJr1QXirP6YsxhcFwOl9vX4ZVG8bei3uZvXe21XHcn4heS+f0ab3Qmpu4++AugzcMpnSO0vxf8f+zOo77i4rS81MKFNAT2jyIKQyGSzQu0ZhS2UsxaP0g7kXeszqO+6teHWrU0JeV/vnH6jQATN0+lZPXTzKi+gjEg2ZnW2b+fNixA4KC9CRGD2IKg+ESXuLFyOojOXHtBJNCJlkdxzOMGKE3ih83zuok3Lh3g+BNwbyS7xVqFqxpdRz3d/++vnz03HN6204PYwqD4TK1CtWiav6qBG8K5t+7/1odx/2VKQONGunCcDHWFe1dZuzmsVy4eYFRNUaZ1oI9fvgBjhzRxd3b8/piTGEwXEZEGFV9FBG3Ivhsy2dWx/EMw4bpDuhg65YWCf83nDGbx9D42caUz13eshwe48YNvYdzpUpQp47VaRLEFAbDpcrlLkeDYg0Ys3kMETfNTnxxeuYZPSP622/h8GFLIgzeMJj7kfcZWX2kJef3OJ9+Chcu6Jaeh7auTGEwXG74q8O5df8WQzYMsTqKZwgKgoAAPUHKxfZd3Md3O76jU5lOFMpYyOXn9zhnz8LYsdC0KZQrZ3WaBDOFwXC54lmK0zGwI5NCJ7E/Yr/Vcdxftmx64bVff4WNG1166t5repPGLw0DX3bPLSjdzqBBesvOkZ7dukpUYRCRjCKyWkSO2L7GuvauiETG2L1tcYzHC4jIVtvr59q2ATWSgcGvDCa1X2p6re5ldRTP0L27Xqr544/1+HgXWHtsLcuPLGdAlQFkSpnJJef0aLt2wY8/Qpcubrtlp70S22LoC6xVShUB1trux+a2Uqqk7VY3xuOjgQm2118F2iUyj+EhsqTKwsCXB7L8yHJ+O+qZW1q6VMqUeoTL9u3w009OP12UiqLX6l7kS5ePLuW6OP18Hk8p6NkTMmRw6y077ZXYwlAPmGb7fhpQ394Xih7z9iqwICGvNzxfl7JdKJC+AD1+62GWyrDHO+9A6dJ6Nu3t20491U+7f2LH+R2MqD6CAJ8Ap54rSVi5Uu+j8cknujh4uMQWhmxKqXAA29esTzguQERCRGSLiET/8s8EXFNKRS8heQbI9aQTiUgH23uERESY0SxJgb+PP5/W/JS9F/fy/Y7vrY7j/ry89EiXM2dgwgSnnebW/VsMWDeAwJyBNHuumdPOk2Q8eKBbC4UKwQcfWJ3GIeIsDCKyRkT2xnKrF4/z5LVtQN0c+ExECgGxjeN64rrMSqnJSqlApVRglixZ4nFqw501LN6QSnkqMXD9QDPpzR6vvAL16unOzQsXnHKKMX+O4fQ/pxlXaxxeYsanxOn772H/fhg92uOWvniSOP/WlVI1lFLPxXL7FbggIjkAbF9jnZ6plDpn+3oM2ACUAi4B6UXEx3ZYbuBcon8iw6OICONfG8/FmxcZ9ccoq+N4hk8/1ZPeBg1y+FufvHaSUX+OokmJJryc72WHv3+Sc+2a3oSncmX4v6SzsGBiPw4sBlrbvm8N/ProASKSQUT8bd9nBioB+5XetWU90OhprzeSvrK5yvLO8+8w7q9xnLh2wuo47q9oUejcGaZOhdBQh751r9W9EIQxNcc49H2TrMGD4dIl+OILj53MFpvEFoZRQE0ROQLUtN1HRAJFZKrtmOJAiIjsQheCUUqp6MHrfYCPRSQM3efwXSLzGB5qZPWReHt50+O3HlZH8QxDhkCWLHpopIOGr244sYH5++fTt3Jf8qbL65D3TNL27oWvvoL334dSpaxO41DiidstBgYGqpCQEKtjGA424vcRDFg3gFUtVlGrUC2r47i/H3+Ed9/VX1u3juvop3oQ9YDSk0tz/c51DnQ6QArfFA6JmGQppZdG37lTL5aXyTPmeYhIqK2/96lMz5LhNnpU6EGRjEXosqILdx/ctTqO+2vVCsqX1xvMX7+eqLeaHDqZ3Rd2M7bWWFMU7PHzz7B+vV7k0EOKQnyYwmC4DX8ff754/QsOXz7MhC3OG46ZZHh5wcSJeknuoUMT/DZXbl9h0PpBVMtfjYbFGzowYBJ16xb06AEvvqgvIyVBpjAYbqV24drUL1af4E3BnL5+2uo47q90ab1t5Jdf6iGTCdB3TV+u37nO57U/N3st2GPUKDh1Sv+Ze+BeC/YwhcFwOxNem0CUijId0fYaPhzSpNEd0fHsM/zz1J9M2T6Fj8p/xPPZnndSwCTk8GE9XLh5c6hSxeo0TmMKg+F28qfPT//K/Zm/fz5rjq2xOo77y5xZr6O0bh3MnGn3y+5F3uP9pe+TJ20ehlQd4rx8SYVS0LEjpEjhFtutOpMpDIZb6lWpF4UzFqbj0o7cvu/cdYGShA4doGJFvQrrpUt2vWT8X+PZF7GPiW9MJLVfaicHTAKmTdMdzqNHQ/bsVqdxKlMYDLcU4BPA5DqTOXr1KEM3JrxjNdnw8oJJk/TopJ494zz8+NXjBG0Mon6x+tR9pm6cxyd7ly7pP9dKleC996xO43SmMBhuq1qBarQr1Y6xm8ey8/xOq+O4v+ee00NXp02DtWufeJhSik7LO+Ht5c0Xtb9wYUAP1qOHLrqTJukinMQl/Z/Q8Ghjao4hc8rMvLf4PR5EPYj7BcndwIFQpIgeRvmEpbkX7F/AirAVBFUNIk+6PC4O6IHWroXp0/XWqiVKWJ3GJUxhMNxahhQZ+PL1LwkND+WLrebTbZwCAuDbb+HoUQgOfuzpS7cu0XlFZ17K8ZLZgMcet2/rDudChXTRTSZMYTDcXqNnG/FW0bcYtH4Qx68etzqO+3v1VWjTBsaM0Us2xNB1RVeu3r7KD/V+wMfLJ/bXG/8zaBCEhelimyL5zAg3hcFweyLC129+jbd4035Je6KUa/Y89mjjxulhrK1bw129vMiig4uYvXc2g14exAvZXrA4oAf4808YP163GGrUsDqNS5nCYHiE3GlzM7bWWNYeX8vX2762Oo77y5gRpkyB3bshKIgrt6/QcWlHSmYvSd/KT9qa3fjPrVu61ZUvn57QlsyYtqThMdq/1J5FBxfRe3VvahWqRdFMRa2O5N7q1NGrr44aRdd8oVy+fZmVLVbi6+1rdTL317+/voS0bp2eVZ7MmBaD4TFEhKl1pxLgE0Crha3MKCV7TJjA3MoZ+Cl8FQPK96Zk9pJWJ3J/mzbB55/rzZCqVbM6jSVMYTA8Ss40Ofn6za/ZenYro/8YbXUct3eK63SseZfyp2HgMrOndpyuXoUWLfQopFHJd6vZRBUGEckoIqtF5Ijta4ZYjqkmIjtj3O6ISH3bcz+KyPEYz5mPM0acmj3XjKYlmjJk4xC2nd1mdRy3FRkVqVtW3jAzTSt8Pv8Sli2zOpb7UkovLRIeDrNnQ6pUVieyTGJbDH2BtUqpIsBa2/2HKKXWK6VKKqVKAq8Ct4DfYhzSK/p5pZSZ3mrY5es3vyZnmpw0XdCU63cSt0lNUjVm8xg2ntzIxNcnUmjkJL1/QJs2cO6c1dHc0w8/wIIFevOdMmWsTmOpxBaGesA02/fTgPpxHN8IWKGUupXI8xrJXMYUGZndcDanrp+iw9IOeOIWtc607ew2Bq0fRONnG9PqxVZ64tucOXq0TcuWEBlpdUT3cuiQXrb81VehVy+r01gusYUhm1IqHMD2NWscxzcDZj/y2HAR2S0iE0TE/0kvFJEOIhIiIiERERGJS20kCRXzVCS4WjDz9s1jyvYpVsdxG5dvXabx/MbkTJOTb+t8+7/Nd4oVgy++0CNtkuEQzCe6fRvefltPYJs+PVmshRSXOP8ERGSNiOyN5VYvPicSkRzA88CqGA/3A4oBZYCMQJ8nvV4pNVkpFaiUCsySJUt8Tm0kYX0q96FGwRp0W9mNPRf2WB3HclEqipYLWxJ+I5wFjReQMUXGhw9o2xaaNNEzejdssCSjW1EKOnWCHTvgxx8hVy6rE7mFOAuDUqqGUuq5WG6/Ahdsv/Cjf/FffMpbNQEWKqXux3jvcKXdBX4AyibuxzGSGy/xYkaDGaQPSE+DuQ24evuq1ZEsNeL3EawIW8Fnr31GmVyxXCcX0RPfihTRBeLMGdeHdCdTpui+hUGD9LwPA0j8paTFQGvb962BX59y7Ns8chkpRlERdP/E3kTmMZKh7Kmzs6DxAk5dP0XzX5oTGZU8r5+vObaGT9Z/QvPnm9MxsOOTD0ybFhYuhDt3oGHD/5bMSHb+/lv3K7z2GgwebHUat5LYwjAKqCkiR4CatvuISKCITI0+SETyA3mAjY+8/icR2QPsATIDwxKZx0imKuWtxJevf8nKsJUMXJd8VsGMFnYljKYLmlI8S3Em1Zn0v36FJylWTO/bEP3LMbm5eBEaNYIcOeCnn8Db2+pEbiVRS2IopS4D1WN5PAR4L8b9E8BjF++UUq8m5vyGEdP7ge+zPXw7o/4cRakcpWhSoonVkVzi6u2r1JlVB0FY3Gyx/dt0NmgA/frByJF6KGunTs4N6i7u3IH69SEiAv74AzJlsjqR2zFrJRlJypdvfMneiL20WdSGvOnyUj53easjOdX9yPs0WdCEY1ePsabVGgplLBS/NwgOhr17oWtXyJsX3nrLOUHdRVSUnsvx118wfz6ULm11IrdkxmUZSYqftx8Lmy4kZ5qcvDX7LY5cPmJ1JKdRStF1RVfWHFvD5Lcm83K+l+P/Jt7eepZvqVLQrBmEhjo+qDsZNAjmzoXRo/WlJCNWpjAYSU7WVFlZ2WIlALV/qs2FGxcsTuQcwzYN49vQb+ldsTdtSrZJ+BulSgVLl0KWLHpkzsmTDsvoVr7/HkaMgPbtzSS2OJjCYCRJhTMWZunbSwn/N5w6s+tw494NqyM51Jdbv+STDZ/Q6sVWjKwxMvFvmD07LF+uJ3vVqgXnzyf+Pd3JvHm6INSqBV99pYftGk9kCoORZJXLXY55jeexI3wHb/z0RpIpDtN3Tafryq7UL1af7+p+h5c46L/xs8/qRfbOnoXq1XXnbFKwZAm88w5UrAi//AK+Zj+KuJjCYCRpdYrWYVbDWWw+vZk3Z73JzXs3rY6UKD/v/5m2v7aleoHqzG442/H7NleqpH+RHjsGNWvClSuOfX9XW7NG9yWUKqWLXjJeMTU+TGEwkrwmJZow8/9m8sepP6gzu47HFodZe2bRdEFTyuYqy6JmiwjwCXDOiapVg0WL4MABPfnLU4vDqlVQt66es7FypZ7YZ9jFFAYjWWj2XDNmNJjBppObqP1TbY9bOuO77d/R4pcWVMlXhd9a/mb/XIWEeu01+PlnvWf0yy/ry0ueZMECPfS2aFFYvVrvgW3YzRQGI9lo/nxzZjeczd9n/6bKD1U4ff201ZHipJQieGMw7y15j9cKv8by5sudXxSi1amjP2mfPKkvMR0+7JrzJtaUKdC0KZQtqxcKzBrXos/Go0xhMJKVJiWasPKdlZz+5zQVv6/IjvAdVkd6onuR92i7uC2fbPiEli+0ZFHTRaTwTeHaENWqwfr1cPMmlC+vl+x2V5GR0KOH3oXttdf0paT06a1O5ZFMYTCSnWoFqrGpzSYAKn5fkZ92/2Rxosed+/ccNabX4MedPzLklSFMqz8Nf58nblfiXIGBsGWLXlcoerinu22MdO2aXuZi/Hi99tPixaajORFMYTCSpRezv0hoh1DK5SpHi4Ut6LK8C7fv37Y6FgBrj62l1KRShIaHMuv/ZjG46uC4F8VztkKF9DISr78OnTtD8+Zw3U22VN26VY86WrlSF60vvgAfs9pPYpjCYCRbWVNlZXXL1XQv352J2yYSOCWQneet23b89v3b9PytJzVn1CRjioxsa7+Nt59/27I8j0mbVo9WGj5crzNUsiRs3mxdnvv39QKAlSvr+3/8AR9+aF2eJMQUBiNZ8/X2Zfxr41n5zkqu3r5K2SllGbB2gMuHtP5+8ndKTirJuL/G0aF0B7a138azWZ51aQa7eHtD//7w++/6fuXK+pfxtWuuzREaqjuX+/fXq8Tu2AHlyrk2QxJmCoNhAK8Vfo09H+yh2XPNGPHHCIp/VZy5e+cSpaKcet5jV4/RZH4TXv7xZe4+uMvqlqv5ts63rht5lFAVKuihrN26waRJULw4TJ6sP8U709mzemmLsmXhwgU9pHbePNPJ7GhKqQTfgMbAPiAKCHzKcbWBQ0AY0DfG4wWArcARYC7gZ895S5curQzDWX4/+bt64ZsXFENQJb4qoebsmaPuR9536DkORBxQ7X5tp3yDfFXK4SnV0A1D1Y27Nxx6DpcJDVWqYkWlQKmCBZX6/nulbt927DmOH1eqe3elAgKU8vVVqls3pa5edew5kgEgRNnzu92eg574YigOPANseFJhALyBo0BBwA/YBTxre24e0Mz2/bfAB/ac1xQGw9keRD5Qs3bPUsUnFlcMQeUal0sNXDtQHbl8JMHveePuDTVz10xVe2ZtxRBUwLAA9cHSD9SZ62ccmNwiUVFKLV2qVMmS+tdKpkxK9eql1M6d+rmEuHVLqYULlWrQQCkvL6W8vZVq0UKpY8ccmz0ZsbcwiHLAsDMR2QD0VHrntkefqwAMUUq9Zrvfz/bUKCACyK6UevDocU8TGBioQkIeO5VhOFxkVCRLDi9hyvYprAxbSZSKomimotQuVJsKeSrwfNbnKZqpKL7eDy/MppQi/EY4hy8fZsuZLWw4sYHfT/3Orfu3yJM2D++WfJfOZTuTJVUWi34yJ1FKz3v46iv49Vc9tyBfPnjjDX35p0wZKFgQUqR4/HWXLulJdH/9pTu1f/tNz5/InFlfPvrwQ8id25qfK4kQkVClVGCcx7mgMDQCaiul3rPdbwmUA4YAW5RShW2P5wFWKKWei+t8pjAYVjh9/TQLDy5kRdgKNpzYwJ0Hd/57Ln1AejKm0Msu3Lp/i+t3rnP7wf+Gv5bIUoJq+avRuERjKuet7LgVUd3ZxYt6Qb6FC2HjRrgRY3XbdOn0lppRUbp4REToLTejFSwINWpA48bwyitmRVQHsbcwxDnYV0TWANljeWqAUupXe7LE8ph6yuNPytEB6ACQN29eO05rGI6VJ10eupbrStdyXbkXeY+Dlw6y58Iejlw5wpXbV7hy+woiQgqfFKTxS0OhjIUonLEwJbOXJGuqZLgsQ9as0K6dvkVG6tZAaCicOgXh4XD1Knh56VuWLHpr0QIFdKsiWzar0ydrcRYGpVSNRJ7jDJAnxv3cwDngEpBeRHyUUg9iPP6kHJOByaBbDInMZBiJ4uftxwvZXuCFbC9YHUyh56IAAARDSURBVMUzeHvrkUvFi1udxLCDK9qz24AiIlJARPyAZsBiW0fIeiB649XWgD0tEMMwDMOJElUYRKSBiJwBKgDLRGSV7fGcIrIcwNYa6AysAg4A85RS+2xv0Qf4WETCgEzAd4nJYxiGYSSeQzqfXc10PhuGYcSfvZ3PyWBohGEYhhEfpjAYhmEYDzGFwTAMw3iIKQyGYRjGQ0xhMAzDMB7ikaOSRCQCOJnAl2dGT67zVJ6eHzz/Z/D0/OD5P4On5wdrfoZ8Sqk4F+jyyMKQGCISYs9wLXfl6fnB838GT88Pnv8zeHp+cO+fwVxKMgzDMB5iCoNhGIbxkORYGCZbHSCRPD0/eP7P4On5wfN/Bk/PD278MyS7PgbDMAzj6ZJji8EwDMN4imRVGESktogcEpEwEelrdZ74EJHvReSiiOy1OktCiEgeEVkvIgdEZJ+IdLM6U3yJSICI/C0iu2w/w1CrMyWEiHiLyA4RWWp1loQQkRMiskdEdoqIx62mKSLpRWSBiBy0/X+oYHWmRyWbS0ki4g0cBmqiNw/aBrytlNpvaTA7icjLwA1guj3bn7obEckB5FBKbReRNEAoUN9T/vwBRESAVEqpGyLiC/wBdFNKbbE4WryIyMdAIJBWKVXH6jzxJSIngECllEfOYxCRacDvSqmptj1qUiqlrlmdK6bk1GIoC4QppY4ppe4Bc4B6Fmeym1JqE3DF6hwJpZQKV0ptt33/L3pvjlzWpoofpUVvXOxru3nUJysRyQ28CUy1OktyJCJpgZex7T2jlLrnbkUBkldhyAWcjnH/DB72iympEJH8QClgq7VJ4s92GWYncBFYrZTytJ/hM6A3EGV1kERQwG8iEmrbC96TFAQigB9sl/Omikgqq0M9KjkVBonlMY/6tJcUiEhq4GfgI6XUP1bniS+lVKRSqiR6j/KyIuIxl/VEpA5wUSkVanWWRKqklHoJeB3oZLvM6il8gJeAb5RSpYCbgNv1dyanwnAGyBPjfm7gnEVZkiXbdfmfgZ+UUr9YnScxbM3/DUBti6PERyWgru0a/RzgVRGZaW2k+FNKnbN9vQgsRF8m9hRngDMxWpoL0IXCrSSnwrANKCIiBWwdPs2AxRZnSjZsHbffAQeUUuOtzpMQIpJFRNLbvk8B1AAOWpvKfkqpfkqp3Eqp/Oh//+uUUi0sjhUvIpLKNngB2yWYWoDHjNRTSp0HTovIM7aHqgNuNwDDx+oArqKUeiAinYFVgDfwvVJqn8Wx7CYis4GqQGYROQMMVkp9Z22qeKkEtAT22K7RA/RXSi23MFN85QCm2Ua4eQHzlFIeOeTTg2UDFurPGfgAs5RSK62NFG9dgJ9sH1CPAe9anOcxyWa4qmEYhmGf5HQpyTAMw7CDKQyGYRjGQ0xhMAzDMB5iCoNhGIbxEFMYDMMwjIeYwmAYhmE8xBQGwzAM4yGmMBiGYRgP+X9GN9bsS7cSZQAAAABJRU5ErkJggg==\n", + "text/plain": [ + "
    " + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "import matplotlib.pyplot as plt \n", + "import numpy as np \n", + "\n", + "x = np.linspace(0,2*np.pi,360)\n", + "sin = np.sin(x)\n", + "cos = np.cos(x)\n", + "plt.plot(x,sin,'r')\n", + "plt.plot(x,cos,'g')\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "print(os.path)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    DataTypes

    \n", + "
      \n", + "
    1. Numbers --> int,float,complex
    2. \n", + "
    3. Strings
    4. \n", + "
    5. List
    6. \n", + "
    7. Tuples
    8. \n", + "
    9. Dictionary
    10. \n", + "
    11. Set
    12. \n", + "
    13. FrozenSets
    14. \n", + "
    15. Boolean-->True, False
    16. \n", + "
    \n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "5.551115123125783e-17" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "0.1+0.2-0.3" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "import decimal" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Context(prec=28, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999, capitals=1, clamp=0, flags=[], traps=[InvalidOperation, DivisionByZero, Overflow])" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "decimal.getcontext()" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "decimal.getcontext().prec = 2" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Decimal('0.0')" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "decimal.Decimal('0.1')+decimal.Decimal('0.2')-decimal.Decimal('0.3')" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "python = { \n", + " 'name' : 'python',\n", + " 'version' : 3.7,\n", + " 'release':1994,\n", + " 'scope' : [ 's/w dev','ml','data science'],\n", + " 'modules' : {\n", + " 'web' : ['flask','django','web2py'],\n", + " 'gui' : ['tkinter','kivi','wxpython'],\n", + " 'data' : ['pandas','numpy','stats','Decimal'],\n", + " 'ml' : ['scikit-learn','tenserflow'],\n", + " 'automation' : ['ansible','salt']\n", + " },\n", + " 'father' : 'Guido Van Rossum'\n", + " }" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'python', 'version': 3.7, 'release': 1994, 'scope': ['s/w dev', 'ml', 'data science'], 'modules': {'web': ['flask', 'django', 'web2py'], 'gui': ['tkinter', 'kivi', 'wxpython'], 'data': ['pandas', 'numpy', 'stats', 'Decimal'], 'ml': ['scikit-learn', 'tenserflow'], 'automation': ['ansible', 'salt']}, 'father': 'Guido Van Rossum'}\n" + ] + } + ], + "source": [ + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'father': 'Guido Van Rossum',\n", + " 'modules': {'automation': ['ansible', 'salt'],\n", + " 'data': ['pandas', 'numpy', 'stats', 'Decimal'],\n", + " 'gui': ['tkinter', 'kivi', 'wxpython'],\n", + " 'ml': ['scikit-learn', 'tenserflow'],\n", + " 'web': ['flask', 'django', 'web2py']},\n", + " 'name': 'python',\n", + " 'release': 1994,\n", + " 'scope': ['s/w dev', 'ml', 'data science'],\n", + " 'version': 3.7}\n" + ] + } + ], + "source": [ + "from pprint import pprint\n", + "pprint(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'PYTHON'" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python['name'].upper()" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "python['scope'].sort()" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['data science', 'ml', 's/w dev']" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python['scope']" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Decimal', 'stats', 'numpy', 'pandas']" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python['modules']['data'][::-1]" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['__class__',\n", + " '__contains__',\n", + " '__delattr__',\n", + " '__delitem__',\n", + " '__dir__',\n", + " '__doc__',\n", + " '__eq__',\n", + " '__format__',\n", + " '__ge__',\n", + " '__getattribute__',\n", + " '__getitem__',\n", + " '__gt__',\n", + " '__hash__',\n", + " '__init__',\n", + " '__init_subclass__',\n", + " '__iter__',\n", + " '__le__',\n", + " '__len__',\n", + " '__lt__',\n", + " '__ne__',\n", + " '__new__',\n", + " '__reduce__',\n", + " '__reduce_ex__',\n", + " '__repr__',\n", + " '__setattr__',\n", + " '__setitem__',\n", + " '__sizeof__',\n", + " '__str__',\n", + " '__subclasshook__',\n", + " 'clear',\n", + " 'copy',\n", + " 'fromkeys',\n", + " 'get',\n", + " 'items',\n", + " 'keys',\n", + " 'pop',\n", + " 'popitem',\n", + " 'setdefault',\n", + " 'update',\n", + " 'values']" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dir(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "ename": "KeyError", + "evalue": "'Name'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m-----------------------------------------------\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mpython\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'Name'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m: 'Name'" + ] + } + ], + "source": [ + "python['Name']" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "7628194596339931819" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "hash('name')" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "p y t h o n\n", + "1 2 3\n" + ] + }, + { + "data": { + "text/plain": [ + "dict_keys(['name', 'version', 'release', 'scope', 'modules', 'father'])" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "hash(\"Name\")\n", + "print(*'python')\n", + "print(*[1,2,3])\n", + "python.keys()" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Here are keys of python : name version release scope modules father\n", + "Enter key to find value : salkf\n" + ] + }, + { + "ename": "KeyError", + "evalue": "'salkf'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m-----------------------------------------------\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Here are keys of python : \"\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0mpython\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mpython\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0minput\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Enter key to find value : \"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m: 'salkf'" + ] + } + ], + "source": [ + "print(\"Here are keys of python : \",*python.keys())\n", + "python[input(\"Enter key to find value : \")]" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Help on built-in function print in module builtins:\n", + "\n", + "print(...)\n", + " print(value, ..., sep=' ', end='\\n', file=sys.stdout, flush=False)\n", + " \n", + " Prints the values to a stream, or to sys.stdout by default.\n", + " Optional keyword arguments:\n", + " file: a file-like object (stream); defaults to the current sys.stdout.\n", + " sep: string inserted between values, default a space.\n", + " end: string appended after the last value, default a newline.\n", + " flush: whether to forcibly flush the stream.\n", + "\n" + ] + } + ], + "source": [ + "help(print)" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "value1\n", + "value2\n", + "1\n", + "2\n", + "3\n", + "4\n" + ] + } + ], + "source": [ + "print('value1','value2',1,2,3,4,sep='\\n')" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\tBye World\n" + ] + } + ], + "source": [ + "print(\"Hello\",\"World\",end='\\t')\n", + "print(\"Bye\",\"World\")" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "python\n" + ] + } + ], + "source": [ + "print('python')" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "p\n", + "y\n", + "h\n", + "t\n", + "o\n", + "n\n" + ] + } + ], + "source": [ + "print(*'pyhton',sep='\\n')#print('p','y','h','t','o','n')" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "name version release scope modules father\n" + ] + } + ], + "source": [ + "print(*python)" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": {}, + "outputs": [], + "source": [ + "fp = open('C:/users/sachin/desktop/arya.txt','w')" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": {}, + "outputs": [], + "source": [ + "print(\"Hello World\",\"This is Awesom.\",\"Python is \\\n", + "easy\",sep='\\n',file=fp)" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": {}, + "outputs": [], + "source": [ + "fp.close()" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": {}, + "outputs": [ + { + "ename": "KeyError", + "evalue": "'abccadre'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m-----------------------------------------------\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mpython\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'abccadre'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m: 'abccadre'" + ] + } + ], + "source": [ + "python['abccadre']" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "key : abracadara\n" + ] + }, + { + "data": { + "text/plain": [ + "'NO such key exists'" + ] + }, + "execution_count": 56, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#python.get('key','msg')\n", + "\n", + "python.get(input(\"key : \").strip().lower(),\"NO such key exists\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Data_Type_Dictionary (1).html b/python_ipynb/Data_Type_Dictionary (1).html new file mode 100644 index 0000000..7de8a42 --- /dev/null +++ b/python_ipynb/Data_Type_Dictionary (1).html @@ -0,0 +1,13935 @@ + + + +Data_Type_Dictionary + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +
    +

    Dictionaries in Python

    +
    +
    +
    +
    +
    +
    In [1]:
    +
    +
    +
    f = { 'name':'sachin','age':22,'language':'hindi','height':5.11,'education':'Engineer'}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    print(f.values())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    dict_values(['sachin', 22, 'hindi', 5.11, 'Engineer'])
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    s = 'sachin'
    +h  = hash(s)
    +k = bin(h)
    +print(h)
    +print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    7690198149797640290
    +0b110101010111001000100100111100100001011000011011111100001100010
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    info = {
    +    
    +    'name':'python',
    +    'father':'Guido Van Rossum',
    +    'type' : 'Programming Language',
    +    'current_version' : 3.7,
    +    'scope' : {
    +        'web' : [ 'flask','django','pyramid','web2py'],
    +        'gui' : [ 'tkinter', 'wxpython','kivi',],
    +        'automation' : [ 'ansible','puppet','openstack'],
    +        'bigdata' : [ 'pyspark'],
    +        'data_science' : [ 'pandas','numpy',],
    +        'machine_learning' : ['sci-py','scikit-learn','teserflow']
    +        
    +    }
    +
    +        }
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    print(info)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'name': 'python', 'father': 'Guido Van Rossum', 'type': 'Programming Language', 'current_version': 3.7, 'scope': {'web': ['flask', 'django', 'pyramid', 'web2py'], 'gui': ['tkinter', 'wxpython', 'kivi'], 'automation': ['ansible', 'puppet', 'openstack'], 'bigdata': ['pyspark'], 'data_science': ['pandas', 'numpy'], 'machine_learning': ['sci-py', 'scikit-learn', 'teserflow']}}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    from pprint import pprint
    +pprint(info)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'current_version': 3.7,
    + 'father': 'Guido Van Rossum',
    + 'name': 'python',
    + 'scope': {'automation': ['ansible', 'puppet', 'openstack'],
    +           'bigdata': ['pyspark'],
    +           'data_science': ['pandas', 'numpy'],
    +           'gui': ['tkinter', 'wxpython', 'kivi'],
    +           'machine_learning': ['sci-py', 'scikit-learn', 'teserflow'],
    +           'web': ['flask', 'django', 'pyramid', 'web2py']},
    + 'type': 'Programming Language'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    info['name']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[11]:
    + + + + +
    +
    'python'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    info['current_version']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[12]:
    + + + + +
    +
    3.7
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    info['scope']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[13]:
    + + + + +
    +
    {'web': ['flask', 'django', 'pyramid', 'web2py'],
    + 'gui': ['tkinter', 'wxpython', 'kivi'],
    + 'automation': ['ansible', 'puppet', 'openstack'],
    + 'bigdata': ['pyspark'],
    + 'data_science': ['pandas', 'numpy'],
    + 'machine_learning': ['sci-py', 'scikit-learn', 'teserflow']}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    info['scope']['web'][1:]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[16]:
    + + + + +
    +
    ['django', 'pyramid', 'web2py']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    info = { 
    +        
    +    'name' : "sachin yadav",
    +    'age' : 22,
    +    'education' : {
    +        'matric' : ['RBSE',88.00],
    +        'high_school' : ['RBSE',82.40],
    +        'garduation'  : ['RTU','B.tech computer science',74],
    +                    },
    +    'favourite_things' : 
    +                    {
    +                        'actor':'wahtever',
    +                        'actress' : [ 'one','two','three'],
    +                        'game' : [ 'cricket','footbal',],
    +                        'color' : 'mycolor',
    +                        
    +                    }    
    +        }
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    info['education']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[20]:
    + + + + +
    +
    {'matric': ['RBSE', 88.0],
    + 'high_school': ['RBSE', 82.4],
    + 'garduation': ['RTU', 'B.tech computer science', 74]}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [22]:
    +
    +
    +
    info['education']['garduation']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[22]:
    + + + + +
    +
    ['RTU', 'B.tech computer science', 74]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    info['education']['garduation'][2]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[23]:
    + + + + +
    +
    74
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    python = { 'name':'python','version':3.7,'author':'Gudio Van Rossum'}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    python['name'] = 'PYHTON'
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [30]:
    +
    +
    +
    python['name']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[30]:
    + + + + +
    +
    'PYHTON'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [29]:
    +
    +
    +
    python['Name'] = 'python'
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [31]:
    +
    +
    +
    python['Name']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[31]:
    + + + + +
    +
    'python'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [32]:
    +
    +
    +
    print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum', 'Name': 'python'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [33]:
    +
    +
    +
    print(dir(python))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [35]:
    +
    +
    +
    python['sachin']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +KeyError                                  Traceback (most recent call last)
    +<ipython-input-35-3907d8678c3f> in <module>()
    +----> 1 python['sachin']
    +
    +KeyError: 'sachin'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [39]:
    +
    +
    +
    print('before')
    +print(python)
    +del python['Name']
    +print('after')
    +print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    before
    +{'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum', 'Name': 'python'}
    +after
    +{'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [50]:
    +
    +
    +
    key = input("What do you want see : ").strip().lower()
    +key = ''.join(key.split())
    +python[key]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    What do you want see : sachin
    +
    +
    +
    + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +KeyError                                  Traceback (most recent call last)
    +<ipython-input-50-1a8f19be03bc> in <module>()
    +      1 key = input("What do you want see : ").strip().lower()
    +      2 key = ''.join(key.split())
    +----> 3 python[key]
    +
    +KeyError: 'sachin'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [56]:
    +
    +
    +
    python.get('name','No such key exists')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[56]:
    + + + + +
    +
    'PYHTON'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [59]:
    +
    +
    +
    key = input("What do you want see : ").strip().lower()
    +key = ''.join(key.split())
    +python.get(key,'No such key exists in our database')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    What do you want see : sachin
    +
    +
    +
    + +
    + +
    Out[59]:
    + + + + +
    +
    'No such key exists in our database'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [69]:
    +
    +
    +
    print(python.items())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    dict_items([('name', 'PYHTON'), ('version', 3.7), ('author', 'Gudio Van Rossum')])
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [61]:
    +
    +
    +
    print(dir(python))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [68]:
    +
    +
    +
    s = "hel  lo    W    o   rld"
    +k = s.split()
    +print(k)
    +''.join(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['hel', 'lo', 'W', 'o', 'rld']
    +
    +
    +
    + +
    + +
    Out[68]:
    + + + + +
    +
    'helloWorld'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [70]:
    +
    +
    +
    python.keys()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[70]:
    + + + + +
    +
    dict_keys(['name', 'version', 'author'])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [71]:
    +
    +
    +
    python.values()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[71]:
    + + + + +
    +
    dict_values(['PYHTON', 3.7, 'Gudio Van Rossum'])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [72]:
    +
    +
    +
    l1 = [ 'one','two','three','four','five','six']
    +l2 = [ 'sachin','poonam','jitender','neha','meena','ramwatar']
    +print(l1)
    +print(l2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['one', 'two', 'three', 'four', 'five', 'six']
    +['sachin', 'poonam', 'jitender', 'neha', 'meena', 'ramwatar']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [73]:
    +
    +
    +
    l3 = list(zip(l1,l2))
    +print(l3)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [('one', 'sachin'), ('two', 'poonam'), ('three', 'jitender'), ('four', 'neha'), ('five', 'meena'), ('six', 'ramwatar')]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [74]:
    +
    +
    +
    my_dict = dict(l3)
    +print(my_dict)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'one': 'sachin', 'two': 'poonam', 'three': 'jitender', 'four': 'neha', 'five': 'meena', 'six': 'ramwatar'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [75]:
    +
    +
    +
    k = list(my_dict)
    +print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['one', 'two', 'three', 'four', 'five', 'six']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [76]:
    +
    +
    +
    k = list(my_dict.items())
    +print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [('one', 'sachin'), ('two', 'poonam'), ('three', 'jitender'), ('four', 'neha'), ('five', 'meena'), ('six', 'ramwatar')]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [77]:
    +
    +
    +
    v = list(my_dict.values())
    +ke = list(my_dict.keys())
    +kv = list(my_dict.items())
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [78]:
    +
    +
    +
    print(ke)
    +print(v)
    +print(kv)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['one', 'two', 'three', 'four', 'five', 'six']
    +['sachin', 'poonam', 'jitender', 'neha', 'meena', 'ramwatar']
    +[('one', 'sachin'), ('two', 'poonam'), ('three', 'jitender'), ('four', 'neha'), ('five', 'meena'), ('six', 'ramwatar')]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [81]:
    +
    +
    +
    print(dir(python))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [82]:
    +
    +
    +
    print(python.pop.__doc__)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
    +If key is not found, d is returned if given, otherwise KeyError is raised
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [85]:
    +
    +
    +
    print(python)
    +value= python.pop('name')
    +print("Value is removed from dictionary is ",value)
    +print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum'}
    +Value is removed from dictionary is  PYHTON
    +{'version': 3.7, 'author': 'Gudio Van Rossum'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [87]:
    +
    +
    +
    python.pop('sachin','No Key available')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[87]:
    + + + + +
    +
    'No Key available'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [88]:
    +
    +
    +
    print(dir(python))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [89]:
    +
    +
    +
    python.popitem()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[89]:
    + + + + +
    +
    ('author', 'Gudio Van Rossum')
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [90]:
    +
    +
    +
    python['sachin'] = 'mr. coder'
    +python['name'] = 'python'
    +print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'version': 3.7, 'sachin': 'mr. coder', 'name': 'python'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [91]:
    +
    +
    +
    python['name'] = 'World"s best language'
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [92]:
    +
    +
    +
    python
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[92]:
    + + + + +
    +
    {'version': 3.7, 'sachin': 'mr. coder', 'name': 'World"s best language'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [93]:
    +
    +
    +
    python['name']  = 'python'
    +print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'version': 3.7, 'sachin': 'mr. coder', 'name': 'python'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [94]:
    +
    +
    +
    python.setdefault('rajat','i am the owner of Grras')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[94]:
    + + + + +
    +
    'i am the owner of Grras'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [95]:
    +
    +
    +
    print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'version': 3.7, 'sachin': 'mr. coder', 'name': 'python', 'rajat': 'i am the owner of Grras'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [96]:
    +
    +
    +
    python.setdefault('name','don of the world')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[96]:
    + + + + +
    +
    'python'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [97]:
    +
    +
    +
    print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'version': 3.7, 'sachin': 'mr. coder', 'name': 'python', 'rajat': 'i am the owner of Grras'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [98]:
    +
    +
    +
    info = { 'scope' : 'world-wide','name':'PYTHON',}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [99]:
    +
    +
    +
    print(info)
    +print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'scope': 'world-wide', 'name': 'PYTHON'}
    +{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python', 'rajat': 'i am the owner of Grras'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [100]:
    +
    +
    +
    python.update(info)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [101]:
    +
    +
    +
    python
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[101]:
    + + + + +
    +
    {'version': 3.7,
    + 'sachin': 'mr. coder',
    + 'name': 'PYTHON',
    + 'rajat': 'i am the owner of Grras',
    + 'scope': 'world-wide'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    info
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +NameError                                 Traceback (most recent call last)
    +<ipython-input-15-886ead46232a> in <module>()
    +----> 1 info
    +
    +NameError: name 'info' is not defined
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [103]:
    +
    +
    +
    info.update(python)
    +info
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[103]:
    + + + + +
    +
    {'scope': 'world-wide',
    + 'name': 'PYTHON',
    + 'version': 3.7,
    + 'sachin': 'mr. coder',
    + 'rajat': 'i am the owner of Grras'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [1]:
    +
    +
    +
    #list way 
    +student = [
    +    [1001,'sachin',999999,'python@123',True],
    +    [1002,'jitendra',6500,'redhat@8921',False],
    +    [1003,'meena',75000,'password',False],
    +]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    student[0]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[2]:
    + + + + +
    +
    [1001, 'sachin', 999999, 'python@123', True]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    #anthor way of list represet
    +student = [ 
    +            [1001,1002,1003,1004,1005,1006],
    +            ['sachin','jitendra','meena','ramawatar','poonam','neha'],
    +            [9999,6500,5677,34223,56434,34565434],
    +            ['redhat','Asimov','python@123','password','myworld','iamking'],
    +            [True,False,False,True,False,True]
    +         ]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    acc_num = int(input("Enter your account number : "))
    +index = student[0].index(acc_num)
    +print("Your name is ",student[1][index])
    +print("Your Balance is ",student[2][index])
    +print("Your Password is ",student[3][index])
    +print("Your Loan Status is ",student[4][index])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter your account number : 1005
    +Your name is  poonam
    +Your Balance is  56434
    +Your Password is  myworld
    +Your Loan Status is  False
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    #dictionary implementation
    +#anthor way of list represet
    +student = { 
    +    'acc'  :  [1001,1002,1003,1004,1005,1006],
    +    'name' :  ['sachin','jitendra','meena','ramawatar','poonam','neha'],
    +    'bal'  :  [9999,6500,5677,34223,56434,34565434],
    +'password' :  ['redhat','Asimov','python@123','password','myworld','iamking'],
    +    'loan' :  [True,False,False,True,False,True]
    +    }
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    acc_num = int(input("Enter your account number : "))
    +index = student['acc'].index(acc_num)
    +print("Your name is ",student['name'][index])
    +print("Your Balance is ",student['bal'][index])
    +print("Your Password is ",student['password'][index])
    +print("Your Loan Status is ",student['loan'][index])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter your account number : 1002
    +Your name is  jitendra
    +Your Balance is  6500
    +Your Password is  Asimov
    +Your Loan Status is  False
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    student = { 
    +    1001 : { 'name':'sachin','bal':6500,'password':'redhat@3496'},
    +    1002 : { 'name':'meena','bal':7500000,'password':'@123abcd!','loan':True },
    +    1003 : { 'name':'poonam','bal':89234,'password':'1384y3243',},
    +    1004 : { 'name':'jitendra','bal':734234,'password':'hello',},
    +    1005 : { 'name':'sudharshan','bal':897983,'password':'bye'},
    +    1006 : { 'name':'ramawatar','bal':95000,'password':'goodboy'}            
    +            }
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    name = input("Enter your name : ")
    +acc_no = 1007
    +password = input("Password : ")
    +bal = int(input("Enter your balance : "))
    +info = { 'name':name,'bal':bal,'password':password}
    +student.update({1007:info})
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter your name : neha
    +Password : mynameisneha
    +Enter your balance : 10000
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    from pprint import pprint
    +pprint(student)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {1001: {'bal': 6500, 'name': 'sachin', 'password': 'redhat@3496'},
    + 1002: {'bal': 7500000, 'loan': True, 'name': 'meena', 'password': '@123abcd!'},
    + 1003: {'bal': 89234, 'name': 'poonam', 'password': '1384y3243'},
    + 1004: {'bal': 734234, 'name': 'jitendra', 'password': 'hello'},
    + 1005: {'bal': 897983, 'name': 'sudharshan', 'password': 'bye'},
    + 1006: {'bal': 95000, 'name': 'ramawatar', 'password': 'goodboy'},
    + 1007: {'bal': 10000, 'name': 'neha', 'password': 'mynameisneha'}}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    print(student)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {1001: {'name': 'sachin', 'bal': 6500, 'password': 'redhat@3496'}, 1002: {'name': 'meena', 'bal': 7500000, 'password': '@123abcd!', 'loan': True}, 1003: {'name': 'poonam', 'bal': 89234, 'password': '1384y3243'}, 1004: {'name': 'jitendra', 'bal': 734234, 'password': 'hello'}, 1005: {'name': 'sudharshan', 'bal': 897983, 'password': 'bye'}, 1006: {'name': 'ramawatar', 'bal': 95000, 'password': 'goodboy'}, 1007: {'name': 'neha', 'bal': 10000, 'password': 'mynameisneha'}}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    from getpass import getpass
    +password = getpass("Passoword : ")
    +print(password)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Passoword : ········
    +helloworldal;ksjdfk
    +
    +
    +
    + +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/Data_Type_Dictionary (1).ipynb b/python_ipynb/Data_Type_Dictionary (1).ipynb new file mode 100644 index 0000000..52c37ad --- /dev/null +++ b/python_ipynb/Data_Type_Dictionary (1).ipynb @@ -0,0 +1,1364 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Dictionaries in Python

    " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "f = { 'name':'sachin','age':22,'language':'hindi','height':5.11,'education':'Engineer'}\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "dict_values(['sachin', 22, 'hindi', 5.11, 'Engineer'])\n" + ] + } + ], + "source": [ + "print(f.values())" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "7690198149797640290\n", + "0b110101010111001000100100111100100001011000011011111100001100010\n" + ] + } + ], + "source": [ + "s = 'sachin'\n", + "h = hash(s)\n", + "k = bin(h)\n", + "print(h)\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "info = {\n", + " \n", + " 'name':'python',\n", + " 'father':'Guido Van Rossum',\n", + " 'type' : 'Programming Language',\n", + " 'current_version' : 3.7,\n", + " 'scope' : {\n", + " 'web' : [ 'flask','django','pyramid','web2py'],\n", + " 'gui' : [ 'tkinter', 'wxpython','kivi',],\n", + " 'automation' : [ 'ansible','puppet','openstack'],\n", + " 'bigdata' : [ 'pyspark'],\n", + " 'data_science' : [ 'pandas','numpy',],\n", + " 'machine_learning' : ['sci-py','scikit-learn','teserflow']\n", + " \n", + " }\n", + "\n", + " }" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'python', 'father': 'Guido Van Rossum', 'type': 'Programming Language', 'current_version': 3.7, 'scope': {'web': ['flask', 'django', 'pyramid', 'web2py'], 'gui': ['tkinter', 'wxpython', 'kivi'], 'automation': ['ansible', 'puppet', 'openstack'], 'bigdata': ['pyspark'], 'data_science': ['pandas', 'numpy'], 'machine_learning': ['sci-py', 'scikit-learn', 'teserflow']}}\n" + ] + } + ], + "source": [ + "print(info)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'current_version': 3.7,\n", + " 'father': 'Guido Van Rossum',\n", + " 'name': 'python',\n", + " 'scope': {'automation': ['ansible', 'puppet', 'openstack'],\n", + " 'bigdata': ['pyspark'],\n", + " 'data_science': ['pandas', 'numpy'],\n", + " 'gui': ['tkinter', 'wxpython', 'kivi'],\n", + " 'machine_learning': ['sci-py', 'scikit-learn', 'teserflow'],\n", + " 'web': ['flask', 'django', 'pyramid', 'web2py']},\n", + " 'type': 'Programming Language'}\n" + ] + } + ], + "source": [ + "from pprint import pprint\n", + "pprint(info)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'python'" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['name']" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3.7" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['current_version']" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'web': ['flask', 'django', 'pyramid', 'web2py'],\n", + " 'gui': ['tkinter', 'wxpython', 'kivi'],\n", + " 'automation': ['ansible', 'puppet', 'openstack'],\n", + " 'bigdata': ['pyspark'],\n", + " 'data_science': ['pandas', 'numpy'],\n", + " 'machine_learning': ['sci-py', 'scikit-learn', 'teserflow']}" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['scope']" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['django', 'pyramid', 'web2py']" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['scope']['web'][1:]" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [], + "source": [ + "info = { \n", + " \n", + " 'name' : \"sachin yadav\",\n", + " 'age' : 22,\n", + " 'education' : {\n", + " 'matric' : ['RBSE',88.00],\n", + " 'high_school' : ['RBSE',82.40],\n", + " 'garduation' : ['RTU','B.tech computer science',74],\n", + " },\n", + " 'favourite_things' : \n", + " {\n", + " 'actor':'wahtever',\n", + " 'actress' : [ 'one','two','three'],\n", + " 'game' : [ 'cricket','footbal',],\n", + " 'color' : 'mycolor',\n", + " \n", + " } \n", + " }" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'matric': ['RBSE', 88.0],\n", + " 'high_school': ['RBSE', 82.4],\n", + " 'garduation': ['RTU', 'B.tech computer science', 74]}" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['education']" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['RTU', 'B.tech computer science', 74]" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['education']['garduation']" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "74" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['education']['garduation'][2]" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [], + "source": [ + "python = { 'name':'python','version':3.7,'author':'Gudio Van Rossum'}" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [], + "source": [ + "python['name'] = 'PYHTON'" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'PYHTON'" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python['name']" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [], + "source": [ + "python['Name'] = 'python'" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'python'" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python['Name']" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum', 'Name': 'python'}\n" + ] + } + ], + "source": [ + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(python))" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "ename": "KeyError", + "evalue": "'sachin'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mpython\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'sachin'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m: 'sachin'" + ] + } + ], + "source": [ + "python['sachin']" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "before\n", + "{'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum', 'Name': 'python'}\n", + "after\n", + "{'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum'}\n" + ] + } + ], + "source": [ + "print('before')\n", + "print(python)\n", + "del python['Name']\n", + "print('after')\n", + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "What do you want see : sachin\n" + ] + }, + { + "ename": "KeyError", + "evalue": "'sachin'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mkey\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0minput\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"What do you want see : \"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstrip\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlower\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[0mkey\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m''\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[0mpython\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m: 'sachin'" + ] + } + ], + "source": [ + "key = input(\"What do you want see : \").strip().lower()\n", + "key = ''.join(key.split())\n", + "python[key]" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'PYHTON'" + ] + }, + "execution_count": 56, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.get('name','No such key exists')" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "What do you want see : sachin\n" + ] + }, + { + "data": { + "text/plain": [ + "'No such key exists in our database'" + ] + }, + "execution_count": 59, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "key = input(\"What do you want see : \").strip().lower()\n", + "key = ''.join(key.split())\n", + "python.get(key,'No such key exists in our database')" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "dict_items([('name', 'PYHTON'), ('version', 3.7), ('author', 'Gudio Van Rossum')])\n" + ] + } + ], + "source": [ + "print(python.items())" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(python))" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hel', 'lo', 'W', 'o', 'rld']\n" + ] + }, + { + "data": { + "text/plain": [ + "'helloWorld'" + ] + }, + "execution_count": 68, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = \"hel lo W o rld\"\n", + "k = s.split()\n", + "print(k)\n", + "''.join(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_keys(['name', 'version', 'author'])" + ] + }, + "execution_count": 70, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.keys()" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_values(['PYHTON', 3.7, 'Gudio Van Rossum'])" + ] + }, + "execution_count": 71, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.values()" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['one', 'two', 'three', 'four', 'five', 'six']\n", + "['sachin', 'poonam', 'jitender', 'neha', 'meena', 'ramwatar']\n" + ] + } + ], + "source": [ + "l1 = [ 'one','two','three','four','five','six']\n", + "l2 = [ 'sachin','poonam','jitender','neha','meena','ramwatar']\n", + "print(l1)\n", + "print(l2)" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[('one', 'sachin'), ('two', 'poonam'), ('three', 'jitender'), ('four', 'neha'), ('five', 'meena'), ('six', 'ramwatar')]\n" + ] + } + ], + "source": [ + "l3 = list(zip(l1,l2))\n", + "print(l3)" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'one': 'sachin', 'two': 'poonam', 'three': 'jitender', 'four': 'neha', 'five': 'meena', 'six': 'ramwatar'}\n" + ] + } + ], + "source": [ + "my_dict = dict(l3)\n", + "print(my_dict)" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['one', 'two', 'three', 'four', 'five', 'six']\n" + ] + } + ], + "source": [ + "k = list(my_dict)\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[('one', 'sachin'), ('two', 'poonam'), ('three', 'jitender'), ('four', 'neha'), ('five', 'meena'), ('six', 'ramwatar')]\n" + ] + } + ], + "source": [ + "k = list(my_dict.items())\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 77, + "metadata": {}, + "outputs": [], + "source": [ + "v = list(my_dict.values())\n", + "ke = list(my_dict.keys())\n", + "kv = list(my_dict.items())" + ] + }, + { + "cell_type": "code", + "execution_count": 78, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['one', 'two', 'three', 'four', 'five', 'six']\n", + "['sachin', 'poonam', 'jitender', 'neha', 'meena', 'ramwatar']\n", + "[('one', 'sachin'), ('two', 'poonam'), ('three', 'jitender'), ('four', 'neha'), ('five', 'meena'), ('six', 'ramwatar')]\n" + ] + } + ], + "source": [ + "print(ke)\n", + "print(v)\n", + "print(kv)" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(python))" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n", + "If key is not found, d is returned if given, otherwise KeyError is raised\n" + ] + } + ], + "source": [ + "print(python.pop.__doc__)" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum'}\n", + "Value is removed from dictionary is PYHTON\n", + "{'version': 3.7, 'author': 'Gudio Van Rossum'}\n" + ] + } + ], + "source": [ + "print(python)\n", + "value= python.pop('name')\n", + "print(\"Value is removed from dictionary is \",value)\n", + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'No Key available'" + ] + }, + "execution_count": 87, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.pop('sachin','No Key available')" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(python))" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "('author', 'Gudio Van Rossum')" + ] + }, + "execution_count": 89, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.popitem()" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python'}\n" + ] + } + ], + "source": [ + "python['sachin'] = 'mr. coder'\n", + "python['name'] = 'python'\n", + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 91, + "metadata": {}, + "outputs": [], + "source": [ + "python['name'] = 'World\"s best language'" + ] + }, + { + "cell_type": "code", + "execution_count": 92, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'World\"s best language'}" + ] + }, + "execution_count": 92, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python" + ] + }, + { + "cell_type": "code", + "execution_count": 93, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python'}\n" + ] + } + ], + "source": [ + "python['name'] = 'python'\n", + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'i am the owner of Grras'" + ] + }, + "execution_count": 94, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.setdefault('rajat','i am the owner of Grras')" + ] + }, + { + "cell_type": "code", + "execution_count": 95, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python', 'rajat': 'i am the owner of Grras'}\n" + ] + } + ], + "source": [ + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'python'" + ] + }, + "execution_count": 96, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.setdefault('name','don of the world')" + ] + }, + { + "cell_type": "code", + "execution_count": 97, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python', 'rajat': 'i am the owner of Grras'}\n" + ] + } + ], + "source": [ + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": {}, + "outputs": [], + "source": [ + "info = { 'scope' : 'world-wide','name':'PYTHON',}" + ] + }, + { + "cell_type": "code", + "execution_count": 99, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'scope': 'world-wide', 'name': 'PYTHON'}\n", + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python', 'rajat': 'i am the owner of Grras'}\n" + ] + } + ], + "source": [ + "print(info)\n", + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [], + "source": [ + "python.update(info)" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'version': 3.7,\n", + " 'sachin': 'mr. coder',\n", + " 'name': 'PYTHON',\n", + " 'rajat': 'i am the owner of Grras',\n", + " 'scope': 'world-wide'}" + ] + }, + "execution_count": 101, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'info' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0minfo\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mNameError\u001b[0m: name 'info' is not defined" + ] + } + ], + "source": [ + "info" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'scope': 'world-wide',\n", + " 'name': 'PYTHON',\n", + " 'version': 3.7,\n", + " 'sachin': 'mr. coder',\n", + " 'rajat': 'i am the owner of Grras'}" + ] + }, + "execution_count": 103, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info.update(python)\n", + "info" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "#list way \n", + "student = [\n", + " [1001,'sachin',999999,'python@123',True],\n", + " [1002,'jitendra',6500,'redhat@8921',False],\n", + " [1003,'meena',75000,'password',False],\n", + "]" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1001, 'sachin', 999999, 'python@123', True]" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "student[0]" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "#anthor way of list represet\n", + "student = [ \n", + " [1001,1002,1003,1004,1005,1006],\n", + " ['sachin','jitendra','meena','ramawatar','poonam','neha'],\n", + " [9999,6500,5677,34223,56434,34565434],\n", + " ['redhat','Asimov','python@123','password','myworld','iamking'],\n", + " [True,False,False,True,False,True]\n", + " ]" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your account number : 1005\n", + "Your name is poonam\n", + "Your Balance is 56434\n", + "Your Password is myworld\n", + "Your Loan Status is False\n" + ] + } + ], + "source": [ + "acc_num = int(input(\"Enter your account number : \"))\n", + "index = student[0].index(acc_num)\n", + "print(\"Your name is \",student[1][index])\n", + "print(\"Your Balance is \",student[2][index])\n", + "print(\"Your Password is \",student[3][index])\n", + "print(\"Your Loan Status is \",student[4][index])" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], + "source": [ + "#dictionary implementation\n", + "#anthor way of list represet\n", + "student = { \n", + " 'acc' : [1001,1002,1003,1004,1005,1006],\n", + " 'name' : ['sachin','jitendra','meena','ramawatar','poonam','neha'],\n", + " 'bal' : [9999,6500,5677,34223,56434,34565434],\n", + "'password' : ['redhat','Asimov','python@123','password','myworld','iamking'],\n", + " 'loan' : [True,False,False,True,False,True]\n", + " }\n" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your account number : 1002\n", + "Your name is jitendra\n", + "Your Balance is 6500\n", + "Your Password is Asimov\n", + "Your Loan Status is False\n" + ] + } + ], + "source": [ + "acc_num = int(input(\"Enter your account number : \"))\n", + "index = student['acc'].index(acc_num)\n", + "print(\"Your name is \",student['name'][index])\n", + "print(\"Your Balance is \",student['bal'][index])\n", + "print(\"Your Password is \",student['password'][index])\n", + "print(\"Your Loan Status is \",student['loan'][index])" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [], + "source": [ + "student = { \n", + " 1001 : { 'name':'sachin','bal':6500,'password':'redhat@3496'},\n", + " 1002 : { 'name':'meena','bal':7500000,'password':'@123abcd!','loan':True },\n", + " 1003 : { 'name':'poonam','bal':89234,'password':'1384y3243',},\n", + " 1004 : { 'name':'jitendra','bal':734234,'password':'hello',},\n", + " 1005 : { 'name':'sudharshan','bal':897983,'password':'bye'},\n", + " 1006 : { 'name':'ramawatar','bal':95000,'password':'goodboy'} \n", + " }" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your name : neha\n", + "Password : mynameisneha\n", + "Enter your balance : 10000\n" + ] + } + ], + "source": [ + "name = input(\"Enter your name : \")\n", + "acc_no = 1007\n", + "password = input(\"Password : \")\n", + "bal = int(input(\"Enter your balance : \"))\n", + "info = { 'name':name,'bal':bal,'password':password}\n", + "student.update({1007:info})\n" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{1001: {'bal': 6500, 'name': 'sachin', 'password': 'redhat@3496'},\n", + " 1002: {'bal': 7500000, 'loan': True, 'name': 'meena', 'password': '@123abcd!'},\n", + " 1003: {'bal': 89234, 'name': 'poonam', 'password': '1384y3243'},\n", + " 1004: {'bal': 734234, 'name': 'jitendra', 'password': 'hello'},\n", + " 1005: {'bal': 897983, 'name': 'sudharshan', 'password': 'bye'},\n", + " 1006: {'bal': 95000, 'name': 'ramawatar', 'password': 'goodboy'},\n", + " 1007: {'bal': 10000, 'name': 'neha', 'password': 'mynameisneha'}}\n" + ] + } + ], + "source": [ + "from pprint import pprint\n", + "pprint(student)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{1001: {'name': 'sachin', 'bal': 6500, 'password': 'redhat@3496'}, 1002: {'name': 'meena', 'bal': 7500000, 'password': '@123abcd!', 'loan': True}, 1003: {'name': 'poonam', 'bal': 89234, 'password': '1384y3243'}, 1004: {'name': 'jitendra', 'bal': 734234, 'password': 'hello'}, 1005: {'name': 'sudharshan', 'bal': 897983, 'password': 'bye'}, 1006: {'name': 'ramawatar', 'bal': 95000, 'password': 'goodboy'}, 1007: {'name': 'neha', 'bal': 10000, 'password': 'mynameisneha'}}\n" + ] + } + ], + "source": [ + "print(student)" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Passoword : ········\n", + "helloworldal;ksjdfk\n" + ] + } + ], + "source": [ + "from getpass import getpass\n", + "password = getpass(\"Passoword : \")\n", + "print(password)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Data_Type_Dictionary (2).ipynb b/python_ipynb/Data_Type_Dictionary (2).ipynb new file mode 100644 index 0000000..814a332 --- /dev/null +++ b/python_ipynb/Data_Type_Dictionary (2).ipynb @@ -0,0 +1,1143 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Dictionaries in Python

    " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "f = { 'name':'sachin','age':22,'language':'hindi','height':5.11,'education':'Engineer'}\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "dict_values(['sachin', 22, 'hindi', 5.11, 'Engineer'])\n" + ] + } + ], + "source": [ + "print(f.values())" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "7690198149797640290\n", + "0b110101010111001000100100111100100001011000011011111100001100010\n" + ] + } + ], + "source": [ + "s = 'sachin'\n", + "h = hash(s)\n", + "k = bin(h)\n", + "print(h)\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "info = {\n", + " \n", + " 'name':'python',\n", + " 'father':'Guido Van Rossum',\n", + " 'type' : 'Programming Language',\n", + " 'current_version' : 3.7,\n", + " 'scope' : {\n", + " 'web' : [ 'flask','django','pyramid','web2py'],\n", + " 'gui' : [ 'tkinter', 'wxpython','kivi',],\n", + " 'automation' : [ 'ansible','puppet','openstack'],\n", + " 'bigdata' : [ 'pyspark'],\n", + " 'data_science' : [ 'pandas','numpy',],\n", + " 'machine_learning' : ['sci-py','scikit-learn','teserflow']\n", + " \n", + " }\n", + "\n", + " }" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'python', 'father': 'Guido Van Rossum', 'type': 'Programming Language', 'current_version': 3.7, 'scope': {'web': ['flask', 'django', 'pyramid', 'web2py'], 'gui': ['tkinter', 'wxpython', 'kivi'], 'automation': ['ansible', 'puppet', 'openstack'], 'bigdata': ['pyspark'], 'data_science': ['pandas', 'numpy'], 'machine_learning': ['sci-py', 'scikit-learn', 'teserflow']}}\n" + ] + } + ], + "source": [ + "print(info)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'current_version': 3.7,\n", + " 'father': 'Guido Van Rossum',\n", + " 'name': 'python',\n", + " 'scope': {'automation': ['ansible', 'puppet', 'openstack'],\n", + " 'bigdata': ['pyspark'],\n", + " 'data_science': ['pandas', 'numpy'],\n", + " 'gui': ['tkinter', 'wxpython', 'kivi'],\n", + " 'machine_learning': ['sci-py', 'scikit-learn', 'teserflow'],\n", + " 'web': ['flask', 'django', 'pyramid', 'web2py']},\n", + " 'type': 'Programming Language'}\n" + ] + } + ], + "source": [ + "from pprint import pprint\n", + "pprint(info)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'python'" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['name']" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3.7" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['current_version']" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'web': ['flask', 'django', 'pyramid', 'web2py'],\n", + " 'gui': ['tkinter', 'wxpython', 'kivi'],\n", + " 'automation': ['ansible', 'puppet', 'openstack'],\n", + " 'bigdata': ['pyspark'],\n", + " 'data_science': ['pandas', 'numpy'],\n", + " 'machine_learning': ['sci-py', 'scikit-learn', 'teserflow']}" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['scope']" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['django', 'pyramid', 'web2py']" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['scope']['web'][1:]" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [], + "source": [ + "info = { \n", + " \n", + " 'name' : \"sachin yadav\",\n", + " 'age' : 22,\n", + " 'education' : {\n", + " 'matric' : ['RBSE',88.00],\n", + " 'high_school' : ['RBSE',82.40],\n", + " 'garduation' : ['RTU','B.tech computer science',74],\n", + " },\n", + " 'favourite_things' : \n", + " {\n", + " 'actor':'wahtever',\n", + " 'actress' : [ 'one','two','three'],\n", + " 'game' : [ 'cricket','footbal',],\n", + " 'color' : 'mycolor',\n", + " \n", + " } \n", + " }" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'matric': ['RBSE', 88.0],\n", + " 'high_school': ['RBSE', 82.4],\n", + " 'garduation': ['RTU', 'B.tech computer science', 74]}" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['education']" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['RTU', 'B.tech computer science', 74]" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['education']['garduation']" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "74" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['education']['garduation'][2]" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [], + "source": [ + "python = { 'name':'python','version':3.7,'author':'Gudio Van Rossum'}" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [], + "source": [ + "python['name'] = 'PYHTON'" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'PYHTON'" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python['name']" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [], + "source": [ + "python['Name'] = 'python'" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'python'" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python['Name']" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum', 'Name': 'python'}\n" + ] + } + ], + "source": [ + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(python))" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "ename": "KeyError", + "evalue": "'sachin'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mpython\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'sachin'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m: 'sachin'" + ] + } + ], + "source": [ + "python['sachin']" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "before\n", + "{'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum', 'Name': 'python'}\n", + "after\n", + "{'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum'}\n" + ] + } + ], + "source": [ + "print('before')\n", + "print(python)\n", + "del python['Name']\n", + "print('after')\n", + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "What do you want see : sachin\n" + ] + }, + { + "ename": "KeyError", + "evalue": "'sachin'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mkey\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0minput\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"What do you want see : \"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstrip\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlower\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[0mkey\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m''\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[0mpython\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m: 'sachin'" + ] + } + ], + "source": [ + "key = input(\"What do you want see : \").strip().lower()\n", + "key = ''.join(key.split())\n", + "python[key]" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'PYHTON'" + ] + }, + "execution_count": 56, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.get('name','No such key exists')" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "What do you want see : sachin\n" + ] + }, + { + "data": { + "text/plain": [ + "'No such key exists in our database'" + ] + }, + "execution_count": 59, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "key = input(\"What do you want see : \").strip().lower()\n", + "key = ''.join(key.split())\n", + "python.get(key,'No such key exists in our database')" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "dict_items([('name', 'PYHTON'), ('version', 3.7), ('author', 'Gudio Van Rossum')])\n" + ] + } + ], + "source": [ + "print(python.items())" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(python))" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hel', 'lo', 'W', 'o', 'rld']\n" + ] + }, + { + "data": { + "text/plain": [ + "'helloWorld'" + ] + }, + "execution_count": 68, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = \"hel lo W o rld\"\n", + "k = s.split()\n", + "print(k)\n", + "''.join(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_keys(['name', 'version', 'author'])" + ] + }, + "execution_count": 70, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.keys()" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_values(['PYHTON', 3.7, 'Gudio Van Rossum'])" + ] + }, + "execution_count": 71, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.values()" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['one', 'two', 'three', 'four', 'five', 'six']\n", + "['sachin', 'poonam', 'jitender', 'neha', 'meena', 'ramwatar']\n" + ] + } + ], + "source": [ + "l1 = [ 'one','two','three','four','five','six']\n", + "l2 = [ 'sachin','poonam','jitender','neha','meena','ramwatar']\n", + "print(l1)\n", + "print(l2)" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[('one', 'sachin'), ('two', 'poonam'), ('three', 'jitender'), ('four', 'neha'), ('five', 'meena'), ('six', 'ramwatar')]\n" + ] + } + ], + "source": [ + "l3 = list(zip(l1,l2))\n", + "print(l3)" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'one': 'sachin', 'two': 'poonam', 'three': 'jitender', 'four': 'neha', 'five': 'meena', 'six': 'ramwatar'}\n" + ] + } + ], + "source": [ + "my_dict = dict(l3)\n", + "print(my_dict)" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['one', 'two', 'three', 'four', 'five', 'six']\n" + ] + } + ], + "source": [ + "k = list(my_dict)\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[('one', 'sachin'), ('two', 'poonam'), ('three', 'jitender'), ('four', 'neha'), ('five', 'meena'), ('six', 'ramwatar')]\n" + ] + } + ], + "source": [ + "k = list(my_dict.items())\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 77, + "metadata": {}, + "outputs": [], + "source": [ + "v = list(my_dict.values())\n", + "ke = list(my_dict.keys())\n", + "kv = list(my_dict.items())" + ] + }, + { + "cell_type": "code", + "execution_count": 78, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['one', 'two', 'three', 'four', 'five', 'six']\n", + "['sachin', 'poonam', 'jitender', 'neha', 'meena', 'ramwatar']\n", + "[('one', 'sachin'), ('two', 'poonam'), ('three', 'jitender'), ('four', 'neha'), ('five', 'meena'), ('six', 'ramwatar')]\n" + ] + } + ], + "source": [ + "print(ke)\n", + "print(v)\n", + "print(kv)" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(python))" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n", + "If key is not found, d is returned if given, otherwise KeyError is raised\n" + ] + } + ], + "source": [ + "print(python.pop.__doc__)" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum'}\n", + "Value is removed from dictionary is PYHTON\n", + "{'version': 3.7, 'author': 'Gudio Van Rossum'}\n" + ] + } + ], + "source": [ + "print(python)\n", + "value= python.pop('name')\n", + "print(\"Value is removed from dictionary is \",value)\n", + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'No Key available'" + ] + }, + "execution_count": 87, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.pop('sachin','No Key available')" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(python))" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "('author', 'Gudio Van Rossum')" + ] + }, + "execution_count": 89, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.popitem()" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python'}\n" + ] + } + ], + "source": [ + "python['sachin'] = 'mr. coder'\n", + "python['name'] = 'python'\n", + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 91, + "metadata": {}, + "outputs": [], + "source": [ + "python['name'] = 'World\"s best language'" + ] + }, + { + "cell_type": "code", + "execution_count": 92, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'World\"s best language'}" + ] + }, + "execution_count": 92, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python" + ] + }, + { + "cell_type": "code", + "execution_count": 93, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python'}\n" + ] + } + ], + "source": [ + "python['name'] = 'python'\n", + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'i am the owner of Grras'" + ] + }, + "execution_count": 94, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.setdefault('rajat','i am the owner of Grras')" + ] + }, + { + "cell_type": "code", + "execution_count": 95, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python', 'rajat': 'i am the owner of Grras'}\n" + ] + } + ], + "source": [ + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'python'" + ] + }, + "execution_count": 96, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.setdefault('name','don of the world')" + ] + }, + { + "cell_type": "code", + "execution_count": 97, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python', 'rajat': 'i am the owner of Grras'}\n" + ] + } + ], + "source": [ + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": {}, + "outputs": [], + "source": [ + "info = { 'scope' : 'world-wide','name':'PYTHON',}" + ] + }, + { + "cell_type": "code", + "execution_count": 99, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'scope': 'world-wide', 'name': 'PYTHON'}\n", + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python', 'rajat': 'i am the owner of Grras'}\n" + ] + } + ], + "source": [ + "print(info)\n", + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [], + "source": [ + "python.update(info)" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'version': 3.7,\n", + " 'sachin': 'mr. coder',\n", + " 'name': 'PYTHON',\n", + " 'rajat': 'i am the owner of Grras',\n", + " 'scope': 'world-wide'}" + ] + }, + "execution_count": 101, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python" + ] + }, + { + "cell_type": "code", + "execution_count": 102, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'scope': 'world-wide', 'name': 'PYTHON'}" + ] + }, + "execution_count": 102, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'scope': 'world-wide',\n", + " 'name': 'PYTHON',\n", + " 'version': 3.7,\n", + " 'sachin': 'mr. coder',\n", + " 'rajat': 'i am the owner of Grras'}" + ] + }, + "execution_count": 103, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info.update(python)\n", + "info" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Data_Type_Dictionary.html b/python_ipynb/Data_Type_Dictionary.html new file mode 100644 index 0000000..335bc00 --- /dev/null +++ b/python_ipynb/Data_Type_Dictionary.html @@ -0,0 +1,13599 @@ + + + +Data_Type_Dictionary + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +
    +

    Dictionaries in Python

    +
    +
    +
    +
    +
    +
    In [1]:
    +
    +
    +
    f = { 'name':'sachin','age':22,'language':'hindi','height':5.11,'education':'Engineer'}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    print(f.values())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    dict_values(['sachin', 22, 'hindi', 5.11, 'Engineer'])
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    s = 'sachin'
    +h  = hash(s)
    +k = bin(h)
    +print(h)
    +print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    7690198149797640290
    +0b110101010111001000100100111100100001011000011011111100001100010
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    info = {
    +    
    +    'name':'python',
    +    'father':'Guido Van Rossum',
    +    'type' : 'Programming Language',
    +    'current_version' : 3.7,
    +    'scope' : {
    +        'web' : [ 'flask','django','pyramid','web2py'],
    +        'gui' : [ 'tkinter', 'wxpython','kivi',],
    +        'automation' : [ 'ansible','puppet','openstack'],
    +        'bigdata' : [ 'pyspark'],
    +        'data_science' : [ 'pandas','numpy',],
    +        'machine_learning' : ['sci-py','scikit-learn','teserflow']
    +        
    +    }
    +
    +        }
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    print(info)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'name': 'python', 'father': 'Guido Van Rossum', 'type': 'Programming Language', 'current_version': 3.7, 'scope': {'web': ['flask', 'django', 'pyramid', 'web2py'], 'gui': ['tkinter', 'wxpython', 'kivi'], 'automation': ['ansible', 'puppet', 'openstack'], 'bigdata': ['pyspark'], 'data_science': ['pandas', 'numpy'], 'machine_learning': ['sci-py', 'scikit-learn', 'teserflow']}}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    from pprint import pprint
    +pprint(info)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'current_version': 3.7,
    + 'father': 'Guido Van Rossum',
    + 'name': 'python',
    + 'scope': {'automation': ['ansible', 'puppet', 'openstack'],
    +           'bigdata': ['pyspark'],
    +           'data_science': ['pandas', 'numpy'],
    +           'gui': ['tkinter', 'wxpython', 'kivi'],
    +           'machine_learning': ['sci-py', 'scikit-learn', 'teserflow'],
    +           'web': ['flask', 'django', 'pyramid', 'web2py']},
    + 'type': 'Programming Language'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    info['name']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[11]:
    + + + + +
    +
    'python'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    info['current_version']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[12]:
    + + + + +
    +
    3.7
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    info['scope']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[13]:
    + + + + +
    +
    {'web': ['flask', 'django', 'pyramid', 'web2py'],
    + 'gui': ['tkinter', 'wxpython', 'kivi'],
    + 'automation': ['ansible', 'puppet', 'openstack'],
    + 'bigdata': ['pyspark'],
    + 'data_science': ['pandas', 'numpy'],
    + 'machine_learning': ['sci-py', 'scikit-learn', 'teserflow']}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    info['scope']['web'][1:]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[16]:
    + + + + +
    +
    ['django', 'pyramid', 'web2py']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    info = { 
    +        
    +    'name' : "sachin yadav",
    +    'age' : 22,
    +    'education' : {
    +        'matric' : ['RBSE',88.00],
    +        'high_school' : ['RBSE',82.40],
    +        'garduation'  : ['RTU','B.tech computer science',74],
    +                    },
    +    'favourite_things' : 
    +                    {
    +                        'actor':'wahtever',
    +                        'actress' : [ 'one','two','three'],
    +                        'game' : [ 'cricket','footbal',],
    +                        'color' : 'mycolor',
    +                        
    +                    }    
    +        }
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    info['education']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[20]:
    + + + + +
    +
    {'matric': ['RBSE', 88.0],
    + 'high_school': ['RBSE', 82.4],
    + 'garduation': ['RTU', 'B.tech computer science', 74]}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [22]:
    +
    +
    +
    info['education']['garduation']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[22]:
    + + + + +
    +
    ['RTU', 'B.tech computer science', 74]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    info['education']['garduation'][2]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[23]:
    + + + + +
    +
    74
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    python = { 'name':'python','version':3.7,'author':'Gudio Van Rossum'}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    python['name'] = 'PYHTON'
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [30]:
    +
    +
    +
    python['name']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[30]:
    + + + + +
    +
    'PYHTON'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [29]:
    +
    +
    +
    python['Name'] = 'python'
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [31]:
    +
    +
    +
    python['Name']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[31]:
    + + + + +
    +
    'python'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [32]:
    +
    +
    +
    print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum', 'Name': 'python'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [33]:
    +
    +
    +
    print(dir(python))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [35]:
    +
    +
    +
    python['sachin']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +KeyError                                  Traceback (most recent call last)
    +<ipython-input-35-3907d8678c3f> in <module>()
    +----> 1 python['sachin']
    +
    +KeyError: 'sachin'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [39]:
    +
    +
    +
    print('before')
    +print(python)
    +del python['Name']
    +print('after')
    +print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    before
    +{'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum', 'Name': 'python'}
    +after
    +{'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [50]:
    +
    +
    +
    key = input("What do you want see : ").strip().lower()
    +key = ''.join(key.split())
    +python[key]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    What do you want see : sachin
    +
    +
    +
    + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +KeyError                                  Traceback (most recent call last)
    +<ipython-input-50-1a8f19be03bc> in <module>()
    +      1 key = input("What do you want see : ").strip().lower()
    +      2 key = ''.join(key.split())
    +----> 3 python[key]
    +
    +KeyError: 'sachin'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [56]:
    +
    +
    +
    python.get('name','No such key exists')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[56]:
    + + + + +
    +
    'PYHTON'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [59]:
    +
    +
    +
    key = input("What do you want see : ").strip().lower()
    +key = ''.join(key.split())
    +python.get(key,'No such key exists in our database')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    What do you want see : sachin
    +
    +
    +
    + +
    + +
    Out[59]:
    + + + + +
    +
    'No such key exists in our database'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [69]:
    +
    +
    +
    print(python.items())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    dict_items([('name', 'PYHTON'), ('version', 3.7), ('author', 'Gudio Van Rossum')])
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [61]:
    +
    +
    +
    print(dir(python))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [68]:
    +
    +
    +
    s = "hel  lo    W    o   rld"
    +k = s.split()
    +print(k)
    +''.join(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['hel', 'lo', 'W', 'o', 'rld']
    +
    +
    +
    + +
    + +
    Out[68]:
    + + + + +
    +
    'helloWorld'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [70]:
    +
    +
    +
    python.keys()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[70]:
    + + + + +
    +
    dict_keys(['name', 'version', 'author'])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [71]:
    +
    +
    +
    python.values()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[71]:
    + + + + +
    +
    dict_values(['PYHTON', 3.7, 'Gudio Van Rossum'])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [72]:
    +
    +
    +
    l1 = [ 'one','two','three','four','five','six']
    +l2 = [ 'sachin','poonam','jitender','neha','meena','ramwatar']
    +print(l1)
    +print(l2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['one', 'two', 'three', 'four', 'five', 'six']
    +['sachin', 'poonam', 'jitender', 'neha', 'meena', 'ramwatar']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [73]:
    +
    +
    +
    l3 = list(zip(l1,l2))
    +print(l3)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [('one', 'sachin'), ('two', 'poonam'), ('three', 'jitender'), ('four', 'neha'), ('five', 'meena'), ('six', 'ramwatar')]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [74]:
    +
    +
    +
    my_dict = dict(l3)
    +print(my_dict)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'one': 'sachin', 'two': 'poonam', 'three': 'jitender', 'four': 'neha', 'five': 'meena', 'six': 'ramwatar'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [75]:
    +
    +
    +
    k = list(my_dict)
    +print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['one', 'two', 'three', 'four', 'five', 'six']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [76]:
    +
    +
    +
    k = list(my_dict.items())
    +print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [('one', 'sachin'), ('two', 'poonam'), ('three', 'jitender'), ('four', 'neha'), ('five', 'meena'), ('six', 'ramwatar')]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [77]:
    +
    +
    +
    v = list(my_dict.values())
    +ke = list(my_dict.keys())
    +kv = list(my_dict.items())
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [78]:
    +
    +
    +
    print(ke)
    +print(v)
    +print(kv)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['one', 'two', 'three', 'four', 'five', 'six']
    +['sachin', 'poonam', 'jitender', 'neha', 'meena', 'ramwatar']
    +[('one', 'sachin'), ('two', 'poonam'), ('three', 'jitender'), ('four', 'neha'), ('five', 'meena'), ('six', 'ramwatar')]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [81]:
    +
    +
    +
    print(dir(python))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [82]:
    +
    +
    +
    print(python.pop.__doc__)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
    +If key is not found, d is returned if given, otherwise KeyError is raised
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [85]:
    +
    +
    +
    print(python)
    +value= python.pop('name')
    +print("Value is removed from dictionary is ",value)
    +print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum'}
    +Value is removed from dictionary is  PYHTON
    +{'version': 3.7, 'author': 'Gudio Van Rossum'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [87]:
    +
    +
    +
    python.pop('sachin','No Key available')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[87]:
    + + + + +
    +
    'No Key available'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [88]:
    +
    +
    +
    print(dir(python))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [89]:
    +
    +
    +
    python.popitem()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[89]:
    + + + + +
    +
    ('author', 'Gudio Van Rossum')
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [90]:
    +
    +
    +
    python['sachin'] = 'mr. coder'
    +python['name'] = 'python'
    +print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'version': 3.7, 'sachin': 'mr. coder', 'name': 'python'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [91]:
    +
    +
    +
    python['name'] = 'World"s best language'
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [92]:
    +
    +
    +
    python
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[92]:
    + + + + +
    +
    {'version': 3.7, 'sachin': 'mr. coder', 'name': 'World"s best language'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [93]:
    +
    +
    +
    python['name']  = 'python'
    +print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'version': 3.7, 'sachin': 'mr. coder', 'name': 'python'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [94]:
    +
    +
    +
    python.setdefault('rajat','i am the owner of Grras')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[94]:
    + + + + +
    +
    'i am the owner of Grras'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [95]:
    +
    +
    +
    print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'version': 3.7, 'sachin': 'mr. coder', 'name': 'python', 'rajat': 'i am the owner of Grras'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [96]:
    +
    +
    +
    python.setdefault('name','don of the world')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[96]:
    + + + + +
    +
    'python'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [97]:
    +
    +
    +
    print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'version': 3.7, 'sachin': 'mr. coder', 'name': 'python', 'rajat': 'i am the owner of Grras'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [98]:
    +
    +
    +
    info = { 'scope' : 'world-wide','name':'PYTHON',}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [99]:
    +
    +
    +
    print(info)
    +print(python)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'scope': 'world-wide', 'name': 'PYTHON'}
    +{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python', 'rajat': 'i am the owner of Grras'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [100]:
    +
    +
    +
    python.update(info)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [101]:
    +
    +
    +
    python
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[101]:
    + + + + +
    +
    {'version': 3.7,
    + 'sachin': 'mr. coder',
    + 'name': 'PYTHON',
    + 'rajat': 'i am the owner of Grras',
    + 'scope': 'world-wide'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [102]:
    +
    +
    +
    info
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[102]:
    + + + + +
    +
    {'scope': 'world-wide', 'name': 'PYTHON'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [103]:
    +
    +
    +
    info.update(python)
    +info
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[103]:
    + + + + +
    +
    {'scope': 'world-wide',
    + 'name': 'PYTHON',
    + 'version': 3.7,
    + 'sachin': 'mr. coder',
    + 'rajat': 'i am the owner of Grras'}
    +
    + +
    + +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/Data_Type_Dictionary.ipynb b/python_ipynb/Data_Type_Dictionary.ipynb new file mode 100644 index 0000000..52c37ad --- /dev/null +++ b/python_ipynb/Data_Type_Dictionary.ipynb @@ -0,0 +1,1364 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Dictionaries in Python

    " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "f = { 'name':'sachin','age':22,'language':'hindi','height':5.11,'education':'Engineer'}\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "dict_values(['sachin', 22, 'hindi', 5.11, 'Engineer'])\n" + ] + } + ], + "source": [ + "print(f.values())" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "7690198149797640290\n", + "0b110101010111001000100100111100100001011000011011111100001100010\n" + ] + } + ], + "source": [ + "s = 'sachin'\n", + "h = hash(s)\n", + "k = bin(h)\n", + "print(h)\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "info = {\n", + " \n", + " 'name':'python',\n", + " 'father':'Guido Van Rossum',\n", + " 'type' : 'Programming Language',\n", + " 'current_version' : 3.7,\n", + " 'scope' : {\n", + " 'web' : [ 'flask','django','pyramid','web2py'],\n", + " 'gui' : [ 'tkinter', 'wxpython','kivi',],\n", + " 'automation' : [ 'ansible','puppet','openstack'],\n", + " 'bigdata' : [ 'pyspark'],\n", + " 'data_science' : [ 'pandas','numpy',],\n", + " 'machine_learning' : ['sci-py','scikit-learn','teserflow']\n", + " \n", + " }\n", + "\n", + " }" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'python', 'father': 'Guido Van Rossum', 'type': 'Programming Language', 'current_version': 3.7, 'scope': {'web': ['flask', 'django', 'pyramid', 'web2py'], 'gui': ['tkinter', 'wxpython', 'kivi'], 'automation': ['ansible', 'puppet', 'openstack'], 'bigdata': ['pyspark'], 'data_science': ['pandas', 'numpy'], 'machine_learning': ['sci-py', 'scikit-learn', 'teserflow']}}\n" + ] + } + ], + "source": [ + "print(info)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'current_version': 3.7,\n", + " 'father': 'Guido Van Rossum',\n", + " 'name': 'python',\n", + " 'scope': {'automation': ['ansible', 'puppet', 'openstack'],\n", + " 'bigdata': ['pyspark'],\n", + " 'data_science': ['pandas', 'numpy'],\n", + " 'gui': ['tkinter', 'wxpython', 'kivi'],\n", + " 'machine_learning': ['sci-py', 'scikit-learn', 'teserflow'],\n", + " 'web': ['flask', 'django', 'pyramid', 'web2py']},\n", + " 'type': 'Programming Language'}\n" + ] + } + ], + "source": [ + "from pprint import pprint\n", + "pprint(info)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'python'" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['name']" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3.7" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['current_version']" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'web': ['flask', 'django', 'pyramid', 'web2py'],\n", + " 'gui': ['tkinter', 'wxpython', 'kivi'],\n", + " 'automation': ['ansible', 'puppet', 'openstack'],\n", + " 'bigdata': ['pyspark'],\n", + " 'data_science': ['pandas', 'numpy'],\n", + " 'machine_learning': ['sci-py', 'scikit-learn', 'teserflow']}" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['scope']" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['django', 'pyramid', 'web2py']" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['scope']['web'][1:]" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [], + "source": [ + "info = { \n", + " \n", + " 'name' : \"sachin yadav\",\n", + " 'age' : 22,\n", + " 'education' : {\n", + " 'matric' : ['RBSE',88.00],\n", + " 'high_school' : ['RBSE',82.40],\n", + " 'garduation' : ['RTU','B.tech computer science',74],\n", + " },\n", + " 'favourite_things' : \n", + " {\n", + " 'actor':'wahtever',\n", + " 'actress' : [ 'one','two','three'],\n", + " 'game' : [ 'cricket','footbal',],\n", + " 'color' : 'mycolor',\n", + " \n", + " } \n", + " }" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'matric': ['RBSE', 88.0],\n", + " 'high_school': ['RBSE', 82.4],\n", + " 'garduation': ['RTU', 'B.tech computer science', 74]}" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['education']" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['RTU', 'B.tech computer science', 74]" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['education']['garduation']" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "74" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['education']['garduation'][2]" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [], + "source": [ + "python = { 'name':'python','version':3.7,'author':'Gudio Van Rossum'}" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [], + "source": [ + "python['name'] = 'PYHTON'" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'PYHTON'" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python['name']" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [], + "source": [ + "python['Name'] = 'python'" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'python'" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python['Name']" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum', 'Name': 'python'}\n" + ] + } + ], + "source": [ + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(python))" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "ename": "KeyError", + "evalue": "'sachin'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mpython\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'sachin'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m: 'sachin'" + ] + } + ], + "source": [ + "python['sachin']" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "before\n", + "{'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum', 'Name': 'python'}\n", + "after\n", + "{'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum'}\n" + ] + } + ], + "source": [ + "print('before')\n", + "print(python)\n", + "del python['Name']\n", + "print('after')\n", + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "What do you want see : sachin\n" + ] + }, + { + "ename": "KeyError", + "evalue": "'sachin'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mkey\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0minput\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"What do you want see : \"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstrip\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlower\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[0mkey\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m''\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[0mpython\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m: 'sachin'" + ] + } + ], + "source": [ + "key = input(\"What do you want see : \").strip().lower()\n", + "key = ''.join(key.split())\n", + "python[key]" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'PYHTON'" + ] + }, + "execution_count": 56, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.get('name','No such key exists')" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "What do you want see : sachin\n" + ] + }, + { + "data": { + "text/plain": [ + "'No such key exists in our database'" + ] + }, + "execution_count": 59, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "key = input(\"What do you want see : \").strip().lower()\n", + "key = ''.join(key.split())\n", + "python.get(key,'No such key exists in our database')" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "dict_items([('name', 'PYHTON'), ('version', 3.7), ('author', 'Gudio Van Rossum')])\n" + ] + } + ], + "source": [ + "print(python.items())" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(python))" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hel', 'lo', 'W', 'o', 'rld']\n" + ] + }, + { + "data": { + "text/plain": [ + "'helloWorld'" + ] + }, + "execution_count": 68, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = \"hel lo W o rld\"\n", + "k = s.split()\n", + "print(k)\n", + "''.join(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_keys(['name', 'version', 'author'])" + ] + }, + "execution_count": 70, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.keys()" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_values(['PYHTON', 3.7, 'Gudio Van Rossum'])" + ] + }, + "execution_count": 71, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.values()" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['one', 'two', 'three', 'four', 'five', 'six']\n", + "['sachin', 'poonam', 'jitender', 'neha', 'meena', 'ramwatar']\n" + ] + } + ], + "source": [ + "l1 = [ 'one','two','three','four','five','six']\n", + "l2 = [ 'sachin','poonam','jitender','neha','meena','ramwatar']\n", + "print(l1)\n", + "print(l2)" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[('one', 'sachin'), ('two', 'poonam'), ('three', 'jitender'), ('four', 'neha'), ('five', 'meena'), ('six', 'ramwatar')]\n" + ] + } + ], + "source": [ + "l3 = list(zip(l1,l2))\n", + "print(l3)" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'one': 'sachin', 'two': 'poonam', 'three': 'jitender', 'four': 'neha', 'five': 'meena', 'six': 'ramwatar'}\n" + ] + } + ], + "source": [ + "my_dict = dict(l3)\n", + "print(my_dict)" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['one', 'two', 'three', 'four', 'five', 'six']\n" + ] + } + ], + "source": [ + "k = list(my_dict)\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[('one', 'sachin'), ('two', 'poonam'), ('three', 'jitender'), ('four', 'neha'), ('five', 'meena'), ('six', 'ramwatar')]\n" + ] + } + ], + "source": [ + "k = list(my_dict.items())\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 77, + "metadata": {}, + "outputs": [], + "source": [ + "v = list(my_dict.values())\n", + "ke = list(my_dict.keys())\n", + "kv = list(my_dict.items())" + ] + }, + { + "cell_type": "code", + "execution_count": 78, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['one', 'two', 'three', 'four', 'five', 'six']\n", + "['sachin', 'poonam', 'jitender', 'neha', 'meena', 'ramwatar']\n", + "[('one', 'sachin'), ('two', 'poonam'), ('three', 'jitender'), ('four', 'neha'), ('five', 'meena'), ('six', 'ramwatar')]\n" + ] + } + ], + "source": [ + "print(ke)\n", + "print(v)\n", + "print(kv)" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(python))" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n", + "If key is not found, d is returned if given, otherwise KeyError is raised\n" + ] + } + ], + "source": [ + "print(python.pop.__doc__)" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'PYHTON', 'version': 3.7, 'author': 'Gudio Van Rossum'}\n", + "Value is removed from dictionary is PYHTON\n", + "{'version': 3.7, 'author': 'Gudio Van Rossum'}\n" + ] + } + ], + "source": [ + "print(python)\n", + "value= python.pop('name')\n", + "print(\"Value is removed from dictionary is \",value)\n", + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'No Key available'" + ] + }, + "execution_count": 87, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.pop('sachin','No Key available')" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(python))" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "('author', 'Gudio Van Rossum')" + ] + }, + "execution_count": 89, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.popitem()" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python'}\n" + ] + } + ], + "source": [ + "python['sachin'] = 'mr. coder'\n", + "python['name'] = 'python'\n", + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 91, + "metadata": {}, + "outputs": [], + "source": [ + "python['name'] = 'World\"s best language'" + ] + }, + { + "cell_type": "code", + "execution_count": 92, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'World\"s best language'}" + ] + }, + "execution_count": 92, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python" + ] + }, + { + "cell_type": "code", + "execution_count": 93, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python'}\n" + ] + } + ], + "source": [ + "python['name'] = 'python'\n", + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'i am the owner of Grras'" + ] + }, + "execution_count": 94, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.setdefault('rajat','i am the owner of Grras')" + ] + }, + { + "cell_type": "code", + "execution_count": 95, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python', 'rajat': 'i am the owner of Grras'}\n" + ] + } + ], + "source": [ + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'python'" + ] + }, + "execution_count": 96, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python.setdefault('name','don of the world')" + ] + }, + { + "cell_type": "code", + "execution_count": 97, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python', 'rajat': 'i am the owner of Grras'}\n" + ] + } + ], + "source": [ + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": {}, + "outputs": [], + "source": [ + "info = { 'scope' : 'world-wide','name':'PYTHON',}" + ] + }, + { + "cell_type": "code", + "execution_count": 99, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'scope': 'world-wide', 'name': 'PYTHON'}\n", + "{'version': 3.7, 'sachin': 'mr. coder', 'name': 'python', 'rajat': 'i am the owner of Grras'}\n" + ] + } + ], + "source": [ + "print(info)\n", + "print(python)" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [], + "source": [ + "python.update(info)" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'version': 3.7,\n", + " 'sachin': 'mr. coder',\n", + " 'name': 'PYTHON',\n", + " 'rajat': 'i am the owner of Grras',\n", + " 'scope': 'world-wide'}" + ] + }, + "execution_count": 101, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "python" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'info' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0minfo\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mNameError\u001b[0m: name 'info' is not defined" + ] + } + ], + "source": [ + "info" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'scope': 'world-wide',\n", + " 'name': 'PYTHON',\n", + " 'version': 3.7,\n", + " 'sachin': 'mr. coder',\n", + " 'rajat': 'i am the owner of Grras'}" + ] + }, + "execution_count": 103, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info.update(python)\n", + "info" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "#list way \n", + "student = [\n", + " [1001,'sachin',999999,'python@123',True],\n", + " [1002,'jitendra',6500,'redhat@8921',False],\n", + " [1003,'meena',75000,'password',False],\n", + "]" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1001, 'sachin', 999999, 'python@123', True]" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "student[0]" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "#anthor way of list represet\n", + "student = [ \n", + " [1001,1002,1003,1004,1005,1006],\n", + " ['sachin','jitendra','meena','ramawatar','poonam','neha'],\n", + " [9999,6500,5677,34223,56434,34565434],\n", + " ['redhat','Asimov','python@123','password','myworld','iamking'],\n", + " [True,False,False,True,False,True]\n", + " ]" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your account number : 1005\n", + "Your name is poonam\n", + "Your Balance is 56434\n", + "Your Password is myworld\n", + "Your Loan Status is False\n" + ] + } + ], + "source": [ + "acc_num = int(input(\"Enter your account number : \"))\n", + "index = student[0].index(acc_num)\n", + "print(\"Your name is \",student[1][index])\n", + "print(\"Your Balance is \",student[2][index])\n", + "print(\"Your Password is \",student[3][index])\n", + "print(\"Your Loan Status is \",student[4][index])" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], + "source": [ + "#dictionary implementation\n", + "#anthor way of list represet\n", + "student = { \n", + " 'acc' : [1001,1002,1003,1004,1005,1006],\n", + " 'name' : ['sachin','jitendra','meena','ramawatar','poonam','neha'],\n", + " 'bal' : [9999,6500,5677,34223,56434,34565434],\n", + "'password' : ['redhat','Asimov','python@123','password','myworld','iamking'],\n", + " 'loan' : [True,False,False,True,False,True]\n", + " }\n" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your account number : 1002\n", + "Your name is jitendra\n", + "Your Balance is 6500\n", + "Your Password is Asimov\n", + "Your Loan Status is False\n" + ] + } + ], + "source": [ + "acc_num = int(input(\"Enter your account number : \"))\n", + "index = student['acc'].index(acc_num)\n", + "print(\"Your name is \",student['name'][index])\n", + "print(\"Your Balance is \",student['bal'][index])\n", + "print(\"Your Password is \",student['password'][index])\n", + "print(\"Your Loan Status is \",student['loan'][index])" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [], + "source": [ + "student = { \n", + " 1001 : { 'name':'sachin','bal':6500,'password':'redhat@3496'},\n", + " 1002 : { 'name':'meena','bal':7500000,'password':'@123abcd!','loan':True },\n", + " 1003 : { 'name':'poonam','bal':89234,'password':'1384y3243',},\n", + " 1004 : { 'name':'jitendra','bal':734234,'password':'hello',},\n", + " 1005 : { 'name':'sudharshan','bal':897983,'password':'bye'},\n", + " 1006 : { 'name':'ramawatar','bal':95000,'password':'goodboy'} \n", + " }" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your name : neha\n", + "Password : mynameisneha\n", + "Enter your balance : 10000\n" + ] + } + ], + "source": [ + "name = input(\"Enter your name : \")\n", + "acc_no = 1007\n", + "password = input(\"Password : \")\n", + "bal = int(input(\"Enter your balance : \"))\n", + "info = { 'name':name,'bal':bal,'password':password}\n", + "student.update({1007:info})\n" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{1001: {'bal': 6500, 'name': 'sachin', 'password': 'redhat@3496'},\n", + " 1002: {'bal': 7500000, 'loan': True, 'name': 'meena', 'password': '@123abcd!'},\n", + " 1003: {'bal': 89234, 'name': 'poonam', 'password': '1384y3243'},\n", + " 1004: {'bal': 734234, 'name': 'jitendra', 'password': 'hello'},\n", + " 1005: {'bal': 897983, 'name': 'sudharshan', 'password': 'bye'},\n", + " 1006: {'bal': 95000, 'name': 'ramawatar', 'password': 'goodboy'},\n", + " 1007: {'bal': 10000, 'name': 'neha', 'password': 'mynameisneha'}}\n" + ] + } + ], + "source": [ + "from pprint import pprint\n", + "pprint(student)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{1001: {'name': 'sachin', 'bal': 6500, 'password': 'redhat@3496'}, 1002: {'name': 'meena', 'bal': 7500000, 'password': '@123abcd!', 'loan': True}, 1003: {'name': 'poonam', 'bal': 89234, 'password': '1384y3243'}, 1004: {'name': 'jitendra', 'bal': 734234, 'password': 'hello'}, 1005: {'name': 'sudharshan', 'bal': 897983, 'password': 'bye'}, 1006: {'name': 'ramawatar', 'bal': 95000, 'password': 'goodboy'}, 1007: {'name': 'neha', 'bal': 10000, 'password': 'mynameisneha'}}\n" + ] + } + ], + "source": [ + "print(student)" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Passoword : ········\n", + "helloworldal;ksjdfk\n" + ] + } + ], + "source": [ + "from getpass import getpass\n", + "password = getpass(\"Passoword : \")\n", + "print(password)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Data_Type_List (1).ipynb b/python_ipynb/Data_Type_List (1).ipynb new file mode 100644 index 0000000..b37bc41 --- /dev/null +++ b/python_ipynb/Data_Type_List (1).ipynb @@ -0,0 +1,1571 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    List Data Type

    \n", + "

    List is combination of items, items can be homogenous or hetrogenous. If all items of list is homogenous then list is known as array. List type is mutable data type.

    \n", + "

    Homogenous --> all elements are of same data type

    \n", + "

    Hetrogenous --> all elements are of different different types

    \n", + "\n", + "

    for Example : -
    \n", + " mylist1 = [ 1,2,3,4,5] or mylist2 = ['hi','hello','how' ] are of homogenous list or we can these are arrays
    \n", + " mylist2 = [ 1,3.14,'hello','hi',5+6j ] is a hetro genous list

    \n", + " \n", + "

    Array-->array is collection of similar data types or we can say an array is a collection of homogenous data types.

    \n", + " \n", + "

    Note:- All arrays are list but all lists are not array

    " + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['2-shirts', '3-jeans', 'one plus six T', '2kg chawal', '1 airplane']\n" + ] + } + ], + "source": [ + "#syntax name_list = [ item1, item2, item3, ..., itemn ]\n", + "shopping_list = [ '2-shirts','3-jeans','one plus six T','2kg chawal','1 airplane']\n", + "print(shopping_list)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    List support indexing and slicing same as strings

    " + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "programming_languages = [ 'python','java','c','c++','php','.net','shell scripting',\n", + " 'c#','scala','pig','go','swift','javascript','r','angular js',\n", + " 'node js','block chain','html','css','bootstrap','xml','json',\n", + " 'sql','mongodb',]" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['python', 'java', 'c', 'c++', 'php', '.net', 'shell scripting', 'c#', 'scala', 'pig', 'go', 'swift', 'javascript', 'r', 'angular js', 'node js', 'block chain', 'html', 'css', 'bootstrap', 'xml', 'json', 'sql', 'mongodb']\n" + ] + } + ], + "source": [ + "print(programming_languages)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total languages = 24\n" + ] + } + ], + "source": [ + "print(\"Total languages = \",len(programming_languages))" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Top 5 languages in market : ['python', 'java', 'c', 'c++', 'php']\n", + "Last 5 languages in market : ['bootstrap', 'xml', 'json', 'sql', 'mongodb']\n" + ] + } + ], + "source": [ + "print(\"Top 5 languages in market : \",programming_languages[:5])\n", + "print(\"Last 5 languages in market : \",programming_languages[-5:])" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['mongodb', 'sql', 'json', 'xml', 'bootstrap', 'css', 'html', 'block chain', 'node js', 'angular js', 'r', 'javascript', 'swift', 'go', 'pig', 'scala', 'c#', 'shell scripting', '.net', 'php', 'c++', 'c', 'java', 'python']\n" + ] + } + ], + "source": [ + "n = programming_languages[::-1]\n", + "print(n)" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hello', 1, 'something']\n" + ] + } + ], + "source": [ + "l = [ 'hello', 'bye',1,5.6,'something']\n", + "print(l[::2])" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hello', 'my name is sachin', 1, 5.6, 'something']\n" + ] + } + ], + "source": [ + "l[1] = 'my name is sachin' #will over-write value on position 1\n", + "print(l) #this is the proof that list is mutable" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hello', 'my name is sachin', 1, 'something']\n" + ] + } + ], + "source": [ + "del l[3] # will remove item from position 3 it means 5.6 will be deleted\n", + "print(l)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Built-in functions of list

    \n", + "
      \n", + "
    1. \n", + "

      To add items to a list

      \n", + "
        \n", + "
      • list.append(item) --> will add item at the end of list
      • \n", + "
      • list.insert(index,item) --> will add item at position index in list
      • \n", + "
      • list.extend(sequence) --> will append each item from sequence at the end of the list
      • \n", + "
      \n", + "
    2. To delete items from a list

      \n", + "
        \n", + "
      • list.pop() --> will delete last item from a list (opposite of append)
      • \n", + "
      • list.pop(index) ---> will delete item from position index (opposite of insert)
      • \n", + "
      • list.remove(item) --> will delete first occurence of item from list
      • \n", + "
      \n", + "
    3. Some Common Functions of list

      \n", + "
        \n", + "
      • list.sort() --> will sort all the items inplace in ascending order.
      • \n", + "
      • list.sort(reverse=True) --> will sort all the items inplace in descending order.\n", + "

        Note :- for sort function list should homogenous

        \n", + "
      • \n", + "
      • list.reverse() --> will reverse position of all items in place, same as as list[::-1]
      • \n", + "
      • list.clear() --> will clear all the item from a list, will create empty list.
      • \n", + "
      • new_list = list.copy() --> will return a copy of list and store it into new_list
      • \n", + "
      • item_index = list.index(item) --> will return index number of item or we can say will return position of item from list, if item is not available then it will give an error item not found.
      • \n", + "
      • item_count = list.count(item) --> will count repeatation of item inside list or will count how many time item occurs inside a list.
      • \n", + "
      \n", + "
    " + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']\n" + ] + } + ], + "source": [ + "print(dir(list))" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hello', 1, 2, 3, 'hi']\n", + "['hello', 1, 2, 3, 'hi', 'sachin']\n" + ] + } + ], + "source": [ + "#to add items\n", + "l = [ 'hello',1,2,3,'hi',]\n", + "print(l)\n", + "#let's add an item at the end of the list\n", + "l.append('sachin')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hello', 1, 2, 3, 'hi', 'sachin', 3.14]\n" + ] + } + ], + "source": [ + "l.append(3.14) # will add 3.14 at the end\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hello', 1, 2, 3, 'hi', 'sachin', 3.14, [1, 'two', 3, 'four']]\n" + ] + } + ], + "source": [ + "l.append([1,'two',3,'four']) #will add this list at the end as it is\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "l = [ 1,2,5,6,7,34,23,45,]" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 5, 6, 7, 34, 23, 45]\n" + ] + } + ], + "source": [ + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 5, 6, 7, 34, 23, 45, 'hello']\n" + ] + } + ], + "source": [ + "l.append('hello')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 5, 6, 7, 34, 23, 45, 'hello', 'something']\n", + "None\n" + ] + } + ], + "source": [ + "k = l.append('something')\n", + "print(l)\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 5, 6, 7, 34, 23, 45, 'hello', 'something']\n" + ] + } + ], + "source": [ + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 5, 6, 'sachin', 7, 34, 23, 45, 'hello', 'something']\n" + ] + } + ], + "source": [ + "#insert \n", + "l.insert(4,'sachin')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['python', 1, 2, 5, 6, 'sachin', 7, 34, 23, 45, 'hello', 'something']\n" + ] + } + ], + "source": [ + "l.insert(0,'python')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['python', 1, 2, 5, 6, 'sachin', 7, 34, 23, 45, 'hello', 'something', 'addlast']\n" + ] + } + ], + "source": [ + "l.append('addlast')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "#append --> at last location\n", + "#insert --> at a location\n", + "#extend " + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 'hello', 'hi']\n", + "['python', 1, 'java', 'hello', 'hi']\n" + ] + } + ], + "source": [ + "l = []\n", + "l.append(1);l.append('hello');l.append('hi')\n", + "print(l)\n", + "l.insert(0,'python');l.insert(2,'java')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['python', 1, 'java', 'hello', 'hi', 'p', 'y', 't', 'h', 'o', 'n']\n" + ] + } + ], + "source": [ + "l.extend('python')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [], + "source": [ + "l = []\n", + "l.extend([1,2,3,'hello','hi','how are you'])" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 3, 'hello', 'hi', 'how are you']\n" + ] + } + ], + "source": [ + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hi', 'hello', [1, 2, 3]]\n" + ] + } + ], + "source": [ + "l = [ 'hi','hello']\n", + "l.append([1,2,3]) #append(item)\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hi', 'hello', 1, 2, 3]\n" + ] + } + ], + "source": [ + "l = [ 'hi','hello']\n", + "l.extend([1,2,3]) #extend(sequence)\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['python']\n" + ] + } + ], + "source": [ + "l = []\n", + "l.append('python')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['p', 'y', 't', 'h', 'o', 'n']\n" + ] + } + ], + "source": [ + "l = []\n", + "l.extend('python')\n", + "print(l)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['java', 'c', 'c++', 'python', 'ruby', 'perl', 'go', 'swift']\n", + "swift is removed from list.\n", + "['java', 'c', 'c++', 'python', 'ruby', 'perl', 'go']\n" + ] + } + ], + "source": [ + "#how to delete items from list\n", + "l = [ 'java','c','c++','python','ruby','perl','go','swift']\n", + "# how delete last item --> use pop\n", + "print(l)\n", + "item = l.pop()\n", + "print(item,\"is removed from list.\")\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['zero', 'one', 'two', 'three', 'four', 'five', 'six']\n", + "three is deleted\n", + "['zero', 'one', 'two', 'four', 'five', 'six']\n" + ] + } + ], + "source": [ + "#if i want to remove item from a certain position\n", + "#list.pop(index)\n", + "l = [ 'zero','one','two','three','four','five','six']\n", + "print(l)\n", + "item = l.pop(3)\n", + "print(item,\"is deleted\")\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[13, 18, 6, 13, 4, 8, 3, 6, 6, 20, 9, 2, 11, 5, 14]\n" + ] + } + ], + "source": [ + "from random import randint\n", + "k = [ randint(1,20) for var in range(15)]\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "length of list = 15\n", + "Here is your list 13 18 6 13 4 8 3 6 6 20 9 2 11 5 14\n" + ] + } + ], + "source": [ + "print(\"length of list = \",len(k))\n", + "print(\"Here is your list \",*k)" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\n", + "H e l l o W o r l d\n" + ] + } + ], + "source": [ + "print(\"Hello World\")\n", + "print(*\"Hello World\")" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello\n", + "H e l l o\n", + "H e l l o\n" + ] + } + ], + "source": [ + "print(\"Hello\")\n", + "print(*\"Hello\") #--> print('H','e','l','l','o')\n", + "print('H','e','l','l','o')" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 23, 43, 16, 5, 10]\n", + "1 23 43 16 5 10\n", + "1 23 43 16 5 10\n" + ] + } + ], + "source": [ + "l = [ 1,23,43,16,5,10]\n", + "print(l)\n", + "print(*l) # print(1,23,43,16,5,10)\n", + "print(1,23,43,16,5,10)" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "length of list = 15\n", + "Here is your list 13 18 6 13 4 8 3 6 6 20 9 2 11 5 14\n", + "13 18 6 13 4 8 3 6 6 20 9 2 11 5 14\n" + ] + } + ], + "source": [ + "print(\"length of list = \",len(k))\n", + "print(\"Here is your list \",*k)\n", + "l = k\n", + "print(*l)" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[13, 18, 6, 13, 4, 8, 3, 6, 6, 20, 9, 2, 11, 5, 14]\n", + "14 item is deleted\n", + "13 item is deleted\n", + "3 item is deleted\n", + "13 item is deleted\n", + "6 item is deleted\n", + "5 item is deleted\n", + "Remaning List is = [18, 4, 8, 6, 6, 20, 9, 2, 11]\n" + ] + } + ], + "source": [ + "print(l)\n", + "item = l.pop()\n", + "print(item,\"item is deleted\")\n", + "item = l.pop(3)\n", + "print(item,\"item is deleted\")\n", + "item = l.pop(5)\n", + "print(item,\"item is deleted\")\n", + "item = l.pop(0)\n", + "print(item,\"item is deleted\")\n", + "item = l.pop(1)\n", + "print(item,\"item is deleted\")\n", + "item = l.pop()\n", + "print(item,\"item is deleted\")\n", + "print(\"Remaning List is = \",l)" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 1, 2, 3, 1, 2, 3]\n" + ] + } + ], + "source": [ + "#there is one more way\n", + "#if i don't know index number and want to delete a item\n", + "#remove(item)\n", + "l = [ 1,2,3,1,2,3,1,2,3]\n", + "l.remove(3)\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hello', 'hi', 'hello', 'hi', 'bye', 'hi', 'hello']\n", + "['hi', 'hello', 'hi', 'bye', 'hi', 'hello']\n", + "['hello', 'hi', 'bye', 'hi', 'hello']\n" + ] + } + ], + "source": [ + "l = [ 'hello','hi','hello','hi','bye','hi','hello']\n", + "print(l)\n", + "l.remove('hello')\n", + "print(l)\n", + "l.remove('hi')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 1, 1, 2, 1, 1, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 2, 1, 2, 1, 2, 1, 2]\n" + ] + } + ], + "source": [ + "l=[1,2,1,1,2,1,1,1,2,2,1,2,1,2,1,2,1,2,1,2,1,2,1,1,2,2,1,2,1,2,1,2]\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": {}, + "outputs": [], + "source": [ + "l = list(set(l))" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2]\n" + ] + } + ], + "source": [ + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ + { + "ename": "ValueError", + "evalue": "list.remove(x): x not in list", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[0ml\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mremove\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[0ml\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mremove\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[0ml\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mremove\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mValueError\u001b[0m: list.remove(x): x not in list" + ] + } + ], + "source": [ + "#common functions of list \n", + "l = [ 1,2,3,1,1]\n", + "l.remove(1)\n", + "l.remove(1)\n", + "l.remove(1)\n", + "l.remove(1)" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "one is repeated time 7\n", + "two is repeated time 6\n", + "three is repeated time 1\n" + ] + } + ], + "source": [ + "l = [ 1,2,3,2,1,2,32,32,1,1,1,12,2,2,1,12,2,1]\n", + "count_one = l.count(1)\n", + "count_two = l.count(2)\n", + "count_three = l.count(3)\n", + "print(\"one is repeated time \",count_one)\n", + "print(\"two is repeated time \",count_two)\n", + "print(\"three is repeated time \",count_three)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [], + "source": [ + "l = [ 'python','java','sachin','poonam','sudharshan','neha','meena','ramawatar']\n", + "from random import choice\n", + "badi_list = [ choice(l) for var in range(20) ]" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['meena', 'ramawatar', 'python', 'python', 'sachin', 'meena', 'poonam', 'java', 'poonam', 'ramawatar', 'sachin', 'neha', 'neha', 'python', 'sudharshan', 'poonam', 'python', 'sachin', 'sachin', 'ramawatar']\n" + ] + } + ], + "source": [ + "print(badi_list)" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n" + ] + } + ], + "source": [ + "print(badi_list.count('abracadabra'))" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['meena', 'ramawatar', 'python', 'python', 'sachin', 'meena', 'poonam', 'java', 'poonam', 'ramawatar', 'sachin', 'neha', 'neha', 'python', 'sudharshan', 'poonam', 'python', 'sachin', 'sachin', 'ramawatar']\n" + ] + } + ], + "source": [ + "print(badi_list)" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4\n" + ] + } + ], + "source": [ + "index = badi_list.index('sachin')\n", + "print(index)" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['meena', 'ramawatar', 'python', 'python', 'sachin', 'meena', 'poonam', 'java', 'poonam', 'ramawatar', 'sachin', 'neha', 'neha', 'python', 'sudharshan', 'poonam', 'python', 'sachin', 'sachin', 'ramawatar']\n", + "['meena', 'ramawatar', 'python', 'python', 'sachin', 'meena', 'poonam', 'java', 'poonam', 'ramawatar', 'sachin', 'neha', 'neha', 'python', 'sudharshan', 'poonam', 'python', 'sachin', 'sachin', 'ramawatar']\n" + ] + } + ], + "source": [ + "badi_list_ki_copy = badi_list.copy()\n", + "print(badi_list)\n", + "print(badi_list_ki_copy)" + ] + }, + { + "cell_type": "code", + "execution_count": 78, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 3, 4, 5]\n", + "[1, 2, 3, 4, 5]\n", + "[1, 2, 3, 4, 5]\n" + ] + } + ], + "source": [ + "l = [ 1,2,3,4,5]\n", + "k = l \n", + "x = l.copy()\n", + "print(l)\n", + "print(k)\n", + "print(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 3, 4, 5, 'sachin']\n", + "[1, 2, 3, 4, 5, 'sachin']\n", + "[1, 2, 3, 4, 5]\n" + ] + } + ], + "source": [ + "l.append('sachin')\n", + "print(l)\n", + "print(k)\n", + "print(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['sachin', 'rahul', 'rajat', 'nidhi', 'hello']\n", + "['sachin', 'rahul', 'rajat', 'nidhi', 'hello']\n" + ] + } + ], + "source": [ + "mydata = [ 'sachin','rahul','rajat','nidhi','hello']\n", + "mydata_copy = mydata.copy()\n", + "print(mydata)\n", + "print(mydata_copy)" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[]\n", + "['sachin', 'rahul', 'rajat', 'nidhi', 'hello']\n" + ] + } + ], + "source": [ + "mydata.clear() # will remove all times\n", + "print(mydata)\n", + "print(mydata_copy)" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['sachin', 'rahul', 'rajat', 'nidhi', 'hello']\n" + ] + } + ], + "source": [ + "mydata = mydata_copy.copy()\n", + "print(mydata)" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hello', 'nidhi', 'rajat', 'rahul', 'sachin']\n", + "['sachin', 'rahul', 'rajat', 'nidhi', 'hello']\n" + ] + } + ], + "source": [ + "mydata.reverse() #in place reverse the list same as list[::-1]\n", + "print(mydata)\n", + "print(mydata_copy)" + ] + }, + { + "cell_type": "code", + "execution_count": 84, + "metadata": {}, + "outputs": [ + { + "ename": "TypeError", + "evalue": "'<' not supported between instances of 'int' and 'str'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;31m#note --> list should homogenos\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[0ml\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m \u001b[1;34m'hello'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m4\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m5\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 4\u001b[1;33m \u001b[0ml\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msort\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 5\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ml\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mTypeError\u001b[0m: '<' not supported between instances of 'int' and 'str'" + ] + } + ], + "source": [ + "#sort --> will do sorting \n", + "#note --> list should homogenos\n", + "l = [ 'hello',1,2,3,4,5]\n", + "l.sort()\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[23, 15, 29, 25, 28, 22, 9, 31, 23, 26, 35, 35, 14, 47, 13, 16, 28, 32, 11, 32, 1, 29, 23, 10, 3]\n" + ] + } + ], + "source": [ + "l = [ randint(1,50) for var in range(25)]\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 3, 9, 10, 11, 13, 14, 15, 16, 22, 23, 23, 23, 25, 26, 28, 28, 29, 29, 31, 32, 32, 35, 35, 47]\n", + "[1, 3, 9, 10, 11, 13, 14, 15, 16, 22, 23, 23, 23, 25, 26, 28, 28, 29, 29, 31, 32, 32, 35, 35, 47]\n", + "[47, 35, 35, 32, 32, 31, 29, 29, 28, 28, 26, 25, 23, 23, 23, 22, 16, 15, 14, 13, 11, 10, 9, 3, 1]\n" + ] + } + ], + "source": [ + "k = l.copy()\n", + "print(k)\n", + "l.sort()\n", + "print(l)\n", + "d = k.copy()\n", + "d.sort(reverse=True)\n", + "print(d)" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['meena', 'ramawatar', 'python', 'python', 'sachin', 'meena', 'poonam', 'java', 'poonam', 'ramawatar', 'sachin', 'neha', 'neha', 'python', 'sudharshan', 'poonam', 'python', 'sachin', 'sachin', 'ramawatar']\n" + ] + } + ], + "source": [ + "print(badi_list)" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ascending --> ['java', 'meena', 'meena', 'neha', 'neha', 'poonam', 'poonam', 'poonam', 'python', 'python', 'python', 'python', 'ramawatar', 'ramawatar', 'ramawatar', 'sachin', 'sachin', 'sachin', 'sachin', 'sudharshan']\n", + "Desecding ---> ['sudharshan', 'sachin', 'sachin', 'sachin', 'sachin', 'ramawatar', 'ramawatar', 'ramawatar', 'python', 'python', 'python', 'python', 'poonam', 'poonam', 'poonam', 'neha', 'neha', 'meena', 'meena', 'java']\n" + ] + } + ], + "source": [ + "badi_list.sort()\n", + "badi_list_ki_copy.sort(reverse=True)\n", + "print(\"Ascending --> \",badi_list)\n", + "print('Desecding ---> ',badi_list_ki_copy)" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(1, 2, 3, 'hello', 'hi', 'how')\n" + ] + } + ], + "source": [ + "t = (1,2,3,'hello','hi','how')\n", + "# all tuples are same as list except tuples are immutble\n", + "print(t)" + ] + }, + { + "cell_type": "code", + "execution_count": 91, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index']\n" + ] + } + ], + "source": [ + "print(dir(tuple))" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": {}, + "outputs": [], + "source": [ + "from random import randint\n", + "t = tuple( randint(1,20) for var in range(25) )" + ] + }, + { + "cell_type": "code", + "execution_count": 95, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(3, 10, 14, 6, 5, 1, 7, 7, 19, 9, 6, 13, 2, 2, 6, 16, 3, 18, 5, 3, 2, 15, 3, 8, 12)\n" + ] + } + ], + "source": [ + "print(t)" + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], + "source": [ + "print(type(t))" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(3, 10, 14, 6, 5)" + ] + }, + "execution_count": 98, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "t[:5]" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(2, 15, 3, 8, 12)" + ] + }, + "execution_count": 100, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "t[-5:]" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": {}, + "outputs": [], + "source": [ + "#Dictionary\n", + "#JSON,MONGODB \n", + "info = { 'name':'sachin','age':22,'education':'b.tech',\n", + " 'blood_group':'b+ive'}" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'sachin'" + ] + }, + "execution_count": 103, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['name']" + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "22" + ] + }, + "execution_count": 104, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['age']" + ] + }, + { + "cell_type": "code", + "execution_count": 105, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'b.tech'" + ] + }, + "execution_count": 105, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['education']" + ] + }, + { + "cell_type": "code", + "execution_count": 106, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(dict))" + ] + }, + { + "cell_type": "code", + "execution_count": 107, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n", + "If key is not found, d is returned if given, otherwise KeyError is raised\n" + ] + } + ], + "source": [ + "print(dict.pop.__doc__)" + ] + }, + { + "cell_type": "code", + "execution_count": 108, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['p', 'y', 't', 'h', 'o', 'n']\n", + "('p', 'y', 't', 'h', 'o', 'n')\n" + ] + } + ], + "source": [ + "l = list('python')\n", + "t = tuple('python')\n", + "print(l)\n", + "print(t)" + ] + }, + { + "cell_type": "code", + "execution_count": 109, + "metadata": {}, + "outputs": [], + "source": [ + "l = list(info)\n", + "t = tuple(info)" + ] + }, + { + "cell_type": "code", + "execution_count": 110, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['name', 'age', 'education', 'blood_group']\n", + "('name', 'age', 'education', 'blood_group')\n" + ] + } + ], + "source": [ + "print(l)\n", + "print(t)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Data_Type_List.html b/python_ipynb/Data_Type_List.html new file mode 100644 index 0000000..12e0ac4 --- /dev/null +++ b/python_ipynb/Data_Type_List.html @@ -0,0 +1,14335 @@ + + + +Data_Type_List + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +
    +

    List Data Type

    +

    List is combination of items, items can be homogenous or hetrogenous. If all items of list is homogenous then list is known as array. List type is mutable data type.

    +

    Homogenous --> all elements are of same data type

    +

    Hetrogenous --> all elements are of different different types

    for Example : -
    + mylist1 = [ 1,2,3,4,5] or mylist2 = ['hi','hello','how' ] are of homogenous list or we can these are arrays
    + mylist2 = [ 1,3.14,'hello','hi',5+6j ] is a hetro genous list

    Array-->array is collection of similar data types or we can say an array is a collection of homogenous data types.

    Note:- All arrays are list but all lists are not array

    +
    +
    +
    +
    +
    +
    In [4]:
    +
    +
    +
    #syntax name_list = [ item1, item2, item3, ..., itemn ]
    +shopping_list = [ '2-shirts','3-jeans','one plus six T','2kg chawal','1 airplane']
    +print(shopping_list)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['2-shirts', '3-jeans', 'one plus six T', '2kg chawal', '1 airplane']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    List support indexing and slicing same as strings

    +
    +
    +
    +
    +
    +
    In [6]:
    +
    +
    +
    programming_languages = [ 'python','java','c','c++','php','.net','shell scripting',
    +                       'c#','scala','pig','go','swift','javascript','r','angular js',
    +                       'node js','block chain','html','css','bootstrap','xml','json',
    +                       'sql','mongodb',]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    print(programming_languages)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['python', 'java', 'c', 'c++', 'php', '.net', 'shell scripting', 'c#', 'scala', 'pig', 'go', 'swift', 'javascript', 'r', 'angular js', 'node js', 'block chain', 'html', 'css', 'bootstrap', 'xml', 'json', 'sql', 'mongodb']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    print("Total languages = ",len(programming_languages))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Total languages =  24
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    print("Top 5 languages in market : ",programming_languages[:5])
    +print("Last 5 languages in market : ",programming_languages[-5:])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Top 5 languages in market :  ['python', 'java', 'c', 'c++', 'php']
    +Last 5 languages in market :  ['bootstrap', 'xml', 'json', 'sql', 'mongodb']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    n = programming_languages[::-1]
    +print(n)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['mongodb', 'sql', 'json', 'xml', 'bootstrap', 'css', 'html', 'block chain', 'node js', 'angular js', 'r', 'javascript', 'swift', 'go', 'pig', 'scala', 'c#', 'shell scripting', '.net', 'php', 'c++', 'c', 'java', 'python']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    l = [ 'hello', 'bye',1,5.6,'something']
    +print(l[::2])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['hello', 1, 'something']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    l[1] = 'my name is sachin' #will over-write value on position 1
    +print(l) #this is the proof that list is mutable
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['hello', 'my name is sachin', 1, 5.6, 'something']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    del l[3] # will remove item from position 3 it means 5.6 will be deleted
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['hello', 'my name is sachin', 1, 'something']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Built-in functions of list

    +
      +
    1. +

      To add items to a list

      +
        +
      • list.append(item) --> will add item at the end of list
      • +
      • list.insert(index,item) --> will add item at position index in list
      • +
      • list.extend(sequence) --> will append each item from sequence at the end of the list
      • +
      +
    2. To delete items from a list

      +
        +
      • list.pop() --> will delete last item from a list (opposite of append)
      • +
      • list.pop(index) ---> will delete item from position index (opposite of insert)
      • +
      • list.remove(item) --> will delete first occurence of item from list
      • +
      +
    3. Some Common Functions of list

      +
        +
      • list.sort() --> will sort all the items inplace in ascending order.
      • +
      • list.sort(reverse=True) --> will sort all the items inplace in descending order. +

        Note :- for sort function list should homogenous

        +
      • +
      • list.reverse() --> will reverse position of all items in place, same as as list[::-1]
      • +
      • list.clear() --> will clear all the item from a list, will create empty list.
      • +
      • new_list = list.copy() --> will return a copy of list and store it into new_list
      • +
      • item_index = list.index(item) --> will return index number of item or we can say will return position of item from list, if item is not available then it will give an error item not found.
      • +
      • item_count = list.count(item) --> will count repeatation of item inside list or will count how many time item occurs inside a list.
      • +
      +
    +
    +
    +
    +
    +
    +
    In [21]:
    +
    +
    +
    print(dir(list))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [22]:
    +
    +
    +
    #to add items
    +l = [ 'hello',1,2,3,'hi',]
    +print(l)
    +#let's add an item at the end of the list
    +l.append('sachin')
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['hello', 1, 2, 3, 'hi']
    +['hello', 1, 2, 3, 'hi', 'sachin']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    l.append(3.14) # will add 3.14 at the end
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['hello', 1, 2, 3, 'hi', 'sachin', 3.14]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [24]:
    +
    +
    +
    l.append([1,'two',3,'four']) #will add this list at the end as it is
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['hello', 1, 2, 3, 'hi', 'sachin', 3.14, [1, 'two', 3, 'four']]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [1]:
    +
    +
    +
    l = [ 1,2,5,6,7,34,23,45,]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 5, 6, 7, 34, 23, 45]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    l.append('hello')
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 5, 6, 7, 34, 23, 45, 'hello']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    k = l.append('something')
    +print(l)
    +print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 5, 6, 7, 34, 23, 45, 'hello', 'something']
    +None
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 5, 6, 7, 34, 23, 45, 'hello', 'something']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    #insert 
    +l.insert(4,'sachin')
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 5, 6, 'sachin', 7, 34, 23, 45, 'hello', 'something']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    l.insert(0,'python')
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['python', 1, 2, 5, 6, 'sachin', 7, 34, 23, 45, 'hello', 'something']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    l.append('addlast')
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['python', 1, 2, 5, 6, 'sachin', 7, 34, 23, 45, 'hello', 'something', 'addlast']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    #append --> at last location
    +#insert --> at a location
    +#extend 
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    l = []
    +l.append(1);l.append('hello');l.append('hi')
    +print(l)
    +l.insert(0,'python');l.insert(2,'java')
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 'hello', 'hi']
    +['python', 1, 'java', 'hello', 'hi']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    l.extend('python')
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['python', 1, 'java', 'hello', 'hi', 'p', 'y', 't', 'h', 'o', 'n']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    l = []
    +l.extend([1,2,3,'hello','hi','how are you'])
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 3, 'hello', 'hi', 'how are you']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    l = [ 'hi','hello']
    +l.append([1,2,3]) #append(item)
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['hi', 'hello', [1, 2, 3]]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    l = [ 'hi','hello']
    +l.extend([1,2,3]) #extend(sequence)
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['hi', 'hello', 1, 2, 3]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    l = []
    +l.append('python')
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['python']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [21]:
    +
    +
    +
    l = []
    +l.extend('python')
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['p', 'y', 't', 'h', 'o', 'n']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [31]:
    +
    +
    +
    #how to delete items from list
    +l = [ 'java','c','c++','python','ruby','perl','go','swift']
    +# how delete last item --> use pop
    +print(l)
    +item = l.pop()
    +print(item,"is removed from list.")
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['java', 'c', 'c++', 'python', 'ruby', 'perl', 'go', 'swift']
    +swift is removed from list.
    +['java', 'c', 'c++', 'python', 'ruby', 'perl', 'go']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [32]:
    +
    +
    +
    #if i want to remove item from a certain position
    +#list.pop(index)
    +l = [ 'zero','one','two','three','four','five','six']
    +print(l)
    +item = l.pop(3)
    +print(item,"is deleted")
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['zero', 'one', 'two', 'three', 'four', 'five', 'six']
    +three is deleted
    +['zero', 'one', 'two', 'four', 'five', 'six']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [35]:
    +
    +
    +
    from random import randint
    +k = [ randint(1,20) for var in range(15)]
    +print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [13, 18, 6, 13, 4, 8, 3, 6, 6, 20, 9, 2, 11, 5, 14]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [37]:
    +
    +
    +
    print("length of list = ",len(k))
    +print("Here is your list ",*k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    length of list =  15
    +Here is your list  13 18 6 13 4 8 3 6 6 20 9 2 11 5 14
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [38]:
    +
    +
    +
    print("Hello World")
    +print(*"Hello World")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World
    +H e l l o   W o r l d
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [39]:
    +
    +
    +
    print("Hello")
    +print(*"Hello") #--> print('H','e','l','l','o')
    +print('H','e','l','l','o')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello
    +H e l l o
    +H e l l o
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [41]:
    +
    +
    +
    l = [ 1,23,43,16,5,10]
    +print(l)
    +print(*l) # print(1,23,43,16,5,10)
    +print(1,23,43,16,5,10)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 23, 43, 16, 5, 10]
    +1 23 43 16 5 10
    +1 23 43 16 5 10
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [44]:
    +
    +
    +
    print("length of list = ",len(k))
    +print("Here is your list ",*k)
    +l = k
    +print(*l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    length of list =  15
    +Here is your list  13 18 6 13 4 8 3 6 6 20 9 2 11 5 14
    +13 18 6 13 4 8 3 6 6 20 9 2 11 5 14
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [45]:
    +
    +
    +
    print(l)
    +item = l.pop()
    +print(item,"item is deleted")
    +item = l.pop(3)
    +print(item,"item is deleted")
    +item = l.pop(5)
    +print(item,"item is deleted")
    +item = l.pop(0)
    +print(item,"item is deleted")
    +item = l.pop(1)
    +print(item,"item is deleted")
    +item = l.pop()
    +print(item,"item is deleted")
    +print("Remaning List is = ",l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [13, 18, 6, 13, 4, 8, 3, 6, 6, 20, 9, 2, 11, 5, 14]
    +14 item is deleted
    +13 item is deleted
    +3 item is deleted
    +13 item is deleted
    +6 item is deleted
    +5 item is deleted
    +Remaning List is =  [18, 4, 8, 6, 6, 20, 9, 2, 11]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [48]:
    +
    +
    +
    #there is one more way
    +#if i don't know index number and want to delete a item
    +#remove(item)
    +l = [ 1,2,3,1,2,3,1,2,3]
    +l.remove(3)
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 1, 2, 3, 1, 2, 3]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [47]:
    +
    +
    +
    l = [ 'hello','hi','hello','hi','bye','hi','hello']
    +print(l)
    +l.remove('hello')
    +print(l)
    +l.remove('hi')
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['hello', 'hi', 'hello', 'hi', 'bye', 'hi', 'hello']
    +['hi', 'hello', 'hi', 'bye', 'hi', 'hello']
    +['hello', 'hi', 'bye', 'hi', 'hello']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [49]:
    +
    +
    +
    l=[1,2,1,1,2,1,1,1,2,2,1,2,1,2,1,2,1,2,1,2,1,2,1,1,2,2,1,2,1,2,1,2]
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 1, 1, 2, 1, 1, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 2, 1, 2, 1, 2, 1, 2]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [52]:
    +
    +
    +
    l = list(set(l))
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [53]:
    +
    +
    +
    print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [56]:
    +
    +
    +
    #common functions of list 
    +l = [ 1,2,3,1,1]
    +l.remove(1)
    +l.remove(1)
    +l.remove(1)
    +l.remove(1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +ValueError                                Traceback (most recent call last)
    +<ipython-input-56-adcb1fa1e89a> in <module>()
    +      4 l.remove(1)
    +      5 l.remove(1)
    +----> 6 l.remove(1)
    +
    +ValueError: list.remove(x): x not in list
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [58]:
    +
    +
    +
    l = [ 1,2,3,2,1,2,32,32,1,1,1,12,2,2,1,12,2,1]
    +count_one = l.count(1)
    +count_two = l.count(2)
    +count_three = l.count(3)
    +print("one is repeated time ",count_one)
    +print("two is repeated time ",count_two)
    +print("three is repeated time ",count_three)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    one is repeated time  7
    +two is repeated time  6
    +three is repeated time  1
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [59]:
    +
    +
    +
    l = [ 'python','java','sachin','poonam','sudharshan','neha','meena','ramawatar']
    +from random import choice
    +badi_list = [ choice(l) for var in range(20) ]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [61]:
    +
    +
    +
    print(badi_list)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['meena', 'ramawatar', 'python', 'python', 'sachin', 'meena', 'poonam', 'java', 'poonam', 'ramawatar', 'sachin', 'neha', 'neha', 'python', 'sudharshan', 'poonam', 'python', 'sachin', 'sachin', 'ramawatar']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [67]:
    +
    +
    +
    print(badi_list.count('abracadabra'))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    0
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [68]:
    +
    +
    +
    print(badi_list)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['meena', 'ramawatar', 'python', 'python', 'sachin', 'meena', 'poonam', 'java', 'poonam', 'ramawatar', 'sachin', 'neha', 'neha', 'python', 'sudharshan', 'poonam', 'python', 'sachin', 'sachin', 'ramawatar']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [71]:
    +
    +
    +
    index = badi_list.index('sachin')
    +print(index)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    4
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [72]:
    +
    +
    +
    badi_list_ki_copy = badi_list.copy()
    +print(badi_list)
    +print(badi_list_ki_copy)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['meena', 'ramawatar', 'python', 'python', 'sachin', 'meena', 'poonam', 'java', 'poonam', 'ramawatar', 'sachin', 'neha', 'neha', 'python', 'sudharshan', 'poonam', 'python', 'sachin', 'sachin', 'ramawatar']
    +['meena', 'ramawatar', 'python', 'python', 'sachin', 'meena', 'poonam', 'java', 'poonam', 'ramawatar', 'sachin', 'neha', 'neha', 'python', 'sudharshan', 'poonam', 'python', 'sachin', 'sachin', 'ramawatar']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [78]:
    +
    +
    +
    l = [ 1,2,3,4,5]
    +k = l 
    +x = l.copy()
    +print(l)
    +print(k)
    +print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 3, 4, 5]
    +[1, 2, 3, 4, 5]
    +[1, 2, 3, 4, 5]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [79]:
    +
    +
    +
    l.append('sachin')
    +print(l)
    +print(k)
    +print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 3, 4, 5, 'sachin']
    +[1, 2, 3, 4, 5, 'sachin']
    +[1, 2, 3, 4, 5]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [80]:
    +
    +
    +
    mydata = [ 'sachin','rahul','rajat','nidhi','hello']
    +mydata_copy = mydata.copy()
    +print(mydata)
    +print(mydata_copy)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['sachin', 'rahul', 'rajat', 'nidhi', 'hello']
    +['sachin', 'rahul', 'rajat', 'nidhi', 'hello']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [81]:
    +
    +
    +
    mydata.clear() # will remove all times
    +print(mydata)
    +print(mydata_copy)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    []
    +['sachin', 'rahul', 'rajat', 'nidhi', 'hello']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [82]:
    +
    +
    +
    mydata = mydata_copy.copy()
    +print(mydata)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['sachin', 'rahul', 'rajat', 'nidhi', 'hello']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [83]:
    +
    +
    +
    mydata.reverse() #in place reverse the list same as list[::-1]
    +print(mydata)
    +print(mydata_copy)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['hello', 'nidhi', 'rajat', 'rahul', 'sachin']
    +['sachin', 'rahul', 'rajat', 'nidhi', 'hello']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [84]:
    +
    +
    +
    #sort --> will do sorting 
    +#note --> list should homogenos
    +l = [ 'hello',1,2,3,4,5]
    +l.sort()
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +TypeError                                 Traceback (most recent call last)
    +<ipython-input-84-416e536bf2c3> in <module>()
    +      2 #note --> list should homogenos
    +      3 l = [ 'hello',1,2,3,4,5]
    +----> 4 l.sort()
    +      5 print(l)
    +
    +TypeError: '<' not supported between instances of 'int' and 'str'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [85]:
    +
    +
    +
    l = [ randint(1,50) for var in range(25)]
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [23, 15, 29, 25, 28, 22, 9, 31, 23, 26, 35, 35, 14, 47, 13, 16, 28, 32, 11, 32, 1, 29, 23, 10, 3]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [87]:
    +
    +
    +
    k = l.copy()
    +print(k)
    +l.sort()
    +print(l)
    +d = k.copy()
    +d.sort(reverse=True)
    +print(d)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 3, 9, 10, 11, 13, 14, 15, 16, 22, 23, 23, 23, 25, 26, 28, 28, 29, 29, 31, 32, 32, 35, 35, 47]
    +[1, 3, 9, 10, 11, 13, 14, 15, 16, 22, 23, 23, 23, 25, 26, 28, 28, 29, 29, 31, 32, 32, 35, 35, 47]
    +[47, 35, 35, 32, 32, 31, 29, 29, 28, 28, 26, 25, 23, 23, 23, 22, 16, 15, 14, 13, 11, 10, 9, 3, 1]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [88]:
    +
    +
    +
    print(badi_list)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['meena', 'ramawatar', 'python', 'python', 'sachin', 'meena', 'poonam', 'java', 'poonam', 'ramawatar', 'sachin', 'neha', 'neha', 'python', 'sudharshan', 'poonam', 'python', 'sachin', 'sachin', 'ramawatar']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [89]:
    +
    +
    +
    badi_list.sort()
    +badi_list_ki_copy.sort(reverse=True)
    +print("Ascending --> ",badi_list)
    +print('Desecding ---> ',badi_list_ki_copy)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Ascending -->  ['java', 'meena', 'meena', 'neha', 'neha', 'poonam', 'poonam', 'poonam', 'python', 'python', 'python', 'python', 'ramawatar', 'ramawatar', 'ramawatar', 'sachin', 'sachin', 'sachin', 'sachin', 'sudharshan']
    +Desecding --->  ['sudharshan', 'sachin', 'sachin', 'sachin', 'sachin', 'ramawatar', 'ramawatar', 'ramawatar', 'python', 'python', 'python', 'python', 'poonam', 'poonam', 'poonam', 'neha', 'neha', 'meena', 'meena', 'java']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [90]:
    +
    +
    +
    t = (1,2,3,'hello','hi','how')
    +# all tuples are same as list except tuples are immutble
    +print(t)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    (1, 2, 3, 'hello', 'hi', 'how')
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [91]:
    +
    +
    +
    print(dir(tuple))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [94]:
    +
    +
    +
    from random import randint
    +t =  tuple( randint(1,20) for var in range(25) )
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [95]:
    +
    +
    +
    print(t)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    (3, 10, 14, 6, 5, 1, 7, 7, 19, 9, 6, 13, 2, 2, 6, 16, 3, 18, 5, 3, 2, 15, 3, 8, 12)
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [96]:
    +
    +
    +
    print(type(t))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    <class 'tuple'>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [98]:
    +
    +
    +
    t[:5]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[98]:
    + + + + +
    +
    (3, 10, 14, 6, 5)
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [100]:
    +
    +
    +
    t[-5:]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[100]:
    + + + + +
    +
    (2, 15, 3, 8, 12)
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [101]:
    +
    +
    +
    #Dictionary
    +#JSON,MONGODB 
    +info = { 'name':'sachin','age':22,'education':'b.tech',
    +        'blood_group':'b+ive'}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [103]:
    +
    +
    +
    info['name']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[103]:
    + + + + +
    +
    'sachin'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [104]:
    +
    +
    +
    info['age']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[104]:
    + + + + +
    +
    22
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [105]:
    +
    +
    +
    info['education']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[105]:
    + + + + +
    +
    'b.tech'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [106]:
    +
    +
    +
    print(dir(dict))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [107]:
    +
    +
    +
    print(dict.pop.__doc__)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
    +If key is not found, d is returned if given, otherwise KeyError is raised
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [108]:
    +
    +
    +
    l = list('python')
    +t = tuple('python')
    +print(l)
    +print(t)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['p', 'y', 't', 'h', 'o', 'n']
    +('p', 'y', 't', 'h', 'o', 'n')
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [109]:
    +
    +
    +
    l = list(info)
    +t = tuple(info)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [110]:
    +
    +
    +
    print(l)
    +print(t)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['name', 'age', 'education', 'blood_group']
    +('name', 'age', 'education', 'blood_group')
    +
    +
    +
    + +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/Data_Type_List.ipynb b/python_ipynb/Data_Type_List.ipynb new file mode 100644 index 0000000..b37bc41 --- /dev/null +++ b/python_ipynb/Data_Type_List.ipynb @@ -0,0 +1,1571 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    List Data Type

    \n", + "

    List is combination of items, items can be homogenous or hetrogenous. If all items of list is homogenous then list is known as array. List type is mutable data type.

    \n", + "

    Homogenous --> all elements are of same data type

    \n", + "

    Hetrogenous --> all elements are of different different types

    \n", + "\n", + "

    for Example : -
    \n", + " mylist1 = [ 1,2,3,4,5] or mylist2 = ['hi','hello','how' ] are of homogenous list or we can these are arrays
    \n", + " mylist2 = [ 1,3.14,'hello','hi',5+6j ] is a hetro genous list

    \n", + " \n", + "

    Array-->array is collection of similar data types or we can say an array is a collection of homogenous data types.

    \n", + " \n", + "

    Note:- All arrays are list but all lists are not array

    " + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['2-shirts', '3-jeans', 'one plus six T', '2kg chawal', '1 airplane']\n" + ] + } + ], + "source": [ + "#syntax name_list = [ item1, item2, item3, ..., itemn ]\n", + "shopping_list = [ '2-shirts','3-jeans','one plus six T','2kg chawal','1 airplane']\n", + "print(shopping_list)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    List support indexing and slicing same as strings

    " + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "programming_languages = [ 'python','java','c','c++','php','.net','shell scripting',\n", + " 'c#','scala','pig','go','swift','javascript','r','angular js',\n", + " 'node js','block chain','html','css','bootstrap','xml','json',\n", + " 'sql','mongodb',]" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['python', 'java', 'c', 'c++', 'php', '.net', 'shell scripting', 'c#', 'scala', 'pig', 'go', 'swift', 'javascript', 'r', 'angular js', 'node js', 'block chain', 'html', 'css', 'bootstrap', 'xml', 'json', 'sql', 'mongodb']\n" + ] + } + ], + "source": [ + "print(programming_languages)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total languages = 24\n" + ] + } + ], + "source": [ + "print(\"Total languages = \",len(programming_languages))" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Top 5 languages in market : ['python', 'java', 'c', 'c++', 'php']\n", + "Last 5 languages in market : ['bootstrap', 'xml', 'json', 'sql', 'mongodb']\n" + ] + } + ], + "source": [ + "print(\"Top 5 languages in market : \",programming_languages[:5])\n", + "print(\"Last 5 languages in market : \",programming_languages[-5:])" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['mongodb', 'sql', 'json', 'xml', 'bootstrap', 'css', 'html', 'block chain', 'node js', 'angular js', 'r', 'javascript', 'swift', 'go', 'pig', 'scala', 'c#', 'shell scripting', '.net', 'php', 'c++', 'c', 'java', 'python']\n" + ] + } + ], + "source": [ + "n = programming_languages[::-1]\n", + "print(n)" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hello', 1, 'something']\n" + ] + } + ], + "source": [ + "l = [ 'hello', 'bye',1,5.6,'something']\n", + "print(l[::2])" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hello', 'my name is sachin', 1, 5.6, 'something']\n" + ] + } + ], + "source": [ + "l[1] = 'my name is sachin' #will over-write value on position 1\n", + "print(l) #this is the proof that list is mutable" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hello', 'my name is sachin', 1, 'something']\n" + ] + } + ], + "source": [ + "del l[3] # will remove item from position 3 it means 5.6 will be deleted\n", + "print(l)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Built-in functions of list

    \n", + "
      \n", + "
    1. \n", + "

      To add items to a list

      \n", + "
        \n", + "
      • list.append(item) --> will add item at the end of list
      • \n", + "
      • list.insert(index,item) --> will add item at position index in list
      • \n", + "
      • list.extend(sequence) --> will append each item from sequence at the end of the list
      • \n", + "
      \n", + "
    2. To delete items from a list

      \n", + "
        \n", + "
      • list.pop() --> will delete last item from a list (opposite of append)
      • \n", + "
      • list.pop(index) ---> will delete item from position index (opposite of insert)
      • \n", + "
      • list.remove(item) --> will delete first occurence of item from list
      • \n", + "
      \n", + "
    3. Some Common Functions of list

      \n", + "
        \n", + "
      • list.sort() --> will sort all the items inplace in ascending order.
      • \n", + "
      • list.sort(reverse=True) --> will sort all the items inplace in descending order.\n", + "

        Note :- for sort function list should homogenous

        \n", + "
      • \n", + "
      • list.reverse() --> will reverse position of all items in place, same as as list[::-1]
      • \n", + "
      • list.clear() --> will clear all the item from a list, will create empty list.
      • \n", + "
      • new_list = list.copy() --> will return a copy of list and store it into new_list
      • \n", + "
      • item_index = list.index(item) --> will return index number of item or we can say will return position of item from list, if item is not available then it will give an error item not found.
      • \n", + "
      • item_count = list.count(item) --> will count repeatation of item inside list or will count how many time item occurs inside a list.
      • \n", + "
      \n", + "
    " + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']\n" + ] + } + ], + "source": [ + "print(dir(list))" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hello', 1, 2, 3, 'hi']\n", + "['hello', 1, 2, 3, 'hi', 'sachin']\n" + ] + } + ], + "source": [ + "#to add items\n", + "l = [ 'hello',1,2,3,'hi',]\n", + "print(l)\n", + "#let's add an item at the end of the list\n", + "l.append('sachin')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hello', 1, 2, 3, 'hi', 'sachin', 3.14]\n" + ] + } + ], + "source": [ + "l.append(3.14) # will add 3.14 at the end\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hello', 1, 2, 3, 'hi', 'sachin', 3.14, [1, 'two', 3, 'four']]\n" + ] + } + ], + "source": [ + "l.append([1,'two',3,'four']) #will add this list at the end as it is\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "l = [ 1,2,5,6,7,34,23,45,]" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 5, 6, 7, 34, 23, 45]\n" + ] + } + ], + "source": [ + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 5, 6, 7, 34, 23, 45, 'hello']\n" + ] + } + ], + "source": [ + "l.append('hello')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 5, 6, 7, 34, 23, 45, 'hello', 'something']\n", + "None\n" + ] + } + ], + "source": [ + "k = l.append('something')\n", + "print(l)\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 5, 6, 7, 34, 23, 45, 'hello', 'something']\n" + ] + } + ], + "source": [ + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 5, 6, 'sachin', 7, 34, 23, 45, 'hello', 'something']\n" + ] + } + ], + "source": [ + "#insert \n", + "l.insert(4,'sachin')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['python', 1, 2, 5, 6, 'sachin', 7, 34, 23, 45, 'hello', 'something']\n" + ] + } + ], + "source": [ + "l.insert(0,'python')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['python', 1, 2, 5, 6, 'sachin', 7, 34, 23, 45, 'hello', 'something', 'addlast']\n" + ] + } + ], + "source": [ + "l.append('addlast')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "#append --> at last location\n", + "#insert --> at a location\n", + "#extend " + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 'hello', 'hi']\n", + "['python', 1, 'java', 'hello', 'hi']\n" + ] + } + ], + "source": [ + "l = []\n", + "l.append(1);l.append('hello');l.append('hi')\n", + "print(l)\n", + "l.insert(0,'python');l.insert(2,'java')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['python', 1, 'java', 'hello', 'hi', 'p', 'y', 't', 'h', 'o', 'n']\n" + ] + } + ], + "source": [ + "l.extend('python')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [], + "source": [ + "l = []\n", + "l.extend([1,2,3,'hello','hi','how are you'])" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 3, 'hello', 'hi', 'how are you']\n" + ] + } + ], + "source": [ + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hi', 'hello', [1, 2, 3]]\n" + ] + } + ], + "source": [ + "l = [ 'hi','hello']\n", + "l.append([1,2,3]) #append(item)\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hi', 'hello', 1, 2, 3]\n" + ] + } + ], + "source": [ + "l = [ 'hi','hello']\n", + "l.extend([1,2,3]) #extend(sequence)\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['python']\n" + ] + } + ], + "source": [ + "l = []\n", + "l.append('python')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['p', 'y', 't', 'h', 'o', 'n']\n" + ] + } + ], + "source": [ + "l = []\n", + "l.extend('python')\n", + "print(l)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['java', 'c', 'c++', 'python', 'ruby', 'perl', 'go', 'swift']\n", + "swift is removed from list.\n", + "['java', 'c', 'c++', 'python', 'ruby', 'perl', 'go']\n" + ] + } + ], + "source": [ + "#how to delete items from list\n", + "l = [ 'java','c','c++','python','ruby','perl','go','swift']\n", + "# how delete last item --> use pop\n", + "print(l)\n", + "item = l.pop()\n", + "print(item,\"is removed from list.\")\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['zero', 'one', 'two', 'three', 'four', 'five', 'six']\n", + "three is deleted\n", + "['zero', 'one', 'two', 'four', 'five', 'six']\n" + ] + } + ], + "source": [ + "#if i want to remove item from a certain position\n", + "#list.pop(index)\n", + "l = [ 'zero','one','two','three','four','five','six']\n", + "print(l)\n", + "item = l.pop(3)\n", + "print(item,\"is deleted\")\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[13, 18, 6, 13, 4, 8, 3, 6, 6, 20, 9, 2, 11, 5, 14]\n" + ] + } + ], + "source": [ + "from random import randint\n", + "k = [ randint(1,20) for var in range(15)]\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "length of list = 15\n", + "Here is your list 13 18 6 13 4 8 3 6 6 20 9 2 11 5 14\n" + ] + } + ], + "source": [ + "print(\"length of list = \",len(k))\n", + "print(\"Here is your list \",*k)" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\n", + "H e l l o W o r l d\n" + ] + } + ], + "source": [ + "print(\"Hello World\")\n", + "print(*\"Hello World\")" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello\n", + "H e l l o\n", + "H e l l o\n" + ] + } + ], + "source": [ + "print(\"Hello\")\n", + "print(*\"Hello\") #--> print('H','e','l','l','o')\n", + "print('H','e','l','l','o')" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 23, 43, 16, 5, 10]\n", + "1 23 43 16 5 10\n", + "1 23 43 16 5 10\n" + ] + } + ], + "source": [ + "l = [ 1,23,43,16,5,10]\n", + "print(l)\n", + "print(*l) # print(1,23,43,16,5,10)\n", + "print(1,23,43,16,5,10)" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "length of list = 15\n", + "Here is your list 13 18 6 13 4 8 3 6 6 20 9 2 11 5 14\n", + "13 18 6 13 4 8 3 6 6 20 9 2 11 5 14\n" + ] + } + ], + "source": [ + "print(\"length of list = \",len(k))\n", + "print(\"Here is your list \",*k)\n", + "l = k\n", + "print(*l)" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[13, 18, 6, 13, 4, 8, 3, 6, 6, 20, 9, 2, 11, 5, 14]\n", + "14 item is deleted\n", + "13 item is deleted\n", + "3 item is deleted\n", + "13 item is deleted\n", + "6 item is deleted\n", + "5 item is deleted\n", + "Remaning List is = [18, 4, 8, 6, 6, 20, 9, 2, 11]\n" + ] + } + ], + "source": [ + "print(l)\n", + "item = l.pop()\n", + "print(item,\"item is deleted\")\n", + "item = l.pop(3)\n", + "print(item,\"item is deleted\")\n", + "item = l.pop(5)\n", + "print(item,\"item is deleted\")\n", + "item = l.pop(0)\n", + "print(item,\"item is deleted\")\n", + "item = l.pop(1)\n", + "print(item,\"item is deleted\")\n", + "item = l.pop()\n", + "print(item,\"item is deleted\")\n", + "print(\"Remaning List is = \",l)" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 1, 2, 3, 1, 2, 3]\n" + ] + } + ], + "source": [ + "#there is one more way\n", + "#if i don't know index number and want to delete a item\n", + "#remove(item)\n", + "l = [ 1,2,3,1,2,3,1,2,3]\n", + "l.remove(3)\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hello', 'hi', 'hello', 'hi', 'bye', 'hi', 'hello']\n", + "['hi', 'hello', 'hi', 'bye', 'hi', 'hello']\n", + "['hello', 'hi', 'bye', 'hi', 'hello']\n" + ] + } + ], + "source": [ + "l = [ 'hello','hi','hello','hi','bye','hi','hello']\n", + "print(l)\n", + "l.remove('hello')\n", + "print(l)\n", + "l.remove('hi')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 1, 1, 2, 1, 1, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 2, 1, 2, 1, 2, 1, 2]\n" + ] + } + ], + "source": [ + "l=[1,2,1,1,2,1,1,1,2,2,1,2,1,2,1,2,1,2,1,2,1,2,1,1,2,2,1,2,1,2,1,2]\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": {}, + "outputs": [], + "source": [ + "l = list(set(l))" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2]\n" + ] + } + ], + "source": [ + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ + { + "ename": "ValueError", + "evalue": "list.remove(x): x not in list", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[0ml\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mremove\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[0ml\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mremove\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[0ml\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mremove\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mValueError\u001b[0m: list.remove(x): x not in list" + ] + } + ], + "source": [ + "#common functions of list \n", + "l = [ 1,2,3,1,1]\n", + "l.remove(1)\n", + "l.remove(1)\n", + "l.remove(1)\n", + "l.remove(1)" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "one is repeated time 7\n", + "two is repeated time 6\n", + "three is repeated time 1\n" + ] + } + ], + "source": [ + "l = [ 1,2,3,2,1,2,32,32,1,1,1,12,2,2,1,12,2,1]\n", + "count_one = l.count(1)\n", + "count_two = l.count(2)\n", + "count_three = l.count(3)\n", + "print(\"one is repeated time \",count_one)\n", + "print(\"two is repeated time \",count_two)\n", + "print(\"three is repeated time \",count_three)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [], + "source": [ + "l = [ 'python','java','sachin','poonam','sudharshan','neha','meena','ramawatar']\n", + "from random import choice\n", + "badi_list = [ choice(l) for var in range(20) ]" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['meena', 'ramawatar', 'python', 'python', 'sachin', 'meena', 'poonam', 'java', 'poonam', 'ramawatar', 'sachin', 'neha', 'neha', 'python', 'sudharshan', 'poonam', 'python', 'sachin', 'sachin', 'ramawatar']\n" + ] + } + ], + "source": [ + "print(badi_list)" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n" + ] + } + ], + "source": [ + "print(badi_list.count('abracadabra'))" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['meena', 'ramawatar', 'python', 'python', 'sachin', 'meena', 'poonam', 'java', 'poonam', 'ramawatar', 'sachin', 'neha', 'neha', 'python', 'sudharshan', 'poonam', 'python', 'sachin', 'sachin', 'ramawatar']\n" + ] + } + ], + "source": [ + "print(badi_list)" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4\n" + ] + } + ], + "source": [ + "index = badi_list.index('sachin')\n", + "print(index)" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['meena', 'ramawatar', 'python', 'python', 'sachin', 'meena', 'poonam', 'java', 'poonam', 'ramawatar', 'sachin', 'neha', 'neha', 'python', 'sudharshan', 'poonam', 'python', 'sachin', 'sachin', 'ramawatar']\n", + "['meena', 'ramawatar', 'python', 'python', 'sachin', 'meena', 'poonam', 'java', 'poonam', 'ramawatar', 'sachin', 'neha', 'neha', 'python', 'sudharshan', 'poonam', 'python', 'sachin', 'sachin', 'ramawatar']\n" + ] + } + ], + "source": [ + "badi_list_ki_copy = badi_list.copy()\n", + "print(badi_list)\n", + "print(badi_list_ki_copy)" + ] + }, + { + "cell_type": "code", + "execution_count": 78, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 3, 4, 5]\n", + "[1, 2, 3, 4, 5]\n", + "[1, 2, 3, 4, 5]\n" + ] + } + ], + "source": [ + "l = [ 1,2,3,4,5]\n", + "k = l \n", + "x = l.copy()\n", + "print(l)\n", + "print(k)\n", + "print(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 3, 4, 5, 'sachin']\n", + "[1, 2, 3, 4, 5, 'sachin']\n", + "[1, 2, 3, 4, 5]\n" + ] + } + ], + "source": [ + "l.append('sachin')\n", + "print(l)\n", + "print(k)\n", + "print(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['sachin', 'rahul', 'rajat', 'nidhi', 'hello']\n", + "['sachin', 'rahul', 'rajat', 'nidhi', 'hello']\n" + ] + } + ], + "source": [ + "mydata = [ 'sachin','rahul','rajat','nidhi','hello']\n", + "mydata_copy = mydata.copy()\n", + "print(mydata)\n", + "print(mydata_copy)" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[]\n", + "['sachin', 'rahul', 'rajat', 'nidhi', 'hello']\n" + ] + } + ], + "source": [ + "mydata.clear() # will remove all times\n", + "print(mydata)\n", + "print(mydata_copy)" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['sachin', 'rahul', 'rajat', 'nidhi', 'hello']\n" + ] + } + ], + "source": [ + "mydata = mydata_copy.copy()\n", + "print(mydata)" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['hello', 'nidhi', 'rajat', 'rahul', 'sachin']\n", + "['sachin', 'rahul', 'rajat', 'nidhi', 'hello']\n" + ] + } + ], + "source": [ + "mydata.reverse() #in place reverse the list same as list[::-1]\n", + "print(mydata)\n", + "print(mydata_copy)" + ] + }, + { + "cell_type": "code", + "execution_count": 84, + "metadata": {}, + "outputs": [ + { + "ename": "TypeError", + "evalue": "'<' not supported between instances of 'int' and 'str'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;31m#note --> list should homogenos\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[0ml\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m \u001b[1;34m'hello'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m4\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m5\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 4\u001b[1;33m \u001b[0ml\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msort\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 5\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ml\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mTypeError\u001b[0m: '<' not supported between instances of 'int' and 'str'" + ] + } + ], + "source": [ + "#sort --> will do sorting \n", + "#note --> list should homogenos\n", + "l = [ 'hello',1,2,3,4,5]\n", + "l.sort()\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[23, 15, 29, 25, 28, 22, 9, 31, 23, 26, 35, 35, 14, 47, 13, 16, 28, 32, 11, 32, 1, 29, 23, 10, 3]\n" + ] + } + ], + "source": [ + "l = [ randint(1,50) for var in range(25)]\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 3, 9, 10, 11, 13, 14, 15, 16, 22, 23, 23, 23, 25, 26, 28, 28, 29, 29, 31, 32, 32, 35, 35, 47]\n", + "[1, 3, 9, 10, 11, 13, 14, 15, 16, 22, 23, 23, 23, 25, 26, 28, 28, 29, 29, 31, 32, 32, 35, 35, 47]\n", + "[47, 35, 35, 32, 32, 31, 29, 29, 28, 28, 26, 25, 23, 23, 23, 22, 16, 15, 14, 13, 11, 10, 9, 3, 1]\n" + ] + } + ], + "source": [ + "k = l.copy()\n", + "print(k)\n", + "l.sort()\n", + "print(l)\n", + "d = k.copy()\n", + "d.sort(reverse=True)\n", + "print(d)" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['meena', 'ramawatar', 'python', 'python', 'sachin', 'meena', 'poonam', 'java', 'poonam', 'ramawatar', 'sachin', 'neha', 'neha', 'python', 'sudharshan', 'poonam', 'python', 'sachin', 'sachin', 'ramawatar']\n" + ] + } + ], + "source": [ + "print(badi_list)" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ascending --> ['java', 'meena', 'meena', 'neha', 'neha', 'poonam', 'poonam', 'poonam', 'python', 'python', 'python', 'python', 'ramawatar', 'ramawatar', 'ramawatar', 'sachin', 'sachin', 'sachin', 'sachin', 'sudharshan']\n", + "Desecding ---> ['sudharshan', 'sachin', 'sachin', 'sachin', 'sachin', 'ramawatar', 'ramawatar', 'ramawatar', 'python', 'python', 'python', 'python', 'poonam', 'poonam', 'poonam', 'neha', 'neha', 'meena', 'meena', 'java']\n" + ] + } + ], + "source": [ + "badi_list.sort()\n", + "badi_list_ki_copy.sort(reverse=True)\n", + "print(\"Ascending --> \",badi_list)\n", + "print('Desecding ---> ',badi_list_ki_copy)" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(1, 2, 3, 'hello', 'hi', 'how')\n" + ] + } + ], + "source": [ + "t = (1,2,3,'hello','hi','how')\n", + "# all tuples are same as list except tuples are immutble\n", + "print(t)" + ] + }, + { + "cell_type": "code", + "execution_count": 91, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index']\n" + ] + } + ], + "source": [ + "print(dir(tuple))" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": {}, + "outputs": [], + "source": [ + "from random import randint\n", + "t = tuple( randint(1,20) for var in range(25) )" + ] + }, + { + "cell_type": "code", + "execution_count": 95, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(3, 10, 14, 6, 5, 1, 7, 7, 19, 9, 6, 13, 2, 2, 6, 16, 3, 18, 5, 3, 2, 15, 3, 8, 12)\n" + ] + } + ], + "source": [ + "print(t)" + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], + "source": [ + "print(type(t))" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(3, 10, 14, 6, 5)" + ] + }, + "execution_count": 98, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "t[:5]" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(2, 15, 3, 8, 12)" + ] + }, + "execution_count": 100, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "t[-5:]" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": {}, + "outputs": [], + "source": [ + "#Dictionary\n", + "#JSON,MONGODB \n", + "info = { 'name':'sachin','age':22,'education':'b.tech',\n", + " 'blood_group':'b+ive'}" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'sachin'" + ] + }, + "execution_count": 103, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['name']" + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "22" + ] + }, + "execution_count": 104, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['age']" + ] + }, + { + "cell_type": "code", + "execution_count": 105, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'b.tech'" + ] + }, + "execution_count": 105, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "info['education']" + ] + }, + { + "cell_type": "code", + "execution_count": 106, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']\n" + ] + } + ], + "source": [ + "print(dir(dict))" + ] + }, + { + "cell_type": "code", + "execution_count": 107, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n", + "If key is not found, d is returned if given, otherwise KeyError is raised\n" + ] + } + ], + "source": [ + "print(dict.pop.__doc__)" + ] + }, + { + "cell_type": "code", + "execution_count": 108, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['p', 'y', 't', 'h', 'o', 'n']\n", + "('p', 'y', 't', 'h', 'o', 'n')\n" + ] + } + ], + "source": [ + "l = list('python')\n", + "t = tuple('python')\n", + "print(l)\n", + "print(t)" + ] + }, + { + "cell_type": "code", + "execution_count": 109, + "metadata": {}, + "outputs": [], + "source": [ + "l = list(info)\n", + "t = tuple(info)" + ] + }, + { + "cell_type": "code", + "execution_count": 110, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['name', 'age', 'education', 'blood_group']\n", + "('name', 'age', 'education', 'blood_group')\n" + ] + } + ], + "source": [ + "print(l)\n", + "print(t)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Data_Type_Sets (1).ipynb b/python_ipynb/Data_Type_Sets (1).ipynb new file mode 100644 index 0000000..f5bfa7e --- /dev/null +++ b/python_ipynb/Data_Type_Sets (1).ipynb @@ -0,0 +1,475 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Sets

    " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "s1 = { 1,2,5,9,13,16}\n", + "s2 = {16,11,111,57,15,35}\n", + "s3 = {15,35,19,76}" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{1, 2, 5, 9, 13, 16}\n", + "{35, 11, 15, 16, 111, 57}\n", + "{19, 35, 76, 15}\n" + ] + } + ], + "source": [ + "print(s1)\n", + "print(s2)\n", + "print(s3)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__iand__', '__init__', '__init_subclass__', '__ior__', '__isub__', '__iter__', '__ixor__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'add', 'clear', 'copy', 'difference', 'difference_update', 'discard', 'intersection', 'intersection_update', 'isdisjoint', 'issubset', 'issuperset', 'pop', 'remove', 'symmetric_difference', 'symmetric_difference_update', 'union', 'update']\n" + ] + } + ], + "source": [ + "print(dir(set))" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "ename": "TypeError", + "evalue": "unhashable type: 'list'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0ms\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m{\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m4\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m{\u001b[0m\u001b[1;34m'name'\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;34m'sachin'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'work'\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;34m'bakwaas karna'\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m23\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m5\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m: unhashable type: 'list'" + ] + } + ], + "source": [ + "s = { [1,2,3,4],{'name':'sachin','work':'bakwaas karna'},1,23,5}" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 2, 12, 1, 2, 1, 2, 1, 22, 12, 12, 1, 21, 2, 1, 2, 12, 1, 2, 1, 21, 2, 1, 2, 12]\n" + ] + } + ], + "source": [ + "l = [ 1,2,2,12,1,2,1,2,1,22,12,12,1,21,2,1,2,12,1,2,1,21,2,1,2,12]\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{1, 2, 12, 21, 22}\n" + ] + } + ], + "source": [ + "l1 = {1,2,2,12,1,2,1,2,1,22,12,12,1,21,2,1,2,12,1,2,1,21,2,1,2,12 }\n", + "print(l1)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[[1, 2, 3], 'hello']" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "l = [ [1,2,3],'hello']\n", + "l" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [], + "source": [ + "l[0].append(4)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[[1, 2, 3, 4], 'hello']" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "l" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "ename": "TypeError", + "evalue": "unhashable type: 'list'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0ml1\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m{\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m23\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m4\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m: unhashable type: 'list'" + ] + } + ], + "source": [ + "l1 = { [1,2,3],23,3,4}" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Add an element to a set.\n", + "\n", + "This has no effect if the element is already present.\n" + ] + } + ], + "source": [ + "print(set.add.__doc__)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{1, 2, 5, 9, 13, 16}" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s1" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [], + "source": [ + "s1.add(1000)" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{1, 2, 5, 9, 13, 16, 1000}" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s1" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [], + "source": [ + "s1.add(1)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{1, 2, 5, 9, 13, 16, 1000}" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s1" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [], + "source": [ + "s1 = { 'hi','hello','bye','python',1,23,2,5,6,'SACHIN','Hello',123.23}" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{1, 123.23, 2, 23, 5, 6, 'Hello', 'SACHIN', 'bye', 'hello', 'hi', 'python'}" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s1" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [], + "source": [ + "s5 = frozenset({1,2,3,57,5,4,323}) #frozensets are immutable" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'copy', 'difference', 'intersection', 'isdisjoint', 'issubset', 'issuperset', 'symmetric_difference', 'union']\n" + ] + } + ], + "source": [ + "print(dir(s5))" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "ename": "AttributeError", + "evalue": "'frozenset' object has no attribute 'add'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0ms5\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0madd\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m123\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mAttributeError\u001b[0m: 'frozenset' object has no attribute 'add'" + ] + } + ], + "source": [ + "s5.add(123)" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [], + "source": [ + "s1 = { 1,2,5,9,13,16}\n", + "s2 = {16,11,111,57,15,35}\n", + "s3 = {15,35,19,76}" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{1, 2, 5, 9, 13, 16}\n", + "{35, 11, 15, 16, 111, 57}\n", + "{1, 2, 35, 5, 9, 11, 13, 15, 16, 111, 57}\n" + ] + } + ], + "source": [ + "new_s1 = s1.union(s2)\n", + "print(s1)\n", + "print(s2)\n", + "print(new_s1)" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{35, 11, 15, 16, 111, 57}\n", + "{19, 35, 76, 15}\n", + "{16, 57, 11, 111}\n" + ] + } + ], + "source": [ + "new_s2 = s2.difference(s3)\n", + "print(s2)\n", + "print(s3)\n", + "print(new_s2)" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{35, 11, 15, 16, 111, 57}\n", + "{19, 35, 76, 15}\n", + "{35, 15}\n" + ] + } + ], + "source": [ + "new_s3 = s2.intersection(s3)\n", + "print(s2)\n", + "print(s3)\n", + "print(new_s3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Boolean Data Types

    \n", + "
  • True
  • \n", + "
  • False
  • " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Data_Type_Sets.html b/python_ipynb/Data_Type_Sets.html new file mode 100644 index 0000000..72798ff --- /dev/null +++ b/python_ipynb/Data_Type_Sets.html @@ -0,0 +1,12503 @@ + + + +Data_Type_Sets + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +
    +

    Sets

    +
    +
    +
    +
    +
    +
    In [1]:
    +
    +
    +
    s1 = { 1,2,5,9,13,16}
    +s2 = {16,11,111,57,15,35}
    +s3 = {15,35,19,76}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    print(s1)
    +print(s2)
    +print(s3)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {1, 2, 5, 9, 13, 16}
    +{35, 11, 15, 16, 111, 57}
    +{19, 35, 76, 15}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    print(dir(set))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__iand__', '__init__', '__init_subclass__', '__ior__', '__isub__', '__iter__', '__ixor__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'add', 'clear', 'copy', 'difference', 'difference_update', 'discard', 'intersection', 'intersection_update', 'isdisjoint', 'issubset', 'issuperset', 'pop', 'remove', 'symmetric_difference', 'symmetric_difference_update', 'union', 'update']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    s = { [1,2,3,4],{'name':'sachin','work':'bakwaas karna'},1,23,5}
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +TypeError                                 Traceback (most recent call last)
    +<ipython-input-6-18a4bf5c1dc5> in <module>()
    +----> 1 s = { [1,2,3,4],{'name':'sachin','work':'bakwaas karna'},1,23,5}
    +
    +TypeError: unhashable type: 'list'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    l = [ 1,2,2,12,1,2,1,2,1,22,12,12,1,21,2,1,2,12,1,2,1,21,2,1,2,12]
    +print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 2, 12, 1, 2, 1, 2, 1, 22, 12, 12, 1, 21, 2, 1, 2, 12, 1, 2, 1, 21, 2, 1, 2, 12]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    l1 = {1,2,2,12,1,2,1,2,1,22,12,12,1,21,2,1,2,12,1,2,1,21,2,1,2,12 }
    +print(l1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {1, 2, 12, 21, 22}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    l = [ [1,2,3],'hello']
    +l
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[10]:
    + + + + +
    +
    [[1, 2, 3], 'hello']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    l[0].append(4)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    l
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[12]:
    + + + + +
    +
    [[1, 2, 3, 4], 'hello']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    l1 = { [1,2,3],23,3,4}
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +TypeError                                 Traceback (most recent call last)
    +<ipython-input-13-683d37a20b4f> in <module>()
    +----> 1 l1 = { [1,2,3],23,3,4}
    +
    +TypeError: unhashable type: 'list'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    print(set.add.__doc__)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Add an element to a set.
    +
    +This has no effect if the element is already present.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    s1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[15]:
    + + + + +
    +
    {1, 2, 5, 9, 13, 16}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    s1.add(1000)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    s1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[17]:
    + + + + +
    +
    {1, 2, 5, 9, 13, 16, 1000}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    s1.add(1)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    s1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[19]:
    + + + + +
    +
    {1, 2, 5, 9, 13, 16, 1000}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [21]:
    +
    +
    +
    s1 = { 'hi','hello','bye','python',1,23,2,5,6,'SACHIN','Hello',123.23}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [22]:
    +
    +
    +
    s1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[22]:
    + + + + +
    +
    {1, 123.23, 2, 23, 5, 6, 'Hello', 'SACHIN', 'bye', 'hello', 'hi', 'python'}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    s5 = frozenset({1,2,3,57,5,4,323}) #frozensets are immutable
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    print(dir(s5))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'copy', 'difference', 'intersection', 'isdisjoint', 'issubset', 'issuperset', 'symmetric_difference', 'union']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [26]:
    +
    +
    +
    s5.add(123)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +AttributeError                            Traceback (most recent call last)
    +<ipython-input-26-459f5f3b9688> in <module>()
    +----> 1 s5.add(123)
    +
    +AttributeError: 'frozenset' object has no attribute 'add'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    s1 = { 1,2,5,9,13,16}
    +s2 = {16,11,111,57,15,35}
    +s3 = {15,35,19,76}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [29]:
    +
    +
    +
    new_s1 = s1.union(s2)
    +print(s1)
    +print(s2)
    +print(new_s1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {1, 2, 5, 9, 13, 16}
    +{35, 11, 15, 16, 111, 57}
    +{1, 2, 35, 5, 9, 11, 13, 15, 16, 111, 57}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [32]:
    +
    +
    +
    new_s2 = s2.difference(s3)
    +print(s2)
    +print(s3)
    +print(new_s2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {35, 11, 15, 16, 111, 57}
    +{19, 35, 76, 15}
    +{16, 57, 11, 111}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [34]:
    +
    +
    +
    new_s3 = s2.intersection(s3)
    +print(s2)
    +print(s3)
    +print(new_s3)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {35, 11, 15, 16, 111, 57}
    +{19, 35, 76, 15}
    +{35, 15}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Boolean Data Types

    +
  • True
  • +
  • False
  • +
    +
    +
    +
    +
    + + + + + + diff --git a/python_ipynb/Data_Type_Sets.ipynb b/python_ipynb/Data_Type_Sets.ipynb new file mode 100644 index 0000000..f5bfa7e --- /dev/null +++ b/python_ipynb/Data_Type_Sets.ipynb @@ -0,0 +1,475 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Sets

    " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "s1 = { 1,2,5,9,13,16}\n", + "s2 = {16,11,111,57,15,35}\n", + "s3 = {15,35,19,76}" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{1, 2, 5, 9, 13, 16}\n", + "{35, 11, 15, 16, 111, 57}\n", + "{19, 35, 76, 15}\n" + ] + } + ], + "source": [ + "print(s1)\n", + "print(s2)\n", + "print(s3)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__iand__', '__init__', '__init_subclass__', '__ior__', '__isub__', '__iter__', '__ixor__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'add', 'clear', 'copy', 'difference', 'difference_update', 'discard', 'intersection', 'intersection_update', 'isdisjoint', 'issubset', 'issuperset', 'pop', 'remove', 'symmetric_difference', 'symmetric_difference_update', 'union', 'update']\n" + ] + } + ], + "source": [ + "print(dir(set))" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "ename": "TypeError", + "evalue": "unhashable type: 'list'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0ms\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m{\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m4\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m{\u001b[0m\u001b[1;34m'name'\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;34m'sachin'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'work'\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;34m'bakwaas karna'\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m23\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m5\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m: unhashable type: 'list'" + ] + } + ], + "source": [ + "s = { [1,2,3,4],{'name':'sachin','work':'bakwaas karna'},1,23,5}" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 2, 12, 1, 2, 1, 2, 1, 22, 12, 12, 1, 21, 2, 1, 2, 12, 1, 2, 1, 21, 2, 1, 2, 12]\n" + ] + } + ], + "source": [ + "l = [ 1,2,2,12,1,2,1,2,1,22,12,12,1,21,2,1,2,12,1,2,1,21,2,1,2,12]\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{1, 2, 12, 21, 22}\n" + ] + } + ], + "source": [ + "l1 = {1,2,2,12,1,2,1,2,1,22,12,12,1,21,2,1,2,12,1,2,1,21,2,1,2,12 }\n", + "print(l1)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[[1, 2, 3], 'hello']" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "l = [ [1,2,3],'hello']\n", + "l" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [], + "source": [ + "l[0].append(4)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[[1, 2, 3, 4], 'hello']" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "l" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "ename": "TypeError", + "evalue": "unhashable type: 'list'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0ml1\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m{\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m23\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m4\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m: unhashable type: 'list'" + ] + } + ], + "source": [ + "l1 = { [1,2,3],23,3,4}" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Add an element to a set.\n", + "\n", + "This has no effect if the element is already present.\n" + ] + } + ], + "source": [ + "print(set.add.__doc__)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{1, 2, 5, 9, 13, 16}" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s1" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [], + "source": [ + "s1.add(1000)" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{1, 2, 5, 9, 13, 16, 1000}" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s1" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [], + "source": [ + "s1.add(1)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{1, 2, 5, 9, 13, 16, 1000}" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s1" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [], + "source": [ + "s1 = { 'hi','hello','bye','python',1,23,2,5,6,'SACHIN','Hello',123.23}" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{1, 123.23, 2, 23, 5, 6, 'Hello', 'SACHIN', 'bye', 'hello', 'hi', 'python'}" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s1" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [], + "source": [ + "s5 = frozenset({1,2,3,57,5,4,323}) #frozensets are immutable" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'copy', 'difference', 'intersection', 'isdisjoint', 'issubset', 'issuperset', 'symmetric_difference', 'union']\n" + ] + } + ], + "source": [ + "print(dir(s5))" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "ename": "AttributeError", + "evalue": "'frozenset' object has no attribute 'add'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0ms5\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0madd\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m123\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mAttributeError\u001b[0m: 'frozenset' object has no attribute 'add'" + ] + } + ], + "source": [ + "s5.add(123)" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [], + "source": [ + "s1 = { 1,2,5,9,13,16}\n", + "s2 = {16,11,111,57,15,35}\n", + "s3 = {15,35,19,76}" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{1, 2, 5, 9, 13, 16}\n", + "{35, 11, 15, 16, 111, 57}\n", + "{1, 2, 35, 5, 9, 11, 13, 15, 16, 111, 57}\n" + ] + } + ], + "source": [ + "new_s1 = s1.union(s2)\n", + "print(s1)\n", + "print(s2)\n", + "print(new_s1)" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{35, 11, 15, 16, 111, 57}\n", + "{19, 35, 76, 15}\n", + "{16, 57, 11, 111}\n" + ] + } + ], + "source": [ + "new_s2 = s2.difference(s3)\n", + "print(s2)\n", + "print(s3)\n", + "print(new_s2)" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{35, 11, 15, 16, 111, 57}\n", + "{19, 35, 76, 15}\n", + "{35, 15}\n" + ] + } + ], + "source": [ + "new_s3 = s2.intersection(s3)\n", + "print(s2)\n", + "print(s3)\n", + "print(new_s3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Boolean Data Types

    \n", + "
  • True
  • \n", + "
  • False
  • " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Data_Type_string_number.ipynb b/python_ipynb/Data_Type_string_number.ipynb new file mode 100644 index 0000000..db4dac2 --- /dev/null +++ b/python_ipynb/Data_Type_string_number.ipynb @@ -0,0 +1,2843 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Data Types

    \n", + "\n", + "
      \n", + "
    1. Numbers --> int, float, complex
    2. \n", + "
    3. Strings --> group of characters like 'hello'
    4. \n", + "
    5. List --> group of valid python objects or data types [ 1,2,3,4]
    6. \n", + "
    7. Tuples --> Same as list but immutable, like we can not change it
    8. \n", + "
    9. Dictionary --> always store key-value pairs,
    10. \n", + "
    11. Sets --> it implementation of set theory in python
    12. \n", + "
    \n", + " \n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\n", + "Enter your name112\n", + "WElcome user 112\n" + ] + } + ], + "source": [ + "print(\"Hello World\") #for output\n", + "name = input(\"Enter your name\") #for input\n", + "\"\"\"\n", + "name --> variable hai, jisko main contanier bolunga\n", + "\"\"\"\n", + "print(\"WElcome user \",name)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Value of x = 28736827632738727638\n" + ] + } + ], + "source": [ + "x = 28736827632738727638\n", + "print(type(x))\n", + "print(\"Value of x = \",x)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']\n" + ] + } + ], + "source": [ + "from keyword import kwlist\n", + "print(kwlist)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "982739\n" + ] + } + ], + "source": [ + "anything = 982739\n", + "print(anything)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a number : 1\n", + "\n", + "Value = 1\n" + ] + } + ], + "source": [ + "num = input(\"Enter a number : \")\n", + "num = int(num)\n", + "print(type(num))\n", + "print(\"Value = \",num)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "int" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "type(num)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a number : 1\n" + ] + }, + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "num = int(input(\"Enter a number : \"))\n", + "type(num)\n", + "num" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a number : 1\n", + "\n", + "1\n" + ] + } + ], + "source": [ + "num = int(input(\"Enter a number : \"))\n", + "print(type(num))\n", + "print(num)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "value of x = 6.534\n" + ] + } + ], + "source": [ + "#float\n", + "x = 6.534\n", + "print(type(x))\n", + "print(\"value of x = \",x)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a number : 123\n", + "\n", + "value = 123.0\n" + ] + } + ], + "source": [ + "num = float(input(\"Enter a number : \"))\n", + "print(type(num))\n", + "print(\"value = \",num)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Bit Length = 763 bits\n", + "Size taken byx = 128 bytes\n" + ] + } + ], + "source": [ + "x = 29847983274923041239847237489239083278947239848924893248927894178947329847981324798324798327493274327984327984329849328498302498324983274983249832789473298473289479832749832798473298439284792379487398432947329479327432432874983247\n", + "print(\"Bit Length = \",x.bit_length(),'bits')\n", + "print(\"Size taken byx = \",x.__sizeof__(),\"bytes\")" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "value = (3+5j)\n" + ] + } + ], + "source": [ + "x = 3+5j\n", + "print(type(x))\n", + "print(\"value = \",x)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "X = (5+3j)\n", + "Y = (5-3j)\n", + "result = (34+0j)\n" + ] + } + ], + "source": [ + "x = 5+3j\n", + "y = 5-3j\n", + "result = x*y\n", + "print(\"X = \",x)\n", + "print(\"Y = \",y)\n", + "print(\"result = \",result)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter complex num : 123\n", + "Enter another complex : 312\n", + "Type of x = \n", + "Type of y = \n", + "Value of x = (123+0j)\n", + "Value of y = (312+0j)\n", + "Multiplication of complex number : (38376+0j)\n" + ] + } + ], + "source": [ + "x = complex(input(\"Enter complex num : \"))\n", + "y = complex(input(\"Enter another complex : \"))\n", + "print(\"Type of x = \",type(x))\n", + "print(\"Type of y = \",type(y))\n", + "print(\"Value of x = \",x)\n", + "print(\"Value of y = \",y)\n", + "print(\"Multiplication of complex number : \",x*y)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Number : 23\n" + ] + }, + { + "data": { + "text/plain": [ + "int" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x = eval(input(\"Number : \"))\n", + "type(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "11" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "5+6" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "30" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "5*6" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3.3333333333333335" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "10/3" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(10+7.2j)" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "10.0+3j / 2.5+6j" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "27" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "3**3" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "16" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "2**4" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']\n" + ] + } + ], + "source": [ + "x = 5\n", + "print(dir(x))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Strings

    \n", + "

    strings are combinations of characters define inside single quotes or double quotes. eg. 'hello world' or \"123hello\"

    " + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your name : sachin\n" + ] + } + ], + "source": [ + "name = input(\"Enter your name : \")" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'name'" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "\"name\"" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'sachin'" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "name" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "enter something : hi i am something\n" + ] + } + ], + "source": [ + "name = input(prompt='enter something : ' )\n", + "#name = 'hi i am something'" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'hi i am something'" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "name" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], + "source": [ + "type_name = type(name)\n", + "print(type_name)" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "X : 12\n", + "Y : 12\n", + "24\n" + ] + } + ], + "source": [ + "x = input(\"X : \")\n", + "x = int(x)\n", + "y = int(input(\"Y : \"))\n", + "print(x+y)" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [], + "source": [ + "s = \"Hello World\"\n", + "s1 = 'hi how are you '" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\n", + "hi how are you \n", + " \n" + ] + } + ], + "source": [ + "print(s)\n", + "print(s1)\n", + "print(type(s),type(s1))" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello my name is sachin i am going to teach you python. python is awesome language, simple as well aspowerfull enough to hadle all kind of situtations in programming\n" + ] + } + ], + "source": [ + "s = \"Hello \\\n", + "my name is sachin \\\n", + "i am going to teach you python. \\\n", + "python is awesome language, simple as well as\\\n", + "powerfull enough to hadle all kind of situtations in programming\"\n", + "\n", + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello \n", + "my name is sachin \n", + " i am going to teach you python. \n", + "python is awesome language, simple as well as\n", + "powerfull enough to hadle all kind of situtations in programming\n" + ] + }, + { + "data": { + "text/plain": [ + "'Hello \\nmy name is sachin \\n i am going to teach you python. \\npython is awesome language, simple as well as\\npowerfull enough to hadle all kind of situtations in programming'" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = \"\"\"Hello \n", + "my name is sachin \n", + " i am going to teach you python. \n", + "python is awesome language, simple as well as\n", + "powerfull enough to hadle all kind of situtations in programming\"\"\"\n", + "\n", + "print(s)\n", + "s" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello\n", + "hi how are\t you\n", + "\tgood to go\n" + ] + } + ], + "source": [ + "s = \"hello\\nhi how are\\t you\\n\\tgood to go\"\n", + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello\n", + "hi\thow\tare\tyou\n", + "good to go\n" + ] + } + ], + "source": [ + "s = \"Hello\\nhi\\thow\\tare\\tyou\\ngood to go\"\n", + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 1)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m s = \"He said,\"she is Beautiful.\"\"\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" + ] + } + ], + "source": [ + "s = \"He said,\"she is Beautiful.\"\"\n", + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "He said,\"she is Beautiful.\"\n" + ] + } + ], + "source": [ + "s = 'He said,\"she is Beautiful.\"'\n", + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "He said,\"she is Beautiful.\"\n" + ] + } + ], + "source": [ + "# \\ --> escape charcter ( escape sequence )\n", + "#\\n --> new line\n", + "#\\t --> tab space ( by default 8 spaces )\n", + "# encodig used by python is utf-8\n", + "# # --> is used comment lines ( python will not read lines startig with #)\n", + "s = \"He said,\\\"she is Beautiful.\\\"\"\n", + "print(s)\n", + "#Question --> read about all esacape sequences in python\n", + "#eg. \\n, \\t, \\h, \\b, \\a, \\w what is the meaning of all ? \n", + "#reference sites --> python.org, python-course.eu, \n", + "#geeksforgeeks, tutorials point" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "EOL while scanning string literal (, line 3)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m3\u001b[0m\n\u001b[1;33m print(\"Hello World\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m EOL while scanning string literal\n" + ] + } + ], + "source": [ + "# ; --> usually used in every language as statement termination operator\n", + "# python used \\n (new line ) as statement termination\n", + "print(\"Hello World \n", + " #statement already terminated half\n", + " \")\n", + " \n", + "#EOF --> End Of Line --> when statement is not complete" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello world \n" + ] + } + ], + "source": [ + "#\\ is also work as line continutation \n", + "print(\"Hello world \\\n", + " \")\n" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello how are you \n", + " this is good to use back-slash when you want to coninue same line in new line use as we are using here\n" + ] + } + ], + "source": [ + "print(\"Hello how are you \\n this is good to use back-slash \\\n", + "when you want to coninue same line in new line use \\\n", + "as we are using here\")" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Three quotes\n", + " generally used to \n", + " \n", + "declear multi-line strings\n", + " where you can write your\n", + "whole paragraph without worry about\n", + " how you should store it. \n", + " \n" + ] + } + ], + "source": [ + "para = \"\"\"Three quotes\n", + " generally used to \n", + " \n", + "declear multi-line strings\n", + " where you can write your\n", + "whole paragraph without worry about\n", + " how you should store it. \n", + " \"\"\"\n", + "# x = 5 --> initilization\n", + "# name = 'sachin' --> it also known as declaration\n", + "print(para)" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "triple quotes are alose used to give multi-line comments\n" + ] + } + ], + "source": [ + "#here is an example of multiple line comments\n", + "\"\"\" everything is object in python\n", + " object is run time instance of a class\n", + " class is just combination of methonds and attributes\n", + " methods are step by step procedure to slove a problem and also\n", + " known as functions.\n", + " attributes are the operators like + , - which decide behaviour\n", + " \"\"\"\n", + "print(\"triple quotes are alose used to give multi-line comments\")" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']\n" + ] + } + ], + "source": [ + "# dir(obj) --> will all attributes and methods of obj\n", + "s = \"hello world \" # s is an object of string class\n", + "print(dir(s)) # dir(s) will print all function of string class" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']\n" + ] + } + ], + "source": [ + "x = 5 # x is an integer object\n", + "print(dir(x)) # wil print methods and attributes of integer class" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__abs__', '__add__', '__bool__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getformat__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__int__', '__le__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__pos__', '__pow__', '__radd__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rmod__', '__rmul__', '__round__', '__rpow__', '__rsub__', '__rtruediv__', '__setattr__', '__setformat__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', 'as_integer_ratio', 'conjugate', 'fromhex', 'hex', 'imag', 'is_integer', 'real']\n" + ] + } + ], + "source": [ + "print(dir(float)) # will list all attributes and methods of float class" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "11\n" + ] + } + ], + "source": [ + "x = 5\n", + "y = 6\n", + "print(x+y)" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "11\n" + ] + } + ], + "source": [ + "x = 5 ; y = 6 # ; is used terminate statement and we can use it\n", + "#to give multiple statements in a single line\n", + "print(x.__add__(y))" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [], + "source": [ + "s = \"Hello World\" #string is group of char\n", + "#each charcter has it's position and it starts from 0\n", + "#we call index number" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'W'" + ] + }, + "execution_count": 64, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s[6] # indexing --> we are travsing 6 position char" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "l l H o e\n" + ] + } + ], + "source": [ + "print(s[3],s[2],s[0],s[4],s[1])" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']\n" + ] + } + ], + "source": [ + "print(dir(s))" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'HELLO WORLD'" + ] + }, + "execution_count": 69, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# obj.method() --> . is known access specifier and used check whether\n", + "# obj can use method or not\n", + "s.upper()" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'****************************************************************************************************************************************************************************************************************************************************Hello World*****************************************************************************************************************************************************************************************************************************************************'" + ] + }, + "execution_count": 71, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.center(500,\"*\")" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Help on built-in function strip:\n", + "\n", + "strip(...) method of builtins.str instance\n", + " S.strip([chars]) -> str\n", + " \n", + " Return a copy of the string S with leading and trailing\n", + " whitespace removed.\n", + " If chars is given and not None, remove characters in chars instead.\n", + "\n" + ] + } + ], + "source": [ + "help(s.strip)" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "S.strip([chars]) -> str\n", + "\n", + "Return a copy of the string S with leading and trailing\n", + "whitespace removed.\n", + "If chars is given and not None, remove characters in chars instead.\n" + ] + } + ], + "source": [ + "print(s.strip.__doc__)\n", + "#help(obj.method) --> will print help for particular method\n", + "#obj.method.__doc__ --> will print default documentation regarding method\n", + "#__doc__ doc-string (documentation string)\n", + "# __ is also known as dunder\n", + "# __doc__ will also called dunder doc or dunder methods\n", + "# all methods that stars with __ are know as either magic methods\n", + "# of dunder (double underscore) methods" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Help on method raw_input in module ipykernel.kernelbase:\n", + "\n", + "raw_input(prompt='') method of ipykernel.ipkernel.IPythonKernel instance\n", + " Forward raw_input to frontends\n", + " \n", + " Raises\n", + " ------\n", + " StdinNotImplentedError if active frontend doesn't support stdin.\n", + "\n" + ] + } + ], + "source": [ + "help(input)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Length of string s is = 12\n" + ] + } + ], + "source": [ + "s = \"Hello World!\"\n", + "#len(str) --> it will return length of the string str (no of chars in str)\n", + "print(\"Length of string s is = \",len(s))" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "# index --> position of char (item) inside a string (sequence)\n", + "# positive indexing --> it starts from 0 and goes up to len(str) - 1\n", + "# it means first item will at position 0\n", + "# and last will be at position len(str) - 1 (n-1, where n is length of string)\n", + "#negative indexing --> it starts from -1 upto -len(str)\n", + "#it means last item will at position -1 \n", + "# and first will at position -len(str) ( -n , where n is length of string)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "l\n" + ] + } + ], + "source": [ + "s = \"Hello World!\"\n", + "# [] --> is used travese an index number and known as indexing\n", + "\n", + "item = s[3] # we are travesing item at position 3 \n", + "#[n] --> [] indexing and n is index number\n", + "print(item)" + ] + }, + { + "cell_type": "raw", + "metadata": {}, + "source": [ + "#Q. find index number ? \n", + "s = \"Hello World!\"\n", + "x = ? #x is positive index of W i Hello World!\n", + "y = ? #y is negative index of W in Hello World!\n", + "p_item = s[x]\n", + "n_item = s[y]\n", + "\n", + "print(\"W with positive index\",p_item)\n", + "print(\"W with negative index\",n_item)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "W with positive index W\n", + "W with negative index W\n" + ] + } + ], + "source": [ + "#Ans find index number ? \n", + "s = \"Hello World!\"\n", + "x = 6 #x is positive index of W i Hello World!\n", + "y = -6 #y is negative index of W in Hello World!\n", + "p_item = s[x]\n", + "n_item = s[y]\n", + "\n", + "print(\"W with positive index\",p_item)\n", + "print(\"W with negative index\",n_item)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'helloworld'" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "'hello' + 'world' #we can concatenate strings " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    mutable and immutable data types

    \n", + "\n", + "

    mutable --> we can change or modify the structure of data structure or data type like we can add or remove items from data structure.eg list, dictionary, sets

    \n", + "

    immutable --> we can neigther change or nor modify the structure of data type if it is immutable. eg. numbers, strings, tuples

    " + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World!\n", + "l\n" + ] + }, + { + "ename": "TypeError", + "evalue": "'str' object does not support item assignment", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ms\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[0ms\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m'i'\u001b[0m \u001b[1;31m#trying to change s[2] which is l with i\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 7\u001b[0m \u001b[1;31m#error because list is mutable\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mTypeError\u001b[0m: 'str' object does not support item assignment" + ] + } + ], + "source": [ + "#strings are mutable so we can not change them\n", + "s = \"Hello World!\"\n", + "print(s)\n", + "print(s[2])\n", + "\n", + "s[2] = 'i' #trying to change s[2] which is l with i\n", + "#error because list is mutable\n" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ell\n", + "ell\n" + ] + } + ], + "source": [ + "# ell ? \n", + "# () --> paranthesis --> used to call a function like pirnt()\n", + "# [] --> square barkets --> used for traversing or indexing like str[5]\n", + "s = \"Hello World!\"\n", + "#ans = s[?] + s[?] + s[?]\n", + "ans1 = s[1] + s[2] + s[3]\n", + "ans2 = s[-11] + s[-10] + s[-9]\n", + "print(ans1)\n", + "print(ans2)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "llo W\n", + "Hello World!\n" + ] + } + ], + "source": [ + "#Slicing --> used to get a sub-string (part of a string) from a string\n", + "# str[start:end:step] where \n", + "# start --> index from where we will start traversing\n", + "# end --> index where we should end our traversing\n", + "# step --> we will jump steps to travers items from start --> end\n", + "name = \"Hello World!\"\n", + "ans = name[2:7:1]\n", + "#will start from 2 means l\n", + "#will end at 7 means W but as indexing starts from 0 we always go end -1\n", + "#we will end at 6\n", + "#sliced string is --> \"llo \" \n", + "#traverse with step 1 it means travers all inside string\n", + "print(ans)\n", + "print(name)" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "l o\n", + "Hello World!\n" + ] + } + ], + "source": [ + "s = \"Hello World!\"\n", + "ans = name[3:9:2]\n", + "print(ans)\n", + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "eoo\n", + "Hello World!\n" + ] + } + ], + "source": [ + "s = \"Hello World!\"\n", + "ans = s[1:10:3]\n", + "print(ans)\n", + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Hello World!\n" + ] + } + ], + "source": [ + "s = \"Hello World!\"\n", + "ans = s[10:1:2]\n", + "print(ans)\n", + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "drWol\n", + "Hello World!\n" + ] + } + ], + "source": [ + "s = \"Hello World!\"\n", + "ans = s[10:1:-2]\n", + "print(ans)\n", + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World!\n", + "\n" + ] + } + ], + "source": [ + "s = \"Hello World!\"\n", + "ans = s[0:len(s):-1]\n", + "print(s)\n", + "print(ans)" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "12\n", + "Hello World!\n", + "!dlroW olle\n" + ] + } + ], + "source": [ + "s = \"Hello World!\"\n", + "print(len(s))\n", + "ans = s[len(s):0:-1]\n", + "print(s)\n", + "print(ans)" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "!dlroW oll\n" + ] + } + ], + "source": [ + "print(s[15:1:-1])" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'l ol'" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s[3:11:2]" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'doo'" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s[10:2:-3]" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World!\n", + "Hello World!\n", + "Hello Worl\n", + "l r!\n", + "!dlroW olleH\n" + ] + } + ], + "source": [ + "s = \"Hello World!\" # by default step = 1\n", + "j = s[:] #Hello World!\n", + "print(j)\n", + "k = s[::] #Hello World!\n", + "print(k)\n", + "l = s[:10] #Hello Worl\n", + "print(l)\n", + "m = s[2::3] #l r!\n", + "print(m)\n", + "n = s[::-1] #!dlroW olleH\n", + "print(n)" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\n" + ] + } + ], + "source": [ + "s = \"Hello World!\"\n", + "print(s[:-1])" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "llo Worl\n" + ] + } + ], + "source": [ + "s = \"Hello World!\"\n", + "name = s[-10:-2]\n", + "print(name)" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [], + "source": [ + "s = \"Hello World!\"\n", + "name = s[-6:5:2]" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Wr\n" + ] + } + ], + "source": [ + "s = \"Hello World!\"\n", + "name = s[-6:10:2]\n", + "print(name)" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']\n" + ] + } + ], + "source": [ + "print(dir(str))" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Help on built-in function capitalize:\n", + "\n", + "capitalize(...) method of builtins.str instance\n", + " S.capitalize() -> str\n", + " \n", + " Return a capitalized version of S, i.e. make the first character\n", + " have upper case and the rest lower case.\n", + "\n", + "None\n" + ] + } + ], + "source": [ + "s = \"hello world!\"\n", + "print(help(s.capitalize))" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "S.capitalize() -> str\n", + "\n", + "Return a capitalized version of S, i.e. make the first character\n", + "have upper case and the rest lower case.\n" + ] + } + ], + "source": [ + "print(s.capitalize.__doc__) #doc-string" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello WorLD!\n", + "Hello world!\n" + ] + } + ], + "source": [ + "s = \"hello WorLD!\"\n", + "k = s.capitalize()\n", + "print(s)\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "S.center(width[, fillchar]) -> str\n", + "\n", + "Return S centered in a string of length width. Padding is\n", + "done using the specified fill character (default is a space)\n", + "MY name is KHAN\n", + " MY name is KHAN \n", + "#################MY name is KHAN##################\n" + ] + } + ], + "source": [ + "s = \"MY name is KHAN\"\n", + "print(s.center.__doc__)\n", + "k = s.center(50)\n", + "l = s.center(50,'#')\n", + "print(s)\n", + "print(k)\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "S.split(sep=None, maxsplit=-1) -> list of strings\n", + "\n", + "Return a list of the words in S, using sep as the\n", + "delimiter string. If maxsplit is given, at most maxsplit\n", + "splits are done. If sep is not specified or is None, any\n", + "whitespace string is a separator and empty strings are\n", + "removed from the result.\n", + "Hello World how are you ? what's going on let's discover split.\n", + "['Hello', 'World', 'how', 'are', 'you', '?', \"what's\", 'going', 'on', \"let's\", 'discover', 'split.']\n" + ] + } + ], + "source": [ + "s = \"Hello World how are you ? what's going on let's discover split.\"\n", + "print(s.split.__doc__)\n", + "l = s.split()\n", + "print(s)\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Hello my name is khan', ' i am not a terrist', ' do you understand']\n" + ] + } + ], + "source": [ + "s = \"Hello my name is khan, i am not a terrist, do you understand\"\n", + "k = s.split(',')\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\"\\nhello world. how are you ?\\nthis is strings in python.\\ni am learning strings as well it's function.\\n\"\n" + ] + } + ], + "source": [ + "s = \"\"\"\n", + "hello world. how are you ?\n", + "this is strings in python.\n", + "i am learning strings as well it's function.\n", + "\"\"\"\n", + "print(repr(s))" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['', 'hello world. how are you ?', 'this is strings in python.', \"i am learning strings as well it's function.\", '']\n" + ] + } + ], + "source": [ + "k = s.split('\\n')\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\"\\t\\t\\n\\nhello world. how are you ?\\t\\t\\n\\nthis is strings in python.\\t\\t\\n\\ni am learning strings as well it's function.\\t\\t\\n\\n\"\n" + ] + } + ], + "source": [ + "join = '\\t\\t\\n\\n'.join(k)\n", + "print(repr(join))" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\t\t\n", + "\n", + "hello world. how are you ?\t\t\n", + "\n", + "this is strings in python.\t\t\n", + "\n", + "i am learning strings as well it's function.\t\t\n", + "\n", + "\n" + ] + } + ], + "source": [ + "print(join)" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Hello', 'World', 'how', 'are', 'you', '?']\n" + ] + } + ], + "source": [ + "s = \"Hello World how are you ? \"\n", + "k = s.split()\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello-^-.^-World-^-.^-how-^-.^-are-^-.^-you-^-.^-?\n" + ] + } + ], + "source": [ + "new_string = '-^-.^-'.join(k)\n", + "print(new_string)" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Dog is not like cat, and cat is not like Dog.\n", + "CAT is not like cat, and cat is not like CAT.\n" + ] + } + ], + "source": [ + "s = \"Dog is not like cat, and cat is not like Dog.\"\n", + "k = s.replace('Dog','CAT')\n", + "print(s)\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']\n" + ] + } + ], + "source": [ + "print(dir(s))" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "S.strip([chars]) -> str\n", + "\n", + "Return a copy of the string S with leading and trailing\n", + "whitespace removed.\n", + "If chars is given and not None, remove characters in chars instead.\n", + "' Hello World'\n", + "'Hello World'\n", + "'Hello World '\n", + "'Hello World'\n", + "' Hello World '\n", + "'Hello World'\n" + ] + } + ], + "source": [ + "#strip --> will remove all whitespace from begninig and end \n", + "#of the string\n", + "print(str.strip.__doc__)\n", + "lead_s = \" Hello World\" #leading spaces white spaces\n", + "trail_s = \"Hello World \" #trailing spaces white spaces\n", + "lead_trail = \" Hello World \" #leading and trailing white spaces\n", + "print(repr(lead_s))\n", + "print(repr(lead_s.strip()))\n", + "print(repr(trail_s))\n", + "print(repr(trail_s.strip()))\n", + "print(repr(lead_trail))\n", + "print(repr(lead_trail.strip()))" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your name : sachin yadav \n", + "' sachin yadav '\n", + "'sachin yadav'\n" + ] + } + ], + "source": [ + "name = input(\"Enter your name : \")\n", + "name1 = name.strip()\n", + "print(repr(name))\n", + "print(repr(name1))" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your name : sachin yadav \n", + "Welcome back user, sachin yadav\n" + ] + } + ], + "source": [ + "name = input(\"Enter your name : \").strip()\n", + "print(\"Welcome back user,\",name)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "oooooHello Worldooooo\n", + "Hello World\n" + ] + } + ], + "source": [ + "s = \"oooooHello Worldooooo\"\n", + "k = s.strip('o')\n", + "print(s)\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Original String : HeLlO WoRLd\n", + "Lower case string : hello world\n", + "Upper case String : HELLO WORLD\n", + "Swap Case String : hElLo wOrlD\n", + "Capitalize String : Hello world\n", + "Title Case String : Hello World\n", + "Casefold string : hello world\n" + ] + } + ], + "source": [ + "s = \"HeLlO WoRLd\"\n", + "print(\"Original String : \",s)\n", + "print(\"Lower case string :\",s.lower())\n", + "print(\"Upper case String : \",s.upper())\n", + "print(\"Swap Case String : \",s.swapcase())\n", + "print(\"Capitalize String : \",s.capitalize())\n", + "print(\"Title Case String :\",s.title())\n", + "print(\"Casefold string : \",s.casefold())\n" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 1)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m 1s = 'something'\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" + ] + } + ], + "source": [ + "1s = 'something'" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 1)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m name hello\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" + ] + } + ], + "source": [ + "name hello" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello Worldbye world\n" + ] + } + ], + "source": [ + "print(\"Hello World\" \"bye world\")" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\n" + ] + } + ], + "source": [ + " print(\"Hello World\")" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello mr. sachin\n" + ] + } + ], + "source": [ + "name = 'sachin'\n", + "print(\"Hello mr.\",name)" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 1)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m x = 5 y = 8\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" + ] + } + ], + "source": [ + "x = 5 y = 8" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [], + "source": [ + "x = 5 ; y = 8 #delimeter" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 1)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m x y = 6 7\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" + ] + } + ], + "source": [ + "x y = 6 7" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "x,y = 6,7" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'sachin' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"hello world\"\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0msachin\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mNameError\u001b[0m: name 'sachin' is not defined" + ] + } + ], + "source": [ + "print(\"hello world\",sachin)" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter an identifier : hello bye\n" + ] + }, + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 44, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "name = input(\"Enter an identifier : \")\n", + "name.isidentifier()" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a number : 123abc\n" + ] + }, + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "d = input(\"Enter a number : \")\n", + "d.isdigit()" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "enter alphanumeric string : hello@bye\n" + ] + }, + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 46, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "d = input(\"enter alphanumeric string : \")\n", + "d.isalnum()" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter anything : hello123\n" + ] + }, + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 50, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "d = input(\"Enter anything : \")\n", + "d.isalpha()" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']\n" + ] + } + ], + "source": [ + "print(dir(str))" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " \n" + ] + }, + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 67, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = input()\n", + "s.isspace()" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter number : ¼\n", + "Decimal = False\n", + "Digit = False\n", + "Numeric = True\n" + ] + } + ], + "source": [ + "s = input(\"Enter number : \")\n", + "print(\"Decimal = \",s.isdecimal())\n", + "print(\"Digit = \",s.isdigit())\n", + "print(\"Numeric = \",s.isnumeric())" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": {}, + "outputs": [], + "source": [ + "p = [ chr(var) for var in range(10000)]\n" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['\\x00', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\x07', '\\x08', '\\t', '\\n', '\\x0b', '\\x0c', '\\r', '\\x0e', '\\x0f', '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', '\\x18', '\\x19', '\\x1a', '\\x1b', '\\x1c', '\\x1d', '\\x1e', '\\x1f', ' ', '!', '\"', '#', '$', '%', '&', \"'\", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', '\\x7f', '\\x80', '\\x81', '\\x82', '\\x83', '\\x84', '\\x85', '\\x86', '\\x87', '\\x88', '\\x89', '\\x8a', '\\x8b', '\\x8c', '\\x8d', '\\x8e', '\\x8f', '\\x90', '\\x91', '\\x92', '\\x93', '\\x94', '\\x95', '\\x96', '\\x97', '\\x98', '\\x99', '\\x9a', '\\x9b', '\\x9c', '\\x9d', '\\x9e', '\\x9f', '\\xa0', '¡', '¢', '£', '¤', '¥', '¦', '§', '¨', '©', 'ª', '«', '¬', '\\xad', '®', '¯', '°', '±', '²', '³', '´', 'µ', '¶', '·', '¸', '¹', 'º', '»', '¼', '½', '¾', '¿', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'ĸ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ŋ', 'ŋ', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Œ', 'œ', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ŷ', 'ŷ', 'Ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'ſ', 'ƀ', 'Ɓ', 'Ƃ', 'ƃ', 'Ƅ', 'ƅ', 'Ɔ', 'Ƈ', 'ƈ', 'Ɖ', 'Ɗ', 'Ƌ', 'ƌ', 'ƍ', 'Ǝ', 'Ə', 'Ɛ', 'Ƒ', 'ƒ', 'Ɠ', 'Ɣ', 'ƕ', 'Ɩ', 'Ɨ', 'Ƙ', 'ƙ', 'ƚ', 'ƛ', 'Ɯ', 'Ɲ', 'ƞ', 'Ɵ', 'Ơ', 'ơ', 'Ƣ', 'ƣ', 'Ƥ', 'ƥ', 'Ʀ', 'Ƨ', 'ƨ', 'Ʃ', 'ƪ', 'ƫ', 'Ƭ', 'ƭ', 'Ʈ', 'Ư', 'ư', 'Ʊ', 'Ʋ', 'Ƴ', 'ƴ', 'Ƶ', 'ƶ', 'Ʒ', 'Ƹ', 'ƹ', 'ƺ', 'ƻ', 'Ƽ', 'ƽ', 'ƾ', 'ƿ', 'ǀ', 'ǁ', 'ǂ', 'ǃ', 'DŽ', 'Dž', 'dž', 'LJ', 'Lj', 'lj', 'NJ', 'Nj', 'nj', 'Ǎ', 'ǎ', 'Ǐ', 'ǐ', 'Ǒ', 'ǒ', 'Ǔ', 'ǔ', 'Ǖ', 'ǖ', 'Ǘ', 'ǘ', 'Ǚ', 'ǚ', 'Ǜ', 'ǜ', 'ǝ', 'Ǟ', 'ǟ', 'Ǡ', 'ǡ', 'Ǣ', 'ǣ', 'Ǥ', 'ǥ', 'Ǧ', 'ǧ', 'Ǩ', 'ǩ', 'Ǫ', 'ǫ', 'Ǭ', 'ǭ', 'Ǯ', 'ǯ', 'ǰ', 'DZ', 'Dz', 'dz', 'Ǵ', 'ǵ', 'Ƕ', 'Ƿ', 'Ǹ', 'ǹ', 'Ǻ', 'ǻ', 'Ǽ', 'ǽ', 'Ǿ', 'ǿ', 'Ȁ', 'ȁ', 'Ȃ', 'ȃ', 'Ȅ', 'ȅ', 'Ȇ', 'ȇ', 'Ȉ', 'ȉ', 'Ȋ', 'ȋ', 'Ȍ', 'ȍ', 'Ȏ', 'ȏ', 'Ȑ', 'ȑ', 'Ȓ', 'ȓ', 'Ȕ', 'ȕ', 'Ȗ', 'ȗ', 'Ș', 'ș', 'Ț', 'ț', 'Ȝ', 'ȝ', 'Ȟ', 'ȟ', 'Ƞ', 'ȡ', 'Ȣ', 'ȣ', 'Ȥ', 'ȥ', 'Ȧ', 'ȧ', 'Ȩ', 'ȩ', 'Ȫ', 'ȫ', 'Ȭ', 'ȭ', 'Ȯ', 'ȯ', 'Ȱ', 'ȱ', 'Ȳ', 'ȳ', 'ȴ', 'ȵ', 'ȶ', 'ȷ', 'ȸ', 'ȹ', 'Ⱥ', 'Ȼ', 'ȼ', 'Ƚ', 'Ⱦ', 'ȿ', 'ɀ', 'Ɂ', 'ɂ', 'Ƀ', 'Ʉ', 'Ʌ', 'Ɇ', 'ɇ', 'Ɉ', 'ɉ', 'Ɋ', 'ɋ', 'Ɍ', 'ɍ', 'Ɏ', 'ɏ', 'ɐ', 'ɑ', 'ɒ', 'ɓ', 'ɔ', 'ɕ', 'ɖ', 'ɗ', 'ɘ', 'ə', 'ɚ', 'ɛ', 'ɜ', 'ɝ', 'ɞ', 'ɟ', 'ɠ', 'ɡ', 'ɢ', 'ɣ', 'ɤ', 'ɥ', 'ɦ', 'ɧ', 'ɨ', 'ɩ', 'ɪ', 'ɫ', 'ɬ', 'ɭ', 'ɮ', 'ɯ', 'ɰ', 'ɱ', 'ɲ', 'ɳ', 'ɴ', 'ɵ', 'ɶ', 'ɷ', 'ɸ', 'ɹ', 'ɺ', 'ɻ', 'ɼ', 'ɽ', 'ɾ', 'ɿ', 'ʀ', 'ʁ', 'ʂ', 'ʃ', 'ʄ', 'ʅ', 'ʆ', 'ʇ', 'ʈ', 'ʉ', 'ʊ', 'ʋ', 'ʌ', 'ʍ', 'ʎ', 'ʏ', 'ʐ', 'ʑ', 'ʒ', 'ʓ', 'ʔ', 'ʕ', 'ʖ', 'ʗ', 'ʘ', 'ʙ', 'ʚ', 'ʛ', 'ʜ', 'ʝ', 'ʞ', 'ʟ', 'ʠ', 'ʡ', 'ʢ', 'ʣ', 'ʤ', 'ʥ', 'ʦ', 'ʧ', 'ʨ', 'ʩ', 'ʪ', 'ʫ', 'ʬ', 'ʭ', 'ʮ', 'ʯ', 'ʰ', 'ʱ', 'ʲ', 'ʳ', 'ʴ', 'ʵ', 'ʶ', 'ʷ', 'ʸ', 'ʹ', 'ʺ', 'ʻ', 'ʼ', 'ʽ', 'ʾ', 'ʿ', 'ˀ', 'ˁ', '˂', '˃', '˄', '˅', 'ˆ', 'ˇ', 'ˈ', 'ˉ', 'ˊ', 'ˋ', 'ˌ', 'ˍ', 'ˎ', 'ˏ', 'ː', 'ˑ', '˒', '˓', '˔', '˕', '˖', '˗', '˘', '˙', '˚', '˛', '˜', '˝', '˞', '˟', 'ˠ', 'ˡ', 'ˢ', 'ˣ', 'ˤ', '˥', '˦', '˧', '˨', '˩', '˪', '˫', 'ˬ', '˭', 'ˮ', '˯', '˰', '˱', '˲', '˳', '˴', '˵', '˶', '˷', '˸', '˹', '˺', '˻', '˼', '˽', '˾', '˿', '̀', '́', '̂', '̃', '̄', '̅', '̆', '̇', '̈', '̉', '̊', '̋', '̌', '̍', '̎', '̏', '̐', '̑', '̒', '̓', '̔', '̕', '̖', '̗', '̘', '̙', '̚', '̛', '̜', '̝', '̞', '̟', '̠', '̡', '̢', '̣', '̤', '̥', '̦', '̧', '̨', '̩', '̪', '̫', '̬', '̭', '̮', '̯', '̰', '̱', '̲', '̳', '̴', '̵', '̶', '̷', '̸', '̹', '̺', '̻', '̼', '̽', '̾', '̿', '̀', '́', '͂', '̓', '̈́', 'ͅ', '͆', '͇', '͈', '͉', '͊', '͋', '͌', '͍', '͎', '͏', '͐', '͑', '͒', '͓', '͔', '͕', '͖', '͗', '͘', '͙', '͚', '͛', '͜', '͝', '͞', '͟', '͠', '͡', '͢', 'ͣ', 'ͤ', 'ͥ', 'ͦ', 'ͧ', 'ͨ', 'ͩ', 'ͪ', 'ͫ', 'ͬ', 'ͭ', 'ͮ', 'ͯ', 'Ͱ', 'ͱ', 'Ͳ', 'ͳ', 'ʹ', '͵', 'Ͷ', 'ͷ', '\\u0378', '\\u0379', 'ͺ', 'ͻ', 'ͼ', 'ͽ', ';', 'Ϳ', '\\u0380', '\\u0381', '\\u0382', '\\u0383', '΄', '΅', 'Ά', '·', 'Έ', 'Ή', 'Ί', '\\u038b', 'Ό', '\\u038d', 'Ύ', 'Ώ', 'ΐ', 'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', 'Ρ', '\\u03a2', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω', 'Ϊ', 'Ϋ', 'ά', 'έ', 'ή', 'ί', 'ΰ', 'α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ', 'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'ς', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω', 'ϊ', 'ϋ', 'ό', 'ύ', 'ώ', 'Ϗ', 'ϐ', 'ϑ', 'ϒ', 'ϓ', 'ϔ', 'ϕ', 'ϖ', 'ϗ', 'Ϙ', 'ϙ', 'Ϛ', 'ϛ', 'Ϝ', 'ϝ', 'Ϟ', 'ϟ', 'Ϡ', 'ϡ', 'Ϣ', 'ϣ', 'Ϥ', 'ϥ', 'Ϧ', 'ϧ', 'Ϩ', 'ϩ', 'Ϫ', 'ϫ', 'Ϭ', 'ϭ', 'Ϯ', 'ϯ', 'ϰ', 'ϱ', 'ϲ', 'ϳ', 'ϴ', 'ϵ', '϶', 'Ϸ', 'ϸ', 'Ϲ', 'Ϻ', 'ϻ', 'ϼ', 'Ͻ', 'Ͼ', 'Ͽ', 'Ѐ', 'Ё', 'Ђ', 'Ѓ', 'Є', 'Ѕ', 'І', 'Ї', 'Ј', 'Љ', 'Њ', 'Ћ', 'Ќ', 'Ѝ', 'Ў', 'Џ', 'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я', 'а', 'б', 'в', 'г', 'д', 'е', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь', 'э', 'ю', 'я', 'ѐ', 'ё', 'ђ', 'ѓ', 'є', 'ѕ', 'і', 'ї', 'ј', 'љ', 'њ', 'ћ', 'ќ', 'ѝ', 'ў', 'џ', 'Ѡ', 'ѡ', 'Ѣ', 'ѣ', 'Ѥ', 'ѥ', 'Ѧ', 'ѧ', 'Ѩ', 'ѩ', 'Ѫ', 'ѫ', 'Ѭ', 'ѭ', 'Ѯ', 'ѯ', 'Ѱ', 'ѱ', 'Ѳ', 'ѳ', 'Ѵ', 'ѵ', 'Ѷ', 'ѷ', 'Ѹ', 'ѹ', 'Ѻ', 'ѻ', 'Ѽ', 'ѽ', 'Ѿ', 'ѿ', 'Ҁ', 'ҁ', '҂', '҃', '҄', '҅', '҆', '҇', '҈', '҉', 'Ҋ', 'ҋ', 'Ҍ', 'ҍ', 'Ҏ', 'ҏ', 'Ґ', 'ґ', 'Ғ', 'ғ', 'Ҕ', 'ҕ', 'Җ', 'җ', 'Ҙ', 'ҙ', 'Қ', 'қ', 'Ҝ', 'ҝ', 'Ҟ', 'ҟ', 'Ҡ', 'ҡ', 'Ң', 'ң', 'Ҥ', 'ҥ', 'Ҧ', 'ҧ', 'Ҩ', 'ҩ', 'Ҫ', 'ҫ', 'Ҭ', 'ҭ', 'Ү', 'ү', 'Ұ', 'ұ', 'Ҳ', 'ҳ', 'Ҵ', 'ҵ', 'Ҷ', 'ҷ', 'Ҹ', 'ҹ', 'Һ', 'һ', 'Ҽ', 'ҽ', 'Ҿ', 'ҿ', 'Ӏ', 'Ӂ', 'ӂ', 'Ӄ', 'ӄ', 'Ӆ', 'ӆ', 'Ӈ', 'ӈ', 'Ӊ', 'ӊ', 'Ӌ', 'ӌ', 'Ӎ', 'ӎ', 'ӏ', 'Ӑ', 'ӑ', 'Ӓ', 'ӓ', 'Ӕ', 'ӕ', 'Ӗ', 'ӗ', 'Ә', 'ә', 'Ӛ', 'ӛ', 'Ӝ', 'ӝ', 'Ӟ', 'ӟ', 'Ӡ', 'ӡ', 'Ӣ', 'ӣ', 'Ӥ', 'ӥ', 'Ӧ', 'ӧ', 'Ө', 'ө', 'Ӫ', 'ӫ', 'Ӭ', 'ӭ', 'Ӯ', 'ӯ', 'Ӱ', 'ӱ', 'Ӳ', 'ӳ', 'Ӵ', 'ӵ', 'Ӷ', 'ӷ', 'Ӹ', 'ӹ', 'Ӻ', 'ӻ', 'Ӽ', 'ӽ', 'Ӿ', 'ӿ', 'Ԁ', 'ԁ', 'Ԃ', 'ԃ', 'Ԅ', 'ԅ', 'Ԇ', 'ԇ', 'Ԉ', 'ԉ', 'Ԋ', 'ԋ', 'Ԍ', 'ԍ', 'Ԏ', 'ԏ', 'Ԑ', 'ԑ', 'Ԓ', 'ԓ', 'Ԕ', 'ԕ', 'Ԗ', 'ԗ', 'Ԙ', 'ԙ', 'Ԛ', 'ԛ', 'Ԝ', 'ԝ', 'Ԟ', 'ԟ', 'Ԡ', 'ԡ', 'Ԣ', 'ԣ', 'Ԥ', 'ԥ', 'Ԧ', 'ԧ', 'Ԩ', 'ԩ', 'Ԫ', 'ԫ', 'Ԭ', 'ԭ', 'Ԯ', 'ԯ', '\\u0530', 'Ա', 'Բ', 'Գ', 'Դ', 'Ե', 'Զ', 'Է', 'Ը', 'Թ', 'Ժ', 'Ի', 'Լ', 'Խ', 'Ծ', 'Կ', 'Հ', 'Ձ', 'Ղ', 'Ճ', 'Մ', 'Յ', 'Ն', 'Շ', 'Ո', 'Չ', 'Պ', 'Ջ', 'Ռ', 'Ս', 'Վ', 'Տ', 'Ր', 'Ց', 'Ւ', 'Փ', 'Ք', 'Օ', 'Ֆ', '\\u0557', '\\u0558', 'ՙ', '՚', '՛', '՜', '՝', '՞', '՟', '\\u0560', 'ա', 'բ', 'գ', 'դ', 'ե', 'զ', 'է', 'ը', 'թ', 'ժ', 'ի', 'լ', 'խ', 'ծ', 'կ', 'հ', 'ձ', 'ղ', 'ճ', 'մ', 'յ', 'ն', 'շ', 'ո', 'չ', 'պ', 'ջ', 'ռ', 'ս', 'վ', 'տ', 'ր', 'ց', 'ւ', 'փ', 'ք', 'օ', 'ֆ', 'և', '\\u0588', '։', '֊', '\\u058b', '\\u058c', '֍', '֎', '֏', '\\u0590', '֑', '֒', '֓', '֔', '֕', '֖', '֗', '֘', '֙', '֚', '֛', '֜', '֝', '֞', '֟', '֠', '֡', '֢', '֣', '֤', '֥', '֦', '֧', '֨', '֩', '֪', '֫', '֬', '֭', '֮', '֯', 'ְ', 'ֱ', 'ֲ', 'ֳ', 'ִ', 'ֵ', 'ֶ', 'ַ', 'ָ', 'ֹ', 'ֺ', 'ֻ', 'ּ', 'ֽ', '־', 'ֿ', '׀', 'ׁ', 'ׂ', '׃', 'ׄ', 'ׅ', '׆', 'ׇ', '\\u05c8', '\\u05c9', '\\u05ca', '\\u05cb', '\\u05cc', '\\u05cd', '\\u05ce', '\\u05cf', 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט', 'י', 'ך', 'כ', 'ל', 'ם', 'מ', 'ן', 'נ', 'ס', 'ע', 'ף', 'פ', 'ץ', 'צ', 'ק', 'ר', 'ש', 'ת', '\\u05eb', '\\u05ec', '\\u05ed', '\\u05ee', '\\u05ef', 'װ', 'ױ', 'ײ', '׳', '״', '\\u05f5', '\\u05f6', '\\u05f7', '\\u05f8', '\\u05f9', '\\u05fa', '\\u05fb', '\\u05fc', '\\u05fd', '\\u05fe', '\\u05ff', '\\u0600', '\\u0601', '\\u0602', '\\u0603', '\\u0604', '\\u0605', '؆', '؇', '؈', '؉', '؊', '؋', '،', '؍', '؎', '؏', 'ؐ', 'ؑ', 'ؒ', 'ؓ', 'ؔ', 'ؕ', 'ؖ', 'ؗ', 'ؘ', 'ؙ', 'ؚ', '؛', '\\u061c', '\\u061d', '؞', '؟', 'ؠ', 'ء', 'آ', 'أ', 'ؤ', 'إ', 'ئ', 'ا', 'ب', 'ة', 'ت', 'ث', 'ج', 'ح', 'خ', 'د', 'ذ', 'ر', 'ز', 'س', 'ش', 'ص', 'ض', 'ط', 'ظ', 'ع', 'غ', 'ػ', 'ؼ', 'ؽ', 'ؾ', 'ؿ', 'ـ', 'ف', 'ق', 'ك', 'ل', 'م', 'ن', 'ه', 'و', 'ى', 'ي', 'ً', 'ٌ', 'ٍ', 'َ', 'ُ', 'ِ', 'ّ', 'ْ', 'ٓ', 'ٔ', 'ٕ', 'ٖ', 'ٗ', '٘', 'ٙ', 'ٚ', 'ٛ', 'ٜ', 'ٝ', 'ٞ', 'ٟ', '٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩', '٪', '٫', '٬', '٭', 'ٮ', 'ٯ', 'ٰ', 'ٱ', 'ٲ', 'ٳ', 'ٴ', 'ٵ', 'ٶ', 'ٷ', 'ٸ', 'ٹ', 'ٺ', 'ٻ', 'ټ', 'ٽ', 'پ', 'ٿ', 'ڀ', 'ځ', 'ڂ', 'ڃ', 'ڄ', 'څ', 'چ', 'ڇ', 'ڈ', 'ډ', 'ڊ', 'ڋ', 'ڌ', 'ڍ', 'ڎ', 'ڏ', 'ڐ', 'ڑ', 'ڒ', 'ړ', 'ڔ', 'ڕ', 'ږ', 'ڗ', 'ژ', 'ڙ', 'ښ', 'ڛ', 'ڜ', 'ڝ', 'ڞ', 'ڟ', 'ڠ', 'ڡ', 'ڢ', 'ڣ', 'ڤ', 'ڥ', 'ڦ', 'ڧ', 'ڨ', 'ک', 'ڪ', 'ګ', 'ڬ', 'ڭ', 'ڮ', 'گ', 'ڰ', 'ڱ', 'ڲ', 'ڳ', 'ڴ', 'ڵ', 'ڶ', 'ڷ', 'ڸ', 'ڹ', 'ں', 'ڻ', 'ڼ', 'ڽ', 'ھ', 'ڿ', 'ۀ', 'ہ', 'ۂ', 'ۃ', 'ۄ', 'ۅ', 'ۆ', 'ۇ', 'ۈ', 'ۉ', 'ۊ', 'ۋ', 'ی', 'ۍ', 'ێ', 'ۏ', 'ې', 'ۑ', 'ے', 'ۓ', '۔', 'ە', 'ۖ', 'ۗ', 'ۘ', 'ۙ', 'ۚ', 'ۛ', 'ۜ', '\\u06dd', '۞', '۟', '۠', 'ۡ', 'ۢ', 'ۣ', 'ۤ', 'ۥ', 'ۦ', 'ۧ', 'ۨ', '۩', '۪', '۫', '۬', 'ۭ', 'ۮ', 'ۯ', '۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹', 'ۺ', 'ۻ', 'ۼ', '۽', '۾', 'ۿ', '܀', '܁', '܂', '܃', '܄', '܅', '܆', '܇', '܈', '܉', '܊', '܋', '܌', '܍', '\\u070e', '\\u070f', 'ܐ', 'ܑ', 'ܒ', 'ܓ', 'ܔ', 'ܕ', 'ܖ', 'ܗ', 'ܘ', 'ܙ', 'ܚ', 'ܛ', 'ܜ', 'ܝ', 'ܞ', 'ܟ', 'ܠ', 'ܡ', 'ܢ', 'ܣ', 'ܤ', 'ܥ', 'ܦ', 'ܧ', 'ܨ', 'ܩ', 'ܪ', 'ܫ', 'ܬ', 'ܭ', 'ܮ', 'ܯ', 'ܰ', 'ܱ', 'ܲ', 'ܳ', 'ܴ', 'ܵ', 'ܶ', 'ܷ', 'ܸ', 'ܹ', 'ܺ', 'ܻ', 'ܼ', 'ܽ', 'ܾ', 'ܿ', '݀', '݁', '݂', '݃', '݄', '݅', '݆', '݇', '݈', '݉', '݊', '\\u074b', '\\u074c', 'ݍ', 'ݎ', 'ݏ', 'ݐ', 'ݑ', 'ݒ', 'ݓ', 'ݔ', 'ݕ', 'ݖ', 'ݗ', 'ݘ', 'ݙ', 'ݚ', 'ݛ', 'ݜ', 'ݝ', 'ݞ', 'ݟ', 'ݠ', 'ݡ', 'ݢ', 'ݣ', 'ݤ', 'ݥ', 'ݦ', 'ݧ', 'ݨ', 'ݩ', 'ݪ', 'ݫ', 'ݬ', 'ݭ', 'ݮ', 'ݯ', 'ݰ', 'ݱ', 'ݲ', 'ݳ', 'ݴ', 'ݵ', 'ݶ', 'ݷ', 'ݸ', 'ݹ', 'ݺ', 'ݻ', 'ݼ', 'ݽ', 'ݾ', 'ݿ', 'ހ', 'ށ', 'ނ', 'ރ', 'ބ', 'ޅ', 'ކ', 'އ', 'ވ', 'މ', 'ފ', 'ދ', 'ތ', 'ލ', 'ގ', 'ޏ', 'ސ', 'ޑ', 'ޒ', 'ޓ', 'ޔ', 'ޕ', 'ޖ', 'ޗ', 'ޘ', 'ޙ', 'ޚ', 'ޛ', 'ޜ', 'ޝ', 'ޞ', 'ޟ', 'ޠ', 'ޡ', 'ޢ', 'ޣ', 'ޤ', 'ޥ', 'ަ', 'ާ', 'ި', 'ީ', 'ު', 'ޫ', 'ެ', 'ޭ', 'ޮ', 'ޯ', 'ް', 'ޱ', '\\u07b2', '\\u07b3', '\\u07b4', '\\u07b5', '\\u07b6', '\\u07b7', '\\u07b8', '\\u07b9', '\\u07ba', '\\u07bb', '\\u07bc', '\\u07bd', '\\u07be', '\\u07bf', '߀', '߁', '߂', '߃', '߄', '߅', '߆', '߇', '߈', '߉', 'ߊ', 'ߋ', 'ߌ', 'ߍ', 'ߎ', 'ߏ', 'ߐ', 'ߑ', 'ߒ', 'ߓ', 'ߔ', 'ߕ', 'ߖ', 'ߗ', 'ߘ', 'ߙ', 'ߚ', 'ߛ', 'ߜ', 'ߝ', 'ߞ', 'ߟ', 'ߠ', 'ߡ', 'ߢ', 'ߣ', 'ߤ', 'ߥ', 'ߦ', 'ߧ', 'ߨ', 'ߩ', 'ߪ', '߫', '߬', '߭', '߮', '߯', '߰', '߱', '߲', '߳', 'ߴ', 'ߵ', '߶', '߷', '߸', '߹', 'ߺ', '\\u07fb', '\\u07fc', '\\u07fd', '\\u07fe', '\\u07ff', 'ࠀ', 'ࠁ', 'ࠂ', 'ࠃ', 'ࠄ', 'ࠅ', 'ࠆ', 'ࠇ', 'ࠈ', 'ࠉ', 'ࠊ', 'ࠋ', 'ࠌ', 'ࠍ', 'ࠎ', 'ࠏ', 'ࠐ', 'ࠑ', 'ࠒ', 'ࠓ', 'ࠔ', 'ࠕ', 'ࠖ', 'ࠗ', '࠘', '࠙', 'ࠚ', 'ࠛ', 'ࠜ', 'ࠝ', 'ࠞ', 'ࠟ', 'ࠠ', 'ࠡ', 'ࠢ', 'ࠣ', 'ࠤ', 'ࠥ', 'ࠦ', 'ࠧ', 'ࠨ', 'ࠩ', 'ࠪ', 'ࠫ', 'ࠬ', '࠭', '\\u082e', '\\u082f', '࠰', '࠱', '࠲', '࠳', '࠴', '࠵', '࠶', '࠷', '࠸', '࠹', '࠺', '࠻', '࠼', '࠽', '࠾', '\\u083f', 'ࡀ', 'ࡁ', 'ࡂ', 'ࡃ', 'ࡄ', 'ࡅ', 'ࡆ', 'ࡇ', 'ࡈ', 'ࡉ', 'ࡊ', 'ࡋ', 'ࡌ', 'ࡍ', 'ࡎ', 'ࡏ', 'ࡐ', 'ࡑ', 'ࡒ', 'ࡓ', 'ࡔ', 'ࡕ', 'ࡖ', 'ࡗ', 'ࡘ', '࡙', '࡚', '࡛', '\\u085c', '\\u085d', '࡞', '\\u085f', '\\u0860', '\\u0861', '\\u0862', '\\u0863', '\\u0864', '\\u0865', '\\u0866', '\\u0867', '\\u0868', '\\u0869', '\\u086a', '\\u086b', '\\u086c', '\\u086d', '\\u086e', '\\u086f', '\\u0870', '\\u0871', '\\u0872', '\\u0873', '\\u0874', '\\u0875', '\\u0876', '\\u0877', '\\u0878', '\\u0879', '\\u087a', '\\u087b', '\\u087c', '\\u087d', '\\u087e', '\\u087f', '\\u0880', '\\u0881', '\\u0882', '\\u0883', '\\u0884', '\\u0885', '\\u0886', '\\u0887', '\\u0888', '\\u0889', '\\u088a', '\\u088b', '\\u088c', '\\u088d', '\\u088e', '\\u088f', '\\u0890', '\\u0891', '\\u0892', '\\u0893', '\\u0894', '\\u0895', '\\u0896', '\\u0897', '\\u0898', '\\u0899', '\\u089a', '\\u089b', '\\u089c', '\\u089d', '\\u089e', '\\u089f', 'ࢠ', 'ࢡ', 'ࢢ', 'ࢣ', 'ࢤ', 'ࢥ', 'ࢦ', 'ࢧ', 'ࢨ', 'ࢩ', 'ࢪ', 'ࢫ', 'ࢬ', 'ࢭ', 'ࢮ', 'ࢯ', 'ࢰ', 'ࢱ', 'ࢲ', 'ࢳ', 'ࢴ', '\\u08b5', 'ࢶ', 'ࢷ', 'ࢸ', 'ࢹ', 'ࢺ', 'ࢻ', 'ࢼ', 'ࢽ', '\\u08be', '\\u08bf', '\\u08c0', '\\u08c1', '\\u08c2', '\\u08c3', '\\u08c4', '\\u08c5', '\\u08c6', '\\u08c7', '\\u08c8', '\\u08c9', '\\u08ca', '\\u08cb', '\\u08cc', '\\u08cd', '\\u08ce', '\\u08cf', '\\u08d0', '\\u08d1', '\\u08d2', '\\u08d3', 'ࣔ', 'ࣕ', 'ࣖ', 'ࣗ', 'ࣘ', 'ࣙ', 'ࣚ', 'ࣛ', 'ࣜ', 'ࣝ', 'ࣞ', 'ࣟ', '࣠', '࣡', '\\u08e2', 'ࣣ', 'ࣤ', 'ࣥ', 'ࣦ', 'ࣧ', 'ࣨ', 'ࣩ', '࣪', '࣫', '࣬', '࣭', '࣮', '࣯', 'ࣰ', 'ࣱ', 'ࣲ', 'ࣳ', 'ࣴ', 'ࣵ', 'ࣶ', 'ࣷ', 'ࣸ', 'ࣹ', 'ࣺ', 'ࣻ', 'ࣼ', 'ࣽ', 'ࣾ', 'ࣿ', 'ऀ', 'ँ', 'ं', 'ः', 'ऄ', 'अ', 'आ', 'इ', 'ई', 'उ', 'ऊ', 'ऋ', 'ऌ', 'ऍ', 'ऎ', 'ए', 'ऐ', 'ऑ', 'ऒ', 'ओ', 'औ', 'क', 'ख', 'ग', 'घ', 'ङ', 'च', 'छ', 'ज', 'झ', 'ञ', 'ट', 'ठ', 'ड', 'ढ', 'ण', 'त', 'थ', 'द', 'ध', 'न', 'ऩ', 'प', 'फ', 'ब', 'भ', 'म', 'य', 'र', 'ऱ', 'ल', 'ळ', 'ऴ', 'व', 'श', 'ष', 'स', 'ह', 'ऺ', 'ऻ', '़', 'ऽ', 'ा', 'ि', 'ी', 'ु', 'ू', 'ृ', 'ॄ', 'ॅ', 'ॆ', 'े', 'ै', 'ॉ', 'ॊ', 'ो', 'ौ', '्', 'ॎ', 'ॏ', 'ॐ', '॑', '॒', '॓', '॔', 'ॕ', 'ॖ', 'ॗ', 'क़', 'ख़', 'ग़', 'ज़', 'ड़', 'ढ़', 'फ़', 'य़', 'ॠ', 'ॡ', 'ॢ', 'ॣ', '।', '॥', '०', '१', '२', '३', '४', '५', '६', '७', '८', '९', '॰', 'ॱ', 'ॲ', 'ॳ', 'ॴ', 'ॵ', 'ॶ', 'ॷ', 'ॸ', 'ॹ', 'ॺ', 'ॻ', 'ॼ', 'ॽ', 'ॾ', 'ॿ', 'ঀ', 'ঁ', 'ং', 'ঃ', '\\u0984', 'অ', 'আ', 'ই', 'ঈ', 'উ', 'ঊ', 'ঋ', 'ঌ', '\\u098d', '\\u098e', 'এ', 'ঐ', '\\u0991', '\\u0992', 'ও', 'ঔ', 'ক', 'খ', 'গ', 'ঘ', 'ঙ', 'চ', 'ছ', 'জ', 'ঝ', 'ঞ', 'ট', 'ঠ', 'ড', 'ঢ', 'ণ', 'ত', 'থ', 'দ', 'ধ', 'ন', '\\u09a9', 'প', 'ফ', 'ব', 'ভ', 'ম', 'য', 'র', '\\u09b1', 'ল', '\\u09b3', '\\u09b4', '\\u09b5', 'শ', 'ষ', 'স', 'হ', '\\u09ba', '\\u09bb', '়', 'ঽ', 'া', 'ি', 'ী', 'ু', 'ূ', 'ৃ', 'ৄ', '\\u09c5', '\\u09c6', 'ে', 'ৈ', '\\u09c9', '\\u09ca', 'ো', 'ৌ', '্', 'ৎ', '\\u09cf', '\\u09d0', '\\u09d1', '\\u09d2', '\\u09d3', '\\u09d4', '\\u09d5', '\\u09d6', 'ৗ', '\\u09d8', '\\u09d9', '\\u09da', '\\u09db', 'ড়', 'ঢ়', '\\u09de', 'য়', 'ৠ', 'ৡ', 'ৢ', 'ৣ', '\\u09e4', '\\u09e5', '০', '১', '২', '৩', '৪', '৫', '৬', '৭', '৮', '৯', 'ৰ', 'ৱ', '৲', '৳', '৴', '৵', '৶', '৷', '৸', '৹', '৺', '৻', '\\u09fc', '\\u09fd', '\\u09fe', '\\u09ff', '\\u0a00', 'ਁ', 'ਂ', 'ਃ', '\\u0a04', 'ਅ', 'ਆ', 'ਇ', 'ਈ', 'ਉ', 'ਊ', '\\u0a0b', '\\u0a0c', '\\u0a0d', '\\u0a0e', 'ਏ', 'ਐ', '\\u0a11', '\\u0a12', 'ਓ', 'ਔ', 'ਕ', 'ਖ', 'ਗ', 'ਘ', 'ਙ', 'ਚ', 'ਛ', 'ਜ', 'ਝ', 'ਞ', 'ਟ', 'ਠ', 'ਡ', 'ਢ', 'ਣ', 'ਤ', 'ਥ', 'ਦ', 'ਧ', 'ਨ', '\\u0a29', 'ਪ', 'ਫ', 'ਬ', 'ਭ', 'ਮ', 'ਯ', 'ਰ', '\\u0a31', 'ਲ', 'ਲ਼', '\\u0a34', 'ਵ', 'ਸ਼', '\\u0a37', 'ਸ', 'ਹ', '\\u0a3a', '\\u0a3b', '਼', '\\u0a3d', 'ਾ', 'ਿ', 'ੀ', 'ੁ', 'ੂ', '\\u0a43', '\\u0a44', '\\u0a45', '\\u0a46', 'ੇ', 'ੈ', '\\u0a49', '\\u0a4a', 'ੋ', 'ੌ', '੍', '\\u0a4e', '\\u0a4f', '\\u0a50', 'ੑ', '\\u0a52', '\\u0a53', '\\u0a54', '\\u0a55', '\\u0a56', '\\u0a57', '\\u0a58', 'ਖ਼', 'ਗ਼', 'ਜ਼', 'ੜ', '\\u0a5d', 'ਫ਼', '\\u0a5f', '\\u0a60', '\\u0a61', '\\u0a62', '\\u0a63', '\\u0a64', '\\u0a65', '੦', '੧', '੨', '੩', '੪', '੫', '੬', '੭', '੮', '੯', 'ੰ', 'ੱ', 'ੲ', 'ੳ', 'ੴ', 'ੵ', '\\u0a76', '\\u0a77', '\\u0a78', '\\u0a79', '\\u0a7a', '\\u0a7b', '\\u0a7c', '\\u0a7d', '\\u0a7e', '\\u0a7f', '\\u0a80', 'ઁ', 'ં', 'ઃ', '\\u0a84', 'અ', 'આ', 'ઇ', 'ઈ', 'ઉ', 'ઊ', 'ઋ', 'ઌ', 'ઍ', '\\u0a8e', 'એ', 'ઐ', 'ઑ', '\\u0a92', 'ઓ', 'ઔ', 'ક', 'ખ', 'ગ', 'ઘ', 'ઙ', 'ચ', 'છ', 'જ', 'ઝ', 'ઞ', 'ટ', 'ઠ', 'ડ', 'ઢ', 'ણ', 'ત', 'થ', 'દ', 'ધ', 'ન', '\\u0aa9', 'પ', 'ફ', 'બ', 'ભ', 'મ', 'ય', 'ર', '\\u0ab1', 'લ', 'ળ', '\\u0ab4', 'વ', 'શ', 'ષ', 'સ', 'હ', '\\u0aba', '\\u0abb', '઼', 'ઽ', 'ા', 'િ', 'ી', 'ુ', 'ૂ', 'ૃ', 'ૄ', 'ૅ', '\\u0ac6', 'ે', 'ૈ', 'ૉ', '\\u0aca', 'ો', 'ૌ', '્', '\\u0ace', '\\u0acf', 'ૐ', '\\u0ad1', '\\u0ad2', '\\u0ad3', '\\u0ad4', '\\u0ad5', '\\u0ad6', '\\u0ad7', '\\u0ad8', '\\u0ad9', '\\u0ada', '\\u0adb', '\\u0adc', '\\u0add', '\\u0ade', '\\u0adf', 'ૠ', 'ૡ', 'ૢ', 'ૣ', '\\u0ae4', '\\u0ae5', '૦', '૧', '૨', '૩', '૪', '૫', '૬', '૭', '૮', '૯', '૰', '૱', '\\u0af2', '\\u0af3', '\\u0af4', '\\u0af5', '\\u0af6', '\\u0af7', '\\u0af8', 'ૹ', '\\u0afa', '\\u0afb', '\\u0afc', '\\u0afd', '\\u0afe', '\\u0aff', '\\u0b00', 'ଁ', 'ଂ', 'ଃ', '\\u0b04', 'ଅ', 'ଆ', 'ଇ', 'ଈ', 'ଉ', 'ଊ', 'ଋ', 'ଌ', '\\u0b0d', '\\u0b0e', 'ଏ', 'ଐ', '\\u0b11', '\\u0b12', 'ଓ', 'ଔ', 'କ', 'ଖ', 'ଗ', 'ଘ', 'ଙ', 'ଚ', 'ଛ', 'ଜ', 'ଝ', 'ଞ', 'ଟ', 'ଠ', 'ଡ', 'ଢ', 'ଣ', 'ତ', 'ଥ', 'ଦ', 'ଧ', 'ନ', '\\u0b29', 'ପ', 'ଫ', 'ବ', 'ଭ', 'ମ', 'ଯ', 'ର', '\\u0b31', 'ଲ', 'ଳ', '\\u0b34', 'ଵ', 'ଶ', 'ଷ', 'ସ', 'ହ', '\\u0b3a', '\\u0b3b', '଼', 'ଽ', 'ା', 'ି', 'ୀ', 'ୁ', 'ୂ', 'ୃ', 'ୄ', '\\u0b45', '\\u0b46', 'େ', 'ୈ', '\\u0b49', '\\u0b4a', 'ୋ', 'ୌ', '୍', '\\u0b4e', '\\u0b4f', '\\u0b50', '\\u0b51', '\\u0b52', '\\u0b53', '\\u0b54', '\\u0b55', 'ୖ', 'ୗ', '\\u0b58', '\\u0b59', '\\u0b5a', '\\u0b5b', 'ଡ଼', 'ଢ଼', '\\u0b5e', 'ୟ', 'ୠ', 'ୡ', 'ୢ', 'ୣ', '\\u0b64', '\\u0b65', '୦', '୧', '୨', '୩', '୪', '୫', '୬', '୭', '୮', '୯', '୰', 'ୱ', '୲', '୳', '୴', '୵', '୶', '୷', '\\u0b78', '\\u0b79', '\\u0b7a', '\\u0b7b', '\\u0b7c', '\\u0b7d', '\\u0b7e', '\\u0b7f', '\\u0b80', '\\u0b81', 'ஂ', 'ஃ', '\\u0b84', 'அ', 'ஆ', 'இ', 'ஈ', 'உ', 'ஊ', '\\u0b8b', '\\u0b8c', '\\u0b8d', 'எ', 'ஏ', 'ஐ', '\\u0b91', 'ஒ', 'ஓ', 'ஔ', 'க', '\\u0b96', '\\u0b97', '\\u0b98', 'ங', 'ச', '\\u0b9b', 'ஜ', '\\u0b9d', 'ஞ', 'ட', '\\u0ba0', '\\u0ba1', '\\u0ba2', 'ண', 'த', '\\u0ba5', '\\u0ba6', '\\u0ba7', 'ந', 'ன', 'ப', '\\u0bab', '\\u0bac', '\\u0bad', 'ம', 'ய', 'ர', 'ற', 'ல', 'ள', 'ழ', 'வ', 'ஶ', 'ஷ', 'ஸ', 'ஹ', '\\u0bba', '\\u0bbb', '\\u0bbc', '\\u0bbd', 'ா', 'ி', 'ீ', 'ு', 'ூ', '\\u0bc3', '\\u0bc4', '\\u0bc5', 'ெ', 'ே', 'ை', '\\u0bc9', 'ொ', 'ோ', 'ௌ', '்', '\\u0bce', '\\u0bcf', 'ௐ', '\\u0bd1', '\\u0bd2', '\\u0bd3', '\\u0bd4', '\\u0bd5', '\\u0bd6', 'ௗ', '\\u0bd8', '\\u0bd9', '\\u0bda', '\\u0bdb', '\\u0bdc', '\\u0bdd', '\\u0bde', '\\u0bdf', '\\u0be0', '\\u0be1', '\\u0be2', '\\u0be3', '\\u0be4', '\\u0be5', '௦', '௧', '௨', '௩', '௪', '௫', '௬', '௭', '௮', '௯', '௰', '௱', '௲', '௳', '௴', '௵', '௶', '௷', '௸', '௹', '௺', '\\u0bfb', '\\u0bfc', '\\u0bfd', '\\u0bfe', '\\u0bff', 'ఀ', 'ఁ', 'ం', 'ః', '\\u0c04', 'అ', 'ఆ', 'ఇ', 'ఈ', 'ఉ', 'ఊ', 'ఋ', 'ఌ', '\\u0c0d', 'ఎ', 'ఏ', 'ఐ', '\\u0c11', 'ఒ', 'ఓ', 'ఔ', 'క', 'ఖ', 'గ', 'ఘ', 'ఙ', 'చ', 'ఛ', 'జ', 'ఝ', 'ఞ', 'ట', 'ఠ', 'డ', 'ఢ', 'ణ', 'త', 'థ', 'ద', 'ధ', 'న', '\\u0c29', 'ప', 'ఫ', 'బ', 'భ', 'మ', 'య', 'ర', 'ఱ', 'ల', 'ళ', 'ఴ', 'వ', 'శ', 'ష', 'స', 'హ', '\\u0c3a', '\\u0c3b', '\\u0c3c', 'ఽ', 'ా', 'ి', 'ీ', 'ు', 'ూ', 'ృ', 'ౄ', '\\u0c45', 'ె', 'ే', 'ై', '\\u0c49', 'ొ', 'ో', 'ౌ', '్', '\\u0c4e', '\\u0c4f', '\\u0c50', '\\u0c51', '\\u0c52', '\\u0c53', '\\u0c54', 'ౕ', 'ౖ', '\\u0c57', 'ౘ', 'ౙ', 'ౚ', '\\u0c5b', '\\u0c5c', '\\u0c5d', '\\u0c5e', '\\u0c5f', 'ౠ', 'ౡ', 'ౢ', 'ౣ', '\\u0c64', '\\u0c65', '౦', '౧', '౨', '౩', '౪', '౫', '౬', '౭', '౮', '౯', '\\u0c70', '\\u0c71', '\\u0c72', '\\u0c73', '\\u0c74', '\\u0c75', '\\u0c76', '\\u0c77', '౸', '౹', '౺', '౻', '౼', '౽', '౾', '౿', 'ಀ', 'ಁ', 'ಂ', 'ಃ', '\\u0c84', 'ಅ', 'ಆ', 'ಇ', 'ಈ', 'ಉ', 'ಊ', 'ಋ', 'ಌ', '\\u0c8d', 'ಎ', 'ಏ', 'ಐ', '\\u0c91', 'ಒ', 'ಓ', 'ಔ', 'ಕ', 'ಖ', 'ಗ', 'ಘ', 'ಙ', 'ಚ', 'ಛ', 'ಜ', 'ಝ', 'ಞ', 'ಟ', 'ಠ', 'ಡ', 'ಢ', 'ಣ', 'ತ', 'ಥ', 'ದ', 'ಧ', 'ನ', '\\u0ca9', 'ಪ', 'ಫ', 'ಬ', 'ಭ', 'ಮ', 'ಯ', 'ರ', 'ಱ', 'ಲ', 'ಳ', '\\u0cb4', 'ವ', 'ಶ', 'ಷ', 'ಸ', 'ಹ', '\\u0cba', '\\u0cbb', '಼', 'ಽ', 'ಾ', 'ಿ', 'ೀ', 'ು', 'ೂ', 'ೃ', 'ೄ', '\\u0cc5', 'ೆ', 'ೇ', 'ೈ', '\\u0cc9', 'ೊ', 'ೋ', 'ೌ', '್', '\\u0cce', '\\u0ccf', '\\u0cd0', '\\u0cd1', '\\u0cd2', '\\u0cd3', '\\u0cd4', 'ೕ', 'ೖ', '\\u0cd7', '\\u0cd8', '\\u0cd9', '\\u0cda', '\\u0cdb', '\\u0cdc', '\\u0cdd', 'ೞ', '\\u0cdf', 'ೠ', 'ೡ', 'ೢ', 'ೣ', '\\u0ce4', '\\u0ce5', '೦', '೧', '೨', '೩', '೪', '೫', '೬', '೭', '೮', '೯', '\\u0cf0', 'ೱ', 'ೲ', '\\u0cf3', '\\u0cf4', '\\u0cf5', '\\u0cf6', '\\u0cf7', '\\u0cf8', '\\u0cf9', '\\u0cfa', '\\u0cfb', '\\u0cfc', '\\u0cfd', '\\u0cfe', '\\u0cff', '\\u0d00', 'ഁ', 'ം', 'ഃ', '\\u0d04', 'അ', 'ആ', 'ഇ', 'ഈ', 'ഉ', 'ഊ', 'ഋ', 'ഌ', '\\u0d0d', 'എ', 'ഏ', 'ഐ', '\\u0d11', 'ഒ', 'ഓ', 'ഔ', 'ക', 'ഖ', 'ഗ', 'ഘ', 'ങ', 'ച', 'ഛ', 'ജ', 'ഝ', 'ഞ', 'ട', 'ഠ', 'ഡ', 'ഢ', 'ണ', 'ത', 'ഥ', 'ദ', 'ധ', 'ന', 'ഩ', 'പ', 'ഫ', 'ബ', 'ഭ', 'മ', 'യ', 'ര', 'റ', 'ല', 'ള', 'ഴ', 'വ', 'ശ', 'ഷ', 'സ', 'ഹ', 'ഺ', '\\u0d3b', '\\u0d3c', 'ഽ', 'ാ', 'ി', 'ീ', 'ു', 'ൂ', 'ൃ', 'ൄ', '\\u0d45', 'െ', 'േ', 'ൈ', '\\u0d49', 'ൊ', 'ോ', 'ൌ', '്', 'ൎ', '൏', '\\u0d50', '\\u0d51', '\\u0d52', '\\u0d53', 'ൔ', 'ൕ', 'ൖ', 'ൗ', '൘', '൙', '൚', '൛', '൜', '൝', '൞', 'ൟ', 'ൠ', 'ൡ', 'ൢ', 'ൣ', '\\u0d64', '\\u0d65', '൦', '൧', '൨', '൩', '൪', '൫', '൬', '൭', '൮', '൯', '൰', '൱', '൲', '൳', '൴', '൵', '൶', '൷', '൸', '൹', 'ൺ', 'ൻ', 'ർ', 'ൽ', 'ൾ', 'ൿ', '\\u0d80', '\\u0d81', 'ං', 'ඃ', '\\u0d84', 'අ', 'ආ', 'ඇ', 'ඈ', 'ඉ', 'ඊ', 'උ', 'ඌ', 'ඍ', 'ඎ', 'ඏ', 'ඐ', 'එ', 'ඒ', 'ඓ', 'ඔ', 'ඕ', 'ඖ', '\\u0d97', '\\u0d98', '\\u0d99', 'ක', 'ඛ', 'ග', 'ඝ', 'ඞ', 'ඟ', 'ච', 'ඡ', 'ජ', 'ඣ', 'ඤ', 'ඥ', 'ඦ', 'ට', 'ඨ', 'ඩ', 'ඪ', 'ණ', 'ඬ', 'ත', 'ථ', 'ද', 'ධ', 'න', '\\u0db2', 'ඳ', 'ප', 'ඵ', 'බ', 'භ', 'ම', 'ඹ', 'ය', 'ර', '\\u0dbc', 'ල', '\\u0dbe', '\\u0dbf', 'ව', 'ශ', 'ෂ', 'ස', 'හ', 'ළ', 'ෆ', '\\u0dc7', '\\u0dc8', '\\u0dc9', '්', '\\u0dcb', '\\u0dcc', '\\u0dcd', '\\u0dce', 'ා', 'ැ', 'ෑ', 'ි', 'ී', 'ු', '\\u0dd5', 'ූ', '\\u0dd7', 'ෘ', 'ෙ', 'ේ', 'ෛ', 'ො', 'ෝ', 'ෞ', 'ෟ', '\\u0de0', '\\u0de1', '\\u0de2', '\\u0de3', '\\u0de4', '\\u0de5', '෦', '෧', '෨', '෩', '෪', '෫', '෬', '෭', '෮', '෯', '\\u0df0', '\\u0df1', 'ෲ', 'ෳ', '෴', '\\u0df5', '\\u0df6', '\\u0df7', '\\u0df8', '\\u0df9', '\\u0dfa', '\\u0dfb', '\\u0dfc', '\\u0dfd', '\\u0dfe', '\\u0dff', '\\u0e00', 'ก', 'ข', 'ฃ', 'ค', 'ฅ', 'ฆ', 'ง', 'จ', 'ฉ', 'ช', 'ซ', 'ฌ', 'ญ', 'ฎ', 'ฏ', 'ฐ', 'ฑ', 'ฒ', 'ณ', 'ด', 'ต', 'ถ', 'ท', 'ธ', 'น', 'บ', 'ป', 'ผ', 'ฝ', 'พ', 'ฟ', 'ภ', 'ม', 'ย', 'ร', 'ฤ', 'ล', 'ฦ', 'ว', 'ศ', 'ษ', 'ส', 'ห', 'ฬ', 'อ', 'ฮ', 'ฯ', 'ะ', 'ั', 'า', 'ำ', 'ิ', 'ี', 'ึ', 'ื', 'ุ', 'ู', 'ฺ', '\\u0e3b', '\\u0e3c', '\\u0e3d', '\\u0e3e', '฿', 'เ', 'แ', 'โ', 'ใ', 'ไ', 'ๅ', 'ๆ', '็', '่', '้', '๊', '๋', '์', 'ํ', '๎', '๏', '๐', '๑', '๒', '๓', '๔', '๕', '๖', '๗', '๘', '๙', '๚', '๛', '\\u0e5c', '\\u0e5d', '\\u0e5e', '\\u0e5f', '\\u0e60', '\\u0e61', '\\u0e62', '\\u0e63', '\\u0e64', '\\u0e65', '\\u0e66', '\\u0e67', '\\u0e68', '\\u0e69', '\\u0e6a', '\\u0e6b', '\\u0e6c', '\\u0e6d', '\\u0e6e', '\\u0e6f', '\\u0e70', '\\u0e71', '\\u0e72', '\\u0e73', '\\u0e74', '\\u0e75', '\\u0e76', '\\u0e77', '\\u0e78', '\\u0e79', '\\u0e7a', '\\u0e7b', '\\u0e7c', '\\u0e7d', '\\u0e7e', '\\u0e7f', '\\u0e80', 'ກ', 'ຂ', '\\u0e83', 'ຄ', '\\u0e85', '\\u0e86', 'ງ', 'ຈ', '\\u0e89', 'ຊ', '\\u0e8b', '\\u0e8c', 'ຍ', '\\u0e8e', '\\u0e8f', '\\u0e90', '\\u0e91', '\\u0e92', '\\u0e93', 'ດ', 'ຕ', 'ຖ', 'ທ', '\\u0e98', 'ນ', 'ບ', 'ປ', 'ຜ', 'ຝ', 'ພ', 'ຟ', '\\u0ea0', 'ມ', 'ຢ', 'ຣ', '\\u0ea4', 'ລ', '\\u0ea6', 'ວ', '\\u0ea8', '\\u0ea9', 'ສ', 'ຫ', '\\u0eac', 'ອ', 'ຮ', 'ຯ', 'ະ', 'ັ', 'າ', 'ຳ', 'ິ', 'ີ', 'ຶ', 'ື', 'ຸ', 'ູ', '\\u0eba', 'ົ', 'ຼ', 'ຽ', '\\u0ebe', '\\u0ebf', 'ເ', 'ແ', 'ໂ', 'ໃ', 'ໄ', '\\u0ec5', 'ໆ', '\\u0ec7', '່', '້', '໊', '໋', '໌', 'ໍ', '\\u0ece', '\\u0ecf', '໐', '໑', '໒', '໓', '໔', '໕', '໖', '໗', '໘', '໙', '\\u0eda', '\\u0edb', 'ໜ', 'ໝ', 'ໞ', 'ໟ', '\\u0ee0', '\\u0ee1', '\\u0ee2', '\\u0ee3', '\\u0ee4', '\\u0ee5', '\\u0ee6', '\\u0ee7', '\\u0ee8', '\\u0ee9', '\\u0eea', '\\u0eeb', '\\u0eec', '\\u0eed', '\\u0eee', '\\u0eef', '\\u0ef0', '\\u0ef1', '\\u0ef2', '\\u0ef3', '\\u0ef4', '\\u0ef5', '\\u0ef6', '\\u0ef7', '\\u0ef8', '\\u0ef9', '\\u0efa', '\\u0efb', '\\u0efc', '\\u0efd', '\\u0efe', '\\u0eff', 'ༀ', '༁', '༂', '༃', '༄', '༅', '༆', '༇', '༈', '༉', '༊', '་', '༌', '།', '༎', '༏', '༐', '༑', '༒', '༓', '༔', '༕', '༖', '༗', '༘', '༙', '༚', '༛', '༜', '༝', '༞', '༟', '༠', '༡', '༢', '༣', '༤', '༥', '༦', '༧', '༨', '༩', '༪', '༫', '༬', '༭', '༮', '༯', '༰', '༱', '༲', '༳', '༴', '༵', '༶', '༷', '༸', '༹', '༺', '༻', '༼', '༽', '༾', '༿', 'ཀ', 'ཁ', 'ག', 'གྷ', 'ང', 'ཅ', 'ཆ', 'ཇ', '\\u0f48', 'ཉ', 'ཊ', 'ཋ', 'ཌ', 'ཌྷ', 'ཎ', 'ཏ', 'ཐ', 'ད', 'དྷ', 'ན', 'པ', 'ཕ', 'བ', 'བྷ', 'མ', 'ཙ', 'ཚ', 'ཛ', 'ཛྷ', 'ཝ', 'ཞ', 'ཟ', 'འ', 'ཡ', 'ར', 'ལ', 'ཤ', 'ཥ', 'ས', 'ཧ', 'ཨ', 'ཀྵ', 'ཪ', 'ཫ', 'ཬ', '\\u0f6d', '\\u0f6e', '\\u0f6f', '\\u0f70', 'ཱ', 'ི', 'ཱི', 'ུ', 'ཱུ', 'ྲྀ', 'ཷ', 'ླྀ', 'ཹ', 'ེ', 'ཻ', 'ོ', 'ཽ', 'ཾ', 'ཿ', 'ྀ', 'ཱྀ', 'ྂ', 'ྃ', '྄', '྅', '྆', '྇', 'ྈ', 'ྉ', 'ྊ', 'ྋ', 'ྌ', 'ྍ', 'ྎ', 'ྏ', 'ྐ', 'ྑ', 'ྒ', 'ྒྷ', 'ྔ', 'ྕ', 'ྖ', 'ྗ', '\\u0f98', 'ྙ', 'ྚ', 'ྛ', 'ྜ', 'ྜྷ', 'ྞ', 'ྟ', 'ྠ', 'ྡ', 'ྡྷ', 'ྣ', 'ྤ', 'ྥ', 'ྦ', 'ྦྷ', 'ྨ', 'ྩ', 'ྪ', 'ྫ', 'ྫྷ', 'ྭ', 'ྮ', 'ྯ', 'ྰ', 'ྱ', 'ྲ', 'ླ', 'ྴ', 'ྵ', 'ྶ', 'ྷ', 'ྸ', 'ྐྵ', 'ྺ', 'ྻ', 'ྼ', '\\u0fbd', '྾', '྿', '࿀', '࿁', '࿂', '࿃', '࿄', '࿅', '࿆', '࿇', '࿈', '࿉', '࿊', '࿋', '࿌', '\\u0fcd', '࿎', '࿏', '࿐', '࿑', '࿒', '࿓', '࿔', '࿕', '࿖', '࿗', '࿘', '࿙', '࿚', '\\u0fdb', '\\u0fdc', '\\u0fdd', '\\u0fde', '\\u0fdf', '\\u0fe0', '\\u0fe1', '\\u0fe2', '\\u0fe3', '\\u0fe4', '\\u0fe5', '\\u0fe6', '\\u0fe7', '\\u0fe8', '\\u0fe9', '\\u0fea', '\\u0feb', '\\u0fec', '\\u0fed', '\\u0fee', '\\u0fef', '\\u0ff0', '\\u0ff1', '\\u0ff2', '\\u0ff3', '\\u0ff4', '\\u0ff5', '\\u0ff6', '\\u0ff7', '\\u0ff8', '\\u0ff9', '\\u0ffa', '\\u0ffb', '\\u0ffc', '\\u0ffd', '\\u0ffe', '\\u0fff', 'က', 'ခ', 'ဂ', 'ဃ', 'င', 'စ', 'ဆ', 'ဇ', 'ဈ', 'ဉ', 'ည', 'ဋ', 'ဌ', 'ဍ', 'ဎ', 'ဏ', 'တ', 'ထ', 'ဒ', 'ဓ', 'န', 'ပ', 'ဖ', 'ဗ', 'ဘ', 'မ', 'ယ', 'ရ', 'လ', 'ဝ', 'သ', 'ဟ', 'ဠ', 'အ', 'ဢ', 'ဣ', 'ဤ', 'ဥ', 'ဦ', 'ဧ', 'ဨ', 'ဩ', 'ဪ', 'ါ', 'ာ', 'ိ', 'ီ', 'ု', 'ူ', 'ေ', 'ဲ', 'ဳ', 'ဴ', 'ဵ', 'ံ', '့', 'း', '္', '်', 'ျ', 'ြ', 'ွ', 'ှ', 'ဿ', '၀', '၁', '၂', '၃', '၄', '၅', '၆', '၇', '၈', '၉', '၊', '။', '၌', '၍', '၎', '၏', 'ၐ', 'ၑ', 'ၒ', 'ၓ', 'ၔ', 'ၕ', 'ၖ', 'ၗ', 'ၘ', 'ၙ', 'ၚ', 'ၛ', 'ၜ', 'ၝ', 'ၞ', 'ၟ', 'ၠ', 'ၡ', 'ၢ', 'ၣ', 'ၤ', 'ၥ', 'ၦ', 'ၧ', 'ၨ', 'ၩ', 'ၪ', 'ၫ', 'ၬ', 'ၭ', 'ၮ', 'ၯ', 'ၰ', 'ၱ', 'ၲ', 'ၳ', 'ၴ', 'ၵ', 'ၶ', 'ၷ', 'ၸ', 'ၹ', 'ၺ', 'ၻ', 'ၼ', 'ၽ', 'ၾ', 'ၿ', 'ႀ', 'ႁ', 'ႂ', 'ႃ', 'ႄ', 'ႅ', 'ႆ', 'ႇ', 'ႈ', 'ႉ', 'ႊ', 'ႋ', 'ႌ', 'ႍ', 'ႎ', 'ႏ', '႐', '႑', '႒', '႓', '႔', '႕', '႖', '႗', '႘', '႙', 'ႚ', 'ႛ', 'ႜ', 'ႝ', '႞', '႟', 'Ⴀ', 'Ⴁ', 'Ⴂ', 'Ⴃ', 'Ⴄ', 'Ⴅ', 'Ⴆ', 'Ⴇ', 'Ⴈ', 'Ⴉ', 'Ⴊ', 'Ⴋ', 'Ⴌ', 'Ⴍ', 'Ⴎ', 'Ⴏ', 'Ⴐ', 'Ⴑ', 'Ⴒ', 'Ⴓ', 'Ⴔ', 'Ⴕ', 'Ⴖ', 'Ⴗ', 'Ⴘ', 'Ⴙ', 'Ⴚ', 'Ⴛ', 'Ⴜ', 'Ⴝ', 'Ⴞ', 'Ⴟ', 'Ⴠ', 'Ⴡ', 'Ⴢ', 'Ⴣ', 'Ⴤ', 'Ⴥ', '\\u10c6', 'Ⴧ', '\\u10c8', '\\u10c9', '\\u10ca', '\\u10cb', '\\u10cc', 'Ⴭ', '\\u10ce', '\\u10cf', 'ა', 'ბ', 'გ', 'დ', 'ე', 'ვ', 'ზ', 'თ', 'ი', 'კ', 'ლ', 'მ', 'ნ', 'ო', 'პ', 'ჟ', 'რ', 'ს', 'ტ', 'უ', 'ფ', 'ქ', 'ღ', 'ყ', 'შ', 'ჩ', 'ც', 'ძ', 'წ', 'ჭ', 'ხ', 'ჯ', 'ჰ', 'ჱ', 'ჲ', 'ჳ', 'ჴ', 'ჵ', 'ჶ', 'ჷ', 'ჸ', 'ჹ', 'ჺ', '჻', 'ჼ', 'ჽ', 'ჾ', 'ჿ', 'ᄀ', 'ᄁ', 'ᄂ', 'ᄃ', 'ᄄ', 'ᄅ', 'ᄆ', 'ᄇ', 'ᄈ', 'ᄉ', 'ᄊ', 'ᄋ', 'ᄌ', 'ᄍ', 'ᄎ', 'ᄏ', 'ᄐ', 'ᄑ', 'ᄒ', 'ᄓ', 'ᄔ', 'ᄕ', 'ᄖ', 'ᄗ', 'ᄘ', 'ᄙ', 'ᄚ', 'ᄛ', 'ᄜ', 'ᄝ', 'ᄞ', 'ᄟ', 'ᄠ', 'ᄡ', 'ᄢ', 'ᄣ', 'ᄤ', 'ᄥ', 'ᄦ', 'ᄧ', 'ᄨ', 'ᄩ', 'ᄪ', 'ᄫ', 'ᄬ', 'ᄭ', 'ᄮ', 'ᄯ', 'ᄰ', 'ᄱ', 'ᄲ', 'ᄳ', 'ᄴ', 'ᄵ', 'ᄶ', 'ᄷ', 'ᄸ', 'ᄹ', 'ᄺ', 'ᄻ', 'ᄼ', 'ᄽ', 'ᄾ', 'ᄿ', 'ᅀ', 'ᅁ', 'ᅂ', 'ᅃ', 'ᅄ', 'ᅅ', 'ᅆ', 'ᅇ', 'ᅈ', 'ᅉ', 'ᅊ', 'ᅋ', 'ᅌ', 'ᅍ', 'ᅎ', 'ᅏ', 'ᅐ', 'ᅑ', 'ᅒ', 'ᅓ', 'ᅔ', 'ᅕ', 'ᅖ', 'ᅗ', 'ᅘ', 'ᅙ', 'ᅚ', 'ᅛ', 'ᅜ', 'ᅝ', 'ᅞ', 'ᅟ', 'ᅠ', 'ᅡ', 'ᅢ', 'ᅣ', 'ᅤ', 'ᅥ', 'ᅦ', 'ᅧ', 'ᅨ', 'ᅩ', 'ᅪ', 'ᅫ', 'ᅬ', 'ᅭ', 'ᅮ', 'ᅯ', 'ᅰ', 'ᅱ', 'ᅲ', 'ᅳ', 'ᅴ', 'ᅵ', 'ᅶ', 'ᅷ', 'ᅸ', 'ᅹ', 'ᅺ', 'ᅻ', 'ᅼ', 'ᅽ', 'ᅾ', 'ᅿ', 'ᆀ', 'ᆁ', 'ᆂ', 'ᆃ', 'ᆄ', 'ᆅ', 'ᆆ', 'ᆇ', 'ᆈ', 'ᆉ', 'ᆊ', 'ᆋ', 'ᆌ', 'ᆍ', 'ᆎ', 'ᆏ', 'ᆐ', 'ᆑ', 'ᆒ', 'ᆓ', 'ᆔ', 'ᆕ', 'ᆖ', 'ᆗ', 'ᆘ', 'ᆙ', 'ᆚ', 'ᆛ', 'ᆜ', 'ᆝ', 'ᆞ', 'ᆟ', 'ᆠ', 'ᆡ', 'ᆢ', 'ᆣ', 'ᆤ', 'ᆥ', 'ᆦ', 'ᆧ', 'ᆨ', 'ᆩ', 'ᆪ', 'ᆫ', 'ᆬ', 'ᆭ', 'ᆮ', 'ᆯ', 'ᆰ', 'ᆱ', 'ᆲ', 'ᆳ', 'ᆴ', 'ᆵ', 'ᆶ', 'ᆷ', 'ᆸ', 'ᆹ', 'ᆺ', 'ᆻ', 'ᆼ', 'ᆽ', 'ᆾ', 'ᆿ', 'ᇀ', 'ᇁ', 'ᇂ', 'ᇃ', 'ᇄ', 'ᇅ', 'ᇆ', 'ᇇ', 'ᇈ', 'ᇉ', 'ᇊ', 'ᇋ', 'ᇌ', 'ᇍ', 'ᇎ', 'ᇏ', 'ᇐ', 'ᇑ', 'ᇒ', 'ᇓ', 'ᇔ', 'ᇕ', 'ᇖ', 'ᇗ', 'ᇘ', 'ᇙ', 'ᇚ', 'ᇛ', 'ᇜ', 'ᇝ', 'ᇞ', 'ᇟ', 'ᇠ', 'ᇡ', 'ᇢ', 'ᇣ', 'ᇤ', 'ᇥ', 'ᇦ', 'ᇧ', 'ᇨ', 'ᇩ', 'ᇪ', 'ᇫ', 'ᇬ', 'ᇭ', 'ᇮ', 'ᇯ', 'ᇰ', 'ᇱ', 'ᇲ', 'ᇳ', 'ᇴ', 'ᇵ', 'ᇶ', 'ᇷ', 'ᇸ', 'ᇹ', 'ᇺ', 'ᇻ', 'ᇼ', 'ᇽ', 'ᇾ', 'ᇿ', 'ሀ', 'ሁ', 'ሂ', 'ሃ', 'ሄ', 'ህ', 'ሆ', 'ሇ', 'ለ', 'ሉ', 'ሊ', 'ላ', 'ሌ', 'ል', 'ሎ', 'ሏ', 'ሐ', 'ሑ', 'ሒ', 'ሓ', 'ሔ', 'ሕ', 'ሖ', 'ሗ', 'መ', 'ሙ', 'ሚ', 'ማ', 'ሜ', 'ም', 'ሞ', 'ሟ', 'ሠ', 'ሡ', 'ሢ', 'ሣ', 'ሤ', 'ሥ', 'ሦ', 'ሧ', 'ረ', 'ሩ', 'ሪ', 'ራ', 'ሬ', 'ር', 'ሮ', 'ሯ', 'ሰ', 'ሱ', 'ሲ', 'ሳ', 'ሴ', 'ስ', 'ሶ', 'ሷ', 'ሸ', 'ሹ', 'ሺ', 'ሻ', 'ሼ', 'ሽ', 'ሾ', 'ሿ', 'ቀ', 'ቁ', 'ቂ', 'ቃ', 'ቄ', 'ቅ', 'ቆ', 'ቇ', 'ቈ', '\\u1249', 'ቊ', 'ቋ', 'ቌ', 'ቍ', '\\u124e', '\\u124f', 'ቐ', 'ቑ', 'ቒ', 'ቓ', 'ቔ', 'ቕ', 'ቖ', '\\u1257', 'ቘ', '\\u1259', 'ቚ', 'ቛ', 'ቜ', 'ቝ', '\\u125e', '\\u125f', 'በ', 'ቡ', 'ቢ', 'ባ', 'ቤ', 'ብ', 'ቦ', 'ቧ', 'ቨ', 'ቩ', 'ቪ', 'ቫ', 'ቬ', 'ቭ', 'ቮ', 'ቯ', 'ተ', 'ቱ', 'ቲ', 'ታ', 'ቴ', 'ት', 'ቶ', 'ቷ', 'ቸ', 'ቹ', 'ቺ', 'ቻ', 'ቼ', 'ች', 'ቾ', 'ቿ', 'ኀ', 'ኁ', 'ኂ', 'ኃ', 'ኄ', 'ኅ', 'ኆ', 'ኇ', 'ኈ', '\\u1289', 'ኊ', 'ኋ', 'ኌ', 'ኍ', '\\u128e', '\\u128f', 'ነ', 'ኑ', 'ኒ', 'ና', 'ኔ', 'ን', 'ኖ', 'ኗ', 'ኘ', 'ኙ', 'ኚ', 'ኛ', 'ኜ', 'ኝ', 'ኞ', 'ኟ', 'አ', 'ኡ', 'ኢ', 'ኣ', 'ኤ', 'እ', 'ኦ', 'ኧ', 'ከ', 'ኩ', 'ኪ', 'ካ', 'ኬ', 'ክ', 'ኮ', 'ኯ', 'ኰ', '\\u12b1', 'ኲ', 'ኳ', 'ኴ', 'ኵ', '\\u12b6', '\\u12b7', 'ኸ', 'ኹ', 'ኺ', 'ኻ', 'ኼ', 'ኽ', 'ኾ', '\\u12bf', 'ዀ', '\\u12c1', 'ዂ', 'ዃ', 'ዄ', 'ዅ', '\\u12c6', '\\u12c7', 'ወ', 'ዉ', 'ዊ', 'ዋ', 'ዌ', 'ው', 'ዎ', 'ዏ', 'ዐ', 'ዑ', 'ዒ', 'ዓ', 'ዔ', 'ዕ', 'ዖ', '\\u12d7', 'ዘ', 'ዙ', 'ዚ', 'ዛ', 'ዜ', 'ዝ', 'ዞ', 'ዟ', 'ዠ', 'ዡ', 'ዢ', 'ዣ', 'ዤ', 'ዥ', 'ዦ', 'ዧ', 'የ', 'ዩ', 'ዪ', 'ያ', 'ዬ', 'ይ', 'ዮ', 'ዯ', 'ደ', 'ዱ', 'ዲ', 'ዳ', 'ዴ', 'ድ', 'ዶ', 'ዷ', 'ዸ', 'ዹ', 'ዺ', 'ዻ', 'ዼ', 'ዽ', 'ዾ', 'ዿ', 'ጀ', 'ጁ', 'ጂ', 'ጃ', 'ጄ', 'ጅ', 'ጆ', 'ጇ', 'ገ', 'ጉ', 'ጊ', 'ጋ', 'ጌ', 'ግ', 'ጎ', 'ጏ', 'ጐ', '\\u1311', 'ጒ', 'ጓ', 'ጔ', 'ጕ', '\\u1316', '\\u1317', 'ጘ', 'ጙ', 'ጚ', 'ጛ', 'ጜ', 'ጝ', 'ጞ', 'ጟ', 'ጠ', 'ጡ', 'ጢ', 'ጣ', 'ጤ', 'ጥ', 'ጦ', 'ጧ', 'ጨ', 'ጩ', 'ጪ', 'ጫ', 'ጬ', 'ጭ', 'ጮ', 'ጯ', 'ጰ', 'ጱ', 'ጲ', 'ጳ', 'ጴ', 'ጵ', 'ጶ', 'ጷ', 'ጸ', 'ጹ', 'ጺ', 'ጻ', 'ጼ', 'ጽ', 'ጾ', 'ጿ', 'ፀ', 'ፁ', 'ፂ', 'ፃ', 'ፄ', 'ፅ', 'ፆ', 'ፇ', 'ፈ', 'ፉ', 'ፊ', 'ፋ', 'ፌ', 'ፍ', 'ፎ', 'ፏ', 'ፐ', 'ፑ', 'ፒ', 'ፓ', 'ፔ', 'ፕ', 'ፖ', 'ፗ', 'ፘ', 'ፙ', 'ፚ', '\\u135b', '\\u135c', '፝', '፞', '፟', '፠', '፡', '።', '፣', '፤', '፥', '፦', '፧', '፨', '፩', '፪', '፫', '፬', '፭', '፮', '፯', '፰', '፱', '፲', '፳', '፴', '፵', '፶', '፷', '፸', '፹', '፺', '፻', '፼', '\\u137d', '\\u137e', '\\u137f', 'ᎀ', 'ᎁ', 'ᎂ', 'ᎃ', 'ᎄ', 'ᎅ', 'ᎆ', 'ᎇ', 'ᎈ', 'ᎉ', 'ᎊ', 'ᎋ', 'ᎌ', 'ᎍ', 'ᎎ', 'ᎏ', '᎐', '᎑', '᎒', '᎓', '᎔', '᎕', '᎖', '᎗', '᎘', '᎙', '\\u139a', '\\u139b', '\\u139c', '\\u139d', '\\u139e', '\\u139f', 'Ꭰ', 'Ꭱ', 'Ꭲ', 'Ꭳ', 'Ꭴ', 'Ꭵ', 'Ꭶ', 'Ꭷ', 'Ꭸ', 'Ꭹ', 'Ꭺ', 'Ꭻ', 'Ꭼ', 'Ꭽ', 'Ꭾ', 'Ꭿ', 'Ꮀ', 'Ꮁ', 'Ꮂ', 'Ꮃ', 'Ꮄ', 'Ꮅ', 'Ꮆ', 'Ꮇ', 'Ꮈ', 'Ꮉ', 'Ꮊ', 'Ꮋ', 'Ꮌ', 'Ꮍ', 'Ꮎ', 'Ꮏ', 'Ꮐ', 'Ꮑ', 'Ꮒ', 'Ꮓ', 'Ꮔ', 'Ꮕ', 'Ꮖ', 'Ꮗ', 'Ꮘ', 'Ꮙ', 'Ꮚ', 'Ꮛ', 'Ꮜ', 'Ꮝ', 'Ꮞ', 'Ꮟ', 'Ꮠ', 'Ꮡ', 'Ꮢ', 'Ꮣ', 'Ꮤ', 'Ꮥ', 'Ꮦ', 'Ꮧ', 'Ꮨ', 'Ꮩ', 'Ꮪ', 'Ꮫ', 'Ꮬ', 'Ꮭ', 'Ꮮ', 'Ꮯ', 'Ꮰ', 'Ꮱ', 'Ꮲ', 'Ꮳ', 'Ꮴ', 'Ꮵ', 'Ꮶ', 'Ꮷ', 'Ꮸ', 'Ꮹ', 'Ꮺ', 'Ꮻ', 'Ꮼ', 'Ꮽ', 'Ꮾ', 'Ꮿ', 'Ᏸ', 'Ᏹ', 'Ᏺ', 'Ᏻ', 'Ᏼ', 'Ᏽ', '\\u13f6', '\\u13f7', 'ᏸ', 'ᏹ', 'ᏺ', 'ᏻ', 'ᏼ', 'ᏽ', '\\u13fe', '\\u13ff', '᐀', 'ᐁ', 'ᐂ', 'ᐃ', 'ᐄ', 'ᐅ', 'ᐆ', 'ᐇ', 'ᐈ', 'ᐉ', 'ᐊ', 'ᐋ', 'ᐌ', 'ᐍ', 'ᐎ', 'ᐏ', 'ᐐ', 'ᐑ', 'ᐒ', 'ᐓ', 'ᐔ', 'ᐕ', 'ᐖ', 'ᐗ', 'ᐘ', 'ᐙ', 'ᐚ', 'ᐛ', 'ᐜ', 'ᐝ', 'ᐞ', 'ᐟ', 'ᐠ', 'ᐡ', 'ᐢ', 'ᐣ', 'ᐤ', 'ᐥ', 'ᐦ', 'ᐧ', 'ᐨ', 'ᐩ', 'ᐪ', 'ᐫ', 'ᐬ', 'ᐭ', 'ᐮ', 'ᐯ', 'ᐰ', 'ᐱ', 'ᐲ', 'ᐳ', 'ᐴ', 'ᐵ', 'ᐶ', 'ᐷ', 'ᐸ', 'ᐹ', 'ᐺ', 'ᐻ', 'ᐼ', 'ᐽ', 'ᐾ', 'ᐿ', 'ᑀ', 'ᑁ', 'ᑂ', 'ᑃ', 'ᑄ', 'ᑅ', 'ᑆ', 'ᑇ', 'ᑈ', 'ᑉ', 'ᑊ', 'ᑋ', 'ᑌ', 'ᑍ', 'ᑎ', 'ᑏ', 'ᑐ', 'ᑑ', 'ᑒ', 'ᑓ', 'ᑔ', 'ᑕ', 'ᑖ', 'ᑗ', 'ᑘ', 'ᑙ', 'ᑚ', 'ᑛ', 'ᑜ', 'ᑝ', 'ᑞ', 'ᑟ', 'ᑠ', 'ᑡ', 'ᑢ', 'ᑣ', 'ᑤ', 'ᑥ', 'ᑦ', 'ᑧ', 'ᑨ', 'ᑩ', 'ᑪ', 'ᑫ', 'ᑬ', 'ᑭ', 'ᑮ', 'ᑯ', 'ᑰ', 'ᑱ', 'ᑲ', 'ᑳ', 'ᑴ', 'ᑵ', 'ᑶ', 'ᑷ', 'ᑸ', 'ᑹ', 'ᑺ', 'ᑻ', 'ᑼ', 'ᑽ', 'ᑾ', 'ᑿ', 'ᒀ', 'ᒁ', 'ᒂ', 'ᒃ', 'ᒄ', 'ᒅ', 'ᒆ', 'ᒇ', 'ᒈ', 'ᒉ', 'ᒊ', 'ᒋ', 'ᒌ', 'ᒍ', 'ᒎ', 'ᒏ', 'ᒐ', 'ᒑ', 'ᒒ', 'ᒓ', 'ᒔ', 'ᒕ', 'ᒖ', 'ᒗ', 'ᒘ', 'ᒙ', 'ᒚ', 'ᒛ', 'ᒜ', 'ᒝ', 'ᒞ', 'ᒟ', 'ᒠ', 'ᒡ', 'ᒢ', 'ᒣ', 'ᒤ', 'ᒥ', 'ᒦ', 'ᒧ', 'ᒨ', 'ᒩ', 'ᒪ', 'ᒫ', 'ᒬ', 'ᒭ', 'ᒮ', 'ᒯ', 'ᒰ', 'ᒱ', 'ᒲ', 'ᒳ', 'ᒴ', 'ᒵ', 'ᒶ', 'ᒷ', 'ᒸ', 'ᒹ', 'ᒺ', 'ᒻ', 'ᒼ', 'ᒽ', 'ᒾ', 'ᒿ', 'ᓀ', 'ᓁ', 'ᓂ', 'ᓃ', 'ᓄ', 'ᓅ', 'ᓆ', 'ᓇ', 'ᓈ', 'ᓉ', 'ᓊ', 'ᓋ', 'ᓌ', 'ᓍ', 'ᓎ', 'ᓏ', 'ᓐ', 'ᓑ', 'ᓒ', 'ᓓ', 'ᓔ', 'ᓕ', 'ᓖ', 'ᓗ', 'ᓘ', 'ᓙ', 'ᓚ', 'ᓛ', 'ᓜ', 'ᓝ', 'ᓞ', 'ᓟ', 'ᓠ', 'ᓡ', 'ᓢ', 'ᓣ', 'ᓤ', 'ᓥ', 'ᓦ', 'ᓧ', 'ᓨ', 'ᓩ', 'ᓪ', 'ᓫ', 'ᓬ', 'ᓭ', 'ᓮ', 'ᓯ', 'ᓰ', 'ᓱ', 'ᓲ', 'ᓳ', 'ᓴ', 'ᓵ', 'ᓶ', 'ᓷ', 'ᓸ', 'ᓹ', 'ᓺ', 'ᓻ', 'ᓼ', 'ᓽ', 'ᓾ', 'ᓿ', 'ᔀ', 'ᔁ', 'ᔂ', 'ᔃ', 'ᔄ', 'ᔅ', 'ᔆ', 'ᔇ', 'ᔈ', 'ᔉ', 'ᔊ', 'ᔋ', 'ᔌ', 'ᔍ', 'ᔎ', 'ᔏ', 'ᔐ', 'ᔑ', 'ᔒ', 'ᔓ', 'ᔔ', 'ᔕ', 'ᔖ', 'ᔗ', 'ᔘ', 'ᔙ', 'ᔚ', 'ᔛ', 'ᔜ', 'ᔝ', 'ᔞ', 'ᔟ', 'ᔠ', 'ᔡ', 'ᔢ', 'ᔣ', 'ᔤ', 'ᔥ', 'ᔦ', 'ᔧ', 'ᔨ', 'ᔩ', 'ᔪ', 'ᔫ', 'ᔬ', 'ᔭ', 'ᔮ', 'ᔯ', 'ᔰ', 'ᔱ', 'ᔲ', 'ᔳ', 'ᔴ', 'ᔵ', 'ᔶ', 'ᔷ', 'ᔸ', 'ᔹ', 'ᔺ', 'ᔻ', 'ᔼ', 'ᔽ', 'ᔾ', 'ᔿ', 'ᕀ', 'ᕁ', 'ᕂ', 'ᕃ', 'ᕄ', 'ᕅ', 'ᕆ', 'ᕇ', 'ᕈ', 'ᕉ', 'ᕊ', 'ᕋ', 'ᕌ', 'ᕍ', 'ᕎ', 'ᕏ', 'ᕐ', 'ᕑ', 'ᕒ', 'ᕓ', 'ᕔ', 'ᕕ', 'ᕖ', 'ᕗ', 'ᕘ', 'ᕙ', 'ᕚ', 'ᕛ', 'ᕜ', 'ᕝ', 'ᕞ', 'ᕟ', 'ᕠ', 'ᕡ', 'ᕢ', 'ᕣ', 'ᕤ', 'ᕥ', 'ᕦ', 'ᕧ', 'ᕨ', 'ᕩ', 'ᕪ', 'ᕫ', 'ᕬ', 'ᕭ', 'ᕮ', 'ᕯ', 'ᕰ', 'ᕱ', 'ᕲ', 'ᕳ', 'ᕴ', 'ᕵ', 'ᕶ', 'ᕷ', 'ᕸ', 'ᕹ', 'ᕺ', 'ᕻ', 'ᕼ', 'ᕽ', 'ᕾ', 'ᕿ', 'ᖀ', 'ᖁ', 'ᖂ', 'ᖃ', 'ᖄ', 'ᖅ', 'ᖆ', 'ᖇ', 'ᖈ', 'ᖉ', 'ᖊ', 'ᖋ', 'ᖌ', 'ᖍ', 'ᖎ', 'ᖏ', 'ᖐ', 'ᖑ', 'ᖒ', 'ᖓ', 'ᖔ', 'ᖕ', 'ᖖ', 'ᖗ', 'ᖘ', 'ᖙ', 'ᖚ', 'ᖛ', 'ᖜ', 'ᖝ', 'ᖞ', 'ᖟ', 'ᖠ', 'ᖡ', 'ᖢ', 'ᖣ', 'ᖤ', 'ᖥ', 'ᖦ', 'ᖧ', 'ᖨ', 'ᖩ', 'ᖪ', 'ᖫ', 'ᖬ', 'ᖭ', 'ᖮ', 'ᖯ', 'ᖰ', 'ᖱ', 'ᖲ', 'ᖳ', 'ᖴ', 'ᖵ', 'ᖶ', 'ᖷ', 'ᖸ', 'ᖹ', 'ᖺ', 'ᖻ', 'ᖼ', 'ᖽ', 'ᖾ', 'ᖿ', 'ᗀ', 'ᗁ', 'ᗂ', 'ᗃ', 'ᗄ', 'ᗅ', 'ᗆ', 'ᗇ', 'ᗈ', 'ᗉ', 'ᗊ', 'ᗋ', 'ᗌ', 'ᗍ', 'ᗎ', 'ᗏ', 'ᗐ', 'ᗑ', 'ᗒ', 'ᗓ', 'ᗔ', 'ᗕ', 'ᗖ', 'ᗗ', 'ᗘ', 'ᗙ', 'ᗚ', 'ᗛ', 'ᗜ', 'ᗝ', 'ᗞ', 'ᗟ', 'ᗠ', 'ᗡ', 'ᗢ', 'ᗣ', 'ᗤ', 'ᗥ', 'ᗦ', 'ᗧ', 'ᗨ', 'ᗩ', 'ᗪ', 'ᗫ', 'ᗬ', 'ᗭ', 'ᗮ', 'ᗯ', 'ᗰ', 'ᗱ', 'ᗲ', 'ᗳ', 'ᗴ', 'ᗵ', 'ᗶ', 'ᗷ', 'ᗸ', 'ᗹ', 'ᗺ', 'ᗻ', 'ᗼ', 'ᗽ', 'ᗾ', 'ᗿ', 'ᘀ', 'ᘁ', 'ᘂ', 'ᘃ', 'ᘄ', 'ᘅ', 'ᘆ', 'ᘇ', 'ᘈ', 'ᘉ', 'ᘊ', 'ᘋ', 'ᘌ', 'ᘍ', 'ᘎ', 'ᘏ', 'ᘐ', 'ᘑ', 'ᘒ', 'ᘓ', 'ᘔ', 'ᘕ', 'ᘖ', 'ᘗ', 'ᘘ', 'ᘙ', 'ᘚ', 'ᘛ', 'ᘜ', 'ᘝ', 'ᘞ', 'ᘟ', 'ᘠ', 'ᘡ', 'ᘢ', 'ᘣ', 'ᘤ', 'ᘥ', 'ᘦ', 'ᘧ', 'ᘨ', 'ᘩ', 'ᘪ', 'ᘫ', 'ᘬ', 'ᘭ', 'ᘮ', 'ᘯ', 'ᘰ', 'ᘱ', 'ᘲ', 'ᘳ', 'ᘴ', 'ᘵ', 'ᘶ', 'ᘷ', 'ᘸ', 'ᘹ', 'ᘺ', 'ᘻ', 'ᘼ', 'ᘽ', 'ᘾ', 'ᘿ', 'ᙀ', 'ᙁ', 'ᙂ', 'ᙃ', 'ᙄ', 'ᙅ', 'ᙆ', 'ᙇ', 'ᙈ', 'ᙉ', 'ᙊ', 'ᙋ', 'ᙌ', 'ᙍ', 'ᙎ', 'ᙏ', 'ᙐ', 'ᙑ', 'ᙒ', 'ᙓ', 'ᙔ', 'ᙕ', 'ᙖ', 'ᙗ', 'ᙘ', 'ᙙ', 'ᙚ', 'ᙛ', 'ᙜ', 'ᙝ', 'ᙞ', 'ᙟ', 'ᙠ', 'ᙡ', 'ᙢ', 'ᙣ', 'ᙤ', 'ᙥ', 'ᙦ', 'ᙧ', 'ᙨ', 'ᙩ', 'ᙪ', 'ᙫ', 'ᙬ', '᙭', '᙮', 'ᙯ', 'ᙰ', 'ᙱ', 'ᙲ', 'ᙳ', 'ᙴ', 'ᙵ', 'ᙶ', 'ᙷ', 'ᙸ', 'ᙹ', 'ᙺ', 'ᙻ', 'ᙼ', 'ᙽ', 'ᙾ', 'ᙿ', '\\u1680', 'ᚁ', 'ᚂ', 'ᚃ', 'ᚄ', 'ᚅ', 'ᚆ', 'ᚇ', 'ᚈ', 'ᚉ', 'ᚊ', 'ᚋ', 'ᚌ', 'ᚍ', 'ᚎ', 'ᚏ', 'ᚐ', 'ᚑ', 'ᚒ', 'ᚓ', 'ᚔ', 'ᚕ', 'ᚖ', 'ᚗ', 'ᚘ', 'ᚙ', 'ᚚ', '᚛', '᚜', '\\u169d', '\\u169e', '\\u169f', 'ᚠ', 'ᚡ', 'ᚢ', 'ᚣ', 'ᚤ', 'ᚥ', 'ᚦ', 'ᚧ', 'ᚨ', 'ᚩ', 'ᚪ', 'ᚫ', 'ᚬ', 'ᚭ', 'ᚮ', 'ᚯ', 'ᚰ', 'ᚱ', 'ᚲ', 'ᚳ', 'ᚴ', 'ᚵ', 'ᚶ', 'ᚷ', 'ᚸ', 'ᚹ', 'ᚺ', 'ᚻ', 'ᚼ', 'ᚽ', 'ᚾ', 'ᚿ', 'ᛀ', 'ᛁ', 'ᛂ', 'ᛃ', 'ᛄ', 'ᛅ', 'ᛆ', 'ᛇ', 'ᛈ', 'ᛉ', 'ᛊ', 'ᛋ', 'ᛌ', 'ᛍ', 'ᛎ', 'ᛏ', 'ᛐ', 'ᛑ', 'ᛒ', 'ᛓ', 'ᛔ', 'ᛕ', 'ᛖ', 'ᛗ', 'ᛘ', 'ᛙ', 'ᛚ', 'ᛛ', 'ᛜ', 'ᛝ', 'ᛞ', 'ᛟ', 'ᛠ', 'ᛡ', 'ᛢ', 'ᛣ', 'ᛤ', 'ᛥ', 'ᛦ', 'ᛧ', 'ᛨ', 'ᛩ', 'ᛪ', '᛫', '᛬', '᛭', 'ᛮ', 'ᛯ', 'ᛰ', 'ᛱ', 'ᛲ', 'ᛳ', 'ᛴ', 'ᛵ', 'ᛶ', 'ᛷ', 'ᛸ', '\\u16f9', '\\u16fa', '\\u16fb', '\\u16fc', '\\u16fd', '\\u16fe', '\\u16ff', 'ᜀ', 'ᜁ', 'ᜂ', 'ᜃ', 'ᜄ', 'ᜅ', 'ᜆ', 'ᜇ', 'ᜈ', 'ᜉ', 'ᜊ', 'ᜋ', 'ᜌ', '\\u170d', 'ᜎ', 'ᜏ', 'ᜐ', 'ᜑ', 'ᜒ', 'ᜓ', '᜔', '\\u1715', '\\u1716', '\\u1717', '\\u1718', '\\u1719', '\\u171a', '\\u171b', '\\u171c', '\\u171d', '\\u171e', '\\u171f', 'ᜠ', 'ᜡ', 'ᜢ', 'ᜣ', 'ᜤ', 'ᜥ', 'ᜦ', 'ᜧ', 'ᜨ', 'ᜩ', 'ᜪ', 'ᜫ', 'ᜬ', 'ᜭ', 'ᜮ', 'ᜯ', 'ᜰ', 'ᜱ', 'ᜲ', 'ᜳ', '᜴', '᜵', '᜶', '\\u1737', '\\u1738', '\\u1739', '\\u173a', '\\u173b', '\\u173c', '\\u173d', '\\u173e', '\\u173f', 'ᝀ', 'ᝁ', 'ᝂ', 'ᝃ', 'ᝄ', 'ᝅ', 'ᝆ', 'ᝇ', 'ᝈ', 'ᝉ', 'ᝊ', 'ᝋ', 'ᝌ', 'ᝍ', 'ᝎ', 'ᝏ', 'ᝐ', 'ᝑ', 'ᝒ', 'ᝓ', '\\u1754', '\\u1755', '\\u1756', '\\u1757', '\\u1758', '\\u1759', '\\u175a', '\\u175b', '\\u175c', '\\u175d', '\\u175e', '\\u175f', 'ᝠ', 'ᝡ', 'ᝢ', 'ᝣ', 'ᝤ', 'ᝥ', 'ᝦ', 'ᝧ', 'ᝨ', 'ᝩ', 'ᝪ', 'ᝫ', 'ᝬ', '\\u176d', 'ᝮ', 'ᝯ', 'ᝰ', '\\u1771', 'ᝲ', 'ᝳ', '\\u1774', '\\u1775', '\\u1776', '\\u1777', '\\u1778', '\\u1779', '\\u177a', '\\u177b', '\\u177c', '\\u177d', '\\u177e', '\\u177f', 'ក', 'ខ', 'គ', 'ឃ', 'ង', 'ច', 'ឆ', 'ជ', 'ឈ', 'ញ', 'ដ', 'ឋ', 'ឌ', 'ឍ', 'ណ', 'ត', 'ថ', 'ទ', 'ធ', 'ន', 'ប', 'ផ', 'ព', 'ភ', 'ម', 'យ', 'រ', 'ល', 'វ', 'ឝ', 'ឞ', 'ស', 'ហ', 'ឡ', 'អ', 'ឣ', 'ឤ', 'ឥ', 'ឦ', 'ឧ', 'ឨ', 'ឩ', 'ឪ', 'ឫ', 'ឬ', 'ឭ', 'ឮ', 'ឯ', 'ឰ', 'ឱ', 'ឲ', 'ឳ', '឴', '឵', 'ា', 'ិ', 'ី', 'ឹ', 'ឺ', 'ុ', 'ូ', 'ួ', 'ើ', 'ឿ', 'ៀ', 'េ', 'ែ', 'ៃ', 'ោ', 'ៅ', 'ំ', 'ះ', 'ៈ', '៉', '៊', '់', '៌', '៍', '៎', '៏', '័', '៑', '្', '៓', '។', '៕', '៖', 'ៗ', '៘', '៙', '៚', '៛', 'ៜ', '៝', '\\u17de', '\\u17df', '០', '១', '២', '៣', '៤', '៥', '៦', '៧', '៨', '៩', '\\u17ea', '\\u17eb', '\\u17ec', '\\u17ed', '\\u17ee', '\\u17ef', '៰', '៱', '៲', '៳', '៴', '៵', '៶', '៷', '៸', '៹', '\\u17fa', '\\u17fb', '\\u17fc', '\\u17fd', '\\u17fe', '\\u17ff', '᠀', '᠁', '᠂', '᠃', '᠄', '᠅', '᠆', '᠇', '᠈', '᠉', '᠊', '᠋', '᠌', '᠍', '\\u180e', '\\u180f', '᠐', '᠑', '᠒', '᠓', '᠔', '᠕', '᠖', '᠗', '᠘', '᠙', '\\u181a', '\\u181b', '\\u181c', '\\u181d', '\\u181e', '\\u181f', 'ᠠ', 'ᠡ', 'ᠢ', 'ᠣ', 'ᠤ', 'ᠥ', 'ᠦ', 'ᠧ', 'ᠨ', 'ᠩ', 'ᠪ', 'ᠫ', 'ᠬ', 'ᠭ', 'ᠮ', 'ᠯ', 'ᠰ', 'ᠱ', 'ᠲ', 'ᠳ', 'ᠴ', 'ᠵ', 'ᠶ', 'ᠷ', 'ᠸ', 'ᠹ', 'ᠺ', 'ᠻ', 'ᠼ', 'ᠽ', 'ᠾ', 'ᠿ', 'ᡀ', 'ᡁ', 'ᡂ', 'ᡃ', 'ᡄ', 'ᡅ', 'ᡆ', 'ᡇ', 'ᡈ', 'ᡉ', 'ᡊ', 'ᡋ', 'ᡌ', 'ᡍ', 'ᡎ', 'ᡏ', 'ᡐ', 'ᡑ', 'ᡒ', 'ᡓ', 'ᡔ', 'ᡕ', 'ᡖ', 'ᡗ', 'ᡘ', 'ᡙ', 'ᡚ', 'ᡛ', 'ᡜ', 'ᡝ', 'ᡞ', 'ᡟ', 'ᡠ', 'ᡡ', 'ᡢ', 'ᡣ', 'ᡤ', 'ᡥ', 'ᡦ', 'ᡧ', 'ᡨ', 'ᡩ', 'ᡪ', 'ᡫ', 'ᡬ', 'ᡭ', 'ᡮ', 'ᡯ', 'ᡰ', 'ᡱ', 'ᡲ', 'ᡳ', 'ᡴ', 'ᡵ', 'ᡶ', 'ᡷ', '\\u1878', '\\u1879', '\\u187a', '\\u187b', '\\u187c', '\\u187d', '\\u187e', '\\u187f', 'ᢀ', 'ᢁ', 'ᢂ', 'ᢃ', 'ᢄ', 'ᢅ', 'ᢆ', 'ᢇ', 'ᢈ', 'ᢉ', 'ᢊ', 'ᢋ', 'ᢌ', 'ᢍ', 'ᢎ', 'ᢏ', 'ᢐ', 'ᢑ', 'ᢒ', 'ᢓ', 'ᢔ', 'ᢕ', 'ᢖ', 'ᢗ', 'ᢘ', 'ᢙ', 'ᢚ', 'ᢛ', 'ᢜ', 'ᢝ', 'ᢞ', 'ᢟ', 'ᢠ', 'ᢡ', 'ᢢ', 'ᢣ', 'ᢤ', 'ᢥ', 'ᢦ', 'ᢧ', 'ᢨ', 'ᢩ', 'ᢪ', '\\u18ab', '\\u18ac', '\\u18ad', '\\u18ae', '\\u18af', 'ᢰ', 'ᢱ', 'ᢲ', 'ᢳ', 'ᢴ', 'ᢵ', 'ᢶ', 'ᢷ', 'ᢸ', 'ᢹ', 'ᢺ', 'ᢻ', 'ᢼ', 'ᢽ', 'ᢾ', 'ᢿ', 'ᣀ', 'ᣁ', 'ᣂ', 'ᣃ', 'ᣄ', 'ᣅ', 'ᣆ', 'ᣇ', 'ᣈ', 'ᣉ', 'ᣊ', 'ᣋ', 'ᣌ', 'ᣍ', 'ᣎ', 'ᣏ', 'ᣐ', 'ᣑ', 'ᣒ', 'ᣓ', 'ᣔ', 'ᣕ', 'ᣖ', 'ᣗ', 'ᣘ', 'ᣙ', 'ᣚ', 'ᣛ', 'ᣜ', 'ᣝ', 'ᣞ', 'ᣟ', 'ᣠ', 'ᣡ', 'ᣢ', 'ᣣ', 'ᣤ', 'ᣥ', 'ᣦ', 'ᣧ', 'ᣨ', 'ᣩ', 'ᣪ', 'ᣫ', 'ᣬ', 'ᣭ', 'ᣮ', 'ᣯ', 'ᣰ', 'ᣱ', 'ᣲ', 'ᣳ', 'ᣴ', 'ᣵ', '\\u18f6', '\\u18f7', '\\u18f8', '\\u18f9', '\\u18fa', '\\u18fb', '\\u18fc', '\\u18fd', '\\u18fe', '\\u18ff', 'ᤀ', 'ᤁ', 'ᤂ', 'ᤃ', 'ᤄ', 'ᤅ', 'ᤆ', 'ᤇ', 'ᤈ', 'ᤉ', 'ᤊ', 'ᤋ', 'ᤌ', 'ᤍ', 'ᤎ', 'ᤏ', 'ᤐ', 'ᤑ', 'ᤒ', 'ᤓ', 'ᤔ', 'ᤕ', 'ᤖ', 'ᤗ', 'ᤘ', 'ᤙ', 'ᤚ', 'ᤛ', 'ᤜ', 'ᤝ', 'ᤞ', '\\u191f', 'ᤠ', 'ᤡ', 'ᤢ', 'ᤣ', 'ᤤ', 'ᤥ', 'ᤦ', 'ᤧ', 'ᤨ', 'ᤩ', 'ᤪ', 'ᤫ', '\\u192c', '\\u192d', '\\u192e', '\\u192f', 'ᤰ', 'ᤱ', 'ᤲ', 'ᤳ', 'ᤴ', 'ᤵ', 'ᤶ', 'ᤷ', 'ᤸ', '᤹', '᤺', '᤻', '\\u193c', '\\u193d', '\\u193e', '\\u193f', '᥀', '\\u1941', '\\u1942', '\\u1943', '᥄', '᥅', '᥆', '᥇', '᥈', '᥉', '᥊', '᥋', '᥌', '᥍', '᥎', '᥏', 'ᥐ', 'ᥑ', 'ᥒ', 'ᥓ', 'ᥔ', 'ᥕ', 'ᥖ', 'ᥗ', 'ᥘ', 'ᥙ', 'ᥚ', 'ᥛ', 'ᥜ', 'ᥝ', 'ᥞ', 'ᥟ', 'ᥠ', 'ᥡ', 'ᥢ', 'ᥣ', 'ᥤ', 'ᥥ', 'ᥦ', 'ᥧ', 'ᥨ', 'ᥩ', 'ᥪ', 'ᥫ', 'ᥬ', 'ᥭ', '\\u196e', '\\u196f', 'ᥰ', 'ᥱ', 'ᥲ', 'ᥳ', 'ᥴ', '\\u1975', '\\u1976', '\\u1977', '\\u1978', '\\u1979', '\\u197a', '\\u197b', '\\u197c', '\\u197d', '\\u197e', '\\u197f', 'ᦀ', 'ᦁ', 'ᦂ', 'ᦃ', 'ᦄ', 'ᦅ', 'ᦆ', 'ᦇ', 'ᦈ', 'ᦉ', 'ᦊ', 'ᦋ', 'ᦌ', 'ᦍ', 'ᦎ', 'ᦏ', 'ᦐ', 'ᦑ', 'ᦒ', 'ᦓ', 'ᦔ', 'ᦕ', 'ᦖ', 'ᦗ', 'ᦘ', 'ᦙ', 'ᦚ', 'ᦛ', 'ᦜ', 'ᦝ', 'ᦞ', 'ᦟ', 'ᦠ', 'ᦡ', 'ᦢ', 'ᦣ', 'ᦤ', 'ᦥ', 'ᦦ', 'ᦧ', 'ᦨ', 'ᦩ', 'ᦪ', 'ᦫ', '\\u19ac', '\\u19ad', '\\u19ae', '\\u19af', 'ᦰ', 'ᦱ', 'ᦲ', 'ᦳ', 'ᦴ', 'ᦵ', 'ᦶ', 'ᦷ', 'ᦸ', 'ᦹ', 'ᦺ', 'ᦻ', 'ᦼ', 'ᦽ', 'ᦾ', 'ᦿ', 'ᧀ', 'ᧁ', 'ᧂ', 'ᧃ', 'ᧄ', 'ᧅ', 'ᧆ', 'ᧇ', 'ᧈ', 'ᧉ', '\\u19ca', '\\u19cb', '\\u19cc', '\\u19cd', '\\u19ce', '\\u19cf', '᧐', '᧑', '᧒', '᧓', '᧔', '᧕', '᧖', '᧗', '᧘', '᧙', '᧚', '\\u19db', '\\u19dc', '\\u19dd', '᧞', '᧟', '᧠', '᧡', '᧢', '᧣', '᧤', '᧥', '᧦', '᧧', '᧨', '᧩', '᧪', '᧫', '᧬', '᧭', '᧮', '᧯', '᧰', '᧱', '᧲', '᧳', '᧴', '᧵', '᧶', '᧷', '᧸', '᧹', '᧺', '᧻', '᧼', '᧽', '᧾', '᧿', 'ᨀ', 'ᨁ', 'ᨂ', 'ᨃ', 'ᨄ', 'ᨅ', 'ᨆ', 'ᨇ', 'ᨈ', 'ᨉ', 'ᨊ', 'ᨋ', 'ᨌ', 'ᨍ', 'ᨎ', 'ᨏ', 'ᨐ', 'ᨑ', 'ᨒ', 'ᨓ', 'ᨔ', 'ᨕ', 'ᨖ', 'ᨗ', 'ᨘ', 'ᨙ', 'ᨚ', 'ᨛ', '\\u1a1c', '\\u1a1d', '᨞', '᨟', 'ᨠ', 'ᨡ', 'ᨢ', 'ᨣ', 'ᨤ', 'ᨥ', 'ᨦ', 'ᨧ', 'ᨨ', 'ᨩ', 'ᨪ', 'ᨫ', 'ᨬ', 'ᨭ', 'ᨮ', 'ᨯ', 'ᨰ', 'ᨱ', 'ᨲ', 'ᨳ', 'ᨴ', 'ᨵ', 'ᨶ', 'ᨷ', 'ᨸ', 'ᨹ', 'ᨺ', 'ᨻ', 'ᨼ', 'ᨽ', 'ᨾ', 'ᨿ', 'ᩀ', 'ᩁ', 'ᩂ', 'ᩃ', 'ᩄ', 'ᩅ', 'ᩆ', 'ᩇ', 'ᩈ', 'ᩉ', 'ᩊ', 'ᩋ', 'ᩌ', 'ᩍ', 'ᩎ', 'ᩏ', 'ᩐ', 'ᩑ', 'ᩒ', 'ᩓ', 'ᩔ', 'ᩕ', 'ᩖ', 'ᩗ', 'ᩘ', 'ᩙ', 'ᩚ', 'ᩛ', 'ᩜ', 'ᩝ', 'ᩞ', '\\u1a5f', '᩠', 'ᩡ', 'ᩢ', 'ᩣ', 'ᩤ', 'ᩥ', 'ᩦ', 'ᩧ', 'ᩨ', 'ᩩ', 'ᩪ', 'ᩫ', 'ᩬ', 'ᩭ', 'ᩮ', 'ᩯ', 'ᩰ', 'ᩱ', 'ᩲ', 'ᩳ', 'ᩴ', '᩵', '᩶', '᩷', '᩸', '᩹', '᩺', '᩻', '᩼', '\\u1a7d', '\\u1a7e', '᩿', '᪀', '᪁', '᪂', '᪃', '᪄', '᪅', '᪆', '᪇', '᪈', '᪉', '\\u1a8a', '\\u1a8b', '\\u1a8c', '\\u1a8d', '\\u1a8e', '\\u1a8f', '᪐', '᪑', '᪒', '᪓', '᪔', '᪕', '᪖', '᪗', '᪘', '᪙', '\\u1a9a', '\\u1a9b', '\\u1a9c', '\\u1a9d', '\\u1a9e', '\\u1a9f', '᪠', '᪡', '᪢', '᪣', '᪤', '᪥', '᪦', 'ᪧ', '᪨', '᪩', '᪪', '᪫', '᪬', '᪭', '\\u1aae', '\\u1aaf', '᪰', '᪱', '᪲', '᪳', '᪴', '᪵', '᪶', '᪷', '᪸', '᪹', '᪺', '᪻', '᪼', '᪽', '᪾', '\\u1abf', '\\u1ac0', '\\u1ac1', '\\u1ac2', '\\u1ac3', '\\u1ac4', '\\u1ac5', '\\u1ac6', '\\u1ac7', '\\u1ac8', '\\u1ac9', '\\u1aca', '\\u1acb', '\\u1acc', '\\u1acd', '\\u1ace', '\\u1acf', '\\u1ad0', '\\u1ad1', '\\u1ad2', '\\u1ad3', '\\u1ad4', '\\u1ad5', '\\u1ad6', '\\u1ad7', '\\u1ad8', '\\u1ad9', '\\u1ada', '\\u1adb', '\\u1adc', '\\u1add', '\\u1ade', '\\u1adf', '\\u1ae0', '\\u1ae1', '\\u1ae2', '\\u1ae3', '\\u1ae4', '\\u1ae5', '\\u1ae6', '\\u1ae7', '\\u1ae8', '\\u1ae9', '\\u1aea', '\\u1aeb', '\\u1aec', '\\u1aed', '\\u1aee', '\\u1aef', '\\u1af0', '\\u1af1', '\\u1af2', '\\u1af3', '\\u1af4', '\\u1af5', '\\u1af6', '\\u1af7', '\\u1af8', '\\u1af9', '\\u1afa', '\\u1afb', '\\u1afc', '\\u1afd', '\\u1afe', '\\u1aff', 'ᬀ', 'ᬁ', 'ᬂ', 'ᬃ', 'ᬄ', 'ᬅ', 'ᬆ', 'ᬇ', 'ᬈ', 'ᬉ', 'ᬊ', 'ᬋ', 'ᬌ', 'ᬍ', 'ᬎ', 'ᬏ', 'ᬐ', 'ᬑ', 'ᬒ', 'ᬓ', 'ᬔ', 'ᬕ', 'ᬖ', 'ᬗ', 'ᬘ', 'ᬙ', 'ᬚ', 'ᬛ', 'ᬜ', 'ᬝ', 'ᬞ', 'ᬟ', 'ᬠ', 'ᬡ', 'ᬢ', 'ᬣ', 'ᬤ', 'ᬥ', 'ᬦ', 'ᬧ', 'ᬨ', 'ᬩ', 'ᬪ', 'ᬫ', 'ᬬ', 'ᬭ', 'ᬮ', 'ᬯ', 'ᬰ', 'ᬱ', 'ᬲ', 'ᬳ', '᬴', 'ᬵ', 'ᬶ', 'ᬷ', 'ᬸ', 'ᬹ', 'ᬺ', 'ᬻ', 'ᬼ', 'ᬽ', 'ᬾ', 'ᬿ', 'ᭀ', 'ᭁ', 'ᭂ', 'ᭃ', '᭄', 'ᭅ', 'ᭆ', 'ᭇ', 'ᭈ', 'ᭉ', 'ᭊ', 'ᭋ', '\\u1b4c', '\\u1b4d', '\\u1b4e', '\\u1b4f', '᭐', '᭑', '᭒', '᭓', '᭔', '᭕', '᭖', '᭗', '᭘', '᭙', '᭚', '᭛', '᭜', '᭝', '᭞', '᭟', '᭠', '᭡', '᭢', '᭣', '᭤', '᭥', '᭦', '᭧', '᭨', '᭩', '᭪', '᭫', '᭬', '᭭', '᭮', '᭯', '᭰', '᭱', '᭲', '᭳', '᭴', '᭵', '᭶', '᭷', '᭸', '᭹', '᭺', '᭻', '᭼', '\\u1b7d', '\\u1b7e', '\\u1b7f', 'ᮀ', 'ᮁ', 'ᮂ', 'ᮃ', 'ᮄ', 'ᮅ', 'ᮆ', 'ᮇ', 'ᮈ', 'ᮉ', 'ᮊ', 'ᮋ', 'ᮌ', 'ᮍ', 'ᮎ', 'ᮏ', 'ᮐ', 'ᮑ', 'ᮒ', 'ᮓ', 'ᮔ', 'ᮕ', 'ᮖ', 'ᮗ', 'ᮘ', 'ᮙ', 'ᮚ', 'ᮛ', 'ᮜ', 'ᮝ', 'ᮞ', 'ᮟ', 'ᮠ', 'ᮡ', 'ᮢ', 'ᮣ', 'ᮤ', 'ᮥ', 'ᮦ', 'ᮧ', 'ᮨ', 'ᮩ', '᮪', '᮫', 'ᮬ', 'ᮭ', 'ᮮ', 'ᮯ', '᮰', '᮱', '᮲', '᮳', '᮴', '᮵', '᮶', '᮷', '᮸', '᮹', 'ᮺ', 'ᮻ', 'ᮼ', 'ᮽ', 'ᮾ', 'ᮿ', 'ᯀ', 'ᯁ', 'ᯂ', 'ᯃ', 'ᯄ', 'ᯅ', 'ᯆ', 'ᯇ', 'ᯈ', 'ᯉ', 'ᯊ', 'ᯋ', 'ᯌ', 'ᯍ', 'ᯎ', 'ᯏ', 'ᯐ', 'ᯑ', 'ᯒ', 'ᯓ', 'ᯔ', 'ᯕ', 'ᯖ', 'ᯗ', 'ᯘ', 'ᯙ', 'ᯚ', 'ᯛ', 'ᯜ', 'ᯝ', 'ᯞ', 'ᯟ', 'ᯠ', 'ᯡ', 'ᯢ', 'ᯣ', 'ᯤ', 'ᯥ', '᯦', 'ᯧ', 'ᯨ', 'ᯩ', 'ᯪ', 'ᯫ', 'ᯬ', 'ᯭ', 'ᯮ', 'ᯯ', 'ᯰ', 'ᯱ', '᯲', '᯳', '\\u1bf4', '\\u1bf5', '\\u1bf6', '\\u1bf7', '\\u1bf8', '\\u1bf9', '\\u1bfa', '\\u1bfb', '᯼', '᯽', '᯾', '᯿', 'ᰀ', 'ᰁ', 'ᰂ', 'ᰃ', 'ᰄ', 'ᰅ', 'ᰆ', 'ᰇ', 'ᰈ', 'ᰉ', 'ᰊ', 'ᰋ', 'ᰌ', 'ᰍ', 'ᰎ', 'ᰏ', 'ᰐ', 'ᰑ', 'ᰒ', 'ᰓ', 'ᰔ', 'ᰕ', 'ᰖ', 'ᰗ', 'ᰘ', 'ᰙ', 'ᰚ', 'ᰛ', 'ᰜ', 'ᰝ', 'ᰞ', 'ᰟ', 'ᰠ', 'ᰡ', 'ᰢ', 'ᰣ', 'ᰤ', 'ᰥ', 'ᰦ', 'ᰧ', 'ᰨ', 'ᰩ', 'ᰪ', 'ᰫ', 'ᰬ', 'ᰭ', 'ᰮ', 'ᰯ', 'ᰰ', 'ᰱ', 'ᰲ', 'ᰳ', 'ᰴ', 'ᰵ', 'ᰶ', '᰷', '\\u1c38', '\\u1c39', '\\u1c3a', '᰻', '᰼', '᰽', '᰾', '᰿', '᱀', '᱁', '᱂', '᱃', '᱄', '᱅', '᱆', '᱇', '᱈', '᱉', '\\u1c4a', '\\u1c4b', '\\u1c4c', 'ᱍ', 'ᱎ', 'ᱏ', '᱐', '᱑', '᱒', '᱓', '᱔', '᱕', '᱖', '᱗', '᱘', '᱙', 'ᱚ', 'ᱛ', 'ᱜ', 'ᱝ', 'ᱞ', 'ᱟ', 'ᱠ', 'ᱡ', 'ᱢ', 'ᱣ', 'ᱤ', 'ᱥ', 'ᱦ', 'ᱧ', 'ᱨ', 'ᱩ', 'ᱪ', 'ᱫ', 'ᱬ', 'ᱭ', 'ᱮ', 'ᱯ', 'ᱰ', 'ᱱ', 'ᱲ', 'ᱳ', 'ᱴ', 'ᱵ', 'ᱶ', 'ᱷ', 'ᱸ', 'ᱹ', 'ᱺ', 'ᱻ', 'ᱼ', 'ᱽ', '᱾', '᱿', 'ᲀ', 'ᲁ', 'ᲂ', 'ᲃ', 'ᲄ', 'ᲅ', 'ᲆ', 'ᲇ', 'ᲈ', '\\u1c89', '\\u1c8a', '\\u1c8b', '\\u1c8c', '\\u1c8d', '\\u1c8e', '\\u1c8f', '\\u1c90', '\\u1c91', '\\u1c92', '\\u1c93', '\\u1c94', '\\u1c95', '\\u1c96', '\\u1c97', '\\u1c98', '\\u1c99', '\\u1c9a', '\\u1c9b', '\\u1c9c', '\\u1c9d', '\\u1c9e', '\\u1c9f', '\\u1ca0', '\\u1ca1', '\\u1ca2', '\\u1ca3', '\\u1ca4', '\\u1ca5', '\\u1ca6', '\\u1ca7', '\\u1ca8', '\\u1ca9', '\\u1caa', '\\u1cab', '\\u1cac', '\\u1cad', '\\u1cae', '\\u1caf', '\\u1cb0', '\\u1cb1', '\\u1cb2', '\\u1cb3', '\\u1cb4', '\\u1cb5', '\\u1cb6', '\\u1cb7', '\\u1cb8', '\\u1cb9', '\\u1cba', '\\u1cbb', '\\u1cbc', '\\u1cbd', '\\u1cbe', '\\u1cbf', '᳀', '᳁', '᳂', '᳃', '᳄', '᳅', '᳆', '᳇', '\\u1cc8', '\\u1cc9', '\\u1cca', '\\u1ccb', '\\u1ccc', '\\u1ccd', '\\u1cce', '\\u1ccf', '᳐', '᳑', '᳒', '᳓', '᳔', '᳕', '᳖', '᳗', '᳘', '᳙', '᳚', '᳛', '᳜', '᳝', '᳞', '᳟', '᳠', '᳡', '᳢', '᳣', '᳤', '᳥', '᳦', '᳧', '᳨', 'ᳩ', 'ᳪ', 'ᳫ', 'ᳬ', '᳭', 'ᳮ', 'ᳯ', 'ᳰ', 'ᳱ', 'ᳲ', 'ᳳ', '᳴', 'ᳵ', 'ᳶ', '\\u1cf7', '᳸', '᳹', '\\u1cfa', '\\u1cfb', '\\u1cfc', '\\u1cfd', '\\u1cfe', '\\u1cff', 'ᴀ', 'ᴁ', 'ᴂ', 'ᴃ', 'ᴄ', 'ᴅ', 'ᴆ', 'ᴇ', 'ᴈ', 'ᴉ', 'ᴊ', 'ᴋ', 'ᴌ', 'ᴍ', 'ᴎ', 'ᴏ', 'ᴐ', 'ᴑ', 'ᴒ', 'ᴓ', 'ᴔ', 'ᴕ', 'ᴖ', 'ᴗ', 'ᴘ', 'ᴙ', 'ᴚ', 'ᴛ', 'ᴜ', 'ᴝ', 'ᴞ', 'ᴟ', 'ᴠ', 'ᴡ', 'ᴢ', 'ᴣ', 'ᴤ', 'ᴥ', 'ᴦ', 'ᴧ', 'ᴨ', 'ᴩ', 'ᴪ', 'ᴫ', 'ᴬ', 'ᴭ', 'ᴮ', 'ᴯ', 'ᴰ', 'ᴱ', 'ᴲ', 'ᴳ', 'ᴴ', 'ᴵ', 'ᴶ', 'ᴷ', 'ᴸ', 'ᴹ', 'ᴺ', 'ᴻ', 'ᴼ', 'ᴽ', 'ᴾ', 'ᴿ', 'ᵀ', 'ᵁ', 'ᵂ', 'ᵃ', 'ᵄ', 'ᵅ', 'ᵆ', 'ᵇ', 'ᵈ', 'ᵉ', 'ᵊ', 'ᵋ', 'ᵌ', 'ᵍ', 'ᵎ', 'ᵏ', 'ᵐ', 'ᵑ', 'ᵒ', 'ᵓ', 'ᵔ', 'ᵕ', 'ᵖ', 'ᵗ', 'ᵘ', 'ᵙ', 'ᵚ', 'ᵛ', 'ᵜ', 'ᵝ', 'ᵞ', 'ᵟ', 'ᵠ', 'ᵡ', 'ᵢ', 'ᵣ', 'ᵤ', 'ᵥ', 'ᵦ', 'ᵧ', 'ᵨ', 'ᵩ', 'ᵪ', 'ᵫ', 'ᵬ', 'ᵭ', 'ᵮ', 'ᵯ', 'ᵰ', 'ᵱ', 'ᵲ', 'ᵳ', 'ᵴ', 'ᵵ', 'ᵶ', 'ᵷ', 'ᵸ', 'ᵹ', 'ᵺ', 'ᵻ', 'ᵼ', 'ᵽ', 'ᵾ', 'ᵿ', 'ᶀ', 'ᶁ', 'ᶂ', 'ᶃ', 'ᶄ', 'ᶅ', 'ᶆ', 'ᶇ', 'ᶈ', 'ᶉ', 'ᶊ', 'ᶋ', 'ᶌ', 'ᶍ', 'ᶎ', 'ᶏ', 'ᶐ', 'ᶑ', 'ᶒ', 'ᶓ', 'ᶔ', 'ᶕ', 'ᶖ', 'ᶗ', 'ᶘ', 'ᶙ', 'ᶚ', 'ᶛ', 'ᶜ', 'ᶝ', 'ᶞ', 'ᶟ', 'ᶠ', 'ᶡ', 'ᶢ', 'ᶣ', 'ᶤ', 'ᶥ', 'ᶦ', 'ᶧ', 'ᶨ', 'ᶩ', 'ᶪ', 'ᶫ', 'ᶬ', 'ᶭ', 'ᶮ', 'ᶯ', 'ᶰ', 'ᶱ', 'ᶲ', 'ᶳ', 'ᶴ', 'ᶵ', 'ᶶ', 'ᶷ', 'ᶸ', 'ᶹ', 'ᶺ', 'ᶻ', 'ᶼ', 'ᶽ', 'ᶾ', 'ᶿ', '᷀', '᷁', '᷂', '᷃', '᷄', '᷅', '᷆', '᷇', '᷈', '᷉', '᷊', '᷋', '᷌', '᷍', '᷎', '᷏', '᷐', '᷑', '᷒', 'ᷓ', 'ᷔ', 'ᷕ', 'ᷖ', 'ᷗ', 'ᷘ', 'ᷙ', 'ᷚ', 'ᷛ', 'ᷜ', 'ᷝ', 'ᷞ', 'ᷟ', 'ᷠ', 'ᷡ', 'ᷢ', 'ᷣ', 'ᷤ', 'ᷥ', 'ᷦ', 'ᷧ', 'ᷨ', 'ᷩ', 'ᷪ', 'ᷫ', 'ᷬ', 'ᷭ', 'ᷮ', 'ᷯ', 'ᷰ', 'ᷱ', 'ᷲ', 'ᷳ', 'ᷴ', '᷵', '\\u1df6', '\\u1df7', '\\u1df8', '\\u1df9', '\\u1dfa', '᷻', '᷼', '᷽', '᷾', '᷿', 'Ḁ', 'ḁ', 'Ḃ', 'ḃ', 'Ḅ', 'ḅ', 'Ḇ', 'ḇ', 'Ḉ', 'ḉ', 'Ḋ', 'ḋ', 'Ḍ', 'ḍ', 'Ḏ', 'ḏ', 'Ḑ', 'ḑ', 'Ḓ', 'ḓ', 'Ḕ', 'ḕ', 'Ḗ', 'ḗ', 'Ḙ', 'ḙ', 'Ḛ', 'ḛ', 'Ḝ', 'ḝ', 'Ḟ', 'ḟ', 'Ḡ', 'ḡ', 'Ḣ', 'ḣ', 'Ḥ', 'ḥ', 'Ḧ', 'ḧ', 'Ḩ', 'ḩ', 'Ḫ', 'ḫ', 'Ḭ', 'ḭ', 'Ḯ', 'ḯ', 'Ḱ', 'ḱ', 'Ḳ', 'ḳ', 'Ḵ', 'ḵ', 'Ḷ', 'ḷ', 'Ḹ', 'ḹ', 'Ḻ', 'ḻ', 'Ḽ', 'ḽ', 'Ḿ', 'ḿ', 'Ṁ', 'ṁ', 'Ṃ', 'ṃ', 'Ṅ', 'ṅ', 'Ṇ', 'ṇ', 'Ṉ', 'ṉ', 'Ṋ', 'ṋ', 'Ṍ', 'ṍ', 'Ṏ', 'ṏ', 'Ṑ', 'ṑ', 'Ṓ', 'ṓ', 'Ṕ', 'ṕ', 'Ṗ', 'ṗ', 'Ṙ', 'ṙ', 'Ṛ', 'ṛ', 'Ṝ', 'ṝ', 'Ṟ', 'ṟ', 'Ṡ', 'ṡ', 'Ṣ', 'ṣ', 'Ṥ', 'ṥ', 'Ṧ', 'ṧ', 'Ṩ', 'ṩ', 'Ṫ', 'ṫ', 'Ṭ', 'ṭ', 'Ṯ', 'ṯ', 'Ṱ', 'ṱ', 'Ṳ', 'ṳ', 'Ṵ', 'ṵ', 'Ṷ', 'ṷ', 'Ṹ', 'ṹ', 'Ṻ', 'ṻ', 'Ṽ', 'ṽ', 'Ṿ', 'ṿ', 'Ẁ', 'ẁ', 'Ẃ', 'ẃ', 'Ẅ', 'ẅ', 'Ẇ', 'ẇ', 'Ẉ', 'ẉ', 'Ẋ', 'ẋ', 'Ẍ', 'ẍ', 'Ẏ', 'ẏ', 'Ẑ', 'ẑ', 'Ẓ', 'ẓ', 'Ẕ', 'ẕ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ẛ', 'ẜ', 'ẝ', 'ẞ', 'ẟ', 'Ạ', 'ạ', 'Ả', 'ả', 'Ấ', 'ấ', 'Ầ', 'ầ', 'Ẩ', 'ẩ', 'Ẫ', 'ẫ', 'Ậ', 'ậ', 'Ắ', 'ắ', 'Ằ', 'ằ', 'Ẳ', 'ẳ', 'Ẵ', 'ẵ', 'Ặ', 'ặ', 'Ẹ', 'ẹ', 'Ẻ', 'ẻ', 'Ẽ', 'ẽ', 'Ế', 'ế', 'Ề', 'ề', 'Ể', 'ể', 'Ễ', 'ễ', 'Ệ', 'ệ', 'Ỉ', 'ỉ', 'Ị', 'ị', 'Ọ', 'ọ', 'Ỏ', 'ỏ', 'Ố', 'ố', 'Ồ', 'ồ', 'Ổ', 'ổ', 'Ỗ', 'ỗ', 'Ộ', 'ộ', 'Ớ', 'ớ', 'Ờ', 'ờ', 'Ở', 'ở', 'Ỡ', 'ỡ', 'Ợ', 'ợ', 'Ụ', 'ụ', 'Ủ', 'ủ', 'Ứ', 'ứ', 'Ừ', 'ừ', 'Ử', 'ử', 'Ữ', 'ữ', 'Ự', 'ự', 'Ỳ', 'ỳ', 'Ỵ', 'ỵ', 'Ỷ', 'ỷ', 'Ỹ', 'ỹ', 'Ỻ', 'ỻ', 'Ỽ', 'ỽ', 'Ỿ', 'ỿ', 'ἀ', 'ἁ', 'ἂ', 'ἃ', 'ἄ', 'ἅ', 'ἆ', 'ἇ', 'Ἀ', 'Ἁ', 'Ἂ', 'Ἃ', 'Ἄ', 'Ἅ', 'Ἆ', 'Ἇ', 'ἐ', 'ἑ', 'ἒ', 'ἓ', 'ἔ', 'ἕ', '\\u1f16', '\\u1f17', 'Ἐ', 'Ἑ', 'Ἒ', 'Ἓ', 'Ἔ', 'Ἕ', '\\u1f1e', '\\u1f1f', 'ἠ', 'ἡ', 'ἢ', 'ἣ', 'ἤ', 'ἥ', 'ἦ', 'ἧ', 'Ἠ', 'Ἡ', 'Ἢ', 'Ἣ', 'Ἤ', 'Ἥ', 'Ἦ', 'Ἧ', 'ἰ', 'ἱ', 'ἲ', 'ἳ', 'ἴ', 'ἵ', 'ἶ', 'ἷ', 'Ἰ', 'Ἱ', 'Ἲ', 'Ἳ', 'Ἴ', 'Ἵ', 'Ἶ', 'Ἷ', 'ὀ', 'ὁ', 'ὂ', 'ὃ', 'ὄ', 'ὅ', '\\u1f46', '\\u1f47', 'Ὀ', 'Ὁ', 'Ὂ', 'Ὃ', 'Ὄ', 'Ὅ', '\\u1f4e', '\\u1f4f', 'ὐ', 'ὑ', 'ὒ', 'ὓ', 'ὔ', 'ὕ', 'ὖ', 'ὗ', '\\u1f58', 'Ὑ', '\\u1f5a', 'Ὓ', '\\u1f5c', 'Ὕ', '\\u1f5e', 'Ὗ', 'ὠ', 'ὡ', 'ὢ', 'ὣ', 'ὤ', 'ὥ', 'ὦ', 'ὧ', 'Ὠ', 'Ὡ', 'Ὢ', 'Ὣ', 'Ὤ', 'Ὥ', 'Ὦ', 'Ὧ', 'ὰ', 'ά', 'ὲ', 'έ', 'ὴ', 'ή', 'ὶ', 'ί', 'ὸ', 'ό', 'ὺ', 'ύ', 'ὼ', 'ώ', '\\u1f7e', '\\u1f7f', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'ᾐ', 'ᾑ', 'ᾒ', 'ᾓ', 'ᾔ', 'ᾕ', 'ᾖ', 'ᾗ', 'ᾘ', 'ᾙ', 'ᾚ', 'ᾛ', 'ᾜ', 'ᾝ', 'ᾞ', 'ᾟ', 'ᾠ', 'ᾡ', 'ᾢ', 'ᾣ', 'ᾤ', 'ᾥ', 'ᾦ', 'ᾧ', 'ᾨ', 'ᾩ', 'ᾪ', 'ᾫ', 'ᾬ', 'ᾭ', 'ᾮ', 'ᾯ', 'ᾰ', 'ᾱ', 'ᾲ', 'ᾳ', 'ᾴ', '\\u1fb5', 'ᾶ', 'ᾷ', 'Ᾰ', 'Ᾱ', 'Ὰ', 'Ά', 'ᾼ', '᾽', 'ι', '᾿', '῀', '῁', 'ῂ', 'ῃ', 'ῄ', '\\u1fc5', 'ῆ', 'ῇ', 'Ὲ', 'Έ', 'Ὴ', 'Ή', 'ῌ', '῍', '῎', '῏', 'ῐ', 'ῑ', 'ῒ', 'ΐ', '\\u1fd4', '\\u1fd5', 'ῖ', 'ῗ', 'Ῐ', 'Ῑ', 'Ὶ', 'Ί', '\\u1fdc', '῝', '῞', '῟', 'ῠ', 'ῡ', 'ῢ', 'ΰ', 'ῤ', 'ῥ', 'ῦ', 'ῧ', 'Ῠ', 'Ῡ', 'Ὺ', 'Ύ', 'Ῥ', '῭', '΅', '`', '\\u1ff0', '\\u1ff1', 'ῲ', 'ῳ', 'ῴ', '\\u1ff5', 'ῶ', 'ῷ', 'Ὸ', 'Ό', 'Ὼ', 'Ώ', 'ῼ', '´', '῾', '\\u1fff', '\\u2000', '\\u2001', '\\u2002', '\\u2003', '\\u2004', '\\u2005', '\\u2006', '\\u2007', '\\u2008', '\\u2009', '\\u200a', '\\u200b', '\\u200c', '\\u200d', '\\u200e', '\\u200f', '‐', '‑', '‒', '–', '—', '―', '‖', '‗', '‘', '’', '‚', '‛', '“', '”', '„', '‟', '†', '‡', '•', '‣', '․', '‥', '…', '‧', '\\u2028', '\\u2029', '\\u202a', '\\u202b', '\\u202c', '\\u202d', '\\u202e', '\\u202f', '‰', '‱', '′', '″', '‴', '‵', '‶', '‷', '‸', '‹', '›', '※', '‼', '‽', '‾', '‿', '⁀', '⁁', '⁂', '⁃', '⁄', '⁅', '⁆', '⁇', '⁈', '⁉', '⁊', '⁋', '⁌', '⁍', '⁎', '⁏', '⁐', '⁑', '⁒', '⁓', '⁔', '⁕', '⁖', '⁗', '⁘', '⁙', '⁚', '⁛', '⁜', '⁝', '⁞', '\\u205f', '\\u2060', '\\u2061', '\\u2062', '\\u2063', '\\u2064', '\\u2065', '\\u2066', '\\u2067', '\\u2068', '\\u2069', '\\u206a', '\\u206b', '\\u206c', '\\u206d', '\\u206e', '\\u206f', '⁰', 'ⁱ', '\\u2072', '\\u2073', '⁴', '⁵', '⁶', '⁷', '⁸', '⁹', '⁺', '⁻', '⁼', '⁽', '⁾', 'ⁿ', '₀', '₁', '₂', '₃', '₄', '₅', '₆', '₇', '₈', '₉', '₊', '₋', '₌', '₍', '₎', '\\u208f', 'ₐ', 'ₑ', 'ₒ', 'ₓ', 'ₔ', 'ₕ', 'ₖ', 'ₗ', 'ₘ', 'ₙ', 'ₚ', 'ₛ', 'ₜ', '\\u209d', '\\u209e', '\\u209f', '₠', '₡', '₢', '₣', '₤', '₥', '₦', '₧', '₨', '₩', '₪', '₫', '€', '₭', '₮', '₯', '₰', '₱', '₲', '₳', '₴', '₵', '₶', '₷', '₸', '₹', '₺', '₻', '₼', '₽', '₾', '\\u20bf', '\\u20c0', '\\u20c1', '\\u20c2', '\\u20c3', '\\u20c4', '\\u20c5', '\\u20c6', '\\u20c7', '\\u20c8', '\\u20c9', '\\u20ca', '\\u20cb', '\\u20cc', '\\u20cd', '\\u20ce', '\\u20cf', '⃐', '⃑', '⃒', '⃓', '⃔', '⃕', '⃖', '⃗', '⃘', '⃙', '⃚', '⃛', '⃜', '⃝', '⃞', '⃟', '⃠', '⃡', '⃢', '⃣', '⃤', '⃥', '⃦', '⃧', '⃨', '⃩', '⃪', '⃫', '⃬', '⃭', '⃮', '⃯', '⃰', '\\u20f1', '\\u20f2', '\\u20f3', '\\u20f4', '\\u20f5', '\\u20f6', '\\u20f7', '\\u20f8', '\\u20f9', '\\u20fa', '\\u20fb', '\\u20fc', '\\u20fd', '\\u20fe', '\\u20ff', '℀', '℁', 'ℂ', '℃', '℄', '℅', '℆', 'ℇ', '℈', '℉', 'ℊ', 'ℋ', 'ℌ', 'ℍ', 'ℎ', 'ℏ', 'ℐ', 'ℑ', 'ℒ', 'ℓ', '℔', 'ℕ', '№', '℗', '℘', 'ℙ', 'ℚ', 'ℛ', 'ℜ', 'ℝ', '℞', '℟', '℠', '℡', '™', '℣', 'ℤ', '℥', 'Ω', '℧', 'ℨ', '℩', 'K', 'Å', 'ℬ', 'ℭ', '℮', 'ℯ', 'ℰ', 'ℱ', 'Ⅎ', 'ℳ', 'ℴ', 'ℵ', 'ℶ', 'ℷ', 'ℸ', 'ℹ', '℺', '℻', 'ℼ', 'ℽ', 'ℾ', 'ℿ', '⅀', '⅁', '⅂', '⅃', '⅄', 'ⅅ', 'ⅆ', 'ⅇ', 'ⅈ', 'ⅉ', '⅊', '⅋', '⅌', '⅍', 'ⅎ', '⅏', '⅐', '⅑', '⅒', '⅓', '⅔', '⅕', '⅖', '⅗', '⅘', '⅙', '⅚', '⅛', '⅜', '⅝', '⅞', '⅟', 'Ⅰ', 'Ⅱ', 'Ⅲ', 'Ⅳ', 'Ⅴ', 'Ⅵ', 'Ⅶ', 'Ⅷ', 'Ⅸ', 'Ⅹ', 'Ⅺ', 'Ⅻ', 'Ⅼ', 'Ⅽ', 'Ⅾ', 'Ⅿ', 'ⅰ', 'ⅱ', 'ⅲ', 'ⅳ', 'ⅴ', 'ⅵ', 'ⅶ', 'ⅷ', 'ⅸ', 'ⅹ', 'ⅺ', 'ⅻ', 'ⅼ', 'ⅽ', 'ⅾ', 'ⅿ', 'ↀ', 'ↁ', 'ↂ', 'Ↄ', 'ↄ', 'ↅ', 'ↆ', 'ↇ', 'ↈ', '↉', '↊', '↋', '\\u218c', '\\u218d', '\\u218e', '\\u218f', '←', '↑', '→', '↓', '↔', '↕', '↖', '↗', '↘', '↙', '↚', '↛', '↜', '↝', '↞', '↟', '↠', '↡', '↢', '↣', '↤', '↥', '↦', '↧', '↨', '↩', '↪', '↫', '↬', '↭', '↮', '↯', '↰', '↱', '↲', '↳', '↴', '↵', '↶', '↷', '↸', '↹', '↺', '↻', '↼', '↽', '↾', '↿', '⇀', '⇁', '⇂', '⇃', '⇄', '⇅', '⇆', '⇇', '⇈', '⇉', '⇊', '⇋', '⇌', '⇍', '⇎', '⇏', '⇐', '⇑', '⇒', '⇓', '⇔', '⇕', '⇖', '⇗', '⇘', '⇙', '⇚', '⇛', '⇜', '⇝', '⇞', '⇟', '⇠', '⇡', '⇢', '⇣', '⇤', '⇥', '⇦', '⇧', '⇨', '⇩', '⇪', '⇫', '⇬', '⇭', '⇮', '⇯', '⇰', '⇱', '⇲', '⇳', '⇴', '⇵', '⇶', '⇷', '⇸', '⇹', '⇺', '⇻', '⇼', '⇽', '⇾', '⇿', '∀', '∁', '∂', '∃', '∄', '∅', '∆', '∇', '∈', '∉', '∊', '∋', '∌', '∍', '∎', '∏', '∐', '∑', '−', '∓', '∔', '∕', '∖', '∗', '∘', '∙', '√', '∛', '∜', '∝', '∞', '∟', '∠', '∡', '∢', '∣', '∤', '∥', '∦', '∧', '∨', '∩', '∪', '∫', '∬', '∭', '∮', '∯', '∰', '∱', '∲', '∳', '∴', '∵', '∶', '∷', '∸', '∹', '∺', '∻', '∼', '∽', '∾', '∿', '≀', '≁', '≂', '≃', '≄', '≅', '≆', '≇', '≈', '≉', '≊', '≋', '≌', '≍', '≎', '≏', '≐', '≑', '≒', '≓', '≔', '≕', '≖', '≗', '≘', '≙', '≚', '≛', '≜', '≝', '≞', '≟', '≠', '≡', '≢', '≣', '≤', '≥', '≦', '≧', '≨', '≩', '≪', '≫', '≬', '≭', '≮', '≯', '≰', '≱', '≲', '≳', '≴', '≵', '≶', '≷', '≸', '≹', '≺', '≻', '≼', '≽', '≾', '≿', '⊀', '⊁', '⊂', '⊃', '⊄', '⊅', '⊆', '⊇', '⊈', '⊉', '⊊', '⊋', '⊌', '⊍', '⊎', '⊏', '⊐', '⊑', '⊒', '⊓', '⊔', '⊕', '⊖', '⊗', '⊘', '⊙', '⊚', '⊛', '⊜', '⊝', '⊞', '⊟', '⊠', '⊡', '⊢', '⊣', '⊤', '⊥', '⊦', '⊧', '⊨', '⊩', '⊪', '⊫', '⊬', '⊭', '⊮', '⊯', '⊰', '⊱', '⊲', '⊳', '⊴', '⊵', '⊶', '⊷', '⊸', '⊹', '⊺', '⊻', '⊼', '⊽', '⊾', '⊿', '⋀', '⋁', '⋂', '⋃', '⋄', '⋅', '⋆', '⋇', '⋈', '⋉', '⋊', '⋋', '⋌', '⋍', '⋎', '⋏', '⋐', '⋑', '⋒', '⋓', '⋔', '⋕', '⋖', '⋗', '⋘', '⋙', '⋚', '⋛', '⋜', '⋝', '⋞', '⋟', '⋠', '⋡', '⋢', '⋣', '⋤', '⋥', '⋦', '⋧', '⋨', '⋩', '⋪', '⋫', '⋬', '⋭', '⋮', '⋯', '⋰', '⋱', '⋲', '⋳', '⋴', '⋵', '⋶', '⋷', '⋸', '⋹', '⋺', '⋻', '⋼', '⋽', '⋾', '⋿', '⌀', '⌁', '⌂', '⌃', '⌄', '⌅', '⌆', '⌇', '⌈', '⌉', '⌊', '⌋', '⌌', '⌍', '⌎', '⌏', '⌐', '⌑', '⌒', '⌓', '⌔', '⌕', '⌖', '⌗', '⌘', '⌙', '⌚', '⌛', '⌜', '⌝', '⌞', '⌟', '⌠', '⌡', '⌢', '⌣', '⌤', '⌥', '⌦', '⌧', '⌨', '〈', '〉', '⌫', '⌬', '⌭', '⌮', '⌯', '⌰', '⌱', '⌲', '⌳', '⌴', '⌵', '⌶', '⌷', '⌸', '⌹', '⌺', '⌻', '⌼', '⌽', '⌾', '⌿', '⍀', '⍁', '⍂', '⍃', '⍄', '⍅', '⍆', '⍇', '⍈', '⍉', '⍊', '⍋', '⍌', '⍍', '⍎', '⍏', '⍐', '⍑', '⍒', '⍓', '⍔', '⍕', '⍖', '⍗', '⍘', '⍙', '⍚', '⍛', '⍜', '⍝', '⍞', '⍟', '⍠', '⍡', '⍢', '⍣', '⍤', '⍥', '⍦', '⍧', '⍨', '⍩', '⍪', '⍫', '⍬', '⍭', '⍮', '⍯', '⍰', '⍱', '⍲', '⍳', '⍴', '⍵', '⍶', '⍷', '⍸', '⍹', '⍺', '⍻', '⍼', '⍽', '⍾', '⍿', '⎀', '⎁', '⎂', '⎃', '⎄', '⎅', '⎆', '⎇', '⎈', '⎉', '⎊', '⎋', '⎌', '⎍', '⎎', '⎏', '⎐', '⎑', '⎒', '⎓', '⎔', '⎕', '⎖', '⎗', '⎘', '⎙', '⎚', '⎛', '⎜', '⎝', '⎞', '⎟', '⎠', '⎡', '⎢', '⎣', '⎤', '⎥', '⎦', '⎧', '⎨', '⎩', '⎪', '⎫', '⎬', '⎭', '⎮', '⎯', '⎰', '⎱', '⎲', '⎳', '⎴', '⎵', '⎶', '⎷', '⎸', '⎹', '⎺', '⎻', '⎼', '⎽', '⎾', '⎿', '⏀', '⏁', '⏂', '⏃', '⏄', '⏅', '⏆', '⏇', '⏈', '⏉', '⏊', '⏋', '⏌', '⏍', '⏎', '⏏', '⏐', '⏑', '⏒', '⏓', '⏔', '⏕', '⏖', '⏗', '⏘', '⏙', '⏚', '⏛', '⏜', '⏝', '⏞', '⏟', '⏠', '⏡', '⏢', '⏣', '⏤', '⏥', '⏦', '⏧', '⏨', '⏩', '⏪', '⏫', '⏬', '⏭', '⏮', '⏯', '⏰', '⏱', '⏲', '⏳', '⏴', '⏵', '⏶', '⏷', '⏸', '⏹', '⏺', '⏻', '⏼', '⏽', '⏾', '\\u23ff', '␀', '␁', '␂', '␃', '␄', '␅', '␆', '␇', '␈', '␉', '␊', '␋', '␌', '␍', '␎', '␏', '␐', '␑', '␒', '␓', '␔', '␕', '␖', '␗', '␘', '␙', '␚', '␛', '␜', '␝', '␞', '␟', '␠', '␡', '␢', '␣', '␤', '␥', '␦', '\\u2427', '\\u2428', '\\u2429', '\\u242a', '\\u242b', '\\u242c', '\\u242d', '\\u242e', '\\u242f', '\\u2430', '\\u2431', '\\u2432', '\\u2433', '\\u2434', '\\u2435', '\\u2436', '\\u2437', '\\u2438', '\\u2439', '\\u243a', '\\u243b', '\\u243c', '\\u243d', '\\u243e', '\\u243f', '⑀', '⑁', '⑂', '⑃', '⑄', '⑅', '⑆', '⑇', '⑈', '⑉', '⑊', '\\u244b', '\\u244c', '\\u244d', '\\u244e', '\\u244f', '\\u2450', '\\u2451', '\\u2452', '\\u2453', '\\u2454', '\\u2455', '\\u2456', '\\u2457', '\\u2458', '\\u2459', '\\u245a', '\\u245b', '\\u245c', '\\u245d', '\\u245e', '\\u245f', '①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩', '⑪', '⑫', '⑬', '⑭', '⑮', '⑯', '⑰', '⑱', '⑲', '⑳', '⑴', '⑵', '⑶', '⑷', '⑸', '⑹', '⑺', '⑻', '⑼', '⑽', '⑾', '⑿', '⒀', '⒁', '⒂', '⒃', '⒄', '⒅', '⒆', '⒇', '⒈', '⒉', '⒊', '⒋', '⒌', '⒍', '⒎', '⒏', '⒐', '⒑', '⒒', '⒓', '⒔', '⒕', '⒖', '⒗', '⒘', '⒙', '⒚', '⒛', '⒜', '⒝', '⒞', '⒟', '⒠', '⒡', '⒢', '⒣', '⒤', '⒥', '⒦', '⒧', '⒨', '⒩', '⒪', '⒫', '⒬', '⒭', '⒮', '⒯', '⒰', '⒱', '⒲', '⒳', '⒴', '⒵', 'Ⓐ', 'Ⓑ', 'Ⓒ', 'Ⓓ', 'Ⓔ', 'Ⓕ', 'Ⓖ', 'Ⓗ', 'Ⓘ', 'Ⓙ', 'Ⓚ', 'Ⓛ', 'Ⓜ', 'Ⓝ', 'Ⓞ', 'Ⓟ', 'Ⓠ', 'Ⓡ', 'Ⓢ', 'Ⓣ', 'Ⓤ', 'Ⓥ', 'Ⓦ', 'Ⓧ', 'Ⓨ', 'Ⓩ', 'ⓐ', 'ⓑ', 'ⓒ', 'ⓓ', 'ⓔ', 'ⓕ', 'ⓖ', 'ⓗ', 'ⓘ', 'ⓙ', 'ⓚ', 'ⓛ', 'ⓜ', 'ⓝ', 'ⓞ', 'ⓟ', 'ⓠ', 'ⓡ', 'ⓢ', 'ⓣ', 'ⓤ', 'ⓥ', 'ⓦ', 'ⓧ', 'ⓨ', 'ⓩ', '⓪', '⓫', '⓬', '⓭', '⓮', '⓯', '⓰', '⓱', '⓲', '⓳', '⓴', '⓵', '⓶', '⓷', '⓸', '⓹', '⓺', '⓻', '⓼', '⓽', '⓾', '⓿', '─', '━', '│', '┃', '┄', '┅', '┆', '┇', '┈', '┉', '┊', '┋', '┌', '┍', '┎', '┏', '┐', '┑', '┒', '┓', '└', '┕', '┖', '┗', '┘', '┙', '┚', '┛', '├', '┝', '┞', '┟', '┠', '┡', '┢', '┣', '┤', '┥', '┦', '┧', '┨', '┩', '┪', '┫', '┬', '┭', '┮', '┯', '┰', '┱', '┲', '┳', '┴', '┵', '┶', '┷', '┸', '┹', '┺', '┻', '┼', '┽', '┾', '┿', '╀', '╁', '╂', '╃', '╄', '╅', '╆', '╇', '╈', '╉', '╊', '╋', '╌', '╍', '╎', '╏', '═', '║', '╒', '╓', '╔', '╕', '╖', '╗', '╘', '╙', '╚', '╛', '╜', '╝', '╞', '╟', '╠', '╡', '╢', '╣', '╤', '╥', '╦', '╧', '╨', '╩', '╪', '╫', '╬', '╭', '╮', '╯', '╰', '╱', '╲', '╳', '╴', '╵', '╶', '╷', '╸', '╹', '╺', '╻', '╼', '╽', '╾', '╿', '▀', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█', '▉', '▊', '▋', '▌', '▍', '▎', '▏', '▐', '░', '▒', '▓', '▔', '▕', '▖', '▗', '▘', '▙', '▚', '▛', '▜', '▝', '▞', '▟', '■', '□', '▢', '▣', '▤', '▥', '▦', '▧', '▨', '▩', '▪', '▫', '▬', '▭', '▮', '▯', '▰', '▱', '▲', '△', '▴', '▵', '▶', '▷', '▸', '▹', '►', '▻', '▼', '▽', '▾', '▿', '◀', '◁', '◂', '◃', '◄', '◅', '◆', '◇', '◈', '◉', '◊', '○', '◌', '◍', '◎', '●', '◐', '◑', '◒', '◓', '◔', '◕', '◖', '◗', '◘', '◙', '◚', '◛', '◜', '◝', '◞', '◟', '◠', '◡', '◢', '◣', '◤', '◥', '◦', '◧', '◨', '◩', '◪', '◫', '◬', '◭', '◮', '◯', '◰', '◱', '◲', '◳', '◴', '◵', '◶', '◷', '◸', '◹', '◺', '◻', '◼', '◽', '◾', '◿', '☀', '☁', '☂', '☃', '☄', '★', '☆', '☇', '☈', '☉', '☊', '☋', '☌', '☍', '☎', '☏', '☐', '☑', '☒', '☓', '☔', '☕', '☖', '☗', '☘', '☙', '☚', '☛', '☜', '☝', '☞', '☟', '☠', '☡', '☢', '☣', '☤', '☥', '☦', '☧', '☨', '☩', '☪', '☫', '☬', '☭', '☮', '☯', '☰', '☱', '☲', '☳', '☴', '☵', '☶', '☷', '☸', '☹', '☺', '☻', '☼', '☽', '☾', '☿', '♀', '♁', '♂', '♃', '♄', '♅', '♆', '♇', '♈', '♉', '♊', '♋', '♌', '♍', '♎', '♏', '♐', '♑', '♒', '♓', '♔', '♕', '♖', '♗', '♘', '♙', '♚', '♛', '♜', '♝', '♞', '♟', '♠', '♡', '♢', '♣', '♤', '♥', '♦', '♧', '♨', '♩', '♪', '♫', '♬', '♭', '♮', '♯', '♰', '♱', '♲', '♳', '♴', '♵', '♶', '♷', '♸', '♹', '♺', '♻', '♼', '♽', '♾', '♿', '⚀', '⚁', '⚂', '⚃', '⚄', '⚅', '⚆', '⚇', '⚈', '⚉', '⚊', '⚋', '⚌', '⚍', '⚎', '⚏', '⚐', '⚑', '⚒', '⚓', '⚔', '⚕', '⚖', '⚗', '⚘', '⚙', '⚚', '⚛', '⚜', '⚝', '⚞', '⚟', '⚠', '⚡', '⚢', '⚣', '⚤', '⚥', '⚦', '⚧', '⚨', '⚩', '⚪', '⚫', '⚬', '⚭', '⚮', '⚯', '⚰', '⚱', '⚲', '⚳', '⚴', '⚵', '⚶', '⚷', '⚸', '⚹', '⚺', '⚻', '⚼', '⚽', '⚾', '⚿', '⛀', '⛁', '⛂', '⛃', '⛄', '⛅', '⛆', '⛇', '⛈', '⛉', '⛊', '⛋', '⛌', '⛍', '⛎', '⛏', '⛐', '⛑', '⛒', '⛓', '⛔', '⛕', '⛖', '⛗', '⛘', '⛙', '⛚', '⛛', '⛜', '⛝', '⛞', '⛟', '⛠', '⛡', '⛢', '⛣', '⛤', '⛥', '⛦', '⛧', '⛨', '⛩', '⛪', '⛫', '⛬', '⛭', '⛮', '⛯', '⛰', '⛱', '⛲', '⛳', '⛴', '⛵', '⛶', '⛷', '⛸', '⛹', '⛺', '⛻', '⛼', '⛽', '⛾', '⛿', '✀', '✁', '✂', '✃', '✄', '✅', '✆', '✇', '✈', '✉', '✊', '✋', '✌', '✍', '✎', '✏']\n" + ] + } + ], + "source": [ + "print(p)" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "7" + ] + }, + "execution_count": 63, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = \"Hello World\"\n", + "s.rindex('o')" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 72, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = \"sachin is good boy.\"\n", + "s.startswith('sachin')" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 75, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = \"He said you should be like sachin\"\n", + "s.endswith('sachin')" + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "sachin yadav. i am teaching python over here.\n" + ] + } + ], + "source": [ + "s = \"hello my name is sachin yadav. i am teaching python over here.\"\n", + "index = s.find('sachin')\n", + "print(s[index:])" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " sachin\n" + ] + } + ], + "source": [ + "print(\"sachin\".rjust(10))" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Hello', 'World', 'how', 'are', 'you']\n" + ] + } + ], + "source": [ + "s = \"Hello World how are you\"\n", + "l = s.split()\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Hello World ', ' are you ', ' you doing']\n" + ] + } + ], + "source": [ + "s = \"Hello World how are you how you doing\"\n", + "l = s.split('how')\n", + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 91, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "('hello', ' ', 'world, how are you')\n" + ] + } + ], + "source": [ + "s = \"hello world, how are you\"\n", + "k = s.partition(' ')\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 93, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "('hello world, ', 'how', ' are you how you doing')\n" + ] + } + ], + "source": [ + "s = \"hello world, how are you how you doing\"\n", + "k = s.partition('how')\n", + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "S.zfill(width) -> str\n", + "\n", + "Pad a numeric string S with zeros on the left, to fill a field\n", + "of the specified width. The string S is never truncated.\n", + "S.center(width[, fillchar]) -> str\n", + "\n", + "Return S centered in a string of length width. Padding is\n", + "done using the specified fill character (default is a space)\n" + ] + } + ], + "source": [ + "print(str.zfill.__doc__)\n", + "print(str.center.__doc__)" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "###################Hello world####################\n" + ] + } + ], + "source": [ + "s = \"Hello world\"\n", + "print(s.center(50,'#'))" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "000000000000000000000000000000000000000Hello World\n" + ] + } + ], + "source": [ + "s = \"Hello World\"\n", + "print(s.zfill(50))" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0000000000101011\n" + ] + } + ], + "source": [ + "x = '101011'\n", + "print(x.zfill(16))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Data_Types_in_Python.html b/python_ipynb/Data_Types_in_Python.html new file mode 100644 index 0000000..fb98ce2 --- /dev/null +++ b/python_ipynb/Data_Types_in_Python.html @@ -0,0 +1,12562 @@ + + + +Data_Types_in_Python + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +
    +

    Baic Data Type

    +

    We have these data types mentioned below in python

    +

      +
    1. Numbers
    2. +
    3. Strings
    4. +
    5. List
    6. +
    7. Tuple
    8. +
    9. Dictonary
    10. +
    11. Sets
    12. +
    +

    + +
    +
    +
    +
    +
    +
    +
    +

    Q. What is Data Type ?

    +
    +
    +
    +
    +
    +
    +
    +

    Ans. Data Types defines how we store data inside our language. We can store data in many forms known as number, string, list, tuple, dictionary and sets. Each of these forms has it's own rules. So to store data inside a program we need data types.

    +

    +Numbers --> By using number we can store different type of numbers in python
    +int --> int stans for integers and integers are defined as 123, 34343. so anything which repeats 0-9 numbers known as integer. eg. x = 123 so here x will become integer +float --> floats are real number which have a floating point like 3.14, 6.03. eg. x = 567343.343 this is a float number in python. +
    +complex --> real + image in python we write complex number as 56+5j here j denotes imagenary part. real = 56, image = 5

    +
    +
    +
    +
    +
    +
    In [4]:
    +
    +
    +
    #Number
    +#int 
    +x = 56 # this is integer, it is known as initilization or declearation
    +print(type(x)) # how we can see type of a containter 
    +print(x) #value of your containter or you can say variable
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    <class 'int'>
    +56
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    y = int(input("Enter a number : ")) #this is how you can take input from user
    +print("Type of Variable = ",type(y))
    +print("Value of Variable = ",y)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter a number : 45
    +Type of Variable =  <class 'int'>
    +Value of Variable =  45
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    45 + 45
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[6]:
    + + + + +
    +
    90
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    num1 = int(input("Enter Number 1 : "))
    +num2 = int(input("Enter Number 2 : "))
    +num3 = int(input("Enter Number 3 : "))
    +#print(x,y,z)
    +s = """
    +
    +x = {}
    +y = {}
    +z = {}
    +
    +""".format(num1,num2,num3)
    +
    +print(s)
    +
    +result = """
    +Result --> 
    +
    +{x} + {y} + {z} = {add}
    +{x} - {y} - {z} = {sub}
    +{x} * {y} * {z} = {mul}
    +{x} / {y} / {z} = {div}
    +
    +""".format(x=num1,y=num2,z=num3,add=num1+num2+num3,sub=x-y-z,mul=x*y*z,div=x/y/z)
    +print(result)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter Number 1 : 3
    +Enter Number 2 : 2
    +Enter Number 3 : 1
    +
    +
    +x = 3
    +y = 2
    +z = 1
    +
    +
    +
    +Result --> 
    +
    +3 + 2 + 1 = 6
    +3 - 2 - 1 = -4
    +3 * 2 * 1 = 6
    +3 / 2 / 1 = 0.16666666666666666
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    s1 = "Hello World!"
    +length1 = len(s1)
    +s2 = "ajkldfaksdf;lj jsa;klfj l;kdsj flksjfkldsj ;klajsfhdskjlfhs adfkljsdhf kj"
    +length2 = len(s2)
    +
    +print(s1)
    +print("Length is = ",length1)
    +print(s2)
    +print("Length is = ",length2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World!
    +Length is =  12
    +ajkldfaksdf;lj jsa;klfj l;kdsj flksjfkldsj ;klajsfhdskjlfhs adfkljsdhf kj
    +Length is =  73
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    s = "Hello World, You can see 123 '!!python is $Awesome'. me too awesome"
    +print(len(s))
    +s1 = sorted(s)
    +print(s)
    +print(s1)
    +type(s1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    67
    +Hello World, You can see 123 '!!python is $Awesome'. me too awesome
    +[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '!', '!', '$', "'", "'", ',', '.', '1', '2', '3', 'A', 'H', 'W', 'Y', 'a', 'a', 'c', 'd', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'h', 'i', 'l', 'l', 'l', 'm', 'm', 'm', 'n', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'p', 'r', 's', 's', 's', 's', 't', 't', 'u', 'w', 'w', 'y']
    +
    +
    +
    + +
    + +
    Out[6]:
    + + + + +
    +
    list
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    k = ''.join(s1)
    +print(k)
    +type(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
               !!$'',.123AHWYaacdeeeeeeeehilllmmmnnooooooooprssssttuwwy
    +
    +
    +
    + +
    + +
    Out[8]:
    + + + + +
    +
    str
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    s = [ '1','3','hello','hi','how','443']
    +print(s)
    +st = '<$$$$>'.join(s)
    +st
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['1', '3', 'hello', 'hi', 'how', '443']
    +
    +
    +
    + +
    + +
    Out[15]:
    + + + + +
    +
    '1<$$$$>3<$$$$>hello<$$$$>hi<$$$$>how<$$$$>443'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    para= """What happens in vegas lives in vegas.
    +Don't do anything stupid.
    +Python is awesome.
    +But the only way to learn python is by practising.
    +so do practise everyday."""
    +print(para)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    What happens in vegas lives in vegas.
    +Don't do anything stupid.
    +Python is awesome.
    +But the only way to learn python is by practising.
    +so do practise everyday.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    para
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[18]:
    + + + + +
    +
    "What happens in vegas lives in vegas.\nDon't do anything stupid.\nPython is awesome.\nBut the only way to learn python is by practising.\nso do practise everyday."
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [21]:
    +
    +
    +
    print(para)
    +h = para.split('\n')
    +print(h)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    What happens in vegas lives in vegas.
    +Don't do anything stupid.
    +Python is awesome.
    +But the only way to learn python is by practising.
    +so do practise everyday.
    +['What happens in vegas lives in vegas.', "Don't do anything stupid.", 'Python is awesome.', 'But the only way to learn python is by practising.', 'so do practise everyday.']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [22]:
    +
    +
    +
    para1 = '\n\n'.join(h)
    +print(para)
    +print(para1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    What happens in vegas lives in vegas.
    +Don't do anything stupid.
    +Python is awesome.
    +But the only way to learn python is by practising.
    +so do practise everyday.
    +What happens in vegas lives in vegas.
    +
    +Don't do anything stupid.
    +
    +Python is awesome.
    +
    +But the only way to learn python is by practising.
    +
    +so do practise everyday.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [26]:
    +
    +
    +
    s = "Hello World, How are you"
    +p = s.split()
    +p
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[26]:
    + + + + +
    +
    ['Hello', 'World,', 'How', 'are', 'you']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [33]:
    +
    +
    +
    s1 = '--'.join(p)
    +print(s1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello--World,--How--are--you
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [39]:
    +
    +
    +
    s = "this is for fun i want to learn something."
    +b = s.split()
    +print(b)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['this', 'is', 'for', 'fun', 'i', 'want', 'to', 'learn', 'something.']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [41]:
    +
    +
    +
    message = input("Enter your message : ")
    +
    +if message == 'hey' : 
    +    print("hello, How are you")
    +else : 
    +    print("Go to Hell")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter your message : bastard
    +Go to Hell
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [43]:
    +
    +
    +
    ques = int(input("How much do you earn ?  "))
    +
    +if ques > 50000 : 
    +    print("Let's go for date")
    +else : 
    +    print("You are my best friend, don't think much")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    How much do you earn ?  9999999999
    +Let's go for date
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [47]:
    +
    +
    +
    ram = int(input("Ram's salary : "))
    +harry = int(input("Harry's salary : "))
    +tom = int(input("Tom's salary : "))
    +
    +if ram <= harry : 
    +    if ram <= tom : 
    +        print("I will go with ram.")
    +    else : 
    +        print("I will go with tom.")
    +else :
    +    if harry <= tom : 
    +        print("I will go with harry.")
    +    else :
    +        print("I will go with tom")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Ram's salary : 10000
    +Harry's salary : 5000
    +Tom's salary : 0
    +I will go with tom
    +
    +
    +
    + +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/Data_Types_in_Python.ipynb b/python_ipynb/Data_Types_in_Python.ipynb new file mode 100644 index 0000000..171cb03 --- /dev/null +++ b/python_ipynb/Data_Types_in_Python.ipynb @@ -0,0 +1,554 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Baic Data Type

    \n", + "

    We have these data types mentioned below in python

    \n", + "
      \n", + "
    1. Numbers
    2. \n", + "
    3. Strings
    4. \n", + "
    5. List
    6. \n", + "
    7. Tuple
    8. \n", + "
    9. Dictonary
    10. \n", + "
    11. Sets
    12. \n", + "
    \n", + "\n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Q. What is Data Type ?

    " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Ans. Data Types defines how we store data inside our language. We can store data in many forms known as number, string, list, tuple, dictionary and sets. Each of these forms has it's own rules. So to store data inside a program we need data types.

    \n", + "

    \n", + "Numbers --> By using number we can store different type of numbers in python
    \n", + "int --> int stans for integers and integers are defined as 123, 34343. so anything which repeats 0-9 numbers known as integer. eg. x = 123 so here x will become integer\n", + "float --> floats are real number which have a floating point like 3.14, 6.03. eg. x = 567343.343 this is a float number in python.\n", + "
    \n", + "complex --> real + image in python we write complex number as 56+5j here j denotes imagenary part. real = 56, image = 5

    " + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "56\n" + ] + } + ], + "source": [ + "#Number\n", + "#int \n", + "x = 56 # this is integer, it is known as initilization or declearation\n", + "print(type(x)) # how we can see type of a containter \n", + "print(x) #value of your containter or you can say variable" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a number : 45\n", + "Type of Variable = \n", + "Value of Variable = 45\n" + ] + } + ], + "source": [ + "y = int(input(\"Enter a number : \")) #this is how you can take input from user\n", + "print(\"Type of Variable = \",type(y))\n", + "print(\"Value of Variable = \",y)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "90" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "45 + 45" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter Number 1 : 3\n", + "Enter Number 2 : 2\n", + "Enter Number 3 : 1\n", + "\n", + "\n", + "x = 3\n", + "y = 2\n", + "z = 1\n", + "\n", + "\n", + "\n", + "Result --> \n", + "\n", + "3 + 2 + 1 = 6\n", + "3 - 2 - 1 = -4\n", + "3 * 2 * 1 = 6\n", + "3 / 2 / 1 = 0.16666666666666666\n", + "\n", + "\n" + ] + } + ], + "source": [ + "num1 = int(input(\"Enter Number 1 : \"))\n", + "num2 = int(input(\"Enter Number 2 : \"))\n", + "num3 = int(input(\"Enter Number 3 : \"))\n", + "#print(x,y,z)\n", + "s = \"\"\"\n", + "\n", + "x = {}\n", + "y = {}\n", + "z = {}\n", + "\n", + "\"\"\".format(num1,num2,num3)\n", + "\n", + "print(s)\n", + "\n", + "result = \"\"\"\n", + "Result --> \n", + "\n", + "{x} + {y} + {z} = {add}\n", + "{x} - {y} - {z} = {sub}\n", + "{x} * {y} * {z} = {mul}\n", + "{x} / {y} / {z} = {div}\n", + "\n", + "\"\"\".format(x=num1,y=num2,z=num3,add=num1+num2+num3,sub=x-y-z,mul=x*y*z,div=x/y/z)\n", + "print(result)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World!\n", + "Length is = 12\n", + "ajkldfaksdf;lj jsa;klfj l;kdsj flksjfkldsj ;klajsfhdskjlfhs adfkljsdhf kj\n", + "Length is = 73\n" + ] + } + ], + "source": [ + "s1 = \"Hello World!\"\n", + "length1 = len(s1)\n", + "s2 = \"ajkldfaksdf;lj jsa;klfj l;kdsj flksjfkldsj ;klajsfhdskjlfhs adfkljsdhf kj\"\n", + "length2 = len(s2)\n", + "\n", + "print(s1)\n", + "print(\"Length is = \",length1)\n", + "print(s2)\n", + "print(\"Length is = \",length2)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "67\n", + "Hello World, You can see 123 '!!python is $Awesome'. me too awesome\n", + "[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '!', '!', '$', \"'\", \"'\", ',', '.', '1', '2', '3', 'A', 'H', 'W', 'Y', 'a', 'a', 'c', 'd', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'h', 'i', 'l', 'l', 'l', 'm', 'm', 'm', 'n', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'p', 'r', 's', 's', 's', 's', 't', 't', 'u', 'w', 'w', 'y']\n" + ] + }, + { + "data": { + "text/plain": [ + "list" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = \"Hello World, You can see 123 '!!python is $Awesome'. me too awesome\"\n", + "print(len(s))\n", + "s1 = sorted(s)\n", + "print(s)\n", + "print(s1)\n", + "type(s1)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " !!$'',.123AHWYaacdeeeeeeeehilllmmmnnooooooooprssssttuwwy\n" + ] + }, + { + "data": { + "text/plain": [ + "str" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "k = ''.join(s1)\n", + "print(k)\n", + "type(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['1', '3', 'hello', 'hi', 'how', '443']\n" + ] + }, + { + "data": { + "text/plain": [ + "'1<$$$$>3<$$$$>hello<$$$$>hi<$$$$>how<$$$$>443'" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = [ '1','3','hello','hi','how','443']\n", + "print(s)\n", + "st = '<$$$$>'.join(s)\n", + "st" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "What happens in vegas lives in vegas.\n", + "Don't do anything stupid.\n", + "Python is awesome.\n", + "But the only way to learn python is by practising.\n", + "so do practise everyday.\n" + ] + } + ], + "source": [ + "para= \"\"\"What happens in vegas lives in vegas.\n", + "Don't do anything stupid.\n", + "Python is awesome.\n", + "But the only way to learn python is by practising.\n", + "so do practise everyday.\"\"\"\n", + "print(para)" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/plain": [ + "\"What happens in vegas lives in vegas.\\nDon't do anything stupid.\\nPython is awesome.\\nBut the only way to learn python is by practising.\\nso do practise everyday.\"" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "para" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "What happens in vegas lives in vegas.\n", + "Don't do anything stupid.\n", + "Python is awesome.\n", + "But the only way to learn python is by practising.\n", + "so do practise everyday.\n", + "['What happens in vegas lives in vegas.', \"Don't do anything stupid.\", 'Python is awesome.', 'But the only way to learn python is by practising.', 'so do practise everyday.']\n" + ] + } + ], + "source": [ + "print(para)\n", + "h = para.split('\\n')\n", + "print(h)" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "What happens in vegas lives in vegas.\n", + "Don't do anything stupid.\n", + "Python is awesome.\n", + "But the only way to learn python is by practising.\n", + "so do practise everyday.\n", + "What happens in vegas lives in vegas.\n", + "\n", + "Don't do anything stupid.\n", + "\n", + "Python is awesome.\n", + "\n", + "But the only way to learn python is by practising.\n", + "\n", + "so do practise everyday.\n" + ] + } + ], + "source": [ + "para1 = '\\n\\n'.join(h)\n", + "print(para)\n", + "print(para1)" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Hello', 'World,', 'How', 'are', 'you']" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = \"Hello World, How are you\"\n", + "p = s.split()\n", + "p" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello--World,--How--are--you\n" + ] + } + ], + "source": [ + "s1 = '--'.join(p)\n", + "print(s1)" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['this', 'is', 'for', 'fun', 'i', 'want', 'to', 'learn', 'something.']\n" + ] + } + ], + "source": [ + "s = \"this is for fun i want to learn something.\"\n", + "b = s.split()\n", + "print(b)" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your message : bastard\n", + "Go to Hell\n" + ] + } + ], + "source": [ + "message = input(\"Enter your message : \")\n", + "\n", + "if message == 'hey' : \n", + " print(\"hello, How are you\")\n", + "else : \n", + " print(\"Go to Hell\")" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "How much do you earn ? 9999999999\n", + "Let's go for date\n" + ] + } + ], + "source": [ + "ques = int(input(\"How much do you earn ? \"))\n", + "\n", + "if ques > 50000 : \n", + " print(\"Let's go for date\")\n", + "else : \n", + " print(\"You are my best friend, don't think much\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ram's salary : 10000\n", + "Harry's salary : 5000\n", + "Tom's salary : 0\n", + "I will go with tom\n" + ] + } + ], + "source": [ + "ram = int(input(\"Ram's salary : \"))\n", + "harry = int(input(\"Harry's salary : \"))\n", + "tom = int(input(\"Tom's salary : \"))\n", + "\n", + "if ram <= harry : \n", + " if ram <= tom : \n", + " print(\"I will go with ram.\")\n", + " else : \n", + " print(\"I will go with tom.\")\n", + "else :\n", + " if harry <= tom : \n", + " print(\"I will go with harry.\")\n", + " else :\n", + " print(\"I will go with tom\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Exception_Handling.html b/python_ipynb/Exception_Handling.html new file mode 100644 index 0000000..828c5e0 --- /dev/null +++ b/python_ipynb/Exception_Handling.html @@ -0,0 +1,13643 @@ + + + + +Exception_Handling + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    In [2]:
    +
    +
    +
    def hello():
    +    print("Hello world")
    +  print("hi")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +  File "<tokenize>", line 3
    +    print("hi")
    +    ^
    +IndentationError: unindent does not match any outer indentation level
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    if something
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +  File "<ipython-input-3-f642afdc7692>", line 1
    +    if something
    +                ^
    +SyntaxError: invalid syntax
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    1 / 0
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +ZeroDivisionError                         Traceback (most recent call last)
    +<ipython-input-4-b710d87c980c> in <module>()
    +----> 1 1 / 0
    +
    +ZeroDivisionError: division by zero
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    x = int(input("Enter an interger : "))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter an interger : alkdfj
    +
    +
    +
    + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +ValueError                                Traceback (most recent call last)
    +<ipython-input-5-82b31f701f8d> in <module>()
    +----> 1 x = int(input("Enter an interger : "))
    +
    +ValueError: invalid literal for int() with base 10: 'alkdfj'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    x  = 123
    +y = 'hell'
    +x + y
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +TypeError                                 Traceback (most recent call last)
    +<ipython-input-6-f1fca4bca92f> in <module>()
    +      1 x  = 123
    +      2 y = 'hell'
    +----> 3 x + y
    +
    +TypeError: unsupported operand type(s) for +: 'int' and 'str'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    x = [ 1,2,3,]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    x[45]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +IndexError                                Traceback (most recent call last)
    +<ipython-input-8-e5535e46ae18> in <module>()
    +----> 1 x[45]
    +
    +IndexError: list index out of range
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    f = open('abcdefgh')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +FileNotFoundError                         Traceback (most recent call last)
    +<ipython-input-9-cae09dca6f84> in <module>()
    +----> 1 f = open('abcdefgh')
    +
    +FileNotFoundError: [Errno 2] No such file or directory: 'abcdefgh'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    import sachin
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +ModuleNotFoundError                       Traceback (most recent call last)
    +<ipython-input-10-5bb7baf1b1a9> in <module>()
    +----> 1 import sachin
    +
    +ModuleNotFoundError: No module named 'sachin'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    d = { 'a':1,'b':2}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    d['c']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +KeyError                                  Traceback (most recent call last)
    +<ipython-input-12-3e4d85f12902> in <module>()
    +----> 1 d['c']
    +
    +KeyError: 'c'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    def data():
    +    try : 
    +        x = int(input("x : "))
    +        y = int(input("y : "))
    +        r = x/y
    +        print(r)
    +    except ValueError as arg :
    +        print("Error!! Please Input only Integer number Thanks!!")
    +        data()
    +        
    +    except ZeroDivisionError as arg : 
    +        print("Error!! Are bhai yrr kon zero se divide karta hai")
    +        data()
    +        
    +    except Exception as e :
    +        print("There is an Danger Error ")
    +        print("Please Report this to our developers at info@grras.com")
    +        print("Error!!!",e)
    +data()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    x : 5
    +y : 5
    +1.0
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [32]:
    +
    +
    +
    def fun():
    +    try : 
    +        temp = int(input("Enter temp (>0) : "))
    +        if temp < 0 :
    +            raise ZeroDivisionError("Please Enter only Positive Number!!!")
    +        else :
    +            return temp
    +    except ValueError as e : 
    +        print("Invalid Input Try Again")
    +        return fun()
    +    except ZeroDivisionError as arg : 
    +        print("Error!!",arg)
    +        return fun()
    +    except Exception as e : 
    +        print("Something Went Wrong")
    +        return fun()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [33]:
    +
    +
    +
    x  = fun()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter temp (>0) : lkasdjf
    +Invalid Input Try Again
    +Enter temp (>0) : lskdjff
    +Invalid Input Try Again
    +Enter temp (>0) : -12
    +Error!! Please Enter only Positive Number!!!
    +Enter temp (>0) : 6
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [35]:
    +
    +
    +
    def fun():
    +    try : 
    +        temp = int(input("Enter temp (>0) : "))
    +        assert temp > 0 , "Temp should be Positive"
    +        return temp
    +    except ValueError as e : 
    +        print("Invalid Input Try Again")
    +        return fun()
    +    except ZeroDivisionError as arg : 
    +        print("Error!!",arg)
    +        return fun()
    +    except Exception as e : 
    +        print("Something Went Wrong")
    +        return fun()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
    fun
    +
    + +
    +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/Exception_Handling.ipynb b/python_ipynb/Exception_Handling.ipynb new file mode 100644 index 0000000..1c54dc1 --- /dev/null +++ b/python_ipynb/Exception_Handling.ipynb @@ -0,0 +1,358 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "ename": "IndentationError", + "evalue": "unindent does not match any outer indentation level (, line 3)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m3\u001b[0m\n\u001b[1;33m print(\"hi\")\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mIndentationError\u001b[0m\u001b[1;31m:\u001b[0m unindent does not match any outer indentation level\n" + ] + } + ], + "source": [ + "def hello():\n", + " print(\"Hello world\")\n", + " print(\"hi\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 1)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m if something\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" + ] + } + ], + "source": [ + "if something" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "ename": "ZeroDivisionError", + "evalue": "division by zero", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[1;36m1\u001b[0m \u001b[1;33m/\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mZeroDivisionError\u001b[0m: division by zero" + ] + } + ], + "source": [ + "1 / 0" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter an interger : alkdfj\n" + ] + }, + { + "ename": "ValueError", + "evalue": "invalid literal for int() with base 10: 'alkdfj'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mx\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0minput\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Enter an interger : \"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mValueError\u001b[0m: invalid literal for int() with base 10: 'alkdfj'" + ] + } + ], + "source": [ + "x = int(input(\"Enter an interger : \"))" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "ename": "TypeError", + "evalue": "unsupported operand type(s) for +: 'int' and 'str'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mx\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m123\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[0my\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m'hell'\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[0mx\u001b[0m \u001b[1;33m+\u001b[0m \u001b[0my\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'int' and 'str'" + ] + } + ], + "source": [ + "x = 123\n", + "y = 'hell'\n", + "x + y" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "x = [ 1,2,3,]" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "ename": "IndexError", + "evalue": "list index out of range", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mIndexError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mx\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m45\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mIndexError\u001b[0m: list index out of range" + ] + } + ], + "source": [ + "x[45]" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "ename": "FileNotFoundError", + "evalue": "[Errno 2] No such file or directory: 'abcdefgh'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mFileNotFoundError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mf\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'abcdefgh'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'abcdefgh'" + ] + } + ], + "source": [ + "f = open('abcdefgh')" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "ename": "ModuleNotFoundError", + "evalue": "No module named 'sachin'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[1;32mimport\u001b[0m \u001b[0msachin\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'sachin'" + ] + } + ], + "source": [ + "import sachin" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "d = { 'a':1,'b':2}" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "ename": "KeyError", + "evalue": "'c'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0md\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'c'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mKeyError\u001b[0m: 'c'" + ] + } + ], + "source": [ + "d['c']" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x : 5\n", + "y : 5\n", + "1.0\n" + ] + } + ], + "source": [ + "def data():\n", + " try : \n", + " x = int(input(\"x : \"))\n", + " y = int(input(\"y : \"))\n", + " r = x/y\n", + " print(r)\n", + " except ValueError as arg :\n", + " print(\"Error!! Please Input only Integer number Thanks!!\")\n", + " data()\n", + " \n", + " except ZeroDivisionError as arg : \n", + " print(\"Error!! Are bhai yrr kon zero se divide karta hai\")\n", + " data()\n", + " \n", + " except Exception as e :\n", + " print(\"There is an Danger Error \")\n", + " print(\"Please Report this to our developers at info@grras.com\")\n", + " print(\"Error!!!\",e)\n", + "data()" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [], + "source": [ + "def fun():\n", + " try : \n", + " temp = int(input(\"Enter temp (>0) : \"))\n", + " if temp < 0 :\n", + " raise ZeroDivisionError(\"Please Enter only Positive Number!!!\")\n", + " else :\n", + " return temp\n", + " except ValueError as e : \n", + " print(\"Invalid Input Try Again\")\n", + " return fun()\n", + " except ZeroDivisionError as arg : \n", + " print(\"Error!!\",arg)\n", + " return fun()\n", + " except Exception as e : \n", + " print(\"Something Went Wrong\")\n", + " return fun()" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter temp (>0) : lkasdjf\n", + "Invalid Input Try Again\n", + "Enter temp (>0) : lskdjff\n", + "Invalid Input Try Again\n", + "Enter temp (>0) : -12\n", + "Error!! Please Enter only Positive Number!!!\n", + "Enter temp (>0) : 6\n" + ] + } + ], + "source": [ + "x = fun()" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [], + "source": [ + "def fun():\n", + " try : \n", + " temp = int(input(\"Enter temp (>0) : \"))\n", + " assert temp > 0 , \"Temp should be Positive\"\n", + " return temp\n", + " except ValueError as e : \n", + " print(\"Invalid Input Try Again\")\n", + " return fun()\n", + " except ZeroDivisionError as arg : \n", + " print(\"Error!!\",arg)\n", + " return fun()\n", + " except Exception as e : \n", + " print(\"Something Went Wrong\")\n", + " return fun()\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "fun" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/File_Handling.html b/python_ipynb/File_Handling.html new file mode 100644 index 0000000..f92bcf2 --- /dev/null +++ b/python_ipynb/File_Handling.html @@ -0,0 +1,14481 @@ + + + + +File_Handling + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +

    File Handling in Python

    +
    +
    +
    +
    +
    +
    In [2]:
    +
    +
    +
    f = open('abracadabra','r')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +FileNotFoundError                         Traceback (most recent call last)
    +<ipython-input-2-b419f5014f3e> in <module>()
    +----> 1 f = open('abracadabra','r')
    +
    +FileNotFoundError: [Errno 2] No such file or directory: 'abracadabra'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    fp = open('File_Handling.ipynb','r')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    data = fp.read(10)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    data
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[5]:
    + + + + +
    +
    '{\n "cells"'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    data = fp.read(10)
    +data
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[6]:
    + + + + +
    +
    ': [\n  {\n  '
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    fp.tell()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[7]:
    + + + + +
    +
    20
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    fp.seek(0)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[8]:
    + + + + +
    +
    0
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    fp.tell()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[9]:
    + + + + +
    +
    0
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    data = fp.read()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    data
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[11]:
    + + + + +
    +
    '{\n "cells": [\n  {\n   "cell_type": "markdown",\n   "metadata": {},\n   "source": [\n    "<p style=\'color:red;font-size:x-large\'> File Handling in Python </p>"\n   ]\n  },\n  {\n   "cell_type": "code",\n   "execution_count": 2,\n   "metadata": {},\n   "outputs": [\n    {\n     "ename": "FileNotFoundError",\n     "evalue": "[Errno 2] No such file or directory: \'abracadabra\'",\n     "output_type": "error",\n     "traceback": [\n      "\\u001b[1;31m---------------------------------------------------------------------------\\u001b[0m",\n      "\\u001b[1;31mFileNotFoundError\\u001b[0m                         Traceback (most recent call last)",\n      "\\u001b[1;32m<ipython-input-2-b419f5014f3e>\\u001b[0m in \\u001b[0;36m<module>\\u001b[1;34m()\\u001b[0m\\n\\u001b[1;32m----> 1\\u001b[1;33m \\u001b[0mf\\u001b[0m \\u001b[1;33m=\\u001b[0m \\u001b[0mopen\\u001b[0m\\u001b[1;33m(\\u001b[0m\\u001b[1;34m\'abracadabra\'\\u001b[0m\\u001b[1;33m,\\u001b[0m\\u001b[1;34m\'r\'\\u001b[0m\\u001b[1;33m)\\u001b[0m\\u001b[1;33m\\u001b[0m\\u001b[0m\\n\\u001b[0m",\n      "\\u001b[1;31mFileNotFoundError\\u001b[0m: [Errno 2] No such file or directory: \'abracadabra\'"\n     ]\n    }\n   ],\n   "source": [\n    "f = open(\'abracadabra\',\'r\')"\n   ]\n  },\n  {\n   "cell_type": "code",\n   "execution_count": 3,\n   "metadata": {\n    "collapsed": true\n   },\n   "outputs": [],\n   "source": [\n    "fp = open(\'File_Handling.ipynb\',\'r\')"\n   ]\n  },\n  {\n   "cell_type": "code",\n   "execution_count": 4,\n   "metadata": {\n    "collapsed": true\n   },\n   "outputs": [],\n   "source": [\n    "data = fp.read(10)"\n   ]\n  },\n  {\n   "cell_type": "code",\n   "execution_count": 5,\n   "metadata": {},\n   "outputs": [\n    {\n     "data": {\n      "text/plain": [\n       "\'{\\\\n \\"cells\\"\'"\n      ]\n     },\n     "execution_count": 5,\n     "metadata": {},\n     "output_type": "execute_result"\n    }\n   ],\n   "source": [\n    "data"\n   ]\n  },\n  {\n   "cell_type": "code",\n   "execution_count": 6,\n   "metadata": {},\n   "outputs": [\n    {\n     "data": {\n      "text/plain": [\n       "\': [\\\\n  {\\\\n  \'"\n      ]\n     },\n     "execution_count": 6,\n     "metadata": {},\n     "output_type": "execute_result"\n    }\n   ],\n   "source": [\n    "data = fp.read(10)\\n",\n    "data"\n   ]\n  },\n  {\n   "cell_type": "code",\n   "execution_count": null,\n   "metadata": {\n    "collapsed": true\n   },\n   "outputs": [],\n   "source": []\n  }\n ],\n "metadata": {\n  "kernelspec": {\n   "display_name": "Python 3",\n   "language": "python",\n   "name": "python3"\n  },\n  "language_info": {\n   "codemirror_mode": {\n    "name": "ipython",\n    "version": 3\n   },\n   "file_extension": ".py",\n   "mimetype": "text/x-python",\n   "name": "python",\n   "nbconvert_exporter": "python",\n   "pygments_lexer": "ipython3",\n   "version": "3.6.3"\n  }\n },\n "nbformat": 4,\n "nbformat_minor": 2\n}\n'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    fp.close()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    fp = open('c:\\users\\sachin yadav\\Desktop\\hello.txt','w')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    fp.write('hello world this is awesome\n')
    +fp.write('\t\tThis is super easy in python.\n')
    +s = """hello,
    +    This is python file handling.
    +                there are 3 modes - 
    +1.read
    +2.write
    +3.append"""
    +fp.write(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[14]:
    + + + + +
    +
    101
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    fp.read()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +UnsupportedOperation                      Traceback (most recent call last)
    +<ipython-input-15-7310eeaf713c> in <module>()
    +----> 1 fp.read()
    +
    +UnsupportedOperation: not readable
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    fp.readable()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[17]:
    + + + + +
    +
    False
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    fp.writable()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[18]:
    + + + + +
    +
    True
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    fp.seekable()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[19]:
    + + + + +
    +
    True
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    fp.mode
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[20]:
    + + + + +
    +
    'w'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [22]:
    +
    +
    +
    fp.name
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[22]:
    + + + + +
    +
    'c:\\users\\sachin yadav\\Desktop\\hello.txt'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    fp.encoding
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[23]:
    + + + + +
    +
    'cp1252'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [24]:
    +
    +
    +
    fp.close()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [36]:
    +
    +
    +
    f = open('c:\\users\\sachin yadav\\desktop\\hello.txt','a+')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [37]:
    +
    +
    +
    print(dir(f))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['_CHUNK_SIZE', '__class__', '__del__', '__delattr__', '__dict__', '__dir__', '__doc__', '__enter__', '__eq__', '__exit__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__lt__', '__ne__', '__new__', '__next__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_checkClosed', '_checkReadable', '_checkSeekable', '_checkWritable', '_finalizing', 'buffer', 'close', 'closed', 'detach', 'encoding', 'errors', 'fileno', 'flush', 'isatty', 'line_buffering', 'mode', 'name', 'newlines', 'read', 'readable', 'readline', 'readlines', 'seek', 'seekable', 'tell', 'truncate', 'writable', 'write', 'writelines']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [39]:
    +
    +
    +
    help(f.detach)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Help on built-in function detach:
    +
    +detach() method of _io.TextIOWrapper instance
    +    Separate the underlying buffer from the TextIOBase and return it.
    +    
    +    After the underlying buffer has been detached, the TextIO is in an
    +    unusable state.
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [40]:
    +
    +
    +
    f.detach()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[40]:
    + + + + +
    +
    <_io.BufferedRandom name='c:\\users\\sachin yadav\\desktop\\hello.txt'>
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [41]:
    +
    +
    +
    f.read()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +ValueError                                Traceback (most recent call last)
    +<ipython-input-41-bacd0e0f09a3> in <module>()
    +----> 1 f.read()
    +
    +ValueError: underlying buffer has been detached
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [42]:
    +
    +
    +
    f = open('c:\\users\\sachin yadav\\desktop\\hello.txt')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [43]:
    +
    +
    +
    help(f.flush)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Help on built-in function flush:
    +
    +flush() method of _io.TextIOWrapper instance
    +    Flush write buffers, if applicable.
    +    
    +    This is not implemented for read-only and non-blocking streams.
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [44]:
    +
    +
    +
    f.flush()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [46]:
    +
    +
    +
    print(f.tell())
    +print(f.read())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    0
    +hello world this is awesome
    +		This is super easy in python.
    +hello,
    +    This is python file handling.
    +                there are 3 modes - 
    +1.read
    +2.write
    +3.append
    +		Hi this is sucessfully appended
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    f.seek(0)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[27]:
    + + + + +
    +
    0
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [28]:
    +
    +
    +
    s = f.read()
    +print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    hello world this is awesome
    +		This is super easy in python.
    +hello,
    +    This is python file handling.
    +                there are 3 modes - 
    +1.read
    +2.write
    +3.append
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [29]:
    +
    +
    +
    s
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[29]:
    + + + + +
    +
    'hello world this is awesome\n\t\tThis is super easy in python.\nhello,\n    This is python file handling.\n                there are 3 modes - \n1.read\n2.write\n3.append'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [30]:
    +
    +
    +
    f.write("\n")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[30]:
    + + + + +
    +
    1
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [31]:
    +
    +
    +
    f.write("\t\tHi this is sucessfully appended")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[31]:
    + + + + +
    +
    33
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [32]:
    +
    +
    +
    f.seek(0)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[32]:
    + + + + +
    +
    0
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [34]:
    +
    +
    +
    f.seek(0)
    +d = f.read()
    +print(d)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    hello world this is awesome
    +		This is super easy in python.
    +hello,
    +    This is python file handling.
    +                there are 3 modes - 
    +1.read
    +2.write
    +3.append
    +		Hi this is sucessfully appended
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [47]:
    +
    +
    +
    f.close()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [48]:
    +
    +
    +
    with open('/users/sachin yadav/desktop/hello.txt') as fp:
    +    data = fp.read()
    +    f.close()
    +print(data)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    hello world this is awesome
    +		This is super easy in python.
    +hello,
    +    This is python file handling.
    +                there are 3 modes - 
    +1.read
    +2.write
    +3.append
    +		Hi this is sucessfully appended
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [49]:
    +
    +
    +
    l = []
    +for var in range(5):
    +    st = input('Name,Maths,Science,English  :').split(',')
    +    s = '\t'.join(st)
    +    l.append(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Name,Maths,Science,English  :sachin,78,98,89
    +Name,Maths,Science,English  :kritika,89,87,78
    +Name,Maths,Science,English  :rajat,89,67,56
    +Name,Maths,Science,English  :nidhi,88,77,66
    +Name,Maths,Science,English  :hello,89,67,88
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [50]:
    +
    +
    +
    print(l)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['sachin\t78\t98\t89', 'kritika\t89\t87\t78', 'rajat\t89\t67\t56', 'nidhi\t88\t77\t66', 'hello\t89\t67\t88']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [51]:
    +
    +
    +
    s = '\n'.join(l)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [52]:
    +
    +
    +
    print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    sachin	78	98	89
    +kritika	89	87	78
    +rajat	89	67	56
    +nidhi	88	77	66
    +hello	89	67	88
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [54]:
    +
    +
    +
    k = 'Name\tMaths\tScience\tEnglish\n'
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [55]:
    +
    +
    +
    s = k+s
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [56]:
    +
    +
    +
    print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Name	Maths	Science	English
    +sachin	78	98	89
    +kritika	89	87	78
    +rajat	89	67	56
    +nidhi	88	77	66
    +hello	89	67	88
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [57]:
    +
    +
    +
    f = open('st_data.txt','w')
    +f.write(s)
    +f.close()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/File_Handling.ipynb b/python_ipynb/File_Handling.ipynb new file mode 100644 index 0000000..4597d74 --- /dev/null +++ b/python_ipynb/File_Handling.ipynb @@ -0,0 +1,905 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    File Handling in Python

    " + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "ename": "FileNotFoundError", + "evalue": "[Errno 2] No such file or directory: 'abracadabra'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mFileNotFoundError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mf\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'abracadabra'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'r'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'abracadabra'" + ] + } + ], + "source": [ + "f = open('abracadabra','r')" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "fp = open('File_Handling.ipynb','r')" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "data = fp.read(10)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'{\\n \"cells\"'" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "data" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "': [\\n {\\n '" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "data = fp.read(10)\n", + "data" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "20" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.tell()" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.seek(0)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.tell()" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "data = fp.read()" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'{\\n \"cells\": [\\n {\\n \"cell_type\": \"markdown\",\\n \"metadata\": {},\\n \"source\": [\\n \"

    File Handling in Python

    \"\\n ]\\n },\\n {\\n \"cell_type\": \"code\",\\n \"execution_count\": 2,\\n \"metadata\": {},\\n \"outputs\": [\\n {\\n \"ename\": \"FileNotFoundError\",\\n \"evalue\": \"[Errno 2] No such file or directory: \\'abracadabra\\'\",\\n \"output_type\": \"error\",\\n \"traceback\": [\\n \"\\\\u001b[1;31m---------------------------------------------------------------------------\\\\u001b[0m\",\\n \"\\\\u001b[1;31mFileNotFoundError\\\\u001b[0m Traceback (most recent call last)\",\\n \"\\\\u001b[1;32m\\\\u001b[0m in \\\\u001b[0;36m\\\\u001b[1;34m()\\\\u001b[0m\\\\n\\\\u001b[1;32m----> 1\\\\u001b[1;33m \\\\u001b[0mf\\\\u001b[0m \\\\u001b[1;33m=\\\\u001b[0m \\\\u001b[0mopen\\\\u001b[0m\\\\u001b[1;33m(\\\\u001b[0m\\\\u001b[1;34m\\'abracadabra\\'\\\\u001b[0m\\\\u001b[1;33m,\\\\u001b[0m\\\\u001b[1;34m\\'r\\'\\\\u001b[0m\\\\u001b[1;33m)\\\\u001b[0m\\\\u001b[1;33m\\\\u001b[0m\\\\u001b[0m\\\\n\\\\u001b[0m\",\\n \"\\\\u001b[1;31mFileNotFoundError\\\\u001b[0m: [Errno 2] No such file or directory: \\'abracadabra\\'\"\\n ]\\n }\\n ],\\n \"source\": [\\n \"f = open(\\'abracadabra\\',\\'r\\')\"\\n ]\\n },\\n {\\n \"cell_type\": \"code\",\\n \"execution_count\": 3,\\n \"metadata\": {\\n \"collapsed\": true\\n },\\n \"outputs\": [],\\n \"source\": [\\n \"fp = open(\\'File_Handling.ipynb\\',\\'r\\')\"\\n ]\\n },\\n {\\n \"cell_type\": \"code\",\\n \"execution_count\": 4,\\n \"metadata\": {\\n \"collapsed\": true\\n },\\n \"outputs\": [],\\n \"source\": [\\n \"data = fp.read(10)\"\\n ]\\n },\\n {\\n \"cell_type\": \"code\",\\n \"execution_count\": 5,\\n \"metadata\": {},\\n \"outputs\": [\\n {\\n \"data\": {\\n \"text/plain\": [\\n \"\\'{\\\\\\\\n \\\\\"cells\\\\\"\\'\"\\n ]\\n },\\n \"execution_count\": 5,\\n \"metadata\": {},\\n \"output_type\": \"execute_result\"\\n }\\n ],\\n \"source\": [\\n \"data\"\\n ]\\n },\\n {\\n \"cell_type\": \"code\",\\n \"execution_count\": 6,\\n \"metadata\": {},\\n \"outputs\": [\\n {\\n \"data\": {\\n \"text/plain\": [\\n \"\\': [\\\\\\\\n {\\\\\\\\n \\'\"\\n ]\\n },\\n \"execution_count\": 6,\\n \"metadata\": {},\\n \"output_type\": \"execute_result\"\\n }\\n ],\\n \"source\": [\\n \"data = fp.read(10)\\\\n\",\\n \"data\"\\n ]\\n },\\n {\\n \"cell_type\": \"code\",\\n \"execution_count\": null,\\n \"metadata\": {\\n \"collapsed\": true\\n },\\n \"outputs\": [],\\n \"source\": []\\n }\\n ],\\n \"metadata\": {\\n \"kernelspec\": {\\n \"display_name\": \"Python 3\",\\n \"language\": \"python\",\\n \"name\": \"python3\"\\n },\\n \"language_info\": {\\n \"codemirror_mode\": {\\n \"name\": \"ipython\",\\n \"version\": 3\\n },\\n \"file_extension\": \".py\",\\n \"mimetype\": \"text/x-python\",\\n \"name\": \"python\",\\n \"nbconvert_exporter\": \"python\",\\n \"pygments_lexer\": \"ipython3\",\\n \"version\": \"3.6.3\"\\n }\\n },\\n \"nbformat\": 4,\\n \"nbformat_minor\": 2\\n}\\n'" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "data" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "fp.close()" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "fp = open('c:\\\\users\\\\sachin yadav\\\\Desktop\\\\hello.txt','w')" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "101" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.write('hello world this is awesome\\n')\n", + "fp.write('\\t\\tThis is super easy in python.\\n')\n", + "s = \"\"\"hello,\n", + " This is python file handling.\n", + " there are 3 modes - \n", + "1.read\n", + "2.write\n", + "3.append\"\"\"\n", + "fp.write(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "ename": "UnsupportedOperation", + "evalue": "not readable", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mUnsupportedOperation\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mfp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mUnsupportedOperation\u001b[0m: not readable" + ] + } + ], + "source": [ + "fp.read()" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.readable()" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.writable()" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.seekable()" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'w'" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.mode" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'c:\\\\users\\\\sachin yadav\\\\Desktop\\\\hello.txt'" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.name" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'cp1252'" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.encoding" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "fp.close()" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "f = open('c:\\\\users\\\\sachin yadav\\\\desktop\\\\hello.txt','a+')" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['_CHUNK_SIZE', '__class__', '__del__', '__delattr__', '__dict__', '__dir__', '__doc__', '__enter__', '__eq__', '__exit__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__lt__', '__ne__', '__new__', '__next__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_checkClosed', '_checkReadable', '_checkSeekable', '_checkWritable', '_finalizing', 'buffer', 'close', 'closed', 'detach', 'encoding', 'errors', 'fileno', 'flush', 'isatty', 'line_buffering', 'mode', 'name', 'newlines', 'read', 'readable', 'readline', 'readlines', 'seek', 'seekable', 'tell', 'truncate', 'writable', 'write', 'writelines']\n" + ] + } + ], + "source": [ + "print(dir(f))" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Help on built-in function detach:\n", + "\n", + "detach() method of _io.TextIOWrapper instance\n", + " Separate the underlying buffer from the TextIOBase and return it.\n", + " \n", + " After the underlying buffer has been detached, the TextIO is in an\n", + " unusable state.\n", + "\n" + ] + } + ], + "source": [ + "help(f.detach)" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "<_io.BufferedRandom name='c:\\\\users\\\\sachin yadav\\\\desktop\\\\hello.txt'>" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "f.detach()" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ + { + "ename": "ValueError", + "evalue": "underlying buffer has been detached", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mf\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mValueError\u001b[0m: underlying buffer has been detached" + ] + } + ], + "source": [ + "f.read()" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "f = open('c:\\\\users\\\\sachin yadav\\\\desktop\\\\hello.txt')" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Help on built-in function flush:\n", + "\n", + "flush() method of _io.TextIOWrapper instance\n", + " Flush write buffers, if applicable.\n", + " \n", + " This is not implemented for read-only and non-blocking streams.\n", + "\n" + ] + } + ], + "source": [ + "help(f.flush)" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "f.flush()" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "hello world this is awesome\n", + "\t\tThis is super easy in python.\n", + "hello,\n", + " This is python file handling.\n", + " there are 3 modes - \n", + "1.read\n", + "2.write\n", + "3.append\n", + "\t\tHi this is sucessfully appended\n" + ] + } + ], + "source": [ + "print(f.tell())\n", + "print(f.read())" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "f.seek(0)" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello world this is awesome\n", + "\t\tThis is super easy in python.\n", + "hello,\n", + " This is python file handling.\n", + " there are 3 modes - \n", + "1.read\n", + "2.write\n", + "3.append\n" + ] + } + ], + "source": [ + "s = f.read()\n", + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'hello world this is awesome\\n\\t\\tThis is super easy in python.\\nhello,\\n This is python file handling.\\n there are 3 modes - \\n1.read\\n2.write\\n3.append'" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "f.write(\"\\n\")" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "33" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "f.write(\"\\t\\tHi this is sucessfully appended\")" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "f.seek(0)" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello world this is awesome\n", + "\t\tThis is super easy in python.\n", + "hello,\n", + " This is python file handling.\n", + " there are 3 modes - \n", + "1.read\n", + "2.write\n", + "3.append\n", + "\t\tHi this is sucessfully appended\n" + ] + } + ], + "source": [ + "f.seek(0)\n", + "d = f.read()\n", + "print(d)" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "f.close()" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello world this is awesome\n", + "\t\tThis is super easy in python.\n", + "hello,\n", + " This is python file handling.\n", + " there are 3 modes - \n", + "1.read\n", + "2.write\n", + "3.append\n", + "\t\tHi this is sucessfully appended\n" + ] + } + ], + "source": [ + "with open('/users/sachin yadav/desktop/hello.txt') as fp:\n", + " data = fp.read()\n", + " f.close()\n", + "print(data)" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Name,Maths,Science,English :sachin,78,98,89\n", + "Name,Maths,Science,English :kritika,89,87,78\n", + "Name,Maths,Science,English :rajat,89,67,56\n", + "Name,Maths,Science,English :nidhi,88,77,66\n", + "Name,Maths,Science,English :hello,89,67,88\n" + ] + } + ], + "source": [ + "l = []\n", + "for var in range(5):\n", + " st = input('Name,Maths,Science,English :').split(',')\n", + " s = '\\t'.join(st)\n", + " l.append(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['sachin\\t78\\t98\\t89', 'kritika\\t89\\t87\\t78', 'rajat\\t89\\t67\\t56', 'nidhi\\t88\\t77\\t66', 'hello\\t89\\t67\\t88']\n" + ] + } + ], + "source": [ + "print(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = '\\n'.join(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "sachin\t78\t98\t89\n", + "kritika\t89\t87\t78\n", + "rajat\t89\t67\t56\n", + "nidhi\t88\t77\t66\n", + "hello\t89\t67\t88\n" + ] + } + ], + "source": [ + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "k = 'Name\\tMaths\\tScience\\tEnglish\\n'" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = k+s" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Name\tMaths\tScience\tEnglish\n", + "sachin\t78\t98\t89\n", + "kritika\t89\t87\t78\n", + "rajat\t89\t67\t56\n", + "nidhi\t88\t77\t66\n", + "hello\t89\t67\t88\n" + ] + } + ], + "source": [ + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "f = open('st_data.txt','w')\n", + "f.write(s)\n", + "f.close()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Functions_In_Python3.html b/python_ipynb/Functions_In_Python3.html new file mode 100644 index 0000000..3476025 --- /dev/null +++ b/python_ipynb/Functions_In_Python3.html @@ -0,0 +1,14146 @@ + + + + +Functions_In_Python3 + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +

    What is a Function ?

    +
    +
    +
    +
    +
    +
    In [ ]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    +
    +
    +

    fuctions are just block of statements, which are group together to perform a specific task. The main motive to define function is reuseablity and reducing the code length.

    +
    +
    +
    +
    +
    +
    In [1]:
    +
    +
    +
    x = 5 ;
    +y = 6;
    +print("Hello world"); print(x,y)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello world
    +5 6
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    print("HI")
    +print("Bye")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    HI
    +Bye
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    def hello(name):
    +    """Doc-String We define our function here
    +    so it is a documentation of function that how your function works.
    +    anyone can read this by calling help(hello) or by printing doc string
    +    as print(hello.__doc__)
    +    """
    +    print(f"Helllo {name}")
    +    print("This is Function")
    +    return 0
    +
    +print(hello.__doc__)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Doc-String We define our function here
    +    so it is a documentation of function that how your function works.
    +    anyone can read this by calling help(hello) or by printing doc string
    +    as print(hello.__doc__)
    +    
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    x = hello()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +TypeError                                 Traceback (most recent call last)
    +<ipython-input-4-2e5dc5cded3e> in <module>()
    +----> 1 x = hello()
    +
    +TypeError: hello() missing 1 required positional argument: 'name'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    x = hello('sachin')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Helllo sachin
    +This is Function
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    0
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    def even(num):
    +    """even(num)---> even takes a num and True if number is even else 
    +    return false if num is odd"""
    +    if num % 2 : 
    +        return False
    +    return True
    +
    +x = even(6)
    +print(x)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    True
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    help(even)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Help on function even in module __main__:
    +
    +even(num)
    +    even(num)---> even takes a num and True if number is even else 
    +    return false if num is odd
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    import random
    +help(random.randint)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Help on method randint in module random:
    +
    +randint(a, b) method of random.Random instance
    +    Return random integer in range [a, b], including both end points.
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    print("Hello world".center(70))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
                                 Hello world                              
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    print("Hello world".rjust(50))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
                                           Hello world
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [56]:
    +
    +
    +
    def print_board(pos=False):
    +    """It will cross dot Board"""
    +    if not pos : 
    +        pos = [ 1,2,3,4,5,6,7,8,9]
    +    top = " {} "+"|"+" {} "+"|"+" {} "
    +    middle = "_"*3+"|"+"_"*3+"|"+"_"*3
    +    print(top.format(pos[0],pos[1],pos[2]))
    +    print(middle)
    +    print(top.format(pos[3],pos[4],pos[5]))
    +    print(middle)
    +    print(top.format(pos[6],pos[7],pos[8]))
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [57]:
    +
    +
    +
    print_board()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
     1 | 2 | 3 
    +___|___|___
    + 4 | 5 | 6 
    +___|___|___
    + 7 | 8 | 9 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [59]:
    +
    +
    +
    print_board([" ",]*9)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
       |   |   
    +___|___|___
    +   |   |   
    +___|___|___
    +   |   |   
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [60]:
    +
    +
    +
    current_pos = [ " " ]*9
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [61]:
    +
    +
    +
    print_board(current_pos)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
       |   |   
    +___|___|___
    +   |   |   
    +___|___|___
    +   |   |   
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [62]:
    +
    +
    +
    current_pos[5] = "X"
    +current_pos[8] = "0"
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [63]:
    +
    +
    +
    print_board(current_pos)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
       |   |   
    +___|___|___
    +   |   | X 
    +___|___|___
    +   |   | 0 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [69]:
    +
    +
    +
    current_pos = [" ",]*9
    +def play_box():
    +    global current_pos
    +    p1_ch = "X"
    +    p2_ch = "0"
    +    covered_pos = []
    +    pl1 = input("Enter player1 Name : ")
    +    pl2 = input("Enter player2 Name : ")
    +    print(f"Choice of {pl1} = {p1_ch}")
    +    print(f"Choice of {pl2} = {p2_ch}")
    +    c = 1 
    +    while c <= 9 :
    +        covered_pos.sort()
    +        if c %2 : 
    +            p1 = int(input(f"Enter your pos {pl1} (1,9) :  "))
    +            if p1 in covered_pos : 
    +                print("Already Covered Position Please Select Another Pos")
    +                print("Choose except ",covered_pos)
    +                continue
    +            covered_pos.append(p1)
    +            current_pos[p1-1] = p1_ch
    +            print_board(current_pos)
    +            #condition check if p1 is in win postion if it is than print and break
    +        else : 
    +            p2 = int(input(f"Enter your pos {pl2} (1,9) : "))
    +            if p2 in covered_pos : 
    +                print("Already Covered Position Please Select Another Pos")
    +                print("Choose except ",covered_pos)
    +                continue
    +            covered_pos.append(p2)
    +            current_pos[p2-1] = p2_ch
    +            print_board(current_pos)
    +            #check whethre p2 is winner 
    +
    +        c = c + 1
    +    
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [70]:
    +
    +
    +
    play_box()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter player1 Name : saschin
    +Enter player2 Name : raja
    +Choice of saschin = X
    +Choice of raja = 0
    +Enter your pos saschin (1,9) :  5
    +   |   |   
    +___|___|___
    +   | X |   
    +___|___|___
    +   |   |   
    +Enter your pos raja (1,9) : 3
    +   |   | 0 
    +___|___|___
    +   | X |   
    +___|___|___
    +   |   |   
    +Enter your pos saschin (1,9) :  3
    +Already Covered Position Please Select Another Pos
    +Choose except  [3, 5]
    +Enter your pos saschin (1,9) :  1
    + X |   | 0 
    +___|___|___
    +   | X |   
    +___|___|___
    +   |   |   
    +Enter your pos raja (1,9) : 2
    + X | 0 | 0 
    +___|___|___
    +   | X |   
    +___|___|___
    +   |   |   
    +Enter your pos saschin (1,9) :  3
    +Already Covered Position Please Select Another Pos
    +Choose except  [1, 2, 3, 5]
    +Enter your pos saschin (1,9) :  4
    + X | 0 | 0 
    +___|___|___
    + X | X |   
    +___|___|___
    +   |   |   
    +Enter your pos raja (1,9) : 5
    +Already Covered Position Please Select Another Pos
    +Choose except  [1, 2, 3, 4, 5]
    +Enter your pos raja (1,9) : 6
    + X | 0 | 0 
    +___|___|___
    + X | X | 0 
    +___|___|___
    +   |   |   
    +Enter your pos saschin (1,9) :  7
    + X | 0 | 0 
    +___|___|___
    + X | X | 0 
    +___|___|___
    + X |   |   
    +Enter your pos raja (1,9) : 8
    + X | 0 | 0 
    +___|___|___
    + X | X | 0 
    +___|___|___
    + X | 0 |   
    +Enter your pos saschin (1,9) :  9
    + X | 0 | 0 
    +___|___|___
    + X | X | 0 
    +___|___|___
    + X | 0 | X 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [76]:
    +
    +
    +
    def print_board(pos=False):
    +    """It will cross dot Board"""
    +    if not pos : 
    +        pos = [ 1,2,3,4,5,6,7,8,9]
    +    top = " {} "+"|"+" {} "+"|"+" {} "
    +    middle = "_"*3+"|"+"_"*3+"|"+"_"*3
    +    print(top.format(pos[0],pos[1],pos[2]))
    +    print(middle)
    +    print(top.format(pos[3],pos[4],pos[5]))
    +    print(middle)
    +    print(top.format(pos[6],pos[7],pos[8]))
    +
    +
    +winning_pos = { 
    +                0:[(1,2),(4,8),(3,6)],
    +                1:[ (4,7),(0,2) ],
    +                2:[ (0,1),(4,6),(5,8)],
    +                3:[ (0,6),(4,5)],
    +                4:[ (1,7),(3,5)],
    +                5:[ (2,8),(3,4)],
    +                6:[ (0,3),(4,2),(7,8)],
    +                7:[ (1,4),(6,8)],
    +                8:[ (0,4),(2,5),(6,7)]
    +               
    +                    }
    +
    +current_pos = [" ",]*9
    +def play_box():
    +    global current_pos
    +    p1_ch = "X"
    +    p2_ch = "0"
    +    covered_pos = []
    +    pl1 = input("Enter player1 Name : ")
    +    pl2 = input("Enter player2 Name : ")
    +    print(f"Choice of {pl1} = {p1_ch}")
    +    print(f"Choice of {pl2} = {p2_ch}")
    +    c = 1 
    +    while c <= 9 :
    +        covered_pos.sort()
    +        if c %2 : 
    +            p1 = int(input(f"Enter your pos {pl1} (1,9) :  "))
    +            if p1 in covered_pos : 
    +                print("Already Covered Position Please Select Another Pos")
    +                print("Choose except ",covered_pos)
    +                continue
    +            covered_pos.append(p1)
    +            current_pos[p1-1] = p1_ch
    +            print_board(current_pos)
    +            check = p1 - 1
    +            data = winning_pos.get(check)
    +            for d in data : 
    +                if p1_ch == current_pos[d[0]] and p1_ch == current_pos[d[1]] :
    +                    print(f"{pl1} is Winner")
    +                    exit(0)
    +                    
    +            
    +            #condition check if p1 is in win postion if it is than print and break
    +        else : 
    +            p2 = int(input(f"Enter your pos {pl2} (1,9) : "))
    +            if p2 in covered_pos : 
    +                print("Already Covered Position Please Select Another Pos")
    +                print("Choose except ",covered_pos)
    +                continue
    +            covered_pos.append(p2)
    +            current_pos[p2-1] = p2_ch
    +            print_board(current_pos)
    +            #check whethre p2 is winner 
    +
    +        c = c + 1
    +    
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [77]:
    +
    +
    +
    current_pos = [" ",]*9
    +def play_box():
    +    global current_pos
    +    p1_ch = "X"
    +    p2_ch = "0"
    +    covered_pos = []
    +    pl1 = input("Enter player1 Name : ")
    +    pl2 = input("Enter player2 Name : ")
    +    print(f"Choice of {pl1} = {p1_ch}")
    +    print(f"Choice of {pl2} = {p2_ch}")
    +    c = 1 
    +    while c <= 9 :
    +        covered_pos.sort()
    +        if c %2 : 
    +            p1 = int(input(f"Enter your pos {pl1} (1,9) :  "))
    +            if p1 in covered_pos : 
    +                print("Already Covered Position Please Select Another Pos")
    +                print("Choose except ",covered_pos)
    +                continue
    +            covered_pos.append(p1)
    +            current_pos[p1-1] = p1_ch
    +            print_board(current_pos)
    +            check = p1 - 1
    +            data = winning_pos.get(check)
    +            for d in data : 
    +                if p1_ch == current_pos[d[0]] and p1_ch == current_pos[d[1]] :
    +                    print(f"{pl1} is Winner")
    +                    exit(0)
    +                    
    +            
    +            #condition check if p1 is in win postion if it is than print and break
    +        else : 
    +            p2 = int(input(f"Enter your pos {pl2} (1,9) : "))
    +            if p2 in covered_pos : 
    +                print("Already Covered Position Please Select Another Pos")
    +                print("Choose except ",covered_pos)
    +                continue
    +            covered_pos.append(p2)
    +            current_pos[p2-1] = p2_ch
    +            print_board(current_pos)
    +            #check whethre p2 is winner 
    +
    +        c = c + 1
    +    
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [78]:
    +
    +
    +
    play_box()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter player1 Name : sachin
    +Enter player2 Name : rajat
    +Choice of sachin = X
    +Choice of rajat = 0
    +Enter your pos sachin (1,9) :  1
    + X |   |   
    +___|___|___
    +   |   |   
    +___|___|___
    +   |   |   
    +Enter your pos rajat (1,9) : 2
    + X | 0 |   
    +___|___|___
    +   |   |   
    +___|___|___
    +   |   |   
    +Enter your pos sachin (1,9) :  5
    + X | 0 |   
    +___|___|___
    +   | X |   
    +___|___|___
    +   |   |   
    +Enter your pos rajat (1,9) : 3
    + X | 0 | 0 
    +___|___|___
    +   | X |   
    +___|___|___
    +   |   |   
    +Enter your pos sachin (1,9) :  9
    + X | 0 | 0 
    +___|___|___
    +   | X |   
    +___|___|___
    +   |   | X 
    +sachin is Winner
    +Enter your pos rajat (1,9) : 4
    + X | 0 | 0 
    +___|___|___
    + 0 | X |   
    +___|___|___
    +   |   | X 
    +Enter your pos sachin (1,9) :  5
    +Already Covered Position Please Select Another Pos
    +Choose except  [1, 2, 3, 4, 5, 9]
    +Enter your pos sachin (1,9) :  6
    + X | 0 | 0 
    +___|___|___
    + 0 | X | X 
    +___|___|___
    +   |   | X 
    +Enter your pos rajat (1,9) : 7
    + X | 0 | 0 
    +___|___|___
    + 0 | X | X 
    +___|___|___
    + 0 |   | X 
    +Enter your pos sachin (1,9) :  8
    + X | 0 | 0 
    +___|___|___
    + 0 | X | X 
    +___|___|___
    + 0 | X | X 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    import random
    +random.choice([1,2,3,4,6,7,8,9])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[2]:
    + + + + +
    +
    4
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/Functions_in_Python.html b/python_ipynb/Functions_in_Python.html new file mode 100644 index 0000000..c265df8 --- /dev/null +++ b/python_ipynb/Functions_in_Python.html @@ -0,0 +1,16466 @@ + + + + +Functions_in_Python + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +

    Functions

    +
    +
    +
    +
    +
    +
    +

    What is a function ?

    +
    +
    +
    +
    +
    +
    In [2]:
    +
    +
    +
    def fun():
    +    pass
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    k  = fun()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    None
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    def hello(name):
    +    print("Hello World!! Welcome to python")
    +    print("Welcome, {}".format(name).center(1000,'*'))
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    hello('sachin yadav')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World!! Welcome to python
    +*********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************Welcome, sachin yadav**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    def calc(x,y,ch):
    +    """calc(x,y,ch)-> result
    +    calc functions takes 3 inputs and return evaluated expression. """
    +    if ch == '+' :
    +        r = x + y 
    +    elif ch == '-'  : 
    +        r = x -y 
    +    elif ch == '*' :
    +        r = x * y 
    +    elif ch == '**' : 
    +        r = x ** y 
    +    else :
    +        if y != 0 :
    +            if ch == '/' :
    +                r = x /y 
    +            elif ch == '//' :
    +                r = x // y 
    +            elif ch == '%' :
    +                r == x % y
    +            else :
    +                r = "Wrong Choice"
    +        else : 
    +            r = "Value of Y can not be zero for division o/p"
    +    return r
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    r = calc(4,5,'/')
    +r1 = calc(5,0,'//')
    +r2 = calc(6,5,'**')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    r
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[12]:
    + + + + +
    +
    0.8
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    r1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[13]:
    + + + + +
    +
    'Value of Y can not be zero for division o/p'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +

    +
    +
    +
    +
    +
    +
    In [14]:
    +
    +
    +
    r2
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[14]:
    + + + + +
    +
    7776
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    def swap(x,y):
    +    return y,x
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    x = 10
    +y = 20
    +x,y = swap(x,y)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[17]:
    + + + + +
    +
    20
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    y
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[18]:
    + + + + +
    +
    10
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    #word and line and charcter cout
    +def count(string):
    +    #your code goes here
    +    raw = string.split()
    +    w = len(raw)
    +    l = len(string.split('\n'))
    +    k = ''.join(raw)
    +    k.replace('\n','')
    +    c = len(k)
    +    return l,w,c
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    s = """Hello World,
    +Welcome to python world.
    +        python functions are very very easy.
    +just practise them on regular basis."""
    +
    +l,w,c = count(s)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [24]:
    +
    +
    +
    l
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[24]:
    + + + + +
    +
    4
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    w
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[25]:
    + + + + +
    +
    18
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [26]:
    +
    +
    +
    c
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[26]:
    + + + + +
    +
    94
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +

    Recursion

    +
    +
    +
    +
    +
    +
    In [4]:
    +
    +
    +
    num = int(input("Enter a number : "))
    +c = 1
    +fact = 1
    +while c <= num : 
    +    fact = fact*c 
    +    c = c + 1
    +print("Factorial of {1} is {0}.".format(fact,num))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter a number : 3
    +Factorial of 3 is 6.
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    s = "{0}{1}{0}{1}{0}{1}".format('hello World', 'python')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    hello Worldpythonhello Worldpythonhello Worldpython
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    def fact(num):
    +    s = 1
    +    for var in range(1,num+1):
    +        s = s*var
    +    return s
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    r1 = fact(5)
    +r2 = fact(7)
    +r3 = fact(123)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    r1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[9]:
    + + + + +
    +
    120
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    r2
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[10]:
    + + + + +
    +
    5040
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    r3
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[11]:
    + + + + +
    +
    12146304367025329675766243241881295855454217088483382315328918161829235892362167668831156960612640202170735835221294047782591091570411651472186029519906261646730733907419814952960000000000000000000000000000
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    def one():
    +    print("Hi i am function 1")
    +    return 'one'
    +def two():
    +    print("Hi i am fuction 2")
    +    return 'two'
    +def three():
    +    print("Hi i am function 3")
    +    return 'three'
    +def main():
    +    f1 = one()
    +    f2 = two()
    +    f3 = three()
    +    print(f1)
    +    print(f2)
    +    print(f3)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    main()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hi i am function 1
    +Hi i am fuction 2
    +Hi i am function 3
    +one
    +two
    +three
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    def one():
    +    print('one')
    +    two()
    +def two():
    +    print('two')
    +
    +one()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    one
    +two
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [24]:
    +
    +
    +
    def hello():
    +    print("Hello World Times {}".format(hello.x))
    +    if hello.x < 10 : 
    +        hello.x = hello.x + 1
    +        hello()
    +        
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    hello.x = 1
    +hello()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World Times 1
    +Hello World Times 2
    +Hello World Times 3
    +Hello World Times 4
    +Hello World Times 5
    +Hello World Times 6
    +Hello World Times 7
    +Hello World Times 8
    +Hello World Times 9
    +Hello World Times 10
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    Special Functions in Python

    lambda function

    +
    +
    +
    +
    +
    +
    +

    It is known as inline function in python. It is also famous as Annonyms function in python. It is used to define a function in single line. it used lambda keyword instead of def.

    +
    +
    +
    +
    +
    +
    In [26]:
    +
    +
    +
    def add(x,y):
    +    return x + y 
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    add(4,5)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[27]:
    + + + + +
    +
    9
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [28]:
    +
    +
    +
    add = lambda arg1,arg2 : arg1 + arg2
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [29]:
    +
    +
    +
    add(10,20)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[29]:
    + + + + +
    +
    30
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [30]:
    +
    +
    +
    fact = lambda num : 1 if num == 1 else num*fact(num-1)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [31]:
    +
    +
    +
    fact(5)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[31]:
    + + + + +
    +
    120
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [33]:
    +
    +
    +
    fact(6)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[33]:
    + + + + +
    +
    720
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +

    map function

    +
    +
    +
    +
    +
    +
    +

    This is used to map a sequence to a specific fuction. it iterate throug a sequence one by one and pass them to given function and store each value for each var that is returned by the function into a special object called map object which is also iterator.

    +
    +
    +
    +
    +
    +
    In [36]:
    +
    +
    +
    #without map 
    +l = [ '1','1.25','6.35','10','20']
    +r = []
    +for var in l : 
    +    x = int(float(var))
    +    r.append(x)
    +print(l)
    +print(r)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['1', '1.25', '6.35', '10', '20']
    +[1, 1, 6, 10, 20]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [37]:
    +
    +
    +
    #take data of 5 students only marks
    +st = []
    +for var in range(5):
    +    st.append(int(input("st[{}]".format(var+1))))
    +print(st)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    st[1]10
    +st[2]20
    +st[3]45
    +st[4]60
    +st[5]15
    +[10, 20, 45, 60, 15]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [38]:
    +
    +
    +
    eve_odd = lambda num : True if num % 2 == 0 else False
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [40]:
    +
    +
    +
    #10 number 
    +l = []
    +for var in range(1,11):
    +    num = int(input("Var[{}]".format(var)))
    +    l.append(num)
    +print(l)
    +r = []
    +for var in l :
    +        check = eve_odd(var)
    +        r.append((var,check))
    +print(r)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Var[1]1
    +Var[2]2
    +Var[3]3
    +Var[4]4
    +Var[5]5
    +Var[6]6
    +Var[7]7
    +Var[8]8
    +Var[9]9
    +Var[10]10
    +[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    +[(1, False), (2, True), (3, False), (4, True), (5, False), (6, True), (7, False), (8, True), (9, False), (10, True)]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [48]:
    +
    +
    +
    k = list(zip(l,map(eve_odd,l)))
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [50]:
    +
    +
    +
    print(k)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [(1, False), (2, True), (3, False), (4, True), (5, False), (6, True), (7, False), (8, True), (9, False), (10, True)]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [46]:
    +
    +
    +
    list(zip([1,2,3],[4,5,6]))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[46]:
    + + + + +
    +
    [(1, 4), (2, 5), (3, 6)]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [53]:
    +
    +
    +
    x = list(map(int,input().split()))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    1 2 3 4 5 6 7 8 9 10
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [54]:
    +
    +
    +
    x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[54]:
    + + + + +
    +
    [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [56]:
    +
    +
    +
    eve_odd(3)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[56]:
    + + + + +
    +
    False
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [60]:
    +
    +
    +
    x = list(filter(lambda num:False if num % 2 else True,map(int,input().split())))
    +x
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    123 234 353 34 23 34 23 2 3234 23 23 23 3 23 23 56 4 23 423 434 
    +
    +
    +
    + +
    + +
    Out[60]:
    + + + + +
    +
    [234, 34, 34, 2, 3234, 56, 4, 434]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    name = input("Names of Students : ").split()
    +maths = list(map(int,input("Maths Marks of Students : ").split()))
    +science = list(map(int,input("Science Marks of Students : ").split()))
    +print(*zip(name,maths,science,map(lambda x,y:(x+y)/2,maths,science)))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Names of Students : x y z
    +Maths Marks of Students : 80 90 70
    +Science Marks of Students : 78 90 67
    +('x', 80, 78, 79.0) ('y', 90, 90, 90.0) ('z', 70, 67, 68.5)
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    data_set1 = [ 50, 80,78,65,60,83,93,72,75,77 ]
    +data_set2 = [ 55,85,80,70,65,70,80,78,60,80]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    len(data_set1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[8]:
    + + + + +
    +
    10
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    len(data_set2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[9]:
    + + + + +
    +
    10
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    age = lambda old,new : (old+new)/2
    +age(60,70)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[10]:
    + + + + +
    +
    65.0
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    r = []
    +for var1,var2 in zip(data_set1,data_set2) : 
    +    r.append(age(var1,var2))
    +r
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[11]:
    + + + + +
    +
    [52.5, 82.5, 79.0, 67.5, 62.5, 76.5, 86.5, 75.0, 67.5, 78.5]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    r = list(map(lambda x,y: (x+y)/2,data_set1,data_set2))
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [26]:
    +
    +
    +
    r
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[26]:
    + + + + +
    +
    [52.5, 82.5, 79.0, 67.5, 62.5, 76.5, 86.5, 75.0, 67.5, 78.5]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    list(map(lambda x:True if x > 75 else False,r))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[27]:
    + + + + +
    +
    [False, True, True, False, False, True, True, False, False, True]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [31]:
    +
    +
    +
    list(filter(lambda x:'kuch bhi' if x > 75 else '',r))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[31]:
    + + + + +
    +
    [82.5, 79.0, 76.5, 86.5, 78.5]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [34]:
    +
    +
    +
    fp = open('something_new.py')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +FileNotFoundError                         Traceback (most recent call last)
    +<ipython-input-34-9fec144e4213> in <module>()
    +----> 1 fp = open('something_new.py')
    +
    +FileNotFoundError: [Errno 2] No such file or directory: 'something_new.py'
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [35]:
    +
    +
    +
    import os
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [37]:
    +
    +
    +
    os.getcwd()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[37]:
    + + + + +
    +
    'C:\\PythonCodes'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [38]:
    +
    +
    +
    os.listdir()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[38]:
    + + + + +
    +
    ['.hello.py.un~',
    + '.ipynb_checkpoints',
    + '.one.py.un~',
    + '.pat.py.un~',
    + '.tds.py.un~',
    + 'Basic_Data_Types.ipynb',
    + 'Control_Statements.ipynb',
    + 'Functions_in_Python.ipynb',
    + 'hello.py',
    + 'hello.py~',
    + 'Loop_Examples.ipynb',
    + 'one.py',
    + 'one.py~',
    + 'pat.py',
    + 'pat.py~',
    + 'tds.py',
    + 'tds.py~']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [39]:
    +
    +
    +
    os.listdir('C:\\Users\\sachin yadav\\Desktop')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[39]:
    + + + + +
    +
    ['desktop.ini',
    + 'something_new.py',
    + '~$CHINE LEARNING.docx',
    + '~$Graas_Python_PPT.ppt',
    + '~$ming_pc.docx',
    + '~$Python3_course_ppt.pptx',
    + '~$ras_Python_Course_Outlook.rtf',
    + '~$s3_python.docx',
    + '~WRL0303.tmp']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [40]:
    +
    +
    +
    fp = open('C:\\Users\\sachin yadav\\Desktop\\something_new.py')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [41]:
    +
    +
    +
    print(dir(fp))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['_CHUNK_SIZE', '__class__', '__del__', '__delattr__', '__dict__', '__dir__', '__doc__', '__enter__', '__eq__', '__exit__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__lt__', '__ne__', '__new__', '__next__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_checkClosed', '_checkReadable', '_checkSeekable', '_checkWritable', '_finalizing', 'buffer', 'close', 'closed', 'detach', 'encoding', 'errors', 'fileno', 'flush', 'isatty', 'line_buffering', 'mode', 'name', 'newlines', 'read', 'readable', 'readline', 'readlines', 'seek', 'seekable', 'tell', 'truncate', 'writable', 'write', 'writelines']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [42]:
    +
    +
    +
    fp.mode
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[42]:
    + + + + +
    +
    'r'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [43]:
    +
    +
    +
    fp.readable()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[43]:
    + + + + +
    +
    True
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [45]:
    +
    +
    +
    fp.writable()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[45]:
    + + + + +
    +
    False
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [46]:
    +
    +
    +
    fp.seekable()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[46]:
    + + + + +
    +
    True
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [47]:
    +
    +
    +
    fp.tell()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[47]:
    + + + + +
    +
    0
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [48]:
    +
    +
    +
    line1 = fp.readline()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [49]:
    +
    +
    +
    fp.tell()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[49]:
    + + + + +
    +
    35
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [50]:
    +
    +
    +
    line1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[50]:
    + + + + +
    +
    'from random import randint,choice\n'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [51]:
    +
    +
    +
    fp.readline()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[51]:
    + + + + +
    +
    'from time import sleep\n'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [52]:
    +
    +
    +
    data = fp.read(50)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [53]:
    +
    +
    +
    data
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[53]:
    + + + + +
    +
    'from os import system\n\n\nn = int(input("\\n\\n\\n\\n\\t\\'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [54]:
    +
    +
    +
    fp.tell()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[54]:
    + + + + +
    +
    112
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [55]:
    +
    +
    +
    fp.seek(0)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[55]:
    + + + + +
    +
    0
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [56]:
    +
    +
    +
    fp.tell()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[56]:
    + + + + +
    +
    0
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [57]:
    +
    +
    +
    data = fp.read()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [59]:
    +
    +
    +
    print(data)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    from random import randint,choice
    +from time import sleep
    +from os import system
    +
    +
    +n = int(input("\n\n\n\n\t\tEnter number of players : "))
    +l = []
    +for var in range(n):
    +    system('cls')
    +    print('\n\n\n')
    +    l.append(input("\n\n\n\t\t\t\tName of Player[{}] : ".format(var+1)))
    +while input("\t\t\t\tPress any key to roll bottle : ") : 
    +    system('cls') 
    +    print("\n\n")
    +    print("\n\n\n\n\n")
    +    print("\t\t\t\tRolling....Rolling...\n\n")
    +    sleep(randint(1,5))
    +    print("\t\t\t\tTarget Player : {}".format(choice(l)))
    +    print("\n\n")
    +system('cls')
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [61]:
    +
    +
    +
    fp.write('i am writing into file')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +UnsupportedOperation                      Traceback (most recent call last)
    +<ipython-input-61-3c6fb04e9fda> in <module>()
    +----> 1 fp.write('i am writing into file')
    +
    +UnsupportedOperation: not writable
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [62]:
    +
    +
    +
    fp.close()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [63]:
    +
    +
    +
    f = open('C:\\Users\\sachin yadav\\Desktop\\something_new.py','w')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [64]:
    +
    +
    +
    f.read()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +UnsupportedOperation                      Traceback (most recent call last)
    +<ipython-input-64-bacd0e0f09a3> in <module>()
    +----> 1 f.read()
    +
    +UnsupportedOperation: not readable
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [66]:
    +
    +
    +
    f.write("Hi this is first line\n")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[66]:
    + + + + +
    +
    22
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [68]:
    +
    +
    +
    s = """
    +hi this is a para.
    +                    to understand file handling in python.
    +it's so easy."""
    +f.write(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[68]:
    + + + + +
    +
    92
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [69]:
    +
    +
    +
    f.close()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [70]:
    +
    +
    +
    f = open('C:\\Users\\sachin yadav\\Desktop\\something_new.py','a+')
    +f.tell()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[70]:
    + + + + +
    +
    118
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [71]:
    +
    +
    +
    f.read()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[71]:
    + + + + +
    +
    ''
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [72]:
    +
    +
    +
    f.seek(0)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[72]:
    + + + + +
    +
    0
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [73]:
    +
    +
    +
    f.read()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[73]:
    + + + + +
    +
    "Hi this is first line\n\nhi this is a para.\n                    to understand file handling in python.\nit's so easy."
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [74]:
    +
    +
    +
    f.write('\n\t appended sucessfully')
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[74]:
    + + + + +
    +
    23
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [75]:
    +
    +
    +
    f.close()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [77]:
    +
    +
    +
    name = input("Names of Students : ").split()
    +maths = list(map(int,input("Maths Marks of Students : ").split()))
    +physics = list(map(int,input("Science Marks of Students : ").split()))
    +chemistry = list(map(int,input("Science Marks of Students : ").split()))
    +percentage = list(zip(name,maths,physics,chemistry,map(lambda m,p,c:(m+p+c)/3,maths,physics,chemistry)))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Names of Students : john hari ram shyam mohan natasha
    +Maths Marks of Students : 78 98 69 77 78 76
    +Science Marks of Students : 98 78 67 45 89 78
    +Science Marks of Students : 78 78 87 67 89 78
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [78]:
    +
    +
    +
    name
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[78]:
    + + + + +
    +
    ['john', 'hari', 'ram', 'shyam', 'mohan', 'natasha']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [79]:
    +
    +
    +
    physics
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[79]:
    + + + + +
    +
    [98, 78, 67, 45, 89, 78]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [80]:
    +
    +
    +
    maths
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[80]:
    + + + + +
    +
    [78, 98, 69, 77, 78, 76]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [81]:
    +
    +
    +
    chemistry
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[81]:
    + + + + +
    +
    [78, 78, 87, 67, 89, 78]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [103]:
    +
    +
    +
    s = "{:>20}"*6
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [104]:
    +
    +
    +
    s = '{:'+s[5:]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [105]:
    +
    +
    +
    s
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[105]:
    + + + + +
    +
    '{:}{:>20}{:>20}{:>20}{:>20}{:>20}'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [106]:
    +
    +
    +
    s = s.format('Index','Name','Maths','Physics','Chemistry','Percentage')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [107]:
    +
    +
    +
    s
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[107]:
    + + + + +
    +
    'Index                Name               Maths             Physics           Chemistry          Percentage'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [93]:
    +
    +
    +
    s
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[93]:
    + + + + +
    +
    '               Index                Name               Maths             Physics           Chemistry          Percentage'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [108]:
    +
    +
    +
    index = [ var for var in range(1,len(maths)+1)]
    +
    +index
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[108]:
    + + + + +
    +
    [1, 2, 3, 4, 5, 6]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [112]:
    +
    +
    +
    percentage = list(map(lambda m,p,c:(m+p+c)/3,maths,physics,chemistry))
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [114]:
    +
    +
    +
    percentage = list(map(lambda x: "%.2f"%(x),percentage))
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [115]:
    +
    +
    +
    print(s)
    +print(index)
    +print(name)
    +print(maths)
    +print(physics)
    +print(chemistry)
    +print(percentage)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Index                Name               Maths             Physics           Chemistry          Percentage
    +[1, 2, 3, 4, 5, 6]
    +['john', 'hari', 'ram', 'shyam', 'mohan', 'natasha']
    +[78, 98, 69, 77, 78, 76]
    +[98, 78, 67, 45, 89, 78]
    +[78, 78, 87, 67, 89, 78]
    +['84.67', '84.67', '74.33', '63.00', '85.33', '77.33']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [116]:
    +
    +
    +
    s
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[116]:
    + + + + +
    +
    'Index                Name               Maths             Physics           Chemistry          Percentage'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [117]:
    +
    +
    +
    for i,n,m,p,c,per in zip(index,name,maths,physics,chemistry,percentage):
    +    s = s + '\n'
    +    raw = "{:>20}"*6
    +    raw = "{:"+raw[5:]
    +    raw = raw.format(i,n,m,p,c,per)
    +    s = s+raw
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [118]:
    +
    +
    +
    print(s)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Index                Name               Maths             Physics           Chemistry          Percentage
    +1                john                  78                  98                  78               84.67
    +2                hari                  98                  78                  78               84.67
    +3                 ram                  69                  67                  87               74.33
    +4               shyam                  77                  45                  67               63.00
    +5               mohan                  78                  89                  89               85.33
    +6             natasha                  76                  78                  78               77.33
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [119]:
    +
    +
    +
    f = open('st_record.txt','w')
    +f.write(s)
    +f.close()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/Functions_in_Python.ipynb b/python_ipynb/Functions_in_Python.ipynb new file mode 100644 index 0000000..de70a8c --- /dev/null +++ b/python_ipynb/Functions_in_Python.ipynb @@ -0,0 +1,2245 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Functions

    " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    What is a function ?

    " + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "def fun():\n", + " pass" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "k = fun()" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "None\n" + ] + } + ], + "source": [ + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "def hello(name):\n", + " print(\"Hello World!! Welcome to python\")\n", + " print(\"Welcome, {}\".format(name).center(1000,'*'))" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World!! Welcome to python\n", + "*********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************Welcome, sachin yadav**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************\n" + ] + } + ], + "source": [ + "hello('sachin yadav')" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "def calc(x,y,ch):\n", + " \"\"\"calc(x,y,ch)-> result\n", + " calc functions takes 3 inputs and return evaluated expression. \"\"\"\n", + " if ch == '+' :\n", + " r = x + y \n", + " elif ch == '-' : \n", + " r = x -y \n", + " elif ch == '*' :\n", + " r = x * y \n", + " elif ch == '**' : \n", + " r = x ** y \n", + " else :\n", + " if y != 0 :\n", + " if ch == '/' :\n", + " r = x /y \n", + " elif ch == '//' :\n", + " r = x // y \n", + " elif ch == '%' :\n", + " r == x % y\n", + " else :\n", + " r = \"Wrong Choice\"\n", + " else : \n", + " r = \"Value of Y can not be zero for division o/p\"\n", + " return r" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "r = calc(4,5,'/')\n", + "r1 = calc(5,0,'//')\n", + "r2 = calc(6,5,'**')" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.8" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "r" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Value of Y can not be zero for division o/p'" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "r1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## " + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "7776" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "r2" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "def swap(x,y):\n", + " return y,x" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "x = 10\n", + "y = 20\n", + "x,y = swap(x,y)" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "20" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "10" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "y" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "#word and line and charcter cout\n", + "def count(string):\n", + " #your code goes here\n", + " raw = string.split()\n", + " w = len(raw)\n", + " l = len(string.split('\\n'))\n", + " k = ''.join(raw)\n", + " k.replace('\\n','')\n", + " c = len(k)\n", + " return l,w,c" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = \"\"\"Hello World,\n", + "Welcome to python world.\n", + " python functions are very very easy.\n", + "just practise them on regular basis.\"\"\"\n", + "\n", + "l,w,c = count(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "4" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "l" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "18" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "w" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "94" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "c" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    Recursion

    " + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a number : 3\n", + "Factorial of 3 is 6.\n" + ] + } + ], + "source": [ + "num = int(input(\"Enter a number : \"))\n", + "c = 1\n", + "fact = 1\n", + "while c <= num : \n", + " fact = fact*c \n", + " c = c + 1\n", + "print(\"Factorial of {1} is {0}.\".format(fact,num))" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = \"{0}{1}{0}{1}{0}{1}\".format('hello World', 'python')" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello Worldpythonhello Worldpythonhello Worldpython\n" + ] + } + ], + "source": [ + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "def fact(num):\n", + " s = 1\n", + " for var in range(1,num+1):\n", + " s = s*var\n", + " return s" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "r1 = fact(5)\n", + "r2 = fact(7)\n", + "r3 = fact(123)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "120" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "r1" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "5040" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "r2" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "12146304367025329675766243241881295855454217088483382315328918161829235892362167668831156960612640202170735835221294047782591091570411651472186029519906261646730733907419814952960000000000000000000000000000" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "r3" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "def one():\n", + " print(\"Hi i am function 1\")\n", + " return 'one'\n", + "def two():\n", + " print(\"Hi i am fuction 2\")\n", + " return 'two'\n", + "def three():\n", + " print(\"Hi i am function 3\")\n", + " return 'three'\n", + "def main():\n", + " f1 = one()\n", + " f2 = two()\n", + " f3 = three()\n", + " print(f1)\n", + " print(f2)\n", + " print(f3)" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hi i am function 1\n", + "Hi i am fuction 2\n", + "Hi i am function 3\n", + "one\n", + "two\n", + "three\n" + ] + } + ], + "source": [ + "main()" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "one\n", + "two\n" + ] + } + ], + "source": [ + "def one():\n", + " print('one')\n", + " two()\n", + "def two():\n", + " print('two')\n", + "\n", + "one()" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "def hello():\n", + " print(\"Hello World Times {}\".format(hello.x))\n", + " if hello.x < 10 : \n", + " hello.x = hello.x + 1\n", + " hello()\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World Times 1\n", + "Hello World Times 2\n", + "Hello World Times 3\n", + "Hello World Times 4\n", + "Hello World Times 5\n", + "Hello World Times 6\n", + "Hello World Times 7\n", + "Hello World Times 8\n", + "Hello World Times 9\n", + "Hello World Times 10\n" + ] + } + ], + "source": [ + "hello.x = 1\n", + "hello()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Special Functions in Python\n", + "

    lambda function

    " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    It is known as inline function in python. It is also famous as Annonyms function in python. It is used to define a function in single line. it used lambda keyword instead of def.

    " + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "def add(x,y):\n", + " return x + y " + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "9" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "add(4,5)" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "add = lambda arg1,arg2 : arg1 + arg2" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "30" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "add(10,20)" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "fact = lambda num : 1 if num == 1 else num*fact(num-1)" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "120" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fact(5)" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "720" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fact(6)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    map function

    " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

    This is used to map a sequence to a specific fuction. it iterate throug a sequence one by one and pass them to given function and store each value for each var that is returned by the function into a special object called map object which is also iterator.

    " + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['1', '1.25', '6.35', '10', '20']\n", + "[1, 1, 6, 10, 20]\n" + ] + } + ], + "source": [ + "#without map \n", + "l = [ '1','1.25','6.35','10','20']\n", + "r = []\n", + "for var in l : \n", + " x = int(float(var))\n", + " r.append(x)\n", + "print(l)\n", + "print(r)" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "st[1]10\n", + "st[2]20\n", + "st[3]45\n", + "st[4]60\n", + "st[5]15\n", + "[10, 20, 45, 60, 15]\n" + ] + } + ], + "source": [ + "#take data of 5 students only marks\n", + "st = []\n", + "for var in range(5):\n", + " st.append(int(input(\"st[{}]\".format(var+1))))\n", + "print(st)" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "eve_odd = lambda num : True if num % 2 == 0 else False" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Var[1]1\n", + "Var[2]2\n", + "Var[3]3\n", + "Var[4]4\n", + "Var[5]5\n", + "Var[6]6\n", + "Var[7]7\n", + "Var[8]8\n", + "Var[9]9\n", + "Var[10]10\n", + "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n", + "[(1, False), (2, True), (3, False), (4, True), (5, False), (6, True), (7, False), (8, True), (9, False), (10, True)]\n" + ] + } + ], + "source": [ + "#10 number \n", + "l = []\n", + "for var in range(1,11):\n", + " num = int(input(\"Var[{}]\".format(var)))\n", + " l.append(num)\n", + "print(l)\n", + "r = []\n", + "for var in l :\n", + " check = eve_odd(var)\n", + " r.append((var,check))\n", + "print(r)" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "k = list(zip(l,map(eve_odd,l)))" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[(1, False), (2, True), (3, False), (4, True), (5, False), (6, True), (7, False), (8, True), (9, False), (10, True)]\n" + ] + } + ], + "source": [ + "print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[(1, 4), (2, 5), (3, 6)]" + ] + }, + "execution_count": 46, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "list(zip([1,2,3],[4,5,6]))" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1 2 3 4 5 6 7 8 9 10\n" + ] + } + ], + "source": [ + "x = list(map(int,input().split()))" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]" + ] + }, + "execution_count": 54, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 56, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "eve_odd(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "123 234 353 34 23 34 23 2 3234 23 23 23 3 23 23 56 4 23 423 434 \n" + ] + }, + { + "data": { + "text/plain": [ + "[234, 34, 34, 2, 3234, 56, 4, 434]" + ] + }, + "execution_count": 60, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x = list(filter(lambda num:False if num % 2 else True,map(int,input().split())))\n", + "x" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Names of Students : x y z\n", + "Maths Marks of Students : 80 90 70\n", + "Science Marks of Students : 78 90 67\n", + "('x', 80, 78, 79.0) ('y', 90, 90, 90.0) ('z', 70, 67, 68.5)\n" + ] + } + ], + "source": [ + "name = input(\"Names of Students : \").split()\n", + "maths = list(map(int,input(\"Maths Marks of Students : \").split()))\n", + "science = list(map(int,input(\"Science Marks of Students : \").split()))\n", + "print(*zip(name,maths,science,map(lambda x,y:(x+y)/2,maths,science)))" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "data_set1 = [ 50, 80,78,65,60,83,93,72,75,77 ]\n", + "data_set2 = [ 55,85,80,70,65,70,80,78,60,80]" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "10" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(data_set1)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "10" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(data_set2)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "65.0" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "age = lambda old,new : (old+new)/2\n", + "age(60,70)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[52.5, 82.5, 79.0, 67.5, 62.5, 76.5, 86.5, 75.0, 67.5, 78.5]" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "r = []\n", + "for var1,var2 in zip(data_set1,data_set2) : \n", + " r.append(age(var1,var2))\n", + "r" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "r = list(map(lambda x,y: (x+y)/2,data_set1,data_set2))" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[52.5, 82.5, 79.0, 67.5, 62.5, 76.5, 86.5, 75.0, 67.5, 78.5]" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "r" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[False, True, True, False, False, True, True, False, False, True]" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "list(map(lambda x:True if x > 75 else False,r))" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[82.5, 79.0, 76.5, 86.5, 78.5]" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "list(filter(lambda x:'kuch bhi' if x > 75 else '',r))" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "ename": "FileNotFoundError", + "evalue": "[Errno 2] No such file or directory: 'something_new.py'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mFileNotFoundError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mfp\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'something_new.py'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'something_new.py'" + ] + } + ], + "source": [ + "fp = open('something_new.py')" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import os" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'C:\\\\PythonCodes'" + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "os.getcwd()" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['.hello.py.un~',\n", + " '.ipynb_checkpoints',\n", + " '.one.py.un~',\n", + " '.pat.py.un~',\n", + " '.tds.py.un~',\n", + " 'Basic_Data_Types.ipynb',\n", + " 'Control_Statements.ipynb',\n", + " 'Functions_in_Python.ipynb',\n", + " 'hello.py',\n", + " 'hello.py~',\n", + " 'Loop_Examples.ipynb',\n", + " 'one.py',\n", + " 'one.py~',\n", + " 'pat.py',\n", + " 'pat.py~',\n", + " 'tds.py',\n", + " 'tds.py~']" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "os.listdir()" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['desktop.ini',\n", + " 'something_new.py',\n", + " '~$CHINE LEARNING.docx',\n", + " '~$Graas_Python_PPT.ppt',\n", + " '~$ming_pc.docx',\n", + " '~$Python3_course_ppt.pptx',\n", + " '~$ras_Python_Course_Outlook.rtf',\n", + " '~$s3_python.docx',\n", + " '~WRL0303.tmp']" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "os.listdir('C:\\\\Users\\\\sachin yadav\\\\Desktop')" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "fp = open('C:\\\\Users\\\\sachin yadav\\\\Desktop\\\\something_new.py')" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['_CHUNK_SIZE', '__class__', '__del__', '__delattr__', '__dict__', '__dir__', '__doc__', '__enter__', '__eq__', '__exit__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__lt__', '__ne__', '__new__', '__next__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_checkClosed', '_checkReadable', '_checkSeekable', '_checkWritable', '_finalizing', 'buffer', 'close', 'closed', 'detach', 'encoding', 'errors', 'fileno', 'flush', 'isatty', 'line_buffering', 'mode', 'name', 'newlines', 'read', 'readable', 'readline', 'readlines', 'seek', 'seekable', 'tell', 'truncate', 'writable', 'write', 'writelines']\n" + ] + } + ], + "source": [ + "print(dir(fp))" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'r'" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.mode" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.readable()" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 45, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.writable()" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 46, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.seekable()" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.tell()" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "line1 = fp.readline()" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "35" + ] + }, + "execution_count": 49, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.tell()" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'from random import randint,choice\\n'" + ] + }, + "execution_count": 50, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "line1" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'from time import sleep\\n'" + ] + }, + "execution_count": 51, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.readline()" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "data = fp.read(50)" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'from os import system\\n\\n\\nn = int(input(\"\\\\n\\\\n\\\\n\\\\n\\\\t\\\\'" + ] + }, + "execution_count": 53, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "data" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "112" + ] + }, + "execution_count": 54, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.tell()" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 55, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.seek(0)" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 56, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fp.tell()" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "data = fp.read()" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "from random import randint,choice\n", + "from time import sleep\n", + "from os import system\n", + "\n", + "\n", + "n = int(input(\"\\n\\n\\n\\n\\t\\tEnter number of players : \"))\n", + "l = []\n", + "for var in range(n):\n", + " system('cls')\n", + " print('\\n\\n\\n')\n", + " l.append(input(\"\\n\\n\\n\\t\\t\\t\\tName of Player[{}] : \".format(var+1)))\n", + "while input(\"\\t\\t\\t\\tPress any key to roll bottle : \") : \n", + " system('cls') \n", + " print(\"\\n\\n\")\n", + " print(\"\\n\\n\\n\\n\\n\")\n", + " print(\"\\t\\t\\t\\tRolling....Rolling...\\n\\n\")\n", + " sleep(randint(1,5))\n", + " print(\"\\t\\t\\t\\tTarget Player : {}\".format(choice(l)))\n", + " print(\"\\n\\n\")\n", + "system('cls')\n", + "\n" + ] + } + ], + "source": [ + "print(data)" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": {}, + "outputs": [ + { + "ename": "UnsupportedOperation", + "evalue": "not writable", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mUnsupportedOperation\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mfp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mwrite\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'i am writing into file'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mUnsupportedOperation\u001b[0m: not writable" + ] + } + ], + "source": [ + "fp.write('i am writing into file')" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "fp.close()" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "f = open('C:\\\\Users\\\\sachin yadav\\\\Desktop\\\\something_new.py','w')" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": {}, + "outputs": [ + { + "ename": "UnsupportedOperation", + "evalue": "not readable", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mUnsupportedOperation\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mf\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mUnsupportedOperation\u001b[0m: not readable" + ] + } + ], + "source": [ + "f.read()" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "22" + ] + }, + "execution_count": 66, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "f.write(\"Hi this is first line\\n\")" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "92" + ] + }, + "execution_count": 68, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = \"\"\"\n", + "hi this is a para.\n", + " to understand file handling in python.\n", + "it's so easy.\"\"\"\n", + "f.write(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "f.close()" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "118" + ] + }, + "execution_count": 70, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "f = open('C:\\\\Users\\\\sachin yadav\\\\Desktop\\\\something_new.py','a+')\n", + "f.tell()" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "''" + ] + }, + "execution_count": 71, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "f.read()" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 72, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "f.seek(0)" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "\"Hi this is first line\\n\\nhi this is a para.\\n to understand file handling in python.\\nit's so easy.\"" + ] + }, + "execution_count": 73, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "f.read()" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "23" + ] + }, + "execution_count": 74, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "f.write('\\n\\t appended sucessfully')" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "f.close()" + ] + }, + { + "cell_type": "code", + "execution_count": 77, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Names of Students : john hari ram shyam mohan natasha\n", + "Maths Marks of Students : 78 98 69 77 78 76\n", + "Science Marks of Students : 98 78 67 45 89 78\n", + "Science Marks of Students : 78 78 87 67 89 78\n" + ] + } + ], + "source": [ + "name = input(\"Names of Students : \").split()\n", + "maths = list(map(int,input(\"Maths Marks of Students : \").split()))\n", + "physics = list(map(int,input(\"Science Marks of Students : \").split()))\n", + "chemistry = list(map(int,input(\"Science Marks of Students : \").split()))\n", + "percentage = list(zip(name,maths,physics,chemistry,map(lambda m,p,c:(m+p+c)/3,maths,physics,chemistry)))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 78, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['john', 'hari', 'ram', 'shyam', 'mohan', 'natasha']" + ] + }, + "execution_count": 78, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "name" + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[98, 78, 67, 45, 89, 78]" + ] + }, + "execution_count": 79, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "physics" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[78, 98, 69, 77, 78, 76]" + ] + }, + "execution_count": 80, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "maths" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[78, 78, 87, 67, 89, 78]" + ] + }, + "execution_count": 81, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "chemistry" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = \"{:>20}\"*6" + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "metadata": {}, + "outputs": [], + "source": [ + "s = '{:'+s[5:]" + ] + }, + { + "cell_type": "code", + "execution_count": 105, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'{:}{:>20}{:>20}{:>20}{:>20}{:>20}'" + ] + }, + "execution_count": 105, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s" + ] + }, + { + "cell_type": "code", + "execution_count": 106, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "s = s.format('Index','Name','Maths','Physics','Chemistry','Percentage')" + ] + }, + { + "cell_type": "code", + "execution_count": 107, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Index Name Maths Physics Chemistry Percentage'" + ] + }, + "execution_count": 107, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s" + ] + }, + { + "cell_type": "code", + "execution_count": 93, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "' Index Name Maths Physics Chemistry Percentage'" + ] + }, + "execution_count": 93, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s" + ] + }, + { + "cell_type": "code", + "execution_count": 108, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 3, 4, 5, 6]" + ] + }, + "execution_count": 108, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "index = [ var for var in range(1,len(maths)+1)]\n", + "\n", + "index" + ] + }, + { + "cell_type": "code", + "execution_count": 112, + "metadata": {}, + "outputs": [], + "source": [ + "percentage = list(map(lambda m,p,c:(m+p+c)/3,maths,physics,chemistry))" + ] + }, + { + "cell_type": "code", + "execution_count": 114, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "percentage = list(map(lambda x: \"%.2f\"%(x),percentage))" + ] + }, + { + "cell_type": "code", + "execution_count": 115, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Index Name Maths Physics Chemistry Percentage\n", + "[1, 2, 3, 4, 5, 6]\n", + "['john', 'hari', 'ram', 'shyam', 'mohan', 'natasha']\n", + "[78, 98, 69, 77, 78, 76]\n", + "[98, 78, 67, 45, 89, 78]\n", + "[78, 78, 87, 67, 89, 78]\n", + "['84.67', '84.67', '74.33', '63.00', '85.33', '77.33']\n" + ] + } + ], + "source": [ + "print(s)\n", + "print(index)\n", + "print(name)\n", + "print(maths)\n", + "print(physics)\n", + "print(chemistry)\n", + "print(percentage)" + ] + }, + { + "cell_type": "code", + "execution_count": 116, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Index Name Maths Physics Chemistry Percentage'" + ] + }, + "execution_count": 116, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s" + ] + }, + { + "cell_type": "code", + "execution_count": 117, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "for i,n,m,p,c,per in zip(index,name,maths,physics,chemistry,percentage):\n", + " s = s + '\\n'\n", + " raw = \"{:>20}\"*6\n", + " raw = \"{:\"+raw[5:]\n", + " raw = raw.format(i,n,m,p,c,per)\n", + " s = s+raw" + ] + }, + { + "cell_type": "code", + "execution_count": 118, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Index Name Maths Physics Chemistry Percentage\n", + "1 john 78 98 78 84.67\n", + "2 hari 98 78 78 84.67\n", + "3 ram 69 67 87 74.33\n", + "4 shyam 77 45 67 63.00\n", + "5 mohan 78 89 89 85.33\n", + "6 natasha 76 78 78 77.33\n" + ] + } + ], + "source": [ + "print(s)" + ] + }, + { + "cell_type": "code", + "execution_count": 119, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "f = open('st_record.txt','w')\n", + "f.write(s)\n", + "f.close()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Json_API.html b/python_ipynb/Json_API.html new file mode 100644 index 0000000..c1b00fb --- /dev/null +++ b/python_ipynb/Json_API.html @@ -0,0 +1,14325 @@ + + + + +Json_API + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    In [1]:
    +
    +
    +
    print("Is it visible ? ")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Is it visible ? 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    mydict = {
    +    'name':'arya college',
    +    'est. year' : 2008,
    +    'Area' : None,
    +    'Streams' : [ 'CS','IT'],
    +    'College' : True,
    +    'faculty' : ('rahul','RKT','Akhil Pandey'),
    +    #'ranking' : { 1,2,3,4,5,6,7},
    +    'Unversity' : False,
    +    'Type' : { 'college':'b.tech','data':'some object'}
    +}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    print(type(mydict))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    <class 'dict'>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    import json
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    json_object = json.dumps(mydict)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    print(json_object)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {"name": "arya college", "est. year": 2008, "Area": null, "Streams": ["CS", "IT"], "College": true, "faculty": ["rahul", "RKT", "Akhil Pandey"], "Unversity": false, "Type": {"college": "b.tech", "data": "some object"}}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    new_dict = json.loads(json_object)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    new_dict
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[20]:
    + + + + +
    +
    {'name': 'arya college',
    + 'est. year': 2008,
    + 'Area': None,
    + 'Streams': ['CS', 'IT'],
    + 'College': True,
    + 'faculty': ['rahul', 'RKT', 'Akhil Pandey'],
    + 'Unversity': False,
    + 'Type': {'college': 'b.tech', 'data': 'some object'}}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [21]:
    +
    +
    +
    l = [ 1,2,3,4,45]
    +d = json.dumps(l)
    +print(d)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 3, 4, 45]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    data = json.loads(d)
    +print(data)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    [1, 2, 3, 4, 45]
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [24]:
    +
    +
    +
    url = "https://graph.facebook.com/v3.2/me?fields=name,birthday,posts&access_token=Your_Token"
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    import requests
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [26]:
    +
    +
    +
    page = requests.get('https://grras.com')
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    page.status_code
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[27]:
    + + + + +
    +
    200
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [28]:
    +
    +
    +
    conent = page.content
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [31]:
    +
    +
    +
    data = requests.get(url)
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [32]:
    +
    +
    +
    data.status_code
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[32]:
    + + + + +
    +
    200
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [35]:
    +
    +
    +
    json_data = data.json()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [36]:
    +
    +
    +
    print(type(json_data))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    <class 'dict'>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [37]:
    +
    +
    +
    json_data.keys()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[37]:
    + + + + +
    +
    dict_keys(['name', 'birthday', 'posts', 'id'])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [38]:
    +
    +
    +
    json_data['name']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[38]:
    + + + + +
    +
    'Yadvendra Singh'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [39]:
    +
    +
    +
    json_data['birthday']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[39]:
    + + + + +
    +
    '05/25/1996'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [42]:
    +
    +
    +
    json_data['posts'].keys()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[42]:
    + + + + +
    +
    dict_keys(['data', 'paging'])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [44]:
    +
    +
    +
    json_data['posts']['paging']['next']
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[44]:
    + + + + +
    +
    'https://graph.facebook.com/v3.2/1172663579559902/posts?access_token=EAANo3WBh9FMBADFDv9Mxvq9cPk0V6pRtgOrf2a8J9ZA0vYYIWlZAsM6stPIIHtIBqIBViNds9ZCo8dukFZCFI2WcGwPZCqcUZBJFBNqnQSoXjtZCH40IMtzhz5l97ut50GG05xxI6PTBByp7kMWOtVhEOm0zTzaVdWPOznsULVxc647Kgiw9tkabCOPdkNPT7AtMmtDOAM4rgZDZD&limit=25&until=1477065410&__paging_token=enc_AdCzhikeC5KnhfzlCv4Dpd8w5GJFdYxzof3SuV3uybdZCdz3u4CUfooiEYZBKzfvSz44zoPdqUnU7YrAm1BMe9TAPZCuQhWuCnoIhQNcTAssPA91gZDZD'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [46]:
    +
    +
    +
    for item in json_data['posts']['data'] : 
    +    print(item['created_time'])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    2019-01-19T17:52:05+0000
    +2019-01-17T16:33:38+0000
    +2019-01-10T04:16:39+0000
    +2018-10-24T08:17:52+0000
    +2018-10-24T08:15:44+0000
    +2018-10-17T11:28:49+0000
    +2018-04-29T05:42:19+0000
    +2018-04-04T09:35:22+0000
    +2018-03-27T05:34:26+0000
    +2018-03-15T15:37:38+0000
    +2017-12-14T20:19:17+0000
    +2017-11-21T19:28:00+0000
    +2017-07-04T16:00:49+0000
    +2017-07-03T03:40:24+0000
    +2017-06-19T03:48:57+0000
    +2017-06-17T05:13:04+0000
    +2017-05-09T14:25:11+0000
    +2017-05-07T07:36:49+0000
    +2016-12-11T21:28:00+0000
    +2016-10-21T15:59:57+0000
    +2016-10-21T15:56:50+0000
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [32]:
    +
    +
    +
    import requests
    +key = "AIzaSyBZ3MNgPToz4UWi_sofaFYMdeenolad63k"
    +place = input("Search a Place : ").strip().lower()
    +place  = place.replace(' ','%20')
    +url = "https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input={}&inputtype=textquery&fields=photos,formatted_address,name,rating,opening_hours,geometry&key={}".format(place,key)
    +page = requests.get(url)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Search a Place : jaipur
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    page.status_code
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[15]:
    + + + + +
    +
    200
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [33]:
    +
    +
    +
    data = page.json()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    data.keys()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[17]:
    + + + + +
    +
    dict_keys(['candidates', 'status'])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    type(data['candidates'][0])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[18]:
    + + + + +
    +
    dict
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [19]:
    +
    +
    +
    data['candidates'][0].keys()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[19]:
    + + + + +
    +
    dict_keys(['formatted_address', 'geometry', 'name', 'photos', 'rating'])
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [34]:
    +
    +
    +
    address = data['candidates'][0]['formatted_address']
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [35]:
    +
    +
    +
    address
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[35]:
    + + + + +
    +
    'Jaipur, Rajasthan, India'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [36]:
    +
    +
    +
    photo = data['candidates'][0]['photos']
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [37]:
    +
    +
    +
    photo
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[37]:
    + + + + +
    +
    [{'height': 531,
    +  'html_attributions': ['<a href="https://maps.google.com/maps/contrib/116104116331250803004/photos">SALVATORE PATACCA</a>'],
    +  'photo_reference': 'CmRaAAAAW5mWWqBCF2nNFxSh4whDcvVRzbYxB78m2HK97pvYx-VyFkmlzyTxNkhx6r-wjIT4lUgUlk2nV-wh78poZnWSg5xnigiKXsb4fOKKPDLy_05nEolzNVmmnRoqySFSiXqnEhCuxCU3_gDUYMEYMb2cDQZnGhTLbMGH-iBKDKbSXAXtUVij73Mi8A',
    +  'width': 800}]
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [38]:
    +
    +
    +
    photo_reference = photo[0]['photo_reference']
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [39]:
    +
    +
    +
    photo_reference
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[39]:
    + + + + +
    +
    'CmRaAAAAW5mWWqBCF2nNFxSh4whDcvVRzbYxB78m2HK97pvYx-VyFkmlzyTxNkhx6r-wjIT4lUgUlk2nV-wh78poZnWSg5xnigiKXsb4fOKKPDLy_05nEolzNVmmnRoqySFSiXqnEhCuxCU3_gDUYMEYMb2cDQZnGhTLbMGH-iBKDKbSXAXtUVij73Mi8A'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [40]:
    +
    +
    +
    url = f"https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference={photo_reference}&key={key}"
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [95]:
    +
    +
    +
    print(url)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=CmRaAAAAyanIx9fkVgj4we67mE4iWwLMQ47kJTpXfaxk5h4_Quy3Md8AwrU0JP_CBN9jBELvUnu_WmYsDiR_QhIh4qGLaNibXaEn9ffeXbKZd9UgAXHjgHsGlYGS_7uXGsSRlyZxEhBQP3r0c134qndAgHsokbyYGhTW5Z5d9NWbufhMVcXcoVQZ2UrGRg&key=AIzaSyBZ3MNgPToz4UWi_sofaFYMdeenolad63k
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [41]:
    +
    +
    +
    page = requests.get(url)
    +f  = open('temp.jpeg','wb')
    +f.write(page.content)
    +f.close()
    +import matplotlib.pyplot as plt
    +with open('temp.jpeg','rb') as fp : 
    +    img = plt.imread(fp)
    +    fp.close()
    +plt.imshow(img)
    +plt.show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + + + +
    + +
    + +
    + +
    +
    + +
    +
    +
    +
    In [75]:
    +
    +
    +
    page.status_code
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[75]:
    + + + + +
    +
    200
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [77]:
    +
    +
    +
    pwd
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[77]:
    + + + + +
    +
    'C:\\Users\\hp\\Desktop'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [79]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [80]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [81]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + + + +
    + +
    + +
    + +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/Json_API.ipynb b/python_ipynb/Json_API.ipynb new file mode 100644 index 0000000..f303959 --- /dev/null +++ b/python_ipynb/Json_API.ipynb @@ -0,0 +1,704 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Is it visible ? \n" + ] + } + ], + "source": [ + "print(\"Is it visible ? \")" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [], + "source": [ + "mydict = {\n", + " 'name':'arya college',\n", + " 'est. year' : 2008,\n", + " 'Area' : None,\n", + " 'Streams' : [ 'CS','IT'],\n", + " 'College' : True,\n", + " 'faculty' : ('rahul','RKT','Akhil Pandey'),\n", + " #'ranking' : { 1,2,3,4,5,6,7},\n", + " 'Unversity' : False,\n", + " 'Type' : { 'college':'b.tech','data':'some object'}\n", + "}\n" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], + "source": [ + "print(type(mydict))" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [], + "source": [ + "import json" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [], + "source": [ + "json_object = json.dumps(mydict)" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\"name\": \"arya college\", \"est. year\": 2008, \"Area\": null, \"Streams\": [\"CS\", \"IT\"], \"College\": true, \"faculty\": [\"rahul\", \"RKT\", \"Akhil Pandey\"], \"Unversity\": false, \"Type\": {\"college\": \"b.tech\", \"data\": \"some object\"}}\n" + ] + } + ], + "source": [ + "print(json_object)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [], + "source": [ + "new_dict = json.loads(json_object)" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'name': 'arya college',\n", + " 'est. year': 2008,\n", + " 'Area': None,\n", + " 'Streams': ['CS', 'IT'],\n", + " 'College': True,\n", + " 'faculty': ['rahul', 'RKT', 'Akhil Pandey'],\n", + " 'Unversity': False,\n", + " 'Type': {'college': 'b.tech', 'data': 'some object'}}" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "new_dict" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 3, 4, 45]\n" + ] + } + ], + "source": [ + "l = [ 1,2,3,4,45]\n", + "d = json.dumps(l)\n", + "print(d)" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 3, 4, 45]\n" + ] + } + ], + "source": [ + "data = json.loads(d)\n", + "print(data)" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "url = \"https://graph.facebook.com/v3.2/me?fields=name,birthday,posts&access_token=Your_Token\"" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [], + "source": [ + "import requests" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [], + "source": [ + "page = requests.get('https://grras.com')" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "200" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "page.status_code" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [], + "source": [ + "conent = page.content" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [], + "source": [ + "data = requests.get(url)" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "200" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "data.status_code" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [], + "source": [ + "json_data = data.json()" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], + "source": [ + "print(type(json_data))" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_keys(['name', 'birthday', 'posts', 'id'])" + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "json_data.keys()" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Yadvendra Singh'" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "json_data['name']" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'05/25/1996'" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "json_data['birthday']" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_keys(['data', 'paging'])" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "json_data['posts'].keys()" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'https://graph.facebook.com/v3.2/1172663579559902/posts?access_token=EAANo3WBh9FMBADFDv9Mxvq9cPk0V6pRtgOrf2a8J9ZA0vYYIWlZAsM6stPIIHtIBqIBViNds9ZCo8dukFZCFI2WcGwPZCqcUZBJFBNqnQSoXjtZCH40IMtzhz5l97ut50GG05xxI6PTBByp7kMWOtVhEOm0zTzaVdWPOznsULVxc647Kgiw9tkabCOPdkNPT7AtMmtDOAM4rgZDZD&limit=25&until=1477065410&__paging_token=enc_AdCzhikeC5KnhfzlCv4Dpd8w5GJFdYxzof3SuV3uybdZCdz3u4CUfooiEYZBKzfvSz44zoPdqUnU7YrAm1BMe9TAPZCuQhWuCnoIhQNcTAssPA91gZDZD'" + ] + }, + "execution_count": 44, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "json_data['posts']['paging']['next']" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2019-01-19T17:52:05+0000\n", + "2019-01-17T16:33:38+0000\n", + "2019-01-10T04:16:39+0000\n", + "2018-10-24T08:17:52+0000\n", + "2018-10-24T08:15:44+0000\n", + "2018-10-17T11:28:49+0000\n", + "2018-04-29T05:42:19+0000\n", + "2018-04-04T09:35:22+0000\n", + "2018-03-27T05:34:26+0000\n", + "2018-03-15T15:37:38+0000\n", + "2017-12-14T20:19:17+0000\n", + "2017-11-21T19:28:00+0000\n", + "2017-07-04T16:00:49+0000\n", + "2017-07-03T03:40:24+0000\n", + "2017-06-19T03:48:57+0000\n", + "2017-06-17T05:13:04+0000\n", + "2017-05-09T14:25:11+0000\n", + "2017-05-07T07:36:49+0000\n", + "2016-12-11T21:28:00+0000\n", + "2016-10-21T15:59:57+0000\n", + "2016-10-21T15:56:50+0000\n" + ] + } + ], + "source": [ + "for item in json_data['posts']['data'] : \n", + " print(item['created_time'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import requests\n", + "key = \"AIzaSyBZ3MNgPToz4UWi_sofaFYMdeenolad63k\"\n", + "place = input(\"Search a Place : \").strip().lower()\n", + "place = place.replace(' ','%20')\n", + "url = \"https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input={}&inputtype=textquery&fields=photos,formatted_address,name,rating,opening_hours,geometry&key={}\".format(place,key)\n", + "page = requests.get(url)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "200" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "page.status_code" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "data = page.json()" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_keys(['candidates', 'status'])" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "data.keys()" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "type(data['candidates'][0])" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_keys(['formatted_address', 'geometry', 'name', 'opening_hours', 'photos', 'rating'])" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "data['candidates'][0].keys()" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "address = data['candidates'][0]['formatted_address']" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Paryavaran 2nd Rd, RICCO Industrial Area, Kishangarh, Rajasthan 305801, India'" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "address" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [], + "source": [ + "photo = data['candidates'][0]['photos']" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[{'height': 3456,\n", + " 'html_attributions': ['Er.Suresh Rathore'],\n", + " 'photo_reference': 'CmRaAAAAfuyPU9IUd-wBC0mXUVaskjaPjzNx1nD6CXdbqnzR70hKzoehDng8fXRkXNe6Hw92igYpWmdsPi624E7Ehb2e4W1AdQmhTHXfbdbId8HzGKbmNSQMdo791PLWkWs36RUlEhDUmICi_x6COVwZ-5-454IoGhQ7xs0L5CGmS7iv1PLgNPMoegtl0g',\n", + " 'width': 4608}]" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "photo" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], + "source": [ + "photo_reference = photo[0]['photo_reference']" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'CmRaAAAAfuyPU9IUd-wBC0mXUVaskjaPjzNx1nD6CXdbqnzR70hKzoehDng8fXRkXNe6Hw92igYpWmdsPi624E7Ehb2e4W1AdQmhTHXfbdbId8HzGKbmNSQMdo791PLWkWs36RUlEhDUmICi_x6COVwZ-5-454IoGhQ7xs0L5CGmS7iv1PLgNPMoegtl0g'" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "photo_reference" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [], + "source": [ + "url = f\"https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference={photo_reference}&key={key}\"" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=CmRaAAAAfuyPU9IUd-wBC0mXUVaskjaPjzNx1nD6CXdbqnzR70hKzoehDng8fXRkXNe6Hw92igYpWmdsPi624E7Ehb2e4W1AdQmhTHXfbdbId8HzGKbmNSQMdo791PLWkWs36RUlEhDUmICi_x6COVwZ-5-454IoGhQ7xs0L5CGmS7iv1PLgNPMoegtl0g&key=AIzaSyBZ3MNgPToz4UWi_sofaFYMdeenolad63k\n" + ] + } + ], + "source": [ + "print(url)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "page = requests.get(url)\n", + "f = open('temp.jpeg','wb')\n", + "f.write(page.content)\n", + "f.close()\n", + "import matplotlib.pyplot as plt\n", + "with open('temp.jpeg','rb') as fp : \n", + " img = plt.imread(fp)\n", + " fp.close()\n", + "plt.imshow(img)\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "page.status_code" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "pwd" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.0" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Loop_Examples.html b/python_ipynb/Loop_Examples.html new file mode 100644 index 0000000..56d7289 --- /dev/null +++ b/python_ipynb/Loop_Examples.html @@ -0,0 +1,13516 @@ + + + + +Loop_Examples + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    In [4]:
    +
    +
    +
    from random import randint
    +while input("\n\nPress any key to continue : \n\n") : 
    +    comGuess = randint(1,50)
    +    for var in range(1,6):
    +        userGuess = int(input("Your Guess (1,50) : "))
    +        if userGuess < comGuess : 
    +            print("Think Big Be Big")
    +        elif userGuess > comGuess :
    +            print("Be in Limits Think Lower")
    +        else :
    +            print("Correct Guess")
    +            break
    +        if var == 5 :
    +            print("Computer Guess = ",comGuess)
    +            print("You such a Looser")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +
    +Press any key to continue : 
    +
    +k
    +Your Guess (1,50) : 25
    +Correct Guess
    +
    +
    +Press any key to continue : 
    +
    +k
    +Your Guess (1,50) : 25
    +Be in Limits Think Lower
    +Your Guess (1,50) : 13
    +Think Big Be Big
    +Your Guess (1,50) : 29
    +Be in Limits Think Lower
    +Your Guess (1,50) : 19
    +Think Big Be Big
    +Your Guess (1,50) : 23
    +Be in Limits Think Lower
    +Computer Guess =  21
    +You such a Looser
    +
    +
    +Press any key to continue : 
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [6]:
    +
    +
    +
    from random import randint,choice
    +from time import sleep
    +n = int(input("Enter number of players : "))
    +l = []
    +for var in range(n):
    +        l.append(input("Name of Player[{}]".format(var+1)))
    +while input("Press any key to roll bottle") : 
    +    print("\n\n")
    +    print("Rolling....Rolling...\n\n")
    +    sleep(randint(1,5))
    +    print("Target Player : {}".format(choice(l)))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Enter number of players : 5
    +Name of Player[1]sachin
    +Name of Player[2]rajat
    +Name of Player[3]gaurav
    +Name of Player[4]nidhi
    +Name of Player[5]muskaan
    +Press any key to roll bottlek
    +
    +
    +
    +Rolling....Rolling...
    +
    +
    +Target Player : nidhi
    +Press any key to roll bottlek
    +
    +
    +
    +Rolling....Rolling...
    +
    +
    +Target Player : gaurav
    +Press any key to roll bottle
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    x = 1
    +while x <= 20 : 
    +    
    +    if not( x % 3 ) and not ( x % 5 ) :
    +        break
    +    print(x)
    +    x = x + 1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    x = 1 
    +y = 2
    +
    +while x <= 30 : 
    +    x = x + 2
    +    y = y + 2
    +    if x % 2 == 0 :
    +        break
    +    elif y % 2 : 
    +        break
    +    elif x % 2 and y % 3 :
    +        continue
    +    print("Hello World")
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello World
    +Hello World
    +Hello World
    +Hello World
    +Hello World
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [10]:
    +
    +
    +
    x = 1 
    +while x <= 10 :
    +    if x == 5 :
    +        break
    +    x = x + 1
    +else :
    +    print("Hello World")
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
    num = int(input("Enter a number : "))
    +sq = round(sqrt(num))
    +for var in range(2,sq+1) : 
    +        if num % var == 0 :
    +            print("Not a Prime Number")
    +            break
    +else :
    +        print("Prime Number")
    +    
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    from math import sqrt
    +s=int(input("start : "))
    +e = int(input("end : "))
    +while s <= e : 
    +    num = s     
    +    sq = round(sqrt(num))
    +    for var in range(2,sq+1) : 
    +        if num % var == 0 :
    +            break
    +    else :
    +        print(s,end=',')
    +    s = s + 1
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    start : 1000
    +end : 2000
    +1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [21]:
    +
    +
    +
    from math import sqrt
    +s=int(input("start : "))
    +e = int(input("end : "))
    +c = 0
    +for num in range(s,e+1) :    
    +    sq = round(sqrt(num))
    +    for var in range(2,sq+1) : 
    +        if num % var == 0 :
    +            break
    +    else :
    +        print(num,end=',')
    +        c = c + 1
    +print("\nTotal Prime Number : ",c)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    start : 372493274873294732874932794231784732947932798
    +end : 99999999999999999999999999999999999999999999999999
    +
    +
    +
    + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +KeyboardInterrupt                         Traceback (most recent call last)
    +<ipython-input-21-67e19840b07e> in <module>()
    +      5 for num in range(s,e+1) :
    +      6     sq = round(sqrt(num))
    +----> 7     for var in range(2,sq+1) :
    +      8         if num % var == 0 :
    +      9             break
    +
    +KeyboardInterrupt: 
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/Loop_Examples.ipynb b/python_ipynb/Loop_Examples.ipynb new file mode 100644 index 0000000..3a9a3ae --- /dev/null +++ b/python_ipynb/Loop_Examples.ipynb @@ -0,0 +1,318 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\n", + "Press any key to continue : \n", + "\n", + "k\n", + "Your Guess (1,50) : 25\n", + "Correct Guess\n", + "\n", + "\n", + "Press any key to continue : \n", + "\n", + "k\n", + "Your Guess (1,50) : 25\n", + "Be in Limits Think Lower\n", + "Your Guess (1,50) : 13\n", + "Think Big Be Big\n", + "Your Guess (1,50) : 29\n", + "Be in Limits Think Lower\n", + "Your Guess (1,50) : 19\n", + "Think Big Be Big\n", + "Your Guess (1,50) : 23\n", + "Be in Limits Think Lower\n", + "Computer Guess = 21\n", + "You such a Looser\n", + "\n", + "\n", + "Press any key to continue : \n", + "\n", + "\n" + ] + } + ], + "source": [ + "from random import randint\n", + "while input(\"\\n\\nPress any key to continue : \\n\\n\") : \n", + " comGuess = randint(1,50)\n", + " for var in range(1,6):\n", + " userGuess = int(input(\"Your Guess (1,50) : \"))\n", + " if userGuess < comGuess : \n", + " print(\"Think Big Be Big\")\n", + " elif userGuess > comGuess :\n", + " print(\"Be in Limits Think Lower\")\n", + " else :\n", + " print(\"Correct Guess\")\n", + " break\n", + " if var == 5 :\n", + " print(\"Computer Guess = \",comGuess)\n", + " print(\"You such a Looser\")" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter number of players : 5\n", + "Name of Player[1]sachin\n", + "Name of Player[2]rajat\n", + "Name of Player[3]gaurav\n", + "Name of Player[4]nidhi\n", + "Name of Player[5]muskaan\n", + "Press any key to roll bottlek\n", + "\n", + "\n", + "\n", + "Rolling....Rolling...\n", + "\n", + "\n", + "Target Player : nidhi\n", + "Press any key to roll bottlek\n", + "\n", + "\n", + "\n", + "Rolling....Rolling...\n", + "\n", + "\n", + "Target Player : gaurav\n", + "Press any key to roll bottle\n" + ] + } + ], + "source": [ + "from random import randint,choice\n", + "from time import sleep\n", + "n = int(input(\"Enter number of players : \"))\n", + "l = []\n", + "for var in range(n):\n", + " l.append(input(\"Name of Player[{}]\".format(var+1)))\n", + "while input(\"Press any key to roll bottle\") : \n", + " print(\"\\n\\n\")\n", + " print(\"Rolling....Rolling...\\n\\n\")\n", + " sleep(randint(1,5))\n", + " print(\"Target Player : {}\".format(choice(l)))" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n", + "9\n", + "10\n", + "11\n", + "12\n", + "13\n", + "14\n" + ] + } + ], + "source": [ + "x = 1\n", + "while x <= 20 : \n", + " \n", + " if not( x % 3 ) and not ( x % 5 ) :\n", + " break\n", + " print(x)\n", + " x = x + 1" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\n", + "Hello World\n", + "Hello World\n", + "Hello World\n", + "Hello World\n" + ] + } + ], + "source": [ + "x = 1 \n", + "y = 2\n", + "\n", + "while x <= 30 : \n", + " x = x + 2\n", + " y = y + 2\n", + " if x % 2 == 0 :\n", + " break\n", + " elif y % 2 : \n", + " break\n", + " elif x % 2 and y % 3 :\n", + " continue\n", + " print(\"Hello World\")" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "x = 1 \n", + "while x <= 10 :\n", + " if x == 5 :\n", + " break\n", + " x = x + 1\n", + "else :\n", + " print(\"Hello World\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "num = int(input(\"Enter a number : \"))\n", + "sq = round(sqrt(num))\n", + "for var in range(2,sq+1) : \n", + " if num % var == 0 :\n", + " print(\"Not a Prime Number\")\n", + " break\n", + "else :\n", + " print(\"Prime Number\")\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "start : 1000\n", + "end : 2000\n", + "1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999," + ] + } + ], + "source": [ + "from math import sqrt\n", + "s=int(input(\"start : \"))\n", + "e = int(input(\"end : \"))\n", + "while s <= e : \n", + " num = s \n", + " sq = round(sqrt(num))\n", + " for var in range(2,sq+1) : \n", + " if num % var == 0 :\n", + " break\n", + " else :\n", + " print(s,end=',')\n", + " s = s + 1" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "start : 372493274873294732874932794231784732947932798\n", + "end : 99999999999999999999999999999999999999999999999999\n" + ] + }, + { + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mnum\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ms\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0me\u001b[0m\u001b[1;33m+\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[0msq\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mround\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msqrt\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnum\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 7\u001b[1;33m \u001b[1;32mfor\u001b[0m \u001b[0mvar\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0msq\u001b[0m\u001b[1;33m+\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 8\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mnum\u001b[0m \u001b[1;33m%\u001b[0m \u001b[0mvar\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;36m0\u001b[0m \u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[1;32mbreak\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mKeyboardInterrupt\u001b[0m: " + ] + } + ], + "source": [ + "from math import sqrt\n", + "s=int(input(\"start : \"))\n", + "e = int(input(\"end : \"))\n", + "c = 0\n", + "for num in range(s,e+1) : \n", + " sq = round(sqrt(num))\n", + " for var in range(2,sq+1) : \n", + " if num % var == 0 :\n", + " break\n", + " else :\n", + " print(num,end=',')\n", + " c = c + 1\n", + "print(\"\\nTotal Prime Number : \",c)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Object Oriented Programming Language.slides.html b/python_ipynb/Object Oriented Programming Language.slides.html new file mode 100644 index 0000000..e479bf0 --- /dev/null +++ b/python_ipynb/Object Oriented Programming Language.slides.html @@ -0,0 +1,13141 @@ + + + + + + + + + + + +Object Oriented Programming Language slides + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    +

    Object Oriented Programming Features

    +
    +
    +
    +
    +
    +
    +
    +
      +
    1. Encapsulation
    2. +
    3. Abstraction
    4. +
    5. Data Hiding
    6. +
    7. Dynamic Binding
    8. +
    9. Inheritance
    10. +
    11. Polymorphism (Over Riding)
    12. +
    13. Class
    14. +
    15. Object
    16. +
    +
    +
    +
    +
    +
    +
    +
    +

    Encapsulation

    +
    +
    +
    +
    +
    +
    +
    +

    Encapsulation is process by which we can bind many attributes and methods all together with single known as class.

    +
    +
    +
    +
    +
    +
    +
    +

    Abstraction

    +

    Abstraction is process by which we can only show assential details without include background details.

    +
    +
    +
    +
    +
    +
    +
    +

    Data Hiding

    +

    Hiding some information inside class defination

    +
    +
    +
    +
    +
    +
    In [2]:
    +
    +
    +
    class A:
    +    pass
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [29]:
    +
    +
    +
    import builtins
    +print(dir(builtins))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning', 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError', 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FileExistsError', 'FileNotFoundError', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError', 'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'ModuleNotFoundError', 'NameError', 'None', 'NotADirectoryError', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning', 'PermissionError', 'ProcessLookupError', 'RecursionError', 'ReferenceError', 'ResourceWarning', 'RuntimeError', 'RuntimeWarning', 'StopAsyncIteration', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'TimeoutError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning', 'WindowsError', 'ZeroDivisionError', '__IPYTHON__', '__build_class__', '__debug__', '__doc__', '__import__', '__loader__', '__name__', '__package__', '__spec__', 'abs', 'all', 'any', 'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'display', 'divmod', 'enumerate', 'eval', 'exec', 'filter', 'float', 'format', 'frozenset', 'get_ipython', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    class A:
    +    """This is A class just for fun"""
    +one = A()
    +print(one)
    +print(dir(one))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    <__main__.A object at 0x00000200B5E65BE0>
    +['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [22]:
    +
    +
    +
    class A:
    +    """This doc-string of A if you are a exprecienced program. 
    +    than you have to write it."""
    +    def __str__(self,):
    +        
    +        return "Hi I am object of Class A"
    +    def __add__(self,other):
    +        return "Bhai Bhai"
    +one = A()
    +print(one.__doc__)
    +print(one)
    +two = A()
    +print(two)
    +one + two
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    This doc-string of A if you are a exprecienced program. 
    +    than you have to write it.
    +Hi I am object of Class A
    +Hi I am object of Class A
    +
    +
    +
    + +
    + +
    Out[22]:
    + + + + +
    +
    'Bhai Bhai'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [23]:
    +
    +
    +
    class A:
    +    def show(self):
    +        print("Hi I am A classs")
    +    def hi(self):
    +        print("HI")
    +
    +class B: 
    +    def hello(self):
    +        print("Hello world this is B ")
    +    def hi(self):
    +        print("ha ha ha hi")
    +
    +class C(B,A):
    +    pass
    +
    +one = C()
    +one.show()
    +one.hello()
    +one.hi()
    +    
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hi I am A classs
    +Hello world this is B 
    +ha ha ha hi
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [24]:
    +
    +
    +
    x = 5 #global
    +y = 6 #global
    +def main(p,q):
    +    #print(x) #global
    +    #print(y)
    +    x = p #local
    +    y = q
    +    print(x)
    +    print(y)
    +main(6,6)
    +print(x)
    +print(y)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    6
    +6
    +5
    +6
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    class Person:
    +    def show(self,):
    +        print("I am Person ")
    +k = Person()
    +k.show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    I am Person 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [26]:
    +
    +
    +
    class Person:
    +    def set_name(self,name):
    +        self.name = name
    +    def get_name(self):
    +        print("My Name is : {}".format(self.name))
    +p1 = Person()
    +p2 = Person()
    +p1.set_name('Person1')
    +p2.set_name('Person2')
    +p1.get_name()
    +p2.get_name()
    +print(p1)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    My Name is : Person1
    +My Name is : Person2
    +<__main__.Person object at 0x00000200B5E65B00>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [25]:
    +
    +
    +
    class Person:
    +    def __init__(self,name,color,country):
    +        self.name = name
    +        self.color = color
    +        self.country = country
    +    def show(self):
    +        print("Name of the Object : ",self.name)
    +        print("Color of the Object : ",self.color)
    +        print("Country of the Object : ",self.country)
    +p1 = Person('Person1','fair','US')
    +p2 = Person('Person2','dull','Africa')
    +p3 = Person('Person3','dark','India')
    +p1.show()
    +p2.show()
    +p3.show()
    +print(dir(p1))
    +print(p2)
    +print(p3)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Name of the Object :  Person1
    +Color of the Object :  fair
    +Country of the Object :  US
    +Name of the Object :  Person2
    +Color of the Object :  dull
    +Country of the Object :  Africa
    +Name of the Object :  Person3
    +Color of the Object :  dark
    +Country of the Object :  India
    +['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'color', 'country', 'name', 'show']
    +<__main__.Person object at 0x00000200B5E7C780>
    +<__main__.Person object at 0x00000200B5E658D0>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [28]:
    +
    +
    +
    class Person:
    +    def __init__(self,name,color,country):
    +        self.name = name
    +        self.color = color
    +        self.country = country
    +    def __str__(self):
    +        s = """
    +        Name of the Object : {}
    +        Color of the Object : {}
    +        Country of the Object : {}
    +        """.format(self.name,self.color,self.country)
    +        return s 
    +john = Person('john','fair','Australia')
    +natasha = Person('john','normal','India')
    +print(john)
    +print(natasha)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +        Name of the Object : john
    +        Color of the Object : fair
    +        Country of the Object : Australia
    +        
    +
    +        Name of the Object : john
    +        Color of the Object : normal
    +        Country of the Object : India
    +        
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [29]:
    +
    +
    +
    class Area:
    +    def __init__(self,*args):
    +        self.sides = args
    +    def __str__(self):
    +        if len(self.sides) == 1 : 
    +            name = 'Circle'
    +            radias = self.sides[0]
    +            area = pi*radias*radias
    +            cir = 2*pi*radias
    +        elif len(self.sides) == 2 : 
    +            x,y = self.sides
    +            if x == y : 
    +                name = 'Squre'
    +            else : 
    +                name = 'Rectangle'
    +            area = x*y
    +            cir = 2*(x+y)
    +        elif len(self.sides) == 3 : 
    +            x,y,z = self.sides
    +            s = (x+y+z)/2
    +            area = sqrt(s*(s*x)*(s*y)*(s*z))
    +            cir = x + y + z
    +            name = 'Triangle'
    +        else : 
    +            return "\t\tInvalid Choice of Arguments"
    +        result = """
    +                 You are dealing with {0}
    +                 Area of {0} is {1}
    +                 Circumstance of {0} is {2}""".format(name,area,cir)
    +        return result
    +    def __repr__(self):
    +        if len(self.sides) == 1 : 
    +            name = 'Circle'
    +            radias = self.sides[0]
    +            area = pi*radias*radias
    +            cir = 2*pi*radias
    +        elif len(self.sides) == 2 : 
    +            x,y = self.sides
    +            if x == y : 
    +                name = 'Squre'
    +            else : 
    +                name = 'Rectangle'
    +            area = x*y
    +            cir = 2*(x+y)
    +        elif len(self.sides) == 3 : 
    +            x,y,z = self.sides
    +            s = (x+y+z)/2
    +            area = sqrt(s*(s*x)*(s*y)*(s*z))
    +            cir = x + y + z
    +            name = 'Triange'
    +        else : 
    +            return "Invalid Choice of Arguments"
    +        result = """
    +                 You are dealing with {0}
    +                 Area of {0} is {1}
    +                 Circumstance of {0} is {2}""".format(name,area,cir)
    +        return result
    +    
    +from math import sqrt,pi
    +a = Area(3)
    +b = Area(3,4)
    +c = Area(5,5)
    +d = Area(60,60,60)
    +e = Area(12,23,34,4,4,53,2,)
    +print(a)
    +print(b)
    +print(c)
    +print(d)
    +print(e)
    +a
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +                 You are dealing with Circle
    +                 Area of Circle is 28.274333882308138
    +                 Circumstance of Circle is 18.84955592153876
    +
    +                 You are dealing with Rectangle
    +                 Area of Rectangle is 12
    +                 Circumstance of Rectangle is 14
    +
    +                 You are dealing with Squre
    +                 Area of Squre is 25
    +                 Circumstance of Squre is 20
    +
    +                 You are dealing with Triangle
    +                 Area of Triangle is 3764539.8125136094
    +                 Circumstance of Triangle is 180
    +		Invalid Choice of Arguments
    +
    +
    +
    + +
    + +
    Out[29]:
    + + + + +
    +
    +                 You are dealing with Circle
    +                 Area of Circle is 28.274333882308138
    +                 Circumstance of Circle is 18.84955592153876
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [32]:
    +
    +
    +
    class Area:
    +    def __init__(self,*args):
    +        self.sides = args
    +    def area(self):
    +        if len(self.sides) == 1 : 
    +            return None
    +        elif len(self.sides) == 2 : 
    +            return None
    +        elif len(self.sides) == 3 : 
    +            return None
    +        else : 
    +            return None
    +    def cir(self):
    +        if len(self.sides) == 1 : 
    +            return None
    +        elif len(self.sides) == 2 : 
    +            return None
    +        elif len(self.sides) == 3 : 
    +            return None
    +        else : 
    +            return None
    +    def name(self):
    +        if len(self.sides) == 1 : 
    +            return 'Circle'
    +        elif len(self.sides) == 2 :
    +            if self.sides[0] == self.sides[1] : 
    +                return 'Squre'
    +            else : 
    +                return 'Rectangle'
    +        elif len(self.sides) == 3 : 
    +            return 'Triangle'
    +        else : 
    +            return "Polynomial"
    +        
    +    def __str__(self):
    +        area = self.area()
    +        cir = self.cir()
    +        name = self.name()
    +        return """
    +        Object Type : {}
    +        Area : {}
    +        Circumstance : {}
    +        """.format(name,area,cir)
    +        
    +obj1 = Area(56,78,94)
    +print(obj1)
    +obj2 = Area(55,55)
    +print(obj2)
    +obj1.area()
    +print(obj1.name())
    +print(obj2.name())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +        Object Type : Triangle
    +        Area : None
    +        Circumstance : None
    +        
    +
    +        Object Type : Squre
    +        Area : None
    +        Circumstance : None
    +        
    +Triangle
    +Squre
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [33]:
    +
    +
    +
    class A:
    +    def show():
    +        print("Hello")
    +a = A()
    +A.show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [34]:
    +
    +
    +
    class A:
    +    def show(self):
    +        print("Hi  I am A")
    +A.show('self')
    +one = A()
    +one.show()
    +print(dir(A))
    +print(dir(one))
    +print(A.__dict__)
    +print(one.__dict__)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hi  I am A
    +Hi  I am A
    +['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'show']
    +['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'show']
    +{'__module__': '__main__', 'show': <function A.show at 0x00000200B5E7F950>, '__dict__': <attribute '__dict__' of 'A' objects>, '__weakref__': <attribute '__weakref__' of 'A' objects>, '__doc__': None}
    +{}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [35]:
    +
    +
    +
    class A(object):
    +    def show(self,arg):
    +        self.name = arg
    +one = A()
    +print(A.__dict__)
    +print(one.__dict__)
    +one.show('sachin')
    +print(one.__dict__)
    +two = A()
    +two.show('rajat')
    +print(two.__dict__)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'__module__': '__main__', 'show': <function A.show at 0x00000200B5E3E510>, '__dict__': <attribute '__dict__' of 'A' objects>, '__weakref__': <attribute '__weakref__' of 'A' objects>, '__doc__': None}
    +{}
    +{'name': 'sachin'}
    +{'name': 'rajat'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [36]:
    +
    +
    +
    class A:
    +    def show(self):
    +        print("This is A")
    +class B(A):
    +    def hi(self):
    +        print("Hi from B")
    +c = B()
    +c.hi()
    +c.show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hi from B
    +This is A
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [37]:
    +
    +
    +
    class A():
    +    def show(self):
    +        print("A is Showing his feature")
    +class B(A):
    +    def show(self):
    +        #super().show()
    +        print("This is called over riding")
    +c = B()
    +c.show()
    +data =  {
    +    'user' : ['ram','hari','john','natasha'],
    +    'acc' : [ 1001, 1002, 1003, 1004 ],
    +    'bal' : [ 10000.0,20000.0,15000.0,25000.0],
    +    'password' : [ 'hari@mohan','redhat@123','good@bad','mty123124']
    +}
    +import json
    +f = open('bank.db','w')
    +json.dump(data,f)
    +f.close()
    +f= open('bank.db')
    +d = f.read()
    +f.close()
    +print(d)
    +f = open('bank.db')
    +e = json.load(f)
    +f.close()
    +print(e)
    +print(type(e))
    +print(e['user'])
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    This is called over riding
    +{"user": ["ram", "hari", "john", "natasha"], "acc": [1001, 1002, 1003, 1004], "bal": [10000.0, 20000.0, 15000.0, 25000.0], "password": ["hari@mohan", "redhat@123", "good@bad", "mty123124"]}
    +{'user': ['ram', 'hari', 'john', 'natasha'], 'acc': [1001, 1002, 1003, 1004], 'bal': [10000.0, 20000.0, 15000.0, 25000.0], 'password': ['hari@mohan', 'redhat@123', 'good@bad', 'mty123124']}
    +<class 'dict'>
    +['ram', 'hari', 'john', 'natasha']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [38]:
    +
    +
    +
    class Grras:
    +    """Grras -> show, update  functions to display and update
    +    a trainers profile."""
    +    msg = "There is no update for new exams" #shared msg class varible
    +    def __init__(self,name,subject):
    +        self.name = name #object variable
    +        self.subject = subject
    +    def show(self):
    +        print("Name : ",self.name)
    +        print("Subject : ",self.subject)
    +    def update(self,n,s):
    +        self.name = n
    +        self.subject = s
    +    def print_msg(self):
    +        print("Grras Broadcast : ",Grras.msg)
    +    def send_msg(self,m):
    +        Grras.msg = m + '-->'+self.name
    +    def __repr__(self):
    +        return self.name
    +sachin = Grras('Sachin Yadav','Basic Python')
    +rajat = Grras('Rajat Goyal','Linux')
    +print(sachin)
    +print(rajat)
    +sachin.show()
    +rajat.show()
    +sachin.print_msg()
    +rajat.print_msg()
    +rajat.send_msg("I will not come tomorrow so manage accordingly.")
    +sachin.print_msg()
    +sachin.send_msg('Ok i will manage your class, anything else ? ')
    +rajat.print_msg()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Sachin Yadav
    +Rajat Goyal
    +Name :  Sachin Yadav
    +Subject :  Basic Python
    +Name :  Rajat Goyal
    +Subject :  Linux
    +Grras Broadcast :  There is no update for new exams
    +Grras Broadcast :  There is no update for new exams
    +Grras Broadcast :  I will not come tomorrow so manage accordingly.-->Rajat Goyal
    +Grras Broadcast :  Ok i will manage your class, anything else ? -->Sachin Yadav
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [39]:
    +
    +
    +
    class Student:
    +    def __init__(self,**kwargs):
    +        self.__dict__.update(kwargs)
    +    def show(self):
    +        for key,value in self.__dict__.items():
    +            print("{} = {} ".format(key,value))
    +    def update(self,**kwargs):
    +        self.__dict__.update(kwargs)
    +    def __repr__(self):
    +        return self.__dict__.get('name','Student')
    +        
    +s1 = Student()
    +print(s1)
    +s2 = Student(name='x',age=18,email='x@y.com')
    +s2.show()
    +s1.show()
    +print(s2)
    +s1.update(name='y',age='36')
    +print(s1)
    +s1.show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Student
    +name = x 
    +age = 18 
    +email = x@y.com 
    +x
    +y
    +name = y 
    +age = 36 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [40]:
    +
    +
    +
    class Result(Student):
    +    def __init__(self,maths,science,english,**kwargs):
    +        self.maths = maths
    +        self.science = science
    +        self.english = english
    +        super().__init__(**kwargs)
    +x = Result(maths=60,science=35,english=60,name='john',standard='12A')
    +x.show()
    +print(hasattr(Student,'show'))
    +print(hasattr(x,'name'))
    +print(hasattr(x,'show'))
    +print(setattr(x,'email','grras@gamil.com'))
    +x.show()
    +print(getattr(x,'email'))
    +print(issubclass(Student,Result))
    +print(issubclass(Result,Student))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    maths = 60 
    +science = 35 
    +english = 60 
    +name = john 
    +standard = 12A 
    +True
    +True
    +True
    +None
    +maths = 60 
    +science = 35 
    +english = 60 
    +name = john 
    +standard = 12A 
    +email = grras@gamil.com 
    +grras@gamil.com
    +False
    +True
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [41]:
    +
    +
    +
    import builtins
    +print(dir(builtins))
    +print(isinstance([1,2,3],list))
    +print(isinstance(x,Result))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning', 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError', 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FileExistsError', 'FileNotFoundError', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError', 'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'ModuleNotFoundError', 'NameError', 'None', 'NotADirectoryError', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning', 'PermissionError', 'ProcessLookupError', 'RecursionError', 'ReferenceError', 'ResourceWarning', 'RuntimeError', 'RuntimeWarning', 'StopAsyncIteration', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'TimeoutError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning', 'WindowsError', 'ZeroDivisionError', '__IPYTHON__', '__build_class__', '__debug__', '__doc__', '__import__', '__loader__', '__name__', '__package__', '__spec__', 'abs', 'all', 'any', 'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'display', 'divmod', 'enumerate', 'eval', 'exec', 'filter', 'float', 'format', 'frozenset', 'get_ipython', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip']
    +True
    +True
    +
    +
    +
    + +
    +
    + +
    +
    +
    + + + + + + + diff --git a/python_ipynb/Object_Oriented_Programming_Language.html b/python_ipynb/Object_Oriented_Programming_Language.html new file mode 100644 index 0000000..4f03f86 --- /dev/null +++ b/python_ipynb/Object_Oriented_Programming_Language.html @@ -0,0 +1,14630 @@ + + + + +Object_Oriented_Programming_Language + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +

    Object Oriented Programming Features

    +
    +
    +
    +
    +
    +
    +
  • Encapsulation
  • +
    +
    +
    +
    +
    +
    +
  • Abstraction
  • +
    +
    +
    +
    +
    +
    +
  • Data Hiding
  • +
    +
    +
    +
    +
    +
    +
  • Dynamic Binding
  • +
    +
    +
    +
    +
    +
    +
  • Inheritance
  • +
    +
    +
    +
    +
    +
    +
  • Polymorphism (Over Riding)
  • +
    +
    +
    +
    +
    +
    +
  • Class
  • +
    +
    +
    +
    +
    +
    +
  • Object
  • +
    +
    +
    +
    +
    +
    +

    Encapsulation

    +

    Encapsulation is process by which we can bind many attributes and methods all together with single known as class.

    +
    +
    +
    +
    +
    +
    +

    Abstraction

    +

    Abstraction is process by which we can only show assential details without include background details.

    +
    +
    +
    +
    +
    +
    +

    Data Hiding

    +

    Hiding some information inside class defination

    +
    +
    +
    +
    +
    +
    +

    Defining a Class

    +
    +
    +
    +
    +
    +
    In [1]:
    +
    +
    +
    class A: #defining Class
    +    pass #attribute that does nothing
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    object_one = A() #creating an object of class A
    +print(dir(A)) ; print()#printing out all the attributes and methods class A have
    +print("Every object is just a carbon copy of class \n")
    +print(dir(object_one)) #will show same attributes and methods as class because it's has the blue print of class A
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']
    +
    +Every object is just a carbon copy of class 
    +
    +['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    import builtins
    +print(dir(builtins))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning', 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError', 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FileExistsError', 'FileNotFoundError', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError', 'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'ModuleNotFoundError', 'NameError', 'None', 'NotADirectoryError', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning', 'PermissionError', 'ProcessLookupError', 'RecursionError', 'ReferenceError', 'ResourceWarning', 'RuntimeError', 'RuntimeWarning', 'StopAsyncIteration', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'TimeoutError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning', 'WindowsError', 'ZeroDivisionError', '__IPYTHON__', '__build_class__', '__debug__', '__doc__', '__import__', '__loader__', '__name__', '__package__', '__spec__', 'abs', 'all', 'any', 'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'display', 'divmod', 'enumerate', 'eval', 'exec', 'filter', 'float', 'format', 'frozenset', 'get_ipython', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    More Classes

    +
    +
    +
    +
    +
    +
    In [4]:
    +
    +
    +
    class A: 
    +    """This is A class just for fun""" #doc-string for class
    +one = A() #creating an object of class a
    +print(dir(one)) #directory of class A
    +print(one) #printing Object Default value
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']
    +<__main__.A object at 0x0000024254E4BF98>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    class A:
    +    """This doc-string of A if you are a exprecienced program. 
    +    than you have to write it."""
    +    def __str__(self): #self is the scope of every object where they stores their data
    +        return "Hi I am object of Class A" #__str__ is responsible for what should object will print
    +    def __add__(self,other): #operator overloading this function decide the behaviour of + operator
    +        return "Bhai Bhai"
    +one = A()
    +print(one.__doc__) #printing doc-string 
    +print(one)
    +two = A()
    +print(two)
    +one + two #calling magic method __add__ using object of class A
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    This doc-string of A if you are a exprecienced program. 
    +    than you have to write it.
    +Hi I am object of Class A
    +Hi I am object of Class A
    +
    +
    +
    + +
    + +
    Out[5]:
    + + + + +
    +
    'Bhai Bhai'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +

    Inheritance

    +
    +
    +
    +
    +
    +
    +

    Inheritance is a powerful feature in object oriented programming. +It refers to defining a new class with little or no modification to an existing class. +The new class is called derived (or child) class +and the one from which it inherits is called the base (or parent) class.

    Inheritance is a powerful feature in object oriented programming. +It refers to defining a new class with little or no modification to an existing class. +The new class is called derived (or child) class +and the one from which it inherits is called the base (or parent) class.

    +
    +
    +
    +
    +
    +
    In [6]:
    +
    +
    +
    class A:
    +    def show(self): #method of Class A
    +        print("Hi I am A classs")
    +    def hi(self): #method of class A
    +        print("HI")
    +class B: 
    +    def hello(self): #method of class B
    +        print("Hello world this is B ")
    +    def hi(self): #method of class B
    +        print("ha ha ha hi")
    +class C(B,A): # will follow mro rule --> method resolution order
    +    pass
    +one = C()
    +one.show()
    +one.hello()
    +one.hi() #will call class B's hi method because of mro
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hi I am A classs
    +Hello world this is B 
    +ha ha ha hi
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    Name Space Revision

    +
    +
    +
    +
    +
    +
    In [7]:
    +
    +
    +
    x = 5 #global
    +y = 6 #global
    +def main(p,q):
    +    #print(x) #global
    +    #print(y)
    +    x = p #local
    +    y = q
    +    print(x)
    +    print(y)
    +main(6,6)
    +print(x)
    +print(y)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    6
    +6
    +5
    +6
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    What is method ?

    +
    +
    +
    +
    +
    +
    +

    Any function inside a class is known as method. Same as any operator or variable inside the class is known as attributes

    +
    +
    +
    +
    +
    +
    In [8]:
    +
    +
    +
    class Person:
    +    def show(self,): #just a method
    +        print("I am Person ") #boring printing
    +k = Person()
    +k.show() #calling method
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    I am Person 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    class Person:
    +    def set_name(self,name): #method to set some values to objects self scope
    +        self.name = name
    +    def get_name(self): # method to print name
    +        print("My Name is : {}".format(self.name))
    +p1 = Person()
    +p2 = Person() #instatiation
    +p1.set_name('Person1')
    +p2.set_name('Person2') #setting name
    +p1.get_name() #getting name
    +p2.get_name()
    +print(p1) #just printing objects default implementation
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    My Name is : Person1
    +My Name is : Person2
    +<__main__.Person object at 0x0000024254E82470>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    More and More Classes

    +
    +
    +
    +
    +
    +
    In [10]:
    +
    +
    +
    class Person:
    +    def __init__(self,name,country): #constructor --> creator of each object 
    +        """__new__() is the constructor as it allocates memory for each object called self, where each object put it's data.
    +        __init__() is known as  initializer, it's responsibility to initilize the initial values into self of an object."""
    +        self.name = name # self is a dictionary in which each objects has it's data
    +        self.country = country #self created whenever an object is created and destroyed whenever an object is distroyed
    +    def show(self):
    +        print("Name of the Object : ",self.name)
    +        print("Country of the Object : ",self.country)
    +p1 = Person('Person1','US')
    +p2 = Person('Person2','Africa') 
    +p1.show()
    +p2.show() 
    +print(p1)
    +print(p2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Name of the Object :  Person1
    +Country of the Object :  US
    +Name of the Object :  Person2
    +Country of the Object :  Africa
    +<__main__.Person object at 0x0000024254E82898>
    +<__main__.Person object at 0x0000024254E82828>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    printing an object as Meaningfull

    +
    +
    +
    +
    +
    +
    In [11]:
    +
    +
    +
    class Person:
    +    def __init__(self,name,color,country): #constructer
    +        self.name = name # initilizing values into objects self
    +        self.color = color
    +        self.country = country
    +    def __str__(self):  #representation of an object
    +        s = """Name of the Object : {}\nColor of the Object : {}\nCountry of the Object : {}""".format(self.name,self.color,self.country)
    +        return s  #this will be printed whenver an object is printed
    +john = Person('john','fair','Australia')
    +natasha = Person('john','normal','India')
    +print(john)
    +print(natasha)#how to change representation of an object so repr() also return something meaning full
    +print(repr(natasha)) #every class has method as __repr__ change it
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Name of the Object : john
    +Color of the Object : fair
    +Country of the Object : Australia
    +Name of the Object : john
    +Color of the Object : normal
    +Country of the Object : India
    +<__main__.Person object at 0x0000024254E82C18>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    Working Example of Class

    +
    +
    +
    +
    +
    +
    In [12]:
    +
    +
    +
    class Area:
    +    def __init__(self,*args):
    +        self.sides = args
    +    def __str__(self):
    +        if len(self.sides) == 1 : 
    +            name = 'Circle'
    +            radias = self.sides[0]
    +            area = pi*radias*radias
    +            cir = 2*pi*radias
    +        elif len(self.sides) == 2 : 
    +            x,y = self.sides
    +            if x == y : 
    +                name = 'Squre'
    +            else : 
    +                name = 'Rectangle'
    +            area = x*y
    +            cir = 2*(x+y)
    +        elif len(self.sides) == 3 : 
    +            x,y,z = self.sides
    +            s = (x+y+z)/2
    +            area = sqrt(s*(s*x)*(s*y)*(s*z))
    +            cir = x + y + z
    +            name = 'Triangle'
    +        else : 
    +            return "\t\tInvalid Choice of Arguments"
    +        result = """You are dealing with {0}\nArea of {0} is {1}\nCircumstance of {0} is {2}""".format(name,area,cir)
    +        return result
    +    def __repr__(self):
    +        if len(self.sides) == 1 : 
    +            name = 'Circle'
    +            radias = self.sides[0]
    +            area = pi*radias*radias
    +            cir = 2*pi*radias
    +        elif len(self.sides) == 2 : 
    +            x,y = self.sides
    +            if x == y : 
    +                name = 'Squre'
    +            else : 
    +                name = 'Rectangle'
    +            area = x*y
    +            cir = 2*(x+y)
    +        elif len(self.sides) == 3 : 
    +            x,y,z = self.sides
    +            s = (x+y+z)/2
    +            area = sqrt(s*(s*x)*(s*y)*(s*z))
    +            cir = x + y + z
    +            name = 'Triange'
    +        else : 
    +            return "Invalid Choice of Arguments"
    +        result = """You are dealing with {0} Area of {0} is {1} Circumstance of {0} is {2}""".format(name,area,cir)
    +        return result
    +    
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    from math import sqrt,pi
    +a = Area(3)
    +b = Area(3,4)
    +c = Area(5,5)
    +d = Area(60,60,60)
    +e = Area(12,23,34,4,4,53,2,)
    +print(a);print(b)
    +print(c);print(d)
    +print(e)
    +print(repr(a))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    You are dealing with Circle
    +Area of Circle is 28.274333882308138
    +Circumstance of Circle is 18.84955592153876
    +You are dealing with Rectangle
    +Area of Rectangle is 12
    +Circumstance of Rectangle is 14
    +You are dealing with Squre
    +Area of Squre is 25
    +Circumstance of Squre is 20
    +You are dealing with Triangle
    +Area of Triangle is 3764539.8125136094
    +Circumstance of Triangle is 180
    +		Invalid Choice of Arguments
    +You are dealing with Circle Area of Circle is 28.274333882308138 Circumstance of Circle is 18.84955592153876
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    Now Seriously Something Usefull

    +
    +
    +
    +
    +
    +
    In [14]:
    +
    +
    +
    class Area:
    +    def __init__(self,*args):
    +        self.sides = args
    +    def area(self):
    +        if len(self.sides) == 1 : 
    +            return None
    +        elif len(self.sides) == 2 : 
    +            return None
    +        elif len(self.sides) == 3 : 
    +            return None
    +        else : 
    +            return None
    +    def cir(self):
    +        if len(self.sides) == 1 : 
    +            return None
    +        elif len(self.sides) == 2 : 
    +            return None
    +        elif len(self.sides) == 3 : 
    +            return None
    +        else : 
    +            return None
    +    def name(self):
    +        if len(self.sides) == 1 : 
    +            return 'Circle'
    +        elif len(self.sides) == 2 :
    +            if self.sides[0] == self.sides[1] : 
    +                return 'Squre'
    +            else : 
    +                return 'Rectangle'
    +        elif len(self.sides) == 3 : 
    +            return 'Triangle'
    +        else : 
    +            return "Polynomial"
    +        
    +    def __str__(self):
    +        area = self.area()
    +        cir = self.cir()
    +        name = self.name()
    +        return """
    +        Object Type : {}
    +        Area : {}
    +        Circumstance : {}
    +        """.format(name,area,cir)
    +        
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    obj1 = Area(56,78,94)
    +print(obj1)
    +obj2 = Area(55,55)
    +print(obj2)
    +obj1.area()
    +print(obj1.name())
    +print(obj2.name())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +        Object Type : Triangle
    +        Area : None
    +        Circumstance : None
    +        
    +
    +        Object Type : Squre
    +        Area : None
    +        Circumstance : None
    +        
    +Triangle
    +Squre
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    Ok!! can i call a method without any object ?

    +
    +
    +
    +
    +
    +
    In [16]:
    +
    +
    +
    class A:
    +    def show(): #only can call by class directly beacuse no self is there
    +        print("Hello")
    +a = A()
    +A.show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    Name Space in OOPS

    +
    +
    +
    +
    +
    +
    In [17]:
    +
    +
    +
    class A:
    +    def show(self):
    +        print("Hi  I am A")
    +one = A()
    +one.show()
    +print("\nData inside a Class Dictionary ")
    +print(A.__dict__) # data of class or we can say shared data (shared data)
    +print("\nData inside a Object Dictionary ")
    +print(one.__dict__) #data of Object or we can say personal data (self of an object)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hi  I am A
    +
    +Data inside a Class Dictionary 
    +{'__module__': '__main__', 'show': <function A.show at 0x0000024254E4E7B8>, '__dict__': <attribute '__dict__' of 'A' objects>, '__weakref__': <attribute '__weakref__' of 'A' objects>, '__doc__': None}
    +
    +Data inside a Object Dictionary 
    +{}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    Let's add something into objects

    +
    +
    +
    +
    +
    +
    In [18]:
    +
    +
    +
    class A(object):
    +    def show(self,arg):
    +        self.name = arg
    +one = A()
    +print("Before data in Class") ; print(A.__dict__)
    +print("\nBefore data in object one") ; print(one.__dict__)
    +one.show('sachin')
    +print("\nAfter adding data dictionary (self) of object one")
    +print(one.__dict__)
    +two = A() ; two.show('rajat')
    +print("\nData of object two")
    +print(two.__dict__)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Before data in Class
    +{'__module__': '__main__', 'show': <function A.show at 0x0000024254E7D7B8>, '__dict__': <attribute '__dict__' of 'A' objects>, '__weakref__': <attribute '__weakref__' of 'A' objects>, '__doc__': None}
    +
    +Before data in object one
    +{}
    +
    +After adding data dictionary (self) of object one
    +{'name': 'sachin'}
    +
    +Data of object two
    +{'name': 'rajat'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    Inheritance Again

    +
    +
    +
    +
    +
    +
    In [19]:
    +
    +
    +
    class A:
    +    def show(self):
    +        print("HI from A")
    +class B(A): #child class B is inherting the features of parent class A
    +    def hi(self):
    +        print("Hi from B")
    +c = B()
    +c.hi()
    +c.show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hi from B
    +HI from A
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    Let's See Overriding Now

    +
    +
    +
    +
    +
    +
    +

    Overriding means giving a new defination to old vintage methods of parent class.

    +
    +
    +
    +
    +
    +
    In [20]:
    +
    +
    +
    class A():
    +    def show(self):
    +        print("A is Showing his feature")
    +class B(A):
    +    def show(self):
    +        #super().show()
    +        print("This is called over riding")
    +c = B()
    +c.show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    This is called over riding
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    Let's do something different

    +
    +
    +
    +
    +
    +
    +

    Let's write python objects to a file

    +
    +
    +
    +
    +
    +
    +

    Let's Prepare the data object

    +
    +
    +
    +
    +
    +
    In [21]:
    +
    +
    +
    data =  {
    +    'user' : ['ram','hari','john','natasha'],
    +    'acc' : [ 1001, 1002, 1003, 1004 ],
    +    'bal' : [ 10000.0,20000.0,15000.0,25000.0],
    +    'password' : [ 'hari@mohan','redhat@123','good@bad','mty123124']
    +}
    +
    + +
    +
    +
    + +
    +
    +
    +
    +

    JSON --> Java Script Object Notation Language

    +
    +
    +
    +
    +
    +
    +

    JSON and PICKLE is used to write python objects into files and read python objects from files

    +
    +
    +
    +
    +
    +
    In [22]:
    +
    +
    +
    import json #importing json from standard library of python
    +f = open('bank.db','w') #opening a file for writing data
    +#json.dump is used to dump data into file pointer
    +json.dump(data,f) #writing dictionary object into file using json 
    +f.close() #closing file 
    +
    + +
    +
    +
    + +
    +
    +
    +
    +

    Let's Read Python Objects from a file Using JSON

    +
    +
    +
    +
    +
    +
    In [23]:
    +
    +
    +
    print("Without Json\n")
    +f= open('bank.db') #opening file for reading data
    +d = f.read() #reading data traditional way
    +f.close() #closing File
    +print(repr(d)) #printing Data  
    +print("With Json\n")
    +f = open('bank.db')
    +e = json.load(f) #reading object instead of string using json
    +f.close()
    +print(repr(e)) #let's print the object
    +print("\ntype of data extracted using json = ",type(e)) #you can see we have sucessfully extracted dictionary from a file
    +print()
    +print(e['user']) #it's working
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Without Json
    +
    +'{"user": ["ram", "hari", "john", "natasha"], "acc": [1001, 1002, 1003, 1004], "bal": [10000.0, 20000.0, 15000.0, 25000.0], "password": ["hari@mohan", "redhat@123", "good@bad", "mty123124"]}'
    +With Json
    +
    +{'user': ['ram', 'hari', 'john', 'natasha'], 'acc': [1001, 1002, 1003, 1004], 'bal': [10000.0, 20000.0, 15000.0, 25000.0], 'password': ['hari@mohan', 'redhat@123', 'good@bad', 'mty123124']}
    +
    +type of data extracted using json =  <class 'dict'>
    +
    +['ram', 'hari', 'john', 'natasha']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    Share Memory Concept

    +
    +
    +
    +
    +
    +
    +

    class variable are shared variable, can be used by any object simultaneously.Every Object has it's private variable in it's self

    +
    +
    +
    +
    +
    +
    In [24]:
    +
    +
    +
    class Grras:
    +    """Grras -> show, update  functions to display and update
    +    a trainers profile."""
    +    msg = "There is no update for new exams" #shared msg class varible
    +    def __init__(self,name,subject):
    +        self.name = name #object variable
    +        self.subject = subject
    +    def show(self):
    +        print("Name : ",self.name)
    +        print("Subject : ",self.subject)
    +    def update(self,n,s):
    +        self.name = n
    +        self.subject = s
    +    def print_msg(self):
    +        print("Grras Broadcast : ",Grras.msg)
    +    def send_msg(self,m):
    +        Grras.msg = m + '-->'+self.name
    +    def __repr__(self):
    +        return self.name
    +
    + +
    +
    +
    + +
    +
    +
    +
    +

    Message Passing

    +
    +
    +
    +
    +
    +
    In [25]:
    +
    +
    +
    sachin = Grras('Sachin Yadav','Basic Python')
    +rajat = Grras('Rajat Goyal','Linux')
    +print(sachin)
    +print(rajat)
    +sachin.show()
    +rajat.show()
    +sachin.print_msg()
    +rajat.print_msg()
    +rajat.send_msg("I will not come tomorrow so manage accordingly.")
    +sachin.print_msg()
    +sachin.send_msg('Ok i will manage your class, anything else ? ')
    +rajat.print_msg()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Sachin Yadav
    +Rajat Goyal
    +Name :  Sachin Yadav
    +Subject :  Basic Python
    +Name :  Rajat Goyal
    +Subject :  Linux
    +Grras Broadcast :  There is no update for new exams
    +Grras Broadcast :  There is no update for new exams
    +Grras Broadcast :  I will not come tomorrow so manage accordingly.-->Rajat Goyal
    +Grras Broadcast :  Ok i will manage your class, anything else ? -->Sachin Yadav
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    Some Examples of Class

    +
    +
    +
    +
    +
    +
    In [26]:
    +
    +
    +
    class Student:
    +    def __init__(self,**kwargs):
    +        self.__dict__.update(kwargs)
    +    def show(self):
    +        for key,value in self.__dict__.items():
    +            print("{} = {} ".format(key,value))
    +    def update(self,**kwargs):
    +        self.__dict__.update(kwargs)
    +    def __repr__(self):
    +        return self.__dict__.get('name','Student')        
    +s1 = Student()
    +print(s1)
    +s2 = Student(name='x',age=18,email='x@y.com')
    +s2.show()
    +s1.show()
    +print(s2)
    +s1.update(name='y',age='36')
    +print(s1)
    +s1.show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Student
    +name = x 
    +age = 18 
    +email = x@y.com 
    +x
    +y
    +name = y 
    +age = 36 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    class Result(Student):
    +    def __init__(self,maths,science,english,**kwargs):
    +        self.maths = maths
    +        self.science = science
    +        self.english = english
    +        super().__init__(**kwargs)
    +x = Result(maths=60,science=35,english=60,name='john',standard='12A')
    +x.show()
    +print(hasattr(Student,'show'))
    +print(hasattr(x,'name'))
    +print(hasattr(x,'show'))
    +print(setattr(x,'email','grras@gamil.com'))
    +x.show()
    +print(getattr(x,'email'))
    +print(issubclass(Student,Result))
    +print(issubclass(Result,Student))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    maths = 60 
    +science = 35 
    +english = 60 
    +name = john 
    +standard = 12A 
    +True
    +True
    +True
    +None
    +maths = 60 
    +science = 35 
    +english = 60 
    +name = john 
    +standard = 12A 
    +email = grras@gamil.com 
    +grras@gamil.com
    +False
    +True
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +

    Getter and Setter methods of class

    +
    +
    +
    +
    +
    +
    In [29]:
    +
    +
    +
    print(dir(Result))
    +print(isinstance([1,2,3],list))
    +print(isinstance(x,Result))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'show', 'update']
    +True
    +True
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/Object_Oriented_Programming_Language.ipynb b/python_ipynb/Object_Oriented_Programming_Language.ipynb new file mode 100644 index 0000000..860eccf --- /dev/null +++ b/python_ipynb/Object_Oriented_Programming_Language.ipynb @@ -0,0 +1,1467 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Object Oriented Programming Features

    \n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "\n", + "
  • Encapsulation
  • \n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "
  • Abstraction
  • \n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "
  • Data Hiding
  • \n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "
  • Dynamic Binding
  • \n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "
  • Inheritance
  • \n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "
  • Polymorphism (Over Riding)
  • \n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "
  • Class
  • \n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "
  • Object
  • " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Encapsulation

    \n", + "

    Encapsulation is process by which we can bind many attributes and methods all together with single known as class.

    \n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "

    Abstraction

    \n", + "

    Abstraction is process by which we can only show assential details without include background details.

    \n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "

    Data Hiding

    \n", + "

    Hiding some information inside class defination

    " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Defining a Class

    " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [], + "source": [ + "class A: #defining Class\n", + " pass #attribute that does nothing\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']\n", + "\n", + "Every object is just a carbon copy of class \n", + "\n", + "['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']\n" + ] + } + ], + "source": [ + "object_one = A() #creating an object of class A\n", + "print(dir(A)) ; print()#printing out all the attributes and methods class A have\n", + "print(\"Every object is just a carbon copy of class \\n\")\n", + "print(dir(object_one)) #will show same attributes and methods as class because it's has the blue print of class A" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning', 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError', 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FileExistsError', 'FileNotFoundError', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError', 'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'ModuleNotFoundError', 'NameError', 'None', 'NotADirectoryError', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning', 'PermissionError', 'ProcessLookupError', 'RecursionError', 'ReferenceError', 'ResourceWarning', 'RuntimeError', 'RuntimeWarning', 'StopAsyncIteration', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'TimeoutError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning', 'WindowsError', 'ZeroDivisionError', '__IPYTHON__', '__build_class__', '__debug__', '__doc__', '__import__', '__loader__', '__name__', '__package__', '__spec__', 'abs', 'all', 'any', 'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'display', 'divmod', 'enumerate', 'eval', 'exec', 'filter', 'float', 'format', 'frozenset', 'get_ipython', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip']\n" + ] + } + ], + "source": [ + "import builtins\n", + "print(dir(builtins))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    More Classes

    " + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']\n", + "<__main__.A object at 0x0000024254E4BF98>\n" + ] + } + ], + "source": [ + "class A: \n", + " \"\"\"This is A class just for fun\"\"\" #doc-string for class\n", + "one = A() #creating an object of class a\n", + "print(dir(one)) #directory of class A\n", + "print(one) #printing Object Default value" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "This doc-string of A if you are a exprecienced program. \n", + " than you have to write it.\n", + "Hi I am object of Class A\n", + "Hi I am object of Class A\n" + ] + }, + { + "data": { + "text/plain": [ + "'Bhai Bhai'" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "class A:\n", + " \"\"\"This doc-string of A if you are a exprecienced program. \n", + " than you have to write it.\"\"\"\n", + " def __str__(self): #self is the scope of every object where they stores their data\n", + " return \"Hi I am object of Class A\" #__str__ is responsible for what should object will print\n", + " def __add__(self,other): #operator overloading this function decide the behaviour of + operator\n", + " return \"Bhai Bhai\"\n", + "one = A()\n", + "print(one.__doc__) #printing doc-string \n", + "print(one)\n", + "two = A()\n", + "print(two)\n", + "one + two #calling magic method __add__ using object of class A" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Inheritance

    \n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "

    Inheritance is a powerful feature in object oriented programming. \n", + "It refers to defining a new class with little or no modification to an existing class.\n", + "The new class is called derived (or child) class \n", + "and the one from which it inherits is called the base (or parent) class.

    Inheritance is a powerful feature in object oriented programming. \n", + "It refers to defining a new class with little or no modification to an existing class.\n", + "The new class is called derived (or child) class \n", + "and the one from which it inherits is called the base (or parent) class.

    \n" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hi I am A classs\n", + "Hello world this is B \n", + "ha ha ha hi\n" + ] + } + ], + "source": [ + "class A:\n", + " def show(self): #method of Class A\n", + " print(\"Hi I am A classs\")\n", + " def hi(self): #method of class A\n", + " print(\"HI\")\n", + "class B: \n", + " def hello(self): #method of class B\n", + " print(\"Hello world this is B \")\n", + " def hi(self): #method of class B\n", + " print(\"ha ha ha hi\")\n", + "class C(B,A): # will follow mro rule --> method resolution order\n", + " pass\n", + "one = C()\n", + "one.show()\n", + "one.hello()\n", + "one.hi() #will call class B's hi method because of mro" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Name Space Revision

    " + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "6\n", + "6\n", + "5\n", + "6\n" + ] + } + ], + "source": [ + "\n", + "x = 5 #global\n", + "y = 6 #global\n", + "def main(p,q):\n", + " #print(x) #global\n", + " #print(y)\n", + " x = p #local\n", + " y = q\n", + " print(x)\n", + " print(y)\n", + "main(6,6)\n", + "print(x)\n", + "print(y)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    What is method ?

    " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "

    Any function inside a class is known as method. Same as any operator or variable inside the class is known as attributes

    " + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I am Person \n" + ] + } + ], + "source": [ + "class Person:\n", + " def show(self,): #just a method\n", + " print(\"I am Person \") #boring printing\n", + "k = Person()\n", + "k.show() #calling method" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "My Name is : Person1\n", + "My Name is : Person2\n", + "<__main__.Person object at 0x0000024254E82470>\n" + ] + } + ], + "source": [ + "class Person:\n", + " def set_name(self,name): #method to set some values to objects self scope\n", + " self.name = name\n", + " def get_name(self): # method to print name\n", + " print(\"My Name is : {}\".format(self.name))\n", + "p1 = Person()\n", + "p2 = Person() #instatiation\n", + "p1.set_name('Person1')\n", + "p2.set_name('Person2') #setting name\n", + "p1.get_name() #getting name\n", + "p2.get_name()\n", + "print(p1) #just printing objects default implementation" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    More and More Classes

    " + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Name of the Object : Person1\n", + "Country of the Object : US\n", + "Name of the Object : Person2\n", + "Country of the Object : Africa\n", + "<__main__.Person object at 0x0000024254E82898>\n", + "<__main__.Person object at 0x0000024254E82828>\n" + ] + } + ], + "source": [ + "class Person:\n", + " def __init__(self,name,country): #constructor --> creator of each object \n", + " \"\"\"__new__() is the constructor as it allocates memory for each object called self, where each object put it's data.\n", + " __init__() is known as initializer, it's responsibility to initilize the initial values into self of an object.\"\"\"\n", + " self.name = name # self is a dictionary in which each objects has it's data\n", + " self.country = country #self created whenever an object is created and destroyed whenever an object is distroyed\n", + " def show(self):\n", + " print(\"Name of the Object : \",self.name)\n", + " print(\"Country of the Object : \",self.country)\n", + "p1 = Person('Person1','US')\n", + "p2 = Person('Person2','Africa') \n", + "p1.show()\n", + "p2.show() \n", + "print(p1)\n", + "print(p2)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    printing an object as Meaningfull

    " + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Name of the Object : john\n", + "Color of the Object : fair\n", + "Country of the Object : Australia\n", + "Name of the Object : john\n", + "Color of the Object : normal\n", + "Country of the Object : India\n", + "<__main__.Person object at 0x0000024254E82C18>\n" + ] + } + ], + "source": [ + "class Person:\n", + " def __init__(self,name,color,country): #constructer\n", + " self.name = name # initilizing values into objects self\n", + " self.color = color\n", + " self.country = country\n", + " def __str__(self): #representation of an object\n", + " s = \"\"\"Name of the Object : {}\\nColor of the Object : {}\\nCountry of the Object : {}\"\"\".format(self.name,self.color,self.country)\n", + " return s #this will be printed whenver an object is printed\n", + "john = Person('john','fair','Australia')\n", + "natasha = Person('john','normal','India')\n", + "print(john)\n", + "print(natasha)#how to change representation of an object so repr() also return something meaning full\n", + "print(repr(natasha)) #every class has method as __repr__ change it" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Working Example of Class

    " + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [], + "source": [ + "class Area:\n", + " def __init__(self,*args):\n", + " self.sides = args\n", + " def __str__(self):\n", + " if len(self.sides) == 1 : \n", + " name = 'Circle'\n", + " radias = self.sides[0]\n", + " area = pi*radias*radias\n", + " cir = 2*pi*radias\n", + " elif len(self.sides) == 2 : \n", + " x,y = self.sides\n", + " if x == y : \n", + " name = 'Squre'\n", + " else : \n", + " name = 'Rectangle'\n", + " area = x*y\n", + " cir = 2*(x+y)\n", + " elif len(self.sides) == 3 : \n", + " x,y,z = self.sides\n", + " s = (x+y+z)/2\n", + " area = sqrt(s*(s*x)*(s*y)*(s*z))\n", + " cir = x + y + z\n", + " name = 'Triangle'\n", + " else : \n", + " return \"\\t\\tInvalid Choice of Arguments\"\n", + " result = \"\"\"You are dealing with {0}\\nArea of {0} is {1}\\nCircumstance of {0} is {2}\"\"\".format(name,area,cir)\n", + " return result\n", + " def __repr__(self):\n", + " if len(self.sides) == 1 : \n", + " name = 'Circle'\n", + " radias = self.sides[0]\n", + " area = pi*radias*radias\n", + " cir = 2*pi*radias\n", + " elif len(self.sides) == 2 : \n", + " x,y = self.sides\n", + " if x == y : \n", + " name = 'Squre'\n", + " else : \n", + " name = 'Rectangle'\n", + " area = x*y\n", + " cir = 2*(x+y)\n", + " elif len(self.sides) == 3 : \n", + " x,y,z = self.sides\n", + " s = (x+y+z)/2\n", + " area = sqrt(s*(s*x)*(s*y)*(s*z))\n", + " cir = x + y + z\n", + " name = 'Triange'\n", + " else : \n", + " return \"Invalid Choice of Arguments\"\n", + " result = \"\"\"You are dealing with {0} Area of {0} is {1} Circumstance of {0} is {2}\"\"\".format(name,area,cir)\n", + " return result\n", + " \n" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "You are dealing with Circle\n", + "Area of Circle is 28.274333882308138\n", + "Circumstance of Circle is 18.84955592153876\n", + "You are dealing with Rectangle\n", + "Area of Rectangle is 12\n", + "Circumstance of Rectangle is 14\n", + "You are dealing with Squre\n", + "Area of Squre is 25\n", + "Circumstance of Squre is 20\n", + "You are dealing with Triangle\n", + "Area of Triangle is 3764539.8125136094\n", + "Circumstance of Triangle is 180\n", + "\t\tInvalid Choice of Arguments\n", + "You are dealing with Circle Area of Circle is 28.274333882308138 Circumstance of Circle is 18.84955592153876\n" + ] + } + ], + "source": [ + "from math import sqrt,pi\n", + "a = Area(3)\n", + "b = Area(3,4)\n", + "c = Area(5,5)\n", + "d = Area(60,60,60)\n", + "e = Area(12,23,34,4,4,53,2,)\n", + "print(a);print(b)\n", + "print(c);print(d)\n", + "print(e)\n", + "print(repr(a))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Now Seriously Something Usefull

    " + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [], + "source": [ + "class Area:\n", + " def __init__(self,*args):\n", + " self.sides = args\n", + " def area(self):\n", + " if len(self.sides) == 1 : \n", + " return None\n", + " elif len(self.sides) == 2 : \n", + " return None\n", + " elif len(self.sides) == 3 : \n", + " return None\n", + " else : \n", + " return None\n", + " def cir(self):\n", + " if len(self.sides) == 1 : \n", + " return None\n", + " elif len(self.sides) == 2 : \n", + " return None\n", + " elif len(self.sides) == 3 : \n", + " return None\n", + " else : \n", + " return None\n", + " def name(self):\n", + " if len(self.sides) == 1 : \n", + " return 'Circle'\n", + " elif len(self.sides) == 2 :\n", + " if self.sides[0] == self.sides[1] : \n", + " return 'Squre'\n", + " else : \n", + " return 'Rectangle'\n", + " elif len(self.sides) == 3 : \n", + " return 'Triangle'\n", + " else : \n", + " return \"Polynomial\"\n", + " \n", + " def __str__(self):\n", + " area = self.area()\n", + " cir = self.cir()\n", + " name = self.name()\n", + " return \"\"\"\n", + " Object Type : {}\n", + " Area : {}\n", + " Circumstance : {}\n", + " \"\"\".format(name,area,cir)\n", + " \n" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " Object Type : Triangle\n", + " Area : None\n", + " Circumstance : None\n", + " \n", + "\n", + " Object Type : Squre\n", + " Area : None\n", + " Circumstance : None\n", + " \n", + "Triangle\n", + "Squre\n" + ] + } + ], + "source": [ + "obj1 = Area(56,78,94)\n", + "print(obj1)\n", + "obj2 = Area(55,55)\n", + "print(obj2)\n", + "obj1.area()\n", + "print(obj1.name())\n", + "print(obj2.name())" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Ok!! can i call a method without any object ?

    " + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello\n" + ] + } + ], + "source": [ + "class A:\n", + " def show(): #only can call by class directly beacuse no self is there\n", + " print(\"Hello\")\n", + "a = A()\n", + "A.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Name Space in OOPS

    " + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hi I am A\n", + "\n", + "Data inside a Class Dictionary \n", + "{'__module__': '__main__', 'show': , '__dict__': , '__weakref__': , '__doc__': None}\n", + "\n", + "Data inside a Object Dictionary \n", + "{}\n" + ] + } + ], + "source": [ + "class A:\n", + " def show(self):\n", + " print(\"Hi I am A\")\n", + "one = A()\n", + "one.show()\n", + "print(\"\\nData inside a Class Dictionary \")\n", + "print(A.__dict__) # data of class or we can say shared data (shared data)\n", + "print(\"\\nData inside a Object Dictionary \")\n", + "print(one.__dict__) #data of Object or we can say personal data (self of an object)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Let's add something into objects

    " + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Before data in Class\n", + "{'__module__': '__main__', 'show': , '__dict__': , '__weakref__': , '__doc__': None}\n", + "\n", + "Before data in object one\n", + "{}\n", + "\n", + "After adding data dictionary (self) of object one\n", + "{'name': 'sachin'}\n", + "\n", + "Data of object two\n", + "{'name': 'rajat'}\n" + ] + } + ], + "source": [ + "class A(object):\n", + " def show(self,arg):\n", + " self.name = arg\n", + "one = A()\n", + "print(\"Before data in Class\") ; print(A.__dict__)\n", + "print(\"\\nBefore data in object one\") ; print(one.__dict__)\n", + "one.show('sachin')\n", + "print(\"\\nAfter adding data dictionary (self) of object one\")\n", + "print(one.__dict__)\n", + "two = A() ; two.show('rajat')\n", + "print(\"\\nData of object two\")\n", + "print(two.__dict__)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Inheritance Again

    " + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hi from B\n", + "HI from A\n" + ] + } + ], + "source": [ + "class A:\n", + " def show(self):\n", + " print(\"HI from A\")\n", + "class B(A): #child class B is inherting the features of parent class A\n", + " def hi(self):\n", + " print(\"Hi from B\")\n", + "c = B()\n", + "c.hi()\n", + "c.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Let's See Overriding Now

    " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "

    Overriding means giving a new defination to old vintage methods of parent class.

    " + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "This is called over riding\n" + ] + } + ], + "source": [ + "class A():\n", + " def show(self):\n", + " print(\"A is Showing his feature\")\n", + "class B(A):\n", + " def show(self):\n", + " #super().show()\n", + " print(\"This is called over riding\")\n", + "c = B()\n", + "c.show()\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Let's do something different

    " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "

    Let's write python objects to a file

    " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "

    Let's Prepare the data object

    " + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [], + "source": [ + "\n", + "data = {\n", + " 'user' : ['ram','hari','john','natasha'],\n", + " 'acc' : [ 1001, 1002, 1003, 1004 ],\n", + " 'bal' : [ 10000.0,20000.0,15000.0,25000.0],\n", + " 'password' : [ 'hari@mohan','redhat@123','good@bad','mty123124']\n", + "}\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    JSON --> Java Script Object Notation Language

    " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "

    JSON and PICKLE is used to write python objects into files and read python objects from files

    " + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [], + "source": [ + "import json #importing json from standard library of python\n", + "f = open('bank.db','w') #opening a file for writing data\n", + "#json.dump is used to dump data into file pointer\n", + "json.dump(data,f) #writing dictionary object into file using json \n", + "f.close() #closing file " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Let's Read Python Objects from a file Using JSON

    " + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Without Json\n", + "\n", + "'{\"user\": [\"ram\", \"hari\", \"john\", \"natasha\"], \"acc\": [1001, 1002, 1003, 1004], \"bal\": [10000.0, 20000.0, 15000.0, 25000.0], \"password\": [\"hari@mohan\", \"redhat@123\", \"good@bad\", \"mty123124\"]}'\n", + "With Json\n", + "\n", + "{'user': ['ram', 'hari', 'john', 'natasha'], 'acc': [1001, 1002, 1003, 1004], 'bal': [10000.0, 20000.0, 15000.0, 25000.0], 'password': ['hari@mohan', 'redhat@123', 'good@bad', 'mty123124']}\n", + "\n", + "type of data extracted using json = \n", + "\n", + "['ram', 'hari', 'john', 'natasha']\n" + ] + } + ], + "source": [ + "print(\"Without Json\\n\")\n", + "f= open('bank.db') #opening file for reading data\n", + "d = f.read() #reading data traditional way\n", + "f.close() #closing File\n", + "print(repr(d)) #printing Data \n", + "print(\"With Json\\n\")\n", + "f = open('bank.db')\n", + "e = json.load(f) #reading object instead of string using json\n", + "f.close()\n", + "print(repr(e)) #let's print the object\n", + "print(\"\\ntype of data extracted using json = \",type(e)) #you can see we have sucessfully extracted dictionary from a file\n", + "print()\n", + "print(e['user']) #it's working" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Share Memory Concept

    " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "source": [ + "

    class variable are shared variable, can be used by any object simultaneously.Every Object has it's private variable in it's self

    " + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [], + "source": [ + "class Grras:\n", + " \"\"\"Grras -> show, update functions to display and update\n", + " a trainers profile.\"\"\"\n", + " msg = \"There is no update for new exams\" #shared msg class varible\n", + " def __init__(self,name,subject):\n", + " self.name = name #object variable\n", + " self.subject = subject\n", + " def show(self):\n", + " print(\"Name : \",self.name)\n", + " print(\"Subject : \",self.subject)\n", + " def update(self,n,s):\n", + " self.name = n\n", + " self.subject = s\n", + " def print_msg(self):\n", + " print(\"Grras Broadcast : \",Grras.msg)\n", + " def send_msg(self,m):\n", + " Grras.msg = m + '-->'+self.name\n", + " def __repr__(self):\n", + " return self.name\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Message Passing

    " + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Sachin Yadav\n", + "Rajat Goyal\n", + "Name : Sachin Yadav\n", + "Subject : Basic Python\n", + "Name : Rajat Goyal\n", + "Subject : Linux\n", + "Grras Broadcast : There is no update for new exams\n", + "Grras Broadcast : There is no update for new exams\n", + "Grras Broadcast : I will not come tomorrow so manage accordingly.-->Rajat Goyal\n", + "Grras Broadcast : Ok i will manage your class, anything else ? -->Sachin Yadav\n" + ] + } + ], + "source": [ + "sachin = Grras('Sachin Yadav','Basic Python')\n", + "rajat = Grras('Rajat Goyal','Linux')\n", + "print(sachin)\n", + "print(rajat)\n", + "sachin.show()\n", + "rajat.show()\n", + "sachin.print_msg()\n", + "rajat.print_msg()\n", + "rajat.send_msg(\"I will not come tomorrow so manage accordingly.\")\n", + "sachin.print_msg()\n", + "sachin.send_msg('Ok i will manage your class, anything else ? ')\n", + "rajat.print_msg()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Some Examples of Class

    " + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Student\n", + "name = x \n", + "age = 18 \n", + "email = x@y.com \n", + "x\n", + "y\n", + "name = y \n", + "age = 36 \n" + ] + } + ], + "source": [ + "class Student:\n", + " def __init__(self,**kwargs):\n", + " self.__dict__.update(kwargs)\n", + " def show(self):\n", + " for key,value in self.__dict__.items():\n", + " print(\"{} = {} \".format(key,value))\n", + " def update(self,**kwargs):\n", + " self.__dict__.update(kwargs)\n", + " def __repr__(self):\n", + " return self.__dict__.get('name','Student') \n", + "s1 = Student()\n", + "print(s1)\n", + "s2 = Student(name='x',age=18,email='x@y.com')\n", + "s2.show()\n", + "s1.show()\n", + "print(s2)\n", + "s1.update(name='y',age='36')\n", + "print(s1)\n", + "s1.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "maths = 60 \n", + "science = 35 \n", + "english = 60 \n", + "name = john \n", + "standard = 12A \n", + "True\n", + "True\n", + "True\n", + "None\n", + "maths = 60 \n", + "science = 35 \n", + "english = 60 \n", + "name = john \n", + "standard = 12A \n", + "email = grras@gamil.com \n", + "grras@gamil.com\n", + "False\n", + "True\n" + ] + } + ], + "source": [ + "class Result(Student):\n", + " def __init__(self,maths,science,english,**kwargs):\n", + " self.maths = maths\n", + " self.science = science\n", + " self.english = english\n", + " super().__init__(**kwargs)\n", + "x = Result(maths=60,science=35,english=60,name='john',standard='12A')\n", + "x.show()\n", + "print(hasattr(Student,'show'))\n", + "print(hasattr(x,'name'))\n", + "print(hasattr(x,'show'))\n", + "print(setattr(x,'email','grras@gamil.com'))\n", + "x.show()\n", + "print(getattr(x,'email'))\n", + "print(issubclass(Student,Result))\n", + "print(issubclass(Result,Student))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "

    Getter and Setter methods of class

    " + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'show', 'update']\n", + "True\n", + "True\n" + ] + } + ], + "source": [ + "print(dir(Result))\n", + "print(isinstance([1,2,3],list))\n", + "print(isinstance(x,Result))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "celltoolbar": "Slideshow", + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/Object_Oriented_Programming_Language.slides.html b/python_ipynb/Object_Oriented_Programming_Language.slides.html new file mode 100644 index 0000000..4b5b5f6 --- /dev/null +++ b/python_ipynb/Object_Oriented_Programming_Language.slides.html @@ -0,0 +1,13508 @@ + + + + + + + + + + + +Object_Oriented_Programming_Language slides + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    +

    Object Oriented Programming Features

    +
    +
    +
    +
    +
    +
    +
    +
  • Encapsulation
  • +
    +
    +
    +
    +
    +
    +
    +
  • Abstraction
  • +
    +
    +
    +
    +
    +
    +
    +
  • Data Hiding
  • +
    +
    +
    +
    +
    +
    +
    +
  • Dynamic Binding
  • +
    +
    +
    +
    +
    +
    +
    +
  • Inheritance
  • +
    +
    +
    +
    +
    +
    +
    +
  • Polymorphism (Over Riding)
  • +
    +
    +
    +
    +
    +
    +
    +
  • Class
  • +
    +
    +
    +
    +
    +
    +
    +
  • Object
  • +
    +
    +
    +
    +
    +
    +
    +

    Encapsulation

    +

    Encapsulation is process by which we can bind many attributes and methods all together with single known as class.

    +
    +
    +
    +
    +
    +
    +
    +

    Abstraction

    +

    Abstraction is process by which we can only show assential details without include background details.

    +
    +
    +
    +
    +
    +
    +
    +

    Data Hiding

    +

    Hiding some information inside class defination

    +
    +
    +
    +
    +
    +
    +
    +

    Defining a Class

    +
    +
    +
    +
    +
    +
    In [1]:
    +
    +
    +
    class A: #defining Class
    +    pass #attribute that does nothing
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [2]:
    +
    +
    +
    object_one = A() #creating an object of class A
    +print(dir(A)) ; print()#printing out all the attributes and methods class A have
    +print("Every object is just a carbon copy of class \n")
    +print(dir(object_one)) #will show same attributes and methods as class because it's has the blue print of class A
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']
    +
    +Every object is just a carbon copy of class 
    +
    +['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [3]:
    +
    +
    +
    import builtins
    +print(dir(builtins))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning', 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError', 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FileExistsError', 'FileNotFoundError', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError', 'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'ModuleNotFoundError', 'NameError', 'None', 'NotADirectoryError', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning', 'PermissionError', 'ProcessLookupError', 'RecursionError', 'ReferenceError', 'ResourceWarning', 'RuntimeError', 'RuntimeWarning', 'StopAsyncIteration', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'TimeoutError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning', 'WindowsError', 'ZeroDivisionError', '__IPYTHON__', '__build_class__', '__debug__', '__doc__', '__import__', '__loader__', '__name__', '__package__', '__spec__', 'abs', 'all', 'any', 'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'display', 'divmod', 'enumerate', 'eval', 'exec', 'filter', 'float', 'format', 'frozenset', 'get_ipython', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    More Classes

    +
    +
    +
    +
    +
    +
    In [4]:
    +
    +
    +
    class A: 
    +    """This is A class just for fun""" #doc-string for class
    +one = A() #creating an object of class a
    +print(dir(one)) #directory of class A
    +print(one) #printing Object Default value
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']
    +<__main__.A object at 0x0000024254E4BF98>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [5]:
    +
    +
    +
    class A:
    +    """This doc-string of A if you are a exprecienced program. 
    +    than you have to write it."""
    +    def __str__(self): #self is the scope of every object where they stores their data
    +        return "Hi I am object of Class A" #__str__ is responsible for what should object will print
    +    def __add__(self,other): #operator overloading this function decide the behaviour of + operator
    +        return "Bhai Bhai"
    +one = A()
    +print(one.__doc__) #printing doc-string 
    +print(one)
    +two = A()
    +print(two)
    +one + two #calling magic method __add__ using object of class A
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    This doc-string of A if you are a exprecienced program. 
    +    than you have to write it.
    +Hi I am object of Class A
    +Hi I am object of Class A
    +
    +
    +
    + +
    + +
    Out[5]:
    + + + + +
    +
    'Bhai Bhai'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Inheritance

    +
    +
    +
    +
    +
    +
    +
    +

    Inheritance is a powerful feature in object oriented programming. +It refers to defining a new class with little or no modification to an existing class. +The new class is called derived (or child) class +and the one from which it inherits is called the base (or parent) class.

    Inheritance is a powerful feature in object oriented programming. +It refers to defining a new class with little or no modification to an existing class. +The new class is called derived (or child) class +and the one from which it inherits is called the base (or parent) class.

    +
    +
    +
    +
    +
    +
    In [6]:
    +
    +
    +
    class A:
    +    def show(self): #method of Class A
    +        print("Hi I am A classs")
    +    def hi(self): #method of class A
    +        print("HI")
    +class B: 
    +    def hello(self): #method of class B
    +        print("Hello world this is B ")
    +    def hi(self): #method of class B
    +        print("ha ha ha hi")
    +class C(B,A): # will follow mro rule --> method resolution order
    +    pass
    +one = C()
    +one.show()
    +one.hello()
    +one.hi() #will call class B's hi method because of mro
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hi I am A classs
    +Hello world this is B 
    +ha ha ha hi
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Name Space Revision

    +
    +
    +
    +
    +
    +
    In [7]:
    +
    +
    +
    x = 5 #global
    +y = 6 #global
    +def main(p,q):
    +    #print(x) #global
    +    #print(y)
    +    x = p #local
    +    y = q
    +    print(x)
    +    print(y)
    +main(6,6)
    +print(x)
    +print(y)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    6
    +6
    +5
    +6
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    What is method ?

    +
    +
    +
    +
    +
    +
    +
    +

    Any function inside a class is known as method. Same as any operator or variable inside the class is known as attributes

    +
    +
    +
    +
    +
    +
    In [8]:
    +
    +
    +
    class Person:
    +    def show(self,): #just a method
    +        print("I am Person ") #boring printing
    +k = Person()
    +k.show() #calling method
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    I am Person 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    class Person:
    +    def set_name(self,name): #method to set some values to objects self scope
    +        self.name = name
    +    def get_name(self): # method to print name
    +        print("My Name is : {}".format(self.name))
    +p1 = Person()
    +p2 = Person() #instatiation
    +p1.set_name('Person1')
    +p2.set_name('Person2') #setting name
    +p1.get_name() #getting name
    +p2.get_name()
    +print(p1) #just printing objects default implementation
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    My Name is : Person1
    +My Name is : Person2
    +<__main__.Person object at 0x0000024254E82470>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    More and More Classes

    +
    +
    +
    +
    +
    +
    In [10]:
    +
    +
    +
    class Person:
    +    def __init__(self,name,country): #constructor --> creator of each object 
    +        """__new__() is the constructor as it allocates memory for each object called self, where each object put it's data.
    +        __init__() is known as  initializer, it's responsibility to initilize the initial values into self of an object."""
    +        self.name = name # self is a dictionary in which each objects has it's data
    +        self.country = country #self created whenever an object is created and destroyed whenever an object is distroyed
    +    def show(self):
    +        print("Name of the Object : ",self.name)
    +        print("Country of the Object : ",self.country)
    +p1 = Person('Person1','US')
    +p2 = Person('Person2','Africa') 
    +p1.show()
    +p2.show() 
    +print(p1)
    +print(p2)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Name of the Object :  Person1
    +Country of the Object :  US
    +Name of the Object :  Person2
    +Country of the Object :  Africa
    +<__main__.Person object at 0x0000024254E82898>
    +<__main__.Person object at 0x0000024254E82828>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    printing an object as Meaningfull

    +
    +
    +
    +
    +
    +
    In [11]:
    +
    +
    +
    class Person:
    +    def __init__(self,name,color,country): #constructer
    +        self.name = name # initilizing values into objects self
    +        self.color = color
    +        self.country = country
    +    def __str__(self):  #representation of an object
    +        s = """Name of the Object : {}\nColor of the Object : {}\nCountry of the Object : {}""".format(self.name,self.color,self.country)
    +        return s  #this will be printed whenver an object is printed
    +john = Person('john','fair','Australia')
    +natasha = Person('john','normal','India')
    +print(john)
    +print(natasha)#how to change representation of an object so repr() also return something meaning full
    +print(repr(natasha)) #every class has method as __repr__ change it
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Name of the Object : john
    +Color of the Object : fair
    +Country of the Object : Australia
    +Name of the Object : john
    +Color of the Object : normal
    +Country of the Object : India
    +<__main__.Person object at 0x0000024254E82C18>
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Working Example of Class

    +
    +
    +
    +
    +
    +
    In [12]:
    +
    +
    +
    class Area:
    +    def __init__(self,*args):
    +        self.sides = args
    +    def __str__(self):
    +        if len(self.sides) == 1 : 
    +            name = 'Circle'
    +            radias = self.sides[0]
    +            area = pi*radias*radias
    +            cir = 2*pi*radias
    +        elif len(self.sides) == 2 : 
    +            x,y = self.sides
    +            if x == y : 
    +                name = 'Squre'
    +            else : 
    +                name = 'Rectangle'
    +            area = x*y
    +            cir = 2*(x+y)
    +        elif len(self.sides) == 3 : 
    +            x,y,z = self.sides
    +            s = (x+y+z)/2
    +            area = sqrt(s*(s*x)*(s*y)*(s*z))
    +            cir = x + y + z
    +            name = 'Triangle'
    +        else : 
    +            return "\t\tInvalid Choice of Arguments"
    +        result = """You are dealing with {0}\nArea of {0} is {1}\nCircumstance of {0} is {2}""".format(name,area,cir)
    +        return result
    +    def __repr__(self):
    +        if len(self.sides) == 1 : 
    +            name = 'Circle'
    +            radias = self.sides[0]
    +            area = pi*radias*radias
    +            cir = 2*pi*radias
    +        elif len(self.sides) == 2 : 
    +            x,y = self.sides
    +            if x == y : 
    +                name = 'Squre'
    +            else : 
    +                name = 'Rectangle'
    +            area = x*y
    +            cir = 2*(x+y)
    +        elif len(self.sides) == 3 : 
    +            x,y,z = self.sides
    +            s = (x+y+z)/2
    +            area = sqrt(s*(s*x)*(s*y)*(s*z))
    +            cir = x + y + z
    +            name = 'Triange'
    +        else : 
    +            return "Invalid Choice of Arguments"
    +        result = """You are dealing with {0} Area of {0} is {1} Circumstance of {0} is {2}""".format(name,area,cir)
    +        return result
    +    
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    from math import sqrt,pi
    +a = Area(3)
    +b = Area(3,4)
    +c = Area(5,5)
    +d = Area(60,60,60)
    +e = Area(12,23,34,4,4,53,2,)
    +print(a);print(b)
    +print(c);print(d)
    +print(e)
    +print(repr(a))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    You are dealing with Circle
    +Area of Circle is 28.274333882308138
    +Circumstance of Circle is 18.84955592153876
    +You are dealing with Rectangle
    +Area of Rectangle is 12
    +Circumstance of Rectangle is 14
    +You are dealing with Squre
    +Area of Squre is 25
    +Circumstance of Squre is 20
    +You are dealing with Triangle
    +Area of Triangle is 3764539.8125136094
    +Circumstance of Triangle is 180
    +		Invalid Choice of Arguments
    +You are dealing with Circle Area of Circle is 28.274333882308138 Circumstance of Circle is 18.84955592153876
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Now Seriously Something Usefull

    +
    +
    +
    +
    +
    +
    In [14]:
    +
    +
    +
    class Area:
    +    def __init__(self,*args):
    +        self.sides = args
    +    def area(self):
    +        if len(self.sides) == 1 : 
    +            return None
    +        elif len(self.sides) == 2 : 
    +            return None
    +        elif len(self.sides) == 3 : 
    +            return None
    +        else : 
    +            return None
    +    def cir(self):
    +        if len(self.sides) == 1 : 
    +            return None
    +        elif len(self.sides) == 2 : 
    +            return None
    +        elif len(self.sides) == 3 : 
    +            return None
    +        else : 
    +            return None
    +    def name(self):
    +        if len(self.sides) == 1 : 
    +            return 'Circle'
    +        elif len(self.sides) == 2 :
    +            if self.sides[0] == self.sides[1] : 
    +                return 'Squre'
    +            else : 
    +                return 'Rectangle'
    +        elif len(self.sides) == 3 : 
    +            return 'Triangle'
    +        else : 
    +            return "Polynomial"
    +        
    +    def __str__(self):
    +        area = self.area()
    +        cir = self.cir()
    +        name = self.name()
    +        return """
    +        Object Type : {}
    +        Area : {}
    +        Circumstance : {}
    +        """.format(name,area,cir)
    +        
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [15]:
    +
    +
    +
    obj1 = Area(56,78,94)
    +print(obj1)
    +obj2 = Area(55,55)
    +print(obj2)
    +obj1.area()
    +print(obj1.name())
    +print(obj2.name())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +        Object Type : Triangle
    +        Area : None
    +        Circumstance : None
    +        
    +
    +        Object Type : Squre
    +        Area : None
    +        Circumstance : None
    +        
    +Triangle
    +Squre
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Ok!! can i call a method without any object ?

    +
    +
    +
    +
    +
    +
    In [16]:
    +
    +
    +
    class A:
    +    def show(): #only can call by class directly beacuse no self is there
    +        print("Hello")
    +a = A()
    +A.show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hello
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Name Space in OOPS

    +
    +
    +
    +
    +
    +
    In [17]:
    +
    +
    +
    class A:
    +    def show(self):
    +        print("Hi  I am A")
    +one = A()
    +one.show()
    +print("\nData inside a Class Dictionary ")
    +print(A.__dict__) # data of class or we can say shared data (shared data)
    +print("\nData inside a Object Dictionary ")
    +print(one.__dict__) #data of Object or we can say personal data (self of an object)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hi  I am A
    +
    +Data inside a Class Dictionary 
    +{'__module__': '__main__', 'show': <function A.show at 0x0000024254E4E7B8>, '__dict__': <attribute '__dict__' of 'A' objects>, '__weakref__': <attribute '__weakref__' of 'A' objects>, '__doc__': None}
    +
    +Data inside a Object Dictionary 
    +{}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Let's add something into objects

    +
    +
    +
    +
    +
    +
    In [18]:
    +
    +
    +
    class A(object):
    +    def show(self,arg):
    +        self.name = arg
    +one = A()
    +print("Before data in Class") ; print(A.__dict__)
    +print("\nBefore data in object one") ; print(one.__dict__)
    +one.show('sachin')
    +print("\nAfter adding data dictionary (self) of object one")
    +print(one.__dict__)
    +two = A() ; two.show('rajat')
    +print("\nData of object two")
    +print(two.__dict__)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Before data in Class
    +{'__module__': '__main__', 'show': <function A.show at 0x0000024254E7D7B8>, '__dict__': <attribute '__dict__' of 'A' objects>, '__weakref__': <attribute '__weakref__' of 'A' objects>, '__doc__': None}
    +
    +Before data in object one
    +{}
    +
    +After adding data dictionary (self) of object one
    +{'name': 'sachin'}
    +
    +Data of object two
    +{'name': 'rajat'}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Inheritance Again

    +
    +
    +
    +
    +
    +
    In [19]:
    +
    +
    +
    class A:
    +    def show(self):
    +        print("HI from A")
    +class B(A): #child class B is inherting the features of parent class A
    +    def hi(self):
    +        print("Hi from B")
    +c = B()
    +c.hi()
    +c.show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Hi from B
    +HI from A
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Let's See Overriding Now

    +
    +
    +
    +
    +
    +
    +
    +

    Overriding means giving a new defination to old vintage methods of parent class.

    +
    +
    +
    +
    +
    +
    In [20]:
    +
    +
    +
    class A():
    +    def show(self):
    +        print("A is Showing his feature")
    +class B(A):
    +    def show(self):
    +        #super().show()
    +        print("This is called over riding")
    +c = B()
    +c.show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    This is called over riding
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Let's do something different

    +
    +
    +
    +
    +
    +
    +
    +

    Let's write python objects to a file

    +
    +
    +
    +
    +
    +
    +
    +

    Let's Prepare the data object

    +
    +
    +
    +
    +
    +
    In [21]:
    +
    +
    +
    data =  {
    +    'user' : ['ram','hari','john','natasha'],
    +    'acc' : [ 1001, 1002, 1003, 1004 ],
    +    'bal' : [ 10000.0,20000.0,15000.0,25000.0],
    +    'password' : [ 'hari@mohan','redhat@123','good@bad','mty123124']
    +}
    +
    + +
    +
    +
    + +
    +
    +
    +
    +
    +

    JSON --> Java Script Object Notation Language

    +
    +
    +
    +
    +
    +
    +
    +

    JSON and PICKLE is used to write python objects into files and read python objects from files

    +
    +
    +
    +
    +
    +
    In [22]:
    +
    +
    +
    import json #importing json from standard library of python
    +f = open('bank.db','w') #opening a file for writing data
    +#json.dump is used to dump data into file pointer
    +json.dump(data,f) #writing dictionary object into file using json 
    +f.close() #closing file 
    +
    + +
    +
    +
    + +
    +
    +
    +
    +
    +

    Let's Read Python Objects from a file Using JSON

    +
    +
    +
    +
    +
    +
    In [23]:
    +
    +
    +
    print("Without Json\n")
    +f= open('bank.db') #opening file for reading data
    +d = f.read() #reading data traditional way
    +f.close() #closing File
    +print(repr(d)) #printing Data  
    +print("With Json\n")
    +f = open('bank.db')
    +e = json.load(f) #reading object instead of string using json
    +f.close()
    +print(repr(e)) #let's print the object
    +print("\ntype of data extracted using json = ",type(e)) #you can see we have sucessfully extracted dictionary from a file
    +print()
    +print(e['user']) #it's working
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Without Json
    +
    +'{"user": ["ram", "hari", "john", "natasha"], "acc": [1001, 1002, 1003, 1004], "bal": [10000.0, 20000.0, 15000.0, 25000.0], "password": ["hari@mohan", "redhat@123", "good@bad", "mty123124"]}'
    +With Json
    +
    +{'user': ['ram', 'hari', 'john', 'natasha'], 'acc': [1001, 1002, 1003, 1004], 'bal': [10000.0, 20000.0, 15000.0, 25000.0], 'password': ['hari@mohan', 'redhat@123', 'good@bad', 'mty123124']}
    +
    +type of data extracted using json =  <class 'dict'>
    +
    +['ram', 'hari', 'john', 'natasha']
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Share Memory Concept

    +
    +
    +
    +
    +
    +
    +
    +

    class variable are shared variable, can be used by any object simultaneously.Every Object has it's private variable in it's self

    +
    +
    +
    +
    +
    +
    In [24]:
    +
    +
    +
    class Grras:
    +    """Grras -> show, update  functions to display and update
    +    a trainers profile."""
    +    msg = "There is no update for new exams" #shared msg class varible
    +    def __init__(self,name,subject):
    +        self.name = name #object variable
    +        self.subject = subject
    +    def show(self):
    +        print("Name : ",self.name)
    +        print("Subject : ",self.subject)
    +    def update(self,n,s):
    +        self.name = n
    +        self.subject = s
    +    def print_msg(self):
    +        print("Grras Broadcast : ",Grras.msg)
    +    def send_msg(self,m):
    +        Grras.msg = m + '-->'+self.name
    +    def __repr__(self):
    +        return self.name
    +
    + +
    +
    +
    + +
    +
    +
    +
    +
    +

    Message Passing

    +
    +
    +
    +
    +
    +
    In [25]:
    +
    +
    +
    sachin = Grras('Sachin Yadav','Basic Python')
    +rajat = Grras('Rajat Goyal','Linux')
    +print(sachin)
    +print(rajat)
    +sachin.show()
    +rajat.show()
    +sachin.print_msg()
    +rajat.print_msg()
    +rajat.send_msg("I will not come tomorrow so manage accordingly.")
    +sachin.print_msg()
    +sachin.send_msg('Ok i will manage your class, anything else ? ')
    +rajat.print_msg()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Sachin Yadav
    +Rajat Goyal
    +Name :  Sachin Yadav
    +Subject :  Basic Python
    +Name :  Rajat Goyal
    +Subject :  Linux
    +Grras Broadcast :  There is no update for new exams
    +Grras Broadcast :  There is no update for new exams
    +Grras Broadcast :  I will not come tomorrow so manage accordingly.-->Rajat Goyal
    +Grras Broadcast :  Ok i will manage your class, anything else ? -->Sachin Yadav
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Some Examples of Class

    +
    +
    +
    +
    +
    +
    In [26]:
    +
    +
    +
    class Student:
    +    def __init__(self,**kwargs):
    +        self.__dict__.update(kwargs)
    +    def show(self):
    +        for key,value in self.__dict__.items():
    +            print("{} = {} ".format(key,value))
    +    def update(self,**kwargs):
    +        self.__dict__.update(kwargs)
    +    def __repr__(self):
    +        return self.__dict__.get('name','Student')        
    +s1 = Student()
    +print(s1)
    +s2 = Student(name='x',age=18,email='x@y.com')
    +s2.show()
    +s1.show()
    +print(s2)
    +s1.update(name='y',age='36')
    +print(s1)
    +s1.show()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Student
    +name = x 
    +age = 18 
    +email = x@y.com 
    +x
    +y
    +name = y 
    +age = 36 
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [27]:
    +
    +
    +
    class Result(Student):
    +    def __init__(self,maths,science,english,**kwargs):
    +        self.maths = maths
    +        self.science = science
    +        self.english = english
    +        super().__init__(**kwargs)
    +x = Result(maths=60,science=35,english=60,name='john',standard='12A')
    +x.show()
    +print(hasattr(Student,'show'))
    +print(hasattr(x,'name'))
    +print(hasattr(x,'show'))
    +print(setattr(x,'email','grras@gamil.com'))
    +x.show()
    +print(getattr(x,'email'))
    +print(issubclass(Student,Result))
    +print(issubclass(Result,Student))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    maths = 60 
    +science = 35 
    +english = 60 
    +name = john 
    +standard = 12A 
    +True
    +True
    +True
    +None
    +maths = 60 
    +science = 35 
    +english = 60 
    +name = john 
    +standard = 12A 
    +email = grras@gamil.com 
    +grras@gamil.com
    +False
    +True
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    Getter and Setter methods of class

    +
    +
    +
    +
    +
    +
    In [28]:
    +
    +
    +
    import builtins
    +print(dir(builtins))
    +print(isinstance([1,2,3],list))
    +print(isinstance(x,Result))
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning', 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError', 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FileExistsError', 'FileNotFoundError', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError', 'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'ModuleNotFoundError', 'NameError', 'None', 'NotADirectoryError', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning', 'PermissionError', 'ProcessLookupError', 'RecursionError', 'ReferenceError', 'ResourceWarning', 'RuntimeError', 'RuntimeWarning', 'StopAsyncIteration', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'TimeoutError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning', 'WindowsError', 'ZeroDivisionError', '__IPYTHON__', '__build_class__', '__debug__', '__doc__', '__import__', '__loader__', '__name__', '__package__', '__spec__', 'abs', 'all', 'any', 'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'display', 'divmod', 'enumerate', 'eval', 'exec', 'filter', 'float', 'format', 'frozenset', 'get_ipython', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip']
    +True
    +True
    +
    +
    +
    + +
    +
    + +
    +
    +
    + + + + + + + diff --git a/python_ipynb/Quiz.html b/python_ipynb/Quiz.html new file mode 100644 index 0000000..245cafe --- /dev/null +++ b/python_ipynb/Quiz.html @@ -0,0 +1,14979 @@ + + + + +Quiz + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    In [19]:
    +
    +
    +
    questions = [
    +    {},
    +    {},
    +    {},
    +    {},
    +]
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [20]:
    +
    +
    +
    import json
    +def read_data():
    +    f = open('ques.txt')
    +    data = f.read()
    +    print(data)
    +    f.close()
    +    data = data.split('\n\n')
    +    if data[-1] : 
    +        pass
    +    else :
    +        data = data[:-1]
    +    new_data = []
    +    for var in data:
    +        q = var.split('\n')
    +        q[1] = q[1].split('\t')
    +        new_data.append(q)
    +    return new_data
    +f = open('quiz_dataset.db')
    +Ques = json.load(f)
    +f.close()
    +data = read_data()
    +def update(data):
    +    global Ques
    +    n = [ ]
    +    for q in data : 
    +        key = q[0].strip()
    +        value = [ q[1], q[2] ]
    +        d = (key,value)
    +        n.append(d)
    +    Ques['python']['Basic'].update(n)
    +    print("Sucessfully updated")
    +f = open('quiz_backup.db','w')
    +json.dump(Ques,f)
    +f.close()
    +update(data)
    +f = open('quiz_dataset.db','w')
    +json.dump(Ques,f)
    +f.close()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Python is a general-purpose programming language supporting multiple programming paradigms. Select the programming paradigm which does not appy to Python.
    +Object-oriented	Procedural	Functional	Symbolic
    +Symbolic
    +After what progrmaming language was Python implemented?
    +Oracle	C++	ABC	Java
    +ABC
    +Name the primary features of Python
    +Exception handling	Form submittals	Storing and archiving	Integrating
    +Exception handling
    +Which year was the updated versions of Python 2.0 and 3.0 released?
    +1990 and 1994	2000 and 2008	1989 and 1990	2001 and 2002
    +2000 and 2008
    +Print built-in function was introduced in version
    +2	1	2.6	3
    +3
    +Which of the following is invalid?
    +_a = 1	__a = 1	__str__ = 1	none of the mentioned
    +none of the mentioned
    +Which of the following is an invalid variable?
    +my_string_1	1st_string	foo	_	1st_string		Why are local variable names beginning with an underscore discouraged?	they are used to indicate a private variables of a class	they confuse the interpreter	they are used to indicate global variables	they slow down execution
    +they are used to indicate a private variables of a class
    +Which of the following is not a keyword?
    +eval	assert	nonlocal	pass
    +eval
    +Which of the following is an invalid statement?
    +abc = 1,000,000	a b c = 1000 2000 3000	a,b,c = 1000, 2000, 3000	a_b_c = 1,000,000
    +a b c = 1000 2000 3000
    +Name few building blocks of Python
    +Functions	arrays	tables	Flowcharts
    +arrays
    +Out of the options, on which OS Python can be used
    +Bada OS	Mac	AS/400	Android
    +AS/400
    +What is the binary file extension generated by python?
    +php	pyc	bin	ini
    +pyc
    +Which layer acts as a layer of logic between the hardware and the code?
    +library modules	binary files	machine language	Python interpreter
    +Python interpreter
    +What is the structure generated after the Python source code is compiled?
    +.ini	.pyc	exe file	.bin
    +.pyc
    +What does CPython and Jython represent?
    +They represent the successive versions of Python.	They represent internal functions of Python.	Implementations of Python	They are the compilers of Python program.
    +Implementations of Python
    +What kind of executables generate a standalone binary executable?
    +Frozen binaries	Pyhton.NET	CPyhton	byte codes
    +Frozen binaries
    +Which of the versions introduced the data hiding feature?
    +Pyhton 1.5	Pyhton 1.0	Pyhton 2.0	Python 1.6
    +Pyhton 1.0
    +What is similar between Javascript and Python?
    +Overloading of the + operator	Object base supports functions and variables without class definition	Both have a UNIX scripting background.	The features are identical.
    +Object base supports functions and variables without class definition
    +What is the default location of Python installation?
    +C:\	D:\	G:\	E:\
    +C:\
    +How do you go to the command line Pyhton interpreter?
    +From Start, select Pyhton 3.6 and click to open.	Select the Python command line directly from the exe file.	Type cmd Python from the command line in Windows.	In Windows, select Python from the installed programs.
    +From Start, select Pyhton 3.6 and click to open.
    +How to create a Pyhton program?
    +Write the program in a text file and upload to the Python folder.	Write the program in the Python editor and execute it.	Use the Print command in the Python interpreter	Write the program using the notepad
    +Use the Print command in the Python interpreter
    +Name few components of IDLE
    +Wordpad	code editor, built-in automation	Project tracker	bug tracker
    +code editor, built-in automation
    +What toolkit is used to code in IDLE?
    +PHP text editor	Soap toolkit	Swing toolkit	Tkinter GUI toolkit
    +Tkinter GUI toolkit
    +Name few of the features of IDLE
    +user interface window	command line entries	debugging and configuration	built-in print option
    +debugging and configuration
    +Name few development environment for Python
    +Soap	Zeus	Eric and Emacs	Eclipse
    +Eric and Emacs
    +What IDEs are used to develop enterprise and professional applications using Python?
    +Netbeans	Wordpad	Sublime and Komodo	Brackets code editor
    +Sublime and Komodo
    +what platforms does Wing IDE support?
    +Android	MAC	Linux	Unix
    +Linux
    +Where is the output from running a saved Python file is displayed?
    +Command prompt	Browser	Shell window	Desktop
    +Shell window
    +What is the first step to start the interactive Python interpreter?
    +Double-click on the Python icon	Select from the Windows explorer	Go to Windows>Start>Programs and select the interpreter.	Type a message with no arguments in the Python interpreter
    +Type a message with no arguments in the Python interpreter
    +What are the two types of windows available in Python IDLE?
    +PHP	Microsoft	Shell and Editor	Desktop
    +Shell and Editor
    +Name the two primary things to be taken care of during Python programming
    +Language	color	Style and indentation	Format
    +Style and indentation
    +What symbol is used to display comments in Python code?
    +#	$	%	<>
    +#
    +What are the compound data types?
    +Graph	Tuples and Strings	Float	Integer
    +Tuples and Strings
    +Which data type stores numbers with fractional values?
    +Generic	Float	Integer	String
    +Float
    +From the options, choose the binary literal.
    +0B01011	0o10	0xA
    +0B01011
    +What does the letter E/e used in float data type represent?
    +Represents the decimal position	Represents negative sign	Represents the power of 10	Represents positive sign
    +Represents the power of 10
    +Which indicates the float data type in the float value syntax?
    +number with decimal values	A built-in function float ()	number with 0B suffixed	numbers with zeros
    +A built-in function float ()
    +What are complex data types?
    +numbers with various levels of operators	algebraic equations	compound numbers	<real part> + <imaginary part>j
    +<real part> + <imaginary part>j
    +The data type of True or False values
    +String	Boolean	Complex	Text
    +Boolean
    +Based on the functionality, which data type can be represented as string and numerals?
    +Float	Sign	Boolean	Char
    +Boolean
    +How to convert a value to boolean?
    +Using the bool() function	by prefixing with the word boolean	by prefixing with the boolean sign	suffixing boolean within brackets
    +Using the bool() function
    +Which data type is also called a sequence?
    +compound	float	boolean	complex
    +compound
    +Which data type does string belong to?
    +Alphabets	Compound	boolean	Char
    +Compound
    +How is a string represented?
    +Alphabetical letters	characters enclosed within quotation marks on both sides	a complete sentence	phrases
    +characters enclosed within quotation marks on both sides
    +What symbol is used to denote multi-line strings?
    +single quotes	triple quotes	double quotes	Brackets
    +triple quotes
    +Which operator is used to extract characters from a string?
    +{start:end}	()	" "	[start:end]
    +[start:end]
    +What is the output of the string - print(Example_string[2])
    +Prints the number 2	Prints the entire string within brackets	Prints the value of the index 2	Prints only the characters ignoring the number
    +Prints the value of the index 2
    +Collection of random objects with no size and type. What type of data type does this denote?
    +text	strings	characters	List data type
    +List data type
    +Out of the options, name the features that list data type support
    +formatting	indexing and concatenation	punctuation	line breaks
    +indexing and concatenation
    +Once created, this data type cannot be changed. Which data type does this denote?
    +Lists	Strings	Tuple	Boolean
    +Tuple
    +How to define Tuple data types?
    +Enlcosed within brackets	Enclosed in square brackets	Enclosed within quotes	Set of characters
    +Enlcosed within brackets
    +What is the specific and interesting feature of tuple data type?
    +Mathematical calculation is possible	Values on the left of the operator can be assigned to the values on the right of the operator.	works with equations	Values cannot be reassigned
    +Values on the left of the operator can be assigned to the values on the right of the operator.
    +Why are Dictionaries in Python called mutable?
    +Elements in the Dictionary can be added, modified and deleted.	Elements in the Dictionary can be merged with another Dictionary.	The Dictionary can be sollated with another.	The elements can be deactivated.
    +Elements in the Dictionary can be added, modified and deleted.
    +How are Dictionaries accessed?
    +Dictionaries are accessed based on their position	Dictionaries are accessed based on the index	Dictionaries are accessed using keys	Dictionaries are accessed alphabetically
    +Dictionaries are accessed using keys
    +The values of the Dictionary keys can be accessed using the symbol:
    +{}	([])	()	[]
    +([])
    +The values within the keys are separated by:
    +commas	curly braces	apostrophe	period
    +commas
    +How is an empty dictionary represented?
    +Empty Dict = 0	My Dict = { }	Dict = null	My Dict = NULL
    +My Dict = { }
    +What is the difference between sets and dictionaries?
    +sets are larger than dictionaries	sets are not restricted to keys	sets are groups of data	sets comprise of numbers and strings
    +sets are not restricted to keys
    +How is a set created?
    +using ({})	create set ()	define set()	()
    +using ({})
    +What are frozensets?
    +frozensets are pre-defined sets	frozensets are similar to set, but immutable	elements are unchangeable	frozensets are changeable sets	frozensets are similar to set, but immutable
    +
    +Why frozensets can be used as keys?
    +frozensets comprise of key elements	frozensets are unhashable	frozensets are hashable	frozensets represent major elements
    +frozensets are hashable
    +Out of given options, which represents the rule for identifiers?
    +keywords can be used as names of identifiers	identifiers can be of specified length	an identifier should not start with a number	an identifier can use special characters
    +an identifier should not start with a number
    +Which of the following environment variable for Python tells the Python interpreter where to locate the module files imported into a program?
    +PYTHONPATH	PYTHONSTARTUP	PYTHONCASEOK	PYTHONHOME
    +PYTHONPATH
    +What is the output of print list if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?
    +[ 'abcd', 786 , 2.23, 'john', 70.2 ]	list	Error	None of the above.	[ 'abcd', 786 , 2.23, 'john', 70.2 ]		What is the output of print tinylist * 2 if tinylist = [123, 'john']?	[123, 'john', 123, 'john']	[123, 'john'] * 2	Error	None of the above.
    +[123, 'john', 123, 'john']
    +Which of the following function convert a String to an object in python?
    +repr(x)	eval(str)	tuple(s)	list(s)
    +eval(str)
    +Which of the following operator in python evaluates to true if the variables on either side of the operator point to the same object and false otherwise?
    +**	//	is	not in
    +is
    +Which of the following function randomizes the items of a list in place?
    +shuffle(lst)	capitalize()	isalnum()	isdigit()
    +shuffle(lst)
    +Which of the following function checks in a string that all characters are in lowercase?
    +islower()	isnumeric()	isspace()	istitle()
    +islower()
    +Which of the following function checks in a string that all characters are decimal?
    +upper()	isdecimal()	swapcase()	title()
    +isdecimal()
    +What is the output of L[2] if L = [1,2,3]?
    +Error	2	3	None of the above.
    +3
    +What is the following function sorts a list?
    +list.reverse()	list.sort([func])	list.pop(obj=list[-1])	list.remove(obj)
    +list.sort([func])
    +Which of these about a set is not true?
    +Mutable data type	Allows duplicate values	Data type with unordered values	Immutable data type
    +Immutable data type
    +Which of the following is not the correct syntax for creating a set?
    +set([[1,2],[3,4]])	set([1,2,2,3,4])	set((1,2,3,4))	{1,2,3,4}	set([[1,2],[3,4]])		Which of the following statements is used to create an empty set?	{ }	set()	[ ]	( )
    +set()
    +If a={5,6,7,8}, which of the following statements is false?
    +print(len(a))	print(min(a))	a.remove(5)	a[2]=45
    +a[2]=45
    +If a={5,6,7}, what happens when a.add(5) is executed?
    +a={5,5,6,7}	a={5,6,7}	Error as there is no add function for set data type	Error as 5 already exists in the set
    +a={5,6,7}
    +Which of these about a frozenset is not true?
    +Mutable data type	Allows duplicate values	Data type with unordered values	Immutable data type
    +Mutable data type
    +Which of the following lines of code will result in an error?
    +s={abs}	s={4, ‘abc’, (1,2)}	s={2, 2.2, 3, ‘xyz’}	s={san}
    +s={san}
    +Which of the following functions cannot be used on heterogeneous sets?
    +pop	remove	update	sum
    +sum
    +Which of the following functions will return the symmetric difference between two sets, x and y?
    +x | y	x ^ y	x & y	x – y
    +x & y
    +The ____________ function removes the first element of a set and the last element of a list.
    +remove	pop	discard	dispose
    +pop
    +If we have two sets, s1 and s2, and we want to check if all the elements of s1 are present in s2 or not, we can use the function:
    +s2.issubset(s1)	s2.issuperset(s1)	s1.issuperset(s2)	s1.isset(s2)
    +s2.issuperset(s1)
    +Which of the following statements create a dictionary?
    +d = {}	d = {“john”:40, “peter”:45}	d = {40:”john”, 45:”peter”}	All of the mentioned	All of the mentioned		Suppose d = {“john”:40, “peter”:45}, to delete the entry for “john” what command do we use	d.delete(“john”:40)	d.delete(“john”)	del d[“john”].	del d(“john”:40)
    +del d[“john”].
    +Suppose d = {“john”:40, “peter”:45}. To obtain the number of entries in dictionary which command do we use?
    +d.size()	len(d)	size(d)	d.len()
    +len(d)
    +Which of these about a dictionary is false?
    +The values of a dictionary can be accessed using keys	The keys of a dictionary can be accessed using values	Dictionaries aren’t ordered	Dictionaries are mutable
    +The keys of a dictionary can be accessed using values
    +Which of the following is not a declaration of the dictionary?
    +{1: ‘A’, 2: ‘B’}	dict([[1,”A”],[2,”B”]])	{1,”A”,2”B”}	{ }
    +{1: ‘A’, 2: ‘B’}
    +Which of the following isn’t true about dictionary keys?
    +More than one key isn’t allowed	Keys must be immutable	Keys must be integers	When duplicate keys encountered, the last assignment wins
    +Keys must be integers
    +Which of the statements about dictionary values if false?
    +More than one key can have the same value	The values of the dictionary can be accessed as dict[key].	Values of a dictionary must be unique	Values of a dictionary can be a mixture of letters and numbers
    +Values of a dictionary must be unique
    +If a is a dictionary with some key-value pairs, what does a.popitem() do?
    +Removes an arbitrary element	Removes all the key-value pairs	Removes the key-value pair for the key given as an argument	Invalid method for dictionary
    +Removes an arbitrary element
    +If b is a dictionary, what does any(b) do?
    +Returns True if any key of the dictionary is true	Returns False if dictionary is empty	Returns True if all keys of the dictionary are true	Method any() doesn’t exist for dictionary
    +Returns True if any key of the dictionary is true
    +Which of the following functions is a built-in function in python?
    +seed()	sqrt()	factorial()	print()
    +print()
    +The function pow(x,y,z) is evaluated as:
    +(x**y)**z	(x**y) / z	(x**y) % z	(x**y)*z	(x**y) % z		What is the output of the function complex() ?	0j	0+0j	0	Error
    +0j
    +The function divmod(a,b), where both ‘a’ and ‘b’ are integers is evaluated as:
    +(a%b, a//b)	(a//b, a%b)	(a//b, a*b)	(a/b, a%b)
    +(a//b, a%b)
    +Which of the following functions does not necessarily accept only iterables as arguments?
    +enumerate()	all()	chr()	max()
    +chr()
    +
    +Which of the following functions accepts only integers as arguments?	ord()	min()	chr()	any()
    +chr()
    +Which of the following functions will not result in an error when no arguments are passed to it?
    +min()	divmod()	all()	float()
    +float()
    +Which of the following functions does not throw an error?
    +ord()	ord(‘ ‘)	ord(”)	ord(“”)
    +ord(‘ ‘)
    +Which of the following is the use of function in python?
    +Functions are reusable pieces of programs	Functions don’t provide better modularity for your application	you can’t also create your own functions	All of the mentioned
    +Functions are reusable pieces of programs
    +Which keyword is use for function?
    +Fun	Define	Def	Function
    +Def
    +Which are the advantages of functions in python?
    +Reducing duplication of code	Decomposing complex problems into simpler pieces	Improving clarity of the code	All of the mentioned
    +All of the mentioned
    +What are the two main types of functions?
    +Custom function	Built-in function & User defined function	User function	System function
    +Built-in function & User defined function
    +Where is function defined?
    +Module	Class	Another function	All of the mentioned
    +All of the mentioned
    +What is called when a function is defined inside a class?
    +Module	Class	Another function	Method
    +Method
    +Which of the following is the use of id() function in python?
    +Id returns the identity of the object	Every object doesn’t have a unique id	All of the mentioned	None of the mentioned
    +Id returns the identity of the object
    +Which of the following refers to mathematical function?
    +sqrt	rhombus	add	Rhombus
    +sqrt
    +Python supports the creation of anonymous functions at runtime, using a construct called __________
    +Lambda	pi	anonymous	None of the mentioned
    +Lambda
    +What is a variable defined outside a function referred to as?
    +A static variable	A global variable	A local variable	An automatic variable
    +A global variable
    +What is a variable defined inside a function referred to as?
    +A global variable	A volatile variable	A local variable	An automatic variable
    +A local variable
    +If a function doesn’t have a return statement, which of the following does the function return?
    +int	null	None	An exception is thrown without the return statement
    +None
    +Is Python case sensitive when dealing with identifiers?
    +yes	no	machine dependent	none of the mentioned
    +yes
    +What is the maximum possible length of an identifier?
    +31 characters	63 characters	79 characters	none of the mentioned
    +none of the mentioned
    +Which of the following is invalid?
    +_a = 1	__a = 1	__str__ = 1	none of the mentioned
    +none of the mentioned
    +Which of the following is an invalid variable?
    +my_string_1	1st_string	foo	_
    +1st_string
    +Why are local variable names beginning with an underscore discouraged?
    +they are used to indicate a private variables of a class	they confuse the interpreter	they are used to indicate global variables	they slow down execution
    +they are used to indicate a private variables of a class
    +Which of the following is not a keyword?
    +eval	assert	nonlocal	pass
    +eval
    +Which of the following is an invalid statement?
    +abc = 1,000,000	a b c = 1000 2000 3000	a,b,c = 1000, 2000, 3000	a_b_c = 1,000,000
    +a b c = 1000 2000 3000
    +Which of these in not a core data type?
    +Lists	Dictionary	Tuples	Class
    +Class
    +Which of the following will run without errors ?
    +round(45.8)	round(6352.898,2,5)	round()	round(7463.123,2,1)
    +round(45.8)
    +What error occurs when you execute?  apple = mango
    +SyntaxError	NameError	ValueError	TypeError
    +NameError
    +What data type is the object below ?  L = [1, 23, ‘hello’, 1].
    +list	dictionary	array	tuple
    +list
    +Which of the following results in a SyntaxError ?
    +‘”Once upon a time…”, she said.’	“He said, ‘Yes!'”	‘3\’	”’That’s okay”
    +‘3\’
    +Select all options that print
    +hello-how-are-you	print(‘hello’, ‘how’, ‘are’, ‘you’)	print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4)	print(‘hello-‘ + ‘how-are-you’)	print(‘hello’ + ‘-‘ + ‘how’ + ‘-‘ + ‘are’ + ‘you’)
    +print(‘hello-‘ + ‘how-are-you’)
    +What is the return value of trunc() ?
    +int	bool	float	None
    +int
    +Which of the following operators has its associativity from right to left?
    ++	//	%	**
    +**
    +Which of the following is the truncation division operator?
    +/	%	//	|
    +//
    +Which of the following formatting options can be used in order to add ‘n’ blank spaces after a given string ‘S’?
    +print(“-ns”%S)	print(“-ns”%S)	print(“%ns”%S)	print(“%-ns”%S)
    +print(“%-ns”%S)
    +What arithmetic operators cannot be used with strings ?
    ++	*	–	All of the mentioned
    +–
    +what is the output when following statement is executed ?  >>> print(‘x\97\x98’)
    +Error	97 98	x\97	\x97\x98
    +x\97
    +>>> print(0xA + 0xB + 0xC) :
    +0xA0xB0xC	Error	0x22	33
    +33
    +Which of the following commands will create a list?
    +list1 = list()	list1 = [].	list1 = list([1, 2, 3])	all of the mentioned
    +all of the mentioned
    +What is the output when we execute list(“hello”)?
    +[‘h’, ‘e’, ‘l’, ‘l’, ‘o’].	[‘hello’].	[‘llo’].	[‘olleh’].	[‘h’, ‘e’, ‘l’, ‘l’, ‘o’].		Suppose list1 is [2445,133,12454,123], what is max(list1) ?	2445	133	12454	123
    +12454
    +To shuffle the list(say list1) what function do we use ?
    +list1.shuffle()	shuffle(list1)	random.shuffle(list1)	random.shuffleList(list1)	random.shuffle(list1)		Which of the following statements is wrong about inheritance?	Protected members of a class can be inherited	The inheriting class is called a subclass	Private members of a class can be inherited and accessed	Inheritance is one of the features of OOP	Private members of a class can be inherited and accessed		Suppose B is a subclass of A, to invoke the __init__ method in A from B, what is the line of code you should write?	A.__init__(self)	B.__init__(self)	A.__init__(B)	B.__init__(A)
    +A.__init__(self)
    +What does built-in function type do in context of classes?
    +Determines the object name of any value	Determines the class name of any value	Determines class description of any value	Determines the file name of any value	Determines the class name of any value		Which of the following is not a type of inheritance?	Double-level	Multi-level	Single-level	Multiple	Double-level		_____ represents an entity in the real world with its identity and behaviour.	A method	An object	A class	An operator
    +An object
    +_____ is used to create an object.
    +class	constructor	User-defined functions	In-built functions	constructor		What is setattr() used for?	To access the attribute of the object	To set an attribute	To check if an attribute exists or not	To delete an attribute	To set an attribute		What is Instantiation in terms of OOP terminology?	Deleting an instance of class	Modifying an instance of class	Copying an instance of class	Creating an instance of class
    +Creating an instance of class
    +
    +Sucessfully updated
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [21]:
    +
    +
    +
    from pprint import pprint
    +data = read_data()
    +pprint(new_data)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Python is a general-purpose programming language supporting multiple programming paradigms. Select the programming paradigm which does not appy to Python.
    +Object-oriented	Procedural	Functional	Symbolic
    +Symbolic
    +After what progrmaming language was Python implemented?
    +Oracle	C++	ABC	Java
    +ABC
    +Name the primary features of Python
    +Exception handling	Form submittals	Storing and archiving	Integrating
    +Exception handling
    +Which year was the updated versions of Python 2.0 and 3.0 released?
    +1990 and 1994	2000 and 2008	1989 and 1990	2001 and 2002
    +2000 and 2008
    +Print built-in function was introduced in version
    +2	1	2.6	3
    +3
    +Which of the following is invalid?
    +_a = 1	__a = 1	__str__ = 1	none of the mentioned
    +none of the mentioned
    +Which of the following is an invalid variable?
    +my_string_1	1st_string	foo	_	1st_string		Why are local variable names beginning with an underscore discouraged?	they are used to indicate a private variables of a class	they confuse the interpreter	they are used to indicate global variables	they slow down execution
    +they are used to indicate a private variables of a class
    +Which of the following is not a keyword?
    +eval	assert	nonlocal	pass
    +eval
    +Which of the following is an invalid statement?
    +abc = 1,000,000	a b c = 1000 2000 3000	a,b,c = 1000, 2000, 3000	a_b_c = 1,000,000
    +a b c = 1000 2000 3000
    +Name few building blocks of Python
    +Functions	arrays	tables	Flowcharts
    +arrays
    +Out of the options, on which OS Python can be used
    +Bada OS	Mac	AS/400	Android
    +AS/400
    +What is the binary file extension generated by python?
    +php	pyc	bin	ini
    +pyc
    +Which layer acts as a layer of logic between the hardware and the code?
    +library modules	binary files	machine language	Python interpreter
    +Python interpreter
    +What is the structure generated after the Python source code is compiled?
    +.ini	.pyc	exe file	.bin
    +.pyc
    +What does CPython and Jython represent?
    +They represent the successive versions of Python.	They represent internal functions of Python.	Implementations of Python	They are the compilers of Python program.
    +Implementations of Python
    +What kind of executables generate a standalone binary executable?
    +Frozen binaries	Pyhton.NET	CPyhton	byte codes
    +Frozen binaries
    +Which of the versions introduced the data hiding feature?
    +Pyhton 1.5	Pyhton 1.0	Pyhton 2.0	Python 1.6
    +Pyhton 1.0
    +What is similar between Javascript and Python?
    +Overloading of the + operator	Object base supports functions and variables without class definition	Both have a UNIX scripting background.	The features are identical.
    +Object base supports functions and variables without class definition
    +What is the default location of Python installation?
    +C:\	D:\	G:\	E:\
    +C:\
    +How do you go to the command line Pyhton interpreter?
    +From Start, select Pyhton 3.6 and click to open.	Select the Python command line directly from the exe file.	Type cmd Python from the command line in Windows.	In Windows, select Python from the installed programs.
    +From Start, select Pyhton 3.6 and click to open.
    +How to create a Pyhton program?
    +Write the program in a text file and upload to the Python folder.	Write the program in the Python editor and execute it.	Use the Print command in the Python interpreter	Write the program using the notepad
    +Use the Print command in the Python interpreter
    +Name few components of IDLE
    +Wordpad	code editor, built-in automation	Project tracker	bug tracker
    +code editor, built-in automation
    +What toolkit is used to code in IDLE?
    +PHP text editor	Soap toolkit	Swing toolkit	Tkinter GUI toolkit
    +Tkinter GUI toolkit
    +Name few of the features of IDLE
    +user interface window	command line entries	debugging and configuration	built-in print option
    +debugging and configuration
    +Name few development environment for Python
    +Soap	Zeus	Eric and Emacs	Eclipse
    +Eric and Emacs
    +What IDEs are used to develop enterprise and professional applications using Python?
    +Netbeans	Wordpad	Sublime and Komodo	Brackets code editor
    +Sublime and Komodo
    +what platforms does Wing IDE support?
    +Android	MAC	Linux	Unix
    +Linux
    +Where is the output from running a saved Python file is displayed?
    +Command prompt	Browser	Shell window	Desktop
    +Shell window
    +What is the first step to start the interactive Python interpreter?
    +Double-click on the Python icon	Select from the Windows explorer	Go to Windows>Start>Programs and select the interpreter.	Type a message with no arguments in the Python interpreter
    +Type a message with no arguments in the Python interpreter
    +What are the two types of windows available in Python IDLE?
    +PHP	Microsoft	Shell and Editor	Desktop
    +Shell and Editor
    +Name the two primary things to be taken care of during Python programming
    +Language	color	Style and indentation	Format
    +Style and indentation
    +What symbol is used to display comments in Python code?
    +#	$	%	<>
    +#
    +What are the compound data types?
    +Graph	Tuples and Strings	Float	Integer
    +Tuples and Strings
    +Which data type stores numbers with fractional values?
    +Generic	Float	Integer	String
    +Float
    +From the options, choose the binary literal.
    +0B01011	0o10	0xA
    +0B01011
    +What does the letter E/e used in float data type represent?
    +Represents the decimal position	Represents negative sign	Represents the power of 10	Represents positive sign
    +Represents the power of 10
    +Which indicates the float data type in the float value syntax?
    +number with decimal values	A built-in function float ()	number with 0B suffixed	numbers with zeros
    +A built-in function float ()
    +What are complex data types?
    +numbers with various levels of operators	algebraic equations	compound numbers	<real part> + <imaginary part>j
    +<real part> + <imaginary part>j
    +The data type of True or False values
    +String	Boolean	Complex	Text
    +Boolean
    +Based on the functionality, which data type can be represented as string and numerals?
    +Float	Sign	Boolean	Char
    +Boolean
    +How to convert a value to boolean?
    +Using the bool() function	by prefixing with the word boolean	by prefixing with the boolean sign	suffixing boolean within brackets
    +Using the bool() function
    +Which data type is also called a sequence?
    +compound	float	boolean	complex
    +compound
    +Which data type does string belong to?
    +Alphabets	Compound	boolean	Char
    +Compound
    +How is a string represented?
    +Alphabetical letters	characters enclosed within quotation marks on both sides	a complete sentence	phrases
    +characters enclosed within quotation marks on both sides
    +What symbol is used to denote multi-line strings?
    +single quotes	triple quotes	double quotes	Brackets
    +triple quotes
    +Which operator is used to extract characters from a string?
    +{start:end}	()	" "	[start:end]
    +[start:end]
    +What is the output of the string - print(Example_string[2])
    +Prints the number 2	Prints the entire string within brackets	Prints the value of the index 2	Prints only the characters ignoring the number
    +Prints the value of the index 2
    +Collection of random objects with no size and type. What type of data type does this denote?
    +text	strings	characters	List data type
    +List data type
    +Out of the options, name the features that list data type support
    +formatting	indexing and concatenation	punctuation	line breaks
    +indexing and concatenation
    +Once created, this data type cannot be changed. Which data type does this denote?
    +Lists	Strings	Tuple	Boolean
    +Tuple
    +How to define Tuple data types?
    +Enlcosed within brackets	Enclosed in square brackets	Enclosed within quotes	Set of characters
    +Enlcosed within brackets
    +What is the specific and interesting feature of tuple data type?
    +Mathematical calculation is possible	Values on the left of the operator can be assigned to the values on the right of the operator.	works with equations	Values cannot be reassigned
    +Values on the left of the operator can be assigned to the values on the right of the operator.
    +Why are Dictionaries in Python called mutable?
    +Elements in the Dictionary can be added, modified and deleted.	Elements in the Dictionary can be merged with another Dictionary.	The Dictionary can be sollated with another.	The elements can be deactivated.
    +Elements in the Dictionary can be added, modified and deleted.
    +How are Dictionaries accessed?
    +Dictionaries are accessed based on their position	Dictionaries are accessed based on the index	Dictionaries are accessed using keys	Dictionaries are accessed alphabetically
    +Dictionaries are accessed using keys
    +The values of the Dictionary keys can be accessed using the symbol:
    +{}	([])	()	[]
    +([])
    +The values within the keys are separated by:
    +commas	curly braces	apostrophe	period
    +commas
    +How is an empty dictionary represented?
    +Empty Dict = 0	My Dict = { }	Dict = null	My Dict = NULL
    +My Dict = { }
    +What is the difference between sets and dictionaries?
    +sets are larger than dictionaries	sets are not restricted to keys	sets are groups of data	sets comprise of numbers and strings
    +sets are not restricted to keys
    +How is a set created?
    +using ({})	create set ()	define set()	()
    +using ({})
    +What are frozensets?
    +frozensets are pre-defined sets	frozensets are similar to set, but immutable	elements are unchangeable	frozensets are changeable sets	frozensets are similar to set, but immutable
    +
    +Why frozensets can be used as keys?
    +frozensets comprise of key elements	frozensets are unhashable	frozensets are hashable	frozensets represent major elements
    +frozensets are hashable
    +Out of given options, which represents the rule for identifiers?
    +keywords can be used as names of identifiers	identifiers can be of specified length	an identifier should not start with a number	an identifier can use special characters
    +an identifier should not start with a number
    +Which of the following environment variable for Python tells the Python interpreter where to locate the module files imported into a program?
    +PYTHONPATH	PYTHONSTARTUP	PYTHONCASEOK	PYTHONHOME
    +PYTHONPATH
    +What is the output of print list if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?
    +[ 'abcd', 786 , 2.23, 'john', 70.2 ]	list	Error	None of the above.	[ 'abcd', 786 , 2.23, 'john', 70.2 ]		What is the output of print tinylist * 2 if tinylist = [123, 'john']?	[123, 'john', 123, 'john']	[123, 'john'] * 2	Error	None of the above.
    +[123, 'john', 123, 'john']
    +Which of the following function convert a String to an object in python?
    +repr(x)	eval(str)	tuple(s)	list(s)
    +eval(str)
    +Which of the following operator in python evaluates to true if the variables on either side of the operator point to the same object and false otherwise?
    +**	//	is	not in
    +is
    +Which of the following function randomizes the items of a list in place?
    +shuffle(lst)	capitalize()	isalnum()	isdigit()
    +shuffle(lst)
    +Which of the following function checks in a string that all characters are in lowercase?
    +islower()	isnumeric()	isspace()	istitle()
    +islower()
    +Which of the following function checks in a string that all characters are decimal?
    +upper()	isdecimal()	swapcase()	title()
    +isdecimal()
    +What is the output of L[2] if L = [1,2,3]?
    +Error	2	3	None of the above.
    +3
    +What is the following function sorts a list?
    +list.reverse()	list.sort([func])	list.pop(obj=list[-1])	list.remove(obj)
    +list.sort([func])
    +Which of these about a set is not true?
    +Mutable data type	Allows duplicate values	Data type with unordered values	Immutable data type
    +Immutable data type
    +Which of the following is not the correct syntax for creating a set?
    +set([[1,2],[3,4]])	set([1,2,2,3,4])	set((1,2,3,4))	{1,2,3,4}	set([[1,2],[3,4]])		Which of the following statements is used to create an empty set?	{ }	set()	[ ]	( )
    +set()
    +If a={5,6,7,8}, which of the following statements is false?
    +print(len(a))	print(min(a))	a.remove(5)	a[2]=45
    +a[2]=45
    +If a={5,6,7}, what happens when a.add(5) is executed?
    +a={5,5,6,7}	a={5,6,7}	Error as there is no add function for set data type	Error as 5 already exists in the set
    +a={5,6,7}
    +Which of these about a frozenset is not true?
    +Mutable data type	Allows duplicate values	Data type with unordered values	Immutable data type
    +Mutable data type
    +Which of the following lines of code will result in an error?
    +s={abs}	s={4, ‘abc’, (1,2)}	s={2, 2.2, 3, ‘xyz’}	s={san}
    +s={san}
    +Which of the following functions cannot be used on heterogeneous sets?
    +pop	remove	update	sum
    +sum
    +Which of the following functions will return the symmetric difference between two sets, x and y?
    +x | y	x ^ y	x & y	x – y
    +x & y
    +The ____________ function removes the first element of a set and the last element of a list.
    +remove	pop	discard	dispose
    +pop
    +If we have two sets, s1 and s2, and we want to check if all the elements of s1 are present in s2 or not, we can use the function:
    +s2.issubset(s1)	s2.issuperset(s1)	s1.issuperset(s2)	s1.isset(s2)
    +s2.issuperset(s1)
    +Which of the following statements create a dictionary?
    +d = {}	d = {“john”:40, “peter”:45}	d = {40:”john”, 45:”peter”}	All of the mentioned	All of the mentioned		Suppose d = {“john”:40, “peter”:45}, to delete the entry for “john” what command do we use	d.delete(“john”:40)	d.delete(“john”)	del d[“john”].	del d(“john”:40)
    +del d[“john”].
    +Suppose d = {“john”:40, “peter”:45}. To obtain the number of entries in dictionary which command do we use?
    +d.size()	len(d)	size(d)	d.len()
    +len(d)
    +Which of these about a dictionary is false?
    +The values of a dictionary can be accessed using keys	The keys of a dictionary can be accessed using values	Dictionaries aren’t ordered	Dictionaries are mutable
    +The keys of a dictionary can be accessed using values
    +Which of the following is not a declaration of the dictionary?
    +{1: ‘A’, 2: ‘B’}	dict([[1,”A”],[2,”B”]])	{1,”A”,2”B”}	{ }
    +{1: ‘A’, 2: ‘B’}
    +Which of the following isn’t true about dictionary keys?
    +More than one key isn’t allowed	Keys must be immutable	Keys must be integers	When duplicate keys encountered, the last assignment wins
    +Keys must be integers
    +Which of the statements about dictionary values if false?
    +More than one key can have the same value	The values of the dictionary can be accessed as dict[key].	Values of a dictionary must be unique	Values of a dictionary can be a mixture of letters and numbers
    +Values of a dictionary must be unique
    +If a is a dictionary with some key-value pairs, what does a.popitem() do?
    +Removes an arbitrary element	Removes all the key-value pairs	Removes the key-value pair for the key given as an argument	Invalid method for dictionary
    +Removes an arbitrary element
    +If b is a dictionary, what does any(b) do?
    +Returns True if any key of the dictionary is true	Returns False if dictionary is empty	Returns True if all keys of the dictionary are true	Method any() doesn’t exist for dictionary
    +Returns True if any key of the dictionary is true
    +Which of the following functions is a built-in function in python?
    +seed()	sqrt()	factorial()	print()
    +print()
    +The function pow(x,y,z) is evaluated as:
    +(x**y)**z	(x**y) / z	(x**y) % z	(x**y)*z	(x**y) % z		What is the output of the function complex() ?	0j	0+0j	0	Error
    +0j
    +The function divmod(a,b), where both ‘a’ and ‘b’ are integers is evaluated as:
    +(a%b, a//b)	(a//b, a%b)	(a//b, a*b)	(a/b, a%b)
    +(a//b, a%b)
    +Which of the following functions does not necessarily accept only iterables as arguments?
    +enumerate()	all()	chr()	max()
    +chr()
    +
    +Which of the following functions accepts only integers as arguments?	ord()	min()	chr()	any()
    +chr()
    +Which of the following functions will not result in an error when no arguments are passed to it?
    +min()	divmod()	all()	float()
    +float()
    +Which of the following functions does not throw an error?
    +ord()	ord(‘ ‘)	ord(”)	ord(“”)
    +ord(‘ ‘)
    +Which of the following is the use of function in python?
    +Functions are reusable pieces of programs	Functions don’t provide better modularity for your application	you can’t also create your own functions	All of the mentioned
    +Functions are reusable pieces of programs
    +Which keyword is use for function?
    +Fun	Define	Def	Function
    +Def
    +Which are the advantages of functions in python?
    +Reducing duplication of code	Decomposing complex problems into simpler pieces	Improving clarity of the code	All of the mentioned
    +All of the mentioned
    +What are the two main types of functions?
    +Custom function	Built-in function & User defined function	User function	System function
    +Built-in function & User defined function
    +Where is function defined?
    +Module	Class	Another function	All of the mentioned
    +All of the mentioned
    +What is called when a function is defined inside a class?
    +Module	Class	Another function	Method
    +Method
    +Which of the following is the use of id() function in python?
    +Id returns the identity of the object	Every object doesn’t have a unique id	All of the mentioned	None of the mentioned
    +Id returns the identity of the object
    +Which of the following refers to mathematical function?
    +sqrt	rhombus	add	Rhombus
    +sqrt
    +Python supports the creation of anonymous functions at runtime, using a construct called __________
    +Lambda	pi	anonymous	None of the mentioned
    +Lambda
    +What is a variable defined outside a function referred to as?
    +A static variable	A global variable	A local variable	An automatic variable
    +A global variable
    +What is a variable defined inside a function referred to as?
    +A global variable	A volatile variable	A local variable	An automatic variable
    +A local variable
    +If a function doesn’t have a return statement, which of the following does the function return?
    +int	null	None	An exception is thrown without the return statement
    +None
    +Is Python case sensitive when dealing with identifiers?
    +yes	no	machine dependent	none of the mentioned
    +yes
    +What is the maximum possible length of an identifier?
    +31 characters	63 characters	79 characters	none of the mentioned
    +none of the mentioned
    +Which of the following is invalid?
    +_a = 1	__a = 1	__str__ = 1	none of the mentioned
    +none of the mentioned
    +Which of the following is an invalid variable?
    +my_string_1	1st_string	foo	_
    +1st_string
    +Why are local variable names beginning with an underscore discouraged?
    +they are used to indicate a private variables of a class	they confuse the interpreter	they are used to indicate global variables	they slow down execution
    +they are used to indicate a private variables of a class
    +Which of the following is not a keyword?
    +eval	assert	nonlocal	pass
    +eval
    +Which of the following is an invalid statement?
    +abc = 1,000,000	a b c = 1000 2000 3000	a,b,c = 1000, 2000, 3000	a_b_c = 1,000,000
    +a b c = 1000 2000 3000
    +Which of these in not a core data type?
    +Lists	Dictionary	Tuples	Class
    +Class
    +Which of the following will run without errors ?
    +round(45.8)	round(6352.898,2,5)	round()	round(7463.123,2,1)
    +round(45.8)
    +What error occurs when you execute?  apple = mango
    +SyntaxError	NameError	ValueError	TypeError
    +NameError
    +What data type is the object below ?  L = [1, 23, ‘hello’, 1].
    +list	dictionary	array	tuple
    +list
    +Which of the following results in a SyntaxError ?
    +‘”Once upon a time…”, she said.’	“He said, ‘Yes!'”	‘3\’	”’That’s okay”
    +‘3\’
    +Select all options that print
    +hello-how-are-you	print(‘hello’, ‘how’, ‘are’, ‘you’)	print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4)	print(‘hello-‘ + ‘how-are-you’)	print(‘hello’ + ‘-‘ + ‘how’ + ‘-‘ + ‘are’ + ‘you’)
    +print(‘hello-‘ + ‘how-are-you’)
    +What is the return value of trunc() ?
    +int	bool	float	None
    +int
    +Which of the following operators has its associativity from right to left?
    ++	//	%	**
    +**
    +Which of the following is the truncation division operator?
    +/	%	//	|
    +//
    +Which of the following formatting options can be used in order to add ‘n’ blank spaces after a given string ‘S’?
    +print(“-ns”%S)	print(“-ns”%S)	print(“%ns”%S)	print(“%-ns”%S)
    +print(“%-ns”%S)
    +What arithmetic operators cannot be used with strings ?
    ++	*	–	All of the mentioned
    +–
    +what is the output when following statement is executed ?  >>> print(‘x\97\x98’)
    +Error	97 98	x\97	\x97\x98
    +x\97
    +>>> print(0xA + 0xB + 0xC) :
    +0xA0xB0xC	Error	0x22	33
    +33
    +Which of the following commands will create a list?
    +list1 = list()	list1 = [].	list1 = list([1, 2, 3])	all of the mentioned
    +all of the mentioned
    +What is the output when we execute list(“hello”)?
    +[‘h’, ‘e’, ‘l’, ‘l’, ‘o’].	[‘hello’].	[‘llo’].	[‘olleh’].	[‘h’, ‘e’, ‘l’, ‘l’, ‘o’].		Suppose list1 is [2445,133,12454,123], what is max(list1) ?	2445	133	12454	123
    +12454
    +To shuffle the list(say list1) what function do we use ?
    +list1.shuffle()	shuffle(list1)	random.shuffle(list1)	random.shuffleList(list1)	random.shuffle(list1)		Which of the following statements is wrong about inheritance?	Protected members of a class can be inherited	The inheriting class is called a subclass	Private members of a class can be inherited and accessed	Inheritance is one of the features of OOP	Private members of a class can be inherited and accessed		Suppose B is a subclass of A, to invoke the __init__ method in A from B, what is the line of code you should write?	A.__init__(self)	B.__init__(self)	A.__init__(B)	B.__init__(A)
    +A.__init__(self)
    +What does built-in function type do in context of classes?
    +Determines the object name of any value	Determines the class name of any value	Determines class description of any value	Determines the file name of any value	Determines the class name of any value		Which of the following is not a type of inheritance?	Double-level	Multi-level	Single-level	Multiple	Double-level		_____ represents an entity in the real world with its identity and behaviour.	A method	An object	A class	An operator
    +An object
    +_____ is used to create an object.
    +class	constructor	User-defined functions	In-built functions	constructor		What is setattr() used for?	To access the attribute of the object	To set an attribute	To check if an attribute exists or not	To delete an attribute	To set an attribute		What is Instantiation in terms of OOP terminology?	Deleting an instance of class	Modifying an instance of class	Copying an instance of class	Creating an instance of class
    +Creating an instance of class
    +
    +
    +
    +
    + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +NameError                                 Traceback (most recent call last)
    +<ipython-input-21-bfc98dcbdf15> in <module>()
    +      1 from pprint import pprint
    +      2 data = read_data()
    +----> 3 pprint(new_data)
    +
    +NameError: name 'new_data' is not defined
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [7]:
    +
    +
    +
    data[0]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[7]:
    + + + + +
    +
    ['Python is a general-purpose programming language supporting multiple programming paradigms. Select the programming paradigm which does not appy to Python.',
    + ['Object-oriented', 'Procedural', 'Functional', 'Symbolic'],
    + 'Symbolic',
    + 'After what progrmaming language was Python implemented?',
    + 'Oracle\tC++\tABC\tJava',
    + 'ABC',
    + 'Name the primary features of Python',
    + 'Exception handling\tForm submittals\tStoring and archiving\tIntegrating',
    + 'Exception handling',
    + 'Which year was the updated versions of Python 2.0 and 3.0 released?',
    + '1990 and 1994\t2000 and 2008\t1989 and 1990\t2001 and 2002',
    + '2000 and 2008',
    + 'Print built-in function was introduced in version',
    + '2\t1\t2.6\t3',
    + '3',
    + 'Which of the following is invalid?',
    + '_a = 1\t__a = 1\t__str__ = 1\tnone of the mentioned',
    + 'none of the mentioned',
    + 'Which of the following is an invalid variable?',
    + 'my_string_1\t1st_string\tfoo\t_\t1st_string\t\tWhy are local variable names beginning with an underscore discouraged?\tthey are used to indicate a private variables of a class\tthey confuse the interpreter\tthey are used to indicate global variables\tthey slow down execution',
    + 'they are used to indicate a private variables of a class',
    + 'Which of the following is not a keyword?',
    + 'eval\tassert\tnonlocal\tpass',
    + 'eval',
    + 'Which of the following is an invalid statement?',
    + 'abc = 1,000,000\ta b c = 1000 2000 3000\ta,b,c = 1000, 2000, 3000\ta_b_c = 1,000,000',
    + 'a b c = 1000 2000 3000',
    + 'Name few building blocks of Python',
    + 'Functions\tarrays\ttables\tFlowcharts',
    + 'arrays',
    + 'Out of the options, on which OS Python can be used',
    + 'Bada OS\tMac\tAS/400\tAndroid',
    + 'AS/400',
    + 'What is the binary file extension generated by python?',
    + 'php\tpyc\tbin\tini',
    + 'pyc',
    + 'Which layer acts as a layer of logic between the hardware and the code?',
    + 'library modules\tbinary files\tmachine language\tPython interpreter',
    + 'Python interpreter',
    + 'What is the structure generated after the Python source code is compiled?',
    + '.ini\t.pyc\texe file\t.bin',
    + '.pyc',
    + 'What does CPython and Jython represent?',
    + 'They represent the successive versions of Python.\tThey represent internal functions of Python.\tImplementations of Python\tThey are the compilers of Python program.',
    + 'Implementations of Python',
    + 'What kind of executables generate a standalone binary executable?',
    + 'Frozen binaries\tPyhton.NET\tCPyhton\tbyte codes',
    + 'Frozen binaries',
    + 'Which of the versions introduced the data hiding feature?',
    + 'Pyhton 1.5\tPyhton 1.0\tPyhton 2.0\tPython 1.6',
    + 'Pyhton 1.0',
    + 'What is similar between Javascript and Python?',
    + 'Overloading of the + operator\tObject base supports functions and variables without class definition\tBoth have a UNIX scripting background.\tThe features are identical.',
    + 'Object base supports functions and variables without class definition',
    + 'What is the default location of Python installation?',
    + 'C:\\\tD:\\\tG:\\\tE:\\',
    + 'C:\\',
    + 'How do you go to the command line Pyhton interpreter?',
    + 'From Start, select Pyhton 3.6 and click to open.\tSelect the Python command line directly from the exe file.\tType cmd Python from the command line in Windows.\tIn Windows, select Python from the installed programs.',
    + 'From Start, select Pyhton 3.6 and click to open.',
    + 'How to create a Pyhton program?',
    + 'Write the program in a text file and upload to the Python folder.\tWrite the program in the Python editor and execute it.\tUse the Print command in the Python interpreter\tWrite the program using the notepad',
    + 'Use the Print command in the Python interpreter',
    + 'Name few components of IDLE',
    + 'Wordpad\tcode editor, built-in automation\tProject tracker\tbug tracker',
    + 'code editor, built-in automation',
    + 'What toolkit is used to code in IDLE?',
    + 'PHP text editor\tSoap toolkit\tSwing toolkit\tTkinter GUI toolkit',
    + 'Tkinter GUI toolkit',
    + 'Name few of the features of IDLE',
    + 'user interface window\tcommand line entries\tdebugging and configuration\tbuilt-in print option',
    + 'debugging and configuration',
    + 'Name few development environment for Python',
    + 'Soap\tZeus\tEric and Emacs\tEclipse',
    + 'Eric and Emacs',
    + 'What IDEs are used to develop enterprise and professional applications using Python?',
    + 'Netbeans\tWordpad\tSublime and Komodo\tBrackets code editor',
    + 'Sublime and Komodo',
    + 'what platforms does Wing IDE support?',
    + 'Android\tMAC\tLinux\tUnix',
    + 'Linux',
    + 'Where is the output from running a saved Python file is displayed?',
    + 'Command prompt\tBrowser\tShell window\tDesktop',
    + 'Shell window',
    + 'What is the first step to start the interactive Python interpreter?',
    + 'Double-click on the Python icon\tSelect from the Windows explorer\tGo to Windows>Start>Programs and select the interpreter.\tType a message with no arguments in the Python interpreter',
    + 'Type a message with no arguments in the Python interpreter',
    + 'What are the two types of windows available in Python IDLE?',
    + 'PHP\tMicrosoft\tShell and Editor\tDesktop',
    + 'Shell and Editor',
    + 'Name the two primary things to be taken care of during Python programming',
    + 'Language\tcolor\tStyle and indentation\tFormat',
    + 'Style and indentation',
    + 'What symbol is used to display comments in Python code?',
    + '#\t$\t%\t<>',
    + '#',
    + 'What are the compound data types?',
    + 'Graph\tTuples and Strings\tFloat\tInteger',
    + 'Tuples and Strings',
    + 'Which data type stores numbers with fractional values?',
    + 'Generic\tFloat\tInteger\tString',
    + 'Float',
    + 'From the options, choose the binary literal.',
    + '0B01011\t0o10\t0xA',
    + '0B01011',
    + 'What does the letter E/e used in float data type represent?',
    + 'Represents the decimal position\tRepresents negative sign\tRepresents the power of 10\tRepresents positive sign',
    + 'Represents the power of 10',
    + 'Which indicates the float data type in the float value syntax?',
    + 'number with decimal values\tA built-in function float ()\tnumber with 0B suffixed\tnumbers with zeros',
    + 'A built-in function float ()',
    + 'What are complex data types?',
    + 'numbers with various levels of operators\talgebraic equations\tcompound numbers\t<real part> + <imaginary part>j',
    + '<real part> + <imaginary part>j',
    + 'The data type of True or False values',
    + 'String\tBoolean\tComplex\tText',
    + 'Boolean',
    + 'Based on the functionality, which data type can be represented as string and numerals?',
    + 'Float\tSign\tBoolean\tChar',
    + 'Boolean',
    + 'How to convert a value to boolean?',
    + 'Using the bool() function\tby prefixing with the word boolean\tby prefixing with the boolean sign\tsuffixing boolean within brackets',
    + 'Using the bool() function',
    + 'Which data type is also called a sequence?',
    + 'compound\tfloat\tboolean\tcomplex',
    + 'compound',
    + 'Which data type does string belong to?',
    + 'Alphabets\tCompound\tboolean\tChar',
    + 'Compound',
    + 'How is a string represented?',
    + 'Alphabetical letters\tcharacters enclosed within quotation marks on both sides\ta complete sentence\tphrases',
    + 'characters enclosed within quotation marks on both sides',
    + 'What symbol is used to denote multi-line strings?',
    + 'single quotes\ttriple quotes\tdouble quotes\tBrackets',
    + 'triple quotes',
    + 'Which operator is used to extract characters from a string?',
    + '{start:end}\t()\t" "\t[start:end]',
    + '[start:end]',
    + 'What is the output of the string - print(Example_string[2])',
    + 'Prints the number 2\tPrints the entire string within brackets\tPrints the value of the index 2\tPrints only the characters ignoring the number',
    + 'Prints the value of the index 2',
    + 'Collection of random objects with no size and type. What type of data type does this denote?',
    + 'text\tstrings\tcharacters\tList data type',
    + 'List data type',
    + 'Out of the options, name the features that list data type support',
    + 'formatting\tindexing and concatenation\tpunctuation\tline breaks',
    + 'indexing and concatenation',
    + 'Once created, this data type cannot be changed. Which data type does this denote?',
    + 'Lists\tStrings\tTuple\tBoolean',
    + 'Tuple',
    + 'How to define Tuple data types?',
    + 'Enlcosed within brackets\tEnclosed in square brackets\tEnclosed within quotes\tSet of characters',
    + 'Enlcosed within brackets',
    + 'What is the specific and interesting feature of tuple data type?',
    + 'Mathematical calculation is possible\tValues on the left of the operator can be assigned to the values on the right of the operator.\tworks with equations\tValues cannot be reassigned',
    + 'Values on the left of the operator can be assigned to the values on the right of the operator.',
    + 'Why are Dictionaries in Python called mutable?',
    + 'Elements in the Dictionary can be added, modified and deleted.\tElements in the Dictionary can be merged with another Dictionary.\tThe Dictionary can be sollated with another.\tThe elements can be deactivated.',
    + 'Elements in the Dictionary can be added, modified and deleted.',
    + 'How are Dictionaries accessed?',
    + 'Dictionaries are accessed based on their position\tDictionaries are accessed based on the index\tDictionaries are accessed using keys\tDictionaries are accessed alphabetically',
    + 'Dictionaries are accessed using keys',
    + 'The values of the Dictionary keys can be accessed using the symbol:',
    + '{}\t([])\t()\t[]',
    + '([])',
    + 'The values within the keys are separated by:',
    + 'commas\tcurly braces\tapostrophe\tperiod',
    + 'commas',
    + 'How is an empty dictionary represented?',
    + 'Empty Dict = 0\tMy Dict = { }\tDict = null\tMy Dict = NULL',
    + 'My Dict = { }',
    + 'What is the difference between sets and dictionaries?',
    + 'sets are larger than dictionaries\tsets are not restricted to keys\tsets are groups of data\tsets comprise of numbers and strings',
    + 'sets are not restricted to keys',
    + 'How is a set created?',
    + 'using ({})\tcreate set ()\tdefine set()\t()',
    + 'using ({})',
    + 'What are frozensets?',
    + 'frozensets are pre-defined sets\tfrozensets are similar to set, but immutable\telements are unchangeable\tfrozensets are changeable sets\tfrozensets are similar to set, but immutable']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    Ques = {
    +    'python' : {
    +        
    +        'Basic' : { },
    +        'Advance' : {
    +            'Gernal' : None,
    +            'Data_Science' : None,
    +            'Web_Desgining' : None,
    +            'Automation' : None,
    +            
    +                    }
    +        
    +                },
    +    'java' : None,
    +    'c' : None,
    +    'c++' : None,
    +    'science' : None,
    +    'maths' : None,
    +}
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [48]:
    +
    +
    +
    pprint(Ques)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'c': None,
    + 'c++': None,
    + 'java': None,
    + 'maths': None,
    + 'python': {'Advance': {'Automation': None,
    +                        'Data_Science': None,
    +                        'Gernal': None,
    +                        'Web_Desgining': None},
    +            'Basic': {'in which year python3 is launched ?': [['2007',
    +                                                               '2008',
    +                                                               '2009',
    +                                                               '2006'],
    +                                                              '2008'],
    +                      'python is launched officially in year ?': [['1991',
    +                                                                   '1992',
    +                                                                   '1994',
    +                                                                   '1996'],
    +                                                                  '1994'],
    +                      'which is not a python web framwork ?': [['Django',
    +                                                                'Flask',
    +                                                                'Web2Py',
    +                                                                'Scipy'],
    +                                                               'Scipy'],
    +                      'which is not python data type ?': [['list',
    +                                                           'array',
    +                                                           'dictionary',
    +                                                           'sets'],
    +                                                          'array'],
    +                      'which package of python provides array processing functions ?': [['pandas',
    +                                                                                         'numpy',
    +                                                                                         'scikit-learn',
    +                                                                                         'Scipy'],
    +                                                                                        'numpy']}},
    + 'science': None}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [4]:
    +
    +
    +
    print("Your Choices : ")
    +print(*Ques.keys())
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Your Choices : 
    +python java c c++ science maths
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
    def quiz():
    +    print("Your Choices : ")
    +    c = 1
    +    for var in Ques :
    +        print("{}. {}".format(c,var))
    +        c += 1
    +    ch1 = input("Your subject : ").strip().lower()
    +    if ch1 in Ques :
    +        print("You wanna try which League ")
    +        c = 1 
    +        for key in Ques[ch1] : 
    +            print("{}. {}".format(c,key))
    +            c = c + 1
    +        ch2 = input("Your Choice : ").strip()
    +        if ch2 in Ques[ch1] : 
    +            start_quiz(ch1,ch2)
    +        else :
    +            print("Invalid Choice Try Again ")
    +            quiz()
    +    else :
    +        print("Invalid Choice Try Again")
    +        quiz()
    +        
    +def start_quiz(key1,key2):
    +    data = Ques[key1][key2]
    +    score = 0
    +    correct = 0
    +    print("Total Questinos : ",len(data))
    +    for question in data : 
    +        print("Your Question is : ")
    +        print(question,'\n')
    +        print("1. {}\t2. {}\t3. {}\t4. {}".format(*(data[question][0])))
    +        
    +        uans = int(input("Your answer : ")) - 1
    +        cans = data[question][0].index(data[question][1])
    +        if uans == cans :
    +            score += 4
    +            correct += 1
    +        else :
    +            score -= 1
    +    print("Thanks for having the quiz ")
    +    print("Total Correct answers : ",correct)
    +    print("Total Incorrect answers : ",len(data)-correct)
    +    print("Your Score is : ",score)
    +    
    +quiz()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Your Choices : 
    +1. python
    +2. java
    +3. c
    +4. c++
    +5. science
    +6. maths
    +Your subject : 1
    +Invalid Choice Try Again
    +Your Choices : 
    +1. python
    +2. java
    +3. c
    +4. c++
    +5. science
    +6. maths
    +Your subject : sffsdf
    +Invalid Choice Try Again
    +Your Choices : 
    +1. python
    +2. java
    +3. c
    +4. c++
    +5. science
    +6. maths
    +Your subject : fasdfsdf
    +Invalid Choice Try Again
    +Your Choices : 
    +1. python
    +2. java
    +3. c
    +4. c++
    +5. science
    +6. maths
    +Your subject : asfdsfsad
    +Invalid Choice Try Again
    +Your Choices : 
    +1. python
    +2. java
    +3. c
    +4. c++
    +5. science
    +6. maths
    +Your subject : asfsfsd
    +Invalid Choice Try Again
    +Your Choices : 
    +1. python
    +2. java
    +3. c
    +4. c++
    +5. science
    +6. maths
    +Your subject : sdfsdaf
    +Invalid Choice Try Again
    +Your Choices : 
    +1. python
    +2. java
    +3. c
    +4. c++
    +5. science
    +6. maths
    +Your subject : sdfdsff
    +Invalid Choice Try Again
    +Your Choices : 
    +1. python
    +2. java
    +3. c
    +4. c++
    +5. science
    +6. maths
    +Your subject : sdf
    +Invalid Choice Try Again
    +Your Choices : 
    +1. python
    +2. java
    +3. c
    +4. c++
    +5. science
    +6. maths
    +Your subject : safsaf
    +Invalid Choice Try Again
    +Your Choices : 
    +1. python
    +2. java
    +3. c
    +4. c++
    +5. science
    +6. maths
    +Your subject : ddsfdsfdsfds
    +Invalid Choice Try Again
    +Your Choices : 
    +1. python
    +2. java
    +3. c
    +4. c++
    +5. science
    +6. maths
    +Your subject : asfs
    +Invalid Choice Try Again
    +Your Choices : 
    +1. python
    +2. java
    +3. c
    +4. c++
    +5. science
    +6. maths
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [70]:
    +
    +
    +
    f = open('quiz_dataset.db','w')
    +import json
    +json.dump(Ques,f)
    +f.close()
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [75]:
    +
    +
    +
    pprint(Ques)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    {'c': None,
    + 'c++': None,
    + 'java': None,
    + 'maths': None,
    + 'python': {'Advance': {'Automation': None,
    +                        'Data_Science': None,
    +                        'Gernal': None,
    +                        'Web_Desgining': None},
    +            'Basic': {'in which year python3 is launched ?': [['2007',
    +                                                               '2008',
    +                                                               '2009',
    +                                                               '2006'],
    +                                                              '2008'],
    +                      'python is launched officially in year ?': [['1991',
    +                                                                   '1992',
    +                                                                   '1994',
    +                                                                   '1996'],
    +                                                                  '1994'],
    +                      'which is not a python web framwork ?': [['Django',
    +                                                                'Flask',
    +                                                                'Web2Py',
    +                                                                'Scipy'],
    +                                                               'Scipy'],
    +                      'which is not a valid python ?': [['Ipython',
    +                                                         'Cpython',
    +                                                         'JPython',
    +                                                         'Ppython'],
    +                                                        'Ppython'],
    +                      'which is not python data type ?': [['list',
    +                                                           'array',
    +                                                           'dictionary',
    +                                                           'sets'],
    +                                                          'array'],
    +                      'which is not python operator ?': [['Increment',
    +                                                          'logical',
    +                                                          'comparision',
    +                                                          'Arithmetic'],
    +                                                         'Increment'],
    +                      'which package of python provides array processing functions ?': [['pandas',
    +                                                                                         'numpy',
    +                                                                                         'scikit-learn',
    +                                                                                         'Scipy'],
    +                                                                                        'numpy']}},
    + 'science': None}
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [8]:
    +
    +
    +
    data[0][0]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[8]:
    + + + + +
    +
    'Python is a general-purpose programming language supporting multiple programming paradigms. Select the programming paradigm which does not appy to Python.'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [9]:
    +
    +
    +
    data[0][1]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[9]:
    + + + + +
    +
    ['Object-oriented', 'Procedural', 'Functional', 'Symbolic']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [11]:
    +
    +
    +
    data[0][2]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[11]:
    + + + + +
    +
    'Symbolic'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [12]:
    +
    +
    +
    data[1][0]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[12]:
    + + + + +
    +
    'Why frozensets can be used as keys?'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [13]:
    +
    +
    +
    data[1][1]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[13]:
    + + + + +
    +
    ['frozensets comprise of key elements',
    + 'frozensets are unhashable',
    + 'frozensets are hashable',
    + 'frozensets represent major elements']
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [14]:
    +
    +
    +
    data[1][2]
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[14]:
    + + + + +
    +
    'frozensets are hashable'
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [16]:
    +
    +
    +
    data_dict = { }
    +for ques_list in data : 
    +    key = ques_list[0]
    +    options = ques_list[1]
    +    ans = ques_list[2]
    +    data_dict.update([(key,[options,ans])])
    +
    + +
    +
    +
    + +
    +
    +
    +
    In [17]:
    +
    +
    +
    data_dict
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    Out[17]:
    + + + + +
    +
    {'Python is a general-purpose programming language supporting multiple programming paradigms. Select the programming paradigm which does not appy to Python.': [['Object-oriented',
    +   'Procedural',
    +   'Functional',
    +   'Symbolic'],
    +  'Symbolic'],
    + 'Why frozensets can be used as keys?': [['frozensets comprise of key elements',
    +   'frozensets are unhashable',
    +   'frozensets are hashable',
    +   'frozensets represent major elements'],
    +  'frozensets are hashable'],
    + 'Which of the following functions accepts only integers as arguments?\tord()\tmin()\tchr()\tany()': [['chr()'],
    +  'Which of the following functions will not result in an error when no arguments are passed to it?']}
    +
    + +
    + +
    +
    + +
    +
    +
    +
    In [18]:
    +
    +
    +
    for key in data_dict:
    +    print(key)
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    Python is a general-purpose programming language supporting multiple programming paradigms. Select the programming paradigm which does not appy to Python.
    +Why frozensets can be used as keys?
    +Which of the following functions accepts only integers as arguments?	ord()	min()	chr()	any()
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/README.md b/python_ipynb/README.md new file mode 100644 index 0000000..013dfb6 --- /dev/null +++ b/python_ipynb/README.md @@ -0,0 +1 @@ +Best Practices upon different technologies diff --git a/python_ipynb/assignment.docx b/python_ipynb/assignment.docx new file mode 100644 index 0000000..d583fd9 Binary files /dev/null and b/python_ipynb/assignment.docx differ diff --git a/python_ipynb/dict.pdf b/python_ipynb/dict.pdf new file mode 100644 index 0000000..ff6abb9 Binary files /dev/null and b/python_ipynb/dict.pdf differ diff --git a/python_ipynb/examples (1).ipynb b/python_ipynb/examples (1).ipynb new file mode 100644 index 0000000..be1ccbe --- /dev/null +++ b/python_ipynb/examples (1).ipynb @@ -0,0 +1,187 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "

    Bank Application

    " + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "Time = Tue Jul 31 13:50:45 2018\n", + "\n", + "\n", + "1. Login \n", + "2. Signup \n", + "3. Exit \n", + "Your Choice : 2\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "Time = Tue Jul 31 13:50:48 2018\n", + "\n", + "\n", + "Enter your name : sachin\n", + "········\n", + "Re-Type your Password : ········\n", + "Password does not match\n", + "Try again\n", + "········\n", + "Re-Type your Password : ········\n", + "Enter initial amount : 1000\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "Time = Tue Jul 31 13:51:12 2018\n", + "\n", + "\n", + "Account Sucessfully Created\n", + "Please note down your account number for future use\n", + "Account Number : 1004\n", + "Redirecting to LOGIN Page ...\n" + ] + }, + { + "ename": "NameError", + "evalue": "name 'login' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 74\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 75\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0m__name__\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m\"__main__\"\u001b[0m \u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 76\u001b[1;33m \u001b[0mbank\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;32m\u001b[0m in \u001b[0;36mbank\u001b[1;34m()\u001b[0m\n\u001b[0;32m 56\u001b[0m \u001b[0mlogin\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 57\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0mch\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;36m2\u001b[0m \u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 58\u001b[1;33m \u001b[0msignup\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 59\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0mch\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;36m3\u001b[0m \u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 60\u001b[0m \u001b[0mos\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msystem\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'cls'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32m\u001b[0m in \u001b[0;36msignup\u001b[1;34m()\u001b[0m\n\u001b[0;32m 41\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Redirecting to LOGIN Page ...\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 42\u001b[0m \u001b[0mtime\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msleep\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 43\u001b[1;33m \u001b[0mlogin\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 44\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 45\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mNameError\u001b[0m: name 'login' is not defined" + ] + } + ], + "source": [ + "import sys\n", + "import os\n", + "import time\n", + "from getpass import getpass\n", + "data = { \n", + " 'user' : [ 'ram','john','harry' ] , \n", + " 'acc' : [ 1001, 1002, 1003 ] , \n", + " 'password' :[ 'abcdef','hey@123','redhat@asimov' ],\n", + " 'bal' : [ 25000.0,1500.0,16644.0 ] , \n", + " }\n", + "def password_input():\n", + " p = getpass()\n", + " q = getpass(\"Re-Type your Password : \")\n", + " if p == q :\n", + " return p\n", + " else : \n", + " print(\"Password does not match\\nTry again\")\n", + " password_input()\n", + " \n", + "def signup():\n", + " global data\n", + " os.system('cls')\n", + " print(\"\\n\\n\\n\\n\")\n", + " print(\"Time = \",time.ctime())\n", + " print(\"\\n\")\n", + " name = input(\"Enter your name : \")\n", + " password = password_input()\n", + " bal = float(\"%.2f\"%(float(input(\"Enter initial amount : \"))))\n", + " acc = data['acc'][-1] + 1\n", + " data['user'].append(name)\n", + " data['acc'].append(acc)\n", + " data['password'].append(password)\n", + " data['bal'].append(bal)\n", + " os.system('cls')\n", + " print(\"\\n\\n\\n\\n\")\n", + " print(\"Time = \",time.ctime())\n", + " print(\"\\n\")\n", + " print(\"Account Sucessfully Created\")\n", + " print(\"Please note down your account number for future use\")\n", + " print(\"Account Number : \",acc)\n", + " print(\"Redirecting to LOGIN Page ...\")\n", + " time.sleep(3)\n", + " login()\n", + "\n", + "\n", + "def bank():\n", + " os.system('cls')\n", + " print(\"\\n\\n\\n\\n\")\n", + " print(\"Time = \",time.ctime())\n", + " print(\"\\n\")\n", + " print(\"1. Login \")\n", + " print(\"2. Signup \")\n", + " print(\"3. Exit \")\n", + " ch = int(input(\"Your Choice : \"))\n", + " if ch == 1 : \n", + " login()\n", + " elif ch == 2 : \n", + " signup()\n", + " elif ch == 3 : \n", + " os.system('cls')\n", + " print(\"\\n\\n\\n\\n\")\n", + " print(\"Thanks for using our services \")\n", + " print(\"Exiting ... \")\n", + " time.sleep(3)\n", + " os.system('cls')\n", + " sys.exit(0)\n", + " else : \n", + " os.system('cls')\n", + " print(\"\\n\\n\\n\\n\")\n", + " print(\"Invalid Choice Try Again \")\n", + " print(\"Redirecting you to Home ... \")\n", + " time.sleep(3)\n", + " bank()\n", + "\n", + "if __name__ == \"__main__\" : \n", + " bank()\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/examples.html b/python_ipynb/examples.html new file mode 100644 index 0000000..b145c47 --- /dev/null +++ b/python_ipynb/examples.html @@ -0,0 +1,13321 @@ + + + + +examples + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +

    Bank Application

    + +
    +
    +
    +
    +
    +
    In [2]:
    +
    +
    +
    import sys
    +import os
    +import time
    +from getpass import getpass
    +data = { 
    +        'user' : [ 'ram','john','harry' ] , 
    +        'acc' : [ 1001, 1002, 1003 ] , 
    +        'password'   :[ 'abcdef','hey@123','redhat@asimov' ],
    +        'bal' : [ 25000.0,1500.0,16644.0 ] , 
    +        }
    +def password_input():
    +    p = getpass()
    +    q = getpass("Re-Type your Password : ")
    +    if p == q :
    +        return p
    +    else : 
    +        print("Password does not match\nTry again")
    +        password_input()
    +        
    +def signup():
    +    global data
    +    os.system('cls')
    +    print("\n\n\n\n")
    +    print("Time = ",time.ctime())
    +    print("\n")
    +    name = input("Enter your name : ")
    +    password = password_input()
    +    bal = float("%.2f"%(float(input("Enter initial amount : "))))
    +    acc = data['acc'][-1] + 1
    +    data['user'].append(name)
    +    data['acc'].append(acc)
    +    data['password'].append(password)
    +    data['bal'].append(bal)
    +    os.system('cls')
    +    print("\n\n\n\n")
    +    print("Time = ",time.ctime())
    +    print("\n")
    +    print("Account Sucessfully Created")
    +    print("Please note down your account number for future use")
    +    print("Account Number : ",acc)
    +    print("Redirecting to LOGIN Page ...")
    +    time.sleep(3)
    +    login()
    +
    +
    +def bank():
    +    os.system('cls')
    +    print("\n\n\n\n")
    +    print("Time = ",time.ctime())
    +    print("\n")
    +    print("1. Login ")
    +    print("2. Signup ")
    +    print("3. Exit ")
    +    ch = int(input("Your Choice : "))
    +    if ch == 1 : 
    +        login()
    +    elif ch == 2 : 
    +        signup()
    +    elif ch == 3 : 
    +        os.system('cls')
    +        print("\n\n\n\n")
    +        print("Thanks for using our services ")
    +        print("Exiting ... ")
    +        time.sleep(3)
    +        os.system('cls')
    +        sys.exit(0)
    +    else : 
    +        os.system('cls')
    +        print("\n\n\n\n")
    +        print("Invalid Choice Try Again  ")
    +        print("Redirecting you to Home ... ")
    +        time.sleep(3)
    +        bank()
    +
    +if __name__ == "__main__" : 
    +    bank()
    +
    + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    +
    +
    +
    +
    +Time =  Tue Jul 31 13:50:45 2018
    +
    +
    +1. Login 
    +2. Signup 
    +3. Exit 
    +Your Choice : 2
    +
    +
    +
    +
    +
    +Time =  Tue Jul 31 13:50:48 2018
    +
    +
    +Enter your name : sachin
    +········
    +Re-Type your Password : ········
    +Password does not match
    +Try again
    +········
    +Re-Type your Password : ········
    +Enter initial amount : 1000
    +
    +
    +
    +
    +
    +Time =  Tue Jul 31 13:51:12 2018
    +
    +
    +Account Sucessfully Created
    +Please note down your account number for future use
    +Account Number :  1004
    +Redirecting to LOGIN Page ...
    +
    +
    +
    + +
    + +
    + + +
    +
    +---------------------------------------------------------------------------
    +NameError                                 Traceback (most recent call last)
    +<ipython-input-2-87f598af73de> in <module>()
    +     74 
    +     75 if __name__ == "__main__" :
    +---> 76     bank()
    +
    +<ipython-input-2-87f598af73de> in bank()
    +     56         login()
    +     57     elif ch == 2 :
    +---> 58         signup()
    +     59     elif ch == 3 :
    +     60         os.system('cls')
    +
    +<ipython-input-2-87f598af73de> in signup()
    +     41     print("Redirecting to LOGIN Page ...")
    +     42     time.sleep(3)
    +---> 43     login()
    +     44 
    +     45 
    +
    +NameError: name 'login' is not defined
    +
    +
    + +
    +
    + +
    +
    +
    +
    In [ ]:
    +
    +
    +
     
    +
    + +
    +
    +
    + +
    +
    +
    + + + + + + diff --git a/python_ipynb/examples.ipynb b/python_ipynb/examples.ipynb new file mode 100644 index 0000000..be1ccbe --- /dev/null +++ b/python_ipynb/examples.ipynb @@ -0,0 +1,187 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "

    Bank Application

    " + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "Time = Tue Jul 31 13:50:45 2018\n", + "\n", + "\n", + "1. Login \n", + "2. Signup \n", + "3. Exit \n", + "Your Choice : 2\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "Time = Tue Jul 31 13:50:48 2018\n", + "\n", + "\n", + "Enter your name : sachin\n", + "········\n", + "Re-Type your Password : ········\n", + "Password does not match\n", + "Try again\n", + "········\n", + "Re-Type your Password : ········\n", + "Enter initial amount : 1000\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "Time = Tue Jul 31 13:51:12 2018\n", + "\n", + "\n", + "Account Sucessfully Created\n", + "Please note down your account number for future use\n", + "Account Number : 1004\n", + "Redirecting to LOGIN Page ...\n" + ] + }, + { + "ename": "NameError", + "evalue": "name 'login' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 74\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 75\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0m__name__\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m\"__main__\"\u001b[0m \u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 76\u001b[1;33m \u001b[0mbank\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;32m\u001b[0m in \u001b[0;36mbank\u001b[1;34m()\u001b[0m\n\u001b[0;32m 56\u001b[0m \u001b[0mlogin\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 57\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0mch\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;36m2\u001b[0m \u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 58\u001b[1;33m \u001b[0msignup\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 59\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0mch\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;36m3\u001b[0m \u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 60\u001b[0m \u001b[0mos\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msystem\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'cls'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32m\u001b[0m in \u001b[0;36msignup\u001b[1;34m()\u001b[0m\n\u001b[0;32m 41\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Redirecting to LOGIN Page ...\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 42\u001b[0m \u001b[0mtime\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msleep\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 43\u001b[1;33m \u001b[0mlogin\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 44\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 45\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mNameError\u001b[0m: name 'login' is not defined" + ] + } + ], + "source": [ + "import sys\n", + "import os\n", + "import time\n", + "from getpass import getpass\n", + "data = { \n", + " 'user' : [ 'ram','john','harry' ] , \n", + " 'acc' : [ 1001, 1002, 1003 ] , \n", + " 'password' :[ 'abcdef','hey@123','redhat@asimov' ],\n", + " 'bal' : [ 25000.0,1500.0,16644.0 ] , \n", + " }\n", + "def password_input():\n", + " p = getpass()\n", + " q = getpass(\"Re-Type your Password : \")\n", + " if p == q :\n", + " return p\n", + " else : \n", + " print(\"Password does not match\\nTry again\")\n", + " password_input()\n", + " \n", + "def signup():\n", + " global data\n", + " os.system('cls')\n", + " print(\"\\n\\n\\n\\n\")\n", + " print(\"Time = \",time.ctime())\n", + " print(\"\\n\")\n", + " name = input(\"Enter your name : \")\n", + " password = password_input()\n", + " bal = float(\"%.2f\"%(float(input(\"Enter initial amount : \"))))\n", + " acc = data['acc'][-1] + 1\n", + " data['user'].append(name)\n", + " data['acc'].append(acc)\n", + " data['password'].append(password)\n", + " data['bal'].append(bal)\n", + " os.system('cls')\n", + " print(\"\\n\\n\\n\\n\")\n", + " print(\"Time = \",time.ctime())\n", + " print(\"\\n\")\n", + " print(\"Account Sucessfully Created\")\n", + " print(\"Please note down your account number for future use\")\n", + " print(\"Account Number : \",acc)\n", + " print(\"Redirecting to LOGIN Page ...\")\n", + " time.sleep(3)\n", + " login()\n", + "\n", + "\n", + "def bank():\n", + " os.system('cls')\n", + " print(\"\\n\\n\\n\\n\")\n", + " print(\"Time = \",time.ctime())\n", + " print(\"\\n\")\n", + " print(\"1. Login \")\n", + " print(\"2. Signup \")\n", + " print(\"3. Exit \")\n", + " ch = int(input(\"Your Choice : \"))\n", + " if ch == 1 : \n", + " login()\n", + " elif ch == 2 : \n", + " signup()\n", + " elif ch == 3 : \n", + " os.system('cls')\n", + " print(\"\\n\\n\\n\\n\")\n", + " print(\"Thanks for using our services \")\n", + " print(\"Exiting ... \")\n", + " time.sleep(3)\n", + " os.system('cls')\n", + " sys.exit(0)\n", + " else : \n", + " os.system('cls')\n", + " print(\"\\n\\n\\n\\n\")\n", + " print(\"Invalid Choice Try Again \")\n", + " print(\"Redirecting you to Home ... \")\n", + " time.sleep(3)\n", + " bank()\n", + "\n", + "if __name__ == \"__main__\" : \n", + " bank()\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/python_ipynb/hello-world/README.md b/python_ipynb/hello-world/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/python_ipynb/hello-world/README.md @@ -0,0 +1 @@ + diff --git a/python_ipynb/hello-world/finish.md b/python_ipynb/hello-world/finish.md new file mode 100644 index 0000000..b6ecbdb --- /dev/null +++ b/python_ipynb/hello-world/finish.md @@ -0,0 +1 @@ +You've completed your first Katacoda scenario! diff --git a/python_ipynb/hello-world/index.json b/python_ipynb/hello-world/index.json new file mode 100644 index 0000000..90268cc --- /dev/null +++ b/python_ipynb/hello-world/index.json @@ -0,0 +1,26 @@ +{ + "title": "Hello World Scenario", + "description": "Your First Scenario", + "difficulty": "beginner", + "time": "2 minutes", + "details": { + "steps": [{ + "title": "Step 1 - Run Command", + "text": "step1.md" + }], + "intro": { + "text": "intro.md", + "credits": "" + }, + "finish": { + "text": "finish.md" + } + }, + "environment": { + "uilayout": "terminal", + "uimessage1": "\u001b[32mYour Interactive Bash Terminal.\r\nStart Kubernetes using `launch.sh`\u001b[m\r\n" + }, + "backend": { + "imageid": "bash" + } +} diff --git a/python_ipynb/hello-world/intro.md b/python_ipynb/hello-world/intro.md new file mode 100644 index 0000000..31f1029 --- /dev/null +++ b/python_ipynb/hello-world/intro.md @@ -0,0 +1 @@ +Welcome to your first Katacoda Scenario! diff --git a/python_ipynb/hello-world/step1.md b/python_ipynb/hello-world/step1.md new file mode 100644 index 0000000..e57dc56 --- /dev/null +++ b/python_ipynb/hello-world/step1.md @@ -0,0 +1,7 @@ +This is your first step. + +## Task + +This is an _example_ of creating a scenario and running a **command** + +`echo 'Hello World'`{{execute}} diff --git a/python_ipynb/temp.jpeg b/python_ipynb/temp.jpeg new file mode 100644 index 0000000..e8b3c8e Binary files /dev/null and b/python_ipynb/temp.jpeg differ