Hi,
I found android tends to delay executing some commands, such as deleting files. Have you done any test that, if i use setfile () to bind external dictionary with one dataset, and then change it to another dataset, is it also delayed?
I ask this because that we plan to do RSI woman on one device, and RSI man on another one. Then I would like to save RSI information into the woman file first and then man file.
best
Jing
android tends to delay executing some command
-
Jing Liu
- Posts: 42
- Joined: July 1st, 2015, 3:19 am
-
josh
- Posts: 2403
- Joined: May 5th, 2014, 12:49 pm
- Location: Washington DC
Re: android tends to delay executing some command
How are you seeing this delay? filedelete is something that should execute immediately on both Windows and Android, same with setfile. Can you give us steps to reproduce the problem?
-
Jing Liu
- Posts: 42
- Joined: July 1st, 2015, 3:19 am
Re: android tends to delay executing some command
Hi,
I have a entry_menu.ent to control the data entry ent.
I create loop between the entry_menu.ent and the data entry ent. So when the interviewer stop one interview (or partial save), it will directly go back to the entry_menu.
I wanna also only the entry_menu option to be shown to the interviewer, so i decide to delete the pff file everytime when the data entry is closed.
I have this in the beginning of the entry_menu, so theoretically, everytime the entry_menu is activated, the pff file should be invisible if it were deleted immediately.
FileDel( concat( strip(DirEntry), "\", strip(HHentryEnt), ".pff" ));
But sometimes, if I shut down the entry_menu just after it is activated for the new loop. the data entry pff is still visible there.
I am sorry, I would like to share you the program. But I have made the code bind to a lot files, to unbind them and make it work on your laptop takes a bit work. If you really need that, I will send you later, is that ok?
best
Jing
I have a entry_menu.ent to control the data entry ent.
I create loop between the entry_menu.ent and the data entry ent. So when the interviewer stop one interview (or partial save), it will directly go back to the entry_menu.
I wanna also only the entry_menu option to be shown to the interviewer, so i decide to delete the pff file everytime when the data entry is closed.
I have this in the beginning of the entry_menu, so theoretically, everytime the entry_menu is activated, the pff file should be invisible if it were deleted immediately.
FileDel( concat( strip(DirEntry), "\", strip(HHentryEnt), ".pff" ));
But sometimes, if I shut down the entry_menu just after it is activated for the new loop. the data entry pff is still visible there.
I am sorry, I would like to share you the program. But I have made the code bind to a lot files, to unbind them and make it work on your laptop takes a bit work. If you really need that, I will send you later, is that ok?
best
Jing
-
josh
- Posts: 2403
- Joined: May 5th, 2014, 12:49 pm
- Location: Washington DC
Re: android tends to delay executing some command
My guess is that the pff file is getting deleted from the disk, however the applications list screen doesn't get updated when you go back to it so the deleted pff is still listed there.
The way I usually handle the data entry pff in menu systems to write it to the temp directory. That way it never shows up in the list of applications but you can still launch it with execpff from the menu program. The applications list only shows pff files that are in the CSEntry directory and its subdirectories so putting it in the temp directory leaves it out of the list. You can use pathname(Temp) to get the path to the temp directory.
The way I usually handle the data entry pff in menu systems to write it to the temp directory. That way it never shows up in the list of applications but you can still launch it with execpff from the menu program. The applications list only shows pff files that are in the CSEntry directory and its subdirectories so putting it in the temp directory leaves it out of the list. You can use pathname(Temp) to get the path to the temp directory.
-
Jing Liu
- Posts: 42
- Joined: July 1st, 2015, 3:19 am
Re: android tends to delay executing some command
Hi,
I have created some other sub folder in /CSEntry, but the pff file in those folders will also shows up on screen. Is folder 'temp' different?
By the way, may I ask you another question?
I want to randomly select two households for rechecking questionnaire. And I would like them to be store in a dat file. And as long as the file is generated for a certain cluster, we will not change it. So I wrote the following code.
CountHHfin( ECLUSTER ) gives you how many households have been completed in cluster. I got 11 there with my testing. And then I found I always get 5 and 10 there. Both random() and randomin() give me 5 and 10. I tested it for a few times, but always 5 and 10. Do you know why?
best
Jing
{Select 2 households for Rechecking questionnaire if more than 10 households are complete}
NumHHfin = CountHHfin( ECLUSTER );
if NumHHfin in 0:10 then
errmsg( "There are only %d households complete in cluster %03d, rechecking cannot start with less than 10 complete households", NumHHfin, ECLUSTER );
reenter;
endif;
//Set recheck information file
if FileExist( concat( strip(DirRef), "RECHECKclus", strip(xCluster), ".dat" ) ) = 0 then
FileCreate( concat( strip(DirRef), "RECHECKclus", strip(xCluster), ".dat" ) );
endif;
setfile( RECHECKCLUS_DICT, concat( strip(DirRef), "RECHECKclus", strip(xCluster), ".dat" ) );
//Only do random selection when the file has not been written before}
if FileEmpty( concat( strip(DirRef), "RECHECKclus", strip(xCluster), ".dat" ) ) = 1 then
open( RECHECKCLUS_DICT );
errmsg("numhhfin is %d", NumHHfin );
i = randomin( 1:NumHHfin );
//i = random (1,11);
errmsg( "%d", i);
RCKHHID = ArryHH (i);
RCKRSWID = ArryRSW (i);
RCKRSMID = ArryRSM (i);
WriteCase( RECHECKCLUS_DICT, RCKHHID );
do varying j=1 while j<=10
i = random( 1, NumHHfin );
//i = random (1, 11);
errmsg( "j is %d, i is %d", j, i);
if ArryHH (i) <> RCKHHID then
break;
endif;
enddo;
RCKHHID = ArryHH (i);
RCKRSWID = ArryRSW (i);
RCKRSMID = ArryRSM (i);
WriteCase( RECHECKCLUS_DICT, RCKHHID );
close( RECHECKCLUS_DICT );
endif;
I have created some other sub folder in /CSEntry, but the pff file in those folders will also shows up on screen. Is folder 'temp' different?
By the way, may I ask you another question?
I want to randomly select two households for rechecking questionnaire. And I would like them to be store in a dat file. And as long as the file is generated for a certain cluster, we will not change it. So I wrote the following code.
CountHHfin( ECLUSTER ) gives you how many households have been completed in cluster. I got 11 there with my testing. And then I found I always get 5 and 10 there. Both random() and randomin() give me 5 and 10. I tested it for a few times, but always 5 and 10. Do you know why?
best
Jing
{Select 2 households for Rechecking questionnaire if more than 10 households are complete}
NumHHfin = CountHHfin( ECLUSTER );
if NumHHfin in 0:10 then
errmsg( "There are only %d households complete in cluster %03d, rechecking cannot start with less than 10 complete households", NumHHfin, ECLUSTER );
reenter;
endif;
//Set recheck information file
if FileExist( concat( strip(DirRef), "RECHECKclus", strip(xCluster), ".dat" ) ) = 0 then
FileCreate( concat( strip(DirRef), "RECHECKclus", strip(xCluster), ".dat" ) );
endif;
setfile( RECHECKCLUS_DICT, concat( strip(DirRef), "RECHECKclus", strip(xCluster), ".dat" ) );
//Only do random selection when the file has not been written before}
if FileEmpty( concat( strip(DirRef), "RECHECKclus", strip(xCluster), ".dat" ) ) = 1 then
open( RECHECKCLUS_DICT );
errmsg("numhhfin is %d", NumHHfin );
i = randomin( 1:NumHHfin );
//i = random (1,11);
errmsg( "%d", i);
RCKHHID = ArryHH (i);
RCKRSWID = ArryRSW (i);
RCKRSMID = ArryRSM (i);
WriteCase( RECHECKCLUS_DICT, RCKHHID );
do varying j=1 while j<=10
i = random( 1, NumHHfin );
//i = random (1, 11);
errmsg( "j is %d, i is %d", j, i);
if ArryHH (i) <> RCKHHID then
break;
endif;
enddo;
RCKHHID = ArryHH (i);
RCKRSWID = ArryRSW (i);
RCKRSMID = ArryRSM (i);
WriteCase( RECHECKCLUS_DICT, RCKHHID );
close( RECHECKCLUS_DICT );
endif;
-
josh
- Posts: 2403
- Joined: May 5th, 2014, 12:49 pm
- Location: Washington DC
Re: android tends to delay executing some command
The temp directory is not a subfolder of csentry - it is outside CSEntry.
Are you using seed() at the start of your program? CSPro will always generate the same sequence of random numbers. To get a different sequence of numbers you need to call seed with a different value each time. An easy way to do this is to call seed(systtime()) at the start of the program.
Are you using seed() at the start of your program? CSPro will always generate the same sequence of random numbers. To get a different sequence of numbers you need to call seed with a different value each time. An easy way to do this is to call seed(systtime()) at the start of the program.
-
Jing Liu
- Posts: 42
- Joined: July 1st, 2015, 3:19 am
Re: android tends to delay executing some command
Hi Josh,
Thanks! Now I get different random results.
best
Jing
Thanks! Now I get different random results.
best
Jing