text:
Q: "jx boot" fails in "openshift-3.11" provider with "tekton pipeline controller" pod into "crashloopbackoff" state Summary:
I already have a setup of "static jenkins server" type jenkins-x running in openshift 3.11 provider. The cluster was crashed and I want to reinstall jenkins-x in my cluster but there is no support for "static jenkins server" now.
So I am trying to install "jenkins-x" via "jx boot" but the installation fails with "tekton pipeline controller" pod into "crashloopbackoff" state.
Steps to reproduce the behavior:
jx-requirements.yml:
autoUpdate:
      enabled: false
      schedule: ""
    bootConfigURL: https://github.com/jenkins-x/jenkins-x-boot-config.git
    cluster:
      clusterName: cic-60
      devEnvApprovers:
      - automation
      environmentGitOwner: cic-60
      gitKind: bitbucketserver
      gitName: bs
      gitServer: http://rtx-swtl-git.fnc.net.local
      namespace: jx
      provider: openshift
      registry: docker-registry.default.svc:5000
    environments:
    - ingress:
        domain: 172.29.35.81.nip.io
        externalDNS: false
        namespaceSubDomain: -jx.
        tls:
          email: ""
          enabled: false
          production: false
      key: dev
      repository: environment-cic-60-dev
    - ingress:
        domain: ""
        externalDNS: false
        namespaceSubDomain: ""
        tls:
          email: ""
          enabled: false
          production: false
      key: staging
      repository: environment-cic-60-staging
    - ingress:
        domain: ""
        externalDNS: false
        namespaceSubDomain: ""
        tls:
          email: ""
          enabled: false
          production: false
      key: production
      repository: environment-cic-60-production
    gitops: true
    ingress:
      domain: 172.29.35.81.nip.io
      externalDNS: false
      namespaceSubDomain: -jx.
      tls:
        email: ""
        enabled: false
        production: false
    kaniko: true
    repository: nexus
    secretStorage: local
    storage:
      backup:
        enabled: false
        url: ""
      logs:
        enabled: false
        url: ""
      reports:
        enabled: false
        url: ""
      repository:
        enabled: false
        url: ""
    vault: {}
    velero:
      schedule: ""
      ttl: ""
    versionStream:
      ref: v1.0.562
      url: https://github.com/jenkins-x/jenkins-x-versions.git
    webhook: lighthouse

Expected behavior:
All the pods under jx namespace should be up & running and jenkins-x should be installed properly
Actual behavior:
Tekton pipeline controller pod is into "CrashLoopBackOff" state with error:
Pods with status in "jx" namespace:
NAME                                           READY     STATUS             RESTARTS   AGE
jenkins-x-chartmuseum-5687695d57-pp994         1/1       Running            0          1d
jenkins-x-controllerbuild-78b4b56695-mg2vs     1/1       Running            0          1d
jenkins-x-controllerrole-765cf99bdb-swshp      1/1       Running            0          1d
jenkins-x-docker-registry-5bcd587565-rhd7q     1/1       Running            0          1d
jenkins-x-gcactivities-1598421600-jtgm6        0/1       Completed          0          1h
jenkins-x-gcactivities-1598423400-4rd76        0/1       Completed          0          43m
jenkins-x-gcactivities-1598425200-sd7xm        0/1       Completed          0          13m
jenkins-x-gcpods-1598421600-z7s4w              0/1       Completed          0          1h
jenkins-x-gcpods-1598423400-vzb6p              0/1       Completed          0          43m
jenkins-x-gcpods-1598425200-56zdp              0/1       Completed          0          13m
jenkins-x-gcpreviews-1598421600-5k4vf          0/1       Completed          0          1h
jenkins-x-nexus-c7dcb47c7-fh7kx                1/1       Running            0          1d
lighthouse-foghorn-654c868bc8-d5w57            1/1       Running            0          1d
lighthouse-gc-jobs-1598421600-bmsq8            0/1       Completed          0          1h
lighthouse-gc-jobs-1598423400-zskt5            0/1       Completed          0          43m
lighthouse-gc-jobs-1598425200-m9gtd            0/1       Completed          0          13m
lighthouse-jx-controller-6c9b8994bd-qt6tc      1/1       Running            0          1d
lighthouse-keeper-7c6fd9466f-gdjjt             1/1       Running            0          1d
lighthouse-webhooks-56668dc58b-4c52j           1/1       Running            0          1d
lighthouse-webhooks-56668dc58b-8dh27           1/1       Running            0          1d
tekton-pipelines-controller-76c8c8dd78-llj4c   0/1       CrashLoopBackOff   436        1d
tiller-7ddfd45c57-rwtt9                        1/1       Running            0          1d

Error log:
2020/08/24 18:38:00 Registering 4 clients
2020/08/24 18:38:00 Registering 3 informer factories
2020/08/24 18:38:00 Registering 8 informers
2020/08/24 18:38:00 Registering 2 controllers
{"level":"info","caller":"logging/config.go:108","msg":"Successfully created the logger."}
{"level":"info","caller":"logging/config.go:109","msg":"Logging level set to info"}
{"level":"fatal","logger":"tekton","caller":"sharedmain/main.go:149","msg":"Version check failed","commit":"821ac4d","error":"kubernetes version \"v1.11.0\" is not compatible, need at least \"v1.14.0\" (this can be overridden with the env var \"KUBERNETES_MIN_VERSION\")","stacktrace":"github.com/tektoncd/pipeline/vendor/knative.dev/pkg/injection/sharedmain.MainWithConfig\n\tgithub.com/tektoncd/pipeline/vendor/knative.dev/pkg/injection/sharedmain/main.go:149\ngithub.com/tektoncd/pipeline/vendor/knative.dev/pkg/injection/sharedmain.MainWithContext\n\tgithub.com/tektoncd/pipeline/vendor/knative.dev/pkg/injection/sharedmain/main.go:114\nmain.main\n\tgithub.com/tektoncd/pipeline/cmd/controller/main.go:72\nruntime.main\n\truntime/proc.go:203"}
After downgrading the tekton image from "0.11.0" to "0.9.0" the tekton pipeline controller pod is into running state. And a new tekton pipeline webhook pod got created and it is into "Crashloopbackoff"

Jx version:
Version        2.1.127
Commit         4bc05a9
Build date     2020-08-05T20:34:57Z
Go version     1.13.8
Git tree state clean

Diagnostic information:
The output of jx diagnose version is:
Running in namespace: jx
Version        2.1.127
Commit         4bc05a9
Build date     2020-08-05T20:34:57Z
Go version     1.13.8
Git tree state clean
NAME                          VERSION
Kubernetes cluster            v1.11.0+d4cacc0
kubectl (installed in JX_BIN) v1.16.6-beta.0
helm client                   2.16.9
git                           2.24.1
Operating System              "CentOS Linux release 7.8.2003 (Core)"

Please visit https://jenkins-x.io/faq/issues/ for any known issues.

Finished printing diagnostic information

Kubernetes cluster: openshift - 3.11
Kubectl version:
Client Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.0+d4cacc0", GitCommit:"d4cacc0", GitTreeState:"clean", BuildDate:"2018-10-15T09:45:30Z", GoVersion:"go1.10.2", Compiler:"gc", Platform:"linux/amd64"}

Operating system / Environment:
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

I need to install "jenkins-x" via "jx boot" in "openshift-3.11" which uses default kubernetes version - 1.11.0 but "jx boot" requires atleast 1.14.0. Please suggest if there is any work around to get jenkins-x on openshift-3.11

A: As the error message shows (in the crashloop), kubernetes version "v1.11.0" is not compatible, need at least "v1.14.0", which make it not installable on OpenShift 3 (as it ships with Kubernetes 1.11.0). It seems jenkins-X comes with Tetkon Pipelines v0.14.2 which requires at least Kubernetes 1.14.0 (and later releases like Tekton Pipelines v0.15.0 requires Kubernetes 1.16.0).
{"level":"fatal","logger":"tekton","caller":"sharedmain/main.go:149","msg":"Version check failed","commit":"821ac4d","error":"kubernetes version \"v1.11.0\" is not compatible, need at least \"v1.14.0\" (this can be overridden with the env var \"KUBERNETES_MIN_VERSION\")","stacktrace":"github.com/tektoncd/pipeline/vendor/knative.dev/pkg/injection/sharedmain.MainWithConfig\n\tgithub.com/tektoncd/pipeline/vendor/knative.dev/pkg/injection/sharedmain/main.go:149\ngithub.com/tektoncd/pipeline/vendor/knative.dev/pkg/injection/sharedmain.MainWithContext\n\tgithub.com/tektoncd/pipeline/vendor/knative.dev/pkg/injection/sharedmain/main.go:114\nmain.main\n\tgithub.com/tektoncd/pipeline/cmd/controller/main.go:72\nruntime.main\n\truntime/proc.go:203"}

Theorically, setting KUBERNETES_MIN_VERSION in the controller deployment might make it work but it is not being tested and most likely the controller won't behave correctly as it's using feature that are not available in 1.11.0. Other than this, there is no workaround that I know of.


text:
Q: How to create intermediate class in django I hav this models
from django.db import models
from embed_video.fields import EmbedVideoField

# Create your models here.

class Video(models.Model):
    video_author = models.CharField(default='Bongo Media', max_length=20)
    video_title = models.CharField(max_length=100)
    video_file = models.FileField(blank=True)
    video_image = models.ImageField(default='image.png')
    video_embed_link = EmbedVideoField(blank=True)
    video_descriptions = models.TextField(max_length=100, blank=True)
    video_pubdate = models.DateTimeField(auto_now=True)
    is_recommended = models.BooleanField(default=False)

    def __str__(self):
        return self.video_title

class Artist(models.Model):
    artist_picture = models.ImageField(upload_to='media')
    artist_name = models.CharField(max_length=100)
    artist_videos = models.ManyToManyField(Video)

    def __str__(self):
        return self.artist_name

In database i have a lot of videos and artists. in views.py how can i query so that when i click to the artist name i  can see only he is videos, or is there any mistake in my models? Or is the intermediate class  needed?, if so, how can i create the intermediate class and how to query data with intermediate class so that  i can filter all videos belonging to one artist

A: Is artist_songs actually artist_videos?
videos = Artist.objects.get(artist_name="John").artist_videos
for video in videos:
    print(video.video_title)

A: I am new to this, but I think that in the above coding, the variable of "videos" is actually a title of the video file. Also, "artist_songs" is not introduced anywhere there.
So, to the answer of your question, no.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Получить input, чтобы при клике исчезал текст Подскажите, пожалуйста, как достать input используя js, чтобы при клике исчезал текст в поле, если нет прямого доступа редактировать input.
Знаю, что можно прописать
onfocus="if (this.value=='Ваш текст') this.value='';"
onblur="if (this.value==''){this.value='Ваш текст'}"

но получить прямой доступ к нему нет возможности, есть только id  и класс.

A: "Достать" и отчистить input зная его идентификатор можно, например, вот так:
document.getElementById('input-id').value = '';


text:
Q: Unable to create aac/mp3 cbr 256k using ffmpeg I am using following commands to make aac/mp3 files with 256kbps bitrate and constant bitrate mode.
For aac:
ffmpeg -i test.wav -b:a 256k -y test.aac

For mp3:
ffmpeg -i test.wav -b:a 256k -y test.mp3

I need to make an aac file in CBR mode from a wav file. As per the documentation available at https://ffmpeg.org, CBR should be made using above mentioned commands but it is always making VBR.
I need help to see if I am doing something wrong, or there are some other steps to be followed. I have tested with ffmpeg versions 2.8 and 3.2.
Can anyone help me fix it?

A: The native AAC encoder doesn't do CBR. It does ABR but can drift. libfdk_aac can do CBR.


text:
Q: Nginx - Password Protect an entire website but keep one folder open We're using Nginx on the server reserved for development (testing) and we want to prevent anyone outside the company from gaining access to the sites under development. However one of the sites uses online payment and for that a folder need to be accessible by anyone, used for the callback from the credit card company..
Is there any way we can protect an entire website but leave just one folder and all the files inside open ?
Regards,
Wael

A:
server {
        auth_basic "go away";
        location /a {
                auth_basic off;
        }
}


text:
Q: Compile openjdk 7 on arm ubuntu I am trying to compile openjdk 7 on my arm ubuntu:
make all ALLOW_DOWNLOADS=true DISABLE_HOTSPOT_OS_VERSION_CHECK=ok

Then I received this error:
g++ -DLINUX -D_GNU_SOURCE -DIA32 -I/home/darklord/Develop/jdk7/hotspot/src/share/vm/prims -I/home/darklord/Develop/jdk7/hotspot/src/share/vm -I/home/darklord/Develop/jdk7/hotspot/src/cpu/x86/vm -I/home/darklord/Develop/jdk7/hotspot/src/os_cpu/linux_x86/vm -I/home/darklord/Develop/jdk7/hotspot/src/os/linux/vm -I/home/darklord/Develop/jdk7/hotspot/src/os/posix/vm -I/home/darklord/Develop/jdk7/hotspot/src/share/vm/adlc -I../generated -DASSERT -DTARGET_OS_FAMILY_linux -DTARGET_ARCH_x86 -DTARGET_ARCH_MODEL_x86_32 -DTARGET_OS_ARCH_linux_x86 -DTARGET_OS_ARCH_MODEL_linux_x86_32 -DTARGET_COMPILER_gcc -DCOMPILER2 -DCOMPILER1  -fno-rtti -fno-exceptions -D_REENTRANT -fcheck-new -fvisibility=hidden -m32 -march=i586 -pipe -Werror -g -c -o ../generated/adfiles/adlparse.o /home/darklord/Develop/jdk7/hotspot/src/share/vm/adlc/adlparse.cpp
g++: error: unrecognized argument in option '-march=i586'

It seems it is trying compile using x86 configuration. So how can I make the build pass on ARM machine?

A: You have to specify proper architecture option for g++. Reference here.

-march=name
      This specifies the name of the target ARM architecture. GCC uses this name to determine what kind of instructions it can emit when
  generating assembly code. This option can be used in conjunction with
  or instead of the -mcpu= option. Permissible names are: armv2',
  armv2a', armv3',armv3m', armv4',armv4t', armv5',armv5t',
  armv5te',armv6', armv6j',iwmmxt', `ep9312'.

Please make sure you refer proper version docs of gcc


text:
Q: I try to connect by ssh from Home Assistant (docker) in Debian and there is no way Good companions. I have a PC with Openmediavault and Home Assistant on a docker container.
I want to ssh the home assistant to the openmediavault system (debian). I try to do it from the SSH & Web Terminal addons, but there is no humane way to do it.
I try to do it like this:
cd /config

mkdir .ssh

ssh-keygen -b 4096 -t rsa

He asks me for the destination route and I give it to him:
/config/.ssh/id_rsa

This copies the private key to the openmediavault server (Debian)
ssh-copy-id -i /config/.ssh/id_rsa peter@192.168.1.37

With this I try to connect to the server to avoid being asked for the password. But he keeps asking me. With the -v it debugs and shows errors supposedly that it does not find the private key.
ssh -v -i /root/.ssh/id_rsa peter@192.168.1.37

OpenSSH_8.8p1, OpenSSL 1.1.1l  24 Aug 2021
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to 192.168.1.37 [192.168.1.37] port 22.
debug1: Connection established.
debug1: identity file /root/.ssh/id_rsa type 0
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa_sk type -1
debug1: identity file /root/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: identity file /root/.ssh/id_ed25519_sk type -1
debug1: identity file /root/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /root/.ssh/id_xmss type -1
debug1: identity file /root/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.8
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.9p1 Debian-10+deb10u2
debug1: compat_banner: match: OpenSSH_7.9p1 Debian-10+deb10u2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.1.37:22 as 'peter'
debug1: load_hostkeys: fopen /root/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:JEfCsgteJLvd11uZUNVx/DKemQZ1tg5xpRKTF0RggUqBzsY
debug1: load_hostkeys: fopen /root/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host '192.168.1.37' is known and matches the ED25519 host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /root/.ssh/id_rsa RSA SHA256:lxlph5P16mJj6H1WhyGku6zaDlQo3ATHWgyphk374pTp8
debug1: Will attempt key: /root/.ssh/id_dsa
debug1: Will attempt key: /root/.ssh/id_ecdsa
debug1: Will attempt key: /root/.ssh/id_ecdsa_sk
debug1: Will attempt key: /root/.ssh/id_ed25519
debug1: Will attempt key: /root/.ssh/id_ed25519_sk
debug1: Will attempt key: /root/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /root/.ssh/id_rsa RSA SHA256:lxlph5P16mJj6H1WhyGku6zaDlQo3ATHWgyphk374pTp8
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ecdsa_sk
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: Trying private key: /root/.ssh/id_ed25519_sk
debug1: Trying private key: /root/.ssh/id_xmss
debug1: Next authentication method: password
peter@192.168.1.37's password:


text:
Q: View dynamic nested list in table I am new at MVC and need help.
In a view I display table, created dynamically by running over foreach loop of List.
in this table I want to display another table of List that can be shown by clicking a button.
for example:
Model1:
int id;
string Name;

Model2:
int title;
List<Model1> listModel1;

I have list of Model2 to display in table by foreach loop,
TITLE------LIST MODEL 1
aa---------- showListButton
bb----------  showListButton
showListButton will show and hide List<Model1> by clicking
ID------NAME
11---------- abc
22----------  efg
33----------  lmn
Can you help?

A: Just render a table into any  element of table element. Like:

      //tr


text:
Q: SASS equivalent to LESS Space ("+_") syntax LESS has a great little feature called Space that allows mixins to append rules to existing properties. Really useful for transform() mixins, because you can append many transform rules to the same property, just by calling the mixin multiple times, eg.
Example:
.scale() {
  transform+_: scale(2);
}
.rotate() {
  transform+_: rotate(15deg);
}
.myclass {
  .scale();
  .rotate();
}

Outputs:
.myclass {
  transform: scale(2) rotate(15deg);
}

I'm trying to get into SASS, but I don't understand how to achieve this with the available syntax. Whatever I do, the output only ever applies one of the transformations, not both. What is the best way to achieve this behaviour using SASS alone?

A: You can use variable arguments in a mixin like so:
@mixin transform($transforms...) {
  transform: $transforms;
}
.myclass {
  @include transform(scale(0.5) rotate(30deg));
}

this will output:
.myclass {
  transform: scale(0.5) rotate(30deg);
}

You can see a working example here:
http://codepen.io/sonnyprince/pen/RaMzgb
A little more info:

Sometimes it makes sense for a mixin or function to take an unknown
  number of arguments. For example, a mixin for creating box shadows
  might take any number of shadows as arguments. For these situations,
  Sass supports "variable arguments," which are arguments at the end of
  a mixin or function declaration that take all leftover arguments and
  package them up as a list. These arguments look just like normal
  arguments, but are followed by ....

http://sass-lang.com/documentation/file.SASS_REFERENCE.html#variable_arguments

A: Sass does not offer such a feature.
You can get reasonably close by using global variables.  However, every single mixin you use, including ones provided by a 3rd party, will have to be modified to work this way.
// the setup
$append-property-vals: (); // global variable
$old-append-property-vals: (); // global variable
@mixin append-property($key, $val, $separator: comma) {
    $old-val: map-get($append-property-vals, $key);
    @if $old-val {
        $append-property-vals: map-merge($append-property-vals, ($key: append($old-val, $val, $separator))) !global;
    } @else {
        $append-property-vals: map-merge($append-property-vals, ($key: $val)) !global;
    }
}

@mixin append-properties {
    // cache the original value
    $old-append-property-vals: $append-property-vals !global;
    @content;

    // write out the saved up properties
    @each $key, $val in $append-property-vals {
        #{$key}: $val;
    }

    // restore the original value
    $append-property-vals: $old-append-property-vals !global;
}

// modify the OP's provided mixins to work
@mixin scale {
    // if the vals should be comma delimited, write `comma` instead of `space` for the 3rd argument
    @include append-property(transform, scale(2), space);
}
@mixin rotate {
    @include append-property(transform, rotate(15deg), space);
}

// call the mixins
.myclass {
    @include append-properties {
        @include scale;
        @include rotate;
    }
}

Output:
.myclass {
  transform: scale(2) rotate(15deg);
}


text:
Q: An AMM-like integral $\int_0^1\frac{\arctan x}x\ln\frac{(1+x^2)^3}{(1+x)^2}dx$
How can we evaluate $$I=\int_0^1\frac{\arctan x}x\ln\frac{(1+x^2)^3}{(1+x)^2}dx=0?$$

I tried substitution $x=\frac{1-t}{1+t}$ and got
$$I=\int_0^1\frac{2 \ln \frac{2 (t^2+1)^3}{(t+1)^4} \arctan \frac{t-1}{t+1}}{t^2-1}dt\\
=\int_0^1\frac{2 \ln \frac{2 (t^2+1)^3}{(t+1)^4} (\arctan t-\frac\pi4)}{t^2-1}dt$$
I'm able to evaluate $$\int_0^1\frac{\ln \frac{2 (t^2+1)^3}{(t+1)^4}}{t^2-1}dt$$
But I have no idea where to start with the rest one.

A: A (new) solution by Cornel Ioan Valean
It's straightforward to show by symmetry means that

\begin{equation*}
\int_0^1 \left(\int_0^1 \frac{a x}{(1+a^2 x^2) (1+a^2 x y)} \textrm{d}x \right)\textrm{d}y=\int_0^1\frac{a x}{1+a^2 x^2}\textrm{d}x\int_0^1 \frac{1}{1+a^2 y^2}\textrm{d}y
\end{equation*}
\begin{equation*}
=\frac{\arctan(a)\log(1+a^2)}{2a^2}.
\end{equation*}

The exact flow is described in the book (Almost) Impossible Integrals, Sums, and Series, page $162$, where the only difference is that we inject a parameter $a$, that is we use $ax$ instead of $x$ and $ay$ instead of $y$.
If we multiply the opposite sides of the result above by $a$ and then integrate from $a=0$ to $a=1$, we get
\begin{equation*}
\frac{1}{2}\int_0^1 \frac{\arctan(a)\log(1+a^2)}{a}\textrm{d}a=\int_0^1\left(\int_0^1 \left(\int_0^1 \frac{a^2 x}{(1+a^2 x^2) (1+a^2 x y)} \textrm{d}x \right)\textrm{d}y\right)\textrm{d}a
\end{equation*}
\begin{equation*}
=\int_0^1\left(\int_0^1 \left(\int_0^1 \frac{a^2 x}{(1+a^2 x^2) (1+a^2 x y)} \textrm{d}y \right)\textrm{d}x\right)\textrm{d}a=\int_0^1 \left(\int_0^1 \frac{\log(1+a^2 x)}{1+a^2 x^2}\textrm{d}x\right)\textrm{d}a
\end{equation*}
\begin{equation*}
\overset{a x\mapsto x}{=}\int_0^1\left(\int_0^a \frac{\log(1+a x)}{a(1+x^2)}\textrm{d}x\right)\textrm{d}a=\int_0^1\frac{1}{1+x^2}\left(\int_x^1 \frac{\log(1+a x)}{a}\textrm{d}a\right)\textrm{d}x
\end{equation*}
\begin{equation*}
\overset{x a\mapsto a}{=}\int_0^1\frac{1}{1+x^2}\left(\int_{x^2}^x \frac{\log(1+a)}{a}\textrm{d}a\right)\textrm{d}x
\end{equation*}
\begin{equation*}
=2\int_0^1 \frac{\arctan(x)\log(1+x^2)}{x}\textrm{d}x-\int_0^1 \frac{\arctan(x)\log(1+x)}{x}\textrm{d}x,
\end{equation*}
and the result follows.
Q.E.D.
A spectacular generalization of the main integral

\begin{equation*}
3 \int_0^x \frac{\arctan(t)\log(1+t^2)}{t} \textrm{d}t=2\int_0^x \frac{\arctan(t) \log (1+x t)}{t} \textrm{d}t
\end{equation*}

The proof follows the strategy above where we integrate from $a=0$ to $a=r$, and $r$ is any real number.

Using the same strategy as in the main integral, we may show that

\begin{equation*}
3 \int_0^1 \frac{\arctan(x)\operatorname{Li}_2(x) }{x} \textrm{d}x+\int_0^1 \frac{\arctan(x)\operatorname{Li}_2(-x)}{x} \textrm{d}x-\int_0^1 \frac{\arctan(x)\operatorname{Li}_2\left(-x^2\right)}{x} \textrm{d}x
\end{equation*}
\begin{equation*}
=3 \zeta(2)G+\frac{45 }{16}\zeta (4)-\frac{1}{256}\psi ^{(3)}\left(\frac{1}{4}\right),
\end{equation*}

without calculating each integral separately. This problem was prepared for Romanian Mathematical Magazine.
More spectacular results
If we use the result
\begin{equation*}
\int_0^x\frac{\arctan(t)\log(1+t^2)}{t} \textrm{d}t-2 \int_0^1 \frac{\arctan(xt) \log (1-t)}{t}\textrm{d}t=2\sum_{n=1}^{\infty}(-1)^{n-1} \frac{x^{2n-1}}{(2n-1)^3},
\end{equation*}
which is found in the book, (Almost) Impossible Integrals, Sums, and Series,
or its extended version which exploits $\displaystyle \operatorname{Ti}_3(x)=\int_0^x\frac{\operatorname{Ti}_2(y)}{y}\textrm{d}y$,
\begin{equation*}
\int_0^x\frac{\arctan(t)\log(1+t^2)}{t} \textrm{d}t-2 \int_0^1 \frac{\arctan(xt) \log (1-t)}{t}\textrm{d}t=2 \operatorname{Ti}_3(x),
\end{equation*}
together with the generalization above (included in the paper), we obtain the amazing results

\begin{equation*}
\int_0^x \frac{\arctan(t) \log (1+x t)}{t} \textrm{d}t-3 \int_0^1 \frac{\arctan(xt) \log (1-t)}{t}\textrm{d}t=3\sum_{n=1}^{\infty}(-1)^{n-1} \frac{x^{2n-1}}{(2n-1)^3},
\end{equation*}

and if we use the extended version to $\displaystyle \operatorname{Ti}_3(x)$, then we have

\begin{equation*}
\int_0^x \frac{\arctan(t) \log (1+x t)}{t} \textrm{d}t-3 \int_0^1 \frac{\arctan(xt) \log (1-t)}{t}\textrm{d}t=3\operatorname{Ti}_3(x).
\end{equation*}

For example, setting $x=1$ above, we obtain the special case

\begin{equation*}
\int_0^1 \frac{\arctan(t) \log (1+t)}{t} \textrm{d}t-3 \int_0^1 \frac{\arctan(t) \log (1-t)}{t}\textrm{d}t=\frac{3}{32}\pi^3.
\end{equation*}

Let's go a bit further and notice that if we exploit the inverse relation of $\operatorname{Ti}_3(x)$, we obtain that

\begin{equation*}
\int_0^x\frac{\arctan(t)\log(1+t^2)}{t} \textrm{d}t+\int_0^{1/x}\frac{\arctan(t)\log(1+t^2)}{t} \textrm{d}t
\end{equation*}
\begin{equation*}
-2 \int_0^1 \frac{\arctan(xt) \log (1-t)}{t}\textrm{d}t-2 \int_0^1 \frac{\arctan(t/x) \log (1-t)}{t}\textrm{d}t
\end{equation*}
\begin{equation*}
=\operatorname{sgn}(x)\left(\frac{\pi^3}{8}+\frac{\pi}{2}\log^2(|x|)\right),
\end{equation*}

and

\begin{equation*}
\int_0^x \frac{\arctan(t) \log (1+x t)}{t} \textrm{d}t+\int_0^{1/x} \frac{\arctan(t) \log (1+t/x)}{t} \textrm{d}t
\end{equation*}
\begin{equation*}
-3 \int_0^1 \frac{\arctan(xt) \log (1-t)}{t}\textrm{d}t-3 \int_0^1 \frac{\arctan(t/x) \log (1-t)}{t}\textrm{d}t
\end{equation*}
\begin{equation*}
=\operatorname{sgn}(x)3\left(\frac{\pi^3}{16}+\frac{\pi}{4}\log^2(|x|)\right).
\end{equation*}

Let me now present a new fancy representation of $\pi$ with the results above

\begin{equation*}
\large \pi
\end{equation*}
\begin{equation*}
=2\int_0^e\frac{\arctan(t)\log(1+t^2)}{t} \textrm{d}t+2\int_0^{1/e}\frac{\arctan(t)\log(1+t^2)}{t} \textrm{d}t
\end{equation*}
\begin{equation*}
-4 \int_0^1 \frac{\arctan(et) \log (1-t)}{t}\textrm{d}t-4 \int_0^1 \frac{\arctan(t/e) \log (1-t)}{t}\textrm{d}t
\end{equation*}
\begin{equation*}
-4\int_0^1\frac{\arctan(t)\log(1+t^2)}{t} \textrm{d}t+8 \int_0^1 \frac{\arctan(t) \log (1-t)}{t}\textrm{d}t.
\end{equation*}

And another new fancy representation of $\pi$

\begin{equation*}
\large \pi
\end{equation*}
\begin{equation*}
=\frac{4}{3}\int_0^e \frac{\arctan(t) \log (1+et)}{t} \textrm{d}t+\frac{4}{3}\int_0^{1/e} \frac{\arctan(t) \log (1+t/e)}{t} \textrm{d}t
\end{equation*}
\begin{equation*}
-4 \int_0^1 \frac{\arctan(et) \log (1-t)}{t}\textrm{d}t-4 \int_0^1 \frac{\arctan(t/e) \log (1-t)}{t}\textrm{d}t
\end{equation*}
\begin{equation*}
-\frac{8}{3}\int_0^1 \frac{\arctan(t) \log (1+t)}{t} \textrm{d}t+8 \int_0^1 \frac{\arctan(t) \log (1-t)}{t}\textrm{d}t.
\end{equation*}

A note: All the results may be found in the new preprint, A symmetry-related treatment of two fascinating sums of integrals by C.I. Valean.

A: Through the dilogarithm/trilogarithm machinery it can be shown that
$$ \int_{0}^{1}\frac{\log(1+i x)\log(1+x)}{x}\,dx=\\\frac{\pi K}{2}-\frac{9i\pi^3}{64}+3iK\log(2)-\frac{3\pi i}{16}\log^2(2)+\frac{5\pi^2}{32}\log(2)-\frac{\log^3(2)}{8}-\frac{69}{16}\zeta(3)+6\,\text{Li}_3\left(\tfrac{1+i}{2}\right) $$
$$ \int_{0}^{1}\frac{\log^2(1+i x)}{x}\,dx=\\
-\frac{\pi K}{2}-\frac{3i\pi^3}{64}+iK\log(2)-\frac{\pi i}{16}\log^2(2)+\frac{5\pi^2}{96}\log(2)-\frac{\log^3(2)}{24}-\frac{3}{16}\zeta(3)+2\,\text{Li}_3\left(\tfrac{1+i}{2}\right) $$
$$ \int_{0}^{1}\frac{\log(1+ix)\log(1-ix)}{x}\,dx= \frac{\pi K}{2}-\frac{27}{32}\zeta(3)$$
hence the claim follows by $\arctan x=\text{Im}\,\log(1+ix)$ and $\log(1+x^2)=\log(1+ix)+\log(1-ix)$.

A: @Kemono Chen proved here
$$\int_0^y\frac{\ln(1+yx)}{1+x^2}dx=\frac12 \tan^{-1}(y)\ln(1+y^2)$$
Divide both sides by $y$ then integrate between $0$ and $1$ we get
$$\color{red}{\frac12\mathcal{I}}=\frac12\int_0^1\frac{\tan^{-1}(y)\ln(1+y^2)}{y}dy=\int_0^1\int_0^y\frac{\ln(1+yx)}{y(1+x^2)}dxdy$$
$$=\int_0^1\frac{1}{1+x^2}\left(\int_x^1\frac{\ln(1+xy)}{y}dy\right)dx=\int_0^1\frac{\operatorname{Li}_2(-x^2)-\operatorname{Li}_2(-x)}{1+x^2}dx$$
$$\overset{IBP}{=}\int_0^1\tan^{-1}(x)\left(\frac{2\ln(1+x^2)}{x}-\frac{\ln(1+x)}{x}\right)dx\\=\color{red}{2\mathcal{I}}-\int_0^1\frac{\tan^{-1}(x)\ln(1+x)}{x}dx$$
which can be written as
$$\int_0^1\tan^{-1}(x)\ln\left(\frac{(1+x^2)^3}{(1+x)^2}\right)dx=0$$

A: A solution by Cornel Ioan Valean. The problem is similar to the problem AMM $12054$. Using the well-known result in $4.535.1$ from  Table of Integrals, Series and Products by I.S. Gradshteyn and I.M. Ryzhik:
$$\int_0^1 \frac{\arctan(y x)}{1+y^2x}\textrm{d}x=\frac{1}{2y^2}\arctan(y)\log(1+y^2)$$
We have:
$$\frac{1}{2}\int_0^1\frac{\arctan(y)\log(1+y^2)}{y}dy=\int_0^1\left(\int_0^1 \frac{y\arctan(y x)}{1+y^2x}\textrm{d}x\right)\textrm{d}y$$
$$\overset{yx=t}{=}\int_0^1\left(\int_0^y \frac{\arctan(t)}{1+y t}\textrm{d}t\right)\textrm{d}y=\int_0^1\left(\int_t^1 \frac{\arctan(t)}{1+y t}\textrm{d}y\right)\textrm{d}t$$
$$=\int_0^1\frac{\arctan(t)\log\left(\frac{1+t}{1+t^2}\right)}{t} \textrm{d}t\overset{t=y}=\int_0^1\frac{\arctan(y)\log\left(\frac{1+y}{1+y^2}\right)}{y} \textrm{d}y$$
And the result is proved.


text:
Q: parsing prices with bs4 I am having trouble parsing prices from mec site. I am able to parse the product names just fine, but can't parse the prices. It returns NONE and is not a callable object.
I tried to load the div locally and that worked (2nd Code block)
Is it possible website not allowing or I am doing something wrong here?
import requests
from bs4 import BeautifulSoup

re = requests.get("https://www.mec.ca/en/search?org_text=hiking%20boots%20men&text=hiking%20boots%20men")

soup = BeautifulSoup(re.text, 'lxml' )
print(soup.find(class_='product__name--ellipsis').p.a.text)
print(soup.find(class_='qa-single-price'))

2nd Code tried locally- works fine
    html_doc = """

    Available prices
    Clearance price $139.95
    $139.95

    Original price

"""

soup = BeautifulSoup(html_doc, 'html.parser')

print(soup.find(class_='qa-single-price').text)

A: Actually, price is generating dynamically by javascript.If you make disabled javascript then you will see that the price goes disappeared but the title/names remain unchanged. So you didn't grab price from the browser request. You can grab all data from api calls json response.

A: The data is loaded dynamically, so requests won't render it. However, the data is also available in JSON format on the website, you can use the built-in re/json modules the find the correct data.
There's no need to use BeautifulSoup since the returned data is in JSON.
Here's a working example:
import re
import json
import requests

response = requests.get(
    "https://www.mec.ca/en/search?org_text=hiking%20boots%20men&text=hiking%20boots%20men"
)

data = json.loads(re.search(r"window.ProductList = (\[.*?\]);", response.text).group(1))

for product in data:
    name = product["name"]
    try:
        price = product["mecPrice"]["price"]["value"]
    except TypeError:
        price = product["mecPrice"]["highPrice"]["formattedValue"]
    print("{:<70} {}".format(name, price))

Output:
Zamberlan 309 Trail Lite Gore-Tex Hiking Boots - Men's                 279.95
Salomon Quest 4 Gore-Tex Hiking Boots - Men's                          289.95
Keen Pyrenees Hiking Boots - Men's                                     219.95
Scarpa Kailash Trek Gore-Tex Hiking Boots - Men's                      299.95
Scarpa Maverick Mid Gore-Tex Hiking Boots - Men's                      199.95
Salomon Quest Element Gore-Tex Hiking Boots - Men's                    249.95
Lowa Renegade Gore-Tex Mid Light Hiking Boots - Men's                  339.95
Scarpa Terra GTX Hiking Boots - Men's                                  244.95
Zamberlan 960 Guide Gore-Tex RR Hiking Boots - Men's                   399.95
Zamberlan 900 Rolle Evo 2 Gore-Tex Hiking Boots - Men's                $299.95
Columbia Newton Ridge Plus II Waterproof Hiking Boots - Men's          139.95
Timberland Garrison Trail Waterproof Mid Hiking Boots - Men's          169.95
...


text:
Q: What is the most efficient way to define a property using Get/Set with a switch for versions? I am writing a program to read and write memory from another program, however there are two different versions and the memory values have an offset in one version, but not in the second, so depending on the setting the user has selected (v1 or v2) I need to determine which address to read/write.
As the moment my code is as below, but I dont feel this is very effecient, and replicating this same code makes the class very long when it really doesnt need to be.
Is there a more efficient way of doing all of this:
public static int Property
{
    get
    {
        switch (Version)
        {
            case Version.v1:
                return Memory.ReadMemory<int>(0xB7CE50 + 0x2680);
            case Version.v2:
                return Memory.ReadMemory<int>(0xB7CE50);
            default:
                return 0;
        }
    }
    set
    {
        switch (Version)
        {
            case Version.v1:
                Memory.WriteMemory<int>(0xB7CE50 + 0x2680, value);
                break;
            case Version.v2:
                Memory.WriteMemory<int>(0xB7CE50, value);
                break;
            default:
                break;
        }
    }
}

Not all addresses need this offset, but most do, so I also need to account for this, hence I cant just add the 0x2680 value if v2

A: One obvious way to approach this is to bring the knowledge of what lives where into a central place. You might want to expand your definition of a Version to include memory addresses (see below), or you might want to include this information in some other class:
public class Version
{
    public int PropertyAddress { get; init; }

    public static Version Version1 { get; } = new()
    {
        PropertyAddress = 0xB7CE50 + 0x2680,
    };

    public static Version Version2 { get; } = new()
    {
        PropertyAddress = 0xB7CE50,
    };

    private Version() { }
}

(I've made use of C# 9 syntax here -- adjust if you're targetting an earlier language version).
You can then simplify your property to something like:
public static int Property
{
    get => Memory.ReadMemory<int>(Version.PropertyAddress);
    set => Memory.WriteMemory<int>(Version.PropertyAddress, value);
}

You could also e.g. put this in a MemoryAddresses class (if you wanted to keep Version as an enum), and do:
private static MemoryAddresses Addresses => Version switch
{
    Version.V1 => MemoryAddresses.V1,
    Version.V2 => MemoryAddresses.V2,
};

public static int Property
{
    get => Memory.ReadMemory<int>(Addresses.PropertyAddress);
    set => Memory.WriteMemory<int>(Addresses.PropertyAddress, value);
}

If you want to take advantage of the fact that some addresses in one version are offset versions of addresses in the other version, you might do something like:
public class Version
{
    public int Offset { get; init; }

    public int Property1Address => 0xB7CE50 + Offset;
    public int Property2Address => 0xB80000 + Offset;
    public int Property3Address { get; init; }

    public static Version Version1 { get; } = new()
    {
        Offset = 0x2680,            // <-- Offset for version 1
        Property3Address = 123456,  // <-- Explicit address for version 1
    };

    public static Version Version2 { get; } = new()
    {
        Offset = 0,                 // <-- No offset for version 2
        Property3Address = 987654,  // <-- Different explicit address for version 2
    };

    private Version() { }
}

A: One way to solve this is to introduce an abstract base class that has concrete implementations of all the properties that are the same for both versions, and abstract declarations for the implementations that differ between the two versions.
For example:
public abstract class MyBaseClass
{
    public abstract int PropertyThatDiffersByVersion { get; set; }

    public int PropertyThatIsTheSameForBothVersions
    {
        get
        {
            return Memory.ReadMemory<int>(0xB82677); // I made up the address.
        }

        set
        {
            Memory.WriteMemory<int>(0xB82677, value);
        }
    }
}

public sealed class MyVersion1 : MyBaseClass
{
    public override int PropertyThatDiffersByVersion
    {
        get
        {
            return Memory.ReadMemory<int>(0xB7CE50 + 0x2680);
        }

        set
        {
            Memory.WriteMemory<int>(0xB7CE50 + 0x2680, value);
        }
    }
}

public sealed class MyVersion2 : MyBaseClass
{
    public override int PropertyThatDiffersByVersion
    {
        get
        {
            return Memory.ReadMemory<int>(0xB7CE50);
        }

        set
        {
            Memory.WriteMemory<int>(0xB7CE50, value);
        }
    }
}

Then you would create an instance of the appropriate class (MyVersion1 or MyVersion2), and pass it to methods that accepted an object of type MyBaseClass.


text:
Q: Date subtraction in php I have the following dates that I get from database as well as from php date. I did some formatting to the date from database to suit accordingly. Those are as follows
From database
 $startDate = $tagQueryRows['startDate'];
 $startDate = strtotime($startDate);
 $startDate = date( 'd-m-Y', $startDate );

Take note that the startDate in database is in this format 2019-09-02 10:26:44
From php date
$todayDate = date('d-m-Y');

Then I did a subtraction as follows
$totalDaysCompleted = ($todayDate- $startDate);

When I did this, it shows the correct number of days but with warning

Notice: A non well formed numeric value encountered

Thus I edited my code as below
$totalDaysCompleted = (strtotime(str_replace('-','/',$todayDate)) - strtotime(str_replace('-','/',$startDate)));

This time the warning gone, but it is not showing the $totalDaysCompleted correctly. The $totalDaysCompleted should be a number like 1, 2, 3 etc. But now it is showing weird number such as -150000 etc.
Can someone help me?

A: After some trial and errors, I got it right by doing the following way
$startDate = $tagQueryRows['startDate'];
$startDate = strtotime($startDate);
$todayDate = date('d-m-Y');
$totalDaysCompleted = (strtotime($todayDate)) - $startDate;
$totalDaysCompleted = round($totalDaysCompleted/(60*60*24),0);


text:
Q: Why do we define partitions of unity to be locally finite instead of pointwise finite? The typical definition of a partitions of unity $\{\varphi_i\}_{i\in I}$ subordinate to a cover $\{U_i\}_{i\in I}$ requires that for any $x\in X$, there is a neighborhood $N_x$ containing $x$ s.t. only a finite number of $\varphi_i$ are positive on $N_x$ (see Wikipedia). My question is why can't we define them to be only s.t. for any $x\in X$, only a finite number of $\varphi_i(x)$ are positive? Essentially, I'm asking what situations/problems require us (or at least make it extremely desirable for us) to have a local finiteness condition instead of a pointwise finiteness condition.
Henno Brandsma's answer tells us that in fact pointwise countable partitions give rise to locally finite ones. That's quite cool and relevant, but my question really is about asking what major theorems/proofs/concepts are easier using the locally finite definition of partitions of unity. As a counter example to what I'm looking for, the proof of the Whitney embedding theorem (what I would call a "major theorem/proof/concept") in Section 50 of Munkres only uses that the partitions of unity are pointwise finite.

A: It's in a sense necessary: Theorem: if $\mathcal{U}$ is an open cover of $X$ and there is a partition of unity $\{\phi_i: X \to [0,1]\}_{i \in I}$ (in the weak sense that $\sum_{i \in I} \phi(x)=1$ for all $x$ and the sum has only at most countably many non-zero terms for each fixed $x$, so that the sum is always countable) such that each $\phi_i^{-1}[(0,1]]$ is contained in some member of $\mathcal{U}$, then $\mathcal{U}$ has a locally finite open refinement and if $X$ is then moreover normal, we can find a locally finite (in the Wikipedia sense) partition of unity for $\mathcal{U}$ as well. This is Lemma 5.1.8. in Engelking's General Topology (revised and completed edition) and the normal part follows from using a closed locally finite refinement plus Urysohn's lemma.
The weak partition concept is the bare minimum of what you want (to use the $\phi_i$ to build global functions) and automatically lead to locally finite refinements of covers... So even asking for pointwise countable leads to local finiteness.
A further advantage is that when $\{f_i\mid i \in I\}$ is a locally finite family of continuous real functions then $\sum_i f_i(x)$ is continuous right away. While if we have a point-countable family of continuous functions this need not be the case (e.g. see this example of a series of countably many continuous functions from $[0,1]$ to $\Bbb R$, that is convergent but whose sum is not continuous; some Fourier series can be even worse behaved..).


text:
Q: JSF rendered and fragments I'm facing a a problem with JSF, i have a fragment that is rendered on all pages, and displays the latest entries of a table (~ 10 items). And i want to reuse it on a page that lists all entries.
I put a rendered rule to prevent the all pages version of the element to appear on this page specifically, but still no go, I aways get a "duplicate id found in view" error. The problem seems to lay on the fact that the JSF processor validate the IDs before validating which ones will really be rendered.
Just for information, I'm using the end of the request URI to determine if rendered is True or False.
Ah, and I tried using c:if, but it was useless too.
Edit:
Sample code requested...
i have this xhtml fragment ("tableInclude.xhtml"):
<ui:composition
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
    xmlns:p="http://primefaces.org/ui"
    xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
    <ui:fragment>
        <p:dataTable var="item" value="#{bean.items}"
                     emptyMessage="#{msg['table.empty']}"
                     widgetVar="table" id="listItems" styleClass="tableItems">
            <p:column styleClass="span1" style="text-align: center;">
                <f:facet name="header">
                    <i class='fa-icon-picture'/>
                </f:facet>
                <p:commandLink action="#{bean.itemSelected(item)}" value="#{item.name}"/>
            </p:column>
        </p:dataTable>
    </ui:fragment>
</ui:composition>

Then i run on every page this:
<ui:include src="./tableInclude.xhtml">

i tried to do this:
<ui:fragment rendered="#{request.requestURI != '/context/don't_render_here.xhtml'}">
    <ui:include src="./tableInclude.xhtml">
</ui:fragment>

But i still get the duplicated id error even so when i access the "don't_render_here.xhtml" page.

A: not the best solution, but a quick and dirty: replace ui:fragment with f:subView


text:
Q: Python Eve MONGO_DBNAME vs MONGO_AUTHDBNAME Eve's global configuration docs mention MONGO_AUTHDBNAME and MONGO_DBNAME parameters.
I'd expect MONGO_AUTHDBNAME to be the database Eve checks provided authorization credentials against.  The analogous CL usage being:
mongo -u "user" -p  --authenticationDatabase "<MONGO_AUTHDBNAME>" --host x.x.x.x

I then expect the MONGO_DBNAME to be the database Eve orients the endpoints/collections from.  The analogous CL usage being:
mongo> use <MONGO_DBNAME>

So that host:5000/endpoint would refer to the endpoint collection within MONGO_DBNAME
However when I set MONGO_DBNAME to anything other than the database I need to authenticate from, accessing every endpoint fails with:
OperationFailure: Authentication failed.

So...
Is my understanding above correct?
Can MONGO_DBNAME and MONGO_AUTHDBNAME be different / do the credentials in settings.py have to have the authentication database be the same as the database you want the endpoints/collections oriented from?
Thanks

A: Check this question. In short, MONGO_AUTHDBNAME is used only in old MongoDB authentication schemes. So you need to have your users in the MONGO_DBNAME database to make it work.


text:
Q: TypeError: login is not a function at HTMLInputElement.onclick (VM188 index.html:76) onclick @ VM188 index.html:76 I am trying to make a login page for my project I am working on and I came across this error while trying to run the code. I have no idea what is causing it.
Here is my code:

<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>JAuth Login</title>
  <link href="https://fonts.googleapis.com/css?family=Karla:400,700&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="https://cdn.materialdesignicons.com/4.8.95/css/materialdesignicons.min.css">
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
  <link rel="stylesheet" href="assets/css/login.css">

Sign into your account

              <form action="#!">

                    Email
                    <input type="email" name="email" id="email" class="form-control" placeholder="Email address">

                    Password
                    <input type="password" name="password" id="password" class="form-control" placeholder="***********">

                  <input name="login" id="login" class="btn btn-block login-btn mb-4" type="button" value="Login" onclick="login()">
                  <input name="register" id="register" class="btn btn-block login-btn mb-4" type="button" value="Register">
                </form>
                Forgot password?

                  Terms of use.
                  Privacy policy

That was the full script.
When I run the code and go to chrome, I keep finding an error saying: TypeError: login is not a function at HTMLInputElement.onclick (VM188 index.html:76) onclick @ VM188 index.html:76
Do you know what is happening?
Thanks


text:
Q: Image and Kdeplot not matching I'm trying to make a kdeplot graphic using some coordinates. Problem is that when I merge it with an image, the kdeplot rotates making it not to match the image. If I remove the line
plt.imshow(img)

The kdeplot shows the graphic correctly.
fig, ax = plt.subplots(figsize=(13.5, 8))
fig.set_facecolor("#23312b")
ax.patch.set_facecolor("#22312b")

plt.title("asd", color = "red", size=20)
#df.to_csv("prueba.csv", index = False)

coordenadasX = []
coordenadasY = []
for x in range(len(df)):
    coordenadasX.append(newdict[x][1])
    coordenadasY.append(newdict[x][2])

heatmap, xedges, yedges = np.histogram2d(coordenadasX, coordenadasY, bins=50)
extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]

coordenadas = np.array([coordenadasX, coordenadasY])

img = cv2.imread('C:\\Users\\srjza\\Documents\\LeaguePython\\mapa.jpg')

ax = sns.kdeplot(
    x = coordenadasX,
    y = coordenadasY,
    thresh = False,
    n_levels=12,
    alpha=0.7,
    fill=True,
    color="red",
    legend=True
)

#plt.clf()
plt.scatter(coordenadasX, coordenadasY)
#plt.imshow(heatmap.T, extent=extent, origin='lower')
plt.imshow(img)
plt.show()

All the dots should match the right bottom corner.


text:
Q: FreeMarkerViewResolver not render the template when i request use ajax Sorry everyone. My english is so bad,but i have some questions to ask.
When i try to use ajax get a freemarker view.It's not render just html code.
The following is my config.
springmvc-servlet.xml
<bean id="freemakerViewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
    <property name="cache" value="true" />
    <property name="prefix" value="" />
    <property name="suffix" value=".html" />
    <property name="contentType" value="text/html;charset=UTF-8"></property>
    <property name="requestContextAttribute" value="request" />
    <property name="exposeSpringMacroHelpers" value="true" />
    <property name="exposeRequestAttributes" value="true" />
    <property name="exposeSessionAttributes" value="true" />
</bean>

freeMarkerConfigurer
<bean id="freeMarkerConfigurer"
    class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
    <property name="templateLoaderPath" value="/WEB-INF/views/" />
    <property name="freemarkerSettings">
        <props>
            <prop key="template_update_delay">0</prop>
            <prop key="default_encoding">UTF-8</prop>
            <prop key="number_format">0.##########</prop>
            <prop key="datetime_format">yyyy-MM-dd HH:mm:ss</prop>
            <prop key="date_format">yyyy-MM-dd</prop>
            <prop key="time_format">HH:mm:ss</prop>
            <prop key="classic_compatible">true</prop>
            <prop key="template_exception_handler">ignore</prop>
        </props>
    </property>
</bean>

*

*my view

    <#list items as item>

item.name

    </#list>

*response data

A: It's my wrong.I submit the wrong parameters,so the list is empty.


text:
Q: How to set focus on listbox after the sub ends VBA I currently enable and disable in different subs where tbA is a textbox, lbA & lbB are listboxes, Generate, Reset & Clse are buttons. There are other codes under these, but I've shorten to show the least amount to reproduce.
After enabling lbA & lbB for input I SetFocus to lbA, but as soon as the sub ends, my focus goes to either Reset or Close
Private Sub Userform_Activate

    lbA.Enabled = False
    lbB.Enabled = False
    Generate.Enabled = False

End Sub

Private Sub tbA_AfterUpdate()

If tbA.TextLength > 0 Then

    tbA.Enabled = False
    lbA.Enabled = True
    lbB.Enabled = True
    Generate.Enabled = True

    lbA.SetFocus

Elseif tbA.TextLength = 0 Then

    Msgbox "Invalid Input"
    Exit Sub

End If  'setting focus works up till here

End Sub 'as soon as this sub ends, and it's time for user to input lbA & lbB
        'it loses focus to the Reset & Close button

Private Sub Generate_Click()

    Msgbox tbA & "from " & lbA " to " & lbB
End

End Sub

Thanks in advance!


text:
Q: Carregar imagem após item selecionado Na minha aplicação o usuário define um diretório raiz. Após definir a raiz existe a listagem de arquivos presentes no diretório. Quando o arquivo for selecionado existe um outro diretório onde existe uma imagem com o mesmo nome do arquivo. Eu quero que ao selecionar o arquivo ele exiba a imagem referente ao arquivo. Eu pesquisei o componente p:graphicImage mas não achei um bom exemplo. Vi usando a library="images" porém ele só reconhece as imagens que estão na pasta resources/images. Eu pensei que se eu pudesse alterar a localização padrão desta library apontando pra minha pasta de imagens eu poderia resolver o problema. Gostaria de saber se essa seria a melhor solução? Ou se me ajudem a resolver este problema de outra maneira.
No momento a página está assim:
<h:form>
    <p:panel header="Informações dos Itens">
        <h:panelGrid columns="2">
            <p:outputLabel value="Diretório Raiz Origem: " for="diretorioRaizOrigem" />
            <p:inputText id="diretorioRaizOrigem" value="#{questItemController.questItem.diretorioRaizOrigem}">
                <p:ajax event="change" process="@this" immediate="true" />
            </p:inputText>
            <p:outputLabel for="itemOrigem" value="Item Origem" />
            <p:autoComplete id="itemOrigem" value="#{questItemController.questItem.nomeItemOrigem}"
                completeMethod="#{questItemController.listarItensDiretorioOrigem}" dropdown="true" var="bean" itemLabel="#{bean}"
                itemValue="#{bean}" effect="bounce" forceSelection="true" minQueryLength="3">
                <p:ajax event="itemSelect" listener="#{questItemController.itemChange()}" update="itemDestino,imagem" process="@this" />
            </p:autoComplete>
            <p:outputLabel value="Diretório Raiz de Destino" for="diretorioRaizDestino" />
            <p:inputText id="diretorioRaizDestino" value="#{questItemController.questItem.diretorioRaizDestino}" />
            <p:outputLabel value="Item Destino" for="itemDestino" />
            <p:inputText id="itemDestino" value="#{questItemController.questItem.nomeItemDestino}" />
            <p:graphicImage id="imagem" value="" rendered="#{questItemController.mostrarImagem}"/>
        </h:panelGrid>
    </p:panel>
</h:form>

A: Você pode criar uma Servlet que lê o arquivo de imagem em um diretório de acordo com um parâmetro na url e depois passar como parâmetro na url do graphicImage;
urlImagem = "/imagem?nome=nome-da-imagem";

<p:graphicImage id="imagem" url="#{questItemController.urlImagem}" rendered="#{questItemController.mostrarImagem}"/>

Servlet:
@WebServlet("/imagem")
public class LogoMarcaServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        Path path = Paths.get("diretorio/das/imagens/" + request.getParameter("nome"));
        byte[] data = Files.readAllBytes(path);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        out.write(data);
        response.setContentType("image/png");
        response.setHeader("Content-Disposition", "inline");
        response.setBufferSize(out.size());

        out.writeTo(response.getOutputStream());
        response.getOutputStream().flush();
        response.getOutputStream().close();
    }

}


text:
Q: Dependent type and dependee in arguments to function in scala I want to do this in Scala:
def sum[T](seq: Seq[T]): T =
  seq match {
    case last :: Nil => last
    case head :: tail => head + sum(tail)
  }

But Scala complains that there is a type mismatch on sum(tail): it is expecting a String but got a T - which doesn't sound right of course. I investigated a little, and it looks like Scala's type inference system can only infer that tail is of type Seq[Any]. Is that the issue? What is the correct way to write this in Scala?

A: The problem is that the compiler doesn't know if method + is available for type T. That business about String is misleading. It just defaults to assuming that + is supposed to be a String concatenation.
If you restrict T to be only some numeric type that can be added together then it will work.
def sum[T:Numeric](seq: Seq[T]): T =
  seq match {
    case last :: Nil => last
    case head :: tail => implicitly[Numeric[T]].plus(head, sum(tail))
  }

It can be expressed a little cleaner by adding an import.
def sum[T:Numeric](seq: Seq[T]): T = {
  import Numeric.Implicits._
  seq match {
    case last :: Nil => last
    case head :: tail => head + sum(tail)
  }
}

Also, :: is intended for List operations. As it is your method will work for a Seq or a List but not, for example, Vector. Change :: to the more generic +: and it will work with many more collection types like Vector, Array, etc.


text:
Q: How can i iterate a ArrayDeque in reverse? How can i iterate a ArrayDeque in reverse?
I would normally do this for an array but it's not indexable.
for (int i = delegate.size() - 1; i >= 0; i--) {}

thanks

A: You can use the method descendingIterator() to get an iterator that iterates the ArrayDeque<T> in reverse.
Iterator<T> it = arrayDeque.descendingIterator();
while(it.hasNext()) {
    // do something with it.next()
}

A: Try this out
The elements will be returned in reverse order from last to first.
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */

class List {
   public static void main(String[] args) {
      // creating a TreeSet
      TreeSet <Integer>treeadd = new TreeSet<Integer>();

      // adding in the tree set
      treeadd.add(1);
      treeadd.add(13);
      treeadd.add(17);
      treeadd.add(2);

      // create descending iterator
      Iterator iterator;
      iterator = treeadd.descendingIterator();

      // displaying the Tree set data
      System.out.println("Descending order: ");
      while (iterator.hasNext()){
          System.out.println(iterator.next() + " ");
      }
   }
}


text:
Q: Containers unable to communicate on same EC2 host I have a multi-container application deployed on an EC2 instance via a single ECS task. When I try making an HTTP request to container-2 from container-1, I get error "Name or service not known."
I'm unable to reproduce this locally when I run with docker compose. I'm using the bridge network mode. I've SSH'd into the EC2 instance and can see that both containers are on the bridge network. (I've unsuccessfully tried awsvpc as well and that led to a different set of issues... so I'll save that for a separate post if necessary.)
Here's a snippet of my task-definition.json:
{
    ...
    "containerDefinitions": [
        {
            "name": "container-1",
            "image": "container-1",
            "portMappings": [
              {
                "hostPort": 8081,
                "containerPort": 8081,
                "protocol": "tcp"
              }
            ]
        },
        {
            "name": "container-2",
            "image": "container-2",
            "portMappings": [
              {
                "hostPort": 8080,
                "containerPort": 8080,
                "protocol": "tcp"
              }
            ]
        }
    ],
    "networkMode": "bridge",
    ...
}

EDIT1 - Adding some of my ifconfig, let me know if I need to add more.
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:a7ff:febd:55df  prefixlen 64  scopeid 0x20<link>
        ether 02:42:a7:bd:55:df  txqueuelen 0  (Ethernet)
        RX packets 842  bytes 55315 (54.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 614  bytes 78799 (76.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ecs-bridge: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 169.254.172.1  netmask 255.255.252.0  broadcast 0.0.0.0
        inet6 fe80::c5a:1bff:fed4:525f  prefixlen 64  scopeid 0x20<link>
        ether 00:00:00:00:00:00  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 23  bytes 1890 (1.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 3760  bytes 274480 (268.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3760  bytes 274480 (268.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

EDIT2 - docker inspect bridge
[
    {
        "Name": "bridge",
        "Id": "...",
        "Created": "...",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "XXX",
                    "Gateway": "XXX"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "somehash": {
                "Name": "container-1",
                "EndpointID": "XXX",
                "MacAddress": "XXX",
                "IPv4Address": "XXX",
                "IPv6Address": ""
            },
            "somehash": {
                "Name": "container-2",
                "EndpointID": "XXX",
                "MacAddress": "XXX",
                "IPv4Address": "XXX",
                "IPv6Address": ""
            }
        },
        "Options": {
            "com.docker.network.bridge.default_bridge": "true",
            "com.docker.network.bridge.enable_icc": "true",
            "com.docker.network.bridge.enable_ip_masquerade": "true",
            "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
            "com.docker.network.bridge.name": "docker0",
            "com.docker.network.driver.mtu": "1500"
        },
        "Labels": {}
    }
]

A: To allow containers in a single task, in EC2 host networking mode, to communicate with each other you need to specify the links attribute to map containers to internal network names. This is documented here.


text:
Q: Sophos Intelix Static file analysis - html What about code of Submit a file for static analysis - HTML create on Insomnia?
https://api.labs.sophos.com/doc/analysis/file/static.html
describe only 3!

A: The 'Static File Analysis - HTML' option that is shown on our video refers to calling the static file analysis part of the API and including the parameter report_format=html. This will ensure that the response from the API is given in HTML rather than the default of JSON.
You mention that our API documentation shows 3 submissions (1 post and 2 gets) each of these submissions will accept the report_format option which has two options (JSON which is the default and HTML). This has lead to the 6 items that you can see in Insomnia in our video.


text:
Q: Unable to start app server in Netbeans I am unable to run either Tomcat (Version 7), or Glassfish (Version 4.1.1) in Netbeans.
I have tried re-installing the app servers and the IDE. Tried with Netbeans 8.0.2 and 8.1. It was working a few days ago.
When I run a project, the process takes a long time (>10 mins) and fails.From the Glassfish log, I see the below errors being shown commonly.
[2016-06-07T18:00:33.360+0530] [glassfish 4.1] [SEVERE] [] [] [tid: _ThreadID=112 _ThreadName=pool-22-thread-1] [timeMillis: 1465302633360] [levelValue: 1000] [[
Config Listener class com.sun.enterprise.web.reconfig.WebConfigListener notification took too long
java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(FutureTask.java:201)
at org.jvnet.hk2.config.Transactions$ConfigListenerNotifier$1.call(Transactions.java:289)
at org.jvnet.hk2.config.Transactions$ConfigListenerNotifier$1.call(Transactions.java:268)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.jvnet.hk2.config.Transactions$Notifier$1$1.run(Transactions.java:167)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
]]

Need your help in figuring out how to fix this. Thank you!


text:
Q: How to send table row data to form input for edit in angularjs I need help with angularjs code. The thing is, in my table rows I have "Edit" button, so if I click on edit a row I want the row data shown in a form below for edit. Please how do I complete the Angularjs code to make this work. I included some codes.
HTML

            S/N
            FName
            LName

            {{ $index + 1 }}
            {{mywrk.fname}}
            {{mywrk.lname}}
            <input type="button" class="btn btn-secondary"
                ng-model="row.clk" ng-click="EditRow()" value="Edit"/>

    <form method="post" novalidate autocomplete="off">

            FName: <input type="text" class="form-control"
                ng-model="edit.fname" ng-required="true">

            LName <input type="text" class="form-control"
                ng-model="edit.lname" ng-required="true">

        <input class="btn btn-secondary" type="submit" value="Update">
        <input class="btn btn-secondary" type="submit" value="Cancel">
    </form>

Javascript
var app = angular.module("myApp", ['ngRoute', 'ngResource' ]);
app.controller('MainCtrl', ['$scope','$filter', function ($scope, $filter){

  $scope.employees = [
    { 'fname': 'Kelly', 'lname': 'Bob'},
    { 'fname': 'Jay', 'lname': 'White'}
  ];

}]);

A: In your edit button, just pass your object to your function like this
ng-click="EditRow(mywrk)"

then in you controller, just add that function and assign the object you've passed to your $scope.edit object like this
$scope.edit = {}; //you need to initialize this first to prevent error
$scope.EditRow = function(item) {
  $scope.edit = item;
}

And you're done.

A: @JKAlombro answer is one way.  Another way, you can get it by $index.

*

*In button click event, you need pass row index
ng-click="EditRow($index)"

*in controller side
$scope.edit = {};
$scope.EditRow = function(index) {
$scope.edit = $scope.employees[index];
}


text:
Q: Application of dynamic programming in real world programming I have found that dynamic programming is a bit skillful and demanding. But since I expect myself to become an adequate software engineer, I am wondering in which development scenario will DP massively be used or in other words are there any practical usage of it in development based on modern computers?
If you think about design patterns like Proxy pattern and dynamic proxy, which is broadly used in spring framework, DP seems like it is only useful in tech interview.
Also, application of parallelized computing and distributed system seems not easy to empower DP in modern computer context.
Are there any not rare scenarios where DP is widely used in very practical ways?
Please forgive my ignorance, since I haven't meet DP in real production level development, which makes me doubt the meaning of digging  into DP.

A: I agree with @ Matt Timmermans.
You don't learn about DP in case you have to use DP someday. By practicing DP, you learn ways of thinking about problems that will make you a better developer. In 10 years, nobody will care about the spring framework, but the techniques you learned from DP will still serve you well.
Now, the answer to your questions, part by parts:
1) Why DP if we have modern computers?
I think you got confused by the analogy of modern computers and the need for DP. Although modern computers are powerful in processing, you may think why I need DP if I have modern fast processors to run my application on.
Not every task can be executed on these modern computers as they come up with storage, network, and compute costs. In fact, as an engineer, we should be thinking of optimizing the usage of such resources, that is, making your code efficient to make it capable of running on minimum system configurations.
In today's world, we have a shared service architecture. It means that different independent services share resources. But the fact is they are interdependent indirectly. Imagine what will happen if a non-optimized code is consuming a lot of memory and compute time. These processors will face difficulty in allocating resources for other services or applications.
The thing is, "Why should I buy an apartment if a multi-bedroom flat can meet my needs and also creates an opportunity for others to buy a flat in the same apartment?"
2) DP in tech interviews
The fact that makes DP the most challenging topic to ace is the number of variations in DP.
It checks your ability to break down a difficult task into small ones to avoid reputations and thus save time, efforts, and thus overall resources.
That is one of the most prime reasons why DP is part of tech interviews.
Not only DP teaches you to optimize and learn useful things, but it also highlights bad practices of writing codes.
3) Usage of DP in real life

*

*In Google Maps to find the shortest path between source and the series of destinations (one by one) out of the various available paths.

*In networking to transfer data from a sender to various receivers in a sequential manner.

*Document Distance Algorithms- to identify the extent of similarity between two text documents used by Search engines like Google, Wikipedia, Quora, and other websites

*Edit distance algorithm used in spell checkers.

*Databases caching common queries in memory: through dedicated cache tiers storing data to avoid DB access, web servers store common data like configuration that can be used across requests. Then multiple levels of caching in code abstractions within every single request that prevents fetching the same data multiple times and save CPU cycles by avoiding recomputation. Finally, caches within your browser or mobile phones that keep the data that doesn't need to be fetched from the server every time.

*Git merge. Document diffing is one of the most prominent uses of LCS.

*Dynamic programming is used in TeX's system of calculating the right amounts of hyphenations and justifications.

*Genetic algorithms.
Also, I found a great answer on Quora which lists the areas in which DP can be used:
Operations research,
Decision making,
Query optimization,
Water resource engineering,
Economics,
Reservoir Operations problems,
Connected speech recognition,
Slope stability analysis,
Using Matlab,
Using Excel,
Unit commitment,
Image processing,
Optimal Inventory control,
Reservoir operational Problems,
Sap Abap,
Sequence Alignment,
Simulation for sewer management,
Finance,
Production Optimization,
Genetic Algorithms for permutation problem,
Haskell,
HTML,
Healthcare,
Hydropower scheduling,
LISP,
Linear space,
XML indexing and querying,
Business,
Bioinformatics


text:
Q: app.R run app local host error resolved when published to shinyappio I'm following Kunaal Naik's Shiny_Dashboards reactive example and tried reproducing a simpler data set, but I'm getting a mapping error, "Aesthetics must be either length 1 or the same as the data (1): x".  What am I doing wrong?
server <- function(input, output, session) {

SalesRep <- c("Amy","Amy", "Amy", "Joe", "Joe", "Joe")
QTR <- c("Q1", "Q2", "Q3", "Q1", "Q2", "Q3")
Sales <- c(10, 20, 30, 5, 10, 15)
sales <- data.frame(SalesRep, QTR, Sales)

  #Summarize Data and then Plot
  data <- reactive({
    req(input$sel_SalesRep)
    df <- sales %>% filter(SalesRep %in% input$sel_SalesRep) %>%  group_by(QTR) %>% summarise(Sales = sum(Sales))
  })

  #Plot
  output$plot <- renderPlot({
    g <- ggplot(data(), aes(y = Sales, x = QTR))
    g + geom_bar(stat = "sum")
  })
}

ui <- basicPage(
  h1("R Shiny interactive Bar Chart using Reactive and Render"),
  selectInput(inputId = "sel_SalesRep",
              label = "Choose Sales Rep",
              list("Amy","Joe")),
  plotOutput("plot")
)

shinyApp(ui = ui, server = server)


text:
Q: Auto layout issue I have the following auto layout constraints on the root view of a view controller :
(lldb) po [superview constraints]
<__NSArrayM 0x9e65ba0>(
<NSLayoutConstraint:0x9e67d10 H:[HeaderView:0x9e6a1b0]-(0)-|   (Names: '|':UIView:0x9e69040 )>,
<NSLayoutConstraint:0x9e67ce0 H:|-(0)-[HeaderView:0x9e6a1b0]   (Names: '|':UIView:0x9e69040 )>,
<NSLayoutConstraint:0x9e67cb0 V:|-(0)-[HeaderView:0x9e6a1b0]   (Names: '|':UIView:0x9e69040 )>,
<NSLayoutConstraint:0x9e67c80 H:|-(0)-[RadialGradientView:0x9e685c0]   (Names: '|':UIView:0x9e69040 )>,
<NSLayoutConstraint:0x9e67c50 V:[RadialGradientView:0x9e685c0]-(0)-|   (Names: '|':UIView:0x9e69040 )>,
<NSLayoutConstraint:0x9e67c20 H:[RadialGradientView:0x9e685c0]-(0)-|   (Names: '|':UIView:0x9e69040 )>,
<NSLayoutConstraint:0x9e67bf0 V:[HeaderView:0x9e6a1b0]-(0)-[RadialGradientView:0x9e685c0]>,
<NSLayoutConstraint:0x10c89830 HeaderView:0x9e6a1b0.height == UIView:0x9e69040.height + 35>
)

And when I add the height constraint (the last one), I get an autolayout ambiguous layout error :
2013-10-16 16:18:43.121 Application[26038:a0b] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
    "<NSLayoutConstraint:0xb016da0 V:|-(0)-[HeaderView:0xb0192a0]   (Names: '|':UIView:0xb018130 )>",
    "<NSLayoutConstraint:0xb016d40 V:[RadialGradientView:0xb0176b0]-(0)-|   (Names: '|':UIView:0xb018130 )>",
    "<NSLayoutConstraint:0xb016ce0 V:[HeaderView:0xb0192a0]-(0)-[RadialGradientView:0xb0176b0]>",
    "<NSLayoutConstraint:0xb00c3f0 HeaderView:0xb0192a0.height == UIView:0xb018130.height + 35>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0xb016ce0 V:[HeaderView:0xb0192a0]-(0)-[RadialGradientView:0xb0176b0]>

Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

RadialGradientView is a subclass of UIView that is only overriding the drawRect: method.
The HeaderView is also a subclass of UIView with the following code :
@implementation HeaderView
{
    NSLayoutConstraint  * heightConstraint;
}

static UINib * headerViewNib = nil;

- (id)awakeAfterUsingCoder:(NSCoder *)aDecoder
{
    if (![[self subviews] count])
    {
        if (headerViewNib == nil)
            headerViewNib = [UINib frameworkNibWithNibName: @"HeaderView"];

        SMDFHeaderView * headerView = [[headerViewNib instantiateWithOwner: nil options: nil] lastObject];

        [headerView setTranslatesAutoresizingMaskIntoConstraints: NO];
        [self removeConstraints: [self constraints]];

        return headerView;
    }
    return self;
}

- (void)layoutSubviews
{
    if (!heightConstraint)
        [self setNeedsUpdateConstraints];

    [super layoutSubviews];
}

- (void)updateConstraints
{
    if (!heightConstraint)
    {
        UIView * superview = [self superview];
        heightConstraint = [NSLayoutConstraint constraintWithItem: self attribute: NSLayoutAttributeHeight relatedBy: NSLayoutRelationEqual toItem: superview attribute:NSLayoutAttributeHeight multiplier: 1.0 constant: 35.0];
        [superview addConstraint: heightConstraint];
    }

    [super updateConstraints];
}

/* Tried that, but it does not change anything.
- (CGSize)intrinsicContentSize
{
    return CGSizeMake([[super superview] frame].size.width, 35);
}*/

@end

PS : The issue does not seems to be related to the nib replacement trick, even if i comment the awakeAfterUsingCoder method, it does the same thing.

A: You've misunderstood how this line works:
heightConstraint = [NSLayoutConstraint constraintWithItem: self attribute: NSLayoutAttributeHeight relatedBy: NSLayoutRelationEqual toItem: superview attribute:NSLayoutAttributeHeight multiplier: 1.0 constant: 35.0];

What this is doing is making self equal to the height of superview, multiplied by 1, plus 35. This means you're asking the subview to be 35 points taller than the superview, and also, elsewhere, asking the subview to fit into the superview. That can't work.
To constrain a view to a particular height, you need to use something like this:
heightConstraint = [NSLayoutConstraint constraintWithItem: self attribute: NSLayoutAttributeHeight relatedBy: NSLayoutRelationEqual toItem: nil attribute:NSLayoutAttributenNotAnAttribute multiplier: 1.0 constant: 35.0];

This just constrains a view to a specific height.


text:
Q: How to add config file while pushing default docker image to cloud foundry As announced the Swisscom logstash buildpack is not supported any longer.
The proposed solution is to push the default docker image.
I am trying to figure out the way to attach the curator configuration without "baking" it inside the docker image. Any ideas?
thanks

A: There are two articles in the support forum that discuss some aspects of your question here:
https://docs.developer.swisscom.com/service-offerings/logstash-docker.html
https://docs.developer.swisscom.com/service-offerings/kibana-docker.html
They do in fact recommend:

If you wish to use configuration files instead, you can fork the official Docker image and ADD your configuration files in your own Dockerfile.

I assume that is exactly what you did not want to do, but you can pass in most of the config via environment variables as far as I understand.
If you are ok with creating a separate Docker image, you could also host the config somewhere (let's say on S3) and then dynamically retrieve it on start-up of your Docker container.
You could also build the config setup into your deployment setup, although I haven't tried this with the docker build-pack, you can "stack" multiple build-packs in CloudFoundry and pre-load your configuration files into the virtual server as part of an initial build-pack step. There is more information on how to do that here: https://docs.cloudfoundry.org/buildpacks/use-multiple-buildpacks.html


text:
Q: Autofeel light bar mod I purchased an Autofeel 30 inch light bar that has 4 rows of LEDs.
I have seen this bar advertised under a number of different names, but as far as I know it's the only one with 4 rows of LEDs (they all look the same). I have added a picture of the bar, so you may recognize it from that.

It's a cheap Chinese bar, but it works well for the purpose I want it for which is a side flood light.
My problem is it also has 4 modes (white steady, white strobing, yellow steady, yellow strobing). These modes are selected by a time delay, so if the unit is switched off and on in less then 7 seconds, it will select the next mode.
If switched off and on again after more then 7 seconds, it will go back to steady white.
I have it rigged up to sync with my high beam and it's proving to be a major pain in the rear (or front in this case).
My first thoughts (see my previous question) were to build a time delay circuit that prevents the unit coming on in less then 7 seconds after it was switched off and I think I have that sorted. However one of the contributors mentioned it would be better to directly modify the light bar.
I have seen it advertised with an extra wire which you use to manually select the mode (that's what I thought I was buying) so I guess it's possible to modify the bar to make it work like that.
So my question is, which is a long shot, I know: Does anyone have any information, circuit, advice to modify the light bar so it only works on white steady?
I have written to the manufacturers and the supplies but got nothing back, except how to use it with the time delay to switch the mode.


text:
Q: std::bad_alloc: out_of_memory: CUDA error when importing data/running models I'm trying to upload a dataset to a NVIDA RAPIDS jupyter notebook, but this error keeps popping up when importing this dataset or when using XGBoost on a dask dataframe. The training dataset is 3.7gb in size. I only have one GPU.
Some specs:

*

*CPU: i7 9700F @4.00GHz

*GPU: 3070 8GB GDDR6

*RAM: 16GB @3600MHz

*Windows 11

*Ubuntu 18.04.05 (running the rapids environment)

*Rapids version 22.12

*CUDA version 12.0

*NVIDIA-SMI version 528.02

I tried using this: https://www.kaggle.com/getting-started/140636 but I think this issue goes deeper
import cudf
import dask_cudf
import dask_xgboost
import xgboost as xgb
import tensorflow as tf
import torch

!du -sh one-hot-train.csv
> 3.7G  one-hot-train.csv

!du -sh y-train.csv
> 10M   y-train.csv

# Does not work due to memory issue
X_train = cudf.read_csv('one-hot-train.csv', index_col = 0)

# This will import the data no problem
X_train = dask_cudf.read_csv('one-hot-train.csv', chunksize = "4GB")
X_train = X_train.drop(columns = ['Unnamed: 0'])

# Since the y csv is so small, it doesn't matter how it's imported
y_train = dask_cudf.read_csv('y-train.csv')
y_train = y_train.drop(columns = ['Unnamed: 0'])

xgb_params = {

    'learning_rate': 0.3,
    'objective': 'binary:logistic',
    'tree_method': 'gpu_hist',
    'max_depth': 6,
    'seed': 555,
    'predictor': 'gpu_predictor',
    'eval_metric': 'aucpr',
    'n_estimators': 5000,

}

# Does not work due to memory issue
xgb_model = dask_xgb.XGBClassifier(**xgb_params)
xgb_model.fit(X_train, y_train)

Here's the specific error:
> MemoryError: std::bad_alloc: out_of_memory: CUDA error at: ~/miniconda3/envs/rapids-22.12/include/rmm/mr/device/cuda_memory_resource.hpp

A: Using Dask XGBoost does not help if you're using a single GPU, as the entire data still needs to fit in memory to train the model. You should either use Dask XGBoost with multiple GPUs or use a single, larger GPU to train this model. XGBoost provides an experimental external memory interface for larger-than-memory dataset training, but it's not ready for production use.
Separately, it looks like you're one-hot-encoding your data based on the file name. You don't need to one-hot-encode your data with recent versions of XGBoost. See the XGBoost Categorical documentation for more information.


text:
Q: CSS transition fade effect on sub-menus not working I'm trying to build some sub-menus with fade in/out effects. Each sub-menu should fade in when the mouse hovers over the corresponding parent menu item. Here's my code so far:
.navbar ul ul {
    display: none;
    opacity: 0;
    position: absolute;
    top: -99999px;
    -webkit-transition: opacity .1s linear;
    -moz-transition: opacity .1s linear;
    -o-transition: opacity .1s linear;
    transition: opacity .1s linear;
}

.navbar li:hover > ul {
    display: block;
    opacity: 1;
    top: 100%;
    -webkit-transition: opacity 0.35s ease;
    -moz-transition: opacity 0.35s ease;
    -o-transition: opacity 0.35s ease;
    transition: opacity 0.35s ease;
}

The Problem:

The sub-menu's fade effect does not work. When I hover my mouse over any parent item, the corresponding sub-menu displays instantly without the fade in/out effect.

The Solution (thanks to Cam):
.navbar ul ul {
    display: block;
    visibility: hidden;
    -webkit-transition: opacity 0.35s ease-in;
    -moz-transition: opacity 0.35s ease-in;
    -o-transition: opacity 0.35s ease-in;
    transition: opacity 0.35s ease-in;
}

.navbar li:hover > ul {
    visibility: visible;
    -webkit-transition:     opacity 0.35s ease;
    -moz-transition:        opacity 0.35s ease;
    -o-transition:          opacity 0.35s ease;
    transition:             opacity 0.35s ease;
}


text:
Q: dependency:list exclude configuration not work? I want to exclude some jar in dependency:list only.
My configuration is(according to https://maven.apache.org/plugins/maven-dependency-plugin/list-mojo.html) :
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1.1</version>
                <executions>
                    <execution>
                        <id>list</id>
                        <goals>
                            <goal>list</goal>
                        </goals>
                        <configuration>
                            <excludeArtifactIds>someartifactids</excludeArtifactIds>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Then I run
mvn clean dependency:list -Dmaven.test.skip=true -Dverbose -DappendOutput -DoutputFile=D:/dependency.txt

But the dependency still appears in the file.

A: When you execute plugins from cli, maven will use execution ID: default-cli.
Option #1 - change execution ID in your pom.xml:
<plugin>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <execution>
            <id>default-cli</id>

Option #2 - specify execution ID explicitly (works since maven 3.3.1)
mvn clean dependency:list@list


text:
Q: Anything similar to a parent view with sub-views in flex 4.6? Is there any way to create a parent view with sub view system in flex?  For example I need to create an application that computes insurance rates for different products.  All products need to have the same inputs for gender, age, and nicotine usage.  What I'd like to do is have a 'parent view' (which wouldn't actually be displayed) that has all these basic fields layed out, then create sub views that automatically displays the components and layout of the parent view, which would cut back on duplicating code.  the sub views would have additional components unique to the product (some would also need to take in number of children, etc.) and compute the rates in different ways.
Edit: let's say I have 2 different products. ProdA and ProdB
This is the view for ProdA
<?xml version="1.0" encoding="utf-8"?>
<components:View xmlns:fx="http://ns.adobe.com/mxml/2009"
             xmlns:s="library://ns.adobe.com/flex/spark" xmlns:components="spark.components.*" title="ProdA"
             xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

<fx:Script>
    <![CDATA[

        import ASClasses.LL;

        public function makeLL(age:String, gen:String, nic:String):void{
            var intAge:int=int(age);
            var newLL:LL=new LL(intAge, gen, nic);
            dest.text=String(newLL.computeRate());
        }

    ]]>
</fx:Script>

<s:VGroup width="100%" height="100%" verticalAlign="middle" horizontalAlign="center">

        <s:Label text="Age:"/>
        <s:TextInput id="age" restrict="0-9" maxChars="2"/>

        <s:ComboBox id="GenderBox" width="140" prompt="Gender" >
            <s:dataProvider>
                <mx:ArrayList>
                    <fx:String>Male</fx:String>
                    <fx:String>Female</fx:String>
                </mx:ArrayList>
            </s:dataProvider>
        </s:ComboBox>

        <s:Label text="The selected gender is: {GenderBox.selectedItem}"/>

        <s:ComboBox id="NicotineBox" width="140" prompt="Nicotine Usage">
            <s:dataProvider>
                <mx:ArrayList>
                    <fx:String>Smoker</fx:String>
                    <fx:String>Non-Smoker</fx:String>
                </mx:ArrayList>
            </s:dataProvider>
        </s:ComboBox>

        <s:Label text="The selected Nicotine is: {NicotineBox.selectedItem}"/>

        <s:Button label="Get Rate" click="makeLL(age.text, GenderBox.selectedItem, NicotineBox.selectedItem)" />
        <s:TextInput id="dest" />
    <s:Button label="Back" click="navigator.popView()" styleName="back" />
</s:VGroup>

This is the view for ProdB
<?xml version="1.0" encoding="utf-8"?>
<components:View xmlns:fx="http://ns.adobe.com/mxml/2009"
             xmlns:s="library://ns.adobe.com/flex/spark" xmlns:components="spark.components.*" title="ProdB"
            xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

<fx:Script>
    <![CDATA[
        import ASClasses.OP;

        public function makePerson(age:String, gen:String, nic:String):void{
            var intAge:int=int(age);
            var newOP:OP=new OP(intAge, gen, nic);
            dest.text=String(newOP.computeRate());
        }

    ]]>
</fx:Script>

<s:VGroup width="100%" height="100%" verticalAlign="middle" horizontalAlign="center" >

    <s:Label text="Age:"/>
    <s:TextInput id="age" restrict="0-9" maxChars="2"/>

    <s:ComboBox id="GenderBox" width="140" prompt="Gender">
        <s:dataProvider>
            <mx:ArrayList>
                <fx:String>Male</fx:String>
                <fx:String>Female</fx:String>
            </mx:ArrayList>
        </s:dataProvider>
    </s:ComboBox>

    <s:Label text="The selected gender is: {GenderBox.selectedItem}"/>

    <s:ComboBox id="NicotineBox" width="140" prompt="Nicotine Usage">
        <s:dataProvider>
            <mx:ArrayList>
                <fx:String>Smoker</fx:String>
                <fx:String>Non-Smoker</fx:String>
            </mx:ArrayList>
        </s:dataProvider>
    </s:ComboBox>

    <s:Label text="The selected Nicotine is: {NicotineBox.selectedItem}"/>

    <s:Button label="Get Rate" click="makePerson(age.text, GenderBox.selectedItem, NicotineBox.selectedItem)" />
    <s:TextInput id="dest" />
    <s:Button label="Back" click="navigator.popView()" styleName="back" />
</s:VGroup>

Almost all the code is the same except for a few differences.  I'd like to have one view (Product) that contains all the duplicated code, then have ProdA and ProdB extend this product.  So that everything in the Product view shows up in both ProdA and ProdB

A: Use dependency injection (expose public properties that you can then bind to within the View), which frees you from having to define the whole thing inline as shown above.  it would look something like this
[Bindable]
public var dataProvider:ArrayList
//..other public vars
<s:ComboBox id="combo" width="140" prompt="{promptPublicVar}" >
          <s:dataProvider>{dataProviderPublicVar}</s:dataProvider>
          <s:change>publicVarContainingSelection=combo.selectedItem</s:change>
</s:ComboBox>

<s:Label text="{label}: {publicVarContainingSelection}"/>

And you'd use it something like
<myNS:MyView>
   <myNS:prompt>Gender</myNS:prompt>
   <myNS:dataProvider><mx:ArrayList>...</mx:ArrayList></myNS:dataProvider>
   <myNS:label>The selected Gender is: </myNS:label>
</myNS:MyView>

===========not going to write any more code to try to guess what you want, so============
here are some patterns you might find useful:

*

*Presentation Model

*Abstract Classes

*Template  Components
Note that the third link also mentions Code behind, which can be used as a type of abstract class.
Also, you might want to consider composition over inheritance. For example, your view shouldn't know or care how to calculate rate information, but could have a rate calculator data component passed to it.  Which it most emphatically should not be creating for itself--this is one of the reasons you're having such a hard time arriving at a reusable design.


text:
Q: Android IME: how to show a pop-up dialog? I'm playing around with some keyboard development and try to show a pop-up dialog when a certain key is pressed
if (primaryCode == -301) {
            AlertDialog mDialog = new AlertDialog.Builder(CONTEXT)
            .setTitle("My dialog")
            .setMessage("Lets do it.")
            .setPositiveButton("ok", null).create();
             mDialog.show();
}

However, the problem is the CONTEXT part. In a normal application it would just be this. I also tried getApplicationContext() and getBaseContext(), but neither of those works -> keyboard crashes.

android.view.WindowManager$BadTokenException:
  Unable to add window -- token null is
  not for an application

So I'm wondering if I have to do something with InputConnection:

The InputConnection interface is the
  communication channel from an
  InputMethod back to the application
  that is receiving its input. It is
  used to perform such things as reading
  text around the cursor, committing
  text to the text box, and sending raw
  key events to the application.

So far I wasn't able to figure out how. I definitely know it's possible, since I have seen it before. I someone could point me in the right direction that would definitely be appreciated.

Update:
To provide a better picture of what I try to achieve I uploaded a screenshot of the Swype keyboard, which does exactly that: showing a pop-up dialog when a special key gets pressed on the keyboard.

A: Peace be upon those who follow the guidance,
solution :
AlertDialog dialog;
//add this to your code
       dialog = builder.create();
        Window window = dialog.getWindow();
        WindowManager.LayoutParams lp = window.getAttributes();
            lp.token = mInputView.getWindowToken();
            lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
            window.setAttributes(lp);
            window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
//end addons
alert.show();

good luck.

A: An IME does not run in an application context, so you can not use normal application windows.  You can use a Dialog, but you will need to modify its window so that the window type is this type:
http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#TYPE_APPLICATION_PANEL
And set WindowManager.LayoutParams.token to be the token of the IME window (via View.getWindowToken()).
Note that the dialog will not be able to display pop-up windows, because in this case it is itself effectively a pop-up window.  Also the coordinate space will be relative to your IME unless you use the window flags to change it.

A: Make an activity and in the manifest file give that activity the attribute
android:theme="@android:style/Theme.Dialog"

A: You have to get a reference to your activity context.
Anyway, you should use the showDialog method of the Activity.

A: its very simple, just create activity like here (with out any view), write code of dialog in it
public class dialog extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage("Are you sure you want to Delete All Contacts?");
    builder.setCancelable(false);

    builder.setPositiveButton("Yes",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            //deleteAllContacts();
                        }//
                    });

            builder.setNegativeButton("No",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            dialog.cancel();
                        }
                    });

    AlertDialog alert = builder.create();
    alert.show();

}
}

now go to Android manifest file and add activity like,
<activity android:name=".dialog" android:theme="@android:style/Theme.NoDisplay">        </activity>

its all, enjoy

A: // 1. CREATE THE DIALOG
val builder: AlertDialog.Builder = AlertDialog.Builder(this, R.style.Theme_AppCompat_Light)
builder.setTitle("Title").setMessage("This is the message for the user. ")
val mDialog = builder.create()

// 2. SET THE IME WINDOW TOKEN ATTRIBUTE WITH THE TOKEN OF THE KEYBOARD VIEW
mDialog.window?.attributes?.token = this.mTblView.windowToken

// 3. SET THE TYPE OF THE DIALOG TO TYPE_APPLICATION_ATTACHED_DIALOG
mDialog.window?.setType(WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG)

// 4. SHOW THE DIALOG
mDialog.show()