Platforms to show: All Mac Windows Linux Cross-Platform
/Main/Web Edition Examples/Infos Web1
Function:
Required plugins for this example: MBS Linux Plugin, MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Main/Web Edition Examples/Infos Web1
This example is the version from Tue, 30th Sep 2013.
Function:
Required plugins for this example: MBS Linux Plugin, MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Main/Web Edition Examples/Infos Web1
This example is the version from Tue, 30th Sep 2013.
Project "Infos Web1.xojo_binary_project"
Class App Inherits WebApplication
EventHandler Sub Open()
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 Open()
me.text = "Compiled with Real Studio "+RBVersionString+" and MBS Real Studio Plugins "+mbs.VersionString
End EventHandler
End Control
Control Timer1 Inherits WebTimer
ControlInstance Timer1 Inherits WebTimer
EventHandler Sub Action()
AutoUpdate
End EventHandler
End Control
EventHandler Sub Open()
update
End EventHandler
Sub AutoUpdate()
dim d as new date
List.Cell(0,1) = d.LongDate+" "+d.LongTime
List.Cell(2,1) = str(app.SessionCount)
dim l as new LinuxSysInfoMBS
if l.Valid = false then
Return
end if
list.Cell( FindIndex("NumberOfProcesses"), 1) = str(l.NumberOfProcesses)
list.Cell( 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.Cell( n, 1) = str(l.availablePhysicalPages)+" pages"
list.Cell( n+1, 1) = str(l.upTime)+" seconds"
list.Cell( n+2, 1) = str(Days)+" days, "+str(hours)+" hours, "+str(minutes)+" minutes, "+str(seconds)+" seconds"
list.Cell( n+3, 1) = str(l.loads(0))
list.Cell( n+4, 1) = str(l.loads(1))
list.Cell( n+5, 1) = str(l.loads(2))
list.Cell( n+6, 1) = format(l.TotalRam / MB, "0.0") + " MB"
list.Cell( n+7, 1) = format(l.FreeRam / MB, "0.0") + " MB"
list.Cell( n+8, 1) = format(l.SharedRam / MB, "0.0") + " MB"
list.Cell( n+9, 1) = format(l.BufferRam / MB, "0.0") + " MB"
list.Cell( n+10, 1) = format(l.TotalSwap / MB, "0.0") + " MB"
list.Cell( n+11, 1) = format(l.FreeSwap / MB, "0.0") + " MB"
list.Cell( n+12, 1) = format(l.TotalHigh / MB, "0.0") + " MB"
list.Cell( 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.Cell(i, 0) = name then
Return i
end if
next
End Function
Function GetBrowserName(s as WebSession.BrowserType) As string
Select case s
case WebSession.BrowserType.Android
Return "Andriod"
case WebSession.BrowserType.Blackberry
Return "Blackberry"
case WebSession.BrowserType.Chrome
Return "Chrome"
case WebSession.BrowserType.ChromeOS
Return "ChromeOS"
case WebSession.BrowserType.Firefox
Return "Firefox"
case WebSession.BrowserType.InternetExplorer
Return "InternetExplorer"
case WebSession.BrowserType.Opera
Return "Opera"
case WebSession.BrowserType.Safari
Return "Safari"
case WebSession.BrowserType.SafariMobile
Return "SafariMobile"
case WebSession.BrowserType.Unknown
Return "Unknown"
else
Return "Unkown: "+str(integer(s))
end Select
End Function
Function GetPlatformName(s as WebSession.PlatformType) As string
Select case s
case WebSession.PlatformType.AndroidPhone
Return "AndroidPhone"
case WebSession.PlatformType.AndroidTablet
Return "AndroidTablet"
case WebSession.PlatformType.Blackberry
Return "Blackberry"
case WebSession.PlatformType.iPad
Return "iPad"
case WebSession.PlatformType.iPhone
Return "iPhone"
case WebSession.PlatformType.iPodTouch
Return "iPodTouch"
case WebSession.PlatformType.Linux
Return "Linux"
case WebSession.PlatformType.Macintosh
Return "Macintosh"
case WebSession.PlatformType.PS3
Return "PS3"
case WebSession.PlatformType.Unknown
Return "Unknown"
case WebSession.PlatformType.WebOS
Return "WebOS"
case WebSession.PlatformType.Wii
Return "Wii"
case WebSession.PlatformType.Windows
Return "Windows"
else
Return "Unkown: "+str(integer(s))
end Select
End Function
Function GetRenderingEngineName(s as WebSession.EngineType) As string
Select case s
case WebSession.EngineType.Gecko
Return "Gecko"
case WebSession.EngineType.Presto
Return "Presto"
case WebSession.EngineType.Trident
Return "Trident"
case WebSession.EngineType.Unknown
Return "Unknown"
case WebSession.EngineType.WebKit
Return "WebKit"
else
Return "Unkown: "+str(integer(s))
end Select
End Function
Sub Update()
dim mysession as Session = Session
list.DeleteAllRows
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.HeaderName(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:
- /Main/Web Edition Examples/Infos Web2
- /Main/Web Edition Examples/Invisible FileUploader with Button Web1
- /Main/Web Edition Examples/Little database sample Web1
- /Main/Web Edition Examples/Music in Web App Web1
- /Main/Web Edition Examples/TicTacToe game/TicTacToe game Web1
- /Main/Web Edition Examples/TicTacToe game/TicTacToe game Web2
- /Main/Web Edition Examples/WebApp with missing pictures Web1
- /Main/Web Loadbalancer Example/MyApp
The items on this page are in the following plugins: MBS Main Plugin.
Feedback: Report problem or ask question.