LocationManager requestLocationUpdates minTime parameter not working - mobile

I´m working with GPS in my applicaction. It works correctly in one of my mobile phone, but when I installed the software in other mobile the "minTime" parameter of LocationManager.requestLocationUpdates not working.
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, minTime, misDistance,locationListener);
I have such as "minTime=120000" (2minutes) and "minDistance=30" (30 meters).
This fail may be due to the accuracy of the second mobile (is worse)?

The minTime parameter is just a hint, see here for more information: https://stackoverflow.com/a/4245527/1127492

Related

Sagemaker Studio trial component chart not showing

I am wondering why I am unable to show the loss and accuracy curve in Sagemaker Studio, Trial components chart.
I am using tensorflow's keras API for training.
from sagemaker.tensorflow import TensorFlow
estimator = TensorFlow(
entry_point="sm_entrypoint.sh",
source_dir=".",
role=role,
instance_count=1,
instance_type="ml.m5.4xlarge",
framework_version="2.4",
py_version="py37",
metric_definitions=[
{'Name':'train:loss', 'Regex':'loss: ([0-9.]+'},
{'Name':'val:loss', 'Regex':'val_loss: ([0-9.]+'},
{'Name':'train:accuracy', 'Regex':'accuracy: ([0-9.]+'},
{'Name':'val:accuracy', 'Regex':'val_accuracy: ([0-9.]+'}
],
enable_sagemaker_metrics=True
)
estimator.fit(
inputs="s3://xxx",
experiment_config={
"ExperimentName": "urbansounds-20211027",
"TrialName": "tf-classical-NN-20211027",
"TrialComponentDisplayName": "Train"
}
)
Regex is enabled, and appears to be logging them correctly. Since under the metrics tab, it shows 12 counts for each metric, corresponding to 12 epochs cycle which I specified.
However, the chart is empty. The x-axis is in time here, but it is also empty when I switched to epoch.
tldr: in your entry_point source code sm_entrypoint.sh, you need to explicitly inform the experiment tracker which epoch the metric is associated with, using the log_metric() function.
There are two ways tracker work in SageMaker Experiment Tracker: (1) you log the metric in your entry_point code, and use metric_definitions argument in the estimator to teach SM to parse the metric from the logs, as the way you did it, or, you can (2) explicitly create a Tracker instance inside your entry_point, and invoke the log_metric() method. Apparently only method (2) tells SM Tracker what epoch each metric entry is registered to.
I found the answer from a random video https://youtu.be/gMnkfPztIHU?t=141, after days of search :(
Oh there is also a catch: SageMaker images do not have the Tracker package installed, so if you just have from smexperiments.tracker import Tracker in your entry_point source code, your SM Estimator will complain. So you will need to install sagemaker-experiments for your image, by
create a requirements.txt file that has sagemaker-experiments==0.1.35 in it;
specify the source dir by including source_dir="./dir_that_contains_requirements.txt" in your estimator creation.

Get Sencha Touch Platform Name

console.log(Ext.os.Name)
prints the name for OS("Windows"==>in windows machine) for all browser,
But I want to know there is anyway to get the current Platform("chrome","safari","firefox","windows","ios","ios-classic") value based upon the theme currently loaded by sencha.
Because i need configure some of my component based on the browser also.
I dont need Browser name or os name, i need the platform variable used
by sencha framework. like when we using the ios6 it will take the
platform parameter as ios-classic we also pass the platform parameter
in link like http://cdn.sencha.com/touch/sencha-touch-2.3.1a/built-examples/kitchensink/index.html?platform=ios-classic# or
http://cdn.sencha.com/touch/sencha-touch-2.3.1a/built-examples/kitchensink/index.html?platform=windows# this will load the ios6 and windows theme respectively even we use any kind of browser in any OS.
you can use Ext.browser
console.log(Ext.browser.name);
console.log(Ext.browser.version);
Ext.device will not work for browser as it works only for native packing.
you can get what theme is applied by using Ext.theme.name
Ext.theme.name
getting platform for them is not directly provided in Sencha Touch. you can check implementation for that in sencha\app\microloader
I found the following configurations on http://docs-origin.sencha.com/extjs/4.2.2/#!/api/Ext , from that what i have observed is, we can't find the browser's name but we can check whether it is chrome or else like that...
example :
console.log(Ext.isWindows);
true //because i am working in windows
chromeVersion
firefoxVersion
ieVersion
isChrome
isFF10
isFF3_0
isFF3_5
isFF3_6
isFF4
isFF5
isGecko
isGecko10
isGecko3
isGecko4
isGecko5
isIE
isIE10
isIE10m
isIE10p
isIE11
isIE11m
isIE11p
isIE6
isIE7
isIE7m
isIE7p
isIE8
isIE8m
isIE8p
isIE9
isIE9m
isIE9p
isLinux
isMac
isOpera
isOpera10_5
isSafari
isSafari2
isSafari3
isSafari4
isSafari5
isSafari5_0
isWebKit
isWindows
name
operaVersion
safariVersion
In Sencha Touch 2.3 the Ext.device.Device singleton will give you information on the platform and the Ext.device.Browser will give you information on the browser.

I am getting 'ZZ' as country code when using pytz

I am using App engine, and I'm trying to get the time zone from the request.
However when on local host it always seems to return 'ZZ' as the country code which is not a country in pytz library.
This code:
country = self.request.headers['X-Appengine-Country']
logging.info(country)
tz = pytz.country_timezones(country)
produces this error:
return self.data[key.upper()]
KeyError: 'ZZ'
many thanks for your help
'ZZ' is often used to denote 'Unknown or unspecified country'
There is also a numeric version of the two letter code, calculated as 1070+30a+b, where a and b are the two letters of the code converted by A=1, B=2, etc. So AA=1101, AB=1102, BA=1131, and ZZ=1876.
I suggest that you use the correct case for the Request Header names. For e.g. X-AppEngine-Country
However, in the local development environment - I do not think the Location features will be supported i.e. you will not get the correct values. These should work only on the deployment environment. The Location is most likely provided by a Google Service that is internal to the Google Network and not exposed in the Local Development Environment.
Try to deploy your code to the live environment and check the values.

iOS 7 - Get Unique ID in C

Can you help me on the below issue
on iOS 6.x, I used gethostuuid system call to get unique ID of iDevice, I just wonder if my app submit for iOS 7.x, it will be rejected by calling this api (gethostuuid)?
Is there any way to get Unique ID on iOS 7 (using C language) instead of calling gethostuuid?
Thanks.
If you want to get your app specific Unique key
why not try this
UIDevice *myDevice=[UIDevice currentDevice];
NSString *UUID = [[myDevice identifierForVendor] UUIDString];
KeyChainItemWrapper.h may help
you can see:
https://developer.apple.com/library/ios/samplecode/GenericKeychain/Listings/Classes_KeychainItemWrapper_m.html

chan->cdr no data after upgrade from Asterisk 1.4.21

I have a legacy Asterisk application in C which does authentication of users, routing and billing using MySQL. I have kept it with Asterisk 1.4.21 because none of the CDR data is returned in newer versions of Asterisk.
Apparently there have been some changes in 1.4.22 https://issues.asterisk.org/jira/browse/ASTERISK-13064 that have completely changed the way CDR-s are handled. Unfortunately no helpful information was given on how to properly migrate existing code.
They have changed the order of execution, the 'h' extension is called and the CDR data is reset.
My code:
ast_log(LOG_NOTICE,"Dialing string: '%s'\n", dialstr);
app = pbx_findapp("Dial");
if (app)
res = pbx_exec(chan, app, dialstr);
ast_log(LOG_NOTICE,"Return from pbx_exec '%i', Disposition: '%s'\n", res, ast_cdr_disp2str(chan->cdr->disposition));
Other parts of the code handle chan->cdr->billsec etc, but it always gives 0 values.
After a successful call I always get this log from CLI:
Return from pbx_exec '-1', Disposition: 'NO ANSWER' while the same code works fine on 1.4.21
One solution I heard is to use ast_reset() before Dial but I am not sure how to implement it.
Any help on how to adapt this application?
You can just get DIALSTATUS variable,that is enought for you application and will be supported in future releases.
pbx_builtin_getvar_helper(chan, "DIALSTATUS");

Resources