Since couple of weeks this exception appears sometimes on my App: Non-fatal Exception: com.facebook.FacebookAuthorizationException: CONNECTION_FAILURE: TigonError(2): TigonLigerErrorDomain(2) AsyncSocketException: connect failed (immediately), type = Socket not open, errno = 101 (Network is unreachable) at com.facebook.login.LoginManager.onActivityResult(LoginManager.java:218) at com.facebook.login.LoginManager$1.onActivityResult(LoginManager.java:173) at com.facebook.internal.CallbackManagerImpl.onActivityResult(CallbackManagerImpl.java:95)...
Saturday, June 30, 2018
Cannot support both http and https url when running a ServiceHost
I'm trying to enable exposing a ServiceHost on both HTTP & HTTPS. Here is the code that runs the service: oServiceHost = new ServiceHost(typeof(API), new Uri(WebHookURL)) oServiceHost.Open(); As you can see here - I'm getting the service URL (WebHookURL) during runtime. As mentioned, URL protocol can be either HTTP or HTTPS. After lots of reading and testing, it came down to this web.config file: <system.serviceModel> <client> <endpoint binding="customBinding" bindingConfiguration="encryptingBinding"...
Friday, June 29, 2018
Inter-App Data Migration (migrating data to new app version)
I currently have a Swift iOS app on Apple's App Store. I have many users and I would like to make a new version and help current users migrate to the new version. FYI: the new version is an Ionic app. Data-wise, my app is using Core Data without any iCloud or sync support. It contains JSON data and also multiple images. So I'd need to bundle the current data and find a way of bringing it to the new ionic app version. Basically my question is: Is there a way of writing in the app's documents directory and let the new version...
why my widget broadcast receiver service stops when the main app stops
I have a widget that implements a specific broadcast receiver service to detect when the wifi connection goes down. It works perfectly if the main activity is running or not. The issue I have is when I stop the main activity then the broadcast receiver service stops as I don't detect anymore the wifi changes. Is there a way to startservice that survives the main activity? if not, any other mechanisms? 2 AnswersAnswers 1 Probably you need to register your receiver in manifest and mark it as exported=true, so it...
Formatting for <pre> tag with white space and line breaks Android
I was able to set my own Tag Hanlder using this example: Android: How to use the Html.TagHandler? Everything worked until I hit this example: <pre class="prettyprint linenums"> Some Code()\n more code </pre> This is transformed into HtmlCompat.fromHtml(context, html, HtmlCompat.FROM_HTML_MODE_COMPACT, null, CustomTagHandler()) The fromHtml method can't seem to handle the white space and \n it will ignore both and skip setting any Span on this tag. My only option is to replace the white space and...
Calculate the approximate entropy of a matrix of time series

Approximate entropy was introduced to quantify the the amount of regularity and the unpredictability of fluctuations in a time series. The function approx_entropy(ts, edim = 2, r = 0.2*sd(ts), elag = 1) from package pracma, calculates the approximate entropy of time series ts. I have a matrix of time series (one series per row) mat and I would estimate the approximate entropy for each of them, storing the results in a vector....
Getting UnsatisfiedLinkError on API 19 - Advanced Profiling is disabled
Everytime I try to run my app on API 19 I got this error on build: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "strtof" referenced by "libsupportjni.so"... at java.lang.Runtime.loadLibrary(Runtime.java:364) at java.lang.System.loadLibrary(System.java:526) at com.android.tools.profiler.support.ProfilerService.<clinit>(ProfilerService.java:41) at com.orm.SugarApp.<init>(SugarApp.java:7) at com.company.my.app.MyApplication.<init>(MyApplication.java:18) at java.lang.Class.newInstanceImpl(Native...
Asp.net WebApi OData V4 problems with nested $expands
I have a OData V4 over Asp.net WebApi (OWIN). Everything works great, except when I try to query a 4-level $expand. My query looks like: http://domain/entity1($expand=entity2($expand=entity3($expand=entity4))) I don't get any error, but the last expand isn't projected in my response. More info: I've set the MaxExpandDepth to 10. All my Entities are EntitySets. I'm using the ODataConventionModelBuilder. I've opened an SQL-profiler and could see that the query (and the result) is correct. It's some filter that occurs...
CSS Masonry UI not working properly using `column-count` and `box-shadow`

The Below is my code of a Masonry UI, I am using with pure CSS This works well if there are more than 4 cards but if I use it with below 4 cards the column-count: 3; does not work well. body{ height:1000px; } ul { list-style: none; -moz-column-count: 3; -webkit-column-count: 3; column-count: 3; -moz-column-gap: 1em; -webkit-column-gap: 1em; column-gap: 1em; padding: 0px 4px 4px 4px;...
Thursday, June 28, 2018
Downside of many caches in spring
Due to the limitation of not being able to evict entries based on a partial key, I am thinking of a workaround using the cache name as my partial key and evicting all (there would only be one) entries in the cache. For example, let's say there are 2 key-value pairs like so: "123@name1" -> value1, "124@name2" -> value2 Ideally, at the time of eviction, I would like to remove all keys that contain the string "123". However, as this is not supported, the workaround I'm thinking of is to have the following: "123" cache:...
How to create custom UI components like responsive seekbar?

I want to create custom sliders or seekbars in android (just as in the gif, slider on the bottom and right), could you provide me with any relevant process how to achieve this. 2 AnswersAnswers 1 After searching for several days I have finally got enough resources to address the problem statement. For staters go through the following resources: 1) https://guides.codepath.com/android/Basic-Painting-with-Views 2) https://guides.codepath.com/android/Progress-Bar-Custom-View...
Use TensorFlow python code with android app
I currently have TensorFlow code in python and are trying to find the best way to add this to an android app. As I see it there are a few options to do this. I've been looking at ML kit (https://developers.google.com/ml-kit/). But I'm not sure if this would work since I am using some specific TensorFlow functions to make calculations in the graph. For example these two lines: t_score = tf.reduce_mean(t_obj) t_grad = tf.gradients(t_score, t_input)[0] Would that be possible to do with ML kit? Another option would then...
Connect to postgres in docker container from host machine

How can I connect to postgres in docker from a host machine? docker-compose.yml version: '2' networks: database: driver: bridge services: app: build: context: . dockerfile: Application.Dockerfile env_file: - docker/Application/env_files/main.env ports: - "8060:80" networks: - database depends_on: - appdb...
Synchronization between Context.openFileInput and Context.openFileOutput
I have an Android Service running daily which does some data synchronization. Once a day it downloads a file and caches it to disk via context.openFileOutput: String fileName = Uri.parse(url).getLastPathSegment(); try (FileOutputStream outputStream = context.openFileOutput(fileName, Context.MODE_PRIVATE)) { outputStream.write(bytes); // ... } catch (IOException e) { // logging ... } This happens on a background thread. I also have a UI which contains a WebView. The WebView uses those cached resources if...
Wednesday, June 27, 2018
QuickInfoSession is dismissed prematurely when using UserControls in quickInfoContent
First some boilerplate code; question below. I have a standard QuickInfoSourceProvider: [Export(typeof(IIntellisenseControllerProvider))] internal sealed class QuickInfoControllerProvider : IIntellisenseControllerProvider { [Import] private IQuickInfoBroker _quickInfoBroker = null; public IIntellisenseController TryCreateIntellisenseController(ITextView textView, IList<ITextBuffer> subjectBuffers) { return new QuickInfoController(textView, subjectBuffers, this._quickInfoBroker); } }...
Automatically reconnect Storm Topology to Redis Cluster on Redis restart
I have created a Storm topology which connects to Redis-cluster using Jedis library. Storm component always expects that Redis is up and running and only then it connects to Redis and subscribes the events.Currently we use pub-sub strategy of Redis. Below is the code sample that explains my Jedis Connectivity inside Storm to for Redis. try { jedis.psubscribe(listener, pattern); } catch(Exception ex) { //catch statement here. } finally { pool.returnResource(jedis); } .... pool = new JedisPool(new JedisPoolConfig(),...
Tuesday, June 26, 2018
Best way to communicate between two applications
I want to create a central application for a suite of applications. The suite of applications are developed by ourselves and third party vendor. We would like to know the best approach to achieve below features 1) Launch the sub application from the central application The sub applications are installed in the device and package name of sub applications are provided by the vendors.We thought of using explicit intent to invoke the sub application. Any other approach to start the sub applications from central application....
FineUploader failing to POST
I'm trying to implement file uploading using FineUploader. Everything is working except the actual upload - when I select a file, it is instantly added to the page saying "Upload failed". Looking at the Network tab in Firefox's inspector, no POST request is even happening, and I'm getting an error message from FineUploader saying the response is not valid JSON (go figure). Here's my client-side (partial) view: <div id="fine-uploader"></div> @* This section is rendered into the page header *@ @section Scripts...