Jan 29, 2014 Replies: 52 This is an example of building a data collection solution. The solution is made of three components: - (B4J) Server - Manages the data in a SQLite database. - (B4A) Device client and (B4J) desktop client - Send new data to the server and show reports. Note that you can also see the reports from any browser. In this example we want to track animals. The following type is declared in all three projects: Code: Type Animal (Name As String, Age As Double, Location As String, Date As Long) Animal objects are sent to the server. This is done with RandomAccessFile as explained here: Send and receive objects Both the server and the clients are pretty simple (check the code!). As we are using SQLite database we set the handlers to be single threaded and thus avoid issues with concurrent transactions. You can make the server accessible over the internet by following the steps described here: Upload files from your B4A app to your B4J server over the internet If you run it in the local network then you only need to open the firewall port (51042 in this example) to incoming connections. Attachments DataCollectionServer.zip DataCollectionServer.zip 4.7 KB · Views: 2,510 DataCollectionDevice.zip DataCollectionDevice.zip 8 KB · Views: 2,235 DataCollectionDesktop.zip DataCollectionDesktop.zip 2.1 KB · Views: 1,536 Last edited: Mar 5, 2018 Click to expand...
This is an example of building a data collection solution. The solution is made of three components: - (B4J) Server - Manages the data in a SQLite database. - (B4A) Device client and (B4J) desktop client - Send new data to the server and show reports. Note that you can also see the reports from any browser. In this example we want to track animals. The following type is declared in all three projects: Code: Type Animal (Name As String, Age As Double, Location As String, Date As Long) Animal objects are sent to the server. This is done with RandomAccessFile as explained here: Send and receive objects Both the server and the clients are pretty simple (check the code!). As we are using SQLite database we set the handlers to be single threaded and thus avoid issues with concurrent transactions. You can make the server accessible over the internet by following the steps described here: Upload files from your B4A app to your B4J server over the internet If you run it in the local network then you only need to open the firewall port (51042 in this example) to incoming connections.
mariomb Member Licensed User Longtime User Apr 21, 2015 #41 Ciao, ho provato tutto e tutto funziona regolarmente sul pc con emulatore. Anche dopo aver fatto una modifica in DataCollectionDevice, trasformando la riga : (link = "http://192.168.123.1:51042") in (link = "http://" & txtIP.Text & ":" & txtPort.Text) per poter modificare indirizzo ip e porta a piacimento. Quando però installo apk di DataCollectionDevice sul mio tel (huawei P6 con android 4.2.2) ricevo il seguente errore : "illegal character in authority at index 26" da cosa può dipendere? Qualcuno può aiutarmi? grazie
Ciao, ho provato tutto e tutto funziona regolarmente sul pc con emulatore. Anche dopo aver fatto una modifica in DataCollectionDevice, trasformando la riga : (link = "http://192.168.123.1:51042") in (link = "http://" & txtIP.Text & ":" & txtPort.Text) per poter modificare indirizzo ip e porta a piacimento. Quando però installo apk di DataCollectionDevice sul mio tel (huawei P6 con android 4.2.2) ricevo il seguente errore : "illegal character in authority at index 26" da cosa può dipendere? Qualcuno può aiutarmi? grazie
luke2012 Well-Known Member Licensed User Longtime User Jun 22, 2015 #42 Hi @Erel, I reproduced your solution on a windows pc. Which is the steps to reproduce the b4J server on a Raspberry PI board?
Hi @Erel, I reproduced your solution on a windows pc. Which is the steps to reproduce the b4J server on a Raspberry PI board?
Erel B4X founder Staff member Licensed User Longtime User Jun 22, 2015 #43 Please start a new thread for this question.
desof Well-Known Member Licensed User Longtime User Jun 26, 2015 #44 Hello very good your example and I'm trying to make it run but I get this error: 2015-06-26 CreateTable: CREATE TABLE IF NOT EXISTS [Animals] ([Name] TEXT, [Age] REAL, [Location] TEXT, [Date] TEXT) 2015-06-26 17:21:57.123:INFO::main: Logging initialized @288ms 2015-06-26 17:21:57.217:INFOejs.Server:main: jetty-9.1.z-SNAPSHOT 2015-06-26 17:21:57.250:WARNejh.MimeTypes:main: java.util.MissingResourceException: Can't find bundle for base name org/eclipse/jetty/http/encoding, locale es_ES 2015-06-26 17:21:57.265:INFOejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@4f4a7090{/,file:/E:/JAVA/DataCollectionServer/DataCollectionServer/Objects/www,AVAILABLE} 2015-06-26 17:21:57.269:INFOejs.AbstractNCSARequestLog:main: Opened E:\JAVA\DataCollectionServer\DataCollectionServer\Objects\logs\b4j-2015_06_26.request.log 2015-06-26 17:21:57.367:INFOejs.ServerConnector:main: Started ServerConnector@7c30a502{HTTP/1.1}{0.0.0.0:51042} 2015-06-26 17:21:57.367:INFOejs.Server:main: Started @539ms
Hello very good your example and I'm trying to make it run but I get this error: 2015-06-26 CreateTable: CREATE TABLE IF NOT EXISTS [Animals] ([Name] TEXT, [Age] REAL, [Location] TEXT, [Date] TEXT) 2015-06-26 17:21:57.123:INFO::main: Logging initialized @288ms 2015-06-26 17:21:57.217:INFOejs.Server:main: jetty-9.1.z-SNAPSHOT 2015-06-26 17:21:57.250:WARNejh.MimeTypes:main: java.util.MissingResourceException: Can't find bundle for base name org/eclipse/jetty/http/encoding, locale es_ES 2015-06-26 17:21:57.265:INFOejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@4f4a7090{/,file:/E:/JAVA/DataCollectionServer/DataCollectionServer/Objects/www,AVAILABLE} 2015-06-26 17:21:57.269:INFOejs.AbstractNCSARequestLog:main: Opened E:\JAVA\DataCollectionServer\DataCollectionServer\Objects\logs\b4j-2015_06_26.request.log 2015-06-26 17:21:57.367:INFOejs.ServerConnector:main: Started ServerConnector@7c30a502{HTTP/1.1}{0.0.0.0:51042} 2015-06-26 17:21:57.367:INFOejs.Server:main: Started @539ms
Erel B4X founder Staff member Licensed User Longtime User Jun 28, 2015 #45 This is not an error. These messages are always printed when the server is started.
MarkusR Well-Known Member Licensed User Longtime User Mar 5, 2018 #46 @Erel , please can you update DataCollectionDesktop.zip at first page to work with B4J 6.01? I replaced the message boxes and server ip etc but after start there is no window and i can not open the form designer. the DataCollectionServer part seems running well.
@Erel , please can you update DataCollectionDesktop.zip at first page to work with B4J 6.01? I replaced the message boxes and server ip etc but after start there is no window and i can not open the form designer. the DataCollectionServer part seems running well.
Erel B4X founder Staff member Licensed User Longtime User Mar 5, 2018 #47 MarkusR said: i can not open the form designer. Click to expand... It is based on scene builder so you need to install it (don't do it). The issue with WebView can be fixed by first showing the form and only then loading the layout: Java 9 and WebView (and GoogleMaps) Overall this is an old example and not so recommended anymore...
MarkusR said: i can not open the form designer. Click to expand... It is based on scene builder so you need to install it (don't do it). The issue with WebView can be fixed by first showing the form and only then loading the layout: Java 9 and WebView (and GoogleMaps) Overall this is an old example and not so recommended anymore...
MarkusR Well-Known Member Licensed User Longtime User Mar 5, 2018 #48 @Erel, i think my issue was that i can not run 2 b4j projects (server & client) from ide in debug mode. the second project waits for the debugger for connect. (i used now one in release mode) i like this example because it is all in one, pc server,pc client and mobile, data grid and database @Others i found also a nice sql lite db management tool http://sqlitebrowser.org/ Last edited: Mar 5, 2018
@Erel, i think my issue was that i can not run 2 b4j projects (server & client) from ide in debug mode. the second project waits for the debugger for connect. (i used now one in release mode) i like this example because it is all in one, pc server,pc client and mobile, data grid and database @Others i found also a nice sql lite db management tool http://sqlitebrowser.org/
A AHilton Active Member Licensed User Longtime User Mar 5, 2018 #49 MarkusR, yes you can. I start project1 (the server) in debug mode. I then start project2 (the client) in debug mode a few times (normally on the 3rd time) before it will start. As long as you don't restart the project1, project2 will restart on the first time after that initial try. It's a big pain and time waster but it's what's available to us for now. I've put in a wish list item for this problem a long time ago but the only response was to run project1 in release mode. That's not a fix.
MarkusR, yes you can. I start project1 (the server) in debug mode. I then start project2 (the client) in debug mode a few times (normally on the 3rd time) before it will start. As long as you don't restart the project1, project2 will restart on the first time after that initial try. It's a big pain and time waster but it's what's available to us for now. I've put in a wish list item for this problem a long time ago but the only response was to run project1 in release mode. That's not a fix.
Erel B4X founder Staff member Licensed User Longtime User Mar 6, 2018 #50 AHilton said: I've put in a wish list item for this problem a long time ago but the only response was to run project1 in release mode. That's not a fix. Click to expand... That's true. Only one instance can reliably run in debug mode. About the "a long time ago" statement, please note that the time a feature was requested in not considered at all (https://www.b4x.com/android/forum/threads/a-few-words-about-feature-requests.69064/#content).
AHilton said: I've put in a wish list item for this problem a long time ago but the only response was to run project1 in release mode. That's not a fix. Click to expand... That's true. Only one instance can reliably run in debug mode. About the "a long time ago" statement, please note that the time a feature was requested in not considered at all (https://www.b4x.com/android/forum/threads/a-few-words-about-feature-requests.69064/#content).
A AHilton Active Member Licensed User Longtime User Mar 6, 2018 #51 Erel said: ... please note that the time a feature was requested in not considered at all ... Click to expand... Thanks for making that clearer, Erel. The point I was making, MarkusR, is that it's a known issue. Perhaps adding your voice to the appropriate forum, B4J Bugs & Wishlist, would help. In the meantime, you have a few options... - Run your server in runtime mode and your client in debug - Run both your server and client in debug but requiring you to start your client several times each time you restart (ie change something on) your server project. - Develop your server project in a VM and your client project normally. Both in debug mode. - Develop server and client projects on 2 different machines. And that's where I'll leave it as this has diverged from the thread topic.
Erel said: ... please note that the time a feature was requested in not considered at all ... Click to expand... Thanks for making that clearer, Erel. The point I was making, MarkusR, is that it's a known issue. Perhaps adding your voice to the appropriate forum, B4J Bugs & Wishlist, would help. In the meantime, you have a few options... - Run your server in runtime mode and your client in debug - Run both your server and client in debug but requiring you to start your client several times each time you restart (ie change something on) your server project. - Develop your server project in a VM and your client project normally. Both in debug mode. - Develop server and client projects on 2 different machines. And that's where I'll leave it as this has diverged from the thread topic.
K karelespinoza New Member Licensed User Longtime User Mar 9, 2018 #52 Hello, I need help I am very new in client-server applications, I have to develop client applications in adndroid and applications in windows, that enter and update information in a database to get reports.
Hello, I need help I am very new in client-server applications, I have to develop client applications in adndroid and applications in windows, that enter and update information in a database to get reports.
Erel B4X founder Staff member Licensed User Longtime User Mar 11, 2018 #53 Please start a new thread in the questions forum.