text:
Q: Сборка консольного приложения под Linux в NET7 Мне нужно собрать консольное приложение C# для Linux, но в свойствах проекта, в графе Целевая ОС есть разные платформы, включая Mac, iOS и т.д., но только не Linux с его дистрибутивами. Гуглил, пробовал менять .csproj вручную, сейчас он выглядит так:
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
    <RootNamespace>Hello_World</RootNamespace>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
    <IsPackable>false</IsPackable>
  </PropertyGroup>

</Project>

Если убрать OutputType Exe, то собирает DLL.
Команда dotnet publish -r linux-x64 -f net7.0 так же не дает нужного результата. В лучшем случае собирает без расширения исполняемого файла, что тоже не запустить на линуксе. SDK NET7 установлены, никаких пакетов, связанных с Linux в инсталлере не обнаружил, сам проект без внешних зависимостей - простейший Hello World из трех строк.


text:
Q: Remove items from a dictionary if condition is met I have a dictionary dict1 from which I want to remove all items where b is null, that means not just the property b, but the whole dictionary.
- hosts: localhost
  gather_facts: false

  vars:
    dict1: [{a:1,b:2,c:3},{a:1,b:"null",c:3},{a:1,b:2,c:3}]

  tasks:
  - set_fact:
      dict2: "{{item | reject(item.b, 'eq', 'null')}}"
    loop: "{{dict1}}"

The output should look like this:
dict2: [{a:1,b:2,c:3},{a:1,b:2,c:3}]

Note: there can be N items in the dictionary and/or N key-value pairs in the same dictionary. Also, there can be N number of b's in the dictionary that have null values, so it has to remove of all them.

A: You can use the selectattr filter to filter a list of dictionaries.
Given the task:
- debug:
    var: dict1 | selectattr('b', '!=', 'null')

This would yield:
dict1 | selectattr('b', '!=', 'null'):
  - a: 1
    b: 2
    c: 3
  - a: 1
    b: 2
    c: 3

A: Given the dictionary with null value instead of the string "null"
dict1:
  - {a: 1, b: 2, c: 3}
  - {a: 1, b: null, c: 3}
  - {a: 1, b: 2, c: 3}

Use selectattr without a test
    - debug:
        var: dict1|selectattr('b')

gives
dict1|selectattr('b'):
  - {a: 1, b: 2, c: 3}
  - {a: 1, b: 2, c: 3}

Quoting:

If no test is specified, the attribute's value will be evaluated as a boolean.

A: A solution with a simple loop and test:
- name: "tips2"
  hosts: localhost
  gather_facts: false

  vars:
    dict1: [{"a": 1, "b": 2, "c": 3}, {"a": 1, "b": "null", "c": 3},{"a": 1, "b": 2, "c": 3}]

  tasks:
    - set_fact:
        dict2: "{{dict2 | default([]) +  [item] }}"
      loop: "{{dict1}}"
      when: item.b != "null"

    - name: debug users
      debug:
        msg: "{{dict2}}"

result:
ok: [localhost] => {
    "msg": [
        {
            "a": 1,
            "b": 2,
            "c": 3
        },
        {
            "a": 1,
            "b": 2,
            "c": 3
        }
    ]
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Parse log4j log files within java code Is there anyway to parse log4j files in your source code directly? I know that there are software's (chainsaw, otroslogviewer) that help you view them outside however looking for something that will help you do it within java code (and maybe return a Log object or something for every entry parsed?)

A: log4j's LogFilePatternReceiver can do that


text:
Q: python recursion appending to list I am trying to to append current to master every time current changes. I have been unsuccessful using list. I have been able to to modify strings and append different strings to master but it would be much easier if I could use list.
master = []

def recur(count,current):
    count = count + 1
    if (count == 5):
        return
    current.append(1)
    master.append(current)
    recur(count,current)

recur(0,[])

print(master)
# out put
# [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]

# what I expected
# [[1], [1,1], [1,1,1], [1,1,1,1]]

A: This is what you want:
master = []

def recur(count, current):
    count += 1
    if (count == 5):
        return

    new_current = current.copy()

    new_current.append(1)
    master.append(new_current)

    recur(count, new_current)

recur(0, [])

print(master)

The issue is that current is a reference to the list object... not the actual list itself. So when you append current to master you are just appending a reference to the same list object. So when you add a new element to the current list it's added to the one list that all of your references are pointing to.
The solution is to take a copy of current list to store its state at that time. There are different types of copy - deep and shallow. Shallow would make a copy of the list object but not it's elements, a deep copy will recurse through the elements and any subelements if you have a list of lists for example.

A: Try the code below,
master = []

def recur(count, current):
    count += 1
    if (count == 5):
        return
    tmp = current[:]
    tmp.append(1)
    master.append(tmp)
    recur(count, tmp)

recur(0, [])

master

output
[[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]

A: The reason is you are appending the reference of the current list to master. So, every time you change current the previously appended lists also change.
Use this link for visualization:click here

>>>def recur(count,current):
    count = count + 1
    if (count == 5):
        return
    current.append(1)
    master.append(current)
    recur(count,current)

>>> master=[]
>>> recur(0,[])
>>> master
[[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]
>>> for i in master:
    id(i)

2485591104264
2485591104264
2485591104264
2485591104264
>>>

Method 1
You can try this. There is no need to keep track of the current list you are appending to master.
def recur(count):
    count+=1
    if count==5:
        return
    curr=[1]*count
    #print(curr)
    master.append(curr)
    recur(count)
master=[]
recur(0)
print(master)

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

Method 2
If you are keen on using current then try this.
Visualization for this code click here.

def recur(count,curr):
    count+=1
    if count==5:
        return
    curr.append(1)
    master.append(curr)
    recur(count,curr[:])
master=[]
recur(0,[])
print(master)

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

Method 3
Or you can try this.
def recur(count,curr):
    count+=1
    if count==5:
        return
    curr.append(1)
    master.append(curr[:])
    recur(count,curr)
master=[]
recur(0,[])
print(master)

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

Method 4
If you want to return [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]] then try this.
def recur(count,curr):
    count+=1
    if count==5:
        return []
    curr.append(1)
    return [curr]+recur(count,curr[:])
master=recur(0,[])
print(master)
another_master=recur(0,[])
print(another_master)

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

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


text:
Q: Null Pointer Exception in Java when using String Arrays I have a piece of code where the program compares the value of two arrays of strings. I am getting a java.lang.NullPointerException, even though I initialized both arrays. Here is the relevant code:
String[] functions=new String [inputs+1];
int funCounter=0;
for (int a=0;a<2;a++)
{
    for (int b=0;b<2;b++)
    {
        if (tokenizedString[b].equals(keywords[a])&&keywords[a].equals("add"))
        {
            System.out.println("Yay");
            functions[funCounter]="add";
            funCounter++;
        }
        }
    }

This is where I inialize tokenizedString:
String[] tokenizedString;
    tokenizedString=new String[2];

tokenizedString is added to a Scanner in stream here:
StringTokenizer st = new StringTokenizer(input," ");

And here is where I initialize keywords:
String[] keywords;
    keywords=new String[2];

Any ideas? Thanks!

A: While you are accessing tokenizedString[n], the string array will give you the nth element. If the nth element is not initialized, for object arrays it will be defaulted to null.
A better way to avoid null checks in this case will be to switch places of the string values if you are sure that the other one will never be null. So instead of:
 tokenizedString[b].equals(keywords[a])

use:
 keywords[a].equals(tokenizedString[b])


text:
Q: Want to create a VM instance in Google Cloud Platform by using CLI Trying to create a VM instance in Google Cloud Platform. Getting error in the mentioned process. Trying to resolve it.
Error: **Could not fetch a resource:

*

*Invalid value for field 'resource.networkInterfaces[0].subnetwork': 'https://compute.googleapis.com/compute/v1/projects/xxx/regions/us/subnetworks/10.128.0.0/20'. The URL is malformed.**

Anyone, please guide me. My intention to make VM creation automated and make it simple by putting it all together in an automated Bash Script.

A: The error indicates that the URL is malformed. It probably because that "subnetwork" does not exist as you write it.
One way to fix it is to have a look in the documentation to know the right way to write the command. Also be sure that that subnet exist in your GCP project.
https://cloud.google.com/vpc/docs/create-use-multiple-interfaces
The easy way to avoid typos is to create the VM in the console the first time (you don't really have to create it, just start the form), at the bottom of the page you will see a line that says "Equivalent REST or command line", click in "command line" to see exactly the CLI command equivalent to the VM you are configuring. Use this command line in your CLI console or script.

Clicking in the "command line" will return something like:
gcloud compute instances create VM_NAME \
    --network=NETWORK_NAME \
    --subnet=SUBNET_NAME \
    --zone=ZONE

with all the parameters already filled in for you.


text:
Q: Is there any control panel for PHP APCU? So, I just upgraded to PHP 5.5 on my ubuntu test box and I can save and fetch user cache from apc_* commands along with apcu_* commands (both seem to work)
But when I check the APC backend (the APC control panel) , user cache entries never show up.
Do anyone know about any control panel or a backend where I can check and manage APCU user cache entries in PHP 5.5 ?

A: You need a different script for apcu:
https://github.com/krakjoe/apcu/blob/simplify/apc.php
https://github.com/krakjoe/apcu/blob/master/apc.php

A: APC Admin have newer realtime version, contactable to APCu, only issue is OpCode cache option does not work


text:
Q: IE11.0.26 Unsupported Error for mergeAttributes I am a web development contractor working at a government agency.  We have just begun to experience issues with our pages and I believe it has to do with Internet Explorer 11.0.26 and jQuery DataTable.  We are using jQuery v1.7 and DataTables 1.9, I know they are old but they did work with IE 11.0.25.
The javaScript (JS) fails with an "Unsupported Error" on the "mergeAttributes" method.  This I believe is still included in the IE11 browser API.
Does anyone know what would cause this error and under what conditions?
Thanks for you assistance.

A: UPDATED: I`ve found and source of this issue and created new question as i need some assistance to deal with it, here is my question with explanations: link
I managed to recreate it, so in my case  mergeAttributes method is screwed up after some special css selector is used (i`ve been using mootols in my case). in IE 11 (11.0.27) with IE=7 rendering mode.
My guess: jQuery/Mootools selectors in some cases modifies Elements attribute list.
Here is code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="X-UA-Compatible" content="IE=7" />

<input type='text' id='inp' value="ORIGINAL" class='ORG'></input>

<input type='text' id='cln' value="CLONE" class='none'></input>

<input type='button' value='Merrge Classes' id='btn'></input>

<input type='button' value='Merrge Classes, but before initiat Class selector' id='btnS'></input> <-- Seceltor used '$$('input[class=randomClass]')'

Demo (was not able to use jsfiddle as this bug appear only in IE=7 rendering mode):
Here is demo

A: Here is the FIX for this issue.  It was provided by carranthuohill3 on the dataTable forum and refferenced Dottoro.com
   // mergeAttributes, in contrast, only merges back on the
   // original attributes, not the events
    try{
        if ( dest.mergeAttributes ) {
            dest.mergeAttributes( src );
        }
    } catch (exception) {
        for (var i=0; i < src.attributes.length; i++) {
            var attr = src.attributes[i];
            var attrName = attr.name.toLowerCase ();
            if (attrName != "id" && attrName != "name") {
                dest.setAttribute (attr.name, attr.value);
            }
        }
    }


text:
Q: How to get notification from printer when physical page/job is complete I'd like to be able to get a notification from a network printer when it physically finishes printing a page (and/or the entire job). This is going to be used in an app I'm writing for print management via web, and since users get charged per-page, and the charge shouldn't go down before the page actually completes.
I'm not sure whether this requires writing a driver, some kind of plug-in or whether a client app will do. I am flexible with my platform, since my client isn't written yet, so I'd like to hear about any suitable solution in either Windows or Linux, in any programming language/level.
I'm aware that there is a difference between the spooler and the printer. I'm trying to examine at which level the printer might notify the machine, via IPP, when the page or job physically complete.
I'm currently looking into Java, using either jspi or cups4j package to obtain a notification when the IPP property job-impressions-completed  changes, or alternatively, poll for it. I'm using a CUPS IPP interface to a local printer. Running a simple tester (HelloPrint.java attached below; or the CupsTest.java included in cups4j), I did not receive any job-impressions-completed attribute changes nor did it list the attribute for the job when I was polling.
So here are the questions:

*

*Am doing this right? If not, then how should I do it?

*Since this is a CUPS interface to a local printer, it might be that the job-impressions-completed attribute isn't being updated, specifically since it acts as a spooler for the real printer. Assuming that the real printer will notify about or list this attribute, Would this be printer-specific or must any IPP-supporting printer have this attribute available and updated?

System info: Ubuntu 11.10, CUPS 1.5.0, printer is Brother HL-2240D (PPD available here)
Note: HL-2240D is not the printer I will be using for the eventual project (specifically, it doesn't support IPP); I'm intending to use either an HP HL4250DN or Samsung 3741ND or similar.
Here's a sample app using the javax.print packages and jspi:
HelloPrint.java
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Date;

import javax.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;
import javax.print.event.*;

import de.lohndirekt.print.IppPrintService;

public class HelloPrint {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // create request attributes
        PrintRequestAttributeSet requestAttributeSet = new HashPrintRequestAttributeSet();
        requestAttributeSet.add(MediaSizeName.ISO_A4);
        requestAttributeSet.add(new Copies(1));
        requestAttributeSet.add(Sides.DUPLEX);

        // find an appropriate service
        // using jspi (http://code.google.com/p/jspi/)
        URI printerURI;
        try {
            printerURI = new URI("ipp://localhost:631/printers/HL2240D-local");
        } catch (URISyntaxException e2) {
            e2.printStackTrace();
            return;
        }
        IppPrintService service = new IppPrintService(printerURI);

        // by enumerating
        //      PrintService[] services = PrintServiceLookup.lookupPrintServices(
        //              DocFlavor.INPUT_STREAM.PDF, requestAttributeSet);
        //      for (PrintService service1 : services) {
        //          System.out.println(service1);
        //      }
        //      PrintService service = services[0];

        // add listeners to service
        service.addPrintServiceAttributeListener(new PrintServiceAttributeListener() {
            @Override
            public void attributeUpdate(PrintServiceAttributeEvent event) {
                PrintServiceAttributeSet serviceAttributeSet = event
                        .getAttributes();
                StringBuilder s = new StringBuilder();
                s.append("=== PrintServiceAttributeEvent: (" + serviceAttributeSet.size() + " attributes)\n");
                for (Attribute attribute : serviceAttributeSet.toArray()) {
                    PrintServiceAttribute printServiceAttribute = (PrintServiceAttribute) attribute;

                    s.append(printServiceAttribute.getCategory().getName()
                            + "/" + printServiceAttribute.getName() + " = "
                            + printServiceAttribute.toString() + "\n");

                }
                System.out.println(s.toString());
            }
        });

        // add file (blank.pdf is a blank page exported as PDF from LibreOffice
        // Writer)
        FileInputStream inputStream;
        try {
            inputStream = new FileInputStream("blank.pdf");
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return;
        }

        // create a new doc and job
        DocAttributeSet docAttributeSet = new HashDocAttributeSet();
        docAttributeSet.add(MediaSizeName.ISO_A4);
        docAttributeSet.add(Sides.DUPLEX);

        Doc doc = new SimpleDoc(inputStream, DocFlavor.INPUT_STREAM.PDF,
                docAttributeSet);

        DocPrintJob job = service.createPrintJob();

        // listen to print job attribute change events
        // attribute set is null, means this means to listen on all dynamic
        // attributes that the job supports.
        job.addPrintJobAttributeListener(new PrintJobAttributeListener() {
            @Override
            public void attributeUpdate(PrintJobAttributeEvent event) {
                PrintJobAttributeSet jobAttributeSet = event.getAttributes();
                StringBuilder s = new StringBuilder();
                s.append("=== PrintJobAttributeEvent: (" + jobAttributeSet.size() + " attributes)\n");
                for (Attribute attribute : jobAttributeSet.toArray()) {
                    PrintJobAttribute jobAttribute = (PrintJobAttribute) attribute;

                    s.append(jobAttribute.getCategory().getName() + "/"
                            + jobAttribute.getName() + " = "
                            + jobAttribute.toString() + "\n");

                }
                System.out.println(s.toString());

            }
        }, null);

        // listen to print job events
        job.addPrintJobListener(new PrintJobListener() {

            @Override
            public void printJobRequiresAttention(PrintJobEvent pje) {
                System.out.println("=== PrintJobEvent: printJobRequiresAttention");
            }

            @Override
            public void printJobNoMoreEvents(PrintJobEvent pje) {
                // TODO Auto-generated method stub
                System.out.println("=== PrintJobEvent: printJobNoMoreEvents");
                System.out.println(pje.getPrintEventType());
                System.out.println(pje.toString());
            }

            @Override
            public void printJobFailed(PrintJobEvent pje) {
                // TODO Auto-generated method stub
                System.out.println("=== PrintJobEvent: printJobFailed");
                System.out.println(pje.getPrintEventType());
                System.out.println(pje.toString());
            }

            @Override
            public void printJobCompleted(PrintJobEvent pje) {
                // TODO Auto-generated method stub
                System.out.println("=== PrintJobEvent: printJobCompleted");
                System.out.println(pje.getPrintEventType());
                System.out.println(pje.toString());
            }

            @Override
            public void printJobCanceled(PrintJobEvent pje) {
                // TODO Auto-generated method stub
                System.out.println("=== PrintJobEvent: printJobCanceled");
                System.out.println(pje.getPrintEventType());
                System.out.println(pje.toString());
            }

            @Override
            public void printDataTransferCompleted(PrintJobEvent pje) {
                System.out.println("=== PrintJobEvent: printDataTransferCompleted");
                System.out.println(pje.getPrintEventType());
                System.out.println(pje.toString());
            }
        });

        // print
        try {
            job.print(doc, requestAttributeSet);
        } catch (PrintException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
            return;
        }

        // try polling
        while (true) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
                return;
            }

            System.out.println("=== Polling: I'm alive and it's " + new Date());
            System.out.println("Job attributes");
            for (Attribute attribute : job.getAttributes().toArray()) {
                System.out.println((attribute.getCategory().getName() + "/"
                        + attribute.getName() + " = " + attribute.toString()));
            }
            System.out.println("Service attributes");
            for (Attribute attribute : service.getAttributes().toArray()) {
                System.out.println((attribute.getCategory().getName() + "/"
                        + attribute.getName() + " = " + attribute.toString()));
            }
        }
    }

}

A: In the end it all depends on the printers firmware. IPP specifies the attribute job-impressions-completed as optional. That means if the printer can't tell which page has been printed, you won't be able to read it - no matter whether your programming is correct or not.
Manufacturers usually claim to support IPP but don't document very well the optional parts they might have implemented (or not).
Before doing any programming I suggest to read all available job-attributes using the ipptool available from CUPS:
#!/usr/bin/env ipptool -tv -d job=482 ipp://192.168.2.113/ipp
{
OPERATION Get-Job-Attributes
GROUP operation-attributes-tag
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
ATTR uri printer-uri $uri
ATTR integer job-id $job
}

job-state is a mandatory attribute and should reach a final state after some time: completed, aborted or canceled. This might be good enough, if you can get the number of job-pages somewhere else.
Implementation hint: IppJob provides method waitForTermination()


text:
Q: Regex Capture Groups in C# I'm trying to come up with a regex that will split out a string in 3 different parts: Name, Address, and Phone Number.
This is what I currently have:
^(?<Name>\w.*)\s+(?<Address>\d+\s\w+.*\d{5,9})\s+(?<Phone>\d+.*)

Here is what regex101 is giving me back with the following sample string:

But if I add in a '#' before the suite number, it works as planned:

I've even tried running just the address regex against the entire string in a separate instance and it worked just fine.  There's something going on with the capture groups that's throwing it off.  Any suggestions would be greatly appreciated!

A: Try making the name non-greedy:
^(?<Name>\w.*?)\s+(?<Address>\d+\s\w+.*\d{5,9})\s+(?<Phone>\d+.*)


text:
Q: Woocommerce For Contact Form 7 - How Can I Add Sku As A Form?
As you can see the Sku information above, click "ASK ABOUT THIS PRODUCT" and there is no form label sku attached.

Can Help me? Thanks

A: *

*Install Contact Form 7 (CF7) plugin

*Contact Form 7 Dynamic Text Extension plugin

*Add a dynamic hidden (or not) field to your CF7 form like this:
[dynamichidden SKU "CF7_get_custom_field key='_sku'"]


text:
Q: Given the permutation $\sigma=\left(\begin{array}{ccccc} 1&2&3&4&5\\ 3&1&2&5&4 \end{array}\right)$ Given the permutation $$\sigma=\left(\begin{array}{ccccc}
1&2&3&4&5\\
3&1&2&5&4
\end{array}\right)$$
the matrix A is defined to be the one whose $i$-th column of the identity matrix $I$. Which of the following is correct?

*

*$A=A^{-2}$

*$A=A^{-4}$

*$A=A^{-5}$

*$A=A^{-1}$

A: That permutation has a $3$ cycle and a $2$ cycle. So, you need to apply that permutation $6$ times to get back to the identity, i.e. $A^6 = I$ and $A^k \neq I$ for $1 \le k \le 5$. Thus, $A^{-1} = A^5$.


text:
Q: Bind two JSF input fields with single property of backing bean Suppose I have two h:inputText components. I want to bind both of the text fields with single property in the backing bean. The problem is that the value submitted to backing bean is that from second text field. I want that the value should be submitted from that field in which user entered the text.
My code:
<h:inputText id="text1" value="#{bean.value}">
    ......
</h:inputText>

<h:inputText id="text2" value="#{bean.value}">
    .......
</h:inputText>

Note that the value in both of the above fiekds is bean.value

A: add <f:ajax event="blur"... or <f:ajax event="keyup"...
like this
<h:inputText id="text1" value="#{inningBean.dismissalName}">
    <f:ajax event="blur" render="typeWhatYouWant" listener="#{optionalBean.someMethod}"/>
</h:inputText>

<h:inputText id="text2" value="#{inningBean.dismissalName}">
    <f:ajax event="blur" render="typeWhatYouWant" listener="#{optionalBean.someMethod}"/>
</h:inputText>

or using js (check your text1 and text2 real ids using viewsource)
<h:inputText id="text1" value="#{inningBean.dismissalName}" onkeyup="$('#yourFormID\\:text2').val($('#yourFormID\\:text1').value)"/>

<h:inputText id="text2" value="#{inningBean.dismissalName}" onkeyup="$('#yourFormID\\:text1').val($('#yourFormID\\:text2').value)"/>


text:
Q: Matching in mongo inside aggregate doesn't return result I have the following query:
db.company_name_match.aggregate([{"$group": {"_id": {"link": "$link", "company_name": "$company_name", "city": "$city"}, res: {$sum: 1}}},{$match: {res: {$gt: 1}}}])

This is meant to find duplicates in the collection.
However, when I add to the match stage another condition, the query doesn't return any results.
db.company_name_match.aggregate([{"$group": {"_id": {"link": "$link", "company_name": "$company_name", "city": "$city"}, res: {$sum: 1}}}, {$match: {res: {$gt: 1}, match_count: 0}}])

Am I doing something wrong here? And I am positive that there are documents which have the match_count == 0.

A: As @Neil Lunn suggested I've fixed this by adding the field to the group aggregation pipeline stage.
As a result, I've got the following query:
db.company_name_match.aggregate([{"$group": {"_id": {"link": "$link", "company_name": "$company_name", "city": "$city"}, match_results: {$first: "$match_results"}, res: {$sum: 1}}},{$match: {res: {$gt: 1}, match_results:[]}}])


text:
Q: Get content between tags I have and input like <input type="checkbox" name="controls[]" value="1347438434" />50504762b6102 and I need to get 50504762b6102.
Here full input:
<input type="checkbox" name="controls[]" value="1347438434" />50504762b6102
<input type="checkbox" name="controls[]" value="1347438435" />50504762b61d9
<input type="checkbox" name="controls[]" value="1347438436" />50504762b62af
<input type="checkbox" name="controls[]" value="1347438437" />50504762b6385
<input type="checkbox" name="controls[]" value="1347438436" />50504762b6466

I also have an array selected_ids which stores selected values, for example 1347438434, 1347438436, 1347438436.
So I am trying to get content like:
$.each(selected_cameras_ids, function(key, value){
    console.log($('input[value="'+value+'"]').nextUntil('label'));
});

But it returns empty object. What is wrong?

A: Use .parent() to get the parent label and then use .text() to get the text content.
$.each(selected_cameras_ids, function(key, value){
    console.log($('input[value="'+value+'"]').parent().text());
});

The demo.

A: Try this (demo: http://jsfiddle.net/kjvUh/):
$.each(selected_cameras_ids, function(key, value){
    console.log($('input[value="'+value+'"]').parent().text());
});


text:
Q: why stack is called abstract data type.If stack is adt , then how to implement stack? Stack is called as abstract data type, which is nothing but an interface.Then why stack comes under data structures topic.Is this a data structure or abstract data type?Is both are same or different?

A: From Wikipedia:

Abstract data types are purely theoretical entities, used (among other things) to simplify the description of abstract algorithms, to classify and evaluate data structures
In computer science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently
One way of describing the stack is as a last in, first out (LIFO) abstract data type and linear data structure. A stack can have any abstract data type as an element, but is characterized by two fundamental operations, called push and pop (or pull).

So, it can be concluded that Abstract Data Types are theoretical but when realized are called data structures.
To be more clear:
A data type can be considered abstract when it is defined in terms of operations on it, and its implementation is hidden (so that we can always replace one implementation with another for, e.g., efficiency reasons, and this will not interfere with anything in the program).

A: Stack is a  abstract data type and  it is also called linear data structure.It follows last in, first out (LIFO) strategy.so its a part of data structure...

A: An abstract data type (ADT) is a theoretical set of specifications of a data set and the set of operations that can be performed on the data within a set. A data type is termed abstract when it is independent of various concrete implementations.
let's say Integer supports addition, multiplication,division operations.
These operations won't work on String data since they cannot support multiplication.hence Integer is not ADT.
now u get the point,
If your operations on data types don't care about the type of data its called Abstract Data Structure.e.g Stack,list,queue…here these things supports operations like push(),pop(),add(),delete() Not caring about what we push,pop,delete.
Here depending upon the type of Implementation (List,Stack,Queue) we get to decide how those ADT are managed.
Why Stack is abstract data type?
`Stack s = new Stack<>();
List l = new LinkedList<>();
s.push(45);
s.push("str");
//s.push("String");
if(s.peek().equals(45)){
    System.out.println("Treu");
}`

I don't think any more explanation needed.

A: stack and queue are referred as abstract datatype because in stack there are, mainly two operations push and pop and in queue there are insertion and deletion. Which are  when operated on any set of data then it is free from that which type of data that must be contained by the set.
For example when we convert from infix (i,e, a+b) to postfix expression (i.e, ab+) then it the set may be contain parenthesis or set of digits or set of characters or combination of three.
so that's why stack and queue are referred as abstract data type .


text:
Q: How to make a block take the remaining width with flexbox So I have the layout close to this one:
.wrapper
  .flex
    .flex-item.first
    .flex-item.last
      %p

and css close to this:
.wrapper {
  min-width: 1100px
  max-width: 1300px
}

.flex {
  display: flex
}

.flex-item.first {
  flex: 0 0 250px;
}

.flex-item.last {
  flex-grow: 5
}

p {
  word-wrap: break-word;
}

and what I am trying to achieve is to make the last flex-item take the remaining width and it works fine, almost ...
If I put a long string in the paragraph tag, I expect it to take the width of the parent and if the line is too long, to transfer text to the next line and it works just like that in Chrome, but in Firefox, this long string makes the second flex-item go outside the allowed width, making it more than 1300px and thus breaking the layout...
PS
1)I tried floating the first item to left and adding overflow to the last item and it worked ok ( not without complications ) but flexbox seems easier to work with, I guess ...
2) The number 5 for flex-grow is random, just made it big enough to make it take the remaining space
Link to Fiddle: https://jsfiddle.net/afj88pc5/

A: Use following css will works:
p {
    word-wrap: break-word;
    word-break: break-all;
}

Check your updated Fiddle here.


text:
Q: how to fix:My fonts & all wordpress icons that used by @font-face are suddenly disabled how to fix:My fonts & all wordpress icons that used by @font-face are suddenly disabled
icons(define by @font-face) appear as rectangles and fonts(define by @font-face) does not work
I updated the template but it didn't work
the theme is movedo wordpress template

A: The most common cause of FontAwesome icons disappearing in a WordPress installation is caching plugins. Try to disable all caching plugins and test again.
Additionally you need to ensure that the two URLs found inside of WP > Settings > General are identical.
If that fails, please provide a link where your code appears so that we can at least try to help you.


text:
Q: System normalizer of a group If $\Sigma$ is a Hall system of a group $G$, the subgroup $N_G(\Sigma) = \{g\in G | H = H^g \;\text{for all} \;H\in \Sigma \}$ is called the normalizer of $\Sigma$
Suppose that $G$ is a finite soluble group. Let $\{p_1,\ldots,p_k \}$ be the set of prime divisors of $|G|$ and $K = \{ G, Q_1, Q_2,\ldots, Q_k\}$ be the set of Hall $p_i'$-subgroups
Show that $N_G(\Sigma) = N_G(K) := \displaystyle\bigcap_{i=1}^{k}
N_G(Q_i)$
My approach: I have shown that $K$ is contained in $\Sigma$ hence $N_G(K) \leq N_G(\Sigma)$
For the other inclusion, let $g\in N_G(\Sigma)$ then $H = H^g$ for all $H\in \Sigma$. Thus $g\in N_G(H)$ for all $H\in \Sigma$.
I know each $H \in \Sigma$ is of the form $H = \bigcap Q$ for some $Q_i$'s from $K$


text:
Q: $\int_{1}^{\infty}\frac{\ln x}{x^2-1}dx=\frac{\pi^2}{8}$ $$\int_{1}^{\infty}\frac{\ln x}{x^2-1}dx=\frac{\pi^2}{8}$$
My working:
$$\int_{1}^{\infty}\frac{\ln x}{x^2-1}dx=\int_{0}^{1}\frac{\ln x}{x^2-1}dx=-\sum_{r\ge 1}\int_0^{1}x^{2r}\ln x\,dx =\sum_{r\ge 1}\frac {1}{(2r-1)^2}=
\frac{\pi^2}{8}$$
Is there any other approach?

A: \begin{align}J&=\int_{0}^{1}\frac{\ln x}{x^2-1}dx\\
&=\frac{1}{4}\int_{0}^{1}\frac{2x\ln(x^2)}{1-x^2}dx-\int_{0}^{1}\frac{\ln x}{1-x}dx\\
\end{align}
In the first integral perform the change of variable $y=x^2$,
\begin{align}J&=\frac{1}{4}\int_{0}^{1}\frac{\ln x}{1-x}dx-\int_{0}^{1}\frac{\ln x}{1-x}dx\\
&=-\frac{3}{4}\int_{0}^{1}\frac{\ln x}{1-x}dx\\
&=-\frac{3}{4}\zeta(2)\\
&=-\frac{3}{4}\times -\frac{\pi^2}{6}\\
&=\frac{\pi^2}{8}\\
\end{align}
NB:
I assume that,
\begin{align} \zeta(2)=\frac{\pi^2}{6}\\
\end{align}
And,
\begin{align}\int_{0}^{1}\frac{\ln x}{1-x}dx&=\int_0^1\left(\sum_{n=0}^\infty x^n\right)\ln x\,dx\\
&=\sum_{n=0}^\infty \int_{0}^{1}x^n\ln x\,dx\\
&-=\sum_{n=0}^\infty\frac{1}{(n+1)^2}\\
&=-\zeta(2)
\end{align}
For $0\leq x<1$,
\begin{align}
\frac{1}{x^2-1}=\frac{x}{1-x^2}-\frac{1}{1-x}
\end{align}

A: The substitution $x\mapsto\coth(x)$ works out quite well. From hereon we get
$$-\int_1^\infty\frac{\log(x)}{1-x^2}\mathrm dx=\int_\infty^0\log(\coth(x))\mathrm dx=\int_0^\infty\log(\coth(x))\mathrm dx$$
Since the hyperbolic cotangent is defined in terms of exponentials we may further rewrite this whole as
\begin{align*}
&\int_0^\infty\log(\coth(x))\mathrm dx=\int_0^\infty\log\left(\frac{e^x+e^{-x}}{e^x-e^{-x}}\right)\mathrm dx = \int_0^\infty\log\left(\frac{1+e^{-2x}}{1-e^{-2x}}\right)\mathrm dx\\
=&\int_0^\infty\log\left(1+e^{-2x}\right)-\log\left(1-e^{-2x}\right)\mathrm dx=\int_0^\infty\sum_{n=0}^\infty(-1)^{n+1}\frac{e^{-2nx}}{n}+\sum_{n=0}^\infty\frac{e^{-2nx}}{n}\mathrm dx
\end{align*}
Due the monotone dominate convergence theorem we are allowed to switch the order of integration and summation and integration which further gives us
\begin{align*}
&\int_0^\infty\sum_{n=0}^\infty(-1)^{n+1}\frac{e^{-2nx}}{n}+\sum_{n=0}^\infty\frac{e^{-2nx}}{n}\mathrm dx=\sum_{n=0}^\infty(-1)^{n+1}\int_0^\infty\frac{e^{-2nx}}{n}\mathrm dx+\sum_{n=0}^\infty\int_0^\infty\frac{e^{-2nx}}{n}\mathrm dx\\
=&\sum_{n=0}^\infty(-1)^{n+1}\left[-\frac{e^{-2nx}}{2n}\right]_0^\infty+\sum_{n=0}^\infty\left[-\frac{e^{-2nx}}{2n}\right]_0^\infty=\sum_{n=0}^\infty\frac{(-1)^{n+1}}{2n^2}+\sum_{n=0}^\infty\frac1{2n^2}=\frac12[\eta(2)+\zeta(2)]\\
=&\frac12\left[\frac{\pi^2}{12}+\frac{\pi^2}6\right]=\frac12\left[\frac{\pi^2}4\right]=\frac{\pi^2}8
\end{align*}

$$\therefore~\int_1^\infty\frac{\log(x)}{x^2-1}\mathrm dx~=~\int_0^\infty\log(\coth(x))\mathrm dx~=~\frac{\pi^2}8$$

$\zeta(s)$ and $\eta(s)$ are the Riemman Zeta Function and the Dirichlet Eta Function respectively. Their series definitions and the relation $\eta(s)=(1-2^{1-s})\zeta(s)$ were used aswell as the well-known value of $\zeta(2)$. Please ask if something is unclear. Overall it is just another way of gaining the series representation of your integral.
Basically it is the same question as here: Integral of $\ln(\tanh(x))$ since you get your value by multiplying the expression by minus one due the relation between the hyperbolic tangent and cotagent function.

A: I will provide two different methods. The first relies on properties of the polygamma function, the second converts the integral to a double integral first before evaluating it.
Let
$$I = \int_1^\infty \frac{\ln x}{x^2 - 1} \, dx.$$

Method 1 - A polygamma approach
By enforcing a substitution of $x \mapsto 1/x$ we see that
$$I = \int_0^1 \frac{\ln x}{x^2 - 1} \, dx.$$
From the following integral representation for the digamma function $\psi (x)$, namely
$$\psi (x + 1) = -\gamma + \int_0^1 \frac{1 - t^x}{1 - t} \, dt,$$
where $\gamma$ is the Euler–Mascheroni constant, on differentiating with respect to $x$ we have
$$\psi^{(1)} (x + 1) = - \int_0^1 \frac{t^x \ln t}{1 - t} \, dt.$$
Here $\psi^{(1)} (z)$ denotes the trigamma function. Substituting $t = u^2$, $dt = 2u \, du$ on finds
$$\psi^{(1)} (x + 1) = 4 \int_0^1 \frac{u^{2x + 1} \ln u}{u^2 - 1} \, du.$$
Setting $x = -1/2$ then yields
$$\int_0^1 \frac{\ln x}{x^2 - 1} \, dx = \frac{1}{4} \psi^{(1)} \left (\frac{1}{2} \right ).$$
Here the dummy variable $u$ has been reverted back to $x$.
To find the value for the trigamma function at $x = 1/2$ we note that for the polygamma function one has (see Eq. (16) here)
$$\psi^{(n)} \left (\frac{1}{2} \right ) = (-1)^{n + 1} n! (2^{n + 1} - 1) \zeta (n + 1).$$
Here $\zeta (z)$ denotes the Riemann zeta function. Setting $n = 1$ yields
$$\psi^{(1)} \left (\frac{1}{2} \right ) = 3 \cdot \zeta (2) = 3 \cdot \frac{\pi^2}{6} = \frac{\pi^2}{2}.$$
Thus
$$\int_1^\infty \frac{\ln x}{x^2 - 1} \, dx = \frac{1}{4} \cdot \frac{\pi^2}{2} = \frac{\pi^2}{8}.$$

Method 2 - Using a double integral
The problem the first method suffers from is its heavy reliance on a knowledge of the polygamma function. In this second approach, knowing any properties for the polygamma and zeta functions are completely avoided altogether.
Note that as
$$\int_0^\infty \frac{\ln x}{x^2 - 1} \, dx =  \int_0^1 \frac{\ln x}{x^2 - 1} \, dx + \int_1^\infty \frac{\ln x}{x^2 - 1} \, dx,$$
we have
$$I = \frac{1}{2} \int_0^\infty \frac{\ln x}{x^2 - 1} \, dx = \frac{1}{4} \int_0^\infty \frac{\ln (x^2)}{x^2 - 1} \, dx. \tag1$$
Observing that
$$\ln (x^2) = \int_0^\infty \left (\frac{x^2}{1 + x^2 t} - \frac{1}{1 + t} \right ) \, dt,$$
we can rewrite (1) as
\begin{align}
I &= \frac{1}{4} \int_0^\infty \int_0^\infty \left (\frac{x^2}{1 + x^2 t} - \frac{1}{1 + t} \right ) \frac{1}{x^2 - 1} \, dt \, dx\\
&= \frac{1}{4} \int_0^\infty \frac{1}{1 + t} \int_0^\infty \frac{1}{1 + x^2 t} \, dx \, dt,
\end{align}
after the order of integration has been changed. Evaluating we have
\begin{align}
I &= \frac{1}{4} \int_0^\infty \frac{1}{\sqrt{t} (1 + t)} \big{[} \tan^{-1} (x \sqrt{t}) \big{]}_0^\infty \, dt\\
&= \frac{\pi}{8} \int_0^\infty \frac{dt}{\sqrt{t} (1 + t)}\\
&= \frac{\pi}{4} \int_0^\infty \frac{dy}{1 + y^2} \qquad \text{(let $t = y^2$)}\\
&= \frac{\pi}{4} \big{[} \tan^{-1} y \big{]}_0^\infty\\
&= \frac{\pi}{4} \cdot \frac{\pi}{2}\\
&= \frac{\pi^2}{8},
\end{align}
as expected.


text:
Q: What do to change color of placehold with Javascript

<input type="type" placeholder="Enter...">

What do to change color of placehold with Javascript.

A: You can use the ::placeholder CSS selector to set the color (and other CSS properties of an element's placeholder).

.redPlaceholder::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
    color: red;
    opacity: 1; /* Firefox */
}

.redPlaceholder:-ms-input-placeholder { /* Internet Explorer 10-11 */
    color: red;
}

.redPlaceholder::-ms-input-placeholder { /* Microsoft Edge */
    color: red;
}
<input type="type" class="redPlaceholder" placeholder="Enter...">

To change the placeholder's color with Javascript, you can add a class to the input with Javascript that sets the color of the placeholder.

.redPlaceholder::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
        color: red;
        opacity: 1; /* Firefox */
    }

    .redPlaceholder:-ms-input-placeholder { /* Internet Explorer 10-11 */
        color: red;
    }

    .redPlaceholder::-ms-input-placeholder { /* Microsoft Edge */
        color: red;
    }
<input type="text" class="" placeholder="Enter.."/>
<p/>
<button onClick="changeColor()">Change Placeholder Color</button>
<script>
var input = document.querySelector('input');
function changeColor(){
  if(input.classList.contains("redPlaceholder")){
    input.classList.remove("redPlaceholder");
  } else {
    input.classList.add("redPlaceholder");
  }
}
</script>


text:
Q: Toolkit not initialized Java FX I am getting the follow error when I run a JavaFx application as "Run" only. Debug works fine...
Exception in thread "main" java.lang.ExceptionInInitializerError
    at Goose.Program.<clinit>(Program.java:26)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:123)
Caused by: java.lang.IllegalStateException: Toolkit not initialized
    at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:273)
    at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:268)
    at com.sun.javafx.application.PlatformImpl.setPlatformUserAgentStylesheet(PlatformImpl.java:550)
    at com.sun.javafx.application.PlatformImpl.setDefaultPlatformUserAgentStylesheet(PlatformImpl.java:512)
    at javafx.scene.control.Control.<clinit>(Control.java:87)
    ... 4 more

I have read that you should subclass Application but I am already doing that so I am not sure why it doesn't work... It works fine if I debug but as soon as I try to run the application instead of debugging it, it throws that error message. Which is a little crazy.... Anyone have any idea what the heck is going on? Here is the code.
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCode;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;

public class Program extends Application{
    TextField input;
    GameServer gm;
    Player p = new Player();

    /**
     * Just starts our GameServer
     */
    public static void main(String[] args) throws Exception {
        launch(args);
    }

    public static final TextArea textArea = new TextArea();

    @Override
    public void start(Stage primaryStage) {
        p.setState(Player.States.Ready);
        p.setAccess(Player.AccessStatus.GameMaster);
        input = new TextField();
        input.setPrefWidth(500);
        input.setOnKeyPressed(event -> {
            if(event.getCode().equals(KeyCode.ENTER)){
                textArea.appendText("Command: " + input.getText() + "\n");
                handleEvent(input);
                input.setText("");
            }
        });

        GridPane gridPane = new GridPane();
        gridPane.setAlignment(Pos.CENTER);
        gridPane.setHgap(10);
        gridPane.setVgap(10);
        gridPane.add(input, 0, 0, 2, 1);
        gridPane.add(textArea, 0,2, 2, 1);

        Scene scene = new Scene(gridPane, 530, 250);
        primaryStage.setMaxWidth(540);
        primaryStage.setMaxHeight(280);
        primaryStage.setMinWidth(540);
        primaryStage.setMinHeight(280);
        primaryStage.setTitle("My Server");
        primaryStage.setScene(scene);
        primaryStage.show();
        primaryStage.setOnCloseRequest(we -> {
            try {
                textArea.appendText("Shutting down server...");
                if(gm.gameworld.getRunning()) {
                    gm.gameworld.setRunning(false);
                    Thread.sleep(2000);
                }
                System.exit(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        run();
    }

    public void run(){
        try {
            GameServer gameServer = new GameServer();
            this.gm = gameServer;
            gameServer.start();
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public void handleEvent(TextField textField){
        try {
            String eventKey = textField.getText().trim();
            Event e = gm.gameworld.getEventHandler().stringToEvent.get(eventKey);
            if(e != null) {
                e.setPlayer(p);
                e.ready(gm.gameworld);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

A: There is a 'public void init() throws Exception' method in Application class whose documentation says:
"The application initialization method. This method is called immediately after the Application class is loaded and constructed. An application may override this method to perform initialization prior to the actual starting of the application". "NOTE: This method is not called on the JavaFX Application Thread. An application must not construct a Scene or a Stage in this method. An application may construct other JavaFX objects in this method."
So, I suppose that you should move: p = new Player(); and
textArea = new TextArea(); to it.


text:
Q: Don't load IntertitialAd, where did i go wrong? InterstitialAd minterstitialAd;

protected void onCreate(Bundle savedInstanceState) {
minterstitialAd = new InterstitialAd(this);
        minterstitialAd.setAdUnitId(" ca-app-pub-XXXX/XXX");
        AdRequest adRequest1 = new AdRequest.Builder().build();
        minterstitialAd.loadAd(adRequest1);
}
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.ayarlar_menu) {
         minterstitialAd.show();
     }
}

Don't load Ad. I add this code Work this code.  Why Don't load my Ad? please help me. I try 3 days to resolve
minterstitialAd.setAdListener(new AdListener() {
            @Override
            public void onAdFailedToLoad(int errorCode) {
                txtsum.setText("asdas");
            }
        });

A: 1) In my case, interstitial ad don't showing because I used test ID for it. After I change it to normal ID problem gone.
2) Before showing interstitial ad, check if it was already loaded. Maybe it still loading when you try to call it?


text:
Q: Can't start localstack on macOS Using Python 3.7.10 and pip 21.1.2
Installed localstack by pip install localstack.
Ran command localstack start to start, got
WARNING:localstack.services.plugins: Service "s3" not yet available, retrying...

On the document, there is a notice like

(Note that on MacOS you may have to run TMPDIR=/private$TMPDIR localstack start --docker if $TMPDIR contains a symbolic link that cannot be mounted by Docker.)

But I ran this command again:
TMPDIR=/private$TMPDIR localstack start --docker

got this error:
Traceback (most recent call last):
  File "/opt/code/localstack/localstack/services/plugins.py", line 102, in check_infra
    check_service_health(api=name, print_error=print_error)
  File "/opt/code/localstack/localstack/services/plugins.py", line 121, in check_service_health
    raise e
  File "/opt/code/localstack/localstack/services/plugins.py", line 117, in check_service_health
    plugin.check(expect_shutdown=expect_shutdown, print_error=print_error)
  File "/opt/code/localstack/localstack/services/plugins.py", line 45, in check
    return self.check_function(expect_shutdown=expect_shutdown, print_error=print_error)
  File "/opt/code/localstack/localstack/services/s3/s3_starter.py", line 44, in check_s3
    assert isinstance(out['Buckets'], list)
TypeError: 'NoneType' object is not subscriptable

On the office issue, somebody said remove HOSTNAME from environment. I didn't set it, is it the key reason?
Why this famous issue happened? (And always?)

output errors when use docker-compose
localstack    | During handling of the above exception, another exception occurred:
localstack    |
localstack    | Traceback (most recent call last):
localstack    |   File "/opt/code/localstack/localstack/services/plugins.py", line 102, in check_infra
localstack    |     check_service_health(api=name, print_error=print_error)
localstack    |   File "/opt/code/localstack/localstack/services/plugins.py", line 121, in check_service_health
localstack    |     raise e
localstack    |   File "/opt/code/localstack/localstack/services/plugins.py", line 117, in check_service_health
localstack    |     plugin.check(expect_shutdown=expect_shutdown, print_error=print_error)
localstack    |   File "/opt/code/localstack/localstack/services/plugins.py", line 45, in check
localstack    |     return self.check_function(expect_shutdown=expect_shutdown, print_error=print_error)
localstack    |   File "/opt/code/localstack/localstack/services/s3/s3_starter.py", line 44, in check_s3
localstack    |     assert isinstance(out['Buckets'], list)
localstack    | TypeError: 'NoneType' object is not subscriptable
localstack    |
localstack    | During handling of the above exception, another exception occurred:
localstack    |
localstack    | Traceback (most recent call last):
localstack    |   File "/opt/code/localstack/localstack/utils/cli.py", line 223, in main
localstack    |     subcommand['function'](argv, args)
localstack    |   File "/opt/code/localstack/localstack/utils/cli.py", line 61, in cmd_infra
localstack    |     start_infra_locally()
localstack    |   File "/opt/code/localstack/localstack/utils/bootstrap.py", line 377, in start_infra_locally
localstack    |     return infra.start_infra()
localstack    |   File "/opt/code/localstack/localstack/services/infra.py", line 388, in start_infra
localstack    |     raise e
localstack    |   File "/opt/code/localstack/localstack/services/infra.py", line 374, in start_infra
localstack    |     thread = do_start_infra(asynchronous, apis, is_in_docker)
localstack    |   File "/opt/code/localstack/localstack/services/infra.py", line 460, in do_start_infra
localstack    |     thread = start_api_services()
localstack    |   File "/opt/code/localstack/localstack/utils/analytics/profiler.py", line 156, in wrapped
localstack    |     return f(*args, **kwargs)
localstack    |   File "/opt/code/localstack/localstack/services/infra.py", line 449, in start_api_services
localstack    |     check_infra(apis=apis)
localstack    |   File "/opt/code/localstack/localstack/services/plugins.py", line 111, in check_infra
localstack    |     check_infra(retries - 1, expect_shutdown=expect_shutdown, apis=apis, additional_checks=additional_checks)
localstack    |   File "/opt/code/localstack/localstack/services/plugins.py", line 111, in check_infra
localstack    |     check_infra(retries - 1, expect_shutdown=expect_shutdown, apis=apis, additional_checks=additional_checks)
localstack    |   File "/opt/code/localstack/localstack/services/plugins.py", line 111, in check_infra
localstack    |     check_infra(retries - 1, expect_shutdown=expect_shutdown, apis=apis, additional_checks=additional_checks)
localstack    |   [Previous line repeated 7 more times]
localstack    |   File "/opt/code/localstack/localstack/services/plugins.py", line 109, in check_infra
localstack    |     raise e
localstack    |   File "/opt/code/localstack/localstack/services/plugins.py", line 102, in check_infra
localstack    |     check_service_health(api=name, print_error=print_error)
localstack    |   File "/opt/code/localstack/localstack/services/plugins.py", line 121, in check_service_health
localstack    |     raise e
localstack    |   File "/opt/code/localstack/localstack/services/plugins.py", line 117, in check_service_health
localstack    |     plugin.check(expect_shutdown=expect_shutdown, print_error=print_error)
localstack    |   File "/opt/code/localstack/localstack/services/plugins.py", line 45, in check
localstack    |     return self.check_function(expect_shutdown=expect_shutdown, print_error=print_error)
localstack    |   File "/opt/code/localstack/localstack/services/s3/s3_starter.py", line 44, in check_s3
localstack    |     assert isinstance(out['Buckets'], list)
localstack    | TypeError: 'NoneType' object is not subscriptable
localstack    |
localstack    | ERROR: 'NoneType' object is not subscriptable
localstack    | (. .venv/bin/activate; exec bin/localstack start --host)
localstack    | make: *** [Makefile:55: infra] Error 1
localstack    | Waiting for all LocalStack services to be ready
localstack    | Starting local dev environment. CTRL-C to quit.
localstack    | 2021-10-06 06:09:13,229 INFO success: infra entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
localstack    |
localstack    | LocalStack version: 0.12.12
localstack    | LocalStack Docker container id: 388ad2388117
localstack    | LocalStack build date: 2021-06-07
localstack    | LocalStack build git hash: ea4dcf40

A: Alternatively, You can start localstack using docker-compose. Create docker-compose.yml file as given below and use this command docker-compose up to  get started with localstack perfectly. Once localstack is up and running, you can also check the health of all the services by hitting url as http://localhost:4566/health
Prerequisites:

*

*Have Docker installed, if you haven't already.

version: "3.8"
services:
  localstack:
    container_name: "${LOCALSTACK_DOCKER_NAME-localstack}"
    image: localstack/localstack
    hostname: localstack
    networks:
      - test-net
    ports:
      - "4566:4566"
    environment:
      - SERVICES=s3,sqs,cloudformation,iam,cloudwatch
      - DEBUG=1
      - DATA_DIR=/tmp/localstack/data
      - LAMBDA_EXECUTOR=docker-reuse
      - LAMBDA_REMOTE_DOCKER=false
      - LAMBDA_REMOVE_CONTAINERS=true
      - DOCKER_HOST=unix:///var/run/docker.sock
      - HOST_TMP_FOLDER=${TMPDIR}
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
networks:
  test-net:
    external: false
    driver: bridge
    name: test-net

Follow this guide to know more


text:
Q: Телега бот на PHP Всем привет. Телеграм бот на php. Бот простой пару кнопок с текстом и галерея с инлайн кнопками.
Работа стандартная через запрос фото 'photo', отрывок кода:
    if (isset ($message["photo"]) && $tg->isMaster()) {
//обработка получения фото
$file_id = $message["photo"][sizeof($message["photo"]) - 1]["file_id"];
$hash = '"' . md5($file_id) . '":';
$file_id = '"' . $file_id . '"';
$hash .= $file_id;
if (filesize('json/photos.json') != 0) {
    $file_id = ",$file_id";
    $hash = ",$hash";
}

отображение через запрос в json/photos.json. Так вот запрос это стандартный запрос в API телеги, могу ли я сделать второй запрос типа photo1, например, и грузить еще одни фотки в вторую галерею в другой файл, а потом из него показывать?
Может быть кто-то имел опыт работы с API телеги и с ботами?


text:
Q: How to pass data class which implements an interface as parameter to an inherited function? [Kotlin] I have an interface like this.
interface MenuOption {
    val name: String
}

Another data class which implements the above.
data class XYZMenuOption (override val name: String) : MenuOption

I have a parent class like this.
class MenuWidget {
    fun listener (options: MenuOption) {}
}

And this second class inherits it. This class overrides the listener function but should take the implemented data class as parameter.
class XYZMenuWidget: MenuWidget {
   override fun listener (options: XYZMenuOption) {}
}

However, the problem is that I can't use XYZMenuOption as a replacement for MenuOption. My idea was that both MenuOption and MenuWidget be very generic and that I can implement them to suit specific menu options wherever needed.

A: You can't change parameter type when overriding parent function. You have 2 options in such case depending on what your end goal is:

*

*Make use of generics in case you want your XYZMenuWidget to only accept XYZMenuOption:
interface MenuOption {
   val name: String
}

data class XYZMenuOption (override val name: String) : MenuOption

// You must make class open in other to extend from it
open class MenuWidget<T : MenuOption> {

// You must make function open in other to override!
    open fun listener (options: T) {}
}

class XYZMenuWidget(): MenuWidget<XYZMenuOption>() {
    // Listener now only accepts XYZMenuOption
    override fun listener (options: XYZMenuOption) {}
}

*Use same type as in parent class (in case you want listener to be called with any implementation of MenuOption:
interface MenuOption {
    val name: String
}

data class XYZMenuOption (override val name: String) : MenuOption

// You must make class open in other to extend from it
open class MenuWidget {

    // You must make function open in other to override!
    open fun listener (options: MenuOption) {}
}

class XYZMenuWidget(): MenuWidget() {
    override fun listener (options: MenuOption) {}
}


text:
Q: Overriding configuration options for unattended-upgrades I have several Ubuntu servers which I want to have all upgrades applied automatically. I used to use a simple script which ran apt-get update && apt-get upgrade but that wasn't very robust, so I'm trying to migrate to unattended-upgrades instead, which seems to be the officially recommended way of doing this.
However, I'm struggling to achieve the following tasks:

*

*How to get an email every day (assuming unattended-upgrades runs every day). At the moment I only seem to get emails when packages are upgraded (I prefer to get an email every day as that way I know if the email doesn't arrive, something has gone wrong).

*How to upgrade all packages, not just those with security updates.

All the tutorials I can find, including the official Ubuntu documentation, tell me to edit the existing files in /etc/apt/apt.conf.d. However, I prefer to override options using additional files, partly so that I don't get a 'configuration file differs from maintainer' error later and also because this makes it easier to keep all the overrides in configuration management and version control.
Is it possible to override all the configuration options in this way? I've tried doing this and have found that some overrides seem to work whilst others don't.
My current overrides files is at /etc/apt/apt.conf.d/99zz-overrides (named to make sure it's read last) and contains the following:
Unattended-Upgrade::Mail "hello@example.org";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

I haven't changed anything else in /etc/apt/apt.conf.d.

A: So if you want to:

*

*use unattended-upgrades
and

*to change its behaviour
and

*not to change the package scripts inside unattended-upgrades themselves

(so basically have your cake and eat it too ;-) )
You'll have to:

*

*cron a daily script

*that greps today's date in var/log/dpkg.log

*sends you an email every day

if the email is empty: nothing happened, otherwise you'll have the log so all the empty and full emails together is what you asked for.

A: Drawing from https://gist.github.com/roybotnik/b0ec2eda2bc625e19eaf and https://wiki.debian.org/UnattendedUpgrades:
The file /etc/apt/apt.conf.d/50unattended-upgrades contains all the options available for its configuration and an explanation of each.
There does not seem to an option to send an email each time it is run, only when there are upgrades or problems. You can, however, set whether you want emails for all upgrades, or only problems (Unattended-Upgrade::MailOnlyOnError ["true"/"false"]
To answer the second part of your question, you can set the sources that unattended-upgrades will use as follows:
Unattended-Upgrade::Allowed-Origins {
        "${distro_id}:${distro_codename}-security";
//      "${distro_id}:${distro_codename}-updates";
//      "${distro_id}:${distro_codename}-proposed";
//      "${distro_id}:${distro_codename}-backports";
};

By uncommenting the updates or other lines, you would automatically update those corresponding sets of packages.


text:
Q: probability at any point vs probability known location I am trying to compute a false alarm probability of a measurement. I have images so the (i,j) indexes of my image arrays are physical positions. I measure a signal at position (i0,j0).
In order to estimate the false alarm probability I check pixels which I selected to be comparable to the (i0,j0) pixel and count how many times a signal above 2 sigma is detected. This gives me the probability of my signal being a false alarm: e.g. out of 1 000 000 pixel 360 have a above 2 sigma detection (I think this is correct?).
Now I would like to include that I know where the signal is supposed to happen. Something like 'Knowing that 360 pixels of 1 000 000 pixel show a significant detection, what is the probability to measure such a significant signal exactly at position (i0,j0)?'


text:
Q: Why can we use a forward declared function but not instantiate a forward declared class? While reading this post I was wondering why calling a function previously forward-declarated is possible like in this example
int f(int x, int y); // forward declaration

int main()
{
    return f(2,3);
}

int f(int x, int y)
{
    return x + y;
}

but instantiating or calling a member variable of a class previously forward-declared is not possible like in the example
class Foo; // forward declaration

int main()
{
    Foo foo;
    return 0;
}

class Foo
{
    int x = 3;
};

My thaughts are that a function is just like an address, which is defined when the forward declaration is done (for example f() is assigned 0xABC). Then when parsing the return f(x,y) line the compiler just injects that address 0xABC in the binary code and then later when parsing the declaration of the function the compiler start inputting the instruction starting from address 0xABC.
However, when parsing the class Foo forward declaration if the compiler assigns to that class to some memory say 0xDEF, then when it parses Foo foo it will not know how much space to allocate since all the members of the class were not defined yet so the compiler doesn't know how much space to allocate in total
I don't really know anything about compilers, so is this correct?

A: Your assumptions are mostly correct, but you don't need to think about how compilers work.
By forward declaring a function, you make its signature available to the rest of the code. This means its name, return value, and parameter types are known, and that's all you need syntactically to call that function.
By forward declaring a class, you only make it known that its name refers to a type. That enables you to use it in various contexts. For example, you can declare (but not define) a function with that class as a parameter type or as the return type. Or you can define a pointer to that class, because the type a pointer points to doesn't matter as long as you don't try to dereference it. Or you can use it as argument to a typename in a template, as long as that template doesn't actually use it (but it could define a pointer to it or declare a function with it as parameter type and so on).
Knowing only that some particular name refers to a class, you cannot deduce anything about its contents (and yes, its size) or how to actually use it.


text:
Q: dataset. It is giving error. "mscorlib.dll Error: Index was out of range. Must be non-negative and less than the size of the collection." I want to show data is datagrid table rows. DATASET shows that it has found 4 record as per my query but it is giving subject error. I have to calculate data of different columns and it needs to be saved in database.
this is the complete code.
immediate help is appreciated.
enter code here

Dim YearTotal As Double
    Dim ArrowChk As Boolean = False

    Dim mvuserid = "Adnan"

    ' If rs.State = adStateOpen Then rs.Close()

    ' Call GET_ACTUAL_BALANCES("AAA", "2015001", "2015003")

    FgData.Enabled = True
    FgData.RowCount = 25

    Call Clear_Grid()


text:
Q: Integrate Apache Jersey for REST web services with a struts2 web apllication I have a web application which has used struts2 framework. I want to add support of REST web services to it using Apache Jersey. I have configured by application but I am getting 404 error while tring to run web services. I have searched on internet and found that filter intercepts all requests, making servlet mapping useless. I also found solution by excluding the url pattern by configuring struts.xml but still there is same problem of 404 not found. I am attaching my code below.
Thanks in advance.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
  <display-name>ocmsLatest</display-name>
  <context-param>
    <param-name>quartz:config-file</param-name>
    <param-value>/quartz.properties</param-value>
  </context-param>
  <context-param>
    <param-name>quartz:shutdown-on-unload</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>quartz:wait-on-shutdown</param-name>
    <param-value>false</param-value>
  </context-param>
  <context-param>
    <param-name>quartz:start-scheduler-on-load</param-name>
    <param-value>true</param-value>
  </context-param>
  <listener>
    <listener-class>
             org.quartz.ee.servlet.QuartzInitializerListener
         </listener-class>
  </listener>
  <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <context-param>
    <param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
    <param-value>/WEB-INF/tiles.xml</param-value>
  </context-param>
  <listener>
    <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
  </listener>
  <session-config>
    <session-timeout>30</session-timeout>
  </session-config>
  <welcome-file-list>
    <welcome-file>/pages/user/index.jsp</welcome-file>
  </welcome-file-list>
  <jsp-config>
    <jsp-property-group>
      <url-pattern>*.jsp</url-pattern>
      <trim-directive-whitespaces>true</trim-directive-whitespaces>
    </jsp-property-group>
  </jsp-config>
  <servlet>
    <description></description>
    <display-name>InitServlet</display-name>
    <servlet-name>InitServlet</servlet-name>
    <servlet-class>com.ocms.util.InitServlet</servlet-class>
    <load-on-startup>0</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>InitServlet</servlet-name>
    <url-pattern>/InitServlet</url-pattern>
  </servlet-mapping>
  <servlet>
    <servlet-name>Captcha</servlet-name>
    <servlet-class>com.roseindiaCaptcha.servlet.RoseIndiaCaptcha</servlet-class>
    <init-param>
      <description>passing height</description>
      <param-name>height</param-name>
      <param-value>60</param-value>
    </init-param>
    <init-param>
      <description>passing width</description>
      <param-name>width</param-name>
      <param-value>200</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>Captcha</servlet-name>
    <url-pattern>/Captcha.jpg</url-pattern>
  </servlet-mapping>
  <error-page>
    <error-code>404</error-code>
    <location>/pages/error404.jsp</location>
  </error-page>
    <servlet>
  <servlet-name>Jersey REST Service</servlet-name>
<servlet-class>
  com.sun.jersey.spi.container.servlet.ServletContainer
</servlet-class>
  <init-param>
    <param-name>com.sun.jersey.config.property.packages</param-name>
    <param-value>com.ocms.rest</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
  <servlet-name>Jersey REST Service</servlet-name>
  <url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>

struts.xml
<struts>
    <constant name="struts.action.excludePattern" value="/rest/.*" />
    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
    <constant name="struts.devMode" value="false" />
    <constant name="struts.custom.i18n.resources" value="com.ocms.app.resources.Resources" />
    <constant name="struts.multipart.maxSize" value="104857600000" />
//all action mappings
</struts>

Hello.java
package com.ocms.rest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/hello")
public class Hello {
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String sayHello() {
        return "Hello Jersey";
    }
}

A: I have changed the FilterDispatcher, org.apache.struts2.dispatcher.FilterDispatcher to org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter and then the problem was solved.


text:
Q: State Estimation of Steady Kalman Filter I am working with discrete Kalman Filter on a system.

x(k+1)=A_k x(k)+B_k u(k)
y(k)=C_k x(k)

I have estimated the state from the available noised y(k), which one is generated from the same system state equations with Reference Trajectory of the state. Then I have tested it with wrong initial state x0 and a big initial co-variance (simulation 1). I have noticed that the KF works very well, after a few steps the gain k quickly converges to a very small value near zero. I think it is may be caused by the process noise Q. I have set it small because the Q stands for the accuracy of the model.
Now I want to modify it to a steady state Kalman Filter. I used the steady gain from simulation-1 as constant instead of the calculation in every iteration. And then, the five equations can be simplified to one equation:

x(k+1)^=(I-KC)A x(k)^+(I-KC)B u(k)+K y(k+1)

I want to test it with same initial state and co-variance matrix as the one in simulation-1. But the result is very different from reference trajectory and even the result of simulation-1. I have tested it with the co-variance matrix p_infi, which is solved from the Discrete Riccati Equation:

k_infi=p_infiC'/(Cp_infi*C'+R)

This neither works.
I am wondering-

*

*How should I apply steady state KF and how should I set the initial state for it?

*Is steady state KF used for scalar system?

*Should I use it with LQ-controller or some others?

A: Let me first simplify the discussion to a filter with a fixed transition matrix, A rather then A_k above.  When the Kalman filter reaches steady-state in this case, one can extract the gains and make a fixed-gain filter that utilizes the steady-state Kalman gains.  That filter is not a Kalman filter, it is a fixed-gain filter.  It's start-up performance will generally be worse than the Kalman filter.  That is the price one pays for replacing the Kalman gain computation with fixed gains.
A fixed-gain filter has no covariance (P) and no Q or R.
Given A, C and Q, the steady-state gains can be computed directly.  Using the discrete Kalman filter model, and setting the a-posteriori covarance matrix equal to the propagated a-posteriori covariance matrix from the prior measurement cycle one has:
P = (I - KC) (A P A^T + Q)
Solving that equation for K results in the steady-state Kalman gains for fixed A, Q and C.
Where is R?  Well it has no role in the steady-state gain computation because the measurement noise has been averaged down in steady-state.  Steady-state means the state estimate is as good as it can get with the amount of process noise (Q) we have.
If A is time-varying, much of this discussion does not hold.  There is no assurance that a Kalman filter will reach steady-state.  There may be no Pinf.
Another implicit assumption in using the steady-state gains from a Kalman filter in a fixed gain filter is that all of the measurements will remain available at the same rates.  The Kalman filter is robust to measurement loss, the fixed-gain filter is not.

A: Steady state KF requires the initial state matches the steady state covariance. Otherwise, the KF could diverge. You can start using the steady state KF when the filter enters the steady state.
The steady state Kalman filter can be used for systems with multiple dimension state.


text:
Q: What is the physical interpretation of the Wick rotation? What is the physical interpretation of the Wick rotation?
How is it that we can just propose there's a new time coordinate tau? Are physicists saying time is modeled by an imaginary number? Isn't that at odds with the clocks we use everyday?

A: There's a couple of different points of view on what exactly it means.
Wick Rotation and diffusion
Even in the Schrodinger equation, Wick rotation has an interesting viewpoint. Namely, that Wick rotating the Schrodinger equation gives us the diffusion equation! More explicitly, the Schrodinger equation (say, with no potential) is given as
$$i\partial_t \psi + \nabla^2\psi = 0$$
Wick rotation of $t = i\tau$ gives
$$\partial_t \psi - \nabla^2\psi = 0$$
which is precisely the diffusion equation. So quantum propagation in real time is, roughly-speaking, diffusion in imaginary time!
Boltzmann statistics and the Hamiltonian
Remember from statistical mechanics that the partition function of a system at inverse temperature $\beta = 1/{k_B T}$ is given by
$$Z(\beta) = \Sigma_i e^{-\beta E_i}$$.
It turns out that this thermal quantity can be defined in terms of the Hamiltonian, namely that
$$Z(\beta) = Tr(e^{-\beta H})$$
where $\rho(\beta) = e^{\beta H}$ is the matrix known as the density matrix of the Hamiltonian. This density matrix is actually all we need to provide a complete description of the thermal properties of a quantum system.
Also note that $\rho(\beta)$ is closely tied together the time-evolution operator $U(t) = e^{iHt}$ by setting $\beta = -it$. This is closely tied together with what we said about diffusion earlier. Remember that a thermal system is an equilibrium notion about letting a system relax given some energy constraints. But the abstract mathematical standpoint is telling us that letting a system thermalize to an inverse temperature $\beta$ is the same thing as letting it evolve in imaginary time for a time $\beta$. But from before, we can see that evolving in imaginary time is the same as letting the system diffuse for a time $\beta$.
In particular, we can also say something about the ground state of the quantum system from this viewpoint. Mathematically speaking, if there is a unique ground state $|\psi>_{ground}$ at energy zero, then it can be obtained (in an unnormalized form) from any initial state $|\psi>_{0}$  with nonzero overlap from the ground state:
$$|\psi>_{ground} = \lim_{\beta \rightarrow \infty} e^{-\beta H} |\psi>_{0} $$
(which is a simple exercise that one should do.) So, from this viewpoint, the ground state of a system is obtained by letting the system evolve for an infinite amount of imaginary time from any starting point, or by letting it "diffuse" for an infinite amount of time.
Note that I've necessarily been a bit hand-wavy here. No one truly knows what the precise connection between diffusion and real-time evolution is apart from the mathematics, but presumably, it will be more clear once we understand what quantum mechanics truly is.
From a computational standpoint
Wick rotation just transforms a path integral into something that actually converges. To understand this point, it suffices to just look at a simple one dimensional integral
$$I(\alpha) := \int_{-\infty}^\infty e^{i \alpha x^2} dx$$
For $\alpha$ being a purely a real number, this integral does not converge, since the integrand has norm 1 at all $x$. But, if we shift $\alpha \rightarrow \alpha + i \epsilon$ for some small number $\epsilon$, then we the imaginary part forces the integrand to go to zero exponentially as $x\rightarrow \infty$, and will converge to $I(\alpha) = \sqrt{\frac{\pi}{-i \alpha}}$. From here, we see that we can evaluate the non-convergent integral $I(\alpha)$ by simply making $\alpha$ into a slighly imaginary number, which allows us to define the integral for $\alpha$ purely real.
The reason that this is important for quantum field theory is that the path integral
$$\int D\phi e^{iS[\phi]}$$
is an infinite dimensional integral. Moreover, a prototypical example of such an action looks like
$$S[\phi] = \int d^4x \phi(x)(-\partial_t^2 + \partial_x^2 + m^2)\phi(x)$$
The comparison point between this infinite dimensional integral and the finite dimensional one is that they are both quadratic matrices with imaginary eigenvalues all with real part bigger than zero. (The spectrum of the operator $(-\partial_t^2 + \partial_x^2 + m^2)$ turns out to satisfy this property.) So, evaluating the path integral in this case will give us an infinite number of nonconvergent integrals! Luckily, making the transformation $t = -i\tau$ will make the integral in terms of $\tau$ a convergent integral for real $\tau$ the lesson learned from the 1D case will allow us to evaluate it for a small imaginary.
The reason this silly-looking substitution works is because QFT's are holomorphic. This is typically an axiom of QFT's and means that any observable $<{O(x_1)...O(x_n)}>$ is a holomorphic function of the $x_i$. So, making time imaginary and continuing back to real time allows us to actually define finite quantities in the first place. An important caveat of this is that there are generically poles in these correlation functions, so we actually have to be careful in how we analytically continue.

A: Besides the nice answer by Joe, I would like to mention a noncommutative-geometry-inspired approach -- which is more 'geometric' in nature than 'physical' and attempts to arrive at an interpretation of the Wick rotation. Disclaimer: Now, one could, in principle, argue that 'geometry is physics' as in the sense of Einstein: 'geometry is gravity'. So take how 'physical' it is, at all, with a pinch of salt, as per your taste.
Noncommutative geometry à la Connes is defined by a spectral triple, which could be twisted by algebra automorphisms [1], [2]. Although the motivation for the twist was mathematical: to construct spectral triples for type III algebras [3], it quickly found applications in quantum groups, C*-dynamical systems, Standard Model and its extensions, cf. [4] and references therein.
The twisted noncommutative Standard model was intended for electroweak vacuum stability and fixing Higgs mass. Later twisting was found to naturally yield a Krein space (of Lorentzian spinors) and hinted at a tight link with Wick rotation [5]. In a recent paper, twisting Euclidean spectral triples and evaluating fermionic action induced on them by the twist has led to the derivation of Weyl and Dirac equations in Lorentzian signature [6].
In this setting, Wick rotation is something that naturally appears, at least at the action level, as a consequence of twisting Euclidean spectral triples. One might even go ahead and say that the transition to a Lorentzian geometry from a Euclidean one, in this sense, is a result of a (spontaneous?) symmetry-breaking: from a non-twisted geometry to a twisted one.


text:
Q: Where is max and min functions length to validate a string in superstructjs? In superstructjs how to check the min and max of string length? can't find it in the docs.
Also superstructjs provide min and max functions but it's date function.
Is it possible to do with superstructjs? or should I write my own custom function?

A: You can use size() for that.
const sizeStruct = size(string(), 3, 5);

assert('ab', sizeStruct); //Fail: Expected a string with a length between `3` and `5` but received one with a length of `2`

assert('abc', sizeStruct); // success

assert('abcdef', sizeStruct); // Fail: Expected a string with a length between `3` and `5` but received one with a length of `6`


text:
Q: Searching multiple mysql tables I currently have this code.
            switch($search_topic)
            {
                case 'Title':
                    $stmt = $dbh->prepare("SELECT game_id, title, platform_name, author_name, price
                                            FROM games
                                            WHERE title
                                            LIKE :search_term");
                break;

                case 'Platform':
                    $stmt = $dbh->prepare("SELECT game_id, title, platform_name, author_name, price
                                            FROM games
                                            INNER JOIN platforms ON games.platform_id = author.platform_id
                                            WHERE platform_name LIKE :search_term");
                break;
            }

the search_topic variable is coming from a listbox on the previous webpage, the Title search works correctly as its simply just search one MySQL table. The Platform search is being abit difficult as I'm attempting to search multiple tables, If that makes sense.
The games table has a column called "platform_id" this this links to the platform table where the key field links to what platform it is under. So how would I go about getting the "platform_id" from the games table and then link it to the "platforms" so I retieve the "platform_title" and then use that to search against.
Schema: http://sqlfiddle.com/#!2/3d3e3/6

A: Based off of your fiddle, here's the update for you:
SELECT g.game_id, g.title, p.platform_name, a.author_name, g.price
FROM games g
INNER JOIN platforms p ON p.platform_id = g.platform_id
INNER JOIN author a ON a.author_id = g.author_id
WHERE g.title LIKE 'Skyrim';

You would obviously change WHERE g.title LIKE 'Skyrim'; to whichever field you would like to filter on. So the platform query would be:
SELECT g.game_id, g.title, p.platform_name, a.author_name, g.price
FROM games g
INNER JOIN platforms p ON p.platform_id = g.platform_id
INNER JOIN author a ON a.author_id = g.author_id
WHERE p.platform_name LIKE 'Xbox';

I would also suggest that you change your CHARSET to utf8 instead of latin1, assuming this reflects your production database setup.

A: SELECT games.game_id,
games.title,
games.platform_name,
games.author_name,
games.price,
games.platform_id,
platforms.platform_id,
platforms.platform_name
FROM games, platforms
WHERE
games.platform_id = platforms.platform_id
AND
platform.platform_name LIKE %:search_term%


text:
Q: Android JNI with dlopen() instead of system.loadlib I can use System.loadLibrary(lib); In android java to load my shared library and use it. The problem with this current approach is that I can actually have two instances of my android application running.
Having two instances of my application with one shared library doesn't. I need two instances of my shared library. The good new is that from java I can find out if I am running either instance A or instance B. Sometimes I'll be running in instance A but still have to load instance B; doing this totally messes up the first instance.
What i've done so far is find out which instance I am running in and pass that to JNI then inside my .c file I load the .so with dlopen, now I have a handle to my shared library.
The java side:
        if(preview)
        {
            for (String lib : getLibraries()) {
                   nativeInitPreview(lib);
                }
        }
        else
        {
            for (String lib : getLibraries()) {
                nativeInitLive(lib);
                }
        }

the c code side:
static void *mainHandleLive = NULL;
static void *SDLHandleLive = NULL;

JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInitLive(JNIEnv* env, jobject instance, jstring lib)
{
    const char *libString = (*env)->GetStringUTFChars(env, lib, NULL);
    __android_log_print(ANDROID_LOG_INFO, "SDL", "Java_org_libsdl_app_SDLActivity_nativeInitLive %s", libString);
    (*env)->ReleaseStringUTFChars(env, lib, libString);

    mainHandleLive = dlopen("/data/app-lib/org.libsdl.app-1/libmain.so", RTLD_NOW | RTLD_LOCAL);
    if (mainHandleLive == 0)
    {
        __android_log_print(ANDROID_LOG_INFO, "SDL", "/data/app-lib/org.libsdl.app-1/libmain.so failed to open");
    }
    SDLHandleLive = dlopen("/data/app-lib/org.libsdl.app-1/libSDL2.so", RTLD_NOW | RTLD_LOCAL);
    if (SDLHandleLive == 0)
    {
        __android_log_print(ANDROID_LOG_INFO, "SDL", "/data/app-lib/org.libsdl.app-1/libSDL2.so failed to open");
    }

}

I have two questions, the initial post that lead me to this idea used a function prototype like this:
dlmopen(LM_ID_NEWLM, "path/to/lib", RTLD_NOW | RTLD_LOCAL);

on android compiling with LM_ID_NEWLM throws an LM_ID_NEWLM undeclared (first use in this function).
So I tried to use RTLD_LOCAL based on this question
I don't currently get any errors when compiling this project.
My question now is, how do I actually use these libs once they have been loaded from c code?

A: No you cannot use JNI if you don't use System.loadLibrary() or equivalent.


text:
Q: Difference test for beta–binomial variables Let $X \sim \textrm{Beta–Binomial}(\alpha_1, \beta_1, n)$ and $Y \sim \textrm{Beta–Binomial}(\alpha_2, \beta_2, n)$ and write $\mu_1 = \frac{\alpha_1}{\alpha_1 + \beta_1}$, $\phi_1 = \alpha_1 +\beta_1$, $\mu_2 = \frac{\alpha_2}{\alpha_2 + \beta_2}$, $\phi_2 = \alpha_2 +\beta_2$ for brevity. I have some samples $x_1, x_2, \ldots, x_k$ and $y_1, y_2, \ldots, y_k$ and want to test the null hypothesis $\mu_1 = \mu_2$. I am interested in all of the following cases, especially the third one:

*

*We know $\phi = \phi_1 = \phi_2$ in advance.

*We know that $\phi_1 = \phi_2$ but not the exact value.

*It is possible that $\phi_1 \ne \phi_2$.

I believe that in the limit $n \to \infty$, $\phi \approx n$, by approximating $X$ and $Y$ with appropriately scaled normal distributions, these situations correspond to the paired difference $Z$-test, Student's $t$-test and Welch's $t$-test, respectively. However, I am more interested in the cases when $n$ and $k$ are small, say $n = k = 10$. It would be very interesting if there was a workable solution for $n = 1$ (beta–Bernoulli distributions), but I doubt that.


text:
Q: Invoking JavaScript Method via COM Interface I am working on a project to interface Matlab and Google Earth Plugin.
My idea is to use COM interface, in which the MATLAB as COM-Client and Google Earth Plugin in Internet Explorer 9 as COM-Sever.
But until now, I still don't have idea how can I invoke a JavaScript method from MATLAB so that I can update the view of Google Earth in Internet Explorer.
Is it possible to invoke a JavaScript method via COM?
My second idea is to build a custom webbrowser based on InternetExplorer and then embedded custom COM methods and properties, so that it can function with Google Earth regarding the invoking from external application.
Any help would be highly appreciated.
Regards,
Wan

A: Looks like the only supported Google Earth API is the JavaScript API.  So your approach of embedding Internet Explorer for this sounds reasonable.
I'm not so familiar with the MATLAB end of things, but assuming you can embed the web browser control you should then be able to start invoking scripts.
At the lowest level, the IE web browser implements the IWebBrowser2 interface.  This interface exposes a Document property, which returns an IHTMLDocument2 interface.  Call IHTMLDocument2::parentWindow to get an IHTMLWindow2 interface.
Once you have the IHTMLWindow2, supposedly from my reading you have a couple options.  Your script can call IHTMLWindow2::execScript.  Alternatively, your top-level JavaScript functions should become available as methods on the IHTMLWindow2 interface via the inherited IDispatch: especially useful if you need the return value.
Some Delphi code that uses execScript:  http://www.delphidabbler.com/articles?article=21
Some .NET Framework code that uses IDispatch directly (see the commented-out more complicated code example):  http://www.west-wind.com/weblog/posts/2008/Sep/27/Calling-JavaScript-functions-in-the-Web-Browser-Control
To make a long story short, essentially you need to do this:
myWebBrowser.Document.parentWindow.MyJavaScriptFunction()
or this:
myWebBrowser.Document.parentWindow.execScript("MyJavaScriptFunction();", "JavaScript")


text:
Q: Axiom of Foundation implies that $V=V_\infty$ Here, $V$ denotes the class of all sets, and $V_\infty$ denotes the von Neumann universe. I've heard the claim a few times that Foundation implies that every set $x$ can be found in $V_\alpha$ for some $\alpha$, but I can't find a proof of this. Does anyone know of a proof?

A: It suffices to show that every transitive set belongs to $V_{\infty}$, indeed if we do prove this, let $x$ be any set, then $cl(x) \subset V_\alpha$ for some $\alpha$, and then since $x\subset cl(x)$, one gets $x\in V_{\alpha+1}$ (where $cl(x)$ denotes the transitive closure of $x$) .
So let $y$ be a transitive set and assume $y\notin V_{\infty}$.
Then one has that $y$ is not a subset of $V_{\infty}$ indeed otherwise the application that to $x\in y$ sends the least $\alpha$ such that $x\in V_\alpha$ would be well defined, and thus by the axiom scheme of replacement would have bounded range, and thus $y\in V_{\alpha+1}$ where $\alpha$ is an upper bound of this application.
Thus the set $z=\{x\in y\mid x\notin V_\infty\}$ is non empty, and thus by the axiom of foundation there is $x\in z$ such that $x\cap z =\emptyset$. But $x\in z$ so $x\in y$ so by transitivity of $y$, $x\subset y$, and so since $z\cap x=\emptyset$, $x\subset y\setminus z$, and thus $x\subset V_\infty$. But we've seen that this implies $x\in V_\infty$, so $x\notin z$ : a contradiction. Therefore $z$ is empty, and $y\subset V_\infty$, and so $y\in V_\infty$.
This concludes the proof.
A bit of thought will show you take the converse is true as well, i.e. if $V=V_\infty$ then the axiom of foundation holds