## Fetching content binary from database or fetching content by its link from storage service

For an app (web + phone) there are two options:

1. Image binaries in database. Server replies to app HTTP request with images as base64
2. Images in storage service like Amazon S3 or Azure Blob Storage or a self-hosted one. Image links in database. Server handles app HTTP requests by sending back only the links to images. The app fetches the images from storage by their link Which option above is the standard practice? Which one has less trouble down the road?

## Does binlog_group_commit_sync_delay affect existing binary logging in MySQL

We want to tune the setting binlog_group_commit_sync_delay to increase replication performance. Our slave is currently two days behind. Does changing this setting affect the current backlog or will we see the impact after two days?

## Segmenting a binary image into three parts

I am trying to segment a binary image into three parts, head, body, and tail. The binary image is a stack tiff file of a moving fruit fly larvae. I was able to do this initially by removing points within a certain distance of the centroid: However, this broke down if the larvae’s head moved too close to the centroid, because the head points would then be removed: I have been looking for creative solutions to this problem. Trying to fit it to a curved ellipsoid and get the vertice points that make up the tail and the head. However, I have not been very successful! I was curious if anyone had any insight into this problem or a suggestion for a creative solution? Thank you! 🙂

Here are the raw binary images:

1) 2) ## Why does the formula floor((i-1)/2) find the parent node in a binary heap?

I learned that when you have a binary heap represented as a vector / list / array with indicies [0, 1, 2, 3, 4, 5, 6, 7, 8, …] the index of the parent of element at index i can be found with parent index = floor((i-1)/2)

I have tried to explain why it works. Can anyone help me verify this?

Took reference from Why does the formula 2n + 1 find the child node in a binary heap? thanks to @Giulio

Posted on Categories proxies

## In what cases is solving Binary Linear Program easy (i.e. **P** complexity)? I’m looking at scheduling problems in particular

In what cases is solving Binary Linear Program easy (i.e. P complexity)?

The reason I’m asking is to understand if I can reformulate a scheduling problem I’m currently working on in such a way to guarantee finding the global optimum within reasonable time, so any advice in that direction is most welcome.

I was under the impression that when solving a scheduling problem, where a variable value of 1 represents that a particular (timeslot x person) pair is part of the schedule, if the result contains non-integers, that means that there exist multiple valid schedules, and the result is a linear combination of such schedules; to obtain a valid integer solution, one simply needs to re-run the algorithm from the current solution, with an additional constraint for one of the real-valued variables equal to either 0 or 1.

Am I mistaken in this understanding? Is there a particular subset of (scheduling) problems where this would be a valid strategy? Any papers / textbook chapter suggestions are most welcome also.

Posted on Categories proxies

## Choosing an AI method to recreate a given binary 2D image

If the title wan not very clear, I want a method to take an input image like this,

[[0, 0, 0, 0],  [1, 1, 1, 0],  [1, 1, 1, 0],  [0, 1, 1, 0]] 

and output the 2D coordinates of the 1s of the image (So that I can recreate the image)

I want the output to be sequential because I need to reconstruct the input image pixel by pixel and there are some conditions on the image construction order (e.g. You cannot place a 1 somewhere when it is surrounded by 1s)

The image can change and the number of 1s in the image too.

1. What is an appropriate AI method to apply in this case?
2. How should I feed the image to the network? (Will flattening it to 2D affect my need of an output order?)
3. Should I get the output coordinates one by one or as an ordered 2xN matrix?
4. If one by one, should I feed the same image for each output or the image without the 1s already filled?

EDIT: The application is a robot creating the image using some kind of building blocks, placing one block after the other

I have tried to apply "NeuroEvolution of Augmenting Topologies" for this using neat-python but was unsuccessful. I am currently looking at RNNs but I am not sure if it is the best choice either.

Posted on Categories proxies

## Binary string satisfying several constraints

I’m trying to solve this problem, but without success.

Problem: You’re given a binary string where some of the bits are replaced by ?. You’re also given several intervals [$$l_i$$, $$r_i$$] ($$l_i < r_i$$). Find a binary string S with ? replaced by 0 or 1, such that in each interval [$$l$$, $$r$$], s[$$l..r$$] includes both 0 and 1.

Example:

Given the string 00?11 and the interval [2, 3], the string 00111 satisfies the requirements, as S[2..3]=01 include both 0 and 1.

However, the string 00?11 and the intervals [2, 3] and [3, 4] cannot be solved, as the ? would have to be both 0 and 1.

The bounds are |S|,Q<=1e5

I tried using greedy, but it’s giving wrong answer for this case: 0??0, [1, 3], [2, 3] and [3, 4], as the greedy algorithm would try 0??0 -> 01?0 -> 0100 -> fail, yet there exists a solution (0010).

I tried removing completely overlapping intervals (such as [1, 3] and [2, 3]), but there’re other cases I found that fails. What would be a correct solution?

Thanks.

Posted on Categories proxies

## Insecure Binary protection IOS Pentest Report

Thirdparty pentest company reported their findings in our IOS app. In the report explanation for this vulnerability is

Apple provides default encryption for applications; however, the encryption could easily be bypassed by using publicly available tools such as Clutch. This was verified by performing static analysis that shows that the application code has not been encrypted, using a strong encryption mechanism, which makes it easy for an attacker to reverse engineer the application and to explore and modify its functionality.

For the remediation they suggested

The recommendation is to use a custom encryption solution for the iOS application. Is it possibile to build IOS app with custom encrytpiton solution? Is that something that is a feature when compiling IOS app?

Is there a way to use custom "encryption" for IOS app?

Posted on Categories proxies

## Is minimising the total number of one entries in binary matrices $CA$ and $C^TB$ NP-HARD?

Given a two rectangular binary matrices $$A$$ and $$B$$ with dimensions $$c\times a$$ and $$c \times b$$ respectively, does there exist an invertible binary matrix C with dimensions $$c \times c$$ such that the total number of 1 entries in $$CA$$ and $$C^TB$$ is below a target threshold $$t$$?

Here we are working in $$GF(2)$$, where multiplication and addition are AND and XOR respectively.

What is the hardness of this problem? Are there approximation algorithms to this problem?

We know this problem is in $$NP$$, as a valid $$C$$ can be used as a certificate. Also, we know how to find $$C$$ when there exists the a solution for $$t = a+b$$, by using Gaussian Elimination.

Posted on Categories proxies

## Searching a 2D array of binary Data

I’m working on optimizing the structure of an optical metadevice. I have a randomly generated 2D matrix, where 0,1 represents the presence/absence of a hole. Each structure manipulates light in a different way, thus giving rise to a unique spectrum.

The problem I wish to solve is to maximize the efficiency of this structure. Given the large size of the solution space ($$2^{100}$$ in this case), it isn’t possible to simulate each structure. Is there any search method I could use to complete this optimization?

A General workflow would be:

1. Generate a random hole structure
2. Flip one or some bits (based on the optimization algorithm)
3. Compute the spectrum
4. Go back to step 2 and make decision based on the previously computed spectrum.

Here’s a link to a sample hole array.

Apologies for the vague statement of the problem. Thanks in advance!