It works fine!!
Well, finally I got it... I'm really happy! The two aplications which I have used SQLite will be much better now.
All written below is calculated for a Airis pda, 400 mhz.
1)
Database of medicines (26000 rows of 100 chars).-
Case a) To find the medicine code (it's not ordered)
Before: It takes me around 1 second
Now: I've learned the importance of having a index at the
end of a book... Indexing: 0.07 seconds/search. Around 14 times
quicker
Case b) To find the medicine name(name are ordered)
Before: I didn't know how to do it, so i did it by conventional searching
sentences. It taked around 9 seconds.
Now: I've learned the GLOB and LIKE properties... 0.13 sec without
index, 0.06 indexing. Around 150 times faster!!
Case c) To find a substring of the medicine name
Before: The same time: 9 seconds
Now: 2.5 sec without and with indexing
2)
Database of radars
360 degrees are equivalent to around 40.000 kms of circumference.
1 degree------------------------------------- X kms
X=111,111111 km/degree ;
111,111111 km ------------------------------ 1 degree
1 km ------------------------------ x degree
X=0.009 --> 0,01 aprox. deg/km
-The necesary precision for our navigator is 0,01 deg (it will be desirable that sounds when distance<1 km...)
-The GPS library shows an innecesary number of decimals. Precision of 1 meter needs only 6 decimal (near 5... because 0.000009). But for our navigator is necesary only two.
-Before this post, I used to do this by calculating distance between two near points like if earth was plane (oh God, in this time I should be in the bonfire...
):
distance=sqrt((x1-x2)^2+(y1-y2)^2)
it can be approximate by dist=abs(x1-x2)+abs(y1-y2)... In the worse case the distance will not be 1 km, but some more: 1,4 km...
This funtion penalize the time to calculate finding a posible radar near my coordinates.
-After this post, I have a trick: GLOB : SELECT speed_of_radar FROM speedcam WHERE coorx GLOB ('"&posx&"*') AND coory('"&posy&"*')
Previously I had formatted posx and poxy: format(posx,"n2") and posy the same, and posx & posy are our GPS longitude and latitude.
Before: 4 seconds
Now: 0.12 seconds-------> 33 times faster...
I am very grateful to you, RB Smissaert for your great help. Thanks very much.
PD: Lately I have known that some cars of great range have an utility that consist in to be able to call to emergency number if the driver has an accident. Of course that cars are equiped of sensors, but I think that some types of accidents would be able to detect by our pda: Ex. stopping too quickly until vel=0, or better stipulate time to destination. If time is bigger than estipulate ask for some problem: button no--> no problem. No answer:---> sms to family with coordinates and/or calling 112...