text:
Q: Fórmula en Excel con parámetros de rutas de archivos Tengo una hoja de cálculo de Excel (denominada Parámetros) donde asigno 3 parámetros:

A1 = Nombre archivo
A2 = Pestaña
B1 = C:\Carpeta[Nombre archivo.xlsx]
B2 = Hoja 1 A3=Valor
B3 = $A$10

Quiero crear una fórmula que concatene las tres celdas para obtener el valor de una celda de una hoja de otro archivo (los especificados en los parámetros anteriores) cuyo valor es 150.
Lo que hago es esta fórmula:

="'"&Parámetros!B1&Parámetros!B2&"'!"&Parámetros!B3

En lugar de devolverme el valor de esa celda, 150, lo que me devuelve es la concatenación de los valores especificados en la fórmula, es decir, me devuelve:

'C:\Carpeta[Nombre archivo.xlsx]Hoja 1'!$A$10

Si en la celda resultado selecciono la celda del archivo en cuestión, el resultado es correcto (150) y en la barra de fórmulas veo la siguiente fórmula:

='C:\Carpeta[Nombre archivo.xlsx]Hoja 1'!$A$10

¿Cómo hago para que devuelva el valor correcto y no la concatenación de los valores?
Muchas gracias.
Ampliando la pregunta, os paso una imágenes de como se ve en la hoja:
Estos son los datos o parámetros iniciales

Y esta es la hoja con la fórmula aplicada y el valor que muestra:

Es decir, en la celda E4 aparece el valor correcto (creado a partir de la fórmula directa ='D:\Documentación\Clientes\Excel Traspaso[VARIABLES DIC.xlsx]Hoja 1'!$A$11) y, en cambio, en la celda E5 la fórmula aplicada muestra la ruta pero no el valor.
¿Alguna otra sugerencia? Muchas gracias

A: Podrías utilizar la función INDIRECT o INDIRECTO, anexo un ejemplo y referencias al respecto:
Lo que hace esta función es convertir TEXTO en referencias de excel, por ejemplo si tienes el texto A1, podrías poner la formula: =INDIRECT('A1') para obtener el valor de esa celda en especifico, que en este caso sería equivalente a =A1

Te pongo otro ejemplo multiplicando valores obtenidos con al función INDIRECT:

En la imagen anterior si modificas el número de renglón veras como se actualizan los valores.

Anexo el ejemplo de excel: EjemploIndirect.xlsx
Por último te anexo la documentación de Microsoft al respecto:

INDIRECTO (función INDIRECTO)
*Se aplica a: Excel 2016 Excel 2013 Excel 2010 Excel 2007 Excel 2016
  para Mac Más... *
En este artículo se describen la sintaxis de la
  fórmula y el uso de la función INDIRECTO en Microsoft Excel.
Descripción
Devuelve la referencia especificada por una cadena de texto. Las
  referencias se evalúan de inmediato para presentar su contenido. Use
  INDIRECTO cuando desee cambiar la referencia a una celda en una
  fórmula sin cambiar la propia fórmula.
Sintaxis
INDIRECTO(ref; [a1])
La sintaxis de la función INDIRECTO tiene los siguientes argumentos:
Ref    Obligatorio. Una referencia a una celda que contiene una
  referencia de tipo A1 o F1C1, un nombre definido como referencia o una
  referencia a una celda como cadena de texto. Si ref no es una
  referencia de celda válida, INDIRECTO devuelve el valor de error
  #¡REF!.
Si ref hace referencia a otro libro (una referencia externa), el otro
  libro debe estar abierto. Si el libro de origen no está abierto,
  INDIRECTO devolverá el valor de error #¡REF!.
Nota    Las referencias externas no son compatibles con Excel Web App.
Si ref hace referencia a un rango de celdas fuera del límite de filas
  de 1.048.576 o del límite de columnas de 16.384 (XFD), INDIRECTO
  devolverá el error #¡REF!.
Nota    Este comportamiento es diferente al de otras versiones de
  Excel anteriores a Microsoft Office Excel 2007, que ignoran el límite
  superado y devuelven un valor.
A1    Opcional. Un valor lógico que especifica el tipo de referencia
  que contiene la celda ref.
Si a1 es VERDADERO o se omite, ref se interpreta como una referencia
  estilo A1.
Si a1 es FALSO o se omite, ref se interpreta como una referencia
  estilo F1C1.

Da clic para ver la función: INDIRECTO (función INDIRECTO)
Actualización(2017-01-11)
Aplicaste la formula de una manera incorrecta, INDIRECT debe ir después del = y no como un string o cadena de caracteres.
Te voy a explicar mas a detalle con un ejemplo parecido a lo que quieres hacer.
Descarga los archivos de ejemplo aquí

*

*Cree este archivo (en la ruta que tienes en la pregunta: D:\Documentación\Clientes\Excel Traspaso):

*

*Después en el segundo archivo tomo los valores del archivo VARIABLES DIC, según las configuraciones correspondientes:

*

*Se muestra que toma la información correspondiente:

Para esto hago uso de la función indirect y también de la función match que busca un valor en un rango de valores.  Busco el DNI del archivo Ejemplo.xlsx en el rango A1:A12 del archivo VARIABLE DIC.xlsx, la funcion match retorna el número de renglón dentro del rango, con este dato yo puedo armar bien el string de la formula y después usar indirect para traer el valor con la formula armada.  Se escucha mucho rollo, pero en realidad en sencillo y será necesario que descargues los archivos para ver las formulas funcionando.
Esta es la formula que utilizo para obtener en que renglón se encuentra un determinado DNI:
=MATCH(A11,INDIRECT("'"&$B$1 &$B$2&"'!"&$B$4),0)

Para obtener el valor de ese DNI utilizo la siguiente formula:
=INDIRECT("'"&$B$1 &$B$2&"'!"&$B$6&E11)

Por último pondré los pasos para que se vea un poco mas claro:

Toda esta información la puedes probar y ver los archivos de ejemplo que añadí.
Ejemplo.xlsx   y  VARIABLES DIC.xlsx
Actualización 2017-01-17
Abro el archivo Ejemplo.xlsx y es correcto lo que mencionas, se muestran las formulas como #REF!

Pero me doy cuenta que tienes una opción de seguridad:

y efectivamente no funciona si no esta abierto el otro archivo.

Lo que se me ocurre es que pongas el link al otro archivo y le des clic solo para que se abra.

Tuve que modificar un poco, separar ruta y archivo, porque el nombre de archivo entre "[]" corchetes no funciona para el link, asi que lo deje sin corchetes y en las formulas del INDIRECT se los puse como strings concatenados.
Te anexo el archivo con el link para abrir el otro workbook:
Ejemplo con link para abrir otro archivo
Al parecer lo que investigue es que no se puede sin tener abierto el otro archivo, lo que se me ocurre es poner el link como el ejemplo que anexe.  Saludos.


text:
Q: VB.NET: Scrollbar "button"? I plan on using a scrollbar for, well, scrolling an image. The image is 200x500, however, the only visible area is 200x250.
So I set the max value to 250, and the min value to 0. The idea is that if I drag the scrollbar's button to the bottom, 250 pixels will have moved for the image, right?
But wait, the scrollbar's button is.... very small. And the scrollbar is actually pretty long. Is there a way to make the scrollbar's button longer?

A: How did you create this scrollbar? Is it a separate control all together, or it is a component of another control? I do know that scrollbars added separately act kinda funny at times.
What I would suggest is using the scollbars built into another container control, which should achieve the exact same effect.

*

*Create a new panel control on your form, and name it. (I suggest something like panelPicture)

*Position the panel where you want your picture to be.

*Set the panel's size to 200x250.

*Set the panel's "Autoscroll" property to True.

*Put a PictureBox inside this panel, and name it. (I suggest something like picMyPicture.)

*Set the PictureBox's position to 0, 0.

*Set the PictureBox's size to 200x500 (or whatever is necessary).

*Set the PictureBox's Image property as desired.

Now, the scrollbar should automatically appear on the picture, and it should look normal.
As a side note (which may or may not be relevant), users typically don't like having to scroll to see the rest of an image, so if you don't need the user to scroll down on the image for some definitive purpose (or because you don't know what the size of the image that will be handled is), I'd try and change the size of things on your form so scrolling will not be necessary.
I hope this helps!

redpajama_set_name: RedPajamaStackExchange


text:
Q: What statuses count as control-impairing effects? I just got a nice shiny new legendary gem.  Bane of the Trapped, to be exact.  Which has, as its primary effect:

Increase damage against enemies under the effects of control-impairing effects by X.

Obviously, it's in my best interest to ensure my enemies are under at least one of these effects at all times, for a constant boost to damage.  My question is, what statuses count as control-impairing?  I'm guessing slow does, as that's what the gem itself will give once it gets to rank 25, but until that point, I'm going to need something else to hit them with.
So what can I use to ensure this gem's damage boost gets as much uptime as possible?

A: Control impairing effects are also referred to as Crowd Control. Those include exhaustively in Diablo 3 :

*

*Knockback

*Stun

*Slow (Including Chill effect)

*Freeze

*Immobilize

*Fear

*Confusion

*Blind

*Taunt

*Charm

*Hex

Source for the list and here is the list of the skills that induce a control impairing effect (might be updated over time)


text:
Q: Github API - Get private repositories of user I have created a script that automatically backs up my GitHub repositories on a hard drive.
I use my Github username in combination with a personal access token to get authorized to Github. Now I've been reading a bit in their documentation about how to get ALL my repositories from the API (public & private), but I can only seem to get the public...
My script: https://github.com/TomTruyen/GitHub-Backup-Script/blob/main/github_backup_script.sh
From what I can understand on line 78, the url should return all my 'owned' repositories (which should include my privates ones)
repositories=$(curl -XGET -s https://"${GITHUB_USERNAME}":"${GITHUB_TOKEN}"@api.github.com/users/"${GITHUB_USERNAME}"/repos?per_page="${repository_count}" | jq -c --raw-output ".[] | {name, ssh_url}")

I have already enabled ALL repository scopes which should give me 'Full control of private repositories (and public)'
I'm out of ideas right now... am I doing something wrong?
NOTE: I'm trying to get my private repositories as a USER, not as an organization
NOTE: ${GITHUB_USERNAME} & ${GITHUB_TOKEN} are variables that I have of course filled in, in my script

A: You're calling the /users endpoint, but looking at List repositories for the authenticated user it looks like you should be calling /user/repos.
By default this will return all repositories, both public and private, for the currently authenticated user. You'll also need to correctly handle pagination (unless you know for sure you have fewer than 100 repositories).
I was able to fetch a list of all my repositories using the following script:
#!/bin/sh
#
# you must set GH_API_USER and GH_API_TOKEN in your environment

tmpfile=$(mktemp curlXXXXXX)
trap "rm -f $tmpfile" EXIT

page=0
while :; do
    let page++
    curl -sf -o $tmpfile \
        -u "$GH_API_USER:$GH_API_TOKEN" \
        "https://api.github.com/user/repos?per_page=100&page=$page&visibility=all"

    count=$(jq length $tmpfile)
    if [[ $count = 0 ]]; then
        break
    fi

    jq '.[]|.full_name' $tmpfile
done

A: visibility=all is the key thing here, guys. I spent hours but end up not getting what I wanted. It's been mentioned in the doc as well -
https://docs.github.com/en/rest/repos/repos#list-repositories-for-the-authenticated-user


text:
Q: Force a Content to in new page when generating a PDF Im using play framework and rendering PDF usin rednerPDF() method.
I would like to display some part of content always be in new page.
For Example I have two tables, One table should be in first page and another table should in next page instead of continue from first page. The first table contents are dynamic and we can't sure the height of the table.
Is it possible?

A: Is it possible?Yes.
You said one table(first one) should be in first page,and again you said its content is dynamic.Now my question is it span over pages and in the next page you want to write second table?This is a generic scenario and what you mentioned is specific one.
You can start trying using two properties of PdfPTable setSplitLate() and setSplitRows()(just google it out for details read Itext In Action).Just keep Two table as two Rows of outer table.set those two property for inner as well as outer in some way as you want(i.e generic case/Specific case).
Another alternative way is use writeSelectedRows() method over PdfContentByte(I don't konw which Object you gonna use for manipulating pdf but you can get it from PdfWriter,*PdfStamper* by using getDirectContent/*UnderContent*/OverContent) after generating table.To use this method you have to set total width of the table so the height can be calculated by method getTotalHeight of PdfPTable.If You use this height properly you absolutely know where your table ends.But all these specific part you have to read & understand first.

A: With yahp you can use a special html tag to force a page break
<yahp:pb />

A: we can achieve this by page-break-after:always
Please refer
Alternate to PDF for dynamically generated document with page breaks


text:
Q: How to avoid HSTS error by hosts redirect with self-signed certificate? I created this records in windows hosts file
127.0.0.1 a.domain.name
127.0.0.1 b.domain.name
127.0.0.1 c.domain.name

where
127.0.0.1 - ip of my server
[a,b,c].domain.name - domains wich from i need to get redirect to my server

So, how i need to create self-signed certificate to get trusted from browsers and avoid HSTS error?

A: Just to clarify: A self-signed certificate will only be trusted by browsers that manually have trusted this certificate. Everybody else will get warnings.
In Windows you would run the powershell command New-SelfSignedCertificate -CertStoreLocation cert:\localmachine\my -DnsName *.test.com -FriendlyName "star_test_com-2020" -NotAfter (Get-Date).AddYears(2) to create a self-signed wildcard certificate for test.com with a two year lifetime.
Then you can search your start menu for manage computer certificates to export the certificate for use on other computers. If you just want to trust the certificate on a client, you'll want a copy that is exported without the private key. If you want to present the certificate from a server, you need a copy that is exported with the private key.
For your own computer to trust the certificate, it needs to exist in the Trusted Root Certification Authorities in the certificate manager. You can copy it there from the Personal store by right-dragging it there with your mouse.
For (Windows/Microsoft) services to be able to present the certificate, it usually needs to exist in the LocalMachine\Personal store.

However: If you want to present services publicly, you will want to use a CA-signed certificate. It's definitely cheapest and probably easiest to go via Let's Encrypt, but I have no experience using them for Windows servers. The alternative is to pay for certificates from a commercial CA.


text:
Q: Need to fill in IP address of the Server in my Clients Connection EditText I have made my friends phone the SERVER and mine the CLIENT. NOW, to connect my phone to his phone, he tells me his IP address(eg. 192.234.34.12), I fill it into my EditText on my phone and then click connect. Our messenger works fine!
But, i dont want to have him Go into:
SETTINGS>>ABOUT PHONE>> ETC ETC>> ETC ETC...
I want it(his IP address) to appear in a TextView on his activity when he puts on our Messenger app.
For this i used a famous code i found:-
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces();
     en.hasMoreElements();) {

    NetworkInterface intf = en.nextElement();

    for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses();
         enumIpAddr.hasMoreElements();) {

        InetAddress inetAddress = enumIpAddr.nextElement();
        if (!inetAddress.isLoopbackAddress()) {
            return inetAddress.getHostAddress().toString();
        }
    }
}

But it appears in IPv6, which is difficult to copy and it still doesn't connect!
But the moment I use IPv4(abc.def.xyz.lmn), it connects!
So my question is, how may I get my friends mobile ip(Server) to be displayed on his phone, so he may tell me it easily and i could connect from my Phone? may be in IPv4 if possible?

A: It seems there is seperate class called Inet4Address  in java.
Try this, it is working for me
for (Enumeration<NetworkInterface> en =  NetworkInterface.getNetworkInterfaces();
   en.hasMoreElements();) {

  NetworkInterface intf = en.nextElement();

    for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses();
          enumIpAddr.hasMoreElements();){

        InetAddress inetAddress = enumIpAddr.nextElement();
        if (!inetAddress.isLoopbackAddress()&& InetAddressUtils.isIPv4Address(inetAddress.getHostAddress()))
        {
           return inetAddress.getHostAddress().toString();
        }
     }
 }


text:
Q: Which is the right method to handle oauth2.0 done in server using Ionic framework? I am creating an Ionic app which has multiple 3rd party integration. I already have a java server which does the oauth2 authentication for the 3rd parties and redirect to the callback url in the server itself.
Now my task is to open back the app page after the server callback url is done.
I have tried the following method:
 monitoring the url changes in app using ionic and redirect after the successful callback.
Which is the best way to handle this sitn.
Thanks.

A: Frankly, I haven't done anything like this. But to my mind, you can check ngcordova oauth implementation for ideas.
   var browserRef = window.open(your_url);

   browserRef.addEventListener("loadstart", function(event) {
       //your code
   });
   browserRef.addEventListener('exit', function(event) {
       deferred.reject("The sign in flow was canceled");
   });

Check oauth.js source for more details.
Moreover, you can find the sample of using this implementation on this page.

A: http://mcgivery.com/using-custom-url-schemes-ionic-framework-app/
Above link may help you. If I am thinking correctly what you want?


text:
Q: How to get identity element of ECCurve with bouncycastle? How do I get the identity ECPoint element (I think it is infinity) of a given ECCurve in the Bouncycastle library.
Thanks

A: It seems to be infinity indeed, so ECCurve.getInfinity() would be the major contestant. It's easy to see in the code that it is treated as identity element.


text:
Q: Jackson JsonNode to typed Collection What is the proper way to convert a Jackson JsonNode to a java collection?
If it were a json string I could use ObjectMapper.readValue(String, TypeReference) but for a JsonNode the only options are ObjectMapper.treeToValue(TreeNode, Class) which wouldn't give a typed collection, or ObjectMapper.convertValue(Object, JavaType) which feels wrong on account of its accepting any POJO for conversion.
Is there another "correct" way or is it one of these?

A: Acquire an ObjectReader with ObjectMapper#readerFor(TypeReference) using a TypeReference describing the typed collection you want. Then use ObjectReader#readValue(JsonNode) to parse the JsonNode (presumably an ArrayNode).
For example, to get a List<String> out of a JSON array containing only JSON strings
ObjectMapper mapper = new ObjectMapper();
// example JsonNode
JsonNode arrayNode = mapper.createArrayNode().add("one").add("two");
// acquire reader for the right type
ObjectReader reader = mapper.readerFor(new TypeReference<List<String>>() {
});
// use it
List<String> list = reader.readValue(arrayNode);

A: The ObjectMapper.convertValue() function is convenient and type-aware.  It can perform a wide array of conversions between tree nodes and Java types/collections, and vice-versa.
An example of how you might use it:
List<String> list = new ArrayList<>();
list.add("one");
list.add("two");

Map<String,List<String>> hashMap = new HashMap<>();
hashMap.put("myList", list);

ObjectMapper mapper = new ObjectMapper();
ObjectNode objectNode = mapper.convertValue(hashMap, ObjectNode.class);
Map<String,List<String>> hashMap2 = mapper.convertValue(objectNode, new TypeReference<Map<String, List<String>>>() {});

A: If an Iterator is more useful...
...you can also use the elements() method of ArrayNode. Example see below.
sample.json
{
    "first": [
        "Some string ...",
        "Some string ..."
    ],
    "second": [
        "Some string ..."
    ]
}

So, the List<String> is inside one of the JsonNodes.
Java
When you convert that inner node to an ArrayNode you can use the elements() method, which returns an Iterator of JsonNodes.
File file = new File("src/test/resources/sample.json");
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = mapper.readTree(file);
ArrayNode arrayNode = (ArrayNode) jsonNode.get("first");
Iterator<JsonNode> itr = arrayNode.elements();
// and to get the string from one of the elements, use for example...
itr.next().asText();

New to Jackson Object Mapper?
I like this tutorial:
https://www.baeldung.com/jackson-object-mapper-tutorial
Update:
You can also use .iterator() method of ArrayNode. It is the same:

Same as calling
.elements(); implemented so that convenience "for-each" loop can be
used for looping over elements of JSON Array constructs.

from the javadocs of com.fasterxml.jackson.core:jackson-databind:2.11.0


text:
Q: Using awk conditional statement with shell module on the tabular data is not working as expected in Ansible I have a requirement as mentioned below.
I have to access the last column from the table, shown below, of data (obtained from the remote node), using an Ansible playbook.
PROGRESS: Starting connection towards ss7caf stack...
          Please wait, the output can take up to several minutes

Blade | EP | AS  | Paths (* - current data       | Path
Id    | Id | Id  | transfer path)                | State
------+----+-----+-------------------------------+---------
PL-3  |  1 | 1-1 | 10.201.176.0 - 10.116.178.161 | Active
      |    |     | 10.201.176.0 - 10.116.178.162 | Blocked
      |    |     | 10.201.176.2 - 10.116.178.161 | Blocked
      |    |     | 10.201.176.2 - 10.116.178.162 | Inactive
PL-4  |  1 | 4-1 | 10.201.176.0 - 10.250.161.130 | Active
      |    |     | 10.201.176.0 - 10.250.161.138 | Blocked
      |    |     | 10.201.176.2 - 10.250.161.130 | Inactive

This table was generated: 2022-03-08 11:11:38 AEDT

I have to use the content of the last column in a conditional statement to draw some conclusions based on it.
For example, the paths which are specified in the last but one column, corrsponding to the blade ID mentioned in column 1

*

*are in working condition if the value/content in the last (i.e.,Path state) column is either Active or Blocked

*are in non-working condition if the value/content in the last (i.e.,Path state) column is Inactive

I have tried a playbook like this.
---
# The objective of this playbook is to use this command "sudo dsc-show-sctp-assoc"
# and check the status of Check the status of SCTP Associations.
- name: Playbook for Checking the status of SCTP Associations
  hosts: all
  become: true
  tasks:
  - name: Getting SCTP Association status details and saving them to a text file
    shell: dsc-show-sctp-assoc | tee sctp.txt  # "dsc-show-sctp-assoc" is used to get the tabular data from the remote node

  - name: IDNETIYING THE PASS AND FAIL CASES
    shell: cat sctp.txt | awk -F "|" {if ($NF=="Inactive") print $0, " ", '===>', "FAIL"; else print $0, " ", "====>","PASS";}'
  register: pass_fail_cases

  - name: PRINTING THE PASS AND FAIL CASES
    debug:
      msg: "{{pass_fail_cases.stdout_lines }}"
...

The expected output is shown below
PROGRESS: Starting connection towards ss7caf stack...
          Please wait, the output can take up to several minutes

Blade | EP | AS  | Paths (* - current data       | Path
Id    | Id | Id  | transfer path)                | State
------+----+-----+-------------------------------+---------
PL-3  |  1 | 1-1 | 10.201.176.0 - 10.116.178.161 | Active  ===> "PASS"
      |    |     | 10.201.176.0 - 10.116.178.162 | Blocked ===> "PASS"
      |    |     | 10.201.176.2 - 10.116.178.161 | Blocked ===> "PASS"
      |    |     |*10.201.176.2 - 10.116.178.162 | Inactive ===> "FAIL"
PL-3  |  1 | 4-1 | 10.201.176.0 - 10.250.161.130 | Active ===> "PASS"
      |    |     | 10.201.176.0 - 10.250.161.138 | Blocked ===> "PASS"
      |    |     | 10.201.176.2 - 10.250.161.130 | Inactive ===> "FAIL"

This table was generated: 2022-03-08 11:11:38 AEDT

whereas I am getting the below output
PROGRESS: Starting connection towards ss7caf stack...
          Please wait, the output can take up to several minutes

Blade | EP | AS  | Paths (* - current data       | Path
Id    | Id | Id  | transfer path)                | State
------+----+-----+-------------------------------+---------
PL-3  |  1 | 1-1 | 10.201.176.0 - 10.116.178.161 | Active  ===> "PASS"
      |    |     | 10.201.176.0 - 10.116.178.162 | Blocked ===> "PASS"
      |    |     | 10.201.176.2 - 10.116.178.161 | Blocked ===> "PASS"
      |    |     |*10.201.176.2 - 10.116.178.162 | Inactive ===> "PASS"
PL-3  |  1 | 4-1 | 10.201.176.0 - 10.250.161.130 | Active ===> "PASS"
      |    |     | 10.201.176.0 - 10.250.161.138 | Blocked ===> "PASS"
      |    |     | 10.201.176.2 - 10.250.161.130 | Inactive ===> "PASS"

This table was generated: 2022-03-08 11:11:38 AEDT

I guess that the conditional statement (if condition) of AWK command is not working as expected and hence everything is resulted as "PASS".
I tried it multiple ways. But none of them gave me the expected output.
Can someone please help to let me know where I am going wrong?
PS: I tried using AWK command here. Please suggest me the other approcahes that I can follow to get the expected output, if any

A: Following awk should work for you:
awk -F '|' '!NF {main=0} !main; /^-{3}/ {main=1; next} main {print $0, "===>", ($NF ~ /Inactive/ ? "\"FAIL\"" : "\"PASS\"")}' sctp.txt

PROGRESS: Starting connection towards ss7caf stack...
          Please wait, the output can take up to several minutes

Blade | EP | AS  | Paths (* - current data       | Path
Id    | Id | Id  | transfer path)                | State
------+----+-----+-------------------------------+---------
PL-3  |  1 | 1-1 | 10.201.176.0 - 10.116.178.161 | Active  ===> "PASS"
      |    |     | 10.201.176.0 - 10.116.178.162 | Blocked  ===> "PASS"
      |    |     | 10.201.176.2 - 10.116.178.161 | Blocked  ===> "PASS"
      |    |     | 10.201.176.2 - 10.116.178.162 | Inactive  ===> "FAIL"
PL-4  |  1 | 4-1 | 10.201.176.0 - 10.250.161.130 | Active  ===> "PASS"
      |    |     | 10.201.176.0 - 10.250.161.138 | Blocked  ===> "PASS"
      |    |     | 10.201.176.2 - 10.250.161.130 | Inactive  ===> "FAIL"

This table was generated: 2022-03-08 11:11:38 AEDT

Or to make it readable:
awk -F '|' '
!NF {main=0}
!main
/^-{3}/ {main=1; next}
main {
   print $0, "===>", ($NF ~ /Inactive/ ? "\"FAIL\"" : "\"PASS\"")
}' sctp.txt

This solutions uses a flag called main to indicate when your main body of report starts. Initially main is zero, when we encounter ----- line then we set main=1. Last block adds PASS or FAIL when main==1 depending on value of $NF.

A: With your shown samples only, please try following awk code.
awk '
!NF{ print; found="" }
(/^(PROGRESS|[[:space:]]+|Blade|Id|-{6}\+)|^This table was generated:/ && !found){
  if(/^-{6}\+/){ found=1 }
  print
  next
}
found{
  print $0, "===>", ($NF ~ /Inactive/ ? "\"FAIL\"":"\"PASS\"")
}
'  Input_file

OR in case you want to use it as a one-liner to use it in ansible playbook try following one-liner then:
awk '!NF{print;found=""} (/^(PROGRESS|[[:space:]]+|Blade|Id|-{6}\+)|^This table was generated:/ && !found){if(/^-{6}\+/){found=1};print;next} found{print $0, "===>", ($NF ~ /Inactive/ ? "\"FAIL\"":"\"PASS\"")}' Input_file
Explanation: Adding detailed explanation for above.
awk '                          ##Starting awk program from here.
!NF{ print; found="" }         ##If NF is NULL then print that line and Nullify found here.
(/^(PROGRESS|[[:space:]]+|Blade|Id|-{6}\+)|^This table was generated:/ && !found){  ##Checking conditions if line starts from PROGRESS OR spaces OR Blade OR Id OR 6 dashes then do following.
  if(/^-{6}\+/){ found=1 }  ##Checking if line starts from 6 dashes then set found to 1.
  print                        ##Printing line here.
  next                         ##next will skip all further statements from here.
}
found{                         ##Checking condition if found is NOT NULL.
  print $0, "===>", ($NF ~ /Inactive/ ? "\"FAIL\"":"\"PASS\"") ##Then printing current line followed by either Fail or Pass based on last field as per OP request.
}
'  Input_file                  ##Mentioning Input_file name here.

A: $ awk '
    BEGIN { map["Active"]=map["Blocked"]="PASS"; map["Inactive"]="FAIL" }
    { print $0 ($NF in map ? " ===> \"" map[$NF] "\"" : "") }
' sctp.txt
PROGRESS: Starting connection towards ss7caf stack...
          Please wait, the output can take up to several minutes

Blade | EP | AS  | Paths (* - current data       | Path
Id    | Id | Id  | transfer path)                | State
------+----+-----+-------------------------------+---------
PL-3  |  1 | 1-1 | 10.201.176.0 - 10.116.178.161 | Active  ===> "PASS"
      |    |     | 10.201.176.0 - 10.116.178.162 | Blocked  ===> "PASS"
      |    |     | 10.201.176.2 - 10.116.178.161 | Blocked  ===> "PASS"
      |    |     | 10.201.176.2 - 10.116.178.162 | Inactive  ===> "FAIL"
PL-4  |  1 | 4-1 | 10.201.176.0 - 10.250.161.130 | Active  ===> "PASS"
      |    |     | 10.201.176.0 - 10.250.161.138 | Blocked  ===> "PASS"
      |    |     | 10.201.176.2 - 10.250.161.130 | Inactive  ===> "FAIL"

This table was generated: 2022-03-08 11:11:38 AEDT

By the way, in your code you have:
shell: cat sctp.txt | awk -F "|" {if ($NF=="Inactive") print $0, " ", '===>', "FAIL"; else print $0, " ", "====>","PASS";}'

idk why you're swapping back and forth between singe and double quotes like that but - don't. A valid syntax for what that line is trying to do would be:
shell: cat sctp.txt | awk -F "|" '{if ($NF=="Inactive") print $0, " ", "===>", "FAIL"; else print $0, " ", "====>","PASS";}'

which could be improved to (but still won't work, I'm just showing valid syntax, not correcting semantics):
shell: awk -F '|' '{print $0, " ", "===>", ($NF=="Inactive" ? "FAIL" : "PASS")}' sctp.txt

A: {m,g}awk '!/[|+]/ || _+__*(_ -= /^[+-]+$/) || sub("$",  " ===> \"" substr(\
         "PASSFAIL", 5^(!_<NF), 4*!+_) "\"")' FS='[|] Inactive[ \t]*$'     \_=1

######### # or preferably, not hard-coding in the "1" :

mawk 'BEGIN { FS = "[|][ \t]+Inactive[ \t]*$"
               _+=_+=_=__ ^=  _<_
      } !/[|+]/ || __ + (__ -= /^[+-]+$/)*-!_ || sub("$",\
       " ===> \"" substr("PASSFAIL", (--_+--_)^(_==NF), _^=_)'

=
PROGRESS: Starting connection towards ss7caf stack...
          Please wait, the output can take up to several minutes

Blade | EP | AS  | Paths (* - current data       | Path
Id    | Id | Id  | transfer path)                | State
------+----+-----+-------------------------------+---------
PL-3  |  1 | 1-1 | 10.201.176.0 - 10.116.178.161 | Active  ===> "PASS"
      |    |     | 10.201.176.0 - 10.116.178.162 | Blocked  ===> "PASS"
      |    |     | 10.201.176.2 - 10.116.178.161 | Blocked  ===> "PASS"
      |    |     | 10.201.176.2 - 10.116.178.162 | Inactive  ===> "FAIL"
PL-4  |  1 | 4-1 | 10.201.176.0 - 10.250.161.130 | Active  ===> "PASS"
      |    |     | 10.201.176.0 - 10.250.161.138 | Blocked  ===> "PASS"
      |    |     | 10.201.176.2 - 10.250.161.130 | Inactive  ===> "FAIL"

This table was generated: 2022-03-08 11:11:38 AEDT


text:
Q: Showing a function is holomorphic $f$ is continuous on $\gamma$ which is smooth & bounded. Let F be a function such that
$$F=\int_\gamma \frac{f(\beta)}{\beta-z} d\beta$$
for all $z$ not in $\gamma$
Show F is holomorphic at $z$ not on the curve and that
$$F^'(z)=\int_\gamma \frac{f(\beta)}{(\beta-z)^2} d\beta$$
I used the basic definition:
$$F^'(z)=\lim_{h\to0}\frac{F(z+h)-F(z)}{h}$$
$$=\lim_{h\to0}\frac{\int_\gamma \frac{f(\beta)}{\beta-(z+h)} d\beta-\int_\gamma \frac{f(\beta)}{\beta-z} d\beta}{h}$$
$$=\lim_{h\to0}\int_\gamma \frac{(f(\beta)(\beta-z)-f(\beta)(\beta-z-h)}{h(\beta-z-h)(\beta-z)} d\beta$$
$$=\lim_{h\to0}\int_\gamma \frac{f(\beta)}{(\beta-z-h)(\beta-z)} d\beta$$
$$=\int_\gamma \frac{f(\beta)}{(\beta-z)^2} d\beta$$
Just wondering is what I done correct (since it seems a bit trivial)? If so is it necessary that the curve is smooth & bounded, and that $f$ is continuous on it?

A: Here we know what would be the derivative. We can write
\begin{align*}
\left|\frac{F(z+h)-F(z)}h-\int_{\gamma}\frac{f(\beta)}{(\beta-z)^2}dz\right|&=|\int_{\gamma}\frac{f(\beta)}{h(\beta-(z+h))}dz-\int_{\gamma}\frac{f(\beta)}{h(\beta-z)}dz\\&-\int_{\gamma}\frac{f(\beta)}{(\beta-z)^2}dz|\\
&=|\int_{\gamma}\frac{f(\beta)}{h(\beta-z)^2(\beta-(z+h))}((\beta-z)^2-\\
&(\beta-z-h)(\beta-z)-h(\beta-(z+h)))dz|,
\end{align*}
and computing
\begin{align*}
(\beta-z)^2-(\beta-z-h)(\beta-z)-h(\beta-(z+h))&=(\beta-z)h-h(\beta-z-h)\\
&=h^2
\end{align*}
so
$$\left|\frac{F(z+h)-F(z)}h-\int_{\gamma}\frac{f(\beta)}{(\beta-z)^2}dz\right|\leq |h|^2\int_{\gamma}\frac{|f(\beta)}{|\beta-z|^2(|h|-d(z,\gamma))}dz$$
(if we assume that $\gamma$ is closed).


text:
Q: Is it better to dereference a pointer to get a value or create a local object and access the value that way? For example say I am looping through a vector of pointers to check multiple objects and perform operations on them. I could do either of the following.
Method 1:
std::vector< Object* >::iterator it;
Object* o;
for (it = objects.begin(); it != objects.end(); ++it)
{
    o = (*it)
    if(o->GetActive())
    {
        o->method;
        o->method2;
        o->method3;
        //etc...
    }
 }

Method 2:
std::vector< Object* >::iterator it;
for (it = objects.begin(); it != objects.end(); ++it)
{
    if((*it)->GetActive())
    {
        (*it)->method;
        (*it)->method2;
        (*it)->method3;
        //etc...
    }
 }

From what I can see Method 1 has easier readability as dereferencing syntax can often complicate the readability, especially when you are doing something like:
if((*o)->CheckValue((*c)))

But creating local variables would make it much easier to read:
if(o->CheckValue(c))

But you are creating extra variables which would increase the memory cost, right?
What would the differences in performance be?

A: An optimizing compiler will probably make them the same. Sometimes it's nice to assign to a variable for better readability. If the container didn't contain pointers you could use a reference instead:
std::vector< Object >::iterator it;
for (it = objects.begin(); it != objects.end(); ++it)
{
    const Object &o = (*it)
    if(o.GetActive())
    {
        o.method();
        o.method2();
        o.method3();
        //etc...
    }
 }

Edit: As Raymond points out in the comments, the compiler can't make certain optimizations if the methods might mutate the object in question. The way to fix that is to use const when possible, so I've changed my example to show it in practice. If you do this you can't call methods on the object that aren't also marked const.

A: I would in fact choose another syntax, which makes the choice irrelevant:
for (Object* o : objects)
{
  // ... body
}

A: Unless you have volatile objects around, when dealing with local objects it mostly comes down just to readability, since compilers routinely deal with this stuff by themselves.
In your particular case, *it is an operation that the compiler has to perform, and whose result will end in a register; so, it's almost sure that the compiler will leave the result in the register anyway for the next uses, thus "implicitly" creating your o variable. In other words, coming down to assembly that variable arises by itself.
It's a different situation, instead, if the compiler cannot trivially prove that it is not modified between dereferentiations (e.g. if a pointer to it - or to objects - is passed around, or if it's nonlocal) or if it's explicitly instructed to avoid this kind of optimizations (via the volatile keyword).


text:
Q: Limiting expression for Power law tail index from a quantile function? Assume that I have a random variable $X$ (which I know will have a power law tail).
If I had the CDF for $X$, $G(x)$, then I could easy calculate this tail as something like,
$$
\alpha = \lim_{x\to\infty}\left(\frac{x G'(x)}{1 - G(x)}\right)
$$
Alternatively, in logs with $X = e^Z$ and a CDF for $z$ instead, F(z), then the calculation should be
$$
\alpha = \lim_{z\to\infty}\left(\frac{F'(z)}{1 - F(z)}\right)
$$
(you can try these out for $X$ a pareto distribution, which would mean that $Z$ is an exponential distribution from standard probability).
QUESTION:  Lets say that I cannot find an expression for $F(z)$ (or $G(x)$ if you prefer, I should be able to convert)
Instead, I am able to calculate a (mostly) analytical quantile function $Q(q) = F^{-1}(q)$ for $z$.  Assume monotonicity, invetibility, etc.
My question is: From only $Q$ and its derivatives, is there a limit I can take to find $\alpha$ for the underlying variable? (I imagine the limit would be as $q \to 1$)?

A: From the Chain Rule,
$$1 = \frac{d}{dq}\left(q\right) = \frac{d}{dq}\left(F(Q(q))\right) = F^\prime(Q(q)) Q^\prime(q).$$
Letting $0 \lt q \lt 1$, substituting $z = Q(q)$ into the limiting expression for $\alpha$, and solving the preceding equation for $F^\prime(Q(q))$ in terms of $Q^\prime(q)$ gives
$$\alpha = \lim_{z\to\infty}\left(\frac{F'(z)}{1 - F(z)}\right)
= \lim_{Q(q)\to\infty}\left(\frac{F'(Q(q))}{1 - F(Q(q))}\right)
=\lim_{q\to 1^{-}}\left(\frac{1/Q^{\prime}(q)}{1 - q}\right).$$
Both the numerator and denominator approach zero.  Applying L'Hopital's Rule gives the simple useful formula
$$\alpha =\lim_{q\to 1^{-}}\left(\frac{\frac{d}{dq}\left(1/Q^{\prime}(q)\right)}{\frac{d}{dq}(1 - q)}\right)
= \lim_{q\to 1^{-}}\frac{Q^{\prime\prime}(q)}{\left(Q^\prime(q)\right)^2}.$$

For a Pareto distribution $F(z) = 1 - \exp(-\alpha z),$ whence $Q(q) = -\frac{1}{\alpha}\log(1-q)$ and differentiating yields $Q^\prime(q) = \frac{1}{\alpha}\frac{1}{1-q}$, $Q^{\prime\prime}(q) = \frac{1}{\alpha}\frac{1}{(1-q)^2}$.  We obtain
$$\alpha =  \lim_{q\to 1^{-}}\frac{Q^{\prime\prime}(q)}{\left(Q^\prime(q)\right)^2} = \lim_{q\to 1^{-}}\frac{\frac{1}{\alpha}\frac{1}{(1-q)^2}}{\left(\frac{1}{\alpha}\frac{1}{1-q}\right)^2} = \lim_{q\to 1^{-}} \alpha,$$
which checks out beautifully.


text:
Q: How to use data from API in factory AngularJS I have the below code which uses the data in the staff array to calculate the staff members pay.

'use strict';
var app = angular.module('app', []);
app.factory('staffFactory', function ($http) {
    var staff = [
        {"id": "1","name": "Kate","rate": "10", "hours": "10"},
        {"id": "2","name": "John","rate": "20", "hours": "10"},
        {"id": "3","name": "Matt","rate": "15", "hours": "10"}
    ];

  function calcPayInner(){
    var unique = {},
        distinct = [],pay = [];
    for (var i in staff) {
        if (typeof (unique[staff[i].id]) == "undefined")  {
            distinct.push(staff[i].id);
        }
        unique[staff[i].id] = unique[staff[i].id] || {pay:0};
        unique[staff[i].id].name = staff[i].name;
        unique[staff[i].id].pay += (parseInt(staff[i].rate, 10) * parseInt(staff[i].hours, 10));
    }

        for (var p in unique) {
            pay.push([p, unique[p]]);
            pay.sort(function (a, b) {
              return (b[1].pay - a[1].pay);
            });
        }
        return pay;
    }
    var staffService = {};
    staffService.allStaff = function () {
        return staff;
    };

    staffService.CalcPay = function () {
        return calcPayInner();
    };

    return staffService;
});

    app.controller('MainCtrl', ['$scope', 'staffFactory', function ($scope, staffFactory) {
        $scope.staff = staffFactory.allStaff();
        console.log($scope.staff);
        $scope.CalcPay = staffFactory.CalcPay();
        $scope.keyPress = function(keyCode){
            $scope.CalcPay = staffFactory.CalcPay();
        };
    }]);

name	rate	hours

                {{s.name}}
                <input ng-keyup="keyPress(s.rate)" ng-model="s.rate">
                <input ng-keyup="keyPress(s.hours)" ng-model="s.hours">

name	pay

                {{b.1.name}}
                {{b.1.pay}}

This all works as intended however now I want to get the staff data from an API call rather than hard coded data.
I have tried the below. (see plnkr)
    var staff = [];
    var test = $http.get('staff.json')
    .success(function(data) {
        staff = data;
        console.log(staff);
    });

Which seems to return the data as I can see in my console but I can't get it to work (returns a blank array) with my existing function.
I have also tried to wrap the function in .finally after .success but then my function becomes undefined.
How can I use the API Data in the functions in my factory so I can get my page working as it was originally with the hard coded array?

A: The problem as others have mentioned is that you are trying to get data before it's available. The solution to the problem is to use promises inside your factory if you want to keep single source for data.
below code uses q so you will have to inject it on your factory.
app.factory('staffFactory', function ($http, $q) {}

allStaff implementation
/* Private var to hold the staff */
var staff = [];

// this method returns a promise
staffService.allStaff = function () {
    var deferred = $q.defer();

    // check if staff is already fetched from server if yes resolve the promise immediately
    if (staff.length > 0) {
        // we have data already. we can avoid going to server
        deferred.resolve(staff);   // staff holds all the data
    } else {
        // data is not available yet. fetch it from server

        $http.get('staff.json')
        .success(function(data) {
            // once data is available resolve
            staff = data;
            deferred.resolve(data);
        })
        .error(function (error) {
            deferred.reject(error);
        });
    }

    return deferred.promise;
};

In controller.
staffFactory.allStaff().then(function (staff) {
    $scope.staff = staff;
    console.log($scope.staff);
    $scope.CalcPay = staffFactory.CalcPay();
    $scope.keyPress = function(keyCode) {
        $scope.CalcPay = staffFactory.CalcPay();
    };
});

checkout the plunkr

A: This is how I did it:
$scope.documents = [];

$http.post('get_xml.php')
    .then(function (result) {
        $scope.documents = result.data;
        console.log(result.data);
    });

As far as I know .then is an asynchronous function, which will update your array as soon as it becomes available.
So in your case, it should be:
app.factory('staffFactory', function ($http) {

    var staff = [];
    var test = $http.get('staff.json').then(function(result) {
        staff = result.data;
        console.log(staff);
    });

    /* Rest of your code... */
});


text:
Q: Npm install from Google Source Repositories in Cloud Build I have a private package hosted on our company's Google Source repository and can't find a way to npm install it in the Cloud Build process...
Expected Behavior
Want to npm install private package from Google Source in my build process.
Actual Behavior
Authorization failed
Steps to Reproduce the Problem
In my development env I started with this in package.json:
"dependencies": {
        "package": "git+https://source.developers.google.com/p/*project*/r/*package*",
        ...
}

In my build file i try with this:
steps:
# Get credentials:
- name: 'gcr.io/cloud-builders/git'
  id: Credentials
  args:
  - 'config'
  - '--global'
  - 'credential.helper'
  - 'gcloud.sh'
# This step installs the app
- name: 'gcr.io/cloud-builders/npm'
  id: Install
  args:
  - 'install'

# This step runs the tests
- name: 'gcr.io/cloud-builders/npm'
  id: Test
  args:
  - 'run'
  - 'test:unit'
...

This fails with:
Step #0 - "Install": npm ERR! Error while executing:
Step #0 - "Install": npm ERR! /usr/bin/git ls-remote -h -t https://source.developers.google.com/p/*project*/r/*package*
Step #0 - "Install": npm ERR!
Step #0 - "Install": npm ERR! git: 'credential-gcloud.sh' is not a git command. See 'git --help'.
Step #0 - "Install": npm ERR! git: 'credential-gcloud.sh' is not a git command. See 'git --help'.
Step #0 - "Install": npm ERR! fatal: remote error:
Step #0 - "Install": npm ERR!
Step #0 - "Install": npm ERR!
Step #0 - "Install": npm ERR! Invalid authentication credentials.
Step #0 - "Install": npm ERR!
Step #0 - "Install": npm ERR! Please generate a new identifier:
Step #0 - "Install": npm ERR!   https://source.developers.google.com/new-password
Step #0 - "Install": npm ERR!
Step #0 - "Install": npm ERR!
Step #0 - "Install": npm ERR!
Step #0 - "Install": npm ERR! exited with error code: 128

So after spending a day googling and looking for good solutions I've not found anything that seems like the "correct" way of doing this.
The best solution so far is:
Generating a ssh key to be able to clone the package. This works but since it seems like I need to have the email in the string as "package": "git+ssh://service.account@company.se@source.developers.google.com:2022/p/project/r/package" I need to change the email between commiting and building.
Anyone got a better suggestion of doing this?


text:
Q: Insert Multiple JSON files to MongoDB using python The JSON files are as follows a.json,b.json.....z.json (26 json files)
The json format of each of the file looks as:
{
    "a cappella": {
        "word": "a cappella",
        "wordset_id": "5feb6f679a",
        "meanings": [
            {
                "id": "492099d426",
                "def": "without musical accompaniment",
                "example": "they performed a cappella",
                "speech_part": "adverb"
            },
            {
                "id": "0bf8d49e2e",
                "def": "sung without instrumental accompaniment",
                "example": "they sang an a cappella Mass",
                "speech_part": "adjective"
            }
        ]
    },
    "A.D.": {
        "word": "A.D.",
        "wordset_id": "b7e9d406a0",
        "meanings": [
            {
                "id": "a7482f3e30",
                "def": "in the Christian era",
                "speech_part": "adverb",
                "synonyms": [
                    "AD"
                ]
            }
        ]
    },.........
}

How could I store these in MongoDB such that if queried with word the results shows meanings,synonyms(if available)?
I have never used Mongo on how to approach, but the same was done with SO suggestions for a single json file in mysql as:
**cursor has db connection
with open('a.json') as f:
    d = json.load(f)

for word in d:
    word_obj = d[word]
    wordset_id = word_obj['wordset_id']

    sql = "INSERT INTO Word (word, wordset_id) VALUES (%s, %s)"
    values = (word, wordset_id)
    cursor.execute(sql, values)
    conn.commit()

similarly to store meanings and synonyms as different tables,
But as suggetsed I guess this would become better if MongoDB is used

A: If you want to insert data from multiple .json files, do it in a loop:
file_names = ['a.json', 'b.json', ...]

for file_name in file_names:
    with open(file_name) as f:
        file_data = json.load(f)  # load data from JSON to dict
        for k, v in file_data.items():  # iterate over key-value pairs
            collection.insert_one(v)  # your collection object here


text:
Q: Tangent space to representation variety In "Varieties of Representations of Finitely generated groups" by Lubotzky and Magid in page vi it claims that
"A. Weil showed that the tangent space to $R_n(T)$ at a representation $\rho$ is a subspace of $Z (T,Ad \circ \rho)$ (the space of one cocycles of T with coefficients in the representation)"
This proposition seems very important for the rest of the book but they provide no exact reference, for example to the paper where A. Weil proves this. Does anyone have a reference? Also, could anyone outline a concrete example about how do vectors of the tangent space correspond to 1-cocycles?


text:
Q: Convert char* to int memory address I have:
char* mem = (char*) 0xB8000;

Then mem is passed to a function. Inside the function, I want to get the number 0xB8000 back and compare it to some other integers. How do I convert mem back to the original integer?

A: To convert any pointer to an integer, do the following:
#include <stdint.h>

uintptr_t ptr_to_integer(const void *ptr) {
    return (uintptr_t) ptr;
}

Note that the size of uintptr_t might vary between platforms. Also this is an optional part of the C standard, so technically only uintmax_t would be absolutely portable.

A:
How do I convert mem back to the original integer?

Usually a cast to (u)intptr_t will form the original integer.
include <stdint.h>

printf("o: %lX\n", 0xB8000LU);
char* mem = (char*) 0xB8000;
printf("mem %p\n", (void *) mem);
uintptr_t i =  (uintptr_t) mem;
printf("i: %jX\n", (uintmax_t) i);

Pitfalls
Round tripping (u)intptr_t to void * to uintptr_t (or any integer type) is not specified by C to result in the original value.  Even void * to (u)intptr_t to void * is only specified to return an equavalent pointer, not necessarily the same pointer bit pattern.
Casting an arbitrary number like (char*) 0xB8000 to a pointer is not specified to work.

"the result is implementation-defined, might not be correctly aligned, might not point to an entity of the referenced type, and might be a trap representation" C17dr 6.3.2.3 5

(u)intptr_t are optional types - though common. A compliant library may not be able to provide the type.
No corresponding print specifier for (u)intptr_t.  A reasonable work-around is to to covert to the widest available type and print.

I want to get the number 0xB8000 back and compare it to some other integers.

A better approach could covert the "other integers" to a char * and compare pointers.
Best for OP to post the larger code usage to handle the overall goal.
Proceed with caution.


text:
Q: Best method to upload data to multiple documents in Firestore I am currently working on an iOS App that uses Cloud Firestore from Firebase.
I was wondering: what is the best way (cost, efficiency and security-wise) to upload some data to multiple Firestore documents simultaneously (or almost simultaneously)?
* The data I have to upload consists of the following: there are two users (User A is the user currently using the app, User B is the one whose profile is currently being seen by User A). If User A saves User B's profile, I must upload User B's UID to User A's Firestore Document. Then, I have to increase a counter in User A's Firestore Document. Finally, I must add User A's UID to User B's Firestore Document. - Note that with Firestore Document I mean either a document Field or a document Subcollection.
The choices are:

*

*Upload everything from the client: seems the best method, cost-wise: it doesn't require extra Cloud Functions usage. I would create a Batch Operation and upload all the data from there*. The downside is that the client must be able to access multiple unrelated collections and documents.

*Update one document from the client, then update everything else from Cloud Functions: this method is the best one efficiency and security-wise; the client only uploads data to the user's document*, without accessing unrelated collections and documents. Also, the client only has to upload a fraction of the data that it had to upload in the previous method, saving bandwidth and cellular data / WiFi usage. The downside is that the usage of Cloud Functions would increase, eventually resulting in more costs.

*Update one document from the client, update the counter* from the client and then update everything else form Cloud Functions: this method is somewhat a hybrid between the first two, as I think that updating the counter from the client is more secure (Cloud Functions' .onWrite trigger may happen twice or more, increasing the counter multiple times?).
My first thought was to go with method 2, as it's far more secured and efficient, but I would like to have someone else's advice too, before "wasting" too much time coding something wrong.
I hope this isn't any kind of duplicate, as I couldn't find anything that answered my question with enough specificity.
Any advice would be much appreciated. Thank you.

A: I would follow the third approach: updating from the client the current user collections (the saved_profiles collection and the counter field), which are private and only accessible by this user (configure Firestore Security Rules) and updating the other user's collection (users_who_saved_my_profile) with a triggered Cloud Function. As these operations are not controlled by security rules, they can access any part of the database. This way no unnecessary permissions are granted to any user.


text:
Q: Returning a random value from array with probability proportional to it's value I have an array like
$keywords = array('apple'=>10,'orange'=>2,'grape'=>12);

I want to randomly pick one of the "Key" from the array. However the probability distribution should be such that probability of picking an element should be proportional to it's value.

A: I'd do it like this:
    $probabilities = array('apple'=>50, 'orange'=>20, 'banana'=>10);

    function random_probability($probabilities) {
      $rand = rand(0, array_sum($probabilities));
      do {
        $sum = array_sum($probabilities);
        if($rand <= $sum && $rand >= $sum - end($probabilities)) {
          return key($probabilities);
        }
      } while(array_pop($probabilities));
    }

A: Add all values (10+2+12 is 24); get a random number in the range [0, 24), and pick the corresponding element depending on whether the number lies in [0, 10), [10, 12), or [12, 24).

A: An O(log(n)) approach (this is ripped directly from an answer to a very similar question):
The usual technique is to transform the array into an array of cumulative sums:
 [10 60 5 25]  --> [10 70 75 100]

Pick a random number in the range from zero up to the cumulative total (in the example: 0 <= x < 100).  Then, use bisection on the cumulative array to locate the index into the original array:
Random variable x      Index in the Cumulative Array      Value in Original Array
-----------------      -----------------------------      ----------------------
 0 <= x < 10                      0                            10
10 <= x < 70                      1                            60
70 <= x < 75                      2                             5
75 <= x < 100                     3                            25

For example, if the random variable x is 4, bisecting the cumulative array gives a position index of 0 which corresponds to 10 in the original array.
And, if the random variable x is 72, bisecting the cumulative array gives a position index of 2 which corresponds to 5 in the original array.


text:
Q: Flight time of spherical bullet fired horizontally versus dropped vertically / effect of crosswind on spherical car
*

*Would a spherical bullet fired horizontally from a musket stay aloft longer than a spherical bullet dropped from the same height?
I know two similar questions have been asked (Will a bullet dropped and a bullet fired from a gun horizontally REALLY hit the ground at the same time when air drag is taken into account?, How can a horizontally fired bullet reach the ground the same time a dropped bullet does? ) but I want to narrow it down by making these assumptions:

*

*No spin

*Flat earth, no curvature

*Spherical bullet

It appears to me that the answer to my question is "yes" (and therefore the answer to the older related question is "no"), because aerodynamic force is more or less proportional to velocity squared.  As the bullet starts to fall, at some given instant in time where the instantaneous velocity vector is known, if we take this velocity vector and thus compute the total aerodynamic force vector (which is purely a drag force vector; no lift is present) and then break this aerodynamic force vector into vertical and horizontal components, we get a larger vertical force component opposing downward acceleration than if we had used the same equation to calculate the aerodynamic drag force acting on an identical round ball falling straight down with the same instantaneous vertical velocity component but no forward motion.  Is this correct?
The same logic seems to shed light on why sideways winds exert much stronger sideways forces on moving cars than on parked cars, although here the situation is much more complicated because the rapidly moving car is acting somewhat like a vertical airfoil flying at an efficient angle-of-attack and creating sideways "lift", while the parked car is more like the same airfoil in a completely "stalled" condition (due to the very high-- 90-degree-- angle-of-attack.)  If the car were truly spherical, then this complication would be avoided and the situation would be just like the original question posed above.  So,

*With a spherical car, would a given crosswind (blowing perpendicular to the road) exert a greater sideways force component on the car (i.e. a force component acting perpendicular to the road) if the car was driving forward than if the car were parked?

Let's give some numbers:
Ball falling at instantaneous speed 5 units, no forward motion, drag force is 25 units
Ball falling at instantaneous speed 5 units and moving forward at instantaneous speed 5 units, total instantaneous velocity vector magnitude 7.07 units, total drag force magnitude 50 units.
Vertical component of drag force is 50 units * sine 45 degrees = 35.4 units
Is this correct?

A: In a vacuum they would fall at the same rate. Taking air drag into account, they probably would not. The early muskets that were not rifled were highly inaccurate at longer distances because they fired a round projectile with no spin on it. Any flaw, dent, or imperfection would cause the bullet to veer off in an unexpected direction because of uneven air flow. This is why rifled barrels were more accurate, if the bullet had a flaw and had more air drag on one side, since it was spinning it would travel in a spiral or wobble, in a much more predictable projectile arc. As for a spherical car. it should have very similar side drag whether moving or not. Moving forward it would have higher pressure at the front but less pressure at the rear so total sideways force should even out.

A: I have now located a highly related answer that supports the calculation given at the end of the question, and supports the idea that the ball fired from the horizontally musket will stay aloft longer than the ball dropped from the same height, and also supports the idea that a crosswind will exert a stronger sideways force component on a spherical car that is driving forward than when the same car is parked.   Here it is: Calculating wind force and drag force on a falling object
In truth the drag coefficient of a sphere cannot be considered strictly constant due to dependency of Reynolds number on speed, as pointed in another related answer Finding the drag force (Air resistance force) for accelerated ball? , but that doesn't appear to change the basic conclusion stated immediately above.


text:
Q: Google Cloud SQL instance always in Maintenance status & Binary logs issue I've had some of Google Cloud SQL MySQL 2nd Gen 5.7 instances with failover replications. Recently I noticed that the one of the instance overloaded with the storage overloaded with binlogs and old binlogs not deleted for some reason.
I tried restart this instance but it wont start since 17 March.
Normal process with binlogs on other server:

Problem server. Binlogs not clearing and server wont start and always under maintenance in the gcloud console.

Also I created one other server with same configuration and not binlogs never clearing. I have already 5326 binlogs here when on normal server I have 1273 binlogs and they are clearing each day.

What I tried with the problem server:
1 - delete it from the Google Cloud Platform frontend. Response: The instance id is currently unavailable.
2 - restart it with the gcloud command. Response: ERROR: (gcloud.sql.instances.restart) HTTPError 409: The instance or operation is not in an appropriate state to handle the request. Same response on any other command which I sent with the gcloud.
Also I tried to solve problem with binlogs to configure with expire_logs_days option, but it seems this option not support by google cloud sql instance.

A: After 3 days of digging I found a solution. Binlogs must cleared automatically when 7 days past. In 8 day it must clear binlogs. It still not deleted for me and still storage still climbing, but I trust it must clear shortly (today I guess)
As I told - SQL instance always in maintenance and can't be deleted from the gcloud console command or frontend. But this is interesting because I still can connect to the instance with the mysql command like mysql -u root -p -h 123.123.123.123. So, I just connected to the instance, deleted database which unused (or we can just use mysqldump to save current live database) and then I just deleted it. In the mysql logs (I'm using Stackdriver for this) I got a lot of messages like this: 2018-03-25T09:28:06.033206Z 25 [ERROR] Disk is full writing '/mysql/binlog/mysql-bin.034311' (Errcode: -255699248 - No space left on device). Waiting for someone to free space.... Let's me be this "someone".
When I deleted database it restarted and then it up. Viola. And now we have live instance. Now we can delete it/restore database on it/change storage for it.


text:
Q: Where is NbSortDirection, NbSortRequest from @nebular/theme? I am getting syntax errors for the import below. Can someone tell how to fix this?
All imports in import declaration are unused.ts(6192)

Module '"../../../../../../../../Users/denisputnam/git/nb-niche-app/node_modules/@nebular/theme"' has no exported member 'NbSortDirection'. Did you mean 'NbLayoutDirection'?ts(2724)
direction.service.d.ts(6, 21): 'NbLayoutDirection' is declared here.
import { NbSortDirection, NbSortRequest, NbTreeGridDataSource, NbTreeGridDataSourceBuilder } from '@nebular/theme';

enter code     import { Component, OnInit } from '@angular/core';
import { NbSortDirection, NbSortRequest, NbTreeGridDataSource, NbTreeGridDataSourceBuilder } from '@nebular/theme';

@Component({
  selector: 'app-checkpoint-criteria',
  templateUrl: './checkpoint-criteria.component.html',
  styleUrls: ['./checkpoint-criteria.component.scss']
})
export class CheckpointCriteriaComponent implements OnInit {
  customColumn = 'name';
  defaultColumns = [ 'size', 'kind', 'items' ];
  allColumns = [ this.customColumn, ...this.defaultColumns ];

  dataSource: NbTreeGridDataSource<any>;

  sortColumn: string = '';
  sortDirection: NbSortDirection = NbSortDirection.NONE;

  constructor() { }

  ngOnInit() {
  }

}

A: Works fine on my side, here's an example https://stackblitz.com/edit/github-7y2b27?file=src%2Fapp%2Fhome%2Fhome.component.ts. Just make sure @nebular/theme version is on 3.4.0 at least.


text:
Q: Hugo list pages for subdirectory? I am using the Tokiwa theme for this project.
here is a link to my repo
In my content folder I have my folders organized as they are in this reference image.

I want to have The main topic (writing) displayed on the home page. If you click on writing I want it to take you to a list page showing the subdirectories "Poems" and "Short Stories" Then if you click on either of those I want it to take you to another list page showing all of the content. I have other broad topics such as "Programming" organized in this same hierarchy and I wanted to get this same set up for each one. Currently my list.html is
{{ define "main" }}

{{.Title}}

    {{.Content}}

{{ range .Pages }}
{{.Dir}}

        {{.Date.Format "2006-01-02"}} | {{.Title}}

{{ end }}

{{ end }}

and in my content.toml file
[menu]
  [[menu.main]]
    identifier = "writing"
    name = "writing"
    url = "/writing"
    weight = 1
     [[menu.main]]
    identifier = "post"
    name = "post"
    url = "/post"
    weight = 2
  [[menu.main]]
    identifier = "poems"
    name = "poems"
    url = "/category/poems"
    parent = "writing"
    weight = 1
  [[menu.main]]
    identifier = "stories"
    name = "stories"
    url = "/category/stories"
    parent = "writing"
    weight = 2

Which seems close, but not exactly right.
Thank you for any help you can offer on this issue.

A: The solution was to have nested _index.md files
so the _index.md file for writing has a hyperlink to poems
poems

Then the _index.md file for poems has a hyperlink to the poem itself. You can make a list of items on these pages.
poem1


text:
Q: Variable value got changed unexpectedly in nodeJS let fulfillmentMessages = []
let multipleRides = formats.text_message
multipleRides.payload.data.text = predefined_responses.intent_report_lost_credential_confirmation_yes.case_ids.response

console.log("Multiple rides Message")
console.log(JSON.stringify(multipleRides))

let noRides = formats.text_message;
noRides.payload.data.text = predefined_responses.intent_report_lost_credential_confirmation_yes_2.response;

console.log("Multiple rides Message after")
console.log(JSON.stringify(multipleRides))

fulfillmentMessages.push(multipleRides)
fulfillmentMessages.push(noRides)

console.log("Going to send these messages")
console.log(JSON.stringify(fulfillmentMessages))

After this code executes multipleRides and noRides have same values in it and array contains the same value twice. Can someone please explain what I am doing wrong here?

A: The main problem here is that both variables, multipleRides and noRides, are referencing the same object, formats.text_message and thus, multipleRides.payload.data is the same object as noRides.payload.data. For that reason, the value stored in multipleRides.payload.data.text is overwritten by the assignment to noRides.payload.data.text. In JavaScript objects are copied by reference and not by value. You will need to do a deep clone of formats.text_message. A shallow copy wont be enough, due to how deep that text is.
This article will give you some hints for doing a deep clone. My advice is to use lodash, the code will be:
const _ = require('lodash')

let fulfillmentMessages = []
let multipleRides = _.cloneDeep(formats.text_message)
multipleRides.payload.data.text = predefined_responses.intent_report_lost_credential_confirmation_yes.case_ids.response

console.log("Multiple rides Message")
console.log(JSON.stringify(multipleRides))

let noRides = _.cloneDeep(formats.text_message);
noRides.payload.data.text = predefined_responses.intent_report_lost_credential_confirmation_yes_2.response;

console.log("Multiple rides Message after")
console.log(JSON.stringify(multipleRides))

fulfillmentMessages.push(multipleRides)
fulfillmentMessages.push(noRides)

console.log("Going to send these messages")
console.log(JSON.stringify(fulfillmentMessages))

You could also use JSON.parse(JSON.stringify(formats.text_message))
I hope this helps!


text:
Q: How to re-position Google Maps logo and map buttons How do you change the position of the Google logo (originally at the bottom left corner) and other map buttons (location, zoom in/out, etc.) of the GoogleMap widget?
I would also like to know if you can disable/enable them.
I am using google_maps_flutter package version ^0.5.19.

A: I found a workaround,
not the best solution I guess, but should work
simply add padding to GoogleMap() widget, set bottom and left values as your wish
new GoogleMap(
    padding: EdgeInsets.only(bottom: 100, left: 15), // <--- padding added here
    // rest of parameters
    // ....
)

NOTE !!
If you pick locations from a point at the center of the screen, adding padding to GoogleMap() should affect/change the values of location picked. so have that considered.
Thank you

A: Google has already simplified this for you,
adapting from Rami answer, you can simply do the following to add padding to your map
      GoogleMap(
        myLocationEnabled: true,
        padding: EdgeInsets.only(bottom: mapBottomPadding, top: 0, right: 0, left: 0),
        myLocationButtonEnabled: true,
        compassEnabled: true,
        mapToolbarEnabled: true,
        mapType: MapType.normal,
        markers: _markers,
        initialCameraPosition: _kLake,
        onMapCreated: (GoogleMapController controller) {
          _controller.complete(controller);
          mapController = controller;
          setState(() {
            mapBottomPadding = 280;
            _goToTheLake();

          });
        },
      ),

The map camera target is adjusted accordingly based on the padding applied to the map either to the left, top, right or bottom.
for further readings go here
Hope this helps.

A: As mentioned by this GitHub issue (open as of July 22, 2020), you must use a StatefulWidget and setState() method when setting padding for the Google Maps logo (or other map buttons).  Without calling setState(), the padding will not properly apply on Android.  This seems to be an issue with the native Android Maps SDK, as the same padding issue occurs in React Native's Google Maps package.
As per Google Maps Platform Terms of Service, you must display the Google logo on your Google Map at all times, so you cannot remove it without a workaround.  However, you can remove other buttons on the Google Map, like the location and zoom in/out buttons.
See the example below for an implementation of padding on the Google Maps logo, as well as removing the location and zoom in/out buttons:
GoogleMap(
    //padding parameter for positioning the Google logo and other map buttons
    padding: EdgeInsets.only(
        bottom: 120,
    ),
    //remove zoom in/out buttons
    zoomControlsEnabled: false,
    //remove location button
    myLocationButtonEnabled: false,
    initialCameraPosition: CameraPosition(
        target: _center,
        zoom: 12.0,
    ),
    onMapCreated: (GoogleMapController controller) {
        //required to apply padding correctly on Android
        setState(() {});
    },
)

To find more info on on parameters of the GoogleMap widget, view the google_maps_flutter package documentation .

A: Apparently there is no direct/reliable way to do so and even if you can somehow use Stack to cover that logo you shouldn't do it either.
You might get into trouble while uploading your app on
Google Playstore.
If you don't care about moral values just read through this:

9.4 Attribution.

(a) Content provided to you through the Service may contain the trade names, trademarks, service marks, logos, domain names, and other distinctive brand features of Google, its partners, or other third party rights holders of content indexed by Google. When Google provides this attribution, you must display it as provided through the Service or as described in the Maps APIs Documentation and may not delete or in any manner alter these trade names, trademarks, service marks, logos, domain names, and other distinctive brand features.

https://developers.google.com/maps/terms
Google already offers a -WIDE- range of free and freemium services from fonts to ... to ... to Flutter. Imagine if you were instead of Google what would you do if you find someone trying to misuse your app's free service which actually costs you money.
If you just want to relocate the icon edit the source code of that package by hovering on GoogleMap() while pressing Ctrl and then right click when the text turns blue. A new window with source code of GoogleMap widget will appear where you can check and edit how the position of the logo is specified but I can't guarantee you that it is allowed.


text:
Q: Why is the tangent space to a point $p$ of $D\subset \mathbb{R}^n$ isomorphic to $\mathbb{R}^n$ I'm having problems with understanding why is it the case. Suppose $D\subset\mathbb{R}^n$ is an open, connected subset and for $p\in D$ define the tangent space $T_pD$ to be the set of the velocities of all curves $(-\epsilon,\epsilon)\to D$ which pass through $p$. The lecture notes I've got claim that for any $p$
$$
T_PD\cong \mathbb{R}^n
$$
The proof goes as follows: let $c:I \to D$ be a curve such that $c(0)=p$, then the velocity of this curve is $c'(0)\in\mathbb{R}^n$.
Conversely, given $v\in \mathbb{R}^n$, let $c(t)=p+vt$ be the curve, then its velocity is $c'(0)=v$, so $v\in T_p D$. But $c$ is a straight line through $p$, so it may not even belong to $D$ at all, how is this not a contradiction?
Also, intuitively, suppose we have a sphere $S^2\subset\mathbb{R}^3$, then surely the tangent space at a point is going to be a plane, not the whole space itself?

A: Regarding your third paragraph: $c$ need only be defined on an interval around $0$ (or may be trivially extended beyond such an interval).
And yes, the tangent space to $S^2$ is isomorphic to $\mathbb R^2$ at each point. But $S^2\subset \mathbb R^3$  has nothing to do wih the situation for an open subset $D\subset \mathbb R^3$.

A: As $D$ is open and $p \in D$, there is $r > 0$ such that $B(p, r) \subseteq D$. Now note that you are free to choose $\epsilon$ in the definition of $c$, so you just choose $\epsilon$ small enough to ensure the range of $c$ is contained in $B(p, r)$ and hence $D$. You don't really need to introduce $B(p, r)$, but it is sometimes helpful to visualise the interior of a circle as opposed to some arbitrary subset of $\mathbb{R}^n$.
As for your second question, note that $S^2$ is not an open connected subset of $\mathbb{R}^3$ so you can't apply the result. $S^2$ is connected, but it is not an open subset of $\mathbb{R}^3$.


text:
Q: using Quick Sequence Diagram Editor for sequence diagrams Anyone have experience with Quick Sequence Diagram Editor? The combination of instant display + text source code + Java implementation is very attractive to me, but I can't quite figure out how to make the syntax do what I want, and the documentation's not very clear. Here's a contrived example:
al:Actor
bill:Actor
atm:ATM[a]
bank:Bank[a]

al:atm.give me $10
atm:al has $3=bank.check al's account balance
al:atm.what time is it
atm:al.it's now
atm:al.stop bugging me
atm:al.you only have $3
atm:bill.and don't you open your mouth
bill:atm.who asked you?
bill:atm.give me $20
al:atm.hey, I'm not finished!
atm:bill has $765=bank.check bill's account balance
atm:yes I'm sure, bill has $765=bank.hmm are you sure?
atm:bill.here's $20, now go away
atm:great, he's a cool dude=bank.I just gave Bill $20
al:atm.what about my $10?
atm:al.read my lips: you only have $3

Here's the result from QSDE in single-threaded mode:

and in multi-threaded mode:

I guess I'm not clear what starts/ends those vertical bars. I have a situation which is single-threaded, but there's state involved, and all the messages are asynchronous. I guess that means I should use an external object to represent that state and its lifetime. What I want is for one timeline to represent the message sequence

*

*al:atm.give me $10

*atm:bank.check al's account balance

*bank:atm.al has $3

*atm:al.you only have $3

and another timeline to represent the message sequence

*

*bill:atm.give me $20

*atm:bank.check bill's account balance

*bank:atm.bill has $765

*atm:bank.hmm are you sure?

*bank:atm.yes I'm sure, bill has $765

*atm:bill.here's $20, now go away

*atm:bank.I just gave Bill $20

*bank:atm.great, he's a cool dude

with the other "wisecracks" representing other miscellaneous messages that I don't care about right now.
Is there a way to do this with QSDE?

A: When a new thread is started (and a message from an user always starts a new thread) it does not stop until it is explicitly stopped or until the diagram ends. E.g. atm:stop terminates the atm thread
here a first attempt
 (everything in multithreaded mode):

al:Actor
bill:Actor
atm:ATM[a]
bank:Bank[a]

al:atm.give me $10
atm:al has $3=bank.check al's account balance
atm:al.you only have $3
atm:stop

bill:atm.give me $20
atm:bill has $765=bank.check bill's account balance
atm:yes I'm sure, bill has $765=bank.hmm are you sure?
atm:bill.here's $20, now go away
atm:great, he's a cool dude=bank.I just gave Bill $20

another version with asynchronous messages
(arguably the messages should be asynchronous, since they are transmitted over the network. Anyway now all arrows look the same)
">" at the start of a message starts a new thread (all messages from users and processes start a new thread by default.)
"&" at the end means that the call returns immediately, and the new thread is not shown. you can use this to simulate sending messages to existing threads.
(all messages TO users and processes always return immediately by default. )

al:Actor
bill:Actor
atm:ATM[a]
bank:Bank[a]

al:atm.give me $10
atm:>bank.check al's account balance
bank:>atm.al has $3&
bank:stop
atm:al.you only have $3
atm:stop

bill:atm.give me $20
atm:>bank.check bill's account balance
bank:>atm.bill has $765&
bank:stop

atm:>bank.hmm are you sure?
bank:>atm.yes I'm sure, bill has $765&
bank:stop

atm:bill.here's $20, now go away
atm:>bank.I just gave Bill $20
bank:>atm.great, he's a cool dude&
bank:stop

The full example with all the wisecracks
it is unclear from the example when exactly a thread in ATM should stop. ATM seems to be acting more like a user or process, not an object. So the example does not necessarily make sense

al:Actor
bill:Actor
atm:ATM[a]
bank:Bank[a]

al:atm[a].give me $10
atm:al has $3=bank.check al's account balance

al:atm.what time is it
atm:al.it's now
atm:stop

atm:al.stop bugging me
atm:al.you only have $3

atm:bill.and don't you open your mouth
bill:atm.who asked you?&
atm:stop

bill:atm.give me $20
al:atm.hey, I'm not finished!&
atm:bill has $765=bank.check bill's account balance
atm:yes I'm sure, bill has $765=bank.hmm are you sure?
atm:bill.here's $20, now go away
atm:great, he's a cool dude=bank.I just gave Bill $20
atm:_
atm:stop

al:atm.what about my $10?
atm:al.read my lips: you only have $3

A: Al and Bill are human. How can a human being possibly be part of a single-threaded situation? Human beings, in contrast to procedures, do not stand still until another procedure returns. They can trigger computational activities and receive signals from a computer, but they do not go down to a thread's stack.
The documentation clearly states (cited from Multithreading Help):
"A newly spawned thread can be distinguished from older threads by the colour of its corresponding lifelines."
"As a rule, a message sent by an actor to an object (dynamically) spawns a new thread."
So this is where your vertical bars come from.
If you want single- or dual-threaded situations, you should use objects, not actors.


text:
Q: Abstract class c++ (error LNK 2001: unresolved external symbol) I'm getting this error when i make an object of a child class which implements virtual function of Base class.

error LNK2001: unresolved external symbol "public: virtual void __thiscall CateringOrder::[Order]::calcTotals(void)" (?calcTotals@?QOrder@@CateringOrder@@UAEXXZ)

whereas my code is
class Order
{
private:
    float SANDWICH_PRICE;
    float TOCOS_PRICE;

public:
    string customerType;
    int NumberOfSandwiches;
    int NumberOfTacos;
    float SandwichSubtotal;
    float Subtotal;
    float TacosSubtotal;
    float Total;
    int TotalItems;

    virtual void calcTotals()=0;

    virtual ~Order(){};

};

//child class 1
class ConsumerOrder:public Order{
private:
    float SALES_TAX_RATE;
public:
    string CustomerName;
    float SalesTax;
    void calcTotals() override;
    string ToString();

};

// child class 2
class CateringOrder: public Order
{

public:
    string CustomerCode;
    float DeliveryFee;
    bool PreferredCustomer;
    void Order::calcTotals(void) override;
    string ToString();

};

//other class
static class Validation
{
public:
    bool CheckCustomerCode();
    bool CheckCustomerType();
    float CheckDeliveryFee();
    int CheckItem();

};

now when i make object of base class then it shows error after compiling it.
bool Validation::CheckCustomerCode()
{
CateringOrder obj;

string tempCode = obj.CustomerCode;

return true;
}

A: Well, the linker error you get would suggest that you never provided a definition for
void CateringOrder::calcTotals(void) {…}

Apart from that, writing something like this:
void Order::calcTotals(void) override;

in a class definition is not legal C++. While this non-standard syntax works with the Visual C++ compiler, it is kept around there only for compatibility reasons. The proper version would be to simply write
void calcTotals(void) override;


text:
Q: Getting the container from the given structure using selector consider the following html structure:

123

123

Now I want to pick the container on the basis of class="top" and id="id2" in such a way that i get the container with class top. How can I do that? I would like to have some selector for that.
P.S: the id i am looking for is not necessarily to be an immediate parent of the class top.

A: Is this what you're looking for?
$('#id2').closest('.top')

It will start with the ID and travel up until it finds the class top.

A: Use .closest(...)
$('#id2').closest('.top');

Or if your structure is always as you have it in the question, then maybe a simple,
$('#id2').parent();

will do.

A: If by "container" you mean the markup, not the DOM element add this somewhere in javascript:
jQuery.fn.outerHTML = function(s) {
    return (s)
        ? this.before(s).remove()
        : jQuery("
").append(this.eq(0).clone()).html();
}

Then use it like this:
$('.top').outerHTML();


text:
Q: Show that $2 t f^{\prime}(t)-(2 t+1) f(t)+\frac{1}{\sqrt{\pi}}=0$ Consider the power series
$$
f(t)=\sum_{n=0}^{\infty} \frac{1}{\Gamma\left(n+\frac{1}{2}\right)} t^{n}, \quad(\Gamma \text { is the Gamma function) }
$$

*

*Determine the set of convergent $D$ of the power series

*Show that for all $t \in D$
$$
2 t f^{\prime}(t)-(2 t+1) f(t)+\frac{1}{\sqrt{\pi}}=0
$$

*Deduce the closed form of $f(t)$.

My answer that I have tried.
For (1), I find the radius of convergent by using $$R=\lim_{n\to+\infty}\frac{|a_n|}{|a_{n+1}|}=+\infty$$
Then the set of convergent $D=\mathbb{R}$
For (2) I have tried by finding:
$$f^{\prime}(t)=\sum_{n=1}^{\infty}\frac{n}{\Gamma\left(n+1/2\right)}t^{n-1}$$
$$2tf^{\prime}(t)=\sum_{n=1}^{\infty}\frac{2n}{\Gamma\left(n+1/2\right)}t^{n}$$
$2tf^{\prime}(t)-(2t+1)f(t)= \sum_{n=1}^{\infty}\frac{2n}{\Gamma\left(n+1/2\right)}t^{n}-(2t+1) \sum_{n=0}^{\infty}\frac{1}{\Gamma\left(n+1/2\right)}t^{n} $
$$2tf^{\prime}(t)-(2t+1)f(t)= \sum_{n=0}^{\infty}\frac{2n-2t-1}{\Gamma\left(n+1/2\right)}t^{n} $$
Then I stuck on this part.
Could you give me some recommendations to do this ?

A: Note that $1/\sqrt\pi=f(0)$, so that
\begin{align*}
2tf'(t)-f(t)+f(0)&=\sum_{n=1}^\infty\frac{2n-1}{\Gamma(n+1/2)}t^n
\\\color{gray}{\big[\Gamma(z+1)=z\Gamma(z)\big]}\quad&=2\sum_{n=1}^\infty\frac{t^n}{\Gamma(n-1/2)}
\\\color{gray}{\big[n\mapsto n+1\big]}\quad&=2\sum_{n=0}^\infty\frac{t^{n+1}}{\Gamma(n+1/2)}=2tf(t).
\end{align*}
Regarding the closed form, we just solve the resulting ODE: $$f(t)=e^t\sqrt{t}\left(\textrm{const.}-\int\frac{e^{-t}\,dt}{2t\sqrt{\pi t}}\right);$$ using integration by parts and the condition $f(0)=1/\sqrt\pi$, we obtain $$f(t)=\frac1{\sqrt\pi}\left(1+e^t\sqrt{t}\int_0^t\frac{e^{-x}}{\sqrt{x}}\,dx\right).$$
This can also be written as $f(t)=f(0)+e^t\sqrt{t}\operatorname{erf}\sqrt{t}$.


text:
Q: how to view certificate detail that contains more than one certificates In ubuntu 16.04 OS there is /etc/ssl/certs/ca-certificates.crt which has a lot of:
-----BEGIN CERTIFICATE-----
xxx
-----END CERTIFICATE-----

how can I view what certificates are in the file as individual certificate, one by one?
I have tried:
openssl x509 -noout  -issuer -subject -dates -in ca-certificates.crt

but it looks as there is only one cert in it:
issuer= /CN=ACCVRAIZ1/OU=PKIACCV/O=ACCV/C=ES
subject= /CN=ACCVRAIZ1/OU=PKIACCV/O=ACCV/C=ES
notBefore=May  5 09:37:37 2011 GMT
notAfter=Dec 31 09:37:37 2030 GMT

Shouldnt there be more? How can I see all of them?


text:
Q: How to navigate to a closing bracket with ReSharper? Say you have a large amount of C# code in an if statement.  If you place your carat next to the opening bracket, is there a hotkey or something in ReSharper that will automatically take you to the closing bracket?

A: See Go to Matching Brace in Visual Studio? (now as an answer as requested!)

A: ReSharper assigns the shortcut (Control + ´ - I have german keyboard) to a different command. In order to restore it go to Tools - Options - Environment - Keyboard, search for Edit.GotoBrace and enter the desired shortcut key.
See to what command it is currently assigned and then remove it for this command first by searching this command and clicking Remove. Then again search for Edit.GotoBrace and assign the shortcut.
Directly assigning without Removing it first didn´t work.

A: VS offers this shortcut, regardless of whether you have R# installed.
Ctrl + ] will take you to the opening brace.  Subsequent presses will jump between the RHS/LHS of the scope.

A: Visual Studio's shortcut is (under the IntelliJ shortcut set): Control + ] when your cursor is on the opening brace goes to the ending brace. The inverse is also true.


text:
Q: urlretrieve returns an empty file I'm trying to use urlretrieve to download files from urls that take the form:
http://example.com/download.php?id=6456&name=foo
yet for some reason I just get an empty response.
I've tried the method suggested in this question didn't seem to help because
remotefile.info()

doesn't contain the key 'content-disposition', only
['content-length', 'x-powered-by', 'refresh', 'server', 'connection', 'date', 'content-type']

Any suggestions?

A: Information from manual:

info() — return the meta-information
  of the page, such as headers, in the
  form of an httplib.HTTPMessage
  instance (see Quick Reference to HTTP
  Headers)

What keys do you have in dict remotefile.info()?
Can you get a full header information?


text:
Q: Access VBA - To get data from Excel file stored in Sharepoint I have the below code working for me provided the "Model_data.xlsm" file is stored in my hard drive. Is it possible if Access can get the data from "model_data.xlsm" stored in Sharepoint?
Private Sub Update_manu_data_Click()

Dim strXls As String

 strXls = CurrentProject.Path & Chr(92) & "Model_data.xlsm"
 DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12,   "Manufacturing_data", _
 strXls, True, "Combined!"

End Sub

A: Finally I did find a workaround for this issue.
I Created a private function in access to download the Excel file from SP and then used the Transferspread sheet function to retrieve the data into access table.
Below is the code i used to download the Excel file in SP using access Vba
 Private Sub Command2_Click()
  Dim Ex As Object
  Dim Acc As Object
  Dim strXls As String

    Set Ex = CreateObject("Excel.Application")
    Set Acc = Ex.Workbooks.Open("https://Sharepoint File link")

    Ex.Visible = False

    Acc.SaveAs "C:\Users\.......\test.xlsx"

    Acc.Close
    Ex.Quit

    strXls = CurrentProject.Path & Chr(92) & "C:\Users\.......\test.xlsx"
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "Tablename", _
    strXls, True, "Sheet(1)!"
 End Sub

A: Sub ConnectToExcel()
    Dim strSharePointPath As String
    Dim strExcelPath As String
    Dim strConnectionString As String
    Dim cnn As ADODB.Connection
    Dim rs As ADODB.Recordset

    ' Set the SharePoint path and Excel file name
    strSharePointPath = "http://yoursharepointurl.com/YourSharePointFolder/"
    strExcelPath = "YourExcelFile.xlsx"

    ' Build the connection string
    strConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
        "WSS;IMEX=0;RetrieveIds=Yes;" & _
        "DATABASE=" & strSharePointPath & ";" & _
        "LIST=" & strExcelPath & ";"

    ' Open the connection
    Set cnn = New ADODB.Connection
    cnn.Open strConnectionString

    ' Open a recordset
    Set rs = New ADODB.Recordset
    rs.Open "SELECT * FROM [Sheet1$]", cnn

    ' Loop through the recordset and display the data
    Do While Not rs.EOF
        Debug.Print rs.Fields(0).Value
        rs.MoveNext
    Loop

    ' Clean up
    rs.Close
    Set rs = Nothing
    cnn.Close
    Set cnn = Nothing
End Sub


text:
Q: How many points to find a polynomial? I would like to fit a formula $ax^b + cx^d+ e$ to a set of points.  I have two questions.

*

*If my data were perfect, how many points do I need in the worst case to get $a,b,c,d,e$ exactly?

*If my data aren't perfect, but the underlying unknown function is really something like $a\sqrt{x} + cx^{0.2} + 5000$, say, what's a good way to estimate $a,b,c,d,e$ from the data?

Update.  Following answers/comments below, if we treat 2. as a least squares minimisation problem, is it convex?  Asked separately at Is $ \sum_{1 \le k \le n} (y_k - a x_k^b + c x_k^d + e)^2 $ convex? .

A: You have 5 unknowns, so 5 points are enough to set up a set of 5 equations in the 5 unknowns. Solving it will require numerical methods.
A "good method" would be to (ab)use least squares: You can define for your $n$ data points $(x_k, y_k)$:
$$
f(a, b, c, d, e) = \sum_{1 \le k \le n} (y_k - a x_k^b + c x_k^d + e)^2
$$
and try to find (again, numerically) the values of the unknowns. Many times such systems turn out to be such that the value of $f$ is rather insensitive to the unknowns, specially if the data don't align very well.

A: $\def\sgn{\mathrm{sgn}}$Answer to 1: Assuming that all the variables are real, $5$ positive values of $x$ is enough.
Proof: Suppose to the contrary that there were two different polynomials $a x^b+c x^d + e$ and $A x^B + C x^D + E$ interpolating through data points $(x_1, y_1)$, $(x_2, y_2)$, ..., $(x_5, y_5)$. Then all the $x_i$ are zeroes of the polynomial
$$A x^B - a x^b + C x^D - c x^d + (E-e).$$
This polynomial has only $5$ nonzero terms so, by Descartes' rule of signs, it can only have $4$ positive real roots. $\square$.
Although I, like you, have been referring to polynomials, I understand that you want your exponents to be real. Fortunately, Descartes' rule of signs works with real exponents. I can supply a proof if needed; it seems to be tricky to find a reference to this fact online.
I don't know the answer to the (much more interesting) question 2.

$\def\sgn{\mathrm{sgn}}$
Descartes' Rule of Signs for real exponents: Let $\lambda_1 < \lambda_2 < \cdots < \lambda_n$ be real numbers, and let $a_1$, $a_2$, ..., $a_n$ be $n$ other real numbers. Let there be $m$ indices $i$ for which $a_i$ and $a_{i+1}$ have different signs. Then the function $f(x) := \sum a_i x^{\lambda_i}$ has at most $m$ positive real roots.

Proof by induction on $m$: If $m=0$, then all the $a_i$ have the same sign, say without loss of generality all the $a_i$ are positive. Then $f(x)$ is positive for all $x>0$, and has no roots.
Now consider $m>0$. Let $f(x)$ have $r$ positive real roots, and let $\sgn(a_1) = \sgn(a_2) = \cdots = \sgn(a_i) = - \sgn(a_{i+1})$. Set $g(x) = x^{- \lambda_i} f(x)$. So $g(x)$ also has $r$ positive real roots and, by Rolle's theorem, $g'(x)$ has at least $r-1$ real roots.
We have
$$g'(x) = \sum_{j=1}^{i-1} (\lambda_j-\lambda_i) a_j x^{\lambda_j-1} + \sum_{j=i+1}^{n} (\lambda_j-\lambda_i) a_j x^{\lambda_j-1}.$$
We have
$$\sgn( (\lambda_1-\lambda_i) a_1) = \sgn( (\lambda_2-\lambda_i) a_2) = \cdots = \sgn( (\lambda_{i-1}-\lambda_i) a_{i-1}) = \sgn( (\lambda_{i+1}-\lambda_i) a_{i+1})$$
and, for $j \geq i+1$, we have $\sgn( (\lambda_j-\lambda_i) a_i) = \sgn(a_i)$. So $g'(x)$ has one fewer sign alternation than $f$ did. By induction, $g'$ has at most $m-1$ positive real roots.
Combining this with the Rolle's theorem bound, $r-1 \leq m-1$, so $r \leq m$, as desired. $\square$.


text:
Q: Why is the temperature of a black hole given by $T=E/2S$? Naively, I would imagine that
$$
 T = \frac{E}{S}
$$
However, for a black hole, $E=c^4 R / 2G$ and $S= A k c^3 / 4 G \hbar $, which yields
$$
 T = \frac{E}{2S}
$$
Is there a simple explanation for the factor 2?

A:
Is there a simple explanation for the factor 2?

Yes. This is a consequence of a purely mathematical fact called Euler's homogeneous function theorem. For (nonrotating and uncharged) black holes  the first law of black hole mechanics could be written as
$$
dM = T dA,
$$
But since the mass $M$ of a black hole is a homogeneous function of degree $\frac 12 $ in area $A$, the mass could be expressed as a bilinear form:
$$
M = 2 \, T A .
$$
This relationship could also be generalized to include angular momentum $J$ and electric charge $Q$:
$$
 M = 2\, T A+2\,\Omega J+ \Phi Q,
$$
where $\Omega$ is the angular velocity and $\Phi$ is electromagnetic potential at the horizon (there is no $2$ in the last term). This formula is known as Smarr relation.


text:
Q: How to convert Bean to Object and how to retrieve Bean from Object in Java I have following bean file.and I would like to put this bean to Map<String, Object> as key of bean.
Bean.java
@SuppressWarnings("serial")
public class bean implements Serializable {
    @Getter @Setter
    private param
 }

BaseAction.java
public class BaseAction extends ActionSupport implements SessionAware {
    // session
    @Getter @Setter
    protected Map<String, Object> session;

    public execute(){
     session.put("loginUser", "userA");
     session.put("bean", bean);
     session.get("bean");
   }

}

After execute above setter,I retrieve this Bean by following getter.
It seems that session.get("bean") seems to be regarded as Object. and caught some error , so that we cannot use bean's setter and getter.
 @Getter @Setter
 private Bean bean= new Bean();

setBean(session.get("bean"))

method setBean(Bean) is not applicable for the arguments(Object)

Are there any good way to put bean to Map<String, Object> ?

A: You can try to convert type of session.get("bean") to Bean just like this:
setBean((Bean)session.get("bean"))

A: The session Map is implemented as Map<String, Object>, and you need to keep types at least to the setter method of the SessionAware interface.
You can convert any object you put into the session to different types using Struts Type Conversion. Since you injected a session object from the action context, it gets and puts objects to the #session via OGNL on the view layer. It uses property accessors of the objects to get its values. You still keep the value as Object in the Struts tags attributes.
If you know the instance type of the object you put into the session then you can always convert to string values to this type from parameters of the request. No need to explicitly typecast to the instance type.
The following code will work the same as above.
@Getter @Setter
private Object bean= new Bean();

setBean(session.get("bean"))