text:
Q: Cordova error: Using "requireCordovaModule" to load non-cordova module "q" is not supported I noticed that the builds on our CI started to fail because of the following error:
Discovered plugin "cordova-plugin-app-version" in config.xml. Adding it to the project

Installing "cordova-plugin-app-version" for android

Adding cordova-plugin-app-version to package.json
Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
[ERROR] Exception:
The command '/bin/sh -c ionic cordova platforms add android' returned a non-zero code: 1

Same issue happens on both iOS and Android.
After some digging, I found that cordova 9.0.0 was recently released.
There are a couple of changes related to this issue.

*

*GH-710 Drop Q Dependency and Use Native Promises

*GH-707 Deprecate requireCordovaModule for non-Cordova modules

My first thought was that somehow we didn't have our cordova version locked, but we did lock it to cordova@8.1.2 in our dockerfile. I also tested it on my local machine and I cordova version 8.1.2 as well. So this can't be the issue.
After looking at the logs some more, I noticed some logs like these:
cordova-android version check failed ("/app/platforms/android/cordova/version"), continuing anyways.
There were a couple of those, like 3 or 4, but the build did not stop when that happened.
I then ran the build of an older commit again, and it worked fine, probably because some layers were cached. But if I changed only a single package (I updated prettier to try it out), it caused most of the layers to be rebuilt and the build crashed with the above error.
It seems that somehow some dependencies deeper down got updated, which are causing the issue.
Thanks for your help.

A: I ran into this also. In my case, I needed to remove a problematic plugin cordova-plugin-camera-preview which lists "cordova": "*" as a dependency. This would install cordova 9.0.0 during ionic cordova build

A: Seems to be an issue with cordova 9.0.0, see this issue ticket.
Looks like it is already fixed and will be included in the next (9.0.1?) release.

A: That's it, I found it.
It comes from an update to cordova cli @9.0.0 and it's append on existing projects.
The issue come from cordova-android-support-gradle-release and fixed in version latest.

So in any case, what you need to do is:
cordova plugin rm cordova-android-support-gradle-release
cordova plugin add cordova-android-support-gradle-release@latest

A: I also get this error after updating to 9.0.0. In my case I fixed it doing a clean up and rebuilding my app. You can try the following steps.
First of all

*

*Update Cordova: npm install -g cordova

*Update SDK, ex: ./android/tools/bin/sdkmanager "build-tools;28.0.3" "platforms;android-28"

*Add SDK path to your system (1), ex: in bashrc export ANDROID_SDK_ROOT=~/android
(1) ANDROID_HOME is deprecated but still working
In your Cordova Project

*

*Remove node_modules, platforms and plugins folders

*Remove package.json and package-lock.json

*Remove from config.xml plugins/platforms/engine

*Add your platform, ex: cordova platform add android

*Add your plugins updated, ex: cordova plugin add cordova-plugin-whitelist

*ex: npm install

*Build: cordova build
You can check a resume of your app with: cordova info
If you want to see a list of your plugin you can use: cordova plugins ls
Hope this help or at least point someone to the right direction :)

A: As the error says, you need to require the q. Go to npmInstall.js (Search the requireCordovaModule in your project then you will see the npmInstall.js ).
Then, add these lines;
var q = require('q');
var npmModule = require('npm');

and replace: var Q = context.requireCordovaModule('q'); with
var Q = context.q;

and replace: var npm = context.requireCordovaModule('npm'); with
var npm = context.npmModule;

A: This is what worked for me:
I removed cordova by calling
npm uninstall cordova -g

and then installed it globally again with
npm install -g cordova@latest

A: Simple:
Replace the requireCordovaModule to require :
requireCordovaModule("q") to require("q")

A: I have returned to the previous version: 8.1.2.

npm install -g cordova@8.1.2

Now, it's working again.

If you want to stay on the latest version of cordova, go to the following instructions:https://stackoverflow.com/a/58956882/9536897

A: i can solve this issue by downgrading cordova to 8.1.1.
npm remove cordova -g && npm install -g cordova@8.1.1

A: This solution worked for me - https://github.com/xpbrew/cordova-sqlite-storage/issues/856#issuecomment-497298630
For whatever plugin this error is associated with, run:
cordova platform rm ios
cordova platform rm android
cordova plugin rm <package-name>

npm i <package-name>@latest
cordova plugin add <package-name>
cordova platform add ios
cordova platform add android

edit: I recently discovered that running:
cordova platform add ios && cordova platform add android

would not install the most recent versions, would be nice for someone to explain why this is different to running them seperately, but this was my problem.

A: remove cordova-plugin-crosswalk-webview

A: I had the same issue.
This is how I solved mine:
cordova plugin | awk '{ print "cordova plugin rm " $1 " && cordova plugin add " $1 }' | sh
ionic cordova remove android && ionic cordova add android

A: C:\Windows\System32
to my PATH variable to fix this odd issue.

A: Here's a little tip in finding where requireCordovaModule exists:
For those looking to change requireCordovaModule to require, I have found it easy to search for the requireCordovaModule text right from the command line by using this command:
grep -r 'requireCordovaModule' ./

Then, you can drill into those files and rename the requireCordovaModule to require.

A: Had same issue in my project.
One thing for sure that the function requireCordovaModule is not deprecated (for now)
I use CI, and in pipelines it was giving error. Many forms suggest to downgrade cordova to 8x (BTW updated to 9.0.0 when i got this error) .. it works but again downgrading is never good.
One of the step i have in pipelines is ionic cordova build which i replaced with ionic cordova run
without any change in code it works


text:
Q: What is the order of operations when creating a struct in memory (under the hood)? Say I have a simple system in C:
#include <cstddef>

typedef struct Point {
  Point *a;
  Point *b;
  int x;
  int y;
} Point;

int main() {
  Point p1 = {NULL, NULL, 3, 5};
  return 0;
}

Godbolt compiles to:
main:
  push rbp
  mov  rbp, rsp
  mov  QWORD PTR [rbp-32], 0
  mov  QWORD PTR [rbp-24], 0
  mov  DWORD PTR [rbp-16], 3
  mov  DWORD PTR [rbp-12], 5
  mov  eax, 0
  pop  rbp
  ret

A tiny step further and we have:
int main() {
  Point v = {NULL, NULL, 3, 5};
  Point m = {NULL, NULL, 7, 9};
  Point s = {&v, &s, 11, 12};
  return 0;
}

Compiled to:
main:
  push rbp                    ; save the base pointer to the stack.
  mov  rbp, rsp               ; put the previous stack pointer into the base pointer.
  mov  QWORD PTR [rbp-32], 0
  mov  QWORD PTR [rbp-24], 0
  mov  DWORD PTR [rbp-16], 3
  mov  DWORD PTR [rbp-12], 5
  mov  QWORD PTR [rbp-64], 0
  mov  QWORD PTR [rbp-56], 0
  mov  DWORD PTR [rbp-48], 7
  mov  DWORD PTR [rbp-44], 9
  mov  QWORD PTR [rbp-96], 0
  mov  QWORD PTR [rbp-88], 0
  mov  QWORD PTR [rbp-80], 0
  mov  DWORD PTR [rbp-80], 11
  mov  DWORD PTR [rbp-76], 12
  lea  rax, [rbp-32]
  mov  QWORD PTR [rbp-96], rax
  lea  rax, [rbp-96]
  mov  QWORD PTR [rbp-88], rax
  mov  eax, 0
  pop  rbp
  ret

I can't exactly tell what's going on yet, but this helps (a little). Could one explain what is happening in the last example? I don't quite understand what the base pointer is, I know what the stack pointer is. I am not sure what QWORD PTR [...] does, but it's saying it's a quad-word size and a pointer/address. But why is it picking those specific offsets from rbp? I don't understand why it chose that.
Then the second part is the lea  rax, [rbp-32]. It looks like it's handling the part where I did {&v, &s}.
So my question is:

*

*What is the QWORD/DWORD PTR loading into? Is this loading into the heap, the stack, or something else?

*Why is it choosing to be an offset of rbp?

*Do the order of operations always go from the smallest object (most primitive object) to the most complex object? Or can you think of a case where the assembly code would first construct the complex object and then construct the more primitive objects?

I am wondering because I'm trying to wrap my head around how to create a tree in assembly. In functional programming or in JavaScript, you have a(b(c(), d(), e(f(g(), h()), ...))). The deepest functions get evaluated first, then a gets evaluated last, passed in the arguments. But I'm having a hard time visualizing how this would look in assembly.
More specifically, I am trying to create like a simple key/value store in assembly, to get a deeper understanding of how "objects" are created at this low level. It's easy in JavaScript:
db[key] = value

But this is because value already exists somewhere in memory. The question I have is, should I be creating this directly in the key-value store up-front? Or do you always create it in a random free spot in memory (like the offsets from rbp) and then later move them to the correct position (or point them to the right places)? I keep thinking I should be creating the tree leaf node directly on the branch, like I am pasting a leaf on the branch (visually). But the leaf already exists! Where does it exist before it is on the branch!? Can it ever exist on the branch before it is constructed elsewhere? I am getting confused.
So, start with a leaf.

Paste it on a branch.

  /
\ | |
 \|/
  |
  |

Where is the leaf being created in the first place? That's what I was trying to see with the assembly example.
Basically I'm wondering how it looks to directly create something on the heap, rather than the stack.

A: Most compiler use the stack for local variables.
Space on the stack is usually managed by two pointers: The stack pointer; and a "base" pointer that points to the base of the "allocated" memory on the stack.
Also worth to note is that the stack on almost all systems grows downward, which is why there are negative offsets from the base pointer (register rbp in your generated code).
The amount of space reserved is calculated by the compiler, which add code to initialize the two pointers either inside the function or before the function is called (it depends on calling conventions).
When the function returns the pointers are reset, which is a very simple way to "free" the memory for the local variables.

Somewhat illustrated, it looks like this:

base pointer ---> +---------------------+
                  | Space for variables |
                  | ...                 |
                  | ...                 |
                  | ...                 |
stack pointer --> +---------------------+

A:
Basically I'm wondering how it looks to directly create something on the heap, rather than the stack.

You can't have a named variable "on the heap" in C.  You can only have pointers to dynamically-allocated storage.  (Where the pointer variable itself is either local or global, automatic or static storage, but the value it holds can be a pointer to the return value of malloc)
e.g.  int *buffer = malloc(100*sizeof(*buffer)); inside a function: buffer is a local variable (automatic storage, which means stack space or just a register on "normal" C implementations on mainstream ISAs).
*buffer is the first int of that block of dynamic storage.

Some managed languages don't distinguish dynamic vs. automatic storage the way C does. e.g. in C# or Java you can always return a reference to a local variable. It's up to the compiler to do "escape analysis" to find out if a reference to a variable is visible outside the function, and if so to actually allocate it on "the heap", otherwise it can optimize it away or just use the stack.
In C, returning a pointer to a local variable doesn't work; the object doesn't exist after leaving the function's scope. You can do it without compile errors (just warnings) but dereferencing the pointer is UB.
e.g.
int *bad_return_local() {
    int buf[100];    // on the stack; destroyed when the function returns
    return buf;      // caller can't use this pointer to out-of-scope automatic storage
}

int *good_return_dynamic() {
    int *buf = malloc(100*sizeof(*buf));  // on "the heap"
    if (!buf) /* error: couldn't allocate memory */;
    return buf;      // caller must manually free() the return value at some point
}

int *return_static() {
    static int buf[100];   // static storage, e.g. in the BSS, same as global scope
    return buf;            // return the same pointer to the same storage every call
}

A: main:
  push rbp                    ; save the base pointer to the stack.
  mov  rbp, rsp               ; put the previous stack pointer into the base pointer.
  mov  QWORD PTR [rbp-32], 0  ; Write 0 (NULL) to v.a
  mov  QWORD PTR [rbp-24], 0  ; Write 0 (NULL) to v.b
  mov  DWORD PTR [rbp-16], 3  ; Write 3 to v.x
  mov  DWORD PTR [rbp-12], 5  ; Write 5 to v.y
  mov  QWORD PTR [rbp-64], 0  ; Write 0 (NULL) m.a
  mov  QWORD PTR [rbp-56], 0  ; Write 0 (NULL) to m.b
  mov  DWORD PTR [rbp-48], 7  ; Write 7 to m.x
  mov  DWORD PTR [rbp-44], 9  ; Write 9 to m.y
  mov  QWORD PTR [rbp-96], 0  ; Write 0 (NULL) to s.a
  mov  QWORD PTR [rbp-88], 0  ; Write 0 (NULL) to s.b
  mov  QWORD PTR [rbp-80], 0  ; Write 0 to s.x
  mov  DWORD PTR [rbp-80], 11 ; Write 11 to s.x
  mov  DWORD PTR [rbp-76], 12 ; Write 11 to s.y
  lea  rax, [rbp-32]          ; Load effective address of v.a into rax
  mov  QWORD PTR [rbp-96], rax ; Write address of v.a into s.a
  lea  rax, [rbp-96]          ; Load effective address of s.a into rax
  mov  QWORD PTR [rbp-88], rax ; Write address of m.a into s.b
  mov  eax, 0
  pop  rbp
  ret

In a function (typically), parameters and local variables are organized into a stack frame (along with the address of the previous frame and the address of the next instruction) and are referenced via an offset from a base ( or frame) pointer.  rbp stores the address of the stack frame, and you reference objects by offsetting from that address.  Why not just offset from the stack pointer (rsp)?  Depending on what you do in the function, the stack pointer can change (not so much in compiled code, more in hand-hacked assembly).  The base or frame pointer gives you a stable, unchanging reference point for doing the offsets. So what
mov QWORD PTR [rbp-32], 0

means is "Write the value of the immediate operand 0, expanded to a QWORD (8 bytes), to the address computed from rbp-32".  If rbp is 0xdeadbeef, then that means zero out the 8 bytes starting at 0xdeadbeef - 0x20, or 0xdeadbecf.
There is some weirdness in the generated code - not sure why it's zeroing out s.x before writing 11 to it.  Also not sure why it's bothering to zero out s.a and s.b before copying the addresses of m and s (the address of a struct object and the address of its first member are always the same).  Turning on optimization may fix that.
This is how one compiler does it.  Different compilers may do something different - for example, this is output from gcc (LLVM) on a Mac:
        .section        __TEXT,__text,regular,pure_instructions
        .build_version macos, 10, 14    sdk_version 10, 14
        .globl  _main                   ## -- Begin function main
        .p2align        4, 0x90
_main:                                  ## @main
        .cfi_startproc
## %bb.0:
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset %rbp, -16
        movq    %rsp, %rbp
        .cfi_def_cfa_register %rbp
        xorl    %eax, %eax
        movl    $0, -4(%rbp)
        movq    l___const.main.v(%rip), %rcx
        movq    %rcx, -32(%rbp)
        movq    l___const.main.v+8(%rip), %rcx
        movq    %rcx, -24(%rbp)
        movq    l___const.main.v+16(%rip), %rcx
        movq    %rcx, -16(%rbp)
        movq    l___const.main.s(%rip), %rcx
        movq    %rcx, -56(%rbp)
        movq    l___const.main.s+8(%rip), %rcx
        movq    %rcx, -48(%rbp)
        movq    l___const.main.s+16(%rip), %rcx
        movq    %rcx, -40(%rbp)
        leaq    -32(%rbp), %rcx
        movq    %rcx, -80(%rbp)
        leaq    -56(%rbp), %rcx
        movq    %rcx, -72(%rbp)
        movl    $11, -64(%rbp)
        movl    $12, -60(%rbp)
        popq    %rbp
        retq
        .cfi_endproc
                                        ## -- End function
        .section        __TEXT,__const
        .p2align        3               ## @__const.main.v
l___const.main.v:
        .quad   0
        .quad   0
        .long   3                       ## 0x3
        .long   5                       ## 0x5

        .p2align        3               ## @__const.main.s
l___const.main.s:
        .quad   0
        .quad   0
        .long   7                       ## 0x7
        .long   9                       ## 0x9

.subsections_via_symbols

Different syntax, different approach, same end result.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is the set $\{0,1\}$ opened or closed? I think it is neither open nor closed because it contains none of boundary points and interior point.
I'm not sure if its correct, help please!

A: Assume the metric topology on $\mathbb{R}$.
For a set to be
open, it must contain an open ball around each of its points. This
set does not, so it's definitely not open. Now, consider the complement,
$$
\left\{ 0,1\right\} ^{c}=\mathbb{R}\setminus\left\{ 0,1\right\} =\left(-\infty,0\right)\cup\left(0,1\right)\cup\left(1,\infty\right).
$$
Note that each of those sets is open, the union of open sets is (by
definition) open. So the original set is closed.

A: $\{0,1\}$ is closed in $\Bbb R,$ since its complement is $(-\infty,0)\cup(0,1)\cup(1,\infty),$ which is a union of open sets, and so open. Alternately, you can prove that it's closed because it's finite, so has no limit/accumulation points, and so vacuously contains all of its limit/accumulation points.
To show that there is no continuous function $f:\Bbb R^n\to\Bbb R$ having range $\{0,1\},$ though, you could make use of a property called connectedness, by noting that $\Bbb R^n$ is connected, while $\{0,1\}$ is not, and then using the fact that continuous images of connected sets are connected.
Alternatively, if you're unfamiliar with connectedness, note that $\{0\}$ is both relatively closed and relatively open in $\{0,1\}$--relatively closed because it is closed in $\Bbb R$, and relatively open because $(-\frac12,\frac12)\cap\{0,1\}=\{0\}$. Thus, the preimage of $\{0\}$ under any continuous function $\Bbb R^n\to\{0,1\}$ will be both open and closed in $\Bbb R^n.$ Which subsets of $\Bbb R^n$ are both open and closed? Given the answer to that question, can a continuous function $\Bbb R^n\to\{0,1\}$ be surjective?

A: $\{0, 1\}$ as a two-point-set is closed in most topological spaces (like $\mathbb R, \mathbb N$, both with their standard topology) and can be open, for example in discrete topological superspaces of $\{0,1\}$ like $\mathbb N$.


text:
Q: How to add noise to audiosegment using pydub? I am very new to signal processing so apologies for the simplicity! I would like to use pydub to add noise to a sound clip. I know pydub has several generator functions for noise and an overlay audio one. Is overlaying the generated noise segment over the sound clip equivalent to
sound = some signal (possibly raw data?)
noise = np.random.normal(0,1,100)
result = sound + noise ?

A: You'll need to overlay the noise — something like:
from pydub import AudioSegment
from pydub.generators import WhiteNoise

sound = AudioSegment.from_file(...)
noise = WhiteNoise().to_audio_segment(duration=len(sound))

combined = sound.overlay(noise)


text:
Q: search for regex match between two files using python I´m working with two text files that look like this:
File 1
#   See ftp://ftp.ncbi.nlm.nih.gov/genomes/README_assembly_summary.txt for a description of the columns in this file.
# assembly_accession    bioproject  biosample   wgs_master  refseq_category taxid   species_taxid   organism_name   infraspecific_name  isolate version_status  assembly_level  release_type    genome_rep  seq_rel_date    asm_name    submitter   gbrs_paired_asm paired_asm_comp ftp_path    excluded_from_refseq    relation_to_type_material   asm_not_live_date
GCF_000739415.1 PRJNA224116 SAMN02732406        na  837 837 Porphyromonas gingivalis    strain=HG66     latest  Chromosome  Major   Full    2014/08/14  ASM73941v1  University of Louisville    GCA_000739415.1 identical   https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/739/415/GCF_000739415.1_ASM73941v1         na
GCF_001263815.1 PRJNA224116 SAMN03366764        na  837 837 Porphyromonas gingivalis    strain=A7436        latest  Complete Genome Major   Full    2015/08/11  ASM126381v1 University of Florida   GCA_001263815.1 identical   https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/001/263/815/GCF_001263815.1_ASM126381v1            na
GCF_001297745.1 PRJNA224116 SAMD00040429    BCBV00000000.1  na  837 837 Porphyromonas gingivalis    strain=Ando     latest  Scaffold    Major   Full    2015/09/17  ASM129774v1 Lab. of Plant Genomics and Genetics, Department of Plant Genome Research, Kazusa DNA Research Institute GCA_001297745.1 identical   https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/001/297/745/GCF_001297745.1_ASM129774v1            an
...

File 2:
#   See ftp://ftp.ncbi.nlm.nih.gov/genomes/README_assembly_summary.txt for a description of the columns in this file.
# assembly_accession    bioproject  biosample   wgs_master  refseq_category taxid   species_taxid   organism_name   infraspecific_name  isolate version_status  assembly_level  release_type    genome_rep  seq_rel_date    asm_name    submitter   gbrs_paired_asm paired_asm_comp ftp_path    excluded_from_refseq    relation_to_type_material   asm_not_live_date
GCA_000739415.1 PRJNA245225 SAMN02732406        na  837 837 Porphyromonas gingivalis    strain=HG66     latest  Chromosome  Major   Full    2014/08/14  ASM73941v1  University of Louisville    GCF_000739415.1 identical   https://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/739/415/GCA_000739415.1_ASM73941v1         na
GCA_001263815.1 PRJNA276132 SAMN03366764        na  837 837 Porphyromonas gingivalis    strain=A7436        latest  Complete Genome Major   Full    2015/08/11  ASM126381v1 University of Florida   GCF_001263815.1 identical   https://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/001/263/815/GCA_001263815.1_ASM126381v1            na

So, I want to search for a specific pattern using regex.
For example, file 1 has this pattern:
GCF_000739415.1

and file 2 this one:
GCA_000739415.1

The difference is the third character: F versus A. However, sometimes numbers differ.
Difference between files is the third row of data.
These two files have a lot of patterns like the previous one, however, there are some differences. My goal is to search for the pattern that only exists in one file and not in the other file.
For example, "GCF_001297745.1 in the third row in the file 1 but not in the file 2. This should be a GCA_001297745.1"
I´m working on a python code:
# PART 1: Open and read text file
with open("assembly_summary_genbank.txt", 'r') as f_1:
    contents_1 = f_1.readlines()
with open("assembly_summary_refseq.txt", 'r') as f_2:
    contents_2 = f_2.readlines()

# PART 2: Search for IDs
matches_1 = re.findall("GCF_[0-9]*\.[0-9]", str(contents_1))
matches_2 = re.findall("GCA_[0-9]*\.[0-9]", str(contents_2))

# PART 3: Match between files
# Seudocode
for line in matches_1:
    if matches_1 == matches_2:
        print("PATTERN THAT ONLY EXIST IN ONE FILE")

Part 3 refers to doing a for loop that searches for each line in both files and prints the patterns that only exist in one file and not in the other one.
Any idea for doing this for loop?

A: Perhaps you are after this?
import re

given_example = "GCA_000739415.1 PRJNA245225 SAMN02732406        na  837 837 Porphyromonas gingivalis    strain=HG66     latest  Chromosome  Major   Full    2014/08/14  ASM73941v1  University of Louisville    GCF_000739415.1 identical   https://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/739/415/GCA_000739415.1_ASM73941v1         an"
altered_example = "GCA_000739415.1 GCTEST_000739415.1"

# GX[A or F]_[number; digit >= 1].[number; digit >= 1]
regex = r"GC[AF]_\d+.\d+"

matches_1 = re.findall(regex, given_example)
matches_2 = re.findall(regex, altered_example)

# Iteration for intersection
for match in matches_1:
    if match in matches_2:
        print(f"{match} is in both files")

Prints
GCA_000739415.1 is in both files
GCA_000739415.1 is in both files

But I would recommend:
# The preferred method for intersection, where order is not important
matches = list(set(matches_1) & set(matches_2))

Which saves as:
['GCA_000739415.1']

Note the regex matches in a form of GX[A or F]_[number; digit >= 1].[number; digit >= 1]. Let me know if this is not what you are after

Regex demo here

Edit
I believe you are after the symmetric difference of sets for files 1 and 2. Which is a fancy way of saying "things in A & B, that are not in both"
Which can be done with literation:
# Iteration
# A set has no duplicates, and is unordered
sym_dif = set()
for match in matches_1:
    if match not in matches_2:
        sym_dif.add(match)

>>> list(sym_dif)
['GCF_001297745.1', 'GCA_001297745.1']

I think your mistake was not using a set, you should't have any duplicates, and using matches_1 == matches_2. The lists won't be the same. You should check if it is not in the other set.
Or using this set notation which is the preferred method:
>>> list(set(matches_1).symmetric_difference(set(matches_2)))
['GCF_001297745.1', 'GCA_001297745.1']

A: As I am looking at these files, it is a data frame from the txt file link you shared.
ftp://ftp.ncbi.nlm.nih.gov/genomes/README_assembly_summary.txt

The assembly_summary.txt files have 22 tab-delimited columns.
Header rows begin with '#".

A better approach would start would be to open the files as tab-separated pandas data frames and apply a function to split and replace all the F with A, and then merge the two files or simply use the is in command to get the indices of the common elements. Here is the code:

Notebook with rationale and algorithm, with comments -

https://colab.research.google.com/drive/1jJYnDpMVCt1spRsUek7RqlMnC_2O92sq?usp=sharing
import pandas as pd
url1="https://ftp.ncbi.nlm.nih.gov/genomes/genbank/assembly_summary_genbank.txt"
url2 = "https://ftp.ncbi.nlm.nih.gov/genomes/refseq/assembly_summary_refseq.txt"
df1=pd.read_csv(url1,sep='\t',low_memory=False)
df2=pd.read_csv(url2,sep='\t',low_memory=False)
def replaceFs(string_test):
  list_words = list(string_test)
  list_words[2]='A'
  return_string = ''.join(list_words)
  return return_string
def table_reform(unformed_df):
  unformed_df = unformed_df.reset_index()
  unformed_df = unformed_df.rename(columns=unformed_df.iloc[0])
  reformed_df = unformed_df[1:]
  return reformed_df
df1 = table_reform(df1)
df2 = table_reform(df2)
df2['# assembly_accession'] = df2['# assembly_accession'].apply(replaceFs)
df_combine = pd.merge(df1,df2,on=['# assembly_accession'],how='inner')
df_combine

Which shows a huge data frame 254000 rows × 45 columns

<script src="https://gist.github.com/paritoshk/7eed427943399237c14b911adfee4428.js"></script>

Hope this helps! My personal view from the CS angle is that double loops with Regex are much slower on such large datasets vs Pandas algorithms.


text:
Q: Tcp/IP Socket Exception I have Sever-Client application which used to send and receive sms, Which working fine till last month.But after that I got TCP/Ip socket exception. I debug server application and found exception:
System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
       at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
       at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
I got same exception on client when I debug more.
I gone through many threads similar to this, People suggest this is network related issue as Firewall/NAT/Antivirus blocking port, due to this connection between client & server get disturb.
I used 2999 port,and multiple clients communicating with server on same port.
Any clues? what is exact cause?

A: Does this happen all the time now or just sometimes? if it just happens every now and again what i would do is put it in a try catch statment and when this error is thrown reconnect and try again and log that it happend and when, also everything that was going on when it was thrown that way you can go back and figure out what the problem is when you get more info on when its being thrown. if its happening all the time then somthing is forcing your connection to close witch could be a firewall so for testing i would turn off all your firewalls and antiviruses.


text:
Q: Discord Bot Escribir mensaje a una hora especifica Básicamente llevo 2 semanas rompiéndome la cabeza de como podría hacer que mi Bot de Discord envié un mensaje a una hora especifica...
He probado con CRON y de momento no se como usarlo bien para sacarle provecho.

function maintenance1(){
  switch (day) {
    case 1:
      msg.channel.send("Luni este maintenance la ora 3:30 am.")
      break;
    case 2:
      msg.channel.send("Marti nu este maintenance.")
      break;
    case 3:
      msg.channel.send("Miercuri este maintenance la ora 3:30 am.")
      break;
    case 4:
      msg.channel.send("Joi nu este maintenance.")
      break;
    case 5:
      msg.channel.send("Vineri este maintenance la ora 2:00 am.")
      break;
    case 6:
      msg.channel.send("Sambata este maintenance la ora 2:00 am.")
      break;
    case 7:
      msg.channel.send("Duminica nu este maintenance.")
      break;
    default:
  }

}

Esto es una  función en la que me devuelve el dia de hoy.

function getToday() {
    let today = new Date();
    let months = [`January`, `February`, `March`, `April`, `May`, `June`, `July`, `August`, `September`, `October`, `November`, `December`];
    let suffix = [`st`, `nd`, `rd`];
    return `${today.getDate()}${suffix[today.getDate()] || `th`} of ${months[today.getMonth()]}`;
}

Esto es otra función en la que me devuelve la hora y fecha de hoy.
Pero no se como usar esto para compararlo con una hora especifica.

  function mueveReloj(){
      momentoActual = new Date()
      hora = momentoActual.getHours()
      minuto = momentoActual.getMinutes()
      segundo = momentoActual.getSeconds()

      str_segundo = new String (segundo)
      if (str_segundo.length == 1)
         segundo = "0" + segundo

      str_minuto = new String (minuto)
      if (str_minuto.length == 1)
         minuto = "0" + minuto

      str_hora = new String (hora)
      if (str_hora.length == 1)
         hora = "0" + hora

      horaImprimible = hora + " : " + minuto + " : " + segundo

      document.form_reloj.reloj.value = horaImprimible

      setTimeout("mueveReloj()",1000)
  }

A mi me interesaria algo asi.. pero al ponerlo mi bot se crashea..
Estaba intentando sacar la hora local del equipo o servidor donde esta hosteado mi bot y compararla con una hora especifica ej = 12:00
Si la hora local coincide con las 12:00
quiero un mensaje en el canal.
   function hora(){
        var hora = get.hour();
        return hora;
   }

   function dia(){
        var dia= get.day();
        return dia;
   }

   if (hora() === '12:00' && dia() === 'lunes') {
       message.channel.send(' Dentro de una hora hay mantenimiento')}

Algo asi:

A: La documentación de node-cron es bastante clara con su ejemplo:
const CronJob = require('cron').CronJob;
const cronExpr = '0 0 2 * * *';
let job = new CronJob(cronExpr, function() {
  console.log('Mensaje mandado cada día a las 2am');
}, 'Europe/Madrid');
job.start();

A: cron.schedule("1 1 21 * * 4", function() {
    console.log("maintenance");
    client.channels.find(c => c.name === 'announcement')
        .send('Mentenanta la ora 3:30.');
});


text:
Q: How to combine two codes into one function? My code creates arrays, I need to implement deletions for it, but I don't know how to do it beautifully and correctly.
main code
template<class T1>
auto auto_vector(T1&& _Size) {
    return new int64_t[_Size]{};
}
template <class T1, class... T2>
auto auto_vector(T1&& _Size, T2&&... _Last)
{
    auto result = new decltype(auto_vector(_Last...))[_Size];
    for (int64_t i = 0; i < _Size; ++i) {
        result[i] = auto_vector(_Last...);
    }
    return result;
}

this is the code that I want to combine with the first
template <class T1, class T2, class T3, class T4>
void del_vector(T4& _Del, T1& _Size, T2& _Size2, T3& _Size3) {
    for (ptrdiff_t i = 0; i < _Size3; ++i) {
        for (ptrdiff_t k = 0; k < _Size2; ++k) {
            delete _Del[i][k];
        }
        delete _Del[i];
    }
    delete _Del;
}
int main()
{
    auto map1 = auto_vector(_Size, _Size2, _Size3);

    auto map2 = auto_vector(3, 4, 5, 7);

    del_vector(map1, _Size, _Size2, _Size3);

    return 0;
}

I do not like this option I would like something like that.
int main()
{
    auto_vector map1(_Size, _Size2, _Size3);

    del_vector map1(_Size, _Size2, _Size3);

    //or so

    auto_vector<_Size, _Size2, _Size3> map1;

    del_vector<_Size, _Size2, _Size3> map1;

    return 0;
}

the reason why I do this is because I cannot implement the same thing using just a vector
and I don't understand why the vector does not work with dynamic arrays, the fact is that I do not know the exact data
_Size, _Size2, _Size3 = ? before compilation.
therefore I use new and all this I do only for his sake.
if it is useful to you to look at the data for tests
cout << " ---------TEST---------- " << endl;
    for (ptrdiff_t i = 0; i < _Size3; ++i) {
        for (ptrdiff_t k = 0; k < _Size2; ++k) {
            for (ptrdiff_t j = 0; j < _Size; ++j) {
                cout << map1[i][k][j] << " ";
            }
            cout << endl;
        }
        cout << endl;
    }
    cout << " ---------TEST---------- " << endl;

A: You have too many new operations in the code. Also del_vector doesn't make any sense in your preferred version as any decent class will deallocate its data in the destructor (lest it has no ownership over it).
What you need is to make a class or a template class that wraps things up.
#include <iostream>
#include <vector>
#include <array>
#include <type_traits>

using namespace std;

template<size_t index, size_t dim>
void ModifyArray(std::array<size_t,dim>& lcAarray){}

template<size_t index, size_t dim, typename... Args>
void ModifyArray(std::array<size_t, dim>& lcAarray, size_t arg, Args... args)
{
    lcAarray[index] = arg;
    ModifyArray<index+1>(lcAarray, args...);
}

template<typename... Args>
std::array<size_t, sizeof...(Args)> MakeArray(Args... args)
{
    std::array<size_t, sizeof...(Args)> lclArray;
    ModifyArray<0>(lclArray, args...);
    return lclArray;
}

template< std::size_t dim >
class myMultiArray;

template<std::size_t dim, std::size_t crDim>
class MyMultiArrayIterator
{
    public:
    MyMultiArrayIterator(myMultiArray<dim>* multiArray, size_t index):
        m_pMultiArray(multiArray),
        m_index(index)
    {}

    template<size_t newDim = crDim+1,  typename std::enable_if<newDim < dim, int>::type = 0>
    MyMultiArrayIterator<dim, newDim> operator [] (size_t idx)
    {
        return MyMultiArrayIterator<dim, newDim>(m_pMultiArray, m_index + idx*m_pMultiArray->GetStep(crDim));
    }

    template<size_t newDim = crDim+1,  typename std::enable_if<newDim == dim, int>::type = 0>
    int& operator [] (size_t idx)
    {
        return m_pMultiArray->GetValue(m_index+idx*m_pMultiArray->GetStep(crDim));
    }

    private:
    size_t              m_index;
    myMultiArray<dim>*  m_pMultiArray;
};

template< std::size_t dim >
class myMultiArray
{
public:
    myMultiArray() = default;

    template<class... Args, typename std::enable_if<sizeof...(Args) == dim-1, int>::type = 0>
    myMultiArray(size_t size0, Args... args)
    {
        m_sizes = MakeArray(size0, args...);

        std::size_t uTotalSize = 1;
        for (std::size_t i = 0; i < dim; i++)
        {
            m_steps[i] = uTotalSize;
            uTotalSize *= m_sizes[i];
        }
        std::cout  << uTotalSize << "\n";
        m_data.resize(uTotalSize);
     }
     // resizes m_data to multiplication of sizes
     int operator  () (std::array < std::size_t, dim > indexes) const
     {
        return m_data[computeIndex(indexes)];
     }
     int &operator  () (std::array < std::size_t, dim > indexes)
     {
        return m_data[computeIndex(indexes)];
     }
     // modify operator
     // you'll probably need more utility functions for such a multi dimensional array

     int GetValue(size_t index) const
     {
        return m_data[index];
     }

     int &GetValue(size_t index)
     {
        return m_data[index];
     }

     size_t GetSize(size_t index) const
     {
         return m_sizes[index];
     }

     size_t GetStep(size_t index) const
     {
         return m_steps[index];
     }

     MyMultiArrayIterator<dim, 1> operator [] (size_t index)
     {
         return  MyMultiArrayIterator<dim, 1>(this, index*m_steps[0]);
     }

private:
     size_t computeIndex(std::array < std::size_t, dim > indexes)
     {
       size_t location = 0;
       for(size_t i=0; i< dim; i++)
       {
           location += m_steps[i]*indexes[i];
       }
       return location;
    }

private:
    std::vector < int >             m_data;
    std::array < std::size_t, dim > m_sizes;
    std::array < std::size_t, dim > m_steps;
};

template<typename... Args>
myMultiArray<sizeof...(Args)> MakeMyMultiArray(Args... args)
{
    return myMultiArray<sizeof...(Args)>(args...);
}

int main ()
{
    auto mapMA = MakeMyMultiArray(3,4,5);

    mapMA({2ull,3ull,4ull}) = 7;
    std::cout << mapMA({{2ull,3ull,4ull}})  << "\n";
    std::cout << mapMA[2][3][4];
  return 0;
}


text:
Q: Generic constructor reference and static method in TypeScript Please, consider the following code:
class Wrapper<T> {

    public static forConstructor<S extends Object>(construc: { new (...args: any[]): S }): Wrapper<S> {
        return new Wrapper<S>();
    }
}

class A {
    private aaa: string = null;
}

class B {
    private bbb: string = null;
}

const wrapper: Wrapper<A> = Wrapper.forConstructor(B);// LINE X

At LINE X Wrapper<A> = Wrapper<B> that is an wrong, however, TypeScript doesn't show error at this line. What is my mistake?

A: Currently Wrapper<A> and Wrapper<B> are structurally compatible. If you'll store the passed constructor as a field (for example) you'll get an error:
type Constructor<T> = new (...args: any[]) => T;

class Wrapper<T> {
    constructor(private c: Constructor<T>){}

    public static forConstructor<T>(construc: Constructor<T>): Wrapper<T> {
        return new Wrapper<T>(construc);
    }
}

class A {
    private aaa: string = null;
}

class B {
    private bbb: string = null;
}

const wrapper: Wrapper<A> = Wrapper.forConstructor(B); // error

Playground

A: A static method can not use the instance type argument Wrapper<T> since static is not instance bounded. Your method signature <S extends Object essentially means any Object. So there is no type safety at all. That's why the tscompiler does not complain at
const wrapper: Wrapper<A> = Wrapper.forConstructor(B);// LINE X

However if you actually use the instance type argument and make it non-static then it will complain e.g.
class Wrapper<S> {

    public forConstructor(construc: { new (...args: any[]): S }): Wrapper<S> {
        return new Wrapper<S>();
    }
}

const wrapper: Wrapper<A> = new Wrapper();
wrapper.forConstructor(B); // will not work


text:
Q: Vuejs transition css only slide down I've been searching for a long time for a solution to this problem, but I can't seem to find the best solution for this problem. Basically I have an accordion which when a user open's it, it should slide down gently with a nice transition.
I'm pretty sure this is possible with only css. Please correct me if I'm wrong, but css transitions are performance wise better than js transitions.
So now the the HTML for the problem I'm facing:
<transition name="slide-down">

      element

</transition>

And the css is:
.slide-down-enter-active, .slide-down-leave-active {
  transition: all .5s;
}

.slide-down-enter-to, .slide-down-leave {
  overflow: hidden;
  max-height: 100%;
}

.slide-down-enter, .slide-down-leave-to {
  overflow: hidden;
  max-height: 0;
}

This results in a not fluent transition. Sliding down doesn't seem to be a problem, but when it slides up it's really janky and not fluent at all!. If I set the max-height: 10rem it isn't making it any better. I'm hoping someone can debug help me with this problem and maybe educate me more about vue transitions and js vs css transitions.
Edit:
Just for clarification the transition itself should by css only. The opening of the accordion is with js which is fine. Also it would be nice to maybe see an example of a transition use with the native vue-transition component.
Edit 2:
Here is a codesandbox which has the same problem I have.
https://codesandbox.io/s/frosty-bash-lmc2f?file=/src/components/HelloWorld.vue

A: Another Update!!!
In order to achieve JS transition you can take a look at official document to learn. Anyways, I am not going to implement fancy timing mechanism, but in simplest form, JS collapse transition in react will look something like following, I included it in existing codesandbox:
<template>
...

    <button @click="jsOpen = !jsOpen">Open JS list</button>
    <transition
      v-on:before-enter="beforeEnter"
      v-on:enter="enter"
      v-on:after-enter="afterEnter"
      v-on:enter-cancelled="enterCancelled"
      v-on:before-leave="beforeLeave"
      v-on:leave="leave"
      v-on:after-leave="afterLeave"
      v-on:level-cancelled="leaveCancelled"
      v-bind:css="false"
    >

item-{{ i }}

    </transition>

</template>

Update:
After understanding requirements from OP, I was trying to play with different things and I stumbled upon this article on css-tricks which explains in much more details about transition, from that article another non-js solution proposed would look like following, I included it in existing stackblitz:
.scale-enter-active,
.scale-leave-active {
  transform-origin: top;
  transition: transform 0.3s ease-in-out;
}

.scale-enter-to,
.scale-leave-from {
  transform: scaleY(1);
}

.scale-enter-from,
.scale-leave-to {
  transform: scaleY(0);
}

here instead of height, it is scaling against y-axis. IT also has a side effect that it expands container to full size first and than updates (scales) content afterwards.
Vue v3.x
-leave and -enter classes in V3 are renamed to -leave-from and -enter-from. Take a look at this stackblitz.
.slidedown-enter-active,
.slidedown-leave-active {
  transition: max-height 0.5s ease-in-out;
}

.slidedown-enter-to,
.slidedown-leave-from {
  overflow: hidden;
  max-height: 1000px;
}

.slidedown-enter-from,
.slidedown-leave-to {
  overflow: hidden;
  max-height: 0;
}

Vue v2.x
Problem is you are specifying max-height to 100%, use some value which will be greater than your expected max-height. Update your style to:
.slide-down-enter-active,
.slide-down-leave-active {
  transition: max-height 0.5s ease-in-out;
}

.slide-down-enter-to,
.slide-down-leave {
  overflow: hidden;
  max-height: 1000px;
}

.slide-down-enter,
.slide-down-leave-to {
  overflow: hidden;
  max-height: 0;
}

and it should work. Take a look at this codesandbox demo.


text:
Q: Trying to figure out how to use decorator_from_middleware functionality As the title states I want to use the 'decorator_from_middleware' function from here: https://docs.djangoproject.com/en/2.1/_modules/django/utils/decorators/
However I'm just confued on how to properly use it. I have my custom middleware class and all the normal middleware stuff set up. How would I incorperate this function to be able to use my middleware as a per view basis with the help of a decorator?
Example:
Let's say I have some middleware class
class SimpleMiddleware:
    def __init__(self, get_response):
        self.get_response = get_response
        # One-time configuration and initialization.

    def __call__(self, request):
        # Code to be executed for each request before
        # the view (and later middleware) are called.

        response = self.get_response(request)

        # Code to be executed for each request/response after
        # the view is called.

        return response

How would I use decorator_from_middleware(middleware_class): and apply it to a particular view?

A: Notice: Your middleware may not work, as documentation asserts that it needs to be compliant with old-style middleware methods. Check it out.
Assuming that this code is your views module:
from django.http import HttpResponse
from django.utils.decorators import decorator_from_middleware
from myapp.middleware import SimpleMiddleware

simple_decorator = decorator_from_middleware(SimpleMiddleware)

@simple_decorator
def some_view(request):
    return HttpResponse("Hello World")

If you want to apply this to class based views, you need will need to decorate dispatch method. You may even write a mixin as such:
class SimpleMiddlewareMixin:
    @simple_decorator
    def dispatch(*args, **kwargs):
        return super().dispatch(*args, **kwargs)

class MyClassBasedView(SimpleMiddlewareMixin, ListView):
    ...


text:
Q: Set up Server Side Rendering for react js but it is not working while deploying to the firebase I was having a problem with SEO in my react app so I did Server-side rendering. At first, I changed '.render' to '.hydrate' in src/index.js. I created a server folder in it server.js and index.js. But it's still showing only the script tag with 'root' in the source code in the browser after deploying to firebase.
src/index.js
import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import App from "./App";
import "bootstrap/dist/css/bootstrap.css";

import { hydrateRoot } from "react-dom/client";
const container = document.getElementById("root");
const root = hydrateRoot(container, <App />);
root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

server.js
import path from "path";
import fs from "fs";
import express from "express";
import React from "react";
import ReactDOMServer from "react-dom/server";
import App from "../src/App";

const PORT = 3000;
const app = express();

const router = express.Router();

const serverRenderer = (req, res, next) => {
  fs.readFile(path.resolve("./build/index.html"), "utf8", (err, data) => {
    if (err) {
      console.error(err);
      return res.status(500).send("An error occurred");
    }
    return res.send(
      data.replace(
        '

',
        `<div id="root">${ReactDOMServer.renderToString(<App />)}</div>`
      )
    );
  });
};
router.use("^/$", serverRenderer);

router.use(
  express.static(path.resolve(__dirname, "..", "build"), { maxAge: "30d" })
);

// tell the app to use the above rules
app.use(router);

// app.use(express.static('./build'))
app.listen(PORT, () => {
  console.log(`SSR running on port ${PORT}`);
});

index.js
require("ignore-styles");

require("@babel/register")({
  ignore: [/(node_modules)/],
  presets: ["@babel/preset-env", "@babel/preset-react"],
});

require("./server");

It is working when I'm running 'node server/server.js' in the terminal but when I'm running 'npm start' it's not working or when I'm deploying it to firebase with 'firebase deploy' after 'npm run build'.
Thank you.


text:
Q: Do Feynman path integrals satisfy Bell locality assumption? There are generally two basic ways to solve physics models:

*

*Directional, e.g. Euler-Lagrange equation in CM, Schrödinger equation in QM. We evolve some initial conditions in some direction, can imagine boundary conditions are e.g. in $t_0 = -\infty$.

*Symmetric, e.g. the least action principle in CM, Feynman path integrals in QM, or of Feynman diagrams in QFT. Like choosing shape of a membrane, statistics inside Ising sequence - with symmetric boundary conditions, we can imagine they are e.g. in $t_0 = -\infty$ and $t_1=+\infty$ (measurement is between boundary conditions).

Having a solution found with 1. or 2., we can transform it into the second, but generally solutions originally found using 1. or 2. seem to have a bit different properties - for example regarding "hidden variables" in Bell theorem.
Transforming solution found in a symmetric way 2) to directional perspective 1), its state was originally chosen also accordingly to all future measurements - like in superdeterminism.
The directional ones (1.) like Schrödinger equation usually satisfy assumptions used to derive Bell inequality, which is violated by physics - what is seen as contradiction of local realistic "hidden variables" models. Does it also concern the symmetric ones (2.)?
We successfully use classical field theories like electromagnetism or general relativity, which assume existence of objective state of their field - how does this field differ from local realistic "hidden variables"?
Wanting to resolve this issue, there are e.g. trials to undermine the locality assumption by proposing faster-than-light communication, but these classical field theories don't allow for that.
So I would like to ask about another way to dissatisfy Bell's locality assumption: there is general belief that physics is CPT-symmetric, so maybe it solves its equations in symmetric ways (2.) like through Feynman path integrals?
Good intuitions for solving in symmetric way provides Ising model, where asking about probability distribution inside such Boltzmann sequence ensemble, we mathematically get $Pr(u) = (\psi_u)^2$ where one amplitude comes from left, second from right, such Born rule allows for Bell-violation construction. Instead of single "hidden variable", due to symmetry we have two: from both directions.
From perspective of e.g. general relativity, we usually solve it through Einstein's equation, which is symmetric - spacetime is kind of "4D jello" there, satisfying this this local condition for intrinsic curvature. It seems tough (?) to solve it in directional way like through Euler-Lagrange, what would require to "unroll" spacetime.
Assuming physics solves its equations in symmetric way, e.g. QM with Feynman path integrals instead of Schrödinger equation, do Bell's assumptions hold - are local realistic "hidden variables" still disproven?

Update: Born-like formulas from symmetry in Ising model (Boltzmann sequence ensemble): $Pr(i)=(\psi_i)^2$ where one amplitude ("hidden variable") comes from left, second from right:

A: I'm answering the question you asked at the end:
Assuming physics solves its equations in symmetric way, e.g. QM with Feynman path integrals instead of Schrödinger equation, do Bell's assumptions hold - are local realistic "hidden variables" still disproven?
The short answer is "Yes." Solving QM with path integrals is equivalent to using Schrödinger's equation,  so the details of Bell's inequalities are irrelevant. Whether you use path integrals or Schrödinger's equation you will get the exact same results.
There are two sides to Bell's inequalities. On one side there is a quantum mechanical calculation and on the other side there is a calculation using an unspecified local hidden variable theory.
If you do look at the details of the quantum side of Bell's inequalities, you will notice that its derivation only depends on the initial entangled state and calculations of correlations.  Neither path integrals nor Schrödinger's equation are being used.

A: Assuming physics solves its equations in symmetric way, e.g. QM with Feynman path integrals instead of Schrödinger equation, do Bell's assumptions hold - are local realistic "hidden variables" still disproven?
Yes. To check this for spins, you can take a spin to a point $\hat{n}$ in the group manifold $SU(2)$. Then take wave function to be defined by the path integral over paths $\mathcal{C}_{\hat n(t)}\equiv \mathcal{C}(\hat{n}_0(t_0)|\hat{n}(t))$ where the system is a point $\hat{n}_0$ at time $t_0$ and at point $\hat{n}$ at time $t$.
$$\psi(\hat{n},t)\equiv\int\!d\mathcal{C}_{\hat n(t)} \exp\left(- \int_{\mathcal{C}_{\hat n(t)}}\hat{n}\cdot d\hat{n}\right). $$
The statistics of the the wavefunction $\psi$ are exactly those of quantum mechanics and will satisfy Bell's theorem at time $t$. This path integral is also exactly what you integrate over. Thus the path integral, on any time slice, contains Bell's theorem. In other words, Bell's theorem is a consquence of superpositions, which is exactly what you are constructing in the path integral.


text:
Q: How do I get a user from their discord tag in Discord JDA? Is there a way to find someone's id from their discord tag? Note: They are in a certain guild that I have the ID of if that helps.

A: Assuming you mean "Name#1234" with the discord tag:
Until this feature request has been implemented by discord you have to use a different approach. If you have all members cached you can simply use Guild#getMemberByTag. Otherwise you have to use Guild#retrieveMembersByPrefix and hope that there aren't more than 100 users with the same name:
String name = tag.substring(0, tag.lastIndexOf('#'));
guild.retrieveMembersByPrefix(name, 100).onSuccess(members -> {
  Member member = members.stream()
    .filter(m -> m.getUser().getAsTag().equals(tag))
    .findFirst()
    .orElse(null);
  if (member != null) {
    // use member here, it should be the member with that specific tag
  } else {
    // there are either more than 100 users with the same name or the member is not int he server
  }
});


text:
Q: Image uploaded from Mobile phone to Angular is sideways or upside down I am able to upload images from my desktop to an Angular based Web Application overlayed on SharePoint without issue, but if I upload from a Mobile phone, such as an iPhone, using the take "Take Photo or Video" or "Photo Library" function, it causes the image to be sideways when taken in portrait or upside down when taken in landscape. Here is my current upload function. Any clues/have others had the same issues uploading to Mobile Web Applications from iPhones/Mobile Phones to a SharePoint library?
Here is my upload function:
  // Upload of images
    $scope.upload = function () {
        //console.log($scope.files);
            if (document.getElementById("file").files.length === 0) {
                alert('No file was selected');
                return;
            }
            var parts = document.getElementById("file").value.split("\\");
            var uploadedfilename = parts[parts.length - 1];
            var basefilename = uploadedfilename.split(".")[0];
            var fileextension = uploadedfilename.split(".")[1];
            var currentdate = new Date();
            var formatteddate = $filter('date')(new Date(currentdate), 'MMddyy-hmmssa');
            var filename = basefilename + formatteddate + '.' + fileextension;
            var file = document.getElementById("file").files[0];
            uploadFileSync("/sites/asite", "Images", filename, file);
        }

        //Upload file synchronously
    function uploadFileSync(spWebUrl, library, filename, file)
    {
            console.log(filename);

            var reader = new FileReader();
            reader.onloadend = function(evt)
            {
                if (evt.target.readyState == FileReader.DONE)
                {
                    var buffer = evt.target.result;
                    var completeUrl = spWebUrl
                      + "/_api/web/lists/getByTitle('"+ library +"')"
                      + "/RootFolder/Files/add(url='"+ filename +"',overwrite='true')?"
                      + "@TargetLibrary='"+library+"'&@TargetFileName='"+ filename +"'";

                    $.ajax({
                        url: completeUrl,
                        type: "POST",
                        data: buffer,
                        async: false,
                        processData: false,
                        headers: {
                            "accept": "application/json;odata=verbose",
                            "X-RequestDigest": $("#__REQUESTDIGEST").val(),
                            "content-length": buffer.byteLength
                        },
                        complete: function (data) {
                            console.log(data);
                        },
                        error: function (err) {
                            alert('failed');
                        }
                    });

                }
            };
            reader.readAsArrayBuffer(file);
        }

The output of these is just pushed into an array for use in an Angular UI Carousel:
 // Control of Image Carousel
    $scope.myInterval = 0;

// Population of carousel
$scope.slides = [];

    appImages.query({
        $select: 'FileLeafRef,ID,Created,Title,UniqueId',
        $filter: 'ReportId eq ' + $routeParams.Id + ' and DisplayinReport eq 1',
    }, function (getimageinfo) {
        // Data is within an object of "value"
        var image = getimageinfo.value;

        // Iterate over item and get ID
        angular.forEach(image, function (imagevalue, imagekey) {

            $scope.slides.push({
                image: '/sites/asite/Images/' + imagevalue.FileLeafRef,
            });
        });
    });

The image carousel is on page as follows:

                <carousel interval="myInterval">
                    <slide ng-repeat="slide in slides" active="slide.active">

Slide {{$index}}

{{slide.text}}

                    </slide>
                </carousel>

IMPORTANT: The images are sideways and upside down upon upload to the SharePoint library, so irrespective of outputting them, they seem to be misoriented when they hit the destination library I am using as a source to display on page.
How do I upload the images so SharePoint respects the EXIF data/orientation?

A: It may be related to EXIF. See JS Client-Side Exif Orientation: Rotate and Mirror JPEG Images
If you want a better answer, we will need the code which show the image, and the code server side.
UPDATE : I'm not an expert at all on SharePoint, but you can found a lot about it in the SharePoint Stack Exchange. For example, https://sharepoint.stackexchange.com/questions/131552/sharepoint-rotating-pictures-in-library, should do the trick.
To sum up a little : in your case, their could be a lot of cases to study. So, I recommended you auto-correct the exif, and then permit to your user to correct it if the auto-correct was wrong. Their is a lot of tools to do that. If you want to do it server-side, look at the link above, and if you want to do it on the client side, you could use JS-Load-Image for example.


text:
Q: Pulse Doppler radar system simulation using MATLAB How to code this project in MATLAB
I'd tried coding this project (prob. 3-2, third paragraph) in MATLAB through this tutorial :
https://www.mathworks.com/help/phased/ug/doppler-shift-and-pulse-doppler-processing.html

I'd changed PRF to 100 and pulse width to 5e-4
, And made Velocity of target one dimensional:
    waveform = phased.RectangularWaveform('SampleRate',5e6,...
    'PulseWidth',5e-4,'OutputFormat','Pulses',...
    'NumPulses',1,'PRF',100);
    target = phased.RadarTarget('Model','Nonfluctuating',...
    'MeanRCS',1,'OperatingFrequency',1e9);
    targetpos = phased.Platform('InitialPosition',[1000; 0; 0],...
    'Velocity',[-100; 0; 0]);
    antenna = phased.IsotropicAntennaElement(...
    'FrequencyRange',[5e8 5e9]);
    transmitter = phased.Transmitter('PeakPower',5e3,'Gain',20,...
    'InUseOutputPort',true);
    transpos = phased.Platform('InitialPosition',[0;0;0],...
    'Velocity',[0;0;0]);
    radiator = phased.Radiator('OperatingFrequency',1e9,'Sensor',antenna);
    collector = phased.Collector('OperatingFrequency',1e9,'Sensor',antenna);
    channel = phased.FreeSpace('SampleRate',waveform.SampleRate,...
    'OperatingFrequency',1e9,'TwoWayPropagation',false);
    receiver = phased.ReceiverPreamp('Gain',0,'LossFactor',0,...
    'SampleRate',5e6,'NoiseFigure',5,...
    'EnableInputPort',true,'SeedSource','Property','Seed',1e3);

I did not change anything here :
    NumPulses = 10;
    sig = waveform(); % get waveform
    transpos = transpos.InitialPosition; % get transmitter position
    rxsig = zeros(length(sig),NumPulses);
    % transmit and receive ten pulses
    for n = 1:NumPulses
        % update target position
        [tgtpos,tgtvel] = targetpos(1/waveform.PRF);
        [tgtrng,tgtang] = rangeangle(tgtpos,transpos);
        tpos(n) = tgtrng;
        [txsig,txstatus] = transmitter(sig); % transmit waveform
        txsig = radiator(txsig,tgtang); % radiate waveform toward target
        txsig = channel(txsig,transpos,tgtpos,[0;0;0],tgtvel); % propagate waveform to target
        txsig = target(txsig); % reflect the signal
        % propagate waveform from the target to the transmiter
        txsig = channel(txsig,tgtpos,transpos,tgtvel,[0;0;0]);
        txsig = collector(txsig,tgtang); % collect signal
        rxsig(:,n) = receiver(txsig,~txstatus); % receive the signal
    end

    prf = waveform.PRF;
    fs = waveform.SampleRate;
    fasttime = unigrid(0,1/fs,1/prf,'[)');
    rangebins = (physconst('LightSpeed')*fasttime)/2;

    probfa = 1e-9;
    NoiseBandwidth = 5e6/2;
    npower = noisepow(NoiseBandwidth,...
        receiver.NoiseFigure,receiver.ReferenceTemperature);
    thresh = npwgnthresh(probfa,NumPulses,'noncoherent');
    thresh = sqrt(npower*db2pow(thresh));
    [pks,range_detect] = findpeaks(pulsint(rxsig,'noncoherent'),...
        'MinPeakHeight',thresh,'SortStr','descend');
    range_estimate = rangebins(range_detect(1));

    ts = rxsig(range_detect(1),:).';
    [Pxx,F] = periodogram(ts,[],256,prf,'centered');
    plot(F,10*log10(Pxx))
    grid
    xlabel('Frequency (kHz)')
    ylabel('Power (dB)')
    title('Periodogram Spectrum Estimate')

    [Y,I] = max(Pxx);
    lambda = physconst('LightSpeed')/1e9;
    tgtspeed = dop2speed(F(I)/2,lambda);
    fprintf('Estimated range of the target is %4.2f meters.\n',...
        range_estimate)

    fprintf('Estimated target speed is %3.1f m/sec.\n',tgtspeed)

    if F(I)>0
        fprintf('The target is approaching the radar.\n')
    else
        fprintf('The target is moving away from the radar.\n')
    end

I really have no idea why this new pulse give me this output :
Estimated range of the target is 750350.54 meters.
Estimated target speed is -4.9 m/sec.
The target is moving away from the radar.

I would be appreciated if anyone could give me an advice or a solution. thanks.


text:
Q: if/switch - "if $var is 'a' or is 'b' or is 'c'" etc
Possible Duplicate:
PHP make if shorter

I have an if statement that looks like this:
if($variable == "one" || $variable == "two" || $variable == "three" || $variable == "four"){
    // do something
}
else {
    // do something else
}

the problem is that its getting quite hefty.. its going to be about 20 or 30 different options.
Is there anyway I can do this in less code? EG:
if($variable == ("one" || "two" || "three" || "four" || "five"))..

A: switch ($variable) {
 case "one":
 case "two":
 case "three":
 case "four":
    // do something
    break;
 default:
    // do something else
}

OR
$testSeries = array("one","two","three","four");
if (in_array($variable,$testSeries)) {
    // do something
}
else {
    // do something else
}

A: The simplest thing that comes to mind is is that you create an array like this:
$options = array("one" , "two" , "three" , "four" , "five");
if(in_array($variable , $options)){

}else{

}

A: switch ($i) {
case "one":
case "two":
case "three":
.
.
.
//Code here
break;
}

A: if (preg_match('/^(one|two|three|four|five)$/', $var)) {
    // Do stuff
}


text:
Q: What's the meaning and structure of this sentence?
In the last sentence, I don't understand this meaning and structure 'They might, but who, bar a tiny majority, would want to hear the answers'.
Could you expain this? Thanks!

A: The OP asks for an explanation of the following, apparently from a book, noting that women might ask different questions of political candidates different from those men would ask.

"They might, but who, bar a tiny majority, would want to hear the
  answers?"

They (women) might (ask different questions), but who, bar [except] a tiny majority [a little over half of the population--that is, women], would want to hear the answers?
"bar" is a preposition; its object is "a tiny majority"
This is sarcasm--at least as far as I can tell from the short excerpt. The paragraphs above, in the photo, may also be sarcastic; more context would be needed to figure out the views of the author.


text:
Q: How to render conditionally based on alternating patterns? I have a list of products that I want to display in a card view. The card background should go like this: Green, Blue, Red, Purple, Green, Blue, Red, Purple, etc etc
products.map(item => (

{item.name}

    { bgColor === 'green'&& setBgColor('blue')}
    { bgColor === 'blue' && setBgColor('red')}
    { bgColor === 'red' && setBgColor('purple')}
    { bgColor === 'purple' && setBgColor('blue')}
))}

This code obviously doesn't work because it'll end up in a never ending loop.
But essentially I'd like the map function to consider what state the color is in, and for the NEXT render in the products array, change the color to a different color.
Logically, I'm trying to say the below code for each map item
if (bgColor === 'green') {
   setBgcolor: 'blue'
   return
}
if (bgColor === 'blue') {
   setBgcolor: 'red'
   return
}
if (bgColor === 'red') {
   setBgcolor: 'purple'
   return
}
if (bgColor === 'purple') {
   setBgcolor: 'green'
   return
}

I'm open to completely different methods of implementing this however..

A: If I understood your issue correctly, you can create a map of colors based on the remainder when you divide the item index by 4.
This code should render 'blue' when the item's index is 0/4/8... etc.
const colorMap = {
 0: 'blue',
 1: 'red',
 2: 'green',
 3: 'purple'
}

products.map((item, index) => (

{item.name}

))}


text:
Q: Cannot convert http request to observable array Angular 2 I've been following the Tour of Heroes chapter on http calls and am trying to implement something similar with a different API.
However, I get the following error:
Cannot find a differ supporting object '[object Object]' of type 'Bond Street 1'. NgFor only supports binding to Iterables such as Arrays.
Any clues on why this is?
My service looks as follows and works when I console.log the result
  search(stationNumber: number): Observable<BikeStand[]> {
    return this.http.get(`APIURL${stationNumber}`)
      .map((b: Response) => {
        console.log(b.json() as BikeStand[])
        return b.json() as BikeStand[];
      });
  }

My component looks as follows
export class BikestandSearchComponent implements OnInit {

  bikestands: Observable<BikeStand[]>;
  private searchTerms = new Subject<number>();

  constructor(private bikestandSearchService: BikestandSearchService) { }

  search(term: number): void {
    this.searchTerms.next(term);
  }

  ngOnInit(): void {
    this.bikestands = this.searchTerms
      .debounceTime(300)
      .distinctUntilChanged()
      .switchMap(term => term ? this.bikestandSearchService.search(term) : Observable.of<BikeStand[]>([]))
      .catch(error => {
        console.log(error);
        return Observable.of<BikeStand[]>([])
      })
  }

And my view likes this

Bikestand search

  <input #searchBox id="search-box" (keyup)="search(searchBox.value)" />

{{bikestand.name}}

My api for a given key looks as follow FYI
{
number: 1,
name: "Bond Street 1",
address: "Street",
position: {
lat: 55.340962,
lng: -6.3
},
banking: false,
bonus: false,
status: "OPEN",
contract_name: "City",
bike_stands: 29,
available_bike_stands: 19,
available_bikes: 10,
last_update: 1473356300000
}

A: as the error states, you are trying to iterate over an object using *ngFor rather than an array. the api you are using/returned is an object.
Check if console.log(b.json() as BikeStand[]) returns an objects which has some data property. if true then
return b.json().data instead .
we want to extract array out of the object to iterate over.

A: It looks like your service or HTTP request isn't actually sending an array, it is sending a single Object.  For example, I ran this code:
import {Component, NgModule} from '@angular/core'
import {BrowserModule} from '@angular/platform-browser'

@Component({
  selector: 'my-app',
  template: `

Hello {{name}}

{{bike.name}}

  `,
})
export class App {

  bikestand:any = {
    number: 1,
    name: "Bond Street 1",
    address: "Street",
    position: {
      lat: 55.340962,
      lng: -6.3
    },
    banking: false,
    bonus: false,
    status: "OPEN",
    contract_name: "City",
    bike_stands: 29,
    available_bike_stands: 19,
    available_bikes: 10,
    last_update: 1473356300000
  };

  constructor() {
    this.name = 'Angular2'
  }
}

@NgModule({
  imports: [ BrowserModule ],
  declarations: [ App ],
  bootstrap: [ App ]
})
export class AppModule {}`

And got the same error.  But change bikestand to an actual array (by putting square brackets around it) and I get correct result.


text:
Q: Getting individual values from an ArrayList I'm trying to get the individual values from an ArrayList but I haven't had any luck.
It appears that when I go through the loop, it's overwriting the i Integer variable being used in the for loop.
public ArrayList<Integer> getTests()
{
    return tests;
}

// Go through all the tests downloaded from the bluetooth module
        for (Integer i :ma.mOpacityTestResult.getTests())
        {
            View row = inflater.inflate(R.layout.test_report_row, (ViewGroup) container, false);
            TextView left = (TextView) row.findViewById(R.id.rowLeft);
            TextView right = (TextView) row.findViewById(R.id.rowRight);

            // This is the checkbox we want shown but to only worth with counter
            CheckBox check = (CheckBox) row.findViewById(R.id.checkBox);
            check.setVisibility(View.VISIBLE);
            check.setChecked(true);

            String testResultString = getString(R.string.TestNumber) + String.valueOf(counter++);

        // Load getTest Results into a list
          List<Object> list = new ArrayList<>();
          list.add(i);          // Trying to seperate each value of i download from bluetooth here but failing
        }

A: Your code is creating a new list on every iteration and adding the value. So at the end of final iteration, only the list created in the last iteration will be left, which gives a feeling that the value in the list is being overwritten. To fix this, the list initialization (List list = new ArrayList<>();) has to be done outside the for loop.

A: You need to keep initialization out of the loop
This should be outside the loop
List<Object> list = new ArrayList<>();

Only addition of values to list should be in the loop
list.add(i);


text:
Q: how can you sort by date for an ArrayList with TreeMap as value in my code I have ArrayList<TreeMap<String, Object>>. What TreeMap would have is the key and value. there is a key named sent_date with the value in format of yyyy-MM-DD HH:MM:SS. I can't find a way to sort this list...Can someone please help? thanks.

A: You can use Collections.sort(list, comparator), where you have to implement a Comparator<Map<String,?>> to do what you need (i.e. retrieve the sent_date from two maps and compare those).

A: In Java 8, this would be (for a sort that modifies the list):
DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
list.sort(Comparator.comparing(m -> LocalDateTime.parse(m.get("sent_date"), format)));

Or if you want to keep the original list:
newList = list.stream()
              .sorted(Comparator.comparing(...))
              .collect(Collectors.toList());


text:
Q: How to prove transitive property of parallel lines for 3 non-coplanar lines. Given: for lines a, b, c; a||b, b||c, and a,b,c non-coplanar
Prove a||c
I seem to gitten to a point where if I can prove a and c are not skewed, then they are parallel, but I just can't figure out how to prove they are not skewed. Or to put it another way, I have to prove a and c are coplanar to prove they are parallel. Or maybe I'm off even on that. Please help. Thank you.

A: $$
\left\{ \matrix{
  a||b\quad  \Rightarrow \quad \left\{ \matrix{
  {\bf a} = {\bf a}_{\,0}  + \alpha \,{\bf u} \hfill \cr
  {\bf b} = {\bf b}_{\,0}  + \beta \,{\bf u} \hfill \cr}  \right. \hfill \cr
  b||c\quad  \Rightarrow \quad \left\{ \matrix{
  {\bf b} = {\bf b}_{\,0}  + \beta \,{\bf u} \hfill \cr
  {\bf c} = {\bf c}_{\,0}  + \gamma \,{\bf u} \hfill \cr}  \right. \hfill \cr}  \right.\quad  \Rightarrow \quad \left\{ \matrix{
  {\bf a} = {\bf a}_{\,0}  + \alpha \,{\bf u} \hfill \cr
  {\bf c} = {\bf c}_{\,0}  + \gamma \,{\bf u} \hfill \cr}  \right.\quad  \Rightarrow \quad a||c
$$


text:
Q: Problem adding Class Library ServiceModel section to Applications app.config I have read on a number of question/answers how you would need to add the "system.serviceModel" section of a class library that has a service reference to the executing application's app.config if your separate class library has a service reference.
However, I found that I can't just add everything in "system.serviceModel" as my code throws exceptions that it can't find the binding sections.  So I had deduced (possibly incorrectly) that a declaration needs to be added to the app.config/configSection section stating what dll uses that section.
When I do that (or attempt to) the application (windows service) crashes as it doesn't like the section I am adding.  I was attempting to add it like:
<section name="system.serviceModel" type="projectName.projectFolder.className, projectname" />

I am obviously doing something wrong and I haven't seen what I am missing from any examples.
Thanks in advance.

A: The answer to my own question, is that you have to fully qualify the client name in the "contract" element in the "Client" section.


text:
Q: If-Then-Else inside List Monads do-notation I am trying to understand the concept of Monads and came across this list comprehension syntax for filtering sums from 2 lists.
largeSums = [i+j | i <- [10, 20, 30], j <- [1 , 2] , (i+j)>20]

I am trying to rewrite this using the do notation but do not understand what goes inside the else part:
largeSums = do
              i <- [10, 20, 30]
              j <- [1 , 2]
              if i+j > 20
               then return (i+j)
               else

A: An empty list without return will work in that case. (which means 'no result for this combination of (i, j)'. On the other hand, return (i+j) equals [i+j])
largeSums = do
              i <- [10, 20, 30]
              j <- [1 , 2]
              if i+j > 20
               then return (i+j)
               else []

However, it is more idiomatic to use guard :: (Alternative f) => Bool -> f ().
import Control.Monad
largeSums = do
              i <- [10, 20, 30]
              j <- [1 , 2]
              guard (i+j > 20)
              return (i+j)

Related links:

*

*How are list comprehensions implemented in Haskell?

*Why is guard based on Alternative?

*The List monad - Learn You a Haskell for Great Good!

*List comprehension translations - Haskell Report 2010


text:
Q: Lookup value in a list of lists, using js I have a list of data in javascript that looks like this:
[[152, 48, 'http://www.google.com'],
 [198, 47, 'http://www.stackoverflow.com'],
 [199, 45, 'http://www.apple.com']]

I am using flot to create a plot, and am trying to pass this third value to access a hyperlink from the point.  As such, I am trying to lookup the third value of each list by using the first two as the lookup keys (i.e., [[x,y,hyperlink],[x2,y2,hyperlink2]], click on a point, then use the appropriate (x,y) to find the corresponding hyperlink)
Is there anyway to do this, or do I need to pass some dictionaries for x and y to javascript, then find the common variable from the two lists that were looked up?  In python I know you could do a filter of list on the x value with itemgetter, then lookup a link corresponding to the y value.  But I know almost nothing about js, so could a solution to ID-ing with (x,y) be given, or if not possible or advised, then a solution to taking two lists of (from x and y vals) and find a common value (if multiple, just one, anyone)?

A: You can make use of the Array .filter() method to figure out if any elements match the supplied x and y. (Note that IE didn't support .filter() until version 9, but MDN has a shim that you can include).
var data = [[152, 48, 'http://www.google.com'],
            [198, 47, 'http://www.stackoverflow.com'],
            [199, 45, 'http://www.apple.com']];

function getURLForPoint1(x, y) {
    var p = data.filter(function(el) {
        return (el[0] === x && el[1] === y);
    });
    if (p.length === 1) return p[0][2];
    // else 0 or more than 1 elements mathced so return undefined
}

Alternatively you can create a dictionary object up front and then do future lookups from the dictionary:
var getURLForPoint2 = function() {
    var dataDictionary = {}, i;
    for (i = 0; i < data.length; i++)
       dataDictionary[data[i][0]+" "+data[i][1]] = data[i][2];

    return function(x, y) {
       return dataDictionary[x + " " + y];
    };
}();

Either way I've coded it so that if you ask for a point that isn't in the list you'll get undefined back, but obviously you can change that to return an empty string or throw an exception or whatever you like.
alert(getURLForPoint1(198, 47));    // 'http://www.stackoverflow.com'
alert(getURLForPoint2(198, 47));    // 'http://www.stackoverflow.com'
alert(getURLForPoint2(4, 5));       // undefined

Demo of both: http://jsfiddle.net/WdSAz/

A: Sorry, no shortcut way to do it in js except to just loop through the list and find the one that has the matching "x" and "y" value.
However, depending on how large your list is (and whether or not this list will be used for something else...) you could restructure the data to make it more efficient. For instance, do a structure like (assumed possible to have for instance x1, y1 vs x1, y2)
x1 > y1 > url
x1 > y2 > url
x2 > y1 > url
etc...

then you can immediately jump to the 2nd lvl "y" list by the "x" index, and the only looping would be how many "y" values share the same "x" value
edit:
actually if you wanna take it a step further with reorganizing the data, you could do something like this:
<script type='text/javascript'>
var list = {
  1 : {
    1 : 'foobar 1,1',
    2 : 'foobar 1,2'
  },
  2 : {
    1 : 'foobar 2,1',
    2 : 'foobar 2,2'
  },
};

</script>

which will allow you to do for instance this
var x = 1;
var y = 2;
alert(list[x][y]);

A: somthing like this maybe
  var findX = 198
  var findY = 47
  var targetUrl
  for (var i=0; i<arr.length; i++)
  {
      for (var j=0; j<arr[i].length; j++)
      {
          if (findX = j[0] && findY == j[1])
          {
              targetUrl = j[2]
          }
      }
  }


text:
Q: What does mean by "$\omega +1$ is convergent sequence"? Let $X=\omega +1$ be convergent sequence. Then what does mean by "$X$ is convergent sequence"?

A: Consider $\omega + 1 = \{0, 1, 2, \ldots, \omega\}$ with the interval topology. Then every finite $n < \omega$ is an isolated point, and the sequence $0, 1, 2, 3, \ldots$ converges to $\omega$.
Given a space $X$, let $\mathsf{Conv}(X) = \{ (a, x) \in X^\omega \times X \mid \lim_n a_n = x\}$ be the space of convergent sequences with their limits. Observe that $\mathsf{Conv}(X) \cong \mathcal{C}(\omega + 1, X)$, i.e., convergent sequences with limits in $X$ are the same thing as continuous maps $\omega + 1 \to X$. This is why the $\omega + 1$ with the interval topology deserves to be called the generic convergent sequence. Every convergent sequence is its continuous image, and every continuous image is a convergent sequence.


text:
Q: Xcode Image cropping produces output which has pixel imperfections Im using the following code to crop my UIImage:
-(UIImage*)cropWithRect:(CGRect)rect
{
   if(self.scale > 1.0f){
       rect = CGRectMake(rect.origin.x * self.scale,
                      rect.origin.y * self.scale,
                      rect.size.width * self.scale,
                      rect.size.height * self.scale);
   }

   CGImageRef imageRef = (CGImageCreateWithImageInRect(self.CGImage, rect));
   return [UIImage imageWithCGImage:imageRef scale:self.scale orientation:self.imageOrientation];
}

But this gives me an output image which has wrong pixel colors which is noticeable when zoomed in. For instance, white input pixel sometimes becomes off-white (not always - only when the white pixels are close to other pixels of dark colors).
Can I get better results or is there another way to produce better cropped images?
Thanks.

A: May be this will help you FXImageView
Step 1: select Image

Step 2: Crop Image

Step 3: Result Image


text:
Q: How to use indexing by matching strings in data frame in pandas I try to resolve the following problem. I have two data sets, say df1 and df2:
df1

NameSP  Val       Char1 BVA
0   'ACCR'  0.091941     A  Y'
1   'SDRE'  0.001395     S  Y'
2   'ACUZ'  0.121183     A  N'
3   'SRRE'  0.001512     S  N'
4   'FFTR'  0.035609     F  N'
5   'STZE'  0.000637     S  N'
6   'AHZR'  0.001418     A  Y'
7   'DEES'  0.000876     D  N'
8   'UURR'  0.023878     U  Y'
9   'LLOH'  0.004371     L  Y'
10  'IUUT'  0.049102     I  N'

df2

NameSP   Val1   Glob
0  'ACCR'  0.234  20000
1  'FFTR'  0.222  10000
2  'STZE'  0.001   5000
3  'DEES'  0.006   2000
4  'UURR'  0.134  20000
5  'LLOH'  0.034  10000

I would like to perform indexing of df2 in df1, and then use the indexing vector for various matrix operation. This would be something similar to strmatch(A,B,'exact') in Matlab. I can get the indexing properly by using .iloc and then .isin as in the following code:
import pandas as pd
import numpy as np

df1 = pd.read_excel('C:\PYTHONCODES\LINEAROPT\TEST_DATA1.xlsx')
df2 = pd.read_excel('C:\PYTHONCODES\LINEAROPT\TEST_DATA2.xlsx')

print(df1)
print(df2)

ddf1 = df1.iloc[:,0]
ddf2 = df2.iloc[:,0]

pindex = ddf1[ddf1.isin(ddf2)]

print(pindex.index)

which gives me:
Int64Index([0, 4, 5, 7, 8, 9], dtype='int64')

But I can not find the way to use this index for mapping and building my arrays. As an example, I would like to have a vector that has the same number of elements that df1, but with Val1 values from df2 at indexed positions and zeros everywhere else. So it should look like that:
0.234
0
0
0
0.222
0.001
0
0.006
0.134
0.034
0

Or another mapping problem. How to use such indexing to map the values from colon "Val" in df1 in a vector that would contain Val from df1 at indexed rows and zeros everywhere else. So this time it should look like:
0.091941
0.0
0.0
0.0
0.035609
0.000637
0.0
0.000876
0.023878
0.004371
0.0

Any idea of how to that in efficient and elegant way?
Thanks for help!

A: First problem
df2.set_index('NameSP')['Val1'].reindex(df1['NameSP']).fillna(0)

Second problem
df1['Val1'].where(df1['NameSP'].isin(df2['NameSP']), 0)


text:
Q: Troubleshooting Windows XP "RestrictRun" policies I'm at a site where user accounts are limited to running only certain programs (according to file name), through the Windows XP RestrictRun policy mechanism.  I realize this is largely useless as a security mechanism, but it is what it is.
Occasionally we'll run into a situation where something under a user account triggers the usual error message: "This operation has been cancelled due to restrictions in effect on this computer", but running the same program under a unrestricted account doesn't give any insight into what program was trying to be launched.
In the interest of troubleshooting this type of scenario, is there a way to get Windows to log program names blocked by a user's RestrictRun policy, or to show the name of the program blocked when displaying the above error message?

A: Use Process Monitor to find what threads/processes are related to the exe you are troubleshooting.  Once you know what other EXEs are required to run a given app you can more easily unblock it.


text:
Q: Python - alternatives for internal memory I'm coding a program that requires high memory usage.
I use python 3.7.10.
During the program I create about 3GB of python objects, modifying them.
Some objects I create contain pointer to other objects.
Also, sometimes I need to deepcopy one object to create another.
My problem is that these objects creation and modification takes a lot of time and causing some performance issues.
I wish I could do some of the creation and modification in parallel. However, there are some limitations:

*

*the program is very CPU-bound and there is almost no usage of IO/network - so multithreading library will not work due to the GIL

*the system I work with has no Read-on-write feature- so using multiprocessing python library spend a lot of time on forking the process

*the objects do not contain numbers and most of the work in the program are not mathematical - so I cannot benefit from numpy and ctypes

What can be a good alternative for this kind of memory to allow me to parallelize better my code?

A: Deepcopy is extremely slow in python. A possible solution is to serialize and load the objects from the disk. See this answer for viable options – perhaps ujson and cPickle. Furthermore, you can serialize and deserialize objects asynchronously using aiofiles.

A: Can't you use your GPU RAM and use CUDA?
https://developer.nvidia.com/how-to-cuda-python
If it doesn't need to be realtime I'd use PySpark (see streaming section https://spark.apache.org/docs/latest/api/python/) and work with remote machines.
Can you tell me a bit about the application? Perhaps you're searching for something like the PyTorch framework (https://pytorch.org/).

A: You may also like to try using Transparent Huge Pages and a hugepage-aware allocator, such as tcmalloc. That may speed up your application by 5-15% without having to change a line of code.
See thp-usage for more information.


text:
Q: Highcharts js: get errors if there is a big point in a 3d series chart I get errors if there is a big point in a 3d series chart.
The below code is an example from the highcharts document.
http://jsfiddle.net/highcharts/4dccq/?utm_source=website&utm_medium=embed&utm_campaign=4dccq
If I change the last value in the data array to 999 in the above code, I got the error in the Console of Chrome v54 and IE 11. But Firefox does not complain.
The changed code:
http://jsfiddle.net/4dccq/718/
Chrome reports:
Error:  attribute d: Unexpected end of attribute. Expected number, "M".
IE reports:
SVG4601: SVG Path data has incorrect format and could not be completely parsed.
Thanks.
$(function () {
    $('#container').highcharts({
        chart: {
            type: 'column',
            margin: 75,
            options3d: {
                enabled: true,
                alpha: 15,
                beta: 15,
                depth: 110
            }
        },
        plotOptions: {
            column: {
                depth: 40,
                stacking: true,
                grouping: false,
                groupZPadding: 10
            }
        },
        series: [{
            data: [1, 2, 4, 3, 2, 4],
            stack: 0
        }, {
            data: [5, 6, 3, 4, 1, 2],
            stack: 0
        }, {
            data: [7, 9, 8, 7, 5, 999],
           // ****** I changed the last value form 8 to 999, and then got the error
            stack: 1
        }]
    });
});

A: It is a regression bug. It appeared in Highcharts 5.0.5, already fixed on master branch.
Use 5.0.4 version
<script src="http://code.highcharts.com/5.0.4/highcharts.js"></script>
<script src="http://code.highcharts.com/5.0.4/highcharts-3d.js"></script>

http://jsfiddle.net/4dccq/719/
or github version:
<script src="http://github.highcharts.com/highcharts.js"></script>
<script src="http://github.highcharts.com/highcharts-3d.js"></script>

http://jsfiddle.net/4dccq/720/


text:
Q: Rails - Form with radio-buttons with javascript actions to enable/disable elements attached I want to create a form where there is a block of three linked radio buttons, each one with a separate input field attached, e.g.

*

*Option 1: [__Dropdown box__]

*Option 2: [__Dropdown box__]

*Option 3: [__Text field__]

Each of the three options will have an attribute in the model.
I want each of the three options to have a radio button, which when selected will automatically activate the input field beside it, and disable the other two. In the controller when the form is submitted, I also need to know which radio button was selected, take the value from the associated input, and set the other two fields to nil before saving the record.
I tried this a few months ago and failed miserably, giving it another go now still isn't making a lot of sense to me, I'm very inexperienced in any web UI/markup languages.
If anyone could point me to an example or the necessary resources so I can read up on the various methods I need to combine, that would be greatly appreciated.

A:  http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-radio_button
Pass a value to :class to group the radio buttons. assign different id to each radio button and in javascript handle the hide/show of related fields. In model, use validations depending upon the value passed by selected radio button.
validates :mmc_value, :numericality => { :message => ERR_NUMBER }, :if => :modifier_type

def modifier_type
  ['MMC', 'LMC'].include?(self.modifier) #modifier is the value on which the validation of other fields is based.
end

A: I ended up doing this to make it work:
View:
Override V
<input id="v_toggle" type="checkbox" value="Hide" />

<%= f.input :v_id, :collection => @vs, :prompt => "Choose a V" %>
<%= f.input :v, :label => false %>

JS file:
jQuery(document).ready(function(){
    $('#service_v').hide();
    jQuery('#v_toggle').live('click', function(event) {
        jQuery('#service_v_id').toggle('show');
        jQuery('#service_v').toggle('show');
    });
});


text:
Q: How to locate search links in google in Selenium for testing I am trying to search Google for Selenium, then run down the list of links by clicking each one, printing the page title, then navigating back.
List<WebElement> linkElements = driver.findElements( **<insert code here>** );

for(WebElement elem: linkElements)
{
    String text = elem.getText();
    driver.findElement(By.linkText(text)).click();
    System.out.println("Title of link\t:\t" + driver.getTitle());
    driver.navigate().back();
}

To find the elements, I have tried By.tagName("a") which doesn't work because it gets ALL the links, not just the search ones. Using Firebug, I see that each search link has a class of r used on the header h3, and the a tag nested inside it.
See the following:

Selenium - Web Browser Automation

What code can I insert to make this work?

A: Try below New Code
    WebDriver driver;
    driver = new FirefoxDriver();
    driver.get("http://www.google.com");
    driver.findElement(By.id("gbqfq")).sendKeys("Selenium");
    Thread.sleep(1500L);
    driver.findElement(By.id("gbqfb")).click();
    Thread.sleep(1500L);
    List<WebElement> linkElements = driver.findElements(By.xpath("//h3[@class='r']/a"));
     for(int i=0;i<=linkElements.size();i++)
        {
            String text = linkElements.get(i).getText();
            driver.findElement(By.linkText(text)).click();
            Thread.sleep(2000L);
            System.out.println("Title of link\t:\t" + driver.getTitle());
            Thread.sleep(2000L);
            driver.navigate().back();
            linkElements = driver.findElements(By.xpath("//h3[@class='r']/a"));

        }

A: You have a lot of solution for doing it. There's mine. You keep your way like
// You get all links in a list
List<WebElement> linkElements = driver.findElements(By.xpath("//h3/a"));

// for each element(link) you click() on it
for(WebElement elem: linkElements)
{
  elem.click();
  // i suggest to put a wait right there
  System.out.println("Title of link\t:\t" + driver.getTitle());
  driver.navigate().back();
}

i don't know why you were trying to complicate with getText() etc.

A: try searching for this selector:
    '.g:nth-child('+clickPosition+') h3.r a'

where "clickPosition" is the SERP result array key. Careful though, google now implements an "onmousedown" event that will change the href attribute to their redirect.