text:
Q: Sort faster in racket using hash table So I have an example list of elements like this
(define A (list 'a 'c 'd 'e 'f 'e 'a))

Now I want to make a ranking from this sample
(define (scan lst)
    (foldl (lambda (element a-hash) (hash-update a-hash element add1 0))
           (hash)
           lst))

The result should be like this:
> #(('a . 2) ('f . 1) ('e . 2) ....)

Because `scan function will make a hash table containing unique keys and the number of repetitions of that key (if it catches an unindexed key it will create a new place for that new key, counting from 0).
Then I'd like to sort that hash-table because it's unsorted:
(define (rank A)
     (define ranking (scan A))
     (sort ranking > #:key cdr)))

So the result would look like this:

#(('a . 2) ('e . 2) ('f . 1) ...)

Now I'd like to truncate the hash-table and throw away the bottom at the threshold of n = 1 (aka only take the elements with more than 2 repetitions).
(define (truncate lst n)
    (define l (length lst))
    (define how-many-to-take
        (for/list
             ([i l]
               #:when (> (cdr (list-ref lst i))
                          n))
               i))
    (take lst (length how-many-to-take)))

So the result might look like this:

(('a . 2) ('e . 2))

However, at the big scale, this procedure is not very efficient, it takes too long. Would you have any suggestion to improve the performance?
Thank you very much,
Part 2:
I have this data structure:
(automaton x
   (vector (state y (vector a b c))
           (state y (vector a b c)) ...))

Then i generate randomly a population of 1000 of them. Then i scan and rank them using the above functions. If i just scan them as is, it already takes long time. If i try to flatten them into a list like this
(list x y a b c y a b c...)

it'd take even more time. Here is the flatten function:
(define (flatten-au au)
  (match-define (automaton x states) au)
  (define l (vector-length states))
  (define body
    (for/list ([i (in-range l)])
      (match-define (state y z) (vector-ref states i))
      (list y (vector->list z))))
  (flatten (list x body)))

The scan function will look a bit different:
(define (scan population)
    (foldl (lambda (auto a-hash) (hash-update a-hash (flatten-automaton auto) add1 0))
           (hash)
           population))

A: Yep, I believe I see the problem. Your algorithm has O(n^2) ("n-squared") running time. This is because you're counting from one to the length of the list, then for each index, performing a list-ref, which takes time proportional to the size of the index.
This is super-easy to fix.
In fact, there's really no reason to sort it or convert it to a list if this is what you want; just filter the hash table directly. Like this...
#lang racket

(define A (build-list 1000000 (λ (idx) (random 50))))

(define (scan lst)
    (foldl (lambda (element a-hash) (hash-update a-hash element add1 0))
           (hash)
           lst))

(define ht (scan A))

(define only-repeated
  (time
   (for/hash ([(k v) (in-hash ht)]
              #:when (< 1 v))
     (values k v))))

I added the call to time to see how long it takes. For a list of size one million, on my computer this takes a measured time of 1 millisecond.
Asymptotic complexity is important!


text:
Q: Recommendations - or best practices - for analyzing non-independent data. Specific example relating to pain perception data provided I am seeking recommendations and/or best practices for analyzing non-independent data. In particular, I am curious about non-independent data that does not reflect typical repeated-measures time-based data in which data for the same question(s) or stimuli are collected at different time points. Rather the data collected is elicited from similar (but not identical) questions or stimuli that are known to be related. A specific example follows.
I have pain perception data for two groups (group A, group B) that can be further divided by gender (i.e., A-women; A-men; B-women; B-men). The pain perception dependent variables include 3 thermal threshold tests (i.e., detection, pain, tolerance) and pain magnitude estimates for a range of specific temperatures (temp X1, X2, X3, X4, X5). These pain perception variables are collected for both heat and cold stimuli (e.g., heat pain tolerance; cold pain tolerance; heat temp X1; cold temp X1). It should be expected (and indeed it is observed) that the various pain perception variables for a given individual are not independent.
The purpose of the analysis is to look for between group differences based on group membership (group A vs. group B) and sex (women vs men). It is desirable to find interactions between group membership and sex. It is also desirable to find interactions between specific pain perception variables (or types of variables; i.e., "cold stimuli") and group membership and/or sex. I have tried running a series of repeated-measures ANOVAs separately for each of the different groupings of pain perception variables (i.e., heat stimuli threshold tests; cold stimuli threshold tests; heat pain magnitude estimates; cold pain magnitude estimates); however this solution does not feel optimal or adequate. My specific questions are:
1) is it appropriate to analyze data elicited from related (but not identical) questions/stimuli using repeated measures?
2) Is it appropriate to analyze chunks of the data (e.g., cold pain magnitude estimates; cold stimuli threshold tests) separately?
2) Would a different strategy (such as multilevel analysis / profile analysis / or some type of multivariate repeated measures ANOVA) be more appropriate?
3) General recommendations and/or best practices for analyzing data such as this.
Thank you for your feedback and input
Patrick Welch
note: I already searched the site for related questions (i.e., ANOVA with non-independent observations ; Parametric techniques for n-related samples) but believe the current question to be different enough to warrant unique consideration.

A: If temperature levels X1...X5 are specific degree values, I'm not sure how temperature and stimulus (hot/cold) can be completely crossed. I presume then that "temperature" consists of 5 ordinal categories, ranging from "likely to cause minimal discomfort" to "likely to cause maximum discomfort permissible by my research ethics board", which then permits crossing with hot/cold direction.
If this is the case, you are correct that the 3 response variables might not be expected to be independent, so you might increase your power (relative to 3 seperate analyses) if you do a multivariate test. Frankly, I must admit that my first inclination would be to simply do three separate analyses, one for each response variable, but that's because I'm not very knowledgeable with regards to the mechanics of multivariate tests. That said, given the likely dependence between the 3 response variables, significant results across 3 separate anovas might be most reasonably considered as manifestations of this dependence rather than 3 truly independent sets of phenomena.
I am pretty sure that you shouldn't lump all 3 response variables into a single univariate analysis by adding "response variable type" as a predictor variable; this approach could run into trouble if the scales and variances of your response variables are very different. Presumably, a multivariate analysis has features that take such differences into account. (However, I wonder if a mixed effects analysis might also be able to handle such differences? I'm new to mixed effects, but suspect I it might...)

A: As to your suggestion of using Multi-level models in this and the other thread, I see no benefit of approaching your analysis in this manner over repeated measures ANOVA. MLM are simply an extension of OLS regression, and offer an explicit framework to model group level (often referred to as "contextual") effects on lower level estimates. I would guess from your example you have no specific "contexts" besides that measures are repeated within individuals, and this is accounted for within the repeated ANOVA design (and your not interested in measuring effects of specific individuals anyway, only to control for this non-independence). Neither groups nor gender with what your description says are "contexts" in this sense, they can only be direct effects (or at least you can only observe if they have direct effects).
MLM just complicates things in this example IMO. It doesn't directly solve your problem that several dependent measures are non-independent, you can't measure any group level characteristic on your outcome because you only have two groups, and your hierarchy is cross classified and has three levels, (an observation is nested within only 1 individual, but the gender and group nestings are not mutually exclusive). All of the things you listed as purposes of the project can be accomplished using repeated ANOVA simply including group, gender, and group*gender interaction effects into the models.
It is beyond the scope of your question, but I would never agree that gender is a group observations are nested within.

A: I don't think that repeated measures is appropriate here - as I understand your protocol, the five temperatures (either hot or cold) are not repeated measures as they occur at different temperatures.
However, it does feel like you need some data reduction across the five levels in each temperature group.  You might be well-served to consider some exploratory analysis to decide what the general shape of the relationship of pain perception to ordinal temperature input is across the hot and cold groups; then reduce that to a linear slope or exponential function; then model that single variable as your dependent variable with gender and A/B as factors.
Latent growth curve modeling might also be appropriate, but that is beyond me.

redpajama_set_name: RedPajamaStackExchange


text:
Q: what is the correct way to link image in website? As per my title, what is the correct way?
I have seen both of these appearing in websites:

And

What is the good of each type?
Does the 1st one aids in faster loading of image as compared to the 2nd one?
Thanks.

A: The second example is a relative URL. In general, it's better for scalability when you don't hard-code things like URLs.

A: The only difference is that if the image is not in the same domain you have to use the full URL. There is no difference in speed.
If you have relative URLs the images break if you move the HTML file somewhere else; if you have full URLs the images break if you move the website to another domain.

A: i prefer the 2nd option. the link is relative to the path were your html file is located. if you copy your site to another subdirectory etc you don't need to update your html code which you have to when u choose the first option.
if the image is on another domain, then the first option is the way to go.

A: If you are following best practices, you should have multiple environments, say for development, testing, QA, pre-production and production.  For this reason alone, the URLs should be relative.  If you do all your development and testing in prod, well... this is a bad way to do business.

A: It is defenitely better to use relative urls. Because when you change something in your structure of your code, you would have to change all the references to the images as well.
With relative paths you don't have to change anything at all.

A: The second example is not that correct to load the images.
Use Root-relative URL for good practice

These URLs are always relative to the root of the folder. These URLs are useful while moving between servers.


text:
Q: SET() or Please suggest suitable design I guess this question is quite basic, but imo those are the hardest.
So lets say I want to create a table about the personnel details of person , and lets say other than basic info like name,address,contactno. etc. I also need to store whether the person is Investor,Mentor,HR Guy,ALumni,Partner,Donor or service provider. He can be in more than 1 fields listed above.
Is it recommendable to use the set() field with the 7 options? seems the logic way to do it but I've read that set() fields are not friendly with searches in big databases.
The other options I had in mind are:
1.Having 7 extra boolean columns for each field in the original table.
Which would be the best way, considering the database/table would be big?.
Plz suggest some good way out!! thanks in advance

A: Normalize.
One table to hold the different types, then, since a person can be zero or more number of type, another table to glue them together. Consider a design something like this;
person:
--------------
id int
name varchar
email varchar
...

type
--------------
id int
name varchar

person_type
--------------
person_id
type_id


text:
Q: Module build failed: SyntaxError: Unexpected token ' in JSON at position 0 I have here a webpack config, I am trying to add moment-timezone with an answer How should I use moment-timezone with webpack?, which led me to Webpack - Error: Cannot define 'query' and multiple loaders in loaders list
var webpack = require('webpack');

module.exports = {
  //devtool: 'inline-source-map',
  entry: [
    'webpack-hot-middleware/client',
    './client/main.js'
  ],
  output: {
    path: require("path").resolve('./assets'),
    filename: 'bundle.js',
    publicPath: '/'
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin()
  ],
  externals: {
      jquery: 'var jQuery'
  },
  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        loaders: ['json-loader', 'babel-loader?presets[]=react,presets[]=es2015,presets[]=react-hmre'],
        exclude: /node_modules/
      }
    ]
  }
};

My current attempt is above.

A: You're telling webpack to pass your JavaScript files to the json-loader. But because JavaScript files are not valid JSON, you get the error that there is an unexpected token already at the first character.
{
  test: /\.jsx?$/,
  loaders: ['json-loader', 'babel-loader?presets[]=react,presets[]=es2015,presets[]=react-hmre'],
  exclude: /node_modules/
}

So you need to remove the json-loader from the .jsx? configuration. Additionally json-loader isn't require anymore in webpack 2 and JSON files should just work out of the box.
You can update the module section to:
module: {
  rules: [
    {
      test: /\.jsx?$/,
      loader: 'babel-loader?presets[]=react,presets[]=es2015,presets[]=react-hmre',
      exclude: /node_modules/
    }
  ]
}

But just in case it shouldn't work, you would have to add the json-loader for files ending in .json:
{
  test: /\.json$/,
  loader: 'json-loader'
}


text:
Q: I can't to see my web page in spring [spring] I'm new using this framework, I'm tryng to deploy a web with a hibernate connection, I created a .xml config file to connect to PostgreSQL.
But the logs shows this error:
2020-11-14T22:32:28.610246+00:00 heroku[router]: at=info method=GET path="/"
host=gstlabs.herokuapp.com request_id=978ecfdc-917f-41a0-8867-8cc55b73def1 fwd="190.84.149.124" dyno=web.1 connect=2ms service=211ms status=500 bytes=610 protocol=https
2020-11-14T23:04:34.213061+00:00 heroku[web.1]: Idling
2020-11-14T23:04:34.215664+00:00 heroku[web.1]: State changed from up to down
2020-11-14T23:04:35.167671+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2020-11-14T23:04:35.279279+00:00 app[web.1]: 2020-11-14 23:04:35.278  INFO 4 --- [extShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2020-11-14T23:04:35.279712+00:00 app[web.1]: 2020-11-14 23:04:35.279  WARN 4 --- [extShutdownHook] o.s.b.f.support.DisposableBeanAdapter    : Invocation of destroy method failed on bean with name 'entityManagerFactory': org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.example.core.models.Projects.technologies in com.example.core.models.Technologies.projects
2020-11-14T23:04:35.280073+00:00 app[web.1]: 2020-11-14 23:04:35.279  INFO 4 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
2020-11-14T23:04:35.282600+00:00 app[web.1]: 2020-11-14 23:04:35.282  INFO 4 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2020-11-14T23:04:35.325392+00:00 app[web.1]: 2020-11-14 23:04:35.325  INFO 4 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
2020-11-14T23:04:35.426750+00:00 heroku[web.1]: Process exited with status 143

There are my Classes:
[Technologies]
package com.example.core.models;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

@Entity
@Table(name="technologies")
public class Technologies {
    @Id
    @Column(name="id")
    private int id;
    @Column(name="name")
    private String name;

    public Technologies() {
    }

    public Technologies(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Technologies [id=" + id + ", name=" + name + "]";
    }

    @ManyToMany(mappedBy="technologies")
    private Set<Projects> projects = new HashSet<>();

    public Set<Projects> getProjects() {
        return projects;
    }

    public void setProjects(Set<Projects> projects) {
        this.projects = projects;
    }
}

[Projects]
package com.example.core.models;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

@Entity
@Table(name="projects")
public class Projects {
    @Id
    @Column(name="id")
    private int id;
    @Column(name="photo")
    private String photo;
    @Column(name="link")
    private String link;

    public Projects() {
    }

    public Projects(String photo, String link) {
        this.photo = photo;
        this.link = link;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    @Override
    public String toString() {
        return "Projects [id=" + id + ", photo=" + photo + ", link=" + link + "]";
    }

    @ManyToMany(cascade= {CascadeType.ALL})
    @JoinTable(
        name="projects_has_technologies",
        joinColumns=@JoinColumn(name="project_id"),
        inverseJoinColumns=@JoinColumn(name="technology_id")
    )
    Set<Technologies> tecnologies = new HashSet<>();

    @ManyToMany(mappedBy="projects")
    private Set<Profiles> profiles = new HashSet<>();

    public Set<Technologies> getTecnologies() {
        return tecnologies;
    }

    public void setTecnologies(Set<Technologies> tecnologies) {
        this.tecnologies = tecnologies;
    }

    public Set<Profiles> getProfiles() {
        return profiles;
    }

    public void setProfiles(Set<Profiles> profiles) {
        this.profiles = profiles;
    }
}

There are some code that are some at my clases in this proyect the other intermedial clases are similar, I'm trynt in this moment insert some objects to the database.
Thanks to your help in advance.

A: Have you tried to add a Configuration Class in your project for example
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories( basePackages = "your repository package" )
@EntityScan( basePackages = {"your entity package1","your entity package2"}
public class TransactionConfiguration {}

This will help you to find your entity classes in the project.


text:
Q: Can't reach returning function in JavaScript I have problem with reaching the code of function that is returned by my 'main' function. Can anyone help me resolve this?

function createBook() {
    let cnt = 1;

 return function(selector,tiTle,auThor,rate){
        alert("In");

    }
}

When I debug the code the returning function is passed.

A: You need a call of the returned function to call the function inside.

function createBook() {
    let cnt = 1;
    return function (selector, tiTle, auThor, rate) {
        alert("In");
    }
}

// you need a call of the returned function to call the function inside
createBook()();

A: You are just calling createBook(), which returns an unexecuted function. You would need to execute the function that is returned by createBook() with another ():
createBook()();

A: just call it as createBook()()

function createBook() {
    let cnt = 1;
    return function(selector,tiTle,auThor,rate){
        alert("In");
    }
}

createBook()();

createBook() returns the function reference, you need to invoke it again with extra parenthesis ().

A: Call the returned function

function createBook() {
  let cnt = 1;

  return function(selector, tiTle, auThor, rate) {
    alert("In");

  }
}

createBook()()

alternatively

function createBook() {
  let cnt = 1;

  return function(selector, tiTle, auThor, rate) {
    alert("In");

  }
}

var book = createBook();
// call anonymous function returned from `createBook()`
book();


text:
Q: How Does a Laravel / Forge server determine which Github user gets the public key? On which to automatically add the Forge servers public key? From the Forge account meta tab:

Typically, this key will automatically be added to GitHub or
  Bitbucket. However, if you need to add it to a service manually, you
  may copy it from here.

Typically, this is true. Our question is: How does Forge determine which user account gets the key?
We have several developers / user accounts on a single Github team. We'd like to configure a particular (machine) user to get all the Forge keys.

A: The user that connects/grants permissions to the forge account to their github/bitbucket account is where the key gets added.


text:
Q: Почему Wp-Super-Cache Wordpress не работает с NGINX/PHP-FM? Помогите пожалуйста, не работает Wp-super-cache, не кэширует вообще, ноль файлов.
Centos7, Nginx/PHP-FM, VestaCP, Wordpress Multisite на поддоменах.
Все работает, nginx запускается, но Wp-Super-Cache не кэширует.
Проверка кэширования файлы делает тестовые, но пишет: Страницы не совпадают! Временной штамп отличается или не был найден!
Вот мой темплейт nginx:
server {
listen      %ip%:%web_ssl_port%;
server_name %domain_idn% %alias_idn%;
root        %docroot%;
index       index.php index.html index.htm;
access_log  /var/log/nginx/domains/%domain%.log combined;
access_log  /var/log/nginx/domains/%domain%.bytes bytes;
error_log   /var/log/nginx/domains/%domain%.error.log error;
ssl         on;
ssl_certificate      %ssl_pem%;
ssl_certificate_key  %ssl_key%;

set $cache_uri $request_uri;

# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
    set $cache_uri 'null cache';
}

# Don't cache uris containing the following segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php

               |wp-.*.php|/feed/|index.php|wp-comments-popup.php
                  |wp-links-opml.php|wp-locations.php |sitemap(_index)?.xml
                  |[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {

    set $cache_uri 'null cache';
}

# Don't use the cache for logged-in users or recent commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+
                     |wp-postpass|wordpress_logged_in") {
    set $cache_uri 'null cache';
}

# Set the cache file
set $cachefile "/wp-content/cache/supercache/$http_host/$cache_uri/index.html";
set $gzipcachefile "/wp-content/cache/supercache/$http_host/$cache_uri/index.html.gz";
if ($https ~* "on") {
    set $cachefile "/wp-content/cache/supercache/$http_host/$cache_uri/index-https.html";
    set $gzipcachefile "/wp-content/cache/supercache/$http_host/$cache_uri/index.html.gz";
}

location = /favicon.ico {
    log_not_found off;
    access_log off;
}

location = /robots.txt {
try_files $uri $uri/ /index.php?$args;
access_log off;
log_not_found off;
}

location / {
# Try in the following order: (1) gzipped cachefile, (2) cachefile, (3) normal url, (4) php
    try_files $gzipcachefile $cachefile $uri $uri/ /index.php?$args;

    if (!-e $request_filename)
    {
        rewrite ^(.+)$ /index.php?q=$1 last;
    }

    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
        expires     max;
    }

    location ~ [^/]\.php(/|$) {

    fastcgi_buffers 8 256k;
    fastcgi_buffer_size 128k;
    fastcgi_intercept_errors on;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;

    fastcgi_cache microcache;
    fastcgi_cache_key $scheme$host$request_uri$request_method;
    fastcgi_cache_valid 200 301 302 30s;
    fastcgi_cache_use_stale updating error timeout invalid_header http_500;
    fastcgi_pass_header Set-Cookie;
    fastcgi_pass_header Cookie;
    fastcgi_ignore_headers Cache-Control Expires Set-Cookie;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        if (!-f $document_root$fastcgi_script_name) {
            return  404;
        }

        fastcgi_pass    %backend_lsnr%;
        fastcgi_index   index.php;
        include         /etc/nginx/fastcgi_params;
    }
}
error_page  403 /error/404.html;
error_page  404 /error/404.html;
error_page  500 502 503 504 /error/50x.html;

location /error/ {
    alias   %home%/%user%/web/%domain%/document_errors/;
}

location ~* "/\.(htaccess|htpasswd)$" {
    deny    all;
    return  404;
}

if ($http_user_agent ~ "Python-urllib|Spinn3r|SISTRIX|Morfeus|Toata|QuerySeekerSpider|JikeSpider|proximic|Sosospider|Sogou web spider|aesop_com_spiderman|alexibot|backweb|batchftp|bigfoot|black.hole|blackwidow|blowfish|botalot|buddy|builtbottough|bullseye|cheesebot|cherrypicker|chinaclaw|collector|copier|copyrightcheck|cosmos|crescent|custo|da|diibot|disco|dittospyder|dragonfly|drip|easydl|ebingbong|ecatch|eirgrabber|emailcollector|emailsiphon|emailwolf|erocrawler|exabot|eyenetie|filehound|flashget|flunky|frontpage|getright|getweb|go.?zilla|go-ahead-got-it|gotit|grabnet|grafula|harvest|hloader|hmview|httplib|httrack|humanlinks|ilsebot|infonavirobot|infotekies|intelliseek|interget|iria|jennybot|jetcar|joc|justview|jyxobot|kenjin|keyword|larbin|leechftp|lexibot|lftp|libweb|likse|linkscan|linkwalker|lnspiderguy|lwp|magnet|mag-net|markwatch|mata.hari|memo|microsoft.url|midown.tool|miixpc|mirror|missigua|mister.pix|moget|mozilla.newt|nameprotect|navroad|backdoorbot|nearsite|net.?vampire|netants|netcraft|netmechanic|netspider|nextgensearchbot|attach|nicerspro|nimblecrawler|npbot|octopus|offline.?explorer|offline.navigator|openfind|outfoxbot|pagegrabber|papa|pavuk|pcbrowser|php.?version.?tracker|pockey|propowerbot|prowebwalker|psbot|pump|queryn|recorder|realdownload|reaper|reget|true_robot|repomonkey|rma|internetseer|sitesnagger|siphon|slysearch|smartdownload|snake|snapbot|snoopy|sogou|spacebison|spankbot|spanner|sqworm|superbot|superhttp|surfbot|asterias|suzuran|szukacz|takeout|teleport|telesoft|the.intraformant|thenomad|tighttwatbot|titan|urldispatcher|turingos|turnitinbot|urly.warning|vacuum|vci|voideye|whacker|libwww-perl|widow|wisenutbot|wwwoffle|xaldon|xenu|zeus|zyborg|anonymouse|zip|emaile|enhancer|fetch|go.?is|auto|bandit|clip|copier|master|sauger|site.quester|whack|craftbot|download|extract|stripper|sucker|ninja|clshttp|webspider|leacher|grabber|webpictures|Jakarta|libwww|lwp-trivial|PHPCrawl|WEP Search|Missigua Locator|ISC Systems iRc|Aboundex|360Spider|Java|Cogentbot|BunnySlippers|Cegbfeieh|AIBOT|Demon|Devil|Wonder|Foobot|Kenjin Spider|Density|LinkextractorPro|LWP::Simple|MassDownloader|Mass Downloader|NetZIP|NG|Metasearch|WebFetch|WebCopier|Webclipping|WebBandit|WebAuto|WebGo|Web.Image.Collector|WebLeacher|WebmasterWorldForumBot|WebReaper|WebSauger|eXtractor|Webster|WebStripper|WebWhacker|WebZIP|Catall Spider|AcoiRobot|rogerbot|MJ12bot|Ahrefsbot|dobot|MegaIndex.ru|SemrushBot|LinkpadBot|Zite|TweetmemeBot|woriobot|topsy|js-kit|NING") {return 403;}

location /vstats/ {
    alias   %home%/%user%/web/%domain%/stats/;
    include %home%/%user%/web/%domain%/stats/auth.conf*;
}

include     /etc/nginx/conf.d/phpmyadmin.inc*;
include     /etc/nginx/conf.d/phppgadmin.inc*;
include     /etc/nginx/conf.d/webmail.inc*;

include     %home%/%user%/conf/web/nginx.%domain_idn%.conf*;

}

В общем никто не помогает )
Я попробовал WpSuperCache, CacheEnabler, Litespeed plugin, Breeze.
Короче работает прямо после установки без танцев только Breeze.
Cache Enabler технически понравился, но завести его не удалось.

A: Ваш конфиг не смотрел. Только что проверил на новом сайте с таким конфигом:
server {
    server_name example.com www.example.com;

    access_log   /var/log/nginx/example.com.access.log;
    error_log    /var/log/nginx/example.com.error.log debug;

    root /var/www/example.com/htdocs;
    index index.php;

    set $cache_uri $request_uri;

    # POST requests and urls with a query string should always go to PHP
    if ($request_method = POST) {
        set $cache_uri 'null cache';
    }
    if ($query_string != "") {
        set $cache_uri 'null cache';
    }

    # Don't cache uris containing the following segments
    if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
        set $cache_uri 'null cache';
    }

    # Don't use the cache for logged in users or recent commenters
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
        set $cache_uri 'null cache';
    }

    # Use cached or actual file if they exists, otherwise pass request to WordPress
    location / {
        try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php ;
    }

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt  { log_not_found off; access_log off; }

    location ~ \.php$ {
        try_files $uri =404;
        include fastcgi_params;
                fastcgi_pass 127.0.0.1:9000;
    }

    # Cache static files for as long as possible
    location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
        expires max; log_not_found off; access_log off;
    }
}

Всё завелось с первого раза. Не забудьте перезагрузить сервер.


text:
Q: Optimal way to find union of two data sets I am working on a side project where I am comparing two different databases and want to find the common elements of the data sets based on the "id" field. I want to know if there is an optimal solution instead of using two nested for loops. Is there a way to do it with a hash map? Many Thanks!
Below is the sample code I am working with.
UPDATE all ids are unique with no possibility of there being a duplicate

// data set 1
const set1 = [
  {
    id: "001",
    name: "bob",
    age: "50",
    location: "texas"
  },
    {
    id: "002",
    name: "bill",
    age: "51",
    location: "texas"
  },
    {
    id: "003",
    name: "ben",
    age: "52",
    location: "texas"
  },
    {
    id: "004",
    name: "cam",
    age: "53",
    location: "texas"
  },
    {
    id: "005",
    name: "max",
    age: "54",
    location: "texas"
  }
]

// data set 2
const set2 = [
  {
    id: "001",
    name: "bob"
  },
  {
    id: "002",
    name: "bill"
  }
]

// I want to create a function where I find the the common elements of the two lists based on id and put the common element of data set 1 into a list and return that list

const findUnion(set1, set2) {
  // logic here, I know I can do a nested for loop but is there a more efficient way such as
  // using a hashmap? ( Map() object? )
}

// desired output
const output = [
  {
    id: "001",
    name: "bob",
    age: "50",
    location: "texas"
  },
    {
    id: "002",
    name: "bill",
    age: "51",
    location: "texas"
  }
]

A: You can use Sets for efficient lookup:
const ids1 = new Set(set1.map(({id}) => id));
const ids2 = new Set(set2.map(({id}) => id));
const output = set1.filter(({id}) => ids1.has(id) && ids2.has(id));
console.log(output);

A: First we combine into one long array. Then group by id using reduce method. Each group contains the item and count of appearances. Finally, for each of the groups, return only those with count of appearances > 1.
Edit: fixed algorithm see code.
Edit 2: Made it more generic so order of items won't matter. This is by extending the duplicates rather then replacing them.

function findUnion(set1, set2) {

  // first remove duplicates from each set
  // bonus: collect duplicates
  var duplicates;

  function dedup(set) {
    duplicates = []
    return Object.values(set.reduce(function(agg, item) {
      var merged = item;
      if (agg[item.id]) {
        merged = { ...agg[item.id],
          ...item
        }
        duplicates.push(merged)
      }
      agg[item.id] = merged;
      return agg
    }, {}));
  }

  set1 = dedup(set1);
  set2 = dedup(set2);

  // then combine
  var combined = [...set1, ...set2]

  // then remove duplicates again, this time keep them
  dedup(combined)
  return duplicates;
}

// data set 1
const set1 = [{
    id: "001",
    name: "bob",
    age: "50",
    location: "texas"
  },
  {
    id: "002",
    name: "bill",
    age: "51",
    location: "texas"
  },
  {
    id: "003",
    name: "ben",
    age: "52",
    location: "texas"
  },
  {
    id: "004",
    name: "cam",
    age: "53",
    location: "texas"
  },
  {
    id: "005",
    name: "max",
    age: "54",
    location: "texas"
  },
  {
    id: "005",
    name: "max",
    age: "54",
    location: "texas"
  },
  {
    id: "005",
    name: "max",
    age: "54",
    location: "texas"
  }
]

// data set 2
const set2 = [{
    id: "001",
    name: "bob"
  },
  {
    id: "002",
    name: "bill"
  }
]

// desired output
const output = [{
    id: "001",
    name: "bob",
    age: "50",
    location: "texas"
  },
  {
    id: "002",
    name: "bill",
    age: "51",
    location: "texas"
  }
]

console.log(findUnion(set1, set2))

A: First of all, you're looking for the intersection, not the union.
As others have said, we can use a Set to track uniqueness.  This gives us near O(1) lookup time, and allows us algorithm that runs in something like O(m + n) time where m and n are the sizes of your sets:

const intersection = (s1, s2, ids = new Set (s2 .map (x => x .id))) =>
  s1 .filter (({id}) => ids .has (id))

const set1 = [{id: "001", name: "bob", age: "50", location: "texas"}, {id: "002", name: "bill", age: "51", location: "texas"}, {id: "003", name: "ben", age: "52", location: "texas"}, {id: "004", name: "cam", age: "53", location: "texas"}, {id: "005", name: "max", age: "54", location: "texas"}]
const set2 = [{id: "001", name: "bob"}, {id: "002", name: "bill"}]

console .log (intersection (set1, set2))
.as-console-wrapper {max-height: 100% !important; top: 0}


text:
Q: Reset used CSS properties set by parent element for a modal I use Twitter Bootstrap's alert feature to annotate an HTML table based on some statuses. In each table cell, there is also a modal window. The modal window inherits the CSS properties set by  element using alert* features:

  Modal Link

Modal Content

So, when the modal displays it actually displays with the colors set by the type of alert which is already set by the parent td. Is there anyway to reset the CSS properties for the modal div?

A: You could write a style just for that
 that overrides all the properties defined for  .alert. However, I usually put the modal
 outside the
.

  ...

    Modal Link

  ...

Modal Content

The modal
 is not going to be shown inside the  so no sense in putting it there.


text:
Q: Aws Glue Workflow triggering multiple times one job (incorrect behavior) I have a big glue workflow (about 100 jobs / crawlers), and it was executing properly until last week. Since then, my first conditional trigger (ALL), is executing 20 time the same job.
I've configured the job it self, to just allow 1 parallel execution, but every time the workflow executes, it tries to launch 20 times (the same job).
Also configured the workflow, to allow a max concurrency of 1, but that doesn't fix the problem.
Since i started working with glue workflow, i've noticed that the tool it self is buggy, old and maybe deprecated ?
Any tips on how to fix this problem ?

A: I too have faced similar problems. Even one is fixed, some other issue would occur lately. So my suggestion is to try using step functions.


text:
Q: How to make an application keep watching for any added file in a directory and execute it, then wait for another new file and repeat the process I am looking for a way to keep my python script watching a directory for any new file, so that my script can execute that added file. I don't want to strain my CPU with a while loop that keeps on running the script checking at each and every while loop cycle straining the CPU, on the other hand, the sleep function only limits the script to run after a designated time, thus the sleep function is not flexible to new changes, it runs on specific intervals hence not efficient.
Is there a method using the sleep function that waits until a certain file is added, then triggers the script to run instantly without exiting the script.
As I mentioned above, when it runs this new added file(the code for running the latest added file I already have it, I made use of the os.stat function which allows me to pick the latest file and store it in a list), I want to keep the script watching without exiting, that is to say it will be in a sleep mode, to reduce CPU usage, and is only triggered again when a new file is in the directory.
How best can I attack this trigger mechanism without straining CPU with the continuously running while loop and also without using the inflexible sleep function which only checks for changes after certain intervals.
I want the script to be highly autonomous, that is to say, it's only activated when a new file is added and go back to sleep again when done processing, then wakes up(is triggered) when a new file is detected in the directory.
Regards Wisdom.


text:
Q: Need VBA code to plot up series of linear data in Excel, create regression eq's for each series, then write the regression eq's in the Excel sheet I have a fairly simple VBA code which is doing 75% of what I need it to do, I just can't get the last step to work properly.
In an Excel sheet, I have two sets of data (X data and Y data).  The x data is the same two data values for every single case.  Then I have two columns of data which comprise the Y data.  I need to create an Excel scatter plot with a whole bunch of data series.  Series 1 is the two constant x values with the first y value from the first column and the first y value from the second column.  The 2nd series is the same two constant x values with the second y value from the first column and the second y value from the second column, and so on.  The columns have about 300+ rows (hence > 300 series total).  I realize that a scatter plot can only do up to about 256 series in one plot so I won't be able to fit them all in one plot.  That's not the point.  I've tried just plotting like, say, 50 of the series and I have that part working fine.  Next, because all the series are straight lines, I need the slope/regression information from each series, so I create a linear trendline and plot the equation on the chart.  I have this part automated and working correctly in Excel as well.  Here's where I'm stuck though.  The last step is, after I've had VBA create the, say, 50 series in the single plot and generate all of the regression equations, I then need for Excel to take those equations and paste them into a column in the main worksheet (where the plotting data resides).  I found something on Google that is supposed to do this (grabbing trendline.datalabel.text and pasting it into the sheet), but it isn't working right, and I can't figure out what I'm doing wrong.  I've tried 20 different things and am still beating my head against a wall.  Any help with the last half of the code would be greatly appreciated.  THANK YOU.
Sub Plot_slopes()

Dim i As Integer

Dim ChtOb As ChartObject

   Dim objTrendline As Trendline

  Dim strEquation As String

Set ChtOb = ActiveSheet.ChartObjects.Add(Left:=20, Width:=800, Top:=20, Height:=250)

ChtOb.Chart.ChartType = xlXYScatterSmoothNoMarkers
ChtOb.Activate

i = 9

For i = 9 To 59

With ActiveChart.SeriesCollection.NewSeries
    .Name = "FS" & i
    .XValues = Worksheets("summary").Range(Worksheets("summary").Cells(3, 7), Worksheets("summary").Cells(4, 7))
    .Values = Worksheets("summary").Range(Worksheets("summary").Cells(i, 13), Worksheets("summary").Cells(i, 14))
    .Trendlines.Add

     End With

With ActiveSheet.ChartObjects(1).Chart

Set objTrendline = .Trendlines(1)

With objTrendline

   .DisplayRSquared = False
    Trendlines(1).DisplayEquation = True
    strEquation = .DataLabel.Text
    Range("Q9").Offset(i, 0) = strEquation

End With

End With

    Next i

End Sub

I mainly need help with the code after the first With Block and where it starts with a new "with"..."with activesheet.chartobjects(1).chart", etc), although, I'm also having trouble with the .name part in the first With block as well.  Goal is to get the last block so that VBA writes out the regression equations for each created series into the main "summary" worksheet


text:
Q: Why is GitVersion Semver patch number offsetting automatically? Maybe a really silly question, but I'm new to GitVersion and trying to set it up in our repo for the first time. I created a branch off of the master branch feature/playing-with-gitversion, installed GitVersion via chocolatey and ran through the setup gitversion init. Gitflow and Mainline modes are what I configured the repo for. I would like to set the next-version variable to 1.0.30 (we had been doing semver manually and already used 1-29), but it keeps offsetting the patch number +60
Here is my GitVersion.yml file:
assembly-versioning-scheme: MajorMinorPatch
mode: Mainline
next-version: 1.0.30
branches:
  feature: {}
ignore:
  sha: []
merge-message-formats: {}

And here is what the semver ends up being:
gitversion /showvariable MajorMinorPatch
1.0.90

I would really like gitversion to just honor the 1.0.30 from GitVersion.yml. I have tried clearing the cache and also trying gitversion /overrideconfig pre-release-weight=0 thinking that variable might be the culprit. What (hopefully) simple thing am I overlooking?


text:
Q: Swift Message Box how to add message box in Swift and make it compatible with IOS 7 +
I have the following code which works with IOS 8:
 var alert = UIAlertController(title: "hello world", message:
            "DO YOU WANT TO PLAY", preferredStyle: UIAlertControllerStyle.Alert)

self.presentViewController(alert, animated: false, completion: nil)

alert.addAction(UIAlertAction(title: "No", style: UIAlertActionStyle.Default,
      handler: nil))
alert.addAction(UIAlertAction(title: "Yes", style: .Default, handler:
  {action in
   // CODE
}))

and I have the following code which works with IOS 7 + (I don't know how to respond to the button click):
    var alert = UIAlertView()
    alert.title = "HelloWorld"
    alert.message = "DO YOU WANT TO PLAY"
    alert.addButtonWithTitle("Yes")
    alert.addButtonWithTitle("No")
    alert.show()

How to modify either of these codes and make it fully work?

A: You can make your class conform to the 'UIAlertViewDelegate' protocol and implement this method:
func alertView(alertView: UIAlertView!, clickedButtonAtIndex buttonIndex: Int) {

    if (buttonIndex == 0) {
       //Do something
    }
}

There you can handle any user interaction with your alertview.
You can determine which button was tapped by the user by checking the buttonIndex variable.
This will work in iOS 7 and 8


text:
Q: How to detect blocking on doubleclick adsense(DFP) code using javascript? A lot of people use plugins like Adblock to avoid banners on websites. If you can detect that plugin, you can easily display an image or text of your preference.
I have Try For this Code
<script>
  window.onload = function() {
    setTimeout(function() {
      if ( typeof(window.google_jobrunner) === "undefined" ) {
        alert("adblcoker is Enabled");
      } else {
        alert("adblacker is not founed")
      }
    }, 2000);
  };
</script>

But This Code only detect on google AdSense code.
How to detect on "doubleclick adsense (DFP) code"?


text:
Q: Principal Part and little o notation The function is $f(x) = 2x + e^{x+x^{4/3}} -1$ and the question wants the principal part with respect to $g(x)=x$ as $x$ goes to $0^+$.
I solved it using MacLaurin expansion and I got $3x$, but should it also have the little $o$ notation with the answer, like $3x + o(x)$?

A: As $x\to 0^+$,
$$e^{x+x^{4/3}}=1+(x+x^{4/3})+O(x^2)=1+x+O(x^{4/3}).$$
with Big O notation. Therefore you may write
$$f(x)=3x+O(x^{4/3})\quad\mbox{or}\quad f(x)=3x+o(x^{a})$$
with any $1\leq a<4/3$.


text:
Q: How enterprises distribute updates for Linux machines? In my use-case, I have Ubuntu machine which is part of organization network but disconnected from the Internet. Yet, somehow it should receive security updates.
How it is usually done in enterprises?
(for example, I know that for Windows machines IT distribute updates via Windows Update. Is there something similar for Linux?)

A: I'm not sure about rpm based distribution as the main one Debian has no editor behind it, but for Red Hat Enterprise Linux you can use Satellite
It makes it possible to use your Red Hat subscription and then use it to register your RHEL machines. You can also push updates to the machines.


text:
Q: While generating ionic cordova build android I'm getting this error in my OkConnectionFactory.java file
This is my Build.gradle file and I'm using android gradle 3.5.0. I have reached allot for this error but didn't got any help.
 apply plugin: 'com.android.application'

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url "https://maven.google.com"
        }

    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
    }
}

// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://maven.google.com"
        }

    }
}

/*task wrapper(type: Wrapper) {
    gradleVersion = '5.6.2'
}*/

// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.
// Refer to: http://www.gradle.org/docs/current/userguide/tutorial_this_and_that.html
ext {
    apply from: 'CordovaLib/cordova.gradle'
// The following are only a few examples of the types of properties you can define.
    compileSdkVersion = 28
    // You can also create properties to specify versions for dependencies.
    // Having consistent versions between modules can avoid conflicts with behavior.
    supportLibVersion = "28.0.0"
    // The value for android.compileSdkVersion.
    if (!project.hasProperty('cdvCompileSdkVersion')) {
        cdvCompileSdkVersion = null;
    }
    // The value for android.buildToolsVersion.
    if (!project.hasProperty('cdvBuildToolsVersion')) {
        cdvBuildToolsVersion = null;
    }
    // Sets the versionCode to the given value.
    if (!project.hasProperty('cdvVersionCode')) {
        cdvVersionCode = null
    }
    // Sets the minSdkVersion to the given value.
    if (!project.hasProperty('cdvMinSdkVersion')) {
        cdvMinSdkVersion = null
    }
    // Whether to build architecture-specific APKs.
    if (!project.hasProperty('cdvBuildMultipleApks')) {
        cdvBuildMultipleApks = null
    }
    // .properties files to use for release signing.
    if (!project.hasProperty('cdvReleaseSigningPropertiesFile')) {
        cdvReleaseSigningPropertiesFile = null
    }
    // .properties files to use for debug signing.
    if (!project.hasProperty('cdvDebugSigningPropertiesFile')) {
        cdvDebugSigningPropertiesFile = null
    }
    // Set by build.js script.
    if (!project.hasProperty('cdvBuildArch')) {
        cdvBuildArch = null
    }

    // Plugin gradle extensions can append to this to have code run at the end.
    cdvPluginPostBuildExtras = []
}

// PLUGIN GRADLE EXTENSIONS START
apply from: "cordova-plugin-code-push/myApp-build-extras.gradle"
apply from: "cordova-android-support-gradle-release/myApp-cordova-android-support-gradle-release.gradle"
// PLUGIN GRADLE EXTENSIONS END

def hasBuildExtras = file('build-extras.gradle').exists()
if (hasBuildExtras) {
    apply from: 'build-extras.gradle'
}

// Set property defaults after extension .gradle files.
if (ext.cdvCompileSdkVersion == null) {
    ext.cdvCompileSdkVersion = privateHelpers.getProjectTarget()
}
if (ext.cdvBuildToolsVersion == null) {
    ext.cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
}
if (ext.cdvDebugSigningPropertiesFile == null && file('debug-signing.properties').exists()) {
    ext.cdvDebugSigningPropertiesFile = 'debug-signing.properties'
}
if (ext.cdvReleaseSigningPropertiesFile == null && file('release-signing.properties').exists()) {
    ext.cdvReleaseSigningPropertiesFile = 'release-signing.properties'
}

// Cast to appropriate types.
ext.cdvBuildMultipleApks = cdvBuildMultipleApks == null ? false : cdvBuildMultipleApks.toBoolean();
ext.cdvMinSdkVersion = cdvMinSdkVersion == null ? null : Integer.parseInt('' + cdvMinSdkVersion)
ext.cdvVersionCode = cdvVersionCode == null ? null : Integer.parseInt('' + cdvVersionCode)

def computeBuildTargetName(debugBuild) {
    def ret = 'assemble'
    if (cdvBuildMultipleApks && cdvBuildArch) {
        def arch = cdvBuildArch == 'arm' ? 'armv7' : cdvBuildArch
        ret += '' + arch.toUpperCase().charAt(0) + arch.substring(1);
    }
    return ret + (debugBuild ? 'Debug' : 'Release')
}

// Make cdvBuild a task that depends on the debug/arch-sepecific task.
task cdvBuildDebug
cdvBuildDebug.dependsOn {
    return computeBuildTargetName(true)
}

task cdvBuildRelease
cdvBuildRelease.dependsOn {
    return computeBuildTargetName(false)
}

task cdvPrintProps doLast {
    println('cdvCompileSdkVersion=' + cdvCompileSdkVersion)
    println('cdvBuildToolsVersion=' + cdvBuildToolsVersion)
    println('cdvVersionCode=' + cdvVersionCode)
    println('cdvMinSdkVersion=' + cdvMinSdkVersion)
    println('cdvBuildMultipleApks=' + cdvBuildMultipleApks)
    println('cdvReleaseSigningPropertiesFile=' + cdvReleaseSigningPropertiesFile)
    println('cdvDebugSigningPropertiesFile=' + cdvDebugSigningPropertiesFile)
    println('cdvBuildArch=' + cdvBuildArch)
    println('computedVersionCode=' + android.defaultConfig.versionCode)
    android.productFlavors.each { flavor ->
        println('computed' + flavor.name.capitalize() + 'VersionCode=' + flavor.versionCode)
    }
}

android {
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['libs']
        }
    }

    defaultConfig {
        versionCode cdvVersionCode ?: new BigInteger("" + privateHelpers.extractIntFromManifest("versionCode"))
        applicationId privateHelpers.extractStringFromManifest("package")
        minSdkVersion 16

        if (cdvMinSdkVersion != null) {
            minSdkVersion cdvMinSdkVersion
        }
    }

    lintOptions {
      abortOnError false;
    }

    compileSdkVersion 27
    buildToolsVersion '28.0.3'

    if (Boolean.valueOf(cdvBuildMultipleApks)) {
        productFlavors {
            armv7 {
                versionCode defaultConfig.versionCode*10 + 2
                ndk {
                    abiFilters "armeabi-v7a", ""
                }
            }
            x86 {
                versionCode defaultConfig.versionCode*10 + 4
                ndk {
                    abiFilters "x86", ""
                }
            }
            all {
                ndk {
                    abiFilters "all", ""
                }
            }
        }
    }
 signingConfigs {
        //Your configuration here
        Production {
                // These must be set or Gradle will complain (even if they are overridden).
                keyAlias = ""
                keyPassword = "__unset" // And these must be set to non-empty in order to have the signing step added to the task graph.
                storeFile = null
                storePassword = "__unset"
            }
        release {
                // These must be set or Gradle will complain (even if they are overridden).
                keyAlias = ""
                keyPassword = "__unset" // And these must be set to non-empty in order to have the signing step added to the task graph.
                storeFile = null
                storePassword = "__unset"
            }

       }
    buildTypes {

     release {
         lintOptions {
             checkReleaseBuilds false
             // Or, if you prefer, you can continue to check for errors in release builds,
             // but continue the build even when errors are found:
             abortOnError false
         }
         debuggable true
         minifyEnabled true
         proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
         signingConfig signingConfigs.Production
         buildConfigField "String", "SERVER_URL", '"http://192.131.543"'
      }

    debug {
        debuggable true
        buildConfigField "String", "SERVER_URL", '"http://192.131.543"'

    }
}
    /*

    ELSE NOTHING! DON'T MESS WITH THE VERSION CODE IF YOU DON'T HAVE TO!

    else if (!cdvVersionCode) {
      def minSdkVersion = cdvMinSdkVersion ?: privateHelpers.extractIntFromManifest("minSdkVersion")
      // Vary versionCode by the two most common API levels:
      // 14 is ICS, which is the lowest API level for many apps.
      // 20 is Lollipop, which is the lowest API level for the updatable system webview.
      if (minSdkVersion >= 20) {
        defaultConfig.versionCode += 9
      } else if (minSdkVersion >= 14) {
        defaultConfig.versionCode += 8
      }
    }
    */

   /* compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_6
        targetCompatibility JavaVersion.VERSION_1_6
    } */

    if (cdvReleaseSigningPropertiesFile) {
        signingConfigs {
            release {
                // These must be set or Gradle will complain (even if they are overridden).
                keyAlias = ""
                keyPassword = "__unset" // And these must be set to non-empty in order to have the signing step added to the task graph.
                storeFile = null
                storePassword = "__unset"
            }

            Production {
                // These must be set or Gradle will complain (even if they are overridden).
                keyAlias = ""
                keyPassword = "__unset" // And these must be set to non-empty in order to have the signing step added to the task graph.
                storeFile = null
                storePassword = "__unset"
            }

        }
        buildTypes {
            release {
                signingConfig signingConfigs.release
            }

            Production {
                signingConfig signingConfigs.Production
            }

        }
        addSigningProps(cdvReleaseSigningPropertiesFile, signingConfigs.release)
    }
    if (cdvDebugSigningPropertiesFile) {
        addSigningProps(cdvDebugSigningPropertiesFile, signingConfigs.debug)
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: '*.jar')
   // implementation project(':CordovaLib')
    // SUB-PROJECT DEPENDENCIES START
    compile project('CordovaLib')
    compile "com.squareup.okhttp3:okhttp-urlconnection:4.1.1"
    compile "com.android.support:support-v4:27.1.0"
    // SUB-PROJECT DEPENDENCIES END
}

def promptForReleaseKeyPassword() {
    if (!cdvReleaseSigningPropertiesFile) {
        return;
    }
    if ('__unset'.equals(android.signingConfigs.release.storePassword)) {
        android.signingConfigs.release.storePassword = privateHelpers.promptForPassword('Enter key store password: ')
    }
    if ('__unset'.equals(android.signingConfigs.release.keyPassword)) {
        android.signingConfigs.release.keyPassword = privateHelpers.promptForPassword('Enter key password: ');
    }
}

gradle.taskGraph.whenReady { taskGraph ->
    taskGraph.getAllTasks().each() { task ->
        if (task.name == 'validateReleaseSigning' || task.name == 'validateSigningRelease') {
            promptForReleaseKeyPassword()
        }
    }
}

def addSigningProps(propsFilePath, signingConfig) {
    def propsFile = file(propsFilePath)
    def props = new Properties()
    propsFile.withReader { reader ->
        props.load(reader)
    }

    def storeFile = new File(props.get('key.store') ?: privateHelpers.ensureValueExists(propsFilePath, props, 'storeFile'))
    if (!storeFile.isAbsolute()) {
        storeFile = RelativePath.parse(true, storeFile.toString()).getFile(propsFile.getParentFile())
    }
    if (!storeFile.exists()) {
        throw new FileNotFoundException('Keystore file does not exist: ' + storeFile.getAbsolutePath())
    }
    signingConfig.keyAlias = props.get('key.alias') ?: privateHelpers.ensureValueExists(propsFilePath, props, 'keyAlias')
    signingConfig.keyPassword = props.get('keyPassword', props.get('key.alias.password', signingConfig.keyPassword))
    signingConfig.storeFile = storeFile
    signingConfig.storePassword = props.get('storePassword', props.get('key.store.password', signingConfig.storePassword))
    def storeType = props.get('storeType', props.get('key.store.type', ''))
    if (!storeType) {
        def filename = storeFile.getName().toLowerCase();
        if (filename.endsWith('.p12') || filename.endsWith('.pfx')) {
            storeType = 'pkcs12'
        } else {
            storeType = signingConfig.storeType // "jks"
        }
    }
    signingConfig.storeType = storeType
}

for (def func : cdvPluginPostBuildExtras) {
    func()
}

// This can be defined within build-extras.gradle as:
//     ext.postBuildExtras = { ... code here ... }
if (hasProperty('postBuildExtras')) {
    postBuildExtras()
}

This is my CordovaLib Build.gradle file. Any help will be highly appreciated.
   ext {
    apply from: 'cordova.gradle'
    cdvCompileSdkVersion = privateHelpers.getProjectTarget()
    cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
}

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }

   dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
    }
}

apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

group = 'org.apache.cordova'
version = '6.3.0'

android {
    compileSdkVersion cdvCompileSdkVersion
    buildToolsVersion cdvBuildToolsVersion
    publishNonDefault true

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_6
        targetCompatibility JavaVersion.VERSION_1_6
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
    }
    defaultConfig {
        minSdkVersion 14
    }
}

install {
    repositories.mavenInstaller {
        pom {
            project {
                packaging 'aar'
                name 'Cordova'
                url 'https://cordova.apache.org'
                licenses {
                    license {
                        name 'The Apache Software License, Version 2.0'
                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                    }
                }
                developers {
                    developer {
                        id 'stevengill'
                        name 'Steve Gill'
                    }
                }
                scm {
                    connection 'https://git-wip-us.apache.org/repos/asf?p=cordova-android.git'
                    developerConnection 'https://git-wip-us.apache.org/repos/asf?p=cordova-android.git'
                    url 'https://git-wip-us.apache.org/repos/asf?p=cordova-android'

                }
            }
        }
    }
}

task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

artifacts {
    archives sourcesJar
}

bintray {
    user = System.getenv('BINTRAY_USER')
    key = System.getenv('BINTRAY_KEY')
    configurations = ['archives']
    pkg {
        repo = 'maven'
        name = 'cordova-android'
        userOrg = 'cordova'
        licenses = ['Apache-2.0']
        vcsUrl = 'https://git-wip-us.apache.org/repos/asf?p=cordova-android.git'
        websiteUrl = 'https://cordova.apache.org'
        issueTrackerUrl = 'https://issues.apache.org/jira/browse/CB'
        publicDownloadNumbers = true
        licenses = ['Apache-2.0']
        labels = ['android', 'cordova', 'phonegap']
        version {
            name = '6.3.0'
            released  = new Date()
            vcsTag = '6.3.0'
        }
    }
}

This is my distribution URL

distributionUrl=https://services.gradle.org/distributions/gradle-5.4.1-all.zip

This is my okConnectionFactory.java file
    package com.github.kevinsawicki.http;
import okhttp3.OkUrlFactory;
import okhttp3.OkHttpClient;
import java.net.URL;
import java.net.HttpURLConnection;
import java.net.URLStreamHandler;
import java.net.Proxy;

public class OkConnectionFactory implements HttpRequest.ConnectionFactory {

    protected OkHttpClient okHttpClient = new OkHttpClient();

    public HttpURLConnection create(URL url) {
        OkUrlFactory okUrlFactory = new OkUrlFactory(okHttpClient);
        return (HttpURLConnection) okUrlFactory.open(url);
    }

    public HttpURLConnection create(URL url, Proxy proxy) {
        OkHttpClient okHttpClientWithProxy = okHttpClient.newBuilder().proxy(proxy).build();
        OkUrlFactory okUrlFactory = new OkUrlFactory(okHttpClientWithProxy);
        return (HttpURLConnection) okUrlFactory.open(url);
    }
}

This is my Plugin list
 {
  "homepage": "",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@agm/core": "1.0.0-beta.3",
    "@angular/common": "4.0.0",
    "@angular/compiler": "4.0.0",
    "@angular/compiler-cli": "4.0.0",
    "@angular/core": "4.0.0",
    "@angular/forms": "4.0.0",
    "@angular/http": "4.0.0",
    "@angular/platform-browser": "4.0.0",
    "@angular/platform-browser-dynamic": "4.0.0",
    "@ionic-native/barcode-scanner": "4.4.2",
    "@ionic-native/base64": "^4.17.0",
    "@ionic-native/battery-status": "4.15.0",
    "@ionic-native/camera": "4.13.0",
    "@ionic-native/core": "4.1.0",
    "@ionic-native/email-composer": "^5.0.0",
    "@ionic-native/file": "4.14.0",
    "@ionic-native/file-chooser": "^4.17.0",
    "@ionic-native/file-opener": "^4.17.0",
    "@ionic-native/file-path": "4.1.0",
    "@ionic-native/file-transfer": "^4.13.0",
    "@ionic-native/geolocation": "4.4.2",
    "@ionic-native/http": "^4.20.0",
    "@ionic-native/keyboard": "3.4.4",
    "@ionic-native/media": "4.14.0",
    "@ionic-native/media-capture": "4.14.0",
    "@ionic-native/network": "4.3.2",
    "@ionic-native/phonegap-local-notification": "^4.20.0",
    "@ionic-native/push": "^4.6.0",
    "@ionic-native/splash-screen": "3.4.4",
    "@ionic-native/status-bar": "3.4.4",
    "@ionic-native/transfer": "3.14.0",
    "@ionic-native/video-capture-plus": "4.13.0",
    "@ionic-native/video-player": "4.14.0",
    "@ionic/cloud-angular": "0.12.0",
    "@ionic/storage": "2.0.1",
    "@types/cordova-plugin-battery-status": "1.2.3",
    "@types/cordova-plugin-media": "3.0.0",
    "@types/ionic": "3.19.0",
    "@types/underscore": "1.8.9",
    "angular2-signaturepad": "2.6.1",
    "babel-runtime": "6.26.0",
    "backo2": "1.0.2",
    "com-badrit-base64": "^0.2.0",
    "com.moust.cordova.videoplayer": "https://github.com/moust/cordova-plugin-videoplayer.git",
    "component-bind": "1.0.0",
    "cordova": "^8.1.2",
    "cordova-android": "^7.1.0",
    "cordova-android-support-gradle-release": "^3.0.1",
    "cordova-plugin-advanced-http": "^2.0.6",
    "cordova-plugin-battery-status": "^2.0.2",
    "cordova-plugin-camera": "^2.4.1",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-device": "^1.1.7",
    "cordova-plugin-file": "^4.3.3",
    "cordova-plugin-file-opener2": "^2.2.0",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-filechooser": "^1.2.0",
    "cordova-plugin-geolocation": "^2.4.3",
    "cordova-plugin-ionic-webview": "^1.2.1",
    "cordova-plugin-media": "^5.0.2",
    "cordova-plugin-media-capture": "^1.4.3",
    "cordova-plugin-splashscreen": "^4.1.0",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-video-capture-plus": "1.0.0",
    "cordova-plugin-video-player": "git+https://github.com/moust/cordova-plugin-videoplayer.git",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-wkwebview-engine": "git+https://github.com/driftyco/cordova-plugin-wkwebview-engine.git",
    "cordova-sqlite-storage": "^2.6.0",
    "engine.io-client": "3.1.4",
    "express": "^4.16.4",
    "font-awesome": "4.7.0",
    "has-binary": "0.1.7",
    "infinite-scroll": "^3.0.6",
    "ionic": "^4.3.1",
    "ionic-angular": "3.0.1",
    "ionic-image-loader": "4.1.1",
    "ionic-img-viewer": "1.3.4",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "isobject": "3.0.1",
    "jquery": "3.2.1",
    "lodash": "4.17.4",
    "moment": "2.22.2",
    "moment-timezone": "0.5.13",
    "ng-socket-io": "^0.2.4",
    "npm-push": "^0.4.8",
    "parseuri": "0.0.5",
    "phonegap-plugin-barcodescanner": "^7.1.2",
    "phonegap-plugin-local-notification": "1.0.1",
    "phonegap-plugin-push": "^1.11.1",
    "reflect-metadata": "0.1.10",
    "rxjs": "5.1.1",
    "setimmediate": "1.0.5",
    "signature_pad": "2.3.2",
    "socket.io": "^2.2.0",
    "socket.io-client": "1.7.3",
    "socket.io-parser": "3.1.2",
    "sw-toolbox": "3.4.0",
    "to-array": "0.1.4",
    "underscore": "1.9.1",
    "zone.js": "0.8.4"
  },
  "devDependencies": {
    "@angular/tsc-wrapped": "4.4.6",
    "@ionic/app-scripts": "1.3.0",
    "@ionic/cli-plugin-cordova": "1.6.2",
    "@ionic/cli-plugin-ionic-angular": "1.4.1",
    "@types/lodash": "4.14.62",
    "@types/moment-timezone": "0.2.34",
    "@types/socket.io-client": "1.4.29",
    "typescript": "2.2.1"
  },
  "cordova": {
    "platforms": [
      "android"
    ],
    "plugins": {
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-wkwebview-engine": {},
      "cordova-sqlite-storage": {},
      "ionic-plugin-keyboard": {},
      "phonegap-plugin-push": {
        "SENDER_ID": "694054568313"
      },
      "cordova-plugin-media-capture": {},
      "phonegap-plugin-barcodescanner": {
        "CAMERA_USAGE_DESCRIPTION": " ",
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      },
      "cordova-plugin-file-transfer": {},
      "cordova-plugin-geolocation": {
        "GEOLOCATION_USAGE_DESCRIPTION": "To locate you"
      },
      "com.moust.cordova.videoplayer": {},
      "cordova-plugin-camera": {},
      "cordova-plugin-media": {},
      "cordova-plugin-file": {},
      "cordova-plugin-battery-status": {},
      "cordova-plugin-compat": {},
      "cordova-plugin-file-opener2": {
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      },
      "cordova-plugin-advanced-http": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-filechooser": {},
      "com-badrit-base64": {},
      "phonegap-plugin-local-notification": {},
      "cordova-android-support-gradle-release": {
        "ANDROID_SUPPORT_VERSION": "27.+"
      }
    }
  }
}


text:
Q: Unable to Add, Edit, or Remove users and groups for Enterprise Application I've created and registered a web application via Azure Active Directory -> App Registrations.
Within my application manifest I've created a role (why there's no UI to do this is beyond me), and for now am planning on adding quite a few more.
However, I'm unable to assign users to the role I created via Azure Active Directory -> Enterprise Applications, as the Add, Edit, and Remove options are greyed out.
According to these docs, I need to be Global Admin to be able to set these.  The only way I can do so is to keep pestering my network admin every time I want to assign users/groups to roles.  This is obviously not a suitable solution, and as the registered application owner, it should be trivial for me to control the authorization levels of my application.
How is it possible for me to assign users & groups to the roles I create?  If it's simply not possible without having to raise the issue with my global admin, what are my options?

A: Unfortunatelly, as per docs, you already went through, today only administrator can assign roles to an application.
There is a feature request to simplify that and Microsoft is working on a solution. If you give your vote, it will certainly make the request more important.
For time being it is only the Global Admin who can grant permissions to an Application.


text:
Q: After a render of not showing a child, the child state data was gone completely when it render again. Why's that and how to prevent it happening? In my parent component, there is a button to control whether to show the child or not.
In the input box, the input value is stored inside child component. When value is input, everything seem fine, data is recorded very fine in the child's state.
1.

*click to not show it

*click to show again

Child's input box value was gone, and the state value in child was gone as well.
How can I keep the value when I click to show the child again?
In parent:
import React, { useEffect, useState } from "react";
import ReactDOM from "react-dom";
import Child1 from "./child";

import "./styles.css";

function Parent() {
  const [message, setMessage] = useState("initial text");
  const [showChild,setShowChild] = useState(true);
  useEffect(() => {
    console.log("useeffect in parent");
  });

  return (

      <button onClick={() => setShowChild(!showChild)}>show child</button>
      {showChild?
      <Child1 />
      :
      null

  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<Parent />, rootElement);

In child:
import React, { useEffect, useState } from "react";

function Child1() {
  useEffect(() => {
    console.log("useeffect in child");
    console.log("newMessage: " + newMessage);
  });
  const [newMessage, setNewMessage] = useState("");

  return (

      <input onChange={(event) => setNewMessage(event.target.value)} />

  );
}

export default Child1;

A: This is because you are conditionally rendering <Child1 /> which means that when you click the toggle again to hide it, React basically unmounts it i.e. it is removed completely from the tree and thus all component state is lost. When you click the toggle again to show the component, it is mounted again.
One way to fix this would be to set show prop on the component itself and let it manage how it is shown and hidden. For example:
In parent:
  return (

      <button onClick={() => setShowChild(!showChild)}>show child</button>
      <Child1 show={showChild} />

  );

In child:
import React, { useEffect, useState } from "react";

function Child1(props) {
  useEffect(() => {
    console.log("useeffect in child");
    console.log("newMessage: " + newMessage);
  });
  const [newMessage, setNewMessage] = useState("");

  if (!props.show) return <React.Fragment />

  return (

      <input onChange={(event) => setNewMessage(event.target.value)} />

  );
}

export default Child1;

Inside child, you may alternatively use the prop show to set CSS style  display:none on div when show is false. This ways the input element itself with remain in the DOM but is simply hidden.
So instead of returning <React.Fragment /> we would modify the return statement as follows:
return (

    <input onChange={(event) => setNewMessage(event.target.value)} />

);

As a third option, you can "elevate the state" meaning that you move newMessage state up to parent and pass newMessage and setNewMessage down to child as props, and keep the rest of the code how it is in your question.
In parent:
const [newMessage, setNewMessage] = useState("");
...
return (
  ...
  <Child1 newMessage={newMessage} setNewMessage={setNewMessage} />
  ...
)

In child:
const {newMessage, setNewMessage} = props;

A: https://www.reddit.com/r/learnjavascript/comments/8z7lju/when_does_a_component_unmount/
I also find this is helpful
If the condition changes from true to false, then the new pass of rendering does not include child, and so the prior one will unmount.


text:
Q: Branch Referral Credits not being applied I'm implementing a Branch referral program into my application, but cannot get the rewards to apply correctly. The rule is straightforward and says:
Referring users get 7 default credits the first time users they've referred trigger the event registered

I'm running in debug mode and make sure to sign in using a brand new developer ID each time. I also follow the directions in Simulate an Install.
I use the legacy userCompletedAction method, as specified here. I call this after setting the identity, as so:
[[Branch getInstance] setIdentity:@"..." withCallback:^(...) {
    [[Branch getInstance] userCompletedAction:@"registered"];
    ...
}];

The referral seems to work since both +is_first_session and +clicked_branch_link are true, and $identity_id matches that of the referring user.
I can confirm that I see the event happen in the Event section of the LiveView tab of the Branch Dashboard (see screenshot below).

I do however not see anything in the "Credits" section a few tabs over, and can confirm that the credits were not applied to the referring user's account.
I have attempted to modify my rule to apply every time referred user's trigger the event registered to rule out any bugs related to using the same device, but it made no difference. I have created the rule in the test environment as well.
Any idea what's going wrong, why this is not working?


text:
Q: Exchange 2013 - IMAP with Wildcard Cert - Error when Set-ImapSettings Trying to get a wildcard cert working on Exchange 2013 for IMAP purposes.  Unable to add in ECP (receives error about it not having a FQDN since its a wildcard)
So then I try to run:
Set-ImapSettings -X509CertificateName sub.domain.com

However, I receive an error:

WARNING: The command completed successfully but no settings of
  'SERVERNAME\1' have been modified.

It never enables the IMAP setting for this cert.  I have verified with Get-RoleGroupMember that I am logged in as someone with Server Management capabilities.  Running Get-ExchangeCertificates | fl shows that IMAP service is never tying to this certificate.
Scoured the internet and my mind and can't find why my Set-ImapSettings isn't working correctly.
Any suggestions?  Not getting anything in event viewer that points to anything, I've restarted IMAP services (backend and imap4), tried to force enable IMAP service in powershell (Enable-ExchangeCertificate -Thumbnail xxx -Services imap), nothing has worked.

A: It doesn't show but normally IMAP should still be using the certificate after completing the commands. Did you verify this? Do you get a certificate error when trying to connect to IMAP with a mailbox in Outlook? If it didn't work, then you should get a certificate error (and if you then click "Show Certificate" you should see the self-signed certificate from your Exchange server.


text:
Q: How to create procedure hsqldb liquibase with spring unit test I have a procedure, namely check_customer_valid.
In production, I've already added it into dbchangelog file as below:
<createProcedure catalogName="check_customer_valid"
                         dbms="postgresql"
                         encoding="utf8"
                         procedureName="check_customer_valid"
                         relativeToChangelogFile="true"
                         schemaName="public">
....

But when I run unit test in spring, it throws error "user lacks privilege or object not found: CHECK_CUSTOMER_VALID" because I am using hsqldb in the test environment, while production db is postgres.
I tried to update dbms="postgresql,hsqldb" in above config, however it throws simple syntax "Error: java.sql.SQLSyntaxErrorException: unexpected token: OR". Therefore, I have to add a new changeSet for test env only to declare this procedure.
However the problem is that procedure in HSQL require INOUT parameters, but in postgres it isn't.
My change set for test env is
<changeSet id="sonny add procedure for testing" author="sonny">
        <createProcedure catalogName="check_customer_valid"
                         dbms="hsqldb"
                         encoding="utf8"
                         procedureName="check_customer_valid"
                         relativeToChangelogFile="true"
                         schemaName="public">
            CREATE PROCEDURE CHECK_CUSTOMER_VALID(IN customerName VARCHAR(50), IN customerCity VARCHAR(50), INOUT result BOOLEAN)
            MODIFIES SQL DATA
            BEGIN ATOMIC
                SET result = true;
            END
        </createProcedure>
    </changeSet>

The error is still the same. user lacks privilege or object not found: CHECK_CUSTOMER_VALID"


text:
Q: javascript change image when onmouseover and onmouseout I am a beginner and I am doing a homework and I have a small problem. My task is when onmouseover is on, image1 should be changed to image2. When onmouseout is on, image2 should be changed to image1
Onmouseover works but onmouseout does not work!
Here is my code:
<!DOCTYPE html>

<meta charset="utf-8">
<title>DOM_4</title>

Why my onmouseout does not work? I know there can be better ways to code, but I must use both onmouseover and onmouseout. There should be only HTML and simple javascript codes. (My teacher said so)

A: Your function name changePic22() is incorrect and you have also syntax error document.getElementByID
Replace you code to this one
function changePic1() {
  document.getElementById("myImg").src = "screen.jpg";
}
function changePic2(){
  document.getElementById("myImg").src = "bakground.jpg";
}

A: Try this one:
JS:
function changePic1() {
document.getElementById("myImg").src = "http://res.cloudinary.com/vishakhanehe/image/upload/v1481149848/mickeywaving_ttphnm.gif";
   }
  function changePic22(){
   document.getElementById("myImg").src = "http://res.cloudinary.com/vishakhanehe/image/upload/v1481149848/obama1_c1buc6.jpg";
   }

HTML:


text:
Q: Fastest method to insert words into UserDictionary I would like app to add several (2k) words to UserDictionary.
I have experimented with ContentResolver().insert/bulk insert....
// array of words
    String[] words = getResources().getStringArray(R.array.word_array);

    Long start,end = null;

    start = System.currentTimeMillis();

    int len = words.length;
    ContentValues[] mValueArray = new ContentValues[len];
    ContentValues mNewValues = new ContentValues();

    mNewValues.put(UserDictionary.Words.APP_ID, "com.my.example");
    mNewValues.put(UserDictionary.Words.LOCALE, "en");
    mNewValues.put(UserDictionary.Words.FREQUENCY, "100");

    for (int i = 0; i < len; ++i) {

        mNewValues.put(UserDictionary.Words.WORD, words[i]);

        mValueArray[i] = mNewValues;
    }

    getContentResolver().bulkInsert(
            UserDictionary.Words.CONTENT_URI,   // the user dictionary content URI
           mValueArray                       // the values to insert
        );
   end = System.currentTimeMillis();

   Toast toast = Toast.makeText(this, "Time for " + Integer.toString(len-1)+" words: " + Long.toString((end-start)) + "ms", 50);
   toast.show();

On my phone takes about 100ms per word if I do bulkinsert on batches of 100.  3+ minutes to insert 2k words.
Is anyone aware of a faster method to insert words or any optimization that can be done?
Side question: Is there an upper limit on UserDictionary size or does that depend on phone?
Any help appreciated
Michealster

A: Specific to your case:
Adding 2000 words in the dictionary at a stretch will take time and there is not much of an optimization which can be done. The time you see here are for the file operation and moving from Java->NDK->Native operation.
General:
Irrespective of the method used, one has to understand that these are nothing but file operations and is bound to take time. The APIs (including SQLite related) are just a wrapper to the intended file operations in the native code. Natively file write will always take a longer time then file read.

A: I've saw in the sources of Android that for large sql queries applyBatch method is used. In some other programs as ContactsRemover the authors also use this method. But I do not know if it is really faster then insert or bultInsert.


text:
Q: Haskell IO indentation I tried to rewrite that program, which is working:
nameIOite :: IO ()
nameIOite = do
    putStrLn "What's your name ?"
    name <- getLine
    if name `elem` ["Simon","John","Phil"]
  --if name == "Simon" || name == "John" || name == "Phil" also works but is ugly.
        then putStrLn "I think Haskell is a great programming language."
        else if name == "Koen"
            then putStrLn "I think debugging Haskell is fun."
            else putStrLn "I don't know your name."

This is done using if/then/else (therefore the suffix ite in nameIOite)
Then I'vs tried using guards:
nameIOg :: IO ()
nameIOg = do
    putStrLn "What's your name ?"
    name <- getLine
    let answer
        | name `elem` ["Simon","John","Phil"]   = "I think Haskell is a great programming language."
        | name == "Koen"                        = "I think debugging Haskell is fun."
        | otherwise                             = "I don't know your name."
    putStrLn answer

This didn't work:
test.hs:6:9: error:
parse error (possibly incorrect indentation or mismatched brackets)
  |
6 |    | name `elem` ["Simon","John","Phil"]   = "I think Haskell is   a great programming language."
  |    ^
Failed, no modules loaded.

After some experimenting, the solution turned out to indent the guards once more (which isn't clear to me at all):
nameIOg :: IO ()
nameIOg = do
    putStrLn "What's your name ?"
    name <- getLine
    let answer
            | name `elem` ["Simon","John","Phil"]   = "I think Haskell is a great programming language."
            | name == "Koen"                        = "I think debugging Haskell is fun."
            | otherwise                             = "I don't know your name."
    putStrLn answer

Ok, one module loaded.

Where does that double indentation come from and is there a way to write this more elegently ?
(By the way, I stumbled across this when reviewing my wikibook.hs files.)
Source of example: there
Solutions:         there

A: let allows multiple definitions, as in
main = do
   doSomething
   let x = 1
       y = 2
       z = 3
   print (x+y+z)

Note the indentation. y = 2 is not parsed to continue the definition x = 1 since it starts on the same column.
If you want a new line to be parsed as if it continued the previous line, you have to indent it more. E.g.
main = do
   doSomething
   let x | someCondition = 1
         | otherwise     = 0   -- more indented
       y = 2
       z = 3
   print (x+y+z)

or, using another line
main = do
   doSomething
   let x
          | someCondition = 1   -- more indented
          | otherwise     = 0   -- more indented
       y = 2
       z = 3
   print (x+y+z)

Indentation rules might seem puzzling at first, but they are actually
quite simple.
I think your current code is as elegant as it might be -- it looks fine to me.
If you want more alternatives, you could use if then else, even if most Haskellers would prefer guards. (Personally, I don't have a real preference)
main = do
   doSomething
   let x = if condition               then 1
           else if someOtherCondition then 0
           else                            -1
       y = 2
       z = 3
   print (x+y+z)

You could also use another line, e.g. (I'd tend to prefer that)
main = do
   doSomething
   let x =
          if condition               then 1
          else if someOtherCondition then 0
          else                            -1
       y = 2
       z = 3
   print (x+y+z)

or even
main = do
   doSomething
   let x =
          if condition
          then 1
          else if someOtherCondition
          then 0
          else -1
       y = 2
       z = 3
   print (x+y+z)

I'm not claiming a style is overwhelmingly better than another one.

A: Another option is in-line pattern matching for sum types. This is nice if you have a short bit of code and you do not want to use multiple lines.
z <- maybeDoSomething :: IO (Maybe Int)
let x = case z of { Nothing -> 0; Just v -> v }

It can also short the space required for pattern matching in anonymous functions. This:
(\x -> case t of
         Nothing -> 0
         Just v  -> v
)

Can be changed to this:
(\x -> case t of { Nothing -> 0; Just v  -> v })

You can also avoid if-then-else.
t <- didSomethingSucceed :: IO Bool
let x = case t of { True -> 1; False -> 0 }

I would only use this if the lines can be kept short and you have a small number of patterns to match, otherwise it might be hard to read.


text:
Q: SharePoint Online provided hosted ribbon app running twice I have a SharePoint Online provided hosted ribbon app (in Azure), the app perform query the document properties and check out the document, the problem is when the document process for 50 documents or more (approximately few minutes), the app running twice and perform the activities twice.
Question, is this the limitation of provided hosted app when it come to long running app? or the context expired and auto generate another? anyone has experience this before? please share the solution or suggestion.
Thank you in advanced.


text:
Q: J2EE redirect to an external URL I am developing a web application in which the servlet takes informaiton from index.jsp and does some data processing. After that, I want my application to redirect the user to an external url.
How can I do that? Should I redirect in the servlet or make the servlet call a jsp page which calls the url? and how to do that explicitly?
Thank you in advance!

A: I think below URL should help you:
how to redirect from servlet to jsp page
If the redirect should happen based on some condition use the following in an if condition based on request data you get from index.jsp.
response.sendRedirect("http://www.google.com");

A: There is no need for creating a seperate jsp for url redirection. After performing the required operations in the servlet, simply call sendredirect method of the response object.'reponse.sendRedirect(url)' will do.

A: make the servlet call a jsp page which calls the url.


text:
Q: Inserting title page with image in Rmarkdown to render a pdf document In Rmarkdown, the following sets the context to generate the pdf document:
---
title: "My Report"
author: NDE
output:
  pdf_document:
  fig_caption: true
  toc: true
  highlight: kate
---

I want to insert a title page with an image, title before table of contents gets printed. Is there a way I can achieve it?

A: For me it worked using LaTeX commands \clearpage and \tableofcontents:
---
title: "image before toc"
output: pdf_document
---

\centering

![Caption](folder/image.png)

\raggedright
\clearpage
\tableofcontents

# header 1
lore ipsum

## header 2
lore ipsum

## header 3
lore ipsum

# header 4

If you want the table of contents on the title page, just leave \clearpage command out.
I included \centering and \raggedright commands to center the image on the title page but not the text.
Hope that works for you.


text:
Q: Django models saves database entries starting with id 2 (not id1) Following is my model
class Post(models.Model):
    post_title = models.CharField(max_length=100)
    description = models.TextField(null=False, blank=False)
    created = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now=True)

    def __str__ (self):
        return str(self.post_title)

Following is my query
def posts(request, pk):
    post_list = Post.objects.get(id=pk)
    return render(request, 'testing/posts.html', {'post_list': post_list} )

I have checked the database entry - it starts with id-2. Also, the URL with id-1 isn't working. Note: I am using MySQL database
Why does it happen?


text:
Q: When an 'integer-complex' always is transformed to an 'integer-complex'? I tried Mobius transformations $\frac{az+b}{cz+d}$ for several $z∈ \mathbb{Z}+i\mathbb{Z}$ and it seems that even if $M=\begin{pmatrix}a&b\\c&d\end{pmatrix} \in SL_2(\mathbb{Z})$, not any 'integer-complex' ($z∈ \mathbb{Z}+i\mathbb{Z}$) transforms to a 'integer-complex' and vice-versa. If I am not mistaken after evaluation of $\frac{az+b}{cz+d}$ even lines can be transformed to circles and and vice-versa.
My question is, for what subset of $SL_2(\mathbb{Z})$, a $z∈ \mathbb{Z}+i\mathbb{Z}$ always is transformed to a $w∈ \mathbb{Z}+i\mathbb{Z}$ by transformations $\frac{az+b}{cz+d}$? In other words, a set that transforms lattices to lattices?

A: Multiply nominator and denominator of $\frac{az+b}{cz+d}$ by $\overline{cz+d}$ for $a,b,c,d\in \Bbb{Z}$ to see that we necessarily need
$$
\frac{ad-bc}{c^2+d^2}=\frac{1}{c^2+d^2}\in \Bbb{Z}.
$$
So we need $c^2+d^2=1$ as one necessary condition. Now you can finish.


text:
Q: Windows Server Migration - find which c plusplus redist installations are necessary here's the situation:
We have an older Winserver 2012 VM that we want to migrate to 2019. This VM has a bunch of IIS / ASP sites that were written by an intern about 6-8 years ago, and apparently need to remain functional under the new environment. We see pretty much every Visual C++ Redist installation ever available on the original server, and are wondering how we determine which of them are necessary.
So, I have a twofold question -
Is there any harm or security concern with having all of these installed on a server?
And
Would there be any way to determine which of them are required, save for manually inspecting each sites file system?
Admittedly, I never used ASP much in my web dev days. If this question is way off target, I will delete it.


text:
Q: Trouble with input shape of Embedding layer in Keras I am new at modeling in Keras Python. I wanted to create a model that will generate text answer to my messages like chatbot. I read that I need to use tokenizer and to_categorical method. There is my code:
import numpy as np
from keras.layers import Dense, LSTM, Input, Dropout, Embedding
from keras.models import Sequential
from keras.optimizers import Adam
from keras.preprocessing.text import Tokenizer, text_to_word_sequence
from keras.utils import pad_sequences, to_categorical

X = ["Hello!", "Greetings!"]

tokenizer = Tokenizer(1000)

X_seq = pad_sequences(tokenizer.texts_to_sequences(X), 20)

model = Sequential()

model.add(Embedding(1000, 100, input_length=20))
model.add(LSTM(100))
model.add(Dense(1000, "softmax"))

model.summary()

model.compile(loss='categorical_crossentropy', metrics=['accuracy'])

history = model.fit(X_seq, to_categorical(X_seq), epochs=10, batch_size=20)

print(model.predict(pad_sequences(tokenizer.texts_to_sequences(["Greetings!"]), 20)))

value 1000 is max count of unique words in tokenizer vocabulary
X is my input list of messages.
20 is max length of text.
I wanted to create self-learning model but I don't really inderstand how to do it. In internet I found that I need to pass same input and output values but my model should return something like that [0.1,0.2,0.3....] - the max value represents the word which model predicted. But when I try to fit that it raises exception:
ValueError: Shapes (None, 20) and (None, 1000) are incompatible

I guess that it is a trouble with shapes of input list and embedding layer. Guys please help me deal with that. Thank you in advance!

A: In this particular example using to_categorical(X_seq) gives you targets having [num_of_samples, 20] shape. It means that if you use this target variable to fit model it will expect that number of classes will equal 20 (model output shape = (None, 20)). So to fix your example I would suggest you change model.add(Dense(1000, "softmax")) to model.add(Dense(20, "softmax")).
Additionaly before using tokenizer.texts_to_sequences(X) I would suggest you to fit tokenizer using tokenizer.fit_on_texts(X).


text:
Q: Strong induction $n=2^a\cdot b$ Given $n\in\mathbb N$, there exists a non-negative integer $a$ and an odd integer $b$ such that $n=2^a\cdot b$
Base Case:
$n=1 =2^0\cdot1$
I.H: Assume its true for $n=1,2,\ldots,k$
How would i prove this?

A: It's a rather straight forward induction.
Base Case : $n=1$  is odd.
$n = 2 = 2^1 \times 1$, if you want another.
Now, let $1,...,k$ be covered in the hypothesis. Look at $k+1$.
Either $k+1$  is odd or even. If it is odd, then $k+1 = 2^0 (k+1)$, where $k+1$ is odd (of course). Hence, we are done in this case.
If  $k+1$ is even, then $\frac{k+1}{2} < k+1$ is an integer which has been covered in the inductive hypothesis, say $\frac{k+1}2 = 2^ab$, where $b$ is odd. Transposing, $k+1 = 2^{a+1}b$, where $b$ remains odd. Hence, $k+1$ can always be written in the desired form.
This completes the induction.

A: Firstly note that this statament is reasonable: every number, odd or even could be written in this form.
When $n$ is odd $a$ must be $0$. When $n$ is even $a \ge1$.
So, more formally: take an arbitrary $n \in \mathbb{N}$.

*

*If $n$ is odd we can say that $n=2^0n$

*If $n$ is even consider the prime factorization of $n$, $n=2^{\alpha_1}*3^{\alpha_2}*...*p_n^{\alpha_n}$ note  that $ 2^{p_1}|n \space$ and $\space 2^{p_1+1} \not| n$ $\implies \exists b\in \mathbb{N}: n=2^{p_1}b$.

A: In your comments you inquired how we could discover the proof that I hinted. The idea is simply that every natural $>0$ can be generated by repeatedly multiplying its odd part $\,\color{#c00}b\,$ by a power of $\,\color{#0a0}2.\,$ Said inductively: the set $\,S\,$ of naturals $> 0\,$ writable in form $\,\color{#0a0}2^a \color{#c00}b\,$ satisfies the following.
Lemma $ $ If $\,S\subseteq \Bbb N_{>0}$ contains all $\color{#c00}{\rm odds}$ and is closed under $\rm\color{#0a0}{multiplication\ by\ 2}\,$ then $\,S = \Bbb N_{>0}$
Proof $ $ Suppose for strong induction that $S$ contains every natural $< n.\,$ If $\,n\,$ is odd then $\,n\in S\,$ by $\rm\color{#c00}{hypothesis}$. Else $n = 2k\,$ for $k< n$ so $\,k\in S\,$ by induction, so $n = 2k\in S\,$ by $\rm\color{#0a0}{hypothesis}$.
Remark $ $ More generally, replacing $\,2\,$ by any natural $\,c > 1\,\,$  the same proof  shows that any natural can be written $\rm\color{#90f}{uniquely}$ in form $\,c^a b,\ c\nmid b\,$ and the above induction amounts to pulling out as many factors of $\,c\,$ as possible, i.e. until the remaining cofactor $\,b\,$ is no longer divisible by $\,c.\,$ $\rm\color{#90f}{Uniqueness}$ is clear: if $\,c^ab = n = c^A d\,$ where, wlog $a < A,\,$ then $\,b = c^{A-a}d\Rightarrow c\mid b \,\Rightarrow\!\Leftarrow$
More generally see here, which shows how this is a special case of inductive generation of multiplicatively closed sets (here uniqueness may fail).
Beware $ $ If $\,c\,$ is not prime then the cofactor $b$ need not be coprime to $\,c\,$ so powers of $\,c\,$ need not combine additively under multiplication, e.g. for $\,c = 6\,$ we have $\,(6^2\cdot 2)(6^3\cdot 3) = 6^6\,$ so we get an extra power of $\,6\,$ from $\,bb' = 2\cdot 3,\,$ which can't occur for prime $\,c=p\,$ by $\,p\nmid b,b'\Rightarrow p\nmid bb'$ by Euclid's Lemma.


text:
Q: How to codesign a PyInstaller + PyQt app on Mac OSX avoiding "binary is not signed" errors after notarizing the app? I have followed various PyInstaller recipes to code sign my Mac OSX PyQt5-based app , including:
https://github.com/pyinstaller/pyinstaller/wiki/Recipe-OSX-Code-Signing-Qt
I can build the app, codesign it with my developer ID certificate, and verify it without problem. But, when I send the app for notarizing, it gets rejected with all the libraries copied over to Resources (following the recipe above) being reported as "the binary is not signed" and "The signature does not include a secure timestamp", for example:
Contents/Resources/PyQt5/Qt/lib/QtQuickControls2.framework/Versions/5/QtQuickControls2"

Does anybody have any suggestions for dealing with this problem?


text:
Q: cannot find elements on jsp page (java selenium) I cannot find any elements using selenium for a jsp page.
I tried print out the page source, but it seems to not have any head or body. When I inspect the page source manually through the browser, I was able to see the elements.
Can someone tell me why selenium sees a different page source than when you do it manually? Is there a workaround for this?

A: I understand your pain. I am building tests for an ExtJS website, and the IDs, Names, and other commonly used selectors are all generalized and change almost every time the page loads.
There are two good ways to deal with this issue.
Flaky solution (and the one I started with):
Use a By.xpath("//*[contains(.,'TEXT ON CONTROL')]") type of statement to find the controls.
The reason this is flaky is that sometimes the findelement will see multiples of a control even when it is all the exact same control on the page.
Better solution (and the one I ask my devs to assist with when the tests flake out):
Have your devs add a data-test = 'CONTROL NAME' attribute to the controls. This will let you use a specific identifier that most JSP compilers ignore and leave alone.