Platforms to show: All Mac Windows Linux Cross-Platform
/Main/Web Edition Examples/Infos Web
Required plugins for this example: MBS Util Plugin, MBS Linux Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Main/Web Edition Examples/Infos Web
This example is the version from Mon, 16th Jan 2022.
Project "Infos Web.xojo_binary_project"
Class App Inherits WebApplication
EventHandler Sub Opening(args() as String)
startdate = New date
' register plugins here
End EventHandler
Property StartDate As date
End Class
Class Session Inherits WebSession
Const ErrorDialogCancel = "Do Not Send"
Const ErrorDialogMessage = "This application has encountered an error and cannot continue."
Const ErrorDialogQuestion = "Please describe what you were doing right before the error occurred:"
Const ErrorDialogSubmit = "Send"
Const ErrorThankYou = "Thank You"
Const ErrorThankYouMessage = "Your feedback helps us make improvements."
Const NoJavascriptInstructions = "To turn Javascript on, please refer to your browser settings window."
Const NoJavascriptMessage = "Javascript must be enabled to access this page."
End Class
Class WebPage1 Inherits WebPage
Control List Inherits WebListBox
ControlInstance List Inherits WebListBox
End Control
Control Label1 Inherits WebLabel
ControlInstance Label1 Inherits WebLabel
End Control
Control Link1 Inherits WebLink
ControlInstance Link1 Inherits WebLink
End Control
Control Label2 Inherits WebLabel
ControlInstance Label2 Inherits WebLabel
EventHandler Sub Opening()
me.text = "Compiled with Real Studio "+XojoVersionString+" and MBS Real Studio Plugins "+mbs.VersionString
End EventHandler
End Control
Control Timer1 Inherits WebTimer
ControlInstance Timer1 Inherits WebTimer
EventHandler Sub Run()
AutoUpdate
End EventHandler
End Control
EventHandler Sub Opening()
update
End EventHandler
Sub AutoUpdate()
Dim d As New date
List.CellValueAt(0,1) = d.LongDate+" "+d.LongTime
List.CellValueAt(2,1) = str(app.SessionCount)
// linux system info follows
Dim l As New LinuxSysInfoMBS
if l.Valid = false then
Return
end if
list.CellValueAt( FindIndex("NumberOfProcesses"), 1) = str(l.NumberOfProcesses)
list.CellValueAt( FindIndex("availablePhysicalPages"), 1) = str(l.availablePhysicalPages)+" pages"
dim MB as double = 1024*1024
dim n as integer = l.upTime
dim seconds as integer = n mod 60
n = n \ 60
dim minutes as integer = n mod 60
n = n \ 60
dim hours as integer = n mod 24
n = n \ 24
dim days as integer = n
n = FindIndex("availablePhysicalPages")
list.CellValueAt( n, 1) = str(l.availablePhysicalPages)+" pages"
list.CellValueAt( n+1, 1) = str(l.upTime)+" seconds"
list.CellValueAt( n+2, 1) = str(Days)+" days, "+str(hours)+" hours, "+str(minutes)+" minutes, "+str(seconds)+" seconds"
list.CellValueAt( n+3, 1) = str(l.loads(0))
list.CellValueAt( n+4, 1) = str(l.loads(1))
list.CellValueAt( n+5, 1) = str(l.loads(2))
list.CellValueAt( n+6, 1) = format(l.TotalRam / MB, "0.0") + " MB"
list.CellValueAt( n+7, 1) = format(l.FreeRam / MB, "0.0") + " MB"
list.CellValueAt( n+8, 1) = format(l.SharedRam / MB, "0.0") + " MB"
list.CellValueAt( n+9, 1) = format(l.BufferRam / MB, "0.0") + " MB"
list.CellValueAt( n+10, 1) = format(l.TotalSwap / MB, "0.0") + " MB"
list.CellValueAt( n+11, 1) = format(l.FreeSwap / MB, "0.0") + " MB"
list.CellValueAt( n+12, 1) = format(l.TotalHigh / MB, "0.0") + " MB"
list.CellValueAt( n+13, 1) = format(l.FreeHigh / MB, "0.0") + " MB"
End Sub
Function FindIndex(name as string) As integer
dim c as integer = List.RowCount-1
for i as integer = 0 to c
if List.CellValueAt(i, 0) = name then
Return i
end if
next
End Function
Sub Update()
dim mysession as Session = Session
list.RemoveAllRows
dim d as new date
List.AddRow "Time on Server:", d.LongDate+" "+d.LongTime
List.AddRow "Web App running since:", app.StartDate.LongDate+" "+app.StartDate.LongTime
List.AddRow "Number of sessions:", str(app.SessionCount)
'List.AddRow "Detected Browser", GetBrowserName(mysession.Browser)
'List.AddRow "Detected Platform", GetPlatformName(mysession.Platform)
'List.AddRow "Detected Rendering Engine", GetRenderingEngineName(mysession.RenderingEngine)
List.AddRow "Detected Remote Address", mysession.RemoteAddress
// you need MBS Real Studio Util Plugin
List.AddRow "Computer Name",SystemInformationMBS.ComputerName
List.AddRow "CPU Brand String",SystemInformationMBS.CPUBrandString
List.AddRow "Processor Count", str(SystemInformationMBS.ProcessorCount)
list.AddRow "Header", str(mysession.HeaderCount)
dim u as integer = mysession.HeaderCount
for i as integer = 0 to u-1
dim h as string = mysession.HeaderAt(i)
List.AddRow h, mysession.Header(h)
next
list.AddRow "URL Parameter", str(mysession.URLParameterCount)
u = mysession.URLParameterCount
for i as integer = 0 to u-1
dim h as string = mysession.URLParameterName(i)
List.AddRow h, mysession.URLParameter(h)
next
dim l as new LinuxSysInfoMBS
if l.Valid = false then
Return
end if
List.AddRow "NumberOfProcesses", str(l.NumberOfProcesses)
List.AddRow "NumberOfProcessors", str(l.NumberOfProcessors)
List.AddRow "NumberOfProcessorsConfigured", str(l.NumberOfProcessorsConfigured)
List.AddRow "PhysicalPages", str(l.PhysicalPages)+" pages"
List.AddRow "availablePhysicalPages", str(l.availablePhysicalPages)+" pages"
dim n as integer = l.upTime
dim seconds as integer = n mod 60
n = n \ 60
dim minutes as integer = n mod 60
n = n \ 60
dim hours as integer = n mod 24
n = n \ 24
dim days as integer = n
List.AddRow "upTime", str(l.upTime)+" seconds"
List.AddRow "", str(Days)+" days, "+str(hours)+" hours, "+str(minutes)+" minutes, "+str(seconds)+" seconds"
List.AddRow "loads 1 min", str(l.loads(0))
List.AddRow "loads 5 min", str(l.loads(1))
List.AddRow "loads 15 min", str(l.loads(2))
dim MB as double = 1024*1024
List.AddRow "TotalRam", format(l.TotalRam / MB, "0.0") + " MB"
List.AddRow "FreeRam", format(l.FreeRam / MB, "0.0") + " MB"
List.AddRow "SharedRam", format(l.SharedRam / MB, "0.0") + " MB"
List.AddRow "BufferRam", format(l.BufferRam / MB, "0.0") + " MB"
List.AddRow "TotalSwap", format(l.TotalSwap / MB, "0.0") + " MB"
List.AddRow "FreeSwap", format(l.FreeSwap / MB, "0.0") + " MB"
List.AddRow "TotalHigh", format(l.TotalHigh / MB, "0.0") + " MB"
List.AddRow "FreeHigh", format(l.FreeHigh / MB, "0.0") + " MB"
End Sub
End Class
End Project
See also:
The items on this page are in the following plugins: MBS Main Plugin.