Prevent the android app from running if packet capture or any sniffer is installed on the phone [migrated]

I want to make my Android app secure. In some applications, if the phone has a network sniffer program installed(packet capture,ssl capture etc), the application gives an alert(Remove packet capture) and turns off. How do I add a similar security measure? What technologies should I look for ?

The app first wants me to uninstall packet sniffer program

Problem to structure code permissions (ACL) [migrated]

I have a problem here to structure the code to validate the permissions.

Let’s suppose I have three actions: read:own_users, read:my_users, read:all_users.

And I have a route get/users.

I want this route returning all users if the guy which is doing the request have read:all_users. But if he only have read:my_users permission, this route should return just the users that this guy inserted. And the last possibility, if the user just have read:own_users permission, I wants this route returning just your own object.

So, what I want to solve is: How to do that without doing a switch case in my code for every route putting a where in my SQL.

Or maybe I’m doing this by the wrong way and I need to plan all the stuff trying a new strategy.

Why does my genetic algorithm return negative fitness values? [migrated]

I’m trying to minimize the function and then graph it, but I’m getting negative fitness values and I don’t know how or why. I’m using the GA package which basically handles the algorithm for me as long as I send it a fitness function. (documentation can be found here. https://cran.r-project.org/web/packages/GA/vignettes/GA.html)

# Objective function for I-beam cross section area cross <- function(x1, x2, x3, x4) {   2 * x2 * x4 + x3 * (x1 - 2 * x4) # Not possible to be negative } 

Parameters to the genetic algorithm.

crossGA <- ga(   type = "real-valued",   fitness = function(x)     -cross(x[1], x[2], x[3], x[4]),   lower = c(10, 10, 0.9, 0.9), # Not possible to be negative   upper = c(80, 50, 5, 5), # Not possible to be negative   popSize = 50,   maxiter = 100,   run = 100,   pcrossover = 0.75,   pmutation = .001 ) 

Output.

GA | iter = 1 | Mean = -295.2791 | Best = -104.4886 GA | iter = 2 | Mean = -231.7914 | Best = -104.4886 GA | iter = 3 | Mean = -205.53407 | Best =  -82.49887 GA | iter = 4 | Mean = -199.11156 | Best =  -82.49887 GA | iter = 5 | Mean = -164.27739 | Best =  -82.49887 GA | iter = 6 | Mean = -138.23192 | Best =  -82.49887 GA | iter = 7 | Mean = -117.80066 | Best =  -72.36154 GA | iter = 8 | Mean = -107.05787 | Best =  -72.36154 GA | iter = 9 | Mean = -93.94951 | Best = -72.36154 GA | iter = 10 | Mean = -86.25630 | Best = -72.36154 

vimrc and finding errors in latex document [migrated]

To find errors in a latex document, I open vim on the .log file. Then I type manually

/^l\.\|[Ee]rr\|[Ww]ar followed by RETURN 

This extended regular expression works well. It matches a line starting with ell followed by a fullstop (period) OR the word “error”, possibly capitalized OR the word “warning”, possibly capitalized.

I would like to put this command into my .vimrc with the line

:map % "what should I put here?" 

I made various attempts, including doubling some of the backslashes, but couldn’t get it to work. I want vim to look for a match for my extended regular expression when I type “%”

51k Euros annually for a family of 4 in Berlin: Is it enough? [migrated]

I am a Big Data Engineer in India with 5 years experience. I have been offered a job in a start up in Berlin with 51k euros fixed salary and 5k euros variable annually.

I have a family of 4. My wife, 1 son(who goes to school in class 2) and 1 daughter(6 months old). Is the salary sufficient to survive and possibly save a little?

Is there a cleaner way to save a copy of an object (with its data) for access throughout the application than making it global? [migrated]

The framework is WordPress. There’s a thing such as “filters”. Filters are, more or less, global variables but without the stigma, the way they work is: you give the filter a name and what you want to be inside of it:

add_filter( 'the_generator', new Generator );

now, anywhere after the point of this filter being created, anyone can call apply_filters( 'the_generator' ) and they’ll get the instance of that Generator as it was at the moment it was “globalized”. If the object has setters, then the data might change throughout the lifespan of the application, but data “originality” isn’t needed.

As such, wherever I need to access this object to extract information from it for further usage, I call it from the filter.

Problem is, this is extremely dirty and allows this object to be replaced by actors who have no rights at any time. My Generator is created by a Module and that should be the only actor that can ever change it.

With these in mind, is there a better way to open my objects for access by anyone, but not for it to be replaced (not changed, because it might have setters)?

Keep in mind that my Module is initialized very early on and is not a singleton, so, I cannot extract the Generator from it, because I’d have to re-initialize the Module object, re-running unecessary code, I can’t do:

$  generator = (new Module)->getGenerator(); 

The solution would need to have a component that deals with creating that Generator object, locking it to the Module and another component that allows retrieval of it: ObjectRetriever( 'Module', 'Generator').


Some thoughts:

Maybe hashing the object could be a start? Check, in its setters that are only meant to be used in a pristine way (not by outsiders, but they exist simply so that the system can work) if the setter is being called by Module itself and if not, discard?

I have obtained vignette sticker from ofii. How long can I stay in india? [migrated]

I arrived to France from India on a long stay visa with my wife and child as dependents. I have obtained vignette sticker from ofii for myself and my wife. I have also obtained DCEM for my child. How long can my wife and child stay in india without effecting vignette sticker? And I am not sure if it is constrained and therefore would like to confirm.