I got wrong value when using Gson in some Android devices.
Below is json
JSON
{'Time':'1900-01-01T11:00:00.000+08:00'}
Below is my code for testing
new GsonBuilder().create().fromJson("{'Time':'1904-01-01T11:00:00.000+08:00'}", Info.class);
The result is in correct: Fri Jan 01 10:36:42 GMT+08:00 1904
new GsonBuilder().create().fromJson("{'Time':'1905-01-01T11:00:00.000+08:00'}", Info.class);
The result is correct: Sun Jan 01 11:00:00 GMT+08:00 1905
The android version is 10 (API 29), MIUI 12
May I know anybody has this issue
I try to change the version while publishing a android project to my local maven repository.
Simple publishing works fine with./gradlew publishToMavenLocal.
While researching I found out that it should be possible to override the version number of my maven package on executing the publishing process. But when executing for example publishToMavenLocal -Pversion="asdf" this does not change the version in anyway. it seems like it is ignored.
I got the idea of the -Pversion flag from the comments of this post
Furthermore also the gradle docs say that it should be possible to override the version in some way when building it:
Overriding the default identity values is easy: simply specify the
groupId, artifactId or version attributes when configuring the
MavenPublication.
i don't know if i got anything wrong but is there a way to override the version of a maven package. Also publishing something like -SNAPSHOT to my local maven repo would help me a lot.
It works for me with Gradle 7.6.
$./gradlew publishToMavenLocal -Pversion=31
...
BUILD SUCCESSFUL in 1s
21 actionable tasks: 18 executed, 3 up-to-date
$ls -al ~/.m2/repository/com/foo/bar/client
total 8
drwxr-xr-x 4 johnkramer staff 128 Jan 26 18:05 .
drwxr-xr-x 5 johnkramer staff 160 Jan 26 18:05 ..
drwxr-xr-x 6 johnkramer staff 192 Jan 26 18:05 31
-rw-r--r-- 1 johnkramer staff 334 Jan 26 18:05 maven-metadata-local.xml
My app runs on all devices and simulators Except Samsung SM-A500W. It just failed to update the database. The access to the database is through php scripts stored in a TLD secure domain (Access only through httpS).
The failure is because it thinks the expiration date of the certificate is passed....not true. See LogCat.
10-25 11:07:18.381 25547-25617/uro2.tradersmicro.com.uro2 D/Uploadi16: Exception jb: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate: Certificate expired at Sat Feb 18 18:59:59 EST 2017 (compared to Thu Oct 25 11:07:18 EDT 2018) javax.net.ssl.SSLHandshakeException: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate: Certificate expired at Sat Feb 18 18:59:59 EST 2017 (compared to Thu Oct 25 11:07:18 EDT 2018)
BTW. One of the fragments of my app uses a WebView. The secure database access in this part is normal.
Is there a way to avoid this error?
The way I found to circumvent this problem is to copy the php scripts to a Non Secure Domain, and ensure that they get updated as the scripts are updated.
At run time:- in the try...catch of the database access to change the domain to the insecure one. So far works like a charm.
Of course the database access occurs in an Async task, it seems ok to call the method again, recursively from the catch code.
I would suggest trying to update the device security provider using the Google Play Service:
https://developer.android.com/training/articles/security-gms-provider
import com.google.android.gms.security.ProviderInstaller;
// ....
try {
ProviderInstaller.installIfNeeded(getContext());
} catch (GooglePlayServicesRepairableException e) {
// TODO handle error
}
I'm running CouchDB with Yocto Dizzy on a LogicPD Torpedo with a 1GHz processor. I have multiple Android devices connected, making changes, and syncing with this database through some Java and Nodejs code. For the most part, it looks like the database is replicating properly across all devices.
However, I do have a frequent issue where a device will fall out of sync and the Android app on that device will have to be restarted. By "fall out of sync" I mean that changes are being made on one device, synced to the database, and not showing up on another device. I'm trying to troubleshoot this problem and I haven't been able to find any errors on the Android side. The errors I'm seeing in the CouchDB log are:
[Fri, 25 Sep 2015 14:47:59 GMT] [error] [<0.222.0>] ** Generic server <0.222.0> terminating
** Last message in was {'EXIT',<0.217.0>,killed}
** When Server state == {state,"http://X.XXX.X.X:XXXX/task/",20,[],
[<0.338.0>],
{[],[]}}
** Reason for termination ==
** killed
[Fri, 25 Sep 2015 14:47:59 GMT] [error] [<0.222.0>] {error_report,<0.31.0>,
{<0.222.0>,crash_report,
[[{initial_call,
{couch_replicator_httpc_pool,init,['Argument__1']}},
{pid,<0.222.0>},
{registered_name,[]},
{error_info,
{exit,killed,
[{gen_server,terminate,7,
[{file,"gen_server.erl"},{line,804}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,237}]}]}},
{ancestors,
[<0.217.0>,couch_replicator_job_sup,
couch_primary_services,couch_server_sup,<0.32.0>]},
{messages,[]},
{links,[<0.338.0>]},
{dictionary,[]},
{trap_exit,true},
{status,running},
{heap_size,610},
{stack_size,27},
{reductions,390}],
[]]}}
[Fri, 25 Sep 2015 14:48:06 GMT] [error] [<0.130.0>] Error in replication `b16486bad369b219600dbd5bf0478e81+continuous+create_target` (triggered by document `9be140c9aa6334820aed80fa910275e4`): timeout
Restarting replication in 5 seconds.
[Fri, 25 Sep 2015 14:48:06 GMT] [error] [<0.88.0>] {error_report,<0.31.0>,
{<0.88.0>,supervisor_report,
[{supervisor,{local,couch_replicator_job_sup}},
{errorContext,shutdown_error},
{reason,killed},
{offender,
[{pid,<0.157.0>},
{name,
"98e4832e6f31a0962493d26092b5fe4e+continuous+create_target"},
{mfargs,{gen_server,start_link,undefined}},
{restart_type,temporary},
{shutdown,250},
{child_type,worker}]}]}}
When running the same programs and database on CentOS with an i7, it all works perfectly. I've tried mucking with tcp/ip kernel settings, as well as CouchDBs settings (local.ini, specifically os_process and timeout options).
Does anyone have any experience in this area? Any help would be greatly appreciated!
I'm trying to run an os.system() call from my Python class to source a file I have stored in the file. I am connecting to a server from an Android application and running a method in Django to run a system call. The server is running Apache with mod_wsgi to deploy Django. This is the Django method:
def post_try(request):
os.chdir("/usr/local/src")
response = os.system("source sourceme")
return HttpResponse(response)
The code works fine as far as syntax goes, all necessary imports are done, however I keep getting a 256 error code back instead of the expected 0. I check the error in the Apache log and this is what I get:
[Sun Aug 18 19:43:23 2013] [notice] caught SIGTERM, shutting down
[Sun Aug 18 19:43:24 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sun Aug 18 19:43:24 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sun Aug 18 19:43:24 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Sun Aug 18 19:46:04 2013] [notice] caught SIGTERM, shutting down
[Sun Aug 18 19:46:05 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sun Aug 18 19:46:05 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sun Aug 18 19:46:05 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
sh: line 0: source: sourceme: file not found
I cannot figure out what is going on. I have the sourceme file clearly in the /usr/locals/src/ folder, which I have verified many times using ls. I do not know what is happening. I used os.getcwd() to check that the directory is being changed correctly, but the file still cannot be found. Please let me know if there is anything that I am missing, as I am very frustrated at this problem that I can just not realize.
Thank you
Your approach currently does not make sense:
os.system creates a child process of the WSGI process, while the environment of the parent is passed on to the child, the environment of the child is not passed back/shared with the parent.
Also, source is not a binary, but a built-in function of the shell itself.
If you want to set environment variables us os.environ which is a dictionary of the variables.
Since you are using python, it would be much more sensible to use python program instead of some os.system calls. That is, create python program with the environment variables, add it to your PYTHONPATH and import it in your django code.