MYSQL
මචන්ල මට මෙන්න මේකට හොද විසදුමක් දියල්ලකො..
මගේ MYSQL DB එකෙන් data load කරගන්න ඕනෙ combobox එකකට. Products කියල table එකක් තියෙනව. මේ table එකෙ තියෙන main category and sub category වල distinct values load කරගන්න ඕනෙ.
තව warehouse කියල table එකක warehouse names ටික තියෙනව මේ names ටිකත් combobox එකකට load කරගන්න ඕනෙ. මේ ඔක්කොම තනි query එකකින් කරගන්න පුලුවන්ද?
දැනට කරන්නෙ query 3ක් යවල.
Code:SELECT DISTINCT main_cat FROM products ORDER BY main_cat SELECT DISTINCT sub_cat FROM products ORDER BY sub_cat SELECT DISTINCT wh_name FROM warehouse ORDER BY wh_name
EmbeddedMediaPlayerComponent mediaPlayerComponent;
public static String VLCLIBPATH = "C:\\Program Files\\VideoLAN\\VLC";
public void mousePressed(MouseEvent evt) {
new NativeDiscovery().discover();
SwingUtilities.invokeLater(() -> {
Home Player = new Home(Video_Path, Name);
});
}
Stop Method.private Home(String path, String name){
mediaPlayerComponent = new EmbeddedMediaPlayerComponent();
vlc.setContentPane(mediaPlayerComponent);
mediaPlayerComponent.getMediaPlayer().prepareMedia(path);
mediaPlayerComponent.getMediaPlayer().parseMedia();
mediaPlayerComponent.getMediaPlayer().play();
}
Pause Method.public void Stop() {
if (Video == true) {
Video = false;
mediaPlayerComponent.getMediaPlayer().stop();
}
}
public void Pause() {
if (Video == true) {
mediaPlayerComponent.getMediaPlayer().pause();
}
}
Error ReportNetbeans IDE (64bit)
JDK(64bit)
jl1.0.1.jar
vlcj-3.0.1.jar
jna-3.2.4.jar
platform.jar
VLC(64bit) installed in the computer
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at media.center.Home.Stop(Home.java:518)
at media.center.Vedio_Player.StopMouseClicked(Vedio_Player.java:357)
at media.center.Vedio_Player.access$900(Vedio_Player.java:18)
at media.center.Vedio_Player$4.mouseClicked(Vedio_Player.java:109)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:270)
at java.awt.Component.processMouseEvent(Component.java:6536)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4534)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessI mpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessI mpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessI mpl.doIntersectionPrivilege(ProtectionDomain.java: 80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
BUILD STOPPED (total time: 1 minute 46 seconds)
මෙන්න මේකයි මට ඕනේ කරලා තියෙන උදව්ව.මම හැදුව පොඩි වීඩියෝ player එකක් vlcj වලින්.මේකේ තියෙන ප්රශ්නේ තමයි , ෆිල්ම් එකක් play කරාට පස්සේ ඒක control කරන්න බැහැ.java.lang.NullPointerException එකක් දෙනවා.ඒ කියන්නේ movie එක , Stop , Pause , Resume (Play) කරන්න බැහැ. පල්ලෙහායින් දාන්නම් මගේ code එක.
Stop Method.
Pause Method.
මේ project එක හදන්නේ මෙන්න මේවා යොදාගෙන,
Error Report
ෆිල්ම් එක play වෙනවා කිසිම අව්ලක් නැහැ , තියෙන එකම අව්ල තමයි. film එක stop කරන්නවත් , pause කරන්නවත් බැරි එක.
දන්න කෙනෙක් ඉන්නවනම් මේක කරන හැටි කියල දෙන්න.
1. video kiyanne boolean variable ekak nam ai eka "== true" karanne? bad practice,මෙන්න මේකයි මට ඕනේ කරලා තියෙන උදව්ව.මම හැදුව පොඩි වීඩියෝ player එකක් vlcj වලින්.මේකේ තියෙන ප්රශ්නේ තමයි , ෆිල්ම් එකක් play කරාට පස්සේ ඒක control කරන්න බැහැ.java.lang.NullPointerException එකක් දෙනවා.ඒ කියන්නේ movie එක , Stop , Pause , Resume (Play) කරන්න බැහැ. පල්ලෙහායින් දාන්නම් මගේ code එක
Stop Method.
Pause Method.
මේ project එක හදන්නේ මෙන්න මේවා යොදාගෙන,
Error Report
ෆිල්ම් එක play වෙනවා කිසිම අව්ලක් නැහැ , තියෙන එකම අව්ල තමයි. film එක stop කරන්නවත් , pause කරන්නවත් බැරි එක.
දන්න කෙනෙක් ඉන්නවනම් මේක කරන හැටි කියල දෙන්න.
Solution1. video kiyanne boolean variable ekak nam ai eka "== true" karanne? bad practice,
if(video){}
2.constructor eka private nisa new object eka hadanne kohomada? public constructor ekak vena arguments ekka thiyenawada? INSTANCE 2k use wenawa wage. e nisa mouse press ekedi hadena instance eka method local nisa e INSTANCE eke stop method eka neme call wenne.
3. mediaPlayerComponent ekata assign wenne private constructor eke nisa 2 weni problem eken me variable eka assign wenne na. assign wena INSTANCE eka NOT accessible. mediaPlayerComponent NULL wenawa.
private Home(){
mediaPlayerComponent = new EmbeddedMediaPlayerComponent();
vlc.setContentPane(mediaPlayerComponent);
}
public static Home getInstance(){
return HomeHolder.INSTANCE;
}
private static class HomeHolder{
private static final Home INSTANCE = new Home();
}
private void mediaPlay(String path, String name){
mediaPlayerComponent.getMediaPlayer().prepareMedia(path);
mediaPlayerComponent.getMediaPlayer().parseMedia();
mediaPlayerComponent.getMediaPlayer().play();
//String name - The assigned value is NEVER use
}
public void mousePressed(MouseEvent evt) {
new NativeDiscovery().discover();
SwingUtilities.invokeLater(() -> {
//Home Player = new Home(Video_Path, Name);
Home Player = Home.getInstance();
Player.mediaPlay(Video_Path,Name);
});
}
ESC/POS කමාන්ඩ් යූස් කරපන් මචෝ.C# walin hadapu system ekaka receipt ekak print privew ekak ganne nathuwa print button eka click karapu gaman print wenna hadanne kohomada??????????????????
Java වල, C# වල වගේ ඬොටේ Framework වල එන දේවල් Use කරන්න එපා බං,
Report වලින්, එහෙම නැත්නම් Images විදියට, Text File හදලා ඒ විදියට Print වෙන්න දෙන්න පුලුවන් ඉස්කෝලෙ කරන ප්රොජෙක්ට්ස් වලට,
පුලුවන් නම් උබේම කියලා උබටම Lib එකක් අටවගන්න,
ප්රින්ටර් එක මොකක් උනත්. SDK මොනා උනත්, Fonts මොනා උනත් ඔය හැම ප්රින්ටර් එකක්ම හදලා තියෙන්නෙ ESC/POS Commands වලට වැඩ කරන්න
ඒක Java විතරක් නෙමෙයි PHP වලට පවා පාවිච්චි කරන්න පුලුවන් OS හෝ USB / COM හො වෙන කිසිම දෙයක් මත රදාපවතින්නෙ නැ,
ESC/POS වලට හදාගන්න එක නම් ටිකක් අමාරු වැඩක්.
ඒත් හරියට ඒක හදාගත්තට පස්සෙ මට නම් ගේමක් ම නැ බං, Customer මොන Printer එක දුන්න්නත් මට දැන් කමක් නැ, Epson, Bixlon, Zebra, Samsung, Chineese ඕන එකක්,
Plug and Play
barcodes උනත් දැන් Print කරන්නෙ එහෙම,
1. video kiyanne boolean variable ekak nam ai eka "== true" karanne? bad practice,
if(video){}
2.constructor eka private nisa new object eka hadanne kohomada? public constructor ekak vena arguments ekka thiyenawada? INSTANCE 2k use wenawa wage. e nisa mouse press ekedi hadena instance eka method local nisa e INSTANCE eke stop method eka neme call wenne.
3. mediaPlayerComponent ekata assign wenne private constructor eke nisa 2 weni problem eken me variable eka assign wenne na. assign wena INSTANCE eka NOT accessible. mediaPlayerComponent NULL wenawa.
http://keyhut.com/popopen.htm
මේ ලින්ක් එකේ තියෙනවා Cashier Drawyer එකට Pulse එක යවන්න Printer එකට යවන්න ඕන Codes.
මම නම් සාමන්යෙන් යවන්නෙ 27 ම විතරයි. Print කරන්නෙ නැතුව cashier ට ඕන වෙලාවට Drawyer එක විතරක් ඇරගන්නත් මේක යවන්න පුලුවන් මොනාවත් Print වෙන්නෙ නැ,
උබ ලයින් බයි ලයින් Print කරන්න යවන Code එක මෙතන දාපං මම හදලා දෙන්නම්.
line by line දෙනකොට පරිස්සමෙන් යවන්න ඕන, CRLF දෙකම එකට යැව්වොත් ලයින් දෙකක් පහලට යනවා, ඒ නිසා CR ව්තරක් දෙන්න ඕනි.
පොඩ්ඩක් ESC/POS Command set ekayi වින්ඩොව්ස් Printer API එකයි, Printer Spooler එකයි වැඩ කරන හැටි බලාගන්න එතකොට අව්ලක් වෙන එකක් නැ,.
Eka combo box ekata load karanna one nam quwry 3 ma union ekak gahala data set eka hada ganna.MYSQL
මචන්ල මට මෙන්න මේකට හොද විසදුමක් දියල්ලකො..
මගේ MYSQL DB එකෙන් data load කරගන්න ඕනෙ combobox එකකට. Products කියල table එකක් තියෙනව. මේ table එකෙ තියෙන main category and sub category වල distinct values load කරගන්න ඕනෙ.
තව warehouse කියල table එකක warehouse names ටික තියෙනව මේ names ටිකත් combobox එකකට load කරගන්න ඕනෙ. මේ ඔක්කොම තනි query එකකින් කරගන්න පුලුවන්ද?
දැනට කරන්නෙ query 3ක් යවල.
Code:SELECT DISTINCT main_cat FROM products ORDER BY main_cat SELECT DISTINCT sub_cat FROM products ORDER BY sub_cat SELECT DISTINCT wh_name FROM warehouse ORDER BY wh_name
මචං උඹට ඕනා combo 3කට load කරන්නද වෙන වෙනම? නැත්නම් තනි combo එකකටද?
combo box 3kata..Eka combo box ekata load karanna one nam quwry 3 ma union ekak gahala data set eka hada ganna.

combo box 3kata..![]()