Thursday, September 1, 2016

FTP Data Synchronization for Fun -III: syncing CSEntry data


When we have successfully set up a FileZilla FTP server on our desktop or laptop to run on a WiFi network which we named “ninjaFTP”, we are ready to complete the creation of a data communication system using CSEntry applications. Recall that we have three references for doing this last part as mentioned in FTP Data Synchronization for Fun – I:

CSPro User's Guide, pp. 143-153,Version 6.3.2 available here.
CSPro Synchronization, available here.
Synchronization File (.PNC), available here.

Based on them I tried looking for a workable solution, found something and here I am sharing them with you. And if you are as dumb as me, you may get something out of this. But if you are from a smarter lot forget about this. Or better still show us how to do it more seriously. Anyway, you should be reading those references and play with data synchronization on your own.

For the purpose of this exercise we need to have a data file. If you have your own data that will be good, but I find it convenient to cheat by borrowing a data file from the examples that come with installing CSPro 6.3 software. It is the PopstanEx.dat data file found in the directory “C:\Program Files (x86)\CSPro 6.3\Examples\3 - Tabulation\Adding Weights”.

In the CSEntry folder on my Android phone I created a folder called supervisorData and copied the PopstanEx.dat file into it. I am pretending that as a supervisor I've compiled that data file from the data sent to me from my enumerators. Now I'm going to send it to the Township Data Manager's laptop via the FTP tool created as shown in my last two posts.

First we create a synchronization script (.PNC) file called super2ninja.pnc or with whatever name you like using notepad. Just make sure it contains the following text:

[SyncFile]
Version=CSPro 6.3
Description=Receive Data from supervisor

[Connection]
Type=FTP
Host=ftp://192.168.173.1/
Username=supervisor
Password=superV@007

[Sync]
CreateServerPath=/%DeviceID%/%DateTime%/
ServerPath=/%DeviceID%/%DateTime%/
ClientPath=supervisorData
Put=PopstanEx.dat

We place the super2ninja.pnc file in the D:\CSEntry\data directory.

Next we make sure that:
  • Access point ninjaFTP on our laptop is started (see my post- FTP Data Synchronization for Fun – I: setting up a WiFi access point).
  • FileZilla FTP server is connected (see my post- FTP Data Synchronization for Fun – II: the FileZilla server).
  • Our Android phone is connected to WiFi access point.

Now to run synchronization we take the following steps (1) to (4) and connect to the FTP server.


When we tap “Connect”, we should be connected to the FTP server (5), with (6) and (7) to follow.


Then we should have the data file written to the laptop's directory D:\CSEntry\data\ under a new folder with identity of the supervisor's Android phone and the date and time as the name of the folder.


Finally, we could open the date and time folder to check if the PopstanEx.dat data file is there.

For details on the procedures, syntax of the scripts, options available, and explanation of unfamiliar terms read the references given earlier in this post. Well, I suggest plenty of learning by doing (and experimenting) while no one's looking over your shoulders!