Application and Database Advise

Post

Posted
Rating:
#1 (In Topic #1350)
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
 Hi everyone,

Just wanted to pick your experts brains on something.

I'm having some system issues with my current software every 24-72 hours the software just slows down so much but I am not sure why as I only open the connects to the the database as and when needed and once I'm doing with them I close them.

And when the terminal go to sleep and is woken up again the software crawls (you can press sign on and it take 45-50 seconds for the sign on screen to show)

So could my issues be what is running in the background.

I have the following running on the pos

Xfce desktop (and some machines run just x11)
MySQL full database server
My printer controller program
My customer display control program
My status program (printer open etc)
My database sync program (only kicks in when it detects a update to the updatetable on the server)
And of course the pos application.

The pos database hold everything that is downloaded from the main server at boot up (I have a small sync program that does this)

I have been thinking about remove the MySQL server from the PoS Terminals and using something else that would be a lot lighter but I would need to make sure that I could have 2 programs access the database at any time (they would be the PoS itself and the sync program)

Can SQLite do this or would it be best to just stick with MySQL?


I have been told about these issues by 2 customers (and the software is running on 2 different machine but they are running on xfce debian 12)

I welcome any ideas as how to sort the slowing of the program and the database side (I could be on the totally wrong path here but I need to start somewhere)
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’
 Instead of letting us guess what might be wrong based on your assumptions, have you tried monitoring the systems and see what is eating up memory or cpu time.

You think that would be an option?

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#3
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

gbWilly said

Instead of letting us guess what might be wrong based on your assumptions, have you tried monitoring the systems and see what is eating up memory or cpu time.

You think that would be an option?

This is why I'm asking for advise as I have no idea how to show that information on Linux

I have used the top command is that the one I need to use?
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’

AndyGable said

This is why I'm asking for advise as I have no idea how to show that information on Linux
Luckily DuckDuckGo came up with multiple ideas to the question: how to monitor performance issues linux

1. https://www.tecmint.co…onitor-linux-performance/
2. https://geekflare.com/linux-performance-commands/
3. https://serverauth.com…ing-a-comprehensive-guide

Just the 3 first ideas of DuckDuckGo…
There where many more…

Enjoy…

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Regular
thatbruce is in the usergroup ‘Regular’

AndyGable said


And when the terminal go to sleep and is woken up again the software crawls (you can press sign on and it take 45-50 seconds for the sign on screen to show)

So could my issues be what is running in the background.

As a sheer blind guess I'd say you are on the completely wrong track.

When a program goes to sleep, its active memory becomes available for other processes to use and they will progressively use more and more. Closing database connections frequently is one way of achieving this as every time you re-open the connection it will grab new memory to process cursors, sorts, etc etc.

When your program re-awakes it has to get all its active memory back which can take some time depending on how much has been re-used by something else.

Don't bother running a memory usage utility and reporting back that only a few % of memory is used. That means nothing regarding this. How and when memory is swapped out is entirely a matter for the operating system.

How much of your data is held in active memory? Why? How many images/pictures? How are you using them, as Pictures or Images?
Swapping to sqlite will only make things worse. It is a memory based dbms.

b

Online now: No Back to the top

Post

Posted
Rating:
#6
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

thatbruce said

As a sheer blind guess I'd say you are on the completely wrong track.

When a program goes to sleep, its active memory becomes available for other processes to use and they will progressively use more and more. Closing database connections frequently is one way of achieving this as every time you re-open the connection it will grab new memory to process cursors, sorts, etc etc.

When your program re-awakes it has to get all its active memory back which can take some time depending on how much has been re-used by something else.

Don't bother running a memory usage utility and reporting back that only a few % of memory is used. That means nothing regarding this. How and when memory is swapped out is entirely a matter for the operating system.

How much of your data is held in active memory? Why? How many images/pictures? How are you using them, as Pictures or Images?
Swapping to sqlite will only make things worse. It is a memory based dbms.

b
How much of your data is held in active memory? Why? How many images/pictures? How are you using them, as Pictures or Images?
No data is stored in active Memory (to my knowledge) everything is stored and recalled from the database, images IF they are used are stored as BASE64 text and is converted by the software once it has been recalled from the database

From what I have just read i fell that I could be doing my Database connections wrong as at the moment i am opening the connection to the database, doing what i need with the Database and then closing the connection

Should I instead open the connection at the start of the program and keep the same one open all the time and close it when my app exit? (I do have another Database application that access the same database on the local machine (this app is used to keep the local database in sync with the Main mysql database Server - would I need to update this as well to open the connection when starting and not close it until the app exits?)

Also I have noticed when the System it self turns off the screen (blanks it and then powers it down) it take for ever for my Gambas app to respond (if it does most of the time I have to reboot the system)

The tills are as follows
Toshiba ST-A10 2GB RAM 2GHz CPU running Debian 12 With XFCE desktop
Epson TM-88 Thermal Printer

When the system boot it created a 20mb RAM folder so the interface modules (my apps that control hardware etc) can talk and not over work the SSD that i have put in the machine

right now I can not connect to the Machine EVEN though I can see it online on my AnyDesk portal (it even slows that down to a point where it times out from the connections but once reboot everything works fine for 2-3 days and then it happens all over again)

Does anyone know of a command I can use that would log application memory etc to a file so when I have to reboot I can see what was the last data before the reboot

As I am not sure if it MySQL or my own Gambas applications that is doing this.

Andy
Online now: No Back to the top

Post

Posted
Rating:
#7
Guru
BruceSteers is in the usergroup ‘Guru’
xfce4-taskmanager may help


<IMG src="https://community.linuxmint.com/img/screenshots/xfce4-taskmanager.png"> </IMG>
Online now: No Back to the top

Post

Posted
Rating:
#8
Avatar
Administrator
sholzy is in the usergroup ‘unknown’
Could also use "top" from command line.

sholzy
Gambas One Site Director

To report bugs in the Gambas IDE:
Official Gambas Bug Tracker
Online now: No Back to the top

Post

Posted
Rating:
#9
Avatar
Regular
thatbruce is in the usergroup ‘Regular’

AndyGable said


How much of your data is held in active memory? Why? How many images/pictures? How are you using them, as Pictures or Images?
No data is stored in active Memory (to my knowledge) everything is stored and recalled from the database, images IF they are used are stored as BASE64 text and is converted by the software once it has been recalled from the database
That's not what I meant. From what I've seen most POS systems display grids of pretty pictures of cheese, chalk, cabbages etc to the operator. For that to happen, they must be in memory (whether that is core or GPU). So how much image information is in memory while the program is running. How they are stored is immaterial.

From what I have just read i fell that I could be doing my Database connections wrong as at the moment i am opening the connection to the database, doing what i need with the Database and then closing the connection

Should I instead open the connection at the start of the program and keep the same one open all the time and close it when my app exit? Yes! Let the dbms manage and reuse its own memory (as most genuine rdbms do these days even pschatk MySQL. Also you could learn how the dbms does reuse memory for its caches, cursors etc and maybe there is some tuning that can be done. Otherwise, every time you open the connection, it will have to create a new area to manage that client. Depending on mystical things inside the O/S like "staleness" negotiation of the memory allocations can take a finite time. Not much but depending on the number of re-connections per minute it can add up. There is no reason to work this way. This bit is not true but think about it this way. Suppose your system closed down the filesystem every time you close all the files that you are using. Then you re-open a file so the system has to start up the filesystem again. Crazy eh!

(I do have another Database application that access the same database on the local machine (this app is used to keep the local database in sync with the Main mysql database Server - would I need to update this as well to open the connection when starting and not close it until the app exits?)  That's a bit different. It would depend on how frequently the synching occurs. Once a minute? Several times a day? Once a month? Every Michaelmas? But within the sync app, I'd keep it open while it does its work and only close it when it is really not doing anything. However I dont think that the memory usage for this on the local system would be a large part of your problem. Now the memory on the central server may be a different matter.

Also I have noticed when the System it self turns off the screen (blanks it and then powers it down) it take for ever for my Gambas app to respond (if it does most of the time I have to reboot the system)
How is it arriving at the decision to "turn off the screen"? IOW what deamon is monitoring usage and turning off screen power? The system itself isn't going into some sleep mode too, is it? And God forbid it's not "hibernating" or some such silliness.


When the system boot it created a 20mb RAM folder so the interface modules (my apps that control hardware etc) can talk and not over work the SSD that i have put in the machine How have you achieved this? I doubt this is part of the issue, just interested.

right now I can not connect to the Machine EVEN though I can see it online on my AnyDesk portal (it even slows that down to a point where it times out from the connections but once reboot everything works fine for 2-3 days and then it happens all over again) No idea. Never used it. I only ever ssh into remotes. Is it as good as sliced bread?

Does anyone know of a command I can use that would log application memory etc to a file so when I have to reboot I can see what was the last data before the reboot
None that I can think of, sorry.
As I am not sure if it MySQL or my own Gambas applications that is doing this.
My money is on "Itsalottathings"

Someone mentioned using top. It's a very sophisticated tool that may give you some vision. Print the man page - there is tooo much to comprehend reading it on the screen. Then understand the Linux memory and process management parts so you can see what to display.

hth
b

Online now: No Back to the top

Post

Posted
Rating:
#10
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

thatbruce said

Someone mentioned using top. It's a very sophisticated tool that may give you some vision. Print the man page - there is tooo much to comprehend reading it on the screen. Then understand the Linux memory and process management parts so you can see what to display.

hth
b


Hi B,

Below are my reply's to your questions

That's not what I meant. From what I've seen most POS systems display grids of pretty pictures of cheese, chalk, cabbages etc to the operator. For that to happen, they must be in memory (whether that is core or GPU). So how much image information is in memory while the program is running. How they are stored is immaterial.
Yes I do this myself I use the load from string function for the picturebox and load the image to that.

Yes! Let the dbms manage and reuse its own memory (as most genuine rdbms do these days even pschatk MySQL. Also you could learn how the dbms does reuse memory for its caches, cursors etc and maybe there is some tuning that can be done. Otherwise, every time you open the connection, it will have to create a new area to manage that client. Depending on mystical things inside the O/S like "staleness" negotiation of the memory allocations can take a finite time. Not much but depending on the number of re-connections per minute it can add up. There is no reason to work this way. This bit is not true but think about it this way. Suppose your system closed down the filesystem every time you close all the files that you are using. Then you re-open a file so the system has to start up the filesystem again. Crazy eh!
Thats ok I shall update the code to just open the database connection at Boot and then close it when exits

That's a bit different. It would depend on how frequently the synching occurs. Once a minute? Several times a day? Once a month? Every Michaelmas? But within the sync app, I'd keep it open while it does its work and only close it when it is really not doing anything. However I dont think that the memory usage for this on the local system would be a large part of your problem. Now the memory on the central server may be a different matter.
The app polls a table on the main database called updateTable and if it finds anything it will process that function. It does this pooling every 60 seconds but this can be changed

How is it arriving at the decision to "turn off the screen"? IOW what deamon is monitoring usage and turning off screen power? The system itself isn't going into some sleep mode too, is it? And God forbid it's not "hibernating" or some such silliness.
in my start up scripit I have the following

Code

#!/bin/bash

#Action to be for running PoS System
xset s off
xset s noblank
xset -dpms s off

#Closes the XFCE Panels
killall xfce4-panel

Everything online says the xset stuff should turn off the sleep of the screen etc but I can confirm it does not work (I am going to need to find a better way to control it - AS I have a full Desktop install I may start to use the Display control program in settings)

How have you achieved this? I doubt this is part of the issue, just interested.
This is from my Start up scripit that does the RAM Drive setup

Code (gambas)

  1. #!/bin/bash
  2.  
  3. RAMSIZE=20M
  4.  
  5. echo 'Creating ' $RAMSIZE'B RAM Drive'
  6. sudo mount -t tmpfs -o size=$RAMSIZE tmps /algPoS/AppLink
  7.  

No idea. Never used it. I only ever ssh into remotes. Is it as good as sliced bread?
I use AnyDesk on all my GUI PoS terminals it allows me easier access to update the applications and get backups of the databases etc

None that I can think of, sorry.
No worries I am just grateful that I can bounce Ideas off people who know Linux a little better then myself.

My money is on "Itsalottathings"
I have the same feeling but I need to sort this soon as I can not really release a slow commercial program


Just incase anyone wants to see how we start our systems I have included all 3 scripits

Startup.sh

Code (gambas)

  1. #!/bin/bash
  2.  
  3. #Action to be for running PoS System
  4. xset s off
  5. xset s noblank
  6. xset -dpms s off
  7.  
  8. #Closes the XFCE Panels
  9. killall xfce4-panel
  10.  
  11. clear
  12.  
  13. cd /algPoS
  14.  
  15. echo 'Start PoS Services'
  16. ./StartUp/RAMDrive.sh
  17.  
  18. echo 'Starting PoS Programs'
  19. ./StartUp/PoSStartUp.sh
  20.  

RAMDrive.sh

Code (gambas)

  1. #!/bin/bash
  2.  
  3. RAMSIZE=20M
  4.  
  5. echo 'Creating ' $RAMSIZE'B RAM Drive'
  6. sudo mount -t tmpfs -o size=$RAMSIZE tmps /algPoS/AppLink
  7.  


PoSStartUp.sh

Code (gambas)

  1. #!/bin/bash
  2.  
  3. BootedDate=$(date)
  4.  
  5. clear
  6. echo 'System Started' $BootedDate
  7. echo 'Starting ESC/PoS Printer Module'
  8. sudo chmod +x /algPoS/Apps/PoSPrinter/PoSPrinter.gambas
  9. /algPoS/Apps/PoSPrinter/PoSPrinter.gambas > /dev/null 2>&1 &
  10.  sleep 5
  11.  
  12. clear
  13. echo 'System Started' $BootedDate
  14. echo 'Starting ESC/PoS Printer Module                                   DONE'
  15. echo 'Starting Epson Status Module'
  16. sudo chmod +x /algPoS/Apps/StatusModule/EpsonStatus.gambas
  17. /algPoS/Apps/StatusModule/EpsonStatus.gambas > /dev/null 2>&1 &
  18.  sleep 5
  19.  
  20. clear
  21. echo 'System Started' $BootedDate
  22. echo 'Starting ESC/PoS Printer Module                                   DONE'
  23. echo 'Starting Epson Status Module                                      DONE'
  24. echo 'Starting Toshiba LIUST-51 Line Display Controler Module'
  25. sudo chmod +x /algPoS/Apps/LIUST/LIUST.gambas
  26. /algPoS/Apps/LIUST/LIUST.gambas > /dev/null 2>&1 &
  27.  sleep 5
  28.  
  29. clear
  30. echo 'System Started' $BootedDate
  31. echo 'Starting ESC/PoS Printer Module                                   DONE'
  32. echo 'Starting Epson Status Module                                      DONE'
  33. echo 'Starting Toshiba LIUST-51 Line Display Controler Module           DONE'
  34. echo 'Syncing PoS Database With System Database             Please wait...'
  35. sudo chmod +x /algPoS/Apps/DataSync/DatabaseSync.gambas
  36. /algPoS/Apps/DataSync/DatabaseSync.gambas /bootup > /dev/null 2>&1
  37.  sleep 5
  38.  
  39. clear
  40. echo 'System Started' $BootedDate
  41. echo 'Starting ESC/PoS Printer Module                                   DONE'
  42. echo 'Starting Epson Status Module                                      DONE'
  43. echo 'Starting Toshiba LIUST-51 Line Display Controler Module           DONE'
  44. echo 'Syncing PoS Database With System Database                  COMPLETED'
  45. echo 'Starting Database Sync program in Request mode'
  46. sudo chmod +x /algPoS/Apps/DataSync/DatabaseSync.gambas
  47. /algPoS/Apps/DataSync/DatabaseSync.gambas /mansync > /dev/null 2>&1 &
  48.  sleep 2
  49.  
  50. clear
  51. echo 'System Started' $BootedDate
  52. echo 'Starting ESC/PoS Printer Module                                   DONE'
  53. echo 'Starting Epson Status Module                                      DONE'
  54. echo 'Starting Toshiba LIUST-51 Line Display Controler Module           DONE'
  55. echo 'Syncing PoS Database With System Database                  COMPLETED'
  56. echo 'Starting Database Sync program in Request mode                    DONE'
  57. echo 'Starting Data File Processor'
  58. sudo chmod +x /algPoS/Apps/DataProcessor/DataProcessor.gambas
  59. /algPoS/Apps/DataProcessor/DataProcessor.gambas > /dev/null 2>&1 &
  60.  sleep 5
  61.  
  62.  
  63. clear
  64. echo 'System Started' $BootedDate
  65. echo 'Starting ESC/PoS Printer Module                                   DONE'
  66. echo 'Starting Epson Status Module                                      DONE'
  67. echo 'Starting Toshiba LIUST-51 Line Display Controler Module           DONE'
  68. echo 'Syncing PoS Database With System Database                  COMPLETED'
  69. echo 'Starting Database Sync program in Request mode                    DONE'
  70. echo 'Starting Data File Processor                                    DONE'
  71. echo 'Starting BasicRetail Point of sale Software'
  72. #sudo chmod +x /algPoS/Apps/RetailPoS/RetailPoS.gambas
  73. /algPoS/Apps/RetailPoS/RetailPoS.gambas /fullscreen /nomouse > /dev/null 2>&1
  74.  
  75. #This part will keep a eye out incase the PoS application crashes it will restart it
  76.  
  77. until RetailPoS; do
  78.         echo 'RetailPoS has exited with a error code $?. Restarting now..' >&2
  79.         sudo chmod +x /algPoS/Apps/RetailPoS/RetailPoS.gambas
  80.         /algPoS/Apps/RetailPoS/RetailPoS.gambas /fullscreen /nomouse > /dev/null 2>&1
  81.         sleep 1
  82. done
Online now: No Back to the top

Post

Posted
Rating:
#11
Guru
BruceSteers is in the usergroup ‘Guru’
That loop at the bottom looks wrong.

Code

until RetailPoS; do
    echo 'RetailPoS has exited with a error code $?. Restarting now..' >&2
    sudo chmod +x /algPoS/Apps/RetailPoS/RetailPoS.gambas
    /algPoS/Apps/RetailPoS/RetailPoS.gambas /fullscreen /nomouse > /dev/null 2>&1
    sleep 1
done

until should work on a "condition"  I can't quite see what "until RetailPos;" is evaluating?

maybe try pgrep -f to check if a program is running
something like this…

Code

until [ -n $(pgrep -f RetailPoS) ]; do
    echo 'RetailPoS has exited with a error code $?. Restarting now..' >&2
    sudo chmod +x /algPoS/Apps/RetailPoS/RetailPoS.gambas
    /algPoS/Apps/RetailPoS/RetailPoS.gambas /fullscreen /nomouse > /dev/null 2>&1
    sleep 1
done
Online now: No Back to the top

Post

Posted
Rating:
#12
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

BruceSteers said

Code

until [ -n $(pgrep -f RetailPoS) ]; do
    echo 'RetailPoS has exited with a error code $?. Restarting now..' >&2
    sudo chmod +x /algPoS/Apps/RetailPoS/RetailPoS.gambas
    /algPoS/Apps/RetailPoS/RetailPoS.gambas /fullscreen /nomouse > /dev/null 2>&1
    sleep 1
done

Hi Bruce,
That stops my complete script if I exit out of my app (so that works i just need to see if I can force a crash of the app to see if it will reload the app)

I have also been doing some digging and it seems that my actual RetailPoS application is growing in memory every minute

When it starts up it is at 47.1MB in memory but after 2 mins it has gone to  76.3MB and all the app is doing is sitting on a "Closed" Screen

Below is the Code for my frmbackground (this is the main form showing)

I have 2 timers on this form one to display the time and date and the other handles files coming in from the add on modules (timer2)

Code (gambas)

  1. ' Gambas class file
  2.  
  3. Public Sub Form_Open()
  4.     labAppVersion.caption = Application.Version
  5.        
  6.     If Exist(Global.Status_CashDrawerClosed) = True Then Try Kill Global.Status_CashDrawerClosed
  7.  
  8.     If Args.Count > 1 Then
  9.         Select Case Lower(Args[1])
  10.             Case "/fullscreen", "/FullScreen", "/FULLSCREEN"
  11.                 frmbackground.FullScreen = True
  12.                 frmbackground.SetFocus
  13.                
  14.             Case "/fullscreenontop", "FullscreenOnTop", "FullScreenOnTop"
  15.                 frmbackground.FullScreen = True
  16.                 frmbackground.Stacking = 1
  17.                 frmbackground.SetFocus
  18.                
  19.             Case "/nomouse", "/NoMouse", "/NOMOUSE"
  20.                 Me.Mouse = Mouse.Blank
  21.         End Select
  22.  
  23.         Select Case Lower(Args[2])
  24.             Case "/nomouse", "/NoMouse", "/NOMOUSE"
  25.                 Me.Mouse = Mouse.Blank
  26.         End Select
  27.     End If
  28.    
  29.      'Loads the PoS Settings etc
  30.     BootUp.PoSBootup
  31.    
  32.     'Hide / Show Buttons
  33.    
  34.     If global.DisplayOptionsShowJobNumKey = "Yes" Then
  35.         btnUpArrow.Height = 98
  36.         btnDownArrow.Height = 98
  37.         btnEnterJobNumber.Visible = True
  38.     Else
  39.         btnUpArrow.Height = 147
  40.         btnDownArrow.Height = 147
  41.         btnEnterJobNumber.Visible = False
  42.     Endif
  43.    
  44.    
  45.     If global.DisplayOptionsShowLotteryPayout = "Yes" Then
  46.         btnLotteryPayout.Show
  47.     Else
  48.         btnLotteryPayout.hide
  49.     End If
  50.        
  51.     If global.DisplayOptionsShowPriceCheck = "Yes" Then
  52.         btnPriceCheck.Show
  53.     Else
  54.         btnPriceCheck.Hide
  55.     End If
  56.        
  57.     If global.DisplayOptionsShowPriceOverride = "Yes" Then
  58.         btnPriceOverride.Show    
  59.     Else
  60.         btnPriceOverride.Hide
  61.     End If
  62.        
  63.     If global.DisplayOptionsShowDeptKey = "Yes" Then
  64.         btnDepartmentList.Show
  65.     Else
  66.         btnDepartmentList.Hide
  67.        
  68.         If global.DisplayOptionsShowPriceOverride = "Yes" Then
  69.             btnPriceOverride.Height = 98
  70.         Endif
  71.        
  72.     End If
  73.        
  74.     If global.DisplayOptionsShowQtyKey = "Yes" Then
  75.         btnQty.Show
  76.     Else
  77.         btnQty.Hide
  78.     End If
  79.    
  80.     If global.DisplayOptionsShowLotteryPayout = "No" And global.DisplayOptionsShowPriceCheck = "No" Then
  81.         btnSignOnOff.Width = 276
  82.     Else
  83.         If Global.DisplayOptionsShowLotteryPayout = "No" And global.DisplayOptionsShowPriceOverride = "Yes" Then
  84.             btnSignOnOff.Width = 189
  85.         Else
  86.             btnSignOnOff.Width = 94    
  87.         End If
  88.     End If
  89.  
  90.     If global.DisplayOptionsShowLotteryPayout = "No" And global.DisplayOptionsShowPriceCheck = "No" And  
  91.         global.DisplayOptionsShowPriceOverride = "No" Then
  92.             With btnSignOnOff
  93.                 .Width = 94    
  94.                 .x = 0
  95.                 .y = 448
  96.             End With
  97.            
  98.             btnUpArrow.Height = 196
  99.             btnDownArrow.Height = 196
  100.         End If
  101.  
  102.     Select Case Global.ReceipitAction
  103.         Case "Request"
  104.             frmbackground.PicNoRecipit.Visible = True
  105.        
  106.         Case "AtEnd"
  107.             frmbackground.PicNoRecipit.Visible = False
  108.        
  109.         Case "Question", "QuestionType"
  110.             frmbackground.PicNoRecipit.Visible = False
  111.            
  112.     End Select
  113.  
  114.     'Connects to the PoS Database Server and ready the PoS for use
  115.         BackofficeDatabase.ConnectToBackOfficeDatabase("Open")
  116.         DatabaseModule.ConnectToDatabase("Open")    
  117.  
  118.     labDate.Caption = Format(Now, "dd/mm/yyyy")
  119.  
  120.     Select Case Global.ShowSecondsOnClock
  121.         Case "Yes", "yes"
  122.             labTime.Caption = Format(Now, "hh:nn:ss")
  123.  
  124.         Case "No", "no"
  125.             labTime.Caption = Format(Now, "hh:nn")
  126.     End Select
  127.  
  128.     Me.labTillNumber.Caption = Format(Global.PoSNumber, "000")
  129.  
  130.     If Format(Global.PoSNumber, "000") <> "001" Then
  131.         Me.labSystemProcessingMessage.Hide
  132.     Else
  133.         Me.labSystemProcessingMessage.Show
  134.     End If
  135.  
  136.     MenuDisplay.ClearMenu
  137.  
  138.     With Timer1
  139.         .Enabled = True
  140.         .Delay = 1000
  141.         .Start
  142.     End With
  143.  
  144.     With Timer2
  145.         .Enabled = True
  146.         .Delay = 1
  147.         .Start
  148.     End With
  149.  
  150.     Workspace1.Add(frmSignedOff, 0)
  151.     Workspace1.SetFocus
  152.  
  153. Public Sub Form_Activate()
  154.     If frmSignedOff.Visible = True Then
  155.         With Me
  156.             .labCashierName.Visible = False
  157.             .labCashierNumber.Visible = False
  158.             .labTransNumber.Visible = False
  159.             .labSystemProcessingMessage.Caption = Null
  160.         End With
  161.     End If
  162.  
  163.  
  164. Public Sub Timer1_Timer()
  165.  
  166.     labDate.Caption = Format(Now, "dd/mm/yyyy")
  167.  
  168.     Select Case Global.ShowSecondsOnClock
  169.         Case "Yes", "yes"
  170.             labTime.Caption = Format(Now, "hh:nn:ss")
  171.  
  172.         Case "No", "no"
  173.             labTime.Caption = Format(Now, "hh:nn")
  174.     End Select
  175.    
  176.    
  177.     ' If Auto End of day is swiched On this will Process it
  178.     If global.AutoEODEnabled = "Yes" And global.AutoEODRunAt = Format(Now, "hh:nn:ss") Then
  179.         If global.StartEOD = 0 Then
  180.             If global.ExcEvenIfNoSales = "No" Then
  181.                 If global.CustomerCount > 0 Then
  182.                     SystemModule.StartAEOD
  183.                 Else
  184.                     Me.labSystemProcessingMessage.Caption = "Auto End Of Day Not needed"
  185.                 End If
  186.             Else
  187.                 SystemModule.StartAEOD
  188.             End If
  189.         End If
  190.     Else
  191.         global.StartEOD = 0
  192.     End If
  193.    
  194.     If global.RebootActive = "Yes" And global.RebootAt = Format(Now, "hh:nn:ss") Then
  195.         If frmSignedOff.Visible = True Then SystemFunctions.RebootPoSNow
  196.     End If
  197.  
  198. Public Sub Timer2_Timer()
  199. 'tests for the Feed from the DataProcessor App    
  200.         If Exist(Global.DataProcessMessages) = True Then Global.ShowDataProcessMessage
  201.        If Exist(Global.Status_PrinterNormal) = True Then PrinterStatus.Status_PrinterNormal
  202.            If Exist(Global.Status_CoverOpen) = True Then PrinterStatus.Status_CoverOpen    
  203.             If Exist(Global.Status_PaperLow) = True Then PrinterStatus.Status_PaperLow
  204.             If Exist(Global.Status_PaperOUT) = True Then PrinterStatus.Status_PaperOUT
  205.  
  206.     If Global.hFileDataReturned Then PipeFunctions.File_Read
  207.    
  208.     If Exist(Global.StartSyncFunction) = True Then Global.DataSyncDataArrived("Start")
  209.       If Exist(global.EndSyncFunction) = True Then Global.DataSyncDataArrived("End")
  210.        If Exist(global.NoNetworkError) = True Then NetworkIcon("NoNetwork")
  211.           If Exist(global.NetworkIsOk) = True Then NetworkIcon("Network")
  212.  
  213. Private Sub NetworkIcon(Mode As String)
  214.     Select Case Mode
  215.         Case "NoNetwork"
  216.             If Exist(global.NoNetworkError) = True Then Try Kill global.NoNetworkError
  217.             Me.PicNoNetwork.Visible = True
  218.        
  219.         Case "Network"
  220.             If Exist(global.NetworkIsOk) = True Then Try Kill global.NetworkIsOk
  221.             Me.PicNoNetwork.Visible = False
  222.     End Select
  223.  
  224. Public Sub btnUpArrow_Click()
  225.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  226.     KeyArrowUp.ProcessKey(Workspace1.ActiveWindow.Name)
  227.  
  228. Public Sub btnUpArrow_MouseDown()
  229.     Global.pc = Picture.FromString(File.Load(Application.Path &/ "AppImages/RedBackground/upArrow_red.bmp"))
  230.     btnUpArrow.Picture = Global.pc
  231.     btnUpArrow.Background = Color.Red
  232.  
  233. Public Sub btnUpArrow_MouseUp()
  234.     Global.pc = Picture.FromString(File.Load(Application.Path &/ "AppImages/GreyBackground/upArrow.bmp"))
  235.     btnUpArrow.Picture = Global.pc
  236.     btnUpArrow.Background = Color.LightGray
  237.  
  238. Public Sub btnDownArrow_Click()
  239.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  240.     KeyArrowDown.ProcessKey(Workspace1.ActiveWindow.Name)
  241.  
  242. Public Sub btnDownArrow_MouseDown()
  243.     btnDownArrow.Background = Color.Red
  244.     Global.pc = Picture.FromString(File.Load(Application.Path &/ "AppImages/RedBackground/downArrow_red.bmp"))
  245.     btnDownArrow.Picture = Global.pc
  246.    
  247.  
  248. Public Sub btnDownArrow_MouseUp()
  249.     Global.pc = Picture.FromString(File.Load(Application.Path &/ "AppImages/GreyBackground/downArrow.bmp"))
  250.     btnDownArrow.Picture = Global.pc
  251.     btnDownArrow.Background = Color.LightGray
  252.  
  253. Public Sub btnEnterJobNumber_Click()
  254.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  255.  
  256.     If frmSalescreen.labInputText.Caption <> "" Then
  257.         global.JobNumber = frmSalescreen.labInputText.Caption
  258.         frmSalescreen.labInputText.Caption = Null
  259.         frmbackground.btnEnterJobNumber.Caption = "Job Number " & global.JobNumber
  260.     Else
  261.         frmbackground.btnEnterJobNumber.Caption = "Job Number"
  262.         global.JobNumber = Null
  263.     End If
  264.     '
  265.  
  266. Public Sub btnSignOnOff_Click()
  267.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  268.     KeySignOnOff.ProcessKey(Workspace1.ActiveWindow.Name)
  269.  
  270. Public Sub btnSignOnOff_MouseDown()
  271.     btnSignOnOff.Background = Color.Red
  272.  
  273. Public Sub btnSignOnOff_MouseUp()
  274.     btnSignOnOff.Background = Color.White
  275.  
  276. Public Sub btnLotteryPayout_Click()
  277.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  278.     KeyLotteryPayout.ProcessKey(Workspace1.ActiveWindow.Name)
  279.  
  280. Public Sub btnLotteryPayout_MouseDown()
  281.     btnLotteryPayout.Background = Color.Red
  282.  
  283. Public Sub btnLotteryPayout_MouseUp()
  284.     btnLotteryPayout.Background = Color.White
  285.  
  286. Public Sub btnPriceCheck_Click()
  287.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  288.     KeyPriceCheck.ProcessKey(Workspace1.ActiveWindow.Name)
  289.  
  290. Public Sub btnPriceCheck_MouseDown()
  291.     btnPriceCheck.Background = Color.Red
  292.  
  293. Public Sub btnPriceCheck_MouseUp()
  294.     btnPriceCheck.Background = Color.White
  295.  
  296. Public Sub btnPriceOverride_Click()
  297.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  298.     KeyPriceOverride.ProcessKey(Workspace1.ActiveWindow.Name)
  299.  
  300. Public Sub btnPriceOverride_MouseDown()
  301.     btnPriceOverride.Background = Color.Red
  302.  
  303. Public Sub btnPriceOverride_MouseUp()
  304.     btnPriceOverride.Background = Color.White
  305.  
  306. Public Sub btnUserMenu_Click()
  307.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  308.     KeyUserMenu.ProcessKey(Workspace1.ActiveWindow.Name)
  309.  
  310. Public Sub btnUserMenu_MouseDown()
  311.     btnUserMenu.Background = Color.Red
  312.  
  313. Public Sub btnUserMenu_MouseUp()
  314.     btnUserMenu.Background = Color.White
  315.  
  316. Public Sub btnItemMenu_Click()
  317.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  318.     KeyVoidMenu.ProcessKey(Workspace1.ActiveWindow.Name)
  319.  
  320. Public Sub btnItemMenu_MouseDown()
  321.     btnItemMenu.Background = Color.Red
  322.  
  323. Public Sub btnItemMenu_MouseUp()
  324.     btnItemMenu.Background = Color.White
  325.  
  326. Public Sub btnDepartmentList_Click()
  327.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  328.     KeyDepartmentList.ProcessKey(Workspace1.ActiveWindow.Name)
  329.  
  330. Public Sub btnDepartmentList_MouseDown()
  331.     btnDepartmentList.Background = Color.Red
  332.  
  333. Public Sub btnDepartmentList_MouseUp()
  334.     btnDepartmentList.Background = Color.White
  335.  
  336. Public Sub btnPrintRecipt_Click()
  337.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  338.     KeyPrintRecipt.ProcessKey(Workspace1.ActiveWindow.Name)
  339.  
  340. Public Sub btnPrintRecipt_MouseDown()
  341.     btnPrintRecipt.Background = Color.Red
  342.  
  343. Public Sub btnPrintRecipt_MouseUp()
  344.     btnPrintRecipt.Background = Color.White
  345.  
  346. Public Sub btnQty_Click()
  347.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  348.     KeyQty.ProcessKey(Workspace1.ActiveWindow.Name)
  349.  
  350. Public Sub btnQty_MouseDown()
  351.     btnQty.Background = Color.Red
  352.  
  353. Public Sub btnQty_MouseUp()
  354.     btnQty.Background = Color.White
  355.  
  356. Public Sub btnClear_Click()
  357.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  358.     KeyClear.ProcessKey(Workspace1.ActiveWindow.Name)
  359.  
  360. Public Sub btnClear_MouseDown()
  361.     btnClear.Background = Color.Red
  362.  
  363. Public Sub btnClear_MouseUp()
  364.     btnClear.Background = Color.White
  365.  
  366. Public Sub btnTotalNo_Click()
  367.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  368.     KeyTotal_No.Processkey(Workspace1.ActiveWindow.Name)
  369.  
  370. Public Sub btnTotalNo_MouseDown()
  371.     btnTotalNo.Background = Color.Red
  372.  
  373. Public Sub btnTotalNo_MouseUp()
  374.     btnTotalNo.Background = Color.White
  375.  
  376. Public Sub btnEnterYes_Click()
  377.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  378.     KeyEnter_Yes.ProcessKey(Workspace1.ActiveWindow.Name)
  379.  
  380. Public Sub btnEnterYes_MouseDown()
  381.     btnEnterYes.Background = Color.Red
  382.  
  383. Public Sub btnEnterYes_MouseUp()
  384.     btnEnterYes.Background = Color.White
  385. 'Number Keys#
  386. Public Sub btn0_Click()
  387.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  388.     Key_0.ProcessKey(Workspace1.ActiveWindow.Name)
  389.  
  390. Public Sub btn0_MouseDown()
  391.     btn0.Background = Color.Red
  392.  
  393. Public Sub btn0_MouseUp()
  394.     btn0.Background = Color.White
  395.  
  396. Public Sub btnDot_Click()
  397.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  398.     KeyDOT.ProcessKey(Workspace1.ActiveWindow.Name)
  399.  
  400. Public Sub btnDot_MouseDown()
  401.     btnDot.Background = Color.Red
  402.  
  403. Public Sub btnDot_MouseUp()
  404.     btnDot.Background = Color.White
  405.  
  406. Public Sub btn1_Click()
  407.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  408.     Key_1.ProcessKey(Workspace1.ActiveWindow.Name)
  409.  
  410. Public Sub btn1_MouseDown()
  411.     btn1.Background = Color.Red
  412.  
  413. Public Sub btn1_MouseUp()
  414.     btn1.Background = Color.White
  415.  
  416. Public Sub btn2_Click()
  417.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  418.     Key_2.ProcessKey(Workspace1.ActiveWindow.Name)
  419.  
  420. Public Sub btn2_MouseDown()
  421.     btn2.Background = Color.Red
  422.  
  423. Public Sub btn2_MouseUp()
  424.     btn2.Background = Color.White
  425.  
  426. Public Sub btn3_Click()
  427.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  428.     Key_3.ProcessKey(Workspace1.ActiveWindow.Name)
  429.  
  430. Public Sub btn3_MouseDown()
  431.     btn3.Background = Color.Red
  432.  
  433. Public Sub btn3_MouseUp()
  434.     btn3.Background = Color.White
  435.  
  436. Public Sub btn4_Click()
  437.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  438.     Key_4.ProcessKey(Workspace1.ActiveWindow.Name)
  439.  
  440. Public Sub btn4_MouseDown()
  441.     btn4.Background = Color.Red
  442.  
  443. Public Sub btn4_MouseUp()
  444.     btn4.Background = Color.White
  445.  
  446.  
  447. Public Sub btn5_Click()
  448.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  449.     Key_5.ProcessKey(Workspace1.ActiveWindow.Name)
  450.  
  451. Public Sub btn5_MouseDown()
  452.     btn5.Background = Color.Red
  453.  
  454. Public Sub btn5_MouseUp()
  455.     btn5.Background = Color.White
  456.  
  457. Public Sub btn6_Click()
  458.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  459.     Key_6.ProcessKey(Workspace1.ActiveWindow.Name)
  460.  
  461. Public Sub btn6_MouseDown()
  462.     btn6.Background = Color.Red
  463.  
  464. Public Sub btn6_MouseUp()
  465.     btn6.Background = Color.White
  466.  
  467. Public Sub btn7_Click()
  468.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  469.     Key_7.ProcessKey(Workspace1.ActiveWindow.Name)    
  470.  
  471. Public Sub btn7_MouseDown()
  472.     btn7.Background = Color.Red
  473.  
  474. Public Sub btn7_MouseUp()
  475.     btn7.Background = Color.White
  476.  
  477. Public Sub btn8_Click()
  478.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  479.     Key_8.ProcessKey(Workspace1.ActiveWindow.Name)
  480.  
  481. Public Sub btn8_MouseDown()
  482.     btn8.Background = Color.Red
  483.  
  484. Public Sub btn8_MouseUp()
  485.     btn8.Background = Color.White
  486.  
  487. Public Sub btn9_Click()
  488.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  489.     Key_9.ProcessKey(Workspace1.ActiveWindow.Name)
  490.  
  491. Public Sub btn9_MouseDown()
  492.     btn9.Background = Color.Red
  493.  
  494. Public Sub btn9_MouseUp()
  495.     btn9.Background = Color.White
  496.  
  497. Public Sub btnFunctionKeyF1_Click()
  498.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  499.     FunctionKeyF1.ProcessFunctionKey(Workspace1.ActiveWindow.Name)
  500.  
  501. Public Sub btnFunctionKeyF2_Click()
  502.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  503.     FunctionKeyF2.ProcessFunctionKey(Workspace1.ActiveWindow.Name)
  504.  
  505. Public Sub btnFunctionKeyF3_Click()
  506.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  507.     FunctionKeyF3.ProcessFunctionKey(Workspace1.ActiveWindow.Name)
  508.  
  509. Public Sub btnFunctionKeyF4_Click()
  510.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  511.     FunctionKeyF4.ProcessFunctionKey(Workspace1.ActiveWindow.Name)
  512.  
  513. Public Sub btnFunctionKeyF5_Click()
  514.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  515.     FunctionKeyF5.ProcessFunctionKey(Workspace1.ActiveWindow.Name)
  516.  
  517. Public Sub btnFunctionKeyF6_Click()
  518.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  519.     FunctionKeyF6.ProcessFunctionKey(Workspace1.ActiveWindow.Name)
  520.  
  521. Public Sub btnFunctionKeyF7_Click()
  522.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  523.     FunctionKeyF7.ProcessFunctionKey(Workspace1.ActiveWindow.Name)
  524.  
  525. Public Sub btnFunctionKeyF8_Click()
  526.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  527.     FunctionKeyF8.ProcessFunctionKey(Workspace1.ActiveWindow.Name)
  528.  
  529. Public Sub PictureBox2_MouseDown()
  530.     If Global.BeepOnKeyPress = "Yes" Then SystemFunctions.PCSpeakerBleep(500)
  531.  
  532.     If frmSalescreen.Visible = True Then
  533.         Select Case global.DisplayOptionsShowJobNumKey
  534.             Case "Yes"
  535.                 If frmSalescreen.labInputText.Caption = "" Then
  536.                     PrinterFunctions.WithThanks
  537.                 Else
  538.                     PrinterFunctions.JobNumberPrint
  539.                 End If
  540.            
  541.             Case "No"
  542.                 PrinterFunctions.WithThanks
  543.         End Select
  544.     End If
  545.  
  546.     If frmSignedOff.Visible = True Then  
  547.         global.algPoSCount += 1
  548.        
  549.         If global.algPoSCount = 5 Then
  550.             MenuDisplay.ClearMenu
  551.             frmbackground.Workspace1.CloseAll
  552.             frmbackground.Workspace1.Add(frmalgPoSMenu, 0)            
  553.             global.algPoSCount = 0
  554.         End If
  555.  
  556.         MenuDisplay.ClearMenu
  557.         MenuDisplay.SignedOffSystemMenu
  558.     End If
  559.  

and the code for the frmsigned off

Code (gambas)

  1. ' Gambas class file
  2.  
  3. Public Sub Form_Open()
  4.     Label1.Font.Name = "Inconsolata"
  5.  
  6.    
  7.     With frmbackground
  8.            .labCashierName.Visible = False
  9.          .labCashierNumber.Visible = False
  10.            .labTransNumber.Visible = False
  11.                .labMinDate.Visible = False
  12.               .picSafeDrop.Visible = False
  13.           .PicCardAceppted.Visible = False
  14.                .btnUpArrow.Enabled = False
  15.              .btnDownArrow.Enabled = False
  16.  
  17.              .btnSignOnOff.Caption = "Sign On"
  18.              .btnSignOnOff.Enabled = True
  19.  
  20.             .btnPriceCheck.Enabled = True
  21.          .btnLotteryPayout.Enabled = False
  22.         .btnEnterJobNumber.Enabled = False
  23.          .btnPriceOverride.Enabled = False
  24.               .btnUserMenu.Enabled = True
  25.               .btnItemMenu.Enabled = False
  26.         .btnDepartmentList.Enabled = False
  27.            .btnPrintRecipt.Enabled = False
  28.                    .btnQty.Enabled = False
  29.                      .btn7.Enabled = False
  30.                      .btn8.Enabled = False
  31.                      .btn9.Enabled = False
  32.                  .btnClear.Enabled = False
  33.                      .btn4.Enabled = False
  34.                      .btn5.Enabled = False
  35.                      .btn6.Enabled = False
  36.                .btnTotalNo.Enabled = False
  37.                      .btn1.Enabled = False
  38.                      .btn2.Enabled = False
  39.                      .btn3.Enabled = False
  40.                      .btn0.Enabled = False
  41.                    .btnDot.Enabled = False
  42.               .btnEnterYes.Enabled = False
  43.     End With
  44.  
  45.     global.CustomerDisplayFunction("SignedOff")
  46.    
  47.     Me.Enabled = True
  48.     Me.SetFocus
  49.     labCopyrightMessage.Caption = Global.CopyrightValue
  50.     MenuDisplay.ClearMenu
  51.    
  52.     With frmbackground
  53.         .btnTotalNo.Caption = "Total"
  54.         .btnEnterYes.Caption = "Enter"
  55.     End With    
  56.  
  57.  
  58. Public Sub Form_KeyPress()
  59.     KeyFunction(Key.Code)
  60.  
  61. Public Sub KeyFunction(KeyCode As String)
  62.     Select Case KeyCode
  63.         Case Global.Key_SignOn ' lower case A
  64.             If frmSignedOff.Visible = True Then
  65.                 frmbackground.Workspace1.CloseAll
  66.                
  67.                 Select Case global.SignOnType
  68.                     Case "Number"
  69.                         frmbackground.Workspace1.Add(FrmSignOn, 0)    
  70.                        
  71.                     Case "List"
  72.                         DatabaseModule.LoadCashierNamesOnScreen
  73.                         frmbackground.Workspace1.Add(FrmSignOnList, 0)
  74.                 End Select
  75.                
  76.                
  77.             End If
  78.            
  79.         Case Global.Key_PriceCheck
  80.             If frmSignedOff.Visible = True Then
  81.                 global.PriceCheckReturnScreen = "frmSignedOff"
  82.                 frmbackground.Workspace1.CloseAll
  83.                 frmbackground.Workspace1.Add(frmPriceCheck_1, 0)
  84.             End If
  85.            
  86.         Case Global.Key_UserMenu
  87.             If frmSignedOff.Visible = True Then
  88.                 frmbackground.Workspace1.CloseAll
  89.                 frmbackground.Workspace1.Add(frmSignedOffMenu, 0)
  90.             End If
  91.        
  92.     End Select
  93.  
  94.  


frmSignedoff is showing inside a workspace on frmBackground (the full app is based on a workspace holder)

Is there a way I can see what my app is placing into memory all the time as I have checked my code and I can not see what is happening (and I have rewitten the database interface modules so it opens the connection at start of the program and not to close them until the end of the program)

This is what this section does

Code (gambas)

  1.     'Connects to the PoS Database Server and ready the PoS for use
  2.         BackofficeDatabase.ConnectToBackOfficeDatabase("Open")
  3.         DatabaseModule.ConnectToDatabase("Open")    
  4.  
Online now: No Back to the top

Post

Posted
Rating:
#13
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
 Out of all that, the only thing I'd suggest trying is to get rid off all the Show/Hides and use Visible instead.
I don't know if it will help but I think setting visible on and off involves less effort than Show/Hide. You'd need to look at what happens inside the GUI to find out how they are different, probably easier just to try.

b
p.s. By the way, from what I said before, just because a control is hidden doesn't mean it is not using memory, so if any of those controls have images/pictures in them they are loaded, no matter if they are visible.

Online now: No Back to the top

Post

Posted
Rating:
#14
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
How is it arriving at the decision to "turn off the screen"? IOW what deamon is monitoring usage and turning off screen power? The system itself isn't going into some sleep mode too, is it? And God forbid it's not "hibernating" or some such silliness.
in my start up scripit I have the following

Code (gambas)

  1. #!/bin/bash
  2.  
  3. #Action to be for running PoS System
  4. xset s off
  5. xset s noblank
  6. xset -dpms s off
  7.  
  8. #Closes the XFCE Panels
  9. killall xfce4-panel
  10.  
  11.  
Everything online says the xset stuff should turn off the sleep of the screen etc but I can confirm it does not work (I am going to need to find a better way to control it - AS I have a full Desktop install I may start to use the Display control program in settings)

Try using

Code (gambas)

  1. xset -dpms
You can see if this works in a terminal by using "xset q" before and after the above as it takes effect immediately.
I tried out your xsets in a terminal here. The first tWo don't affect  dpms but that simplified 3rd line does work here.

b

Now, lets get back to the actual dpms itself. I presume you are using xfce4-power-manager? What are the settings there? Particularly the System ones.
Image

(Click to enlarge)


Online now: No Back to the top

Post

Posted
Rating:
#15
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
Also
Image

(Click to enlarge)


Online now: No Back to the top

Post

Posted
Rating:
#16
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
Also

Code (gambas)

  1. Public Sub Form_KeyPress()
  2.     KeyFunction(Key.Code)
  3.  
  4. Public Sub KeyFunction(KeyCode As String)
  5.     Select Case KeyCode
  6.         Case Global.Key_SignOn ' lower case A
  7.             If
  8.              blah blah
  9.              
  10.         Case Global.Key_PriceCheck
From the top.
Key.Code is an integer value. I see no need to waste time converting it to a string internally.
Use

Code (gambas)

  1. Public Sub KeyFunction(KeyCode As Integer)
  2.     Select Case KeyCode
  3.         Case Key["a"] ' N.B. upper and lower case alphas are the same. If you really need to see if its one then you need to use Key.Shift as well.
  4.              blah blah
  5.  

Online now: No Back to the top

Post

Posted
Rating:
#17
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
(and I have rewitten the database interface modules so it opens the connection at start of the program and not to close them until the end of the program)
Did it make a difference? You may need a decent dbms monitor like dBeaver or something to see it. I think MySQL has a html front end but I have no idea how sophisticated it is.
b

Online now: No Back to the top

Post

Posted
Rating:
#18
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

thatbruce said

Also

Code (gambas)

  1. Public Sub Form_KeyPress()
  2.     KeyFunction(Key.Code)
  3.  
  4. Public Sub KeyFunction(KeyCode As String)
  5.     Select Case KeyCode
  6.         Case Global.Key_SignOn ' lower case A
  7.             If
  8.              blah blah
  9.              
  10.         Case Global.Key_PriceCheck
From the top.
Key.Code is an integer value. I see no need to waste time converting it to a string internally.
Use

Code (gambas)

  1. Public Sub KeyFunction(KeyCode As Integer)
  2.     Select Case KeyCode
  3.         Case Key["a"] ' N.B. upper and lower case alphas are the same. If you really need to see if its one then you need to use Key.Shift as well.
  4.              blah blah
  5.  


The keys are stored in the system as numbers but stored as string. Should I change them to be integers?
Online now: No Back to the top

Post

Posted
Rating:
#19
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

thatbruce said

(and I have rewitten the database interface modules so it opens the connection at start of the program and not to close them until the end of the program)
Did it make a difference? You may need a decent dbms monitor like dBeaver or something to see it. I think MySQL has a html front end but I have no idea how sophisticated it is.
b

Yes it did the database has not gone over 15mb memory usage yet
Online now: No Back to the top

Post

Posted
Rating:
#20
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
 With all the updates that have been recommend and implemented I can say now on my development machine I have a memory staying around 65MB

But on the customers machine it has gone to 120mb

The only difference is I have on my machine 3.19.5 and on the customers machine is installed 3.19.4 runtime files.

Could the different versions be playing a part in this?
Online now: No Back to the top

Post

Posted
Rating:
#21
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

thatbruce said

How is it arriving at the decision to "turn off the screen"? IOW what deamon is monitoring usage and turning off screen power? The system itself isn't going into some sleep mode too, is it? And God forbid it's not "hibernating" or some such silliness.
in my start up scripit I have the following

Code (gambas)

  1. #!/bin/bash
  2.  
  3. #Action to be for running PoS System
  4. xset s off
  5. xset s noblank
  6. xset -dpms s off
  7.  
  8. #Closes the XFCE Panels
  9. killall xfce4-panel
  10.  
  11.  
Everything online says the xset stuff should turn off the sleep of the screen etc but I can confirm it does not work (I am going to need to find a better way to control it - AS I have a full Desktop install I may start to use the Display control program in settings)

Try using

Code (gambas)

  1. xset -dpms
You can see if this works in a terminal by using "xset q" before and after the above as it takes effect immediately.
I tried out your xsets in a terminal here. The first tWo don't affect  dpms but that simplified 3rd line does work here.

b

Now, lets get back to the actual dpms itself. I presume you are using xfce4-power-manager? What are the settings there? Particularly the System ones.Power Manager_001.png

Once I'm at the customers machine this afternoon I shall let you know the settings
Online now: No Back to the top

Post

Posted
Rating:
#22
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
Severely doubt it.

<COLOR color="#BF0080">(OOPS, this needs a quote so I and you need to know what we are talking about here. I'll be back after a little lie down now.)</COLOR>

One monitor I have looked at here today is vmstat. It does seem to give better information that may provide some pertinent data. You will need to run the following on a live pos for an entire day, which will give a LOT of data we need to look at.
 On a POS in a virtual terminal run this after starting the pos system. Let it run for an entire day
    vmstat -w -n 30 103680 -Sm
This will generate a big output to stdout, so you need to copy it somehow (piping doesn't seem to oblige vmstat, unless someone can convince me otherwise.) The things we are interested in are the swap values which might get us a little further.

Online now: No Back to the top

Post

Posted
Rating:
#23
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

thatbruce said

Severely doubt it.

<COLOR color="#BF0080">(OOPS, this needs a quote so I and you need to know what we are talking about here. I'll be back after a little lie down now.)</COLOR>

One monitor I have looked at here today is vmstat. It does seem to give better information that may provide some pertinent data. You will need to run the following on a live pos for an entire day, which will give a LOT of data we need to look at.
 On a POS in a virtual terminal run this after starting the pos system. Let it run for an entire day
    vmstat -w -n 30 103680 -Sm
This will generate a big output to stdout, so you need to copy it somehow (piping doesn't seem to oblige vmstat, unless someone can convince me otherwise.) The things we are interested in are the swap values which might get us a little further.

This has been set up on the customers machine

I've also checked and the setting for the display etc are all set off.
Online now: No Back to the top

Post

Posted
Rating:
#24
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
 Hi Everyone,

just wanted to ask a silly question while I am still getting the Memory data files for you as you have requested

Why in the xfce4-taskmanager does it show my app as org.gambas. then the PID and not the application name?
Do I need to change a setting somewhere so this can be seen?

Also I have done the following in my code

Delete every time I close the database connection and now it opens when it boot up and then closes when it exits
set all DataResult to null when I am done with them
set all global.pc (picture) as null when I am done once they have all loaded onto the from

And on my development PC my memory usage sits around 55MB but on the actual customers machine it starts at 49.4MB and it keeps increasing by 0.02MB every 2 seconds

SO I am not sure what else to search for when I am looking for memory usage now
Online now: No Back to the top

Post

Posted
Rating:
#25
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
 ****** W T F ******

Well I tried a little experiment on the customers machine just now and I shit you not i have the software sitting happily at 52.5MB of RAM usage

ALL I did was NOT launch the PoS application from the boot up script

SO does anyone know how I can still use my start up script to start my apps BUT not have them spawn from the script (as I think that is what is making it use memory)

I am thinking about making a small start up program in Gambas to launch a list of set programs and then exit (is this a good idea or should i stick with the bash scripit but make it work)
Online now: No Back to the top
1 guest and 0 members have just viewed this.