text:
Q: What's the main difference between account and organization,collection in Azure DevOps? I have worked with TFS for server years. We will move to Azure DevOps in next month.
After go through some docs, got some questions in below:

*

*Why we call an organization for a url not account?

*Why Azure DevOps only have one collection (default collection) unlike TFS server?

*If one organization corresponding to one collection, when we move TFS to Azure DevOps, do we have to create multiple organizations for multiple collections?

A: This is a problem left over by history, some old docs/blogs may not updated timely.
For example, in documentation:
To sign in to your Azure DevOps account at any time, go to https://{youraccount}.visualstudio.com.
… should become:
To sign in to your AzureDevOps organization at any time, go to https://{yourorganization}.visualstudio.com
This change  rolled out with our Sprint 137 Update:

Adopt the word "organization" when referring to a collection of projects in Azure DevOps
We've made a change to our terminology when it comes to referring to a
  collection of projects in Azure DevOPS.
Previously we used the term "account" but have found that this has
  caused a lot of confusion for the broader developer and open source
  community. We've chosen to replace the term "account" with
  "organization". You'll start seeing this change roll out in
  documentation and in-product with this Update.

You account could create or be added in multiple organizations, for example:

As for moving TFS to Azure DevOps, create multiple organizations or not, it's based on your company's need. We suggest to do this if you use TFS Database Import Service

It provides a high fidelity way to migrate collection databases from
  Team Foundation Server (TFS) to Azure DevOps Services. It's
  recommended that you download the migration guide if you're
  looking to use this service to import your collection(s).
The guide
  serves as a walk through of the different steps involved in an import.
  Providing best practices, checklists, and helpful tips to make your
  import as easy as possible. The guide should be used in conjunction
  with the more technical documentation referenced below to successfully
  import to Azure DevOps Services.


text:
Q: Migrate calendar data from Snow Leo server to Lion server I have a big problem that doesn't seem to be covered by the migration documentation from Apple. I installed a fresh Lion server on a backup MacMini and I started migrating services. Wiki and OD migrated with some problems that can be solved (links are different in wiki and OD migrated without password because the old configuration was wrong.. but anyway, not these are my problems), but Calendar service (new version, 3) has no Data directory. As far as I can see all "ics" information is now stored in PostgreSQL. Do you have any idea how can I migrate old ics files (from a snow leo server) to this new structure (lion server with postgresql)?
thank you in advance.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Do orthonormal changes of basis affect the inner product? Let $e_1;\ldots,e_n$ and $e_1',\ldots ,e_n'$ be orthonormal basis of a vector space $V$. Consider the vectors $$v=(v_1e_1+\ldots +v_ne_n)=(v_1'e_1'+\ldots +v_n'e_n'),$$ $$u=(u_1e_1+\ldots +u_ne_n)=(u_1'e_1'+\ldots +u_n'e_n')$$
is $\sum_i u_iv_i = \sum_iu_i'v_i'$? That is, is the value of the dot product preserved?

A: I think this question's formulation hides a misunderstanding. The dot product is given up-front, as a map satisfying certain axioms.
If the basis $(e_1,\ldots,e_n)$ is orthonormal with respect to a given dot product "$\cdot$", this means that $$e_i\cdot e_j=\delta_{ij}=\begin{cases}1&&i=j\\0&&i\ne j\end{cases}$$ That is the definition of the word "orthonormal", and it is always taken with respect to a given dot product. (A basis may be orthonormal with respect to one dot product but not with respect to another.)
Then, for two vectors $u=u_1e_1+\ldots+u_n e_n$ and $v=v_1e_1+\ldots+v_n e_n$ it can be proven that $$u\cdot v=u_1v_1(e_1\cdot e_1)+u_1v_2(e_1\cdot e_2)+\ldots+u_nv_n(e_n\cdot e_n)=u_1v_1+u_2v_2+\ldots+u_nv_n$$ (use e.g. distributivity and the other axioms of the dot product) - simply because of $e_i\cdot e_i=1$ and $e_i\cdot e_j=0$ for $j\ne i$.
Of course this formula is then valid for any other orthonormal basis $(e'_1,\ldots, e'_n)$.

Note: A potential source of confusion may be that, on $V=\mathbb R^n$, one (but by no means unique) dot product is given by $$\begin{bmatrix}u_1 \\ u_2 \\ \vdots \\ u_n\end{bmatrix}\cdot \begin{bmatrix}v_1 \\ v_2 \\ \vdots \\ v_n\end{bmatrix}=u_1v_1+u_2v_2+\ldots+u_nv_n$$ and the "standard" basis in $\mathbb R^n$ happens to be orthonormal with respect to that dot product.


text:
Q: Can I link an external javascript within my CSS stylesheet? I'm trying to set something up where my background would scale depending on the user's browser width, but I'm tied to a background set in the external stylesheet under a certain element. I can change the background, I can modify its attributes, but I cannot replace it with a html background.
I've been researching solutions for this and most of them don't seem to work. I even tried linking (in the html) an external JS that detects screen resolution and chooses a bg file accordingly, which is exactly what I need, only the browser doesn't detect it at all, whether I nest the script within the html or just link it. So I'm looking for a way to link it under the bg setting in CSS. From what I read, this is "possible but risky", with no real instructions on how it's done.
I'm willing to try it despite the risk, but I'm also open to alternative suggestions. All I need is to be able to set two different image files (same image, just scaled differently) for small phones vs everything else. I've already looked at srcset but that requires embedding in html, so it's no go for me, although I was excited about it. I don't mind actually editing the images myself.

A: I'm not sure what you mean by link javascript in bg settings in the css.
But you should be able to set different backgrounds using media queries within CSS. Take a look at https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries

A: It sounds as though you're looking for media queries. You can set specific CSS based on media features.
See W3Schools for a description and examples on media queries.


text:
Q: gradient color transition on hover the gradient color on hover was change immediately. I wanna add transition before changing to the color just like span-2.
Is there any solution to make like this?
dont mind me if my english is not good.
check code here ------>https://jsfiddle.net/zv7mkg1r/8/


text:
Q: 3 digit odd numbers that can be formed using 0,3,5,7 - no repetition Q. How many 3 digit odd numbers can be formed using 0,3,5,7, repetition not allowed.
WHAT I DID :-
3 x 3 x 1 = 9
For Hundredth place - It can be filled in 3 ways (any of 3,5,7), we cannot use 0.
For Tens place - It can be filled in 3 ways (from 0,3,5,7) as one of 3,5,7 already filled in hundredth place.
For Ones place - It can be filled in 1 way as  two digits of 3,5,7 already used in above two places and it cannot use 0.
SOLUTION ON THE BOOK SAYS: -
It fills Hundredth first, then Ones and then Second.

3 X 2 X 2 = 12
What is that I'm not understanding or doing wrong??
How is it determined that which order should be followed, like first we should fill hundredth placed then first place then others ?

A: There are $3$ ways to fill the hundreds place. $3$ ways to fill the tens place. But there can be $2$ or $1$ ways to fill in the ones place. For example, $30\_$ has two options, but $35\_$ has only one. It depends on how you fill the tens place. The solution given avoids that problem because it picks the units before the tens.


text:
Q: Send JavaScript Object from main process to renderer process to populate HTML Table Electron I am writing an inventory management application using HTML, CSS, and JavaScript with Electron. I have run into a bit of a roadblock. When I open a JSON File containing the data I want to use to populate the HTML Table in my app, the file is opened and handled processed in the main.js which is the main process of my app. What I need to do is send the processed JavaScript object to index.js (my renderer process) to be able to populate the HTML Table.
main.js:
const { app, BrowserWindow, Menu } = require('electron');
const { dialog } = require('electron');
const fs = require('fs');

let appWindow;
let fileContents;

function createWindow() {
    appWindow = new BrowserWindow({width: 1100, height: 769});
    appWindow.loadFile('index.html');
    appWindow.webContents.openDevTools();

    const template =
    [
        {
            label: 'File',
            submenu:
            [
                {
                    label: 'Open',
                    accelerator: 'Ctrl+O',
                    click: () => {
                        console.log("Open was pressed!");
                        let inventoryData = dialog.showOpenDialog(appWindow, {
                            title: "Open Inventory Data",
                            buttonLabel: "Open File",
                            filters:
                            [
                                {
                                    name: 'JSON',
                                    extensions: ['json']
                                }
                            ],
                            properties:
                            [
                                'openFile',
                                'showHiddenFiles'
                            ]
                        }, (filePaths, bookmarks) => {

                            filePaths.forEach((value, index, array) => {
                                fs.readFile(value, 'utf-8', (err, data) => {
                                    if(err) {
                                        throw err;
                                    }

                                    fileContents = JSON.parse(data);

                                });
                            });
                        });
                    }
                },
                {
                    label: 'Save',
                    accelerator: 'Ctrl+S',
                    click: () => {
                        console.log("Save was pressed!");
                    }
                },
                {
                    label: 'Merge',
                    accelerator: 'Ctrl+M',
                    click: () => {
                        console.log("Merge was pressed!");
                    }
                }
            ]
        }
    ];

    if(process.platform === 'darwin') {
        template.unshift({
            label: 'Inventory Manager',
            submenu:
            [
                {
                    label: 'About Inventory Manager',
                    role: 'about'
                },
                {
                    type: 'separator'
                },
                {
                    label: "Quit Inventory Manager",
                    role: 'quit'
                }
            ]
        });
    }

    const menu = Menu.buildFromTemplate(template);
    Menu.setApplicationMenu(menu);

    appWindow.on('closed', () => {
        appWindow = null;
    });
}

app.on('ready', createWindow);

app.on('window-all-closed', () => {
    if(process.platform !== 'darwin') {
        app.quit();
    }
});

app.on('activate', () => {
    if(appWindow === null) {
        createWindow();
    }
});

A: Every MenuItem has the following click callback signature:

click(menuItem, browserWindow, event)

Thus, you can use browserWindow argument and modify the template to send data back to Renderer process using ipc or directly run js in html:
...
label: 'Open',
accelerator: 'Ctrl+O',
click: (menuItem, browserWindow, event) => {
    let inventoryData = dialog.showOpenDialog(appWindow, {
      ...
    }, (filePaths, bookmarks) => {
      ...
      fileContents = JSON.parse(data)
      // #1 ipc (recommended)
      browserWindow.webContents.send('populate-table', fileContents)
      // #2 execute js
      browserWindow.webContents.executeJavaScript(`
        document.populateTable(fileContents) // whatever u have
      `)
    });
}
...


text:
Q: Rails, I18n, Labels, Default translation Is there any way to set a default label. Lets say I have 5 models all with the attribute Email and I want them all to have the same translation.
sv.yaml
sv:
  helpers:
    label:
      defaults:
        email: "E-post"

This does not work.

A: label(:post, :title)
# => <label for="post_title">Title</label>

 helpers:
  label:
    post:
      body: "Write your entire text here"

http://apidock.com/rails/ActionView/Helpers/FormHelper/label

A: You can refer to an existing yaml label by prefixing the path to an existing translation with a colon ':'. For example, in my tables I have a general section with often-used labels:
coding_systems:
  code:         'Code'
  note:         'Remark'

Later, I refer back to these like this:
attributes:
  a1_code:
    code:      :coding_systems.code
    note:      :coding_systems.note
  a2_code:
    code:      :coding_systems.code
    note:      :coding_systems.note


text:
Q: Co-Occurrence Constraint I am having difficulty writing an XSD I'm working on using XML Schema 1.1.
I have one element named PaymentMethod that is either "C" or "F":
If PaymentMethod = "C", then it's a check.
If PaymentMethod = "F", then it's a fund transfer.
How do I make BankingInfo (BankName, TransitNo, AccountNo, AccountType) optional for a check and mandatory for a fund transfer?
See below for a snippet of my code.

<xs:element name="PaymentMethod">
  <xs:simpleType>
    <xs:restriction base="xs:string">
      <xs:enumeration value="C" />
      <xs:enumeration value="F" />
    </xs:restriction>
  </xs:simpleType>
</xs:element>

    <xs:complexType name="BankingInfo" minOccurs="0">
      <xs:sequence>
        <xs:element name="TransitNo" type="xs:string" />
        <xs:element name="AccountNo" type="xs:string" />
        <xs:element name="AccountType">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:enumeration value="CHK" />
              <xs:enumeration value="SAV" />
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element name="BankName" type="xs:string" />
      </xs:sequence>
    </xs:complexType>

A: You will need to add an assert at the same level as the BankingInfo node because asserts apply at the same level or lower level but can't navigate up to a parent level. The assert test should check the value of account type as well as ensuring the fields that you want to be "required" actually have values.
Either
<xs:assert test="/root/PaymentMethod eq 'C' or (/root/PaymentMethod eq 'F' and count(/root/BankingInfo) > 0)"/>

Or, if you want some bank info to be required but not all the fields you could do something like this
<xs:assert test="/root/PaymentMethod eq 'C' or (/root/PaymentMethod eq 'F' and string-length(/root/BankingInfo/TransitNo) > 0 and string-length(/root/BankingInfo/AccountNo) > 0)"/>

Both of the above assume some structure similar to the below (the provided sections aren't a complete enough example to put the assert in at the right level)
<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" elementFormDefault="qualified" attributeFormDefault="unqualified" vc:minVersion="1.1">
<xs:element name="root">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="PaymentMethod">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="C"/>
                        <xs:enumeration value="F"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
            <xs:element name="BankingInfo" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="TransitNo" type="xs:string"/>
                        <xs:element name="AccountNo" type="xs:string"/>
                        <xs:element name="AccountType">
                            <xs:simpleType>
                                <xs:restriction base="xs:string">
                                    <xs:enumeration value="CHK"/>
                                    <xs:enumeration value="SAV"/>
                                </xs:restriction>
                            </xs:simpleType>
                        </xs:element>
                        <xs:element name="BankName" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:assert test="/root/PaymentMethod eq 'C' or (/root/PaymentMethod eq 'F' and count(/root/BankingInfo) > 0)"/>
    </xs:complexType>
</xs:element>


text:
Q: Topological similarity of solutions to Dirichlet problem Let $\varphi_{1},\varphi_{2}:\mathbb{S}^{1}\rightarrow\mathbb{R}$ be two
smooth general position (Morse) functions having the same set of critical
points $\left\{  p_{1},...,p_{n}\right\}  \subset\mathbb{S}^{1}$ ($n$ is even)
and both $\varphi_{1}$ and $\varphi_{2}$ have a local maximum at $p_{1}$.
Suppose that $\varphi_{1}$ and $\varphi_{2}$ are similar in the following sense:
$\left(  \varphi_{1}(p_{i})-\varphi_{1}(p_{j})\right)  \left(  \varphi
_{2}(p_{i})-\varphi_{2}(p_{j})\right)  >0$ for any $i\neq j$,
i.e. the critical level sets of $\varphi_{1}$ and $\varphi_{2}$ are in some
sense similar.
Consider the corresponding two Dirichlet problems:
$\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \Delta u=0$
$\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ u|_{\mathbb{S}^{1}}=\varphi_{i}$ , $i=1,2$,
getting in such a way two harmonic solutions $u_{1},u_{2}:\mathbb{B}%
^{2}\rightarrow\mathbb{R}$.
Then is it true that the level lines portraits of $u_{1}$ and $u_{2}$ are the
same up to topological equivalence, i.e. there is a homeomorphism
$h:\mathbb{B}^{2}\rightarrow\mathbb{B}^{2}$ fixing all $p_{i}$ and sending the
level lines of $u_{1}$ onto the level lines of $u_{2}$? Then, of course, $h$
is sending the critical set of $u_{1}$ onto the critical set of $u_{2}$.
In brief: does the similarity of the boundary conditions implies similarity
between the solutions of the corresponding Dirichlet problems?
Note that we don't assume $\varphi_{1}$ and $\varphi_{2}$ to be close in any sense.

A: Certainly not. Imagine six critical points: $3$ minima and $3$ maxima so that all minima are about $-1$ and all maxima are about $+1$ (but may be all different if you want).
Now assume that the first minimum is "thick", so the corresponding value of about $-1$ spreads almost until the adjacent maxima. If out of the other two one is thick as well and another one is thin (i.e., the function goes to almost $+1$ if you move away just a tiny bit, then, when your level goes up from $-1$ to $1$, the thick sublevel domains of $u$ will meet before the thin sublevel domain will have any chance to spread anywhere. But you are free to choose whom to feed up to thickness and whom to starve to thinness.


text:
Q: "unexpected" residue formula for $\Gamma^3(s)/(\Gamma(3s)(e^{2\pi is}-1)) $ There is a related problem in my current work: to find the residue of the following function at any negative integer $s=-n$:
$$f(s)=\frac{\Gamma^3(s)}{\Gamma(3s)(e^{2\pi is}-1)}$$
It seems to be a tedious calculation. As far as I know, the first few terms of Laurent series of $\Gamma(s)$ around $s=-n$ are given by
$$\Gamma(s)=\frac{(-1)^n}{n!}\left(\frac 1{s+n}+\psi(n+1)+\frac 16(3\psi(n+1)^2+\pi^2-3\psi'(n+1))(s+n))+\frac16(\psi(n+1)^3+(\pi^2-3\psi'(n+1))\psi(n+1)+\psi''(n+1))(s+n)^2+O((s+n)^3)\right)$$
where $\psi(s):=\frac{\Gamma'(s)}{\Gamma(s)}$ is the digamma function.
So we might expect that the residue formula of $f(s)$ at $s=-n$ involves the values of digamma function and/or its derivatives. However, numerical values indicate that the formula for $Res (f,-n)$ might only involve $\pi$, $i$, and rational numbers, which is quite unexpected. Here are a few examples:
$$Res (f,-3)=7527 + \frac{4299 i}{4 \pi} + 2100i\pi$$
$$Res (f,-10)=\frac {1065144125784453}{40} - \frac {17136782690536253 i}{11200 \pi} + 6938745989175 i \pi$$
I have verified some other integers as well. Can we find any reason for this pattern or any counterexample? It also seems that $f(s)$ is very special, for instance, if we multiply another $\Gamma(s)$ to the numerator, i.e. $g(s)=\frac{\Gamma^4(s)}{\Gamma(3s)(e^{2\pi is}-1)}$, then the formula for $Res(g,-n)$ does not have such property.

A: $\def\Res{\operatorname*{Res}}
\def\G{\Gamma}
\def\e{\varepsilon}
\def\p{\pi}
\def\ZZ{\mathbb{Z}}
\def\QQ{\mathbb{Q}}
\def\NN{\mathbb{N}}
\def\j{\psi}
\def\z{\zeta}
\def\To{\rightarrow}
\def\f{\varphi}
\def\g{\gamma}
\def\a{\alpha}
\def\b{\beta}
\def\i{\mathrm{i}}
\def\bell{\mathcal{B}}
\def\bern{B}
\newcommand\set[1]{\{#1\}}$After a straightforward but tedious calculation one finds that the residue is given by
\begin{align*}
\frac{(3 n)! i}{4 \pi (n!)^3}
    &\Big(8 \pi ^2 +
    18\pi i (H_n-H_{3 n}) -27 (H_n-H_{3 n})^2 \\
    &\quad +9 \big(\psi^{(1)}(n+1)-3 \psi ^{(1)}(3 n+1)\big)\Big)
\end{align*}
Now note that
$H_n, H_{3n}\in\mathbb{Q}$
and
$\psi^{(1)}(m+1) = \pi^2/6 - \underbrace{\sum_{k=1}^m 1/k^2}_{\in\mathbb{Q}}$ for $m\in\mathbb{Z}^+$.
Thus,
$$\Res_{s=-n}f(s) = a + bi/\pi + ci\pi,\quad
\textrm{where }a,b,c\in\mathbb{Q},$$
as claimed.
Addendum
Below we consider a wider class of residues of the form
\begin{align*}
\Res_{s=-n}
\frac{\G(s)^m}{\G(m s)}\a(s),
\end{align*}
where $m\in\NN$ and $\a$ has an isolated pole of order $p$ at $s=-n$.
That is, we examine
\begin{align*}
\Res_{\e=0}
\frac{\G(-n+\e)^m}{\G(-m n+m\e)} \frac{\b(\e)}{\e^p},
\end{align*}
where $\b$ is analytic at $\e=0$.
We find the general form of such residues.
This is an extension of the types of residues suggested by @Wolfgang in the comments.
In the posted question, $m=3$, $p=1$, and $\b(\e) = \e/(e^{2\p \i\e}-1)$.
A routine calculation results in
\begin{align*}
\frac{\G(-n+\e)^m}{\G(-m n+m\e)}\frac{\b(\e)}{\e^p}
    &=
    \frac{1}{\e^{m+p-1}}
    m\b(\e)
    \left(\frac{\p\e}{\sin\p\e}\right)^m
    \frac{\sin\p m\e}{\p m\e}
    \frac{\G(mn+1-m\e)}{\G(n+1-\e)^m}
\end{align*}
where $s = -n+\e$.
Thus,
\begin{align*}
\Res_{s=-n}
\frac{\G(s)^m}{\G(m s)}\a(s)
    &=
    \Res_{\e=0}
    \frac{1}{\e^{m+p-1}} m\b(\e)f(\e)g(\e),
\end{align*}
where
\begin{align*}
f(\e) &=
    \left(\frac{\p\e}{\sin\p\e}\right)^m
    \frac{\sin\p m\e}{\p m\e} \\
g(\e) &= \frac{\G(m n+1-m\e)}{\G(n+1-\e)^m}.
\end{align*}
We find
\begin{align*}
\Res_{s=-n}
\frac{\G(s)^m}{\G(m s)}\a(s)
&=
    m
    \sum_{i+j+k=m+p-2}
    \frac{1}{i!j!k!}
    \b^{(i)}(0)
    f^{(j)}(0)
    g^{(k)}(0).
        \tag{1}
\end{align*}
For the original problem $\b^{(i)}(0) = a_i (\i\p)^{i-1}$, where $a_i\in\QQ$.
In fact, since $\b(\e)$ in this case is essentially the generating function for the Bernoulli numbers $B_i^-$ we find
\begin{align*}
\b^{(i)}(0) = (2\p\i)^{i-1}B_i^-.
    \tag{2}
\end{align*}
The first few derivatives of $f$ are given as
\begin{align*}
f(0) &\equiv\lim_{\e\To0}f(\e) = 1 \\
f'(0) &= 0 \\
f''(0) &= -\frac{1}{3} (m-1) m \pi^2 \\
f'''(0) &= 0.
\end{align*}
Note that $f^{(2i+1)}(0) = 0$ generally.
One can show that, as suggested above,
\begin{align*}
f^{(2i)}(0) &= b_{2i}\p^{2i},
\end{align*}
where $b_{2i}\in\QQ$.
In fact, an explicit form may be found for these coefficients,
\begin{align*}
f^{(2i)}(0) &= (-1)^i \p^{2i} \bell_{2i}(x_1,\ldots,x_{2i}),
    \tag{3}
\end{align*}
where $\bell_i(\cdots)$ is the $i$th complete Bell polynomial,
\begin{align*}
x_j &= \begin{cases}
\frac{m}{j} 2^j (m^{j-1}-1) B_j, & \textrm{$j$ even} \\
0, & \textrm{else},
\end{cases} \tag{4}
\end{align*}
and where $\bern_j$ is the $j$th Bernoulli number.
(Since $j$ is even, there is no distinction between $\bern^-_j$ and $\bern^+_j$.)
The first few complete Bell polynomials are
\begin{align*}
\bell_0 &= 1 \\
\bell_1(t_1) &= t_1 \\
\bell_2(t_1,t_2) &= t_1^2+t_2 \\
\bell_3(t_1,t_2,t_3) &= t_1^3 + 3t_1 t_2+t_3.
\end{align*}
Note that
$$g(0) = \frac{(m n)!}{n!^m} .$$
The first few derivatives of $g$ are given as
\begin{align*}
\frac{g'(0)}{g(0)} &= -m(H_{m n} - H_n)   \\
\frac{g''(0)}{g(0)} &=
    m^2 (H_{m n} - H_n)^2
    + m^2 \j^{(1)}(m n+1)- m\j^{(1)}(n+1) \\
\frac{g'''(0)}{g(0)} &= - \Bigg(m^3 (H_{m n} - H_n)^3 \\
    & \hspace{7ex} + 3 m (H_{m n} - H_n)
    \left(m^2 \j^{(1)}(m n+1)-m\j^{(1)}(n+1)\right) \\
    & \hspace{7ex} + m^3 \j^{(2)}(m n+1) - m\j^{(2)}(n+1)\Bigg),
\end{align*}
where
$H_n$ is the $n$th harmonic number
and where
$\j^{(i)}$ is the polygamma function.
Generally we find
\begin{align*}
\frac{g^{(j)}(0)}{g(0)}
    &= (-1)^j \bell(y_1,\ldots,y_j),
    \tag{5}
\end{align*}
where
\begin{align*}
y_i &= m^{i}\j^{(i-1)}(m n+1)-m\j^{(i-1)}(n+1).
\end{align*}
Note that
\begin{align*}
y_i &= \begin{cases}
m(H_{m n} - H_{n}), & i=1 \\
(-1)^i (i-1)!\Big(
(m^i-m)\z(i) - m^i H^{(i)}_{m n} + m H^{(i)}_n
\Big) & \textrm{else.}
\end{cases}
    \tag{6}
\end{align*}
Thus, residues involving $y_3$ or higher will contain terms involving $\z(3)$.
We find
\begin{align*}
\Res_{s=-n}
\frac{\G(s)^m}{\G(m s)}\a(s)
&=
    m
    \frac{(m n)!}{n!^m}
    \sum_{{0\le i,2j,k\le m+p-2}\atop{i+2j+k=m+p-2}}
    \frac{1}{i!(2j)!k!}
    (-1)^{j+k}\p^{2j}
    \b^{(i)}(0) \\
    &\hspace{25ex}\times
    \bell_{2j}(x_1,\ldots,x_{2j})
    \bell_k(y_1,\ldots,y_k) \\
&= \sum_{{0\le i,2j,k\le m+p-2}\atop{i+2j+k=m+p-2}}
    q(i,2j,k)
    \b^{(i)}(0)
    \p^{2j} \\
    & \hspace{16ex}\times
    \bell_k\Big(q_1,q_2\z(2)+q'_2,
    \ldots,q_k\z(k)+q_k'\Big),
    \tag{7}
\end{align*}
where $q(i,2j,k),q_i,q_i'\in\QQ$ are explicitly calculable.
Thus, the residues involve sums of rational multiples of $\b^{(i)}(0)$ and products of powers of $\z(2),\z(3),\ldots$.
The residues do not involve the Euler-Mascheroni constant unless $\b^{(i)}(0)$ does.
For $\a$ in the question statement we find
\begin{align*}
\Res_{s=-n}
\frac{\G(s)^m}{\G(m s)(e^{2\p\i\e}-1)}
&= \sum_{{0\le i,2j,k\le m-1}\atop{i+2j+k=m-1}}
    q'(i,2j,k)
    \i^{i-1}
    \p^{2j+i-1} \\
    & \hspace{14ex}\times
    \bell_k\Big(q_1,q_2\z(2)+q'_2,
    \ldots,q_k\z(k)+q_k'\Big),
    \tag{8}
\end{align*}
where $q'(i,2j,k)\in\QQ$.
For $m=3$, one can quickly verify that this sum results in a residue of the form $a + b\i/\p + c\i\p$, where $a,b,c\in\QQ$.
(Schematically, the sum will be of the form
$ \{2,0,0\}+\{0,2,0\}+\{1,0,1\}+\{0,0,2\}$.)


text:
Q: React .map giving errors for rendering JSON received from fetch call I'm learning React and am using the fetch API to send a get request to an HTTP server. I'm able to successfully retrieve the JSON. The code for that is as follows :-
componentDidMount() {
                console.log("Send GET request to Go server")
                fetch("http://192.168.121.106:8080/site", {
                        method: "GET",
                        headers: {
                                Accept: "application/json",
                                "Content-Type": "application/json",
                                'Access-Control-Allow-Origin': '*',
                        }
                }).then(response => {
                        if(response.status === 200) {
                                response.text().then(data => {
                                        this.setState({
                                                siteData : data
                                        });

                                });
                        }
                })
        }

I want to render this JSON in the form of a table. siteData is an object. This is what I have in my render function :-
render() {

            const siteVar =  JSON.stringify(this.state.siteData);

            return (
                    <React.Fragment>

                                                    S. NO.
                                                    NAME
                                                    AGE

                                            { (this.state.siteData).map(site =>

                                                             {site.name}
                                                             {site.age}

                                            )}

                    </React.Fragment>
            )
    }
}

With this code, I'm getting an error that:

this.state.siteData.map is not a function

What am I doing wrong here?
This is a sample of what the JSON will look like :-
{
  "1": {
    "name": "Alice",
    "age": "23",
  },
  "2": {
    "name": "Bob",
    "age": "25",
  }
}

A: The reason why you're getting an error is because you're trying to use the map method on an object. You need to turn your object into an array to be able to use map and store that in your state instead.

const response = {
  "1": {
    "name": "Alice",
    "age": "23",
  },
  "2": {
    "name": "Bob",
    "age": "25",
  }
}

const responseAsArray = Object.keys(response)
  .map(key => {
    return {
      siteNum: key,
      ...response[key]
    }
  })

console.log(responseAsArray)

Going back to your code, it'd look like the following:
componentDidMount() {
  fetch(...)
    .then(response => {
      // Note the use of `.json()` here
      // if your API returns some JSON as a response
      // use this instead of `text()` since it will
      // parse a JSON response into native JavaScript objects
      if (response.status === 200) {
        return response.json()
      }
      // TODO: handle errors appropriately
    })
    .then(json => {
      const siteData = Object.keys(json).map(key => {
        return { siteNum: key, ...json[key] }
      })
      this.setState({ siteData })
    })
    .catch(/* TODO: handle errors appropriately */)
}

Here's a working example:

class App extends React.Component {
  state = { siteData: [] };

  componentDidMount() {
    fakeFetch()
      .then(response => {
        if (response.status === 200) {
          return response.json();
        }
      })
      .then(data => {
        const siteData = Object.keys(data).map(key => {
          return { siteNum: key, ...data[key] };
        });
        this.setState({ siteData });
      })
      .catch(console.error);
  }

  render() {
    const { siteData } = this.state;

    if (siteData.length === 0) {
      return "Loading";
    }
    return (

            S. NO.
            NAME
            AGE

          {siteData.map(({ siteNum, name, age }) => (

              {siteNum}
              {name}
              {age}

          ))}

    );
  }
}

// NOTE:
// This assumes your API returns a JSON response
// that looks like like this:
// {"1":{"name":"Alice","age":"23"},"2":{"name":"Bob","age":"25"}}

function fakeFetch() {
  return Promise.resolve({
    status: 200,
    json: () => {
      return {
        "1": {
          name: "Alice",
          age: "23"
        },
        "2": {
          name: "Bob",
          age: "25"
        }
      };
    }
  });
}

ReactDOM.render(
  <App />,
  document.getElementById("app")
)


text:
Q: Passing variables to the library function package <- c("car","ggplot2","pastecs","psych")
for (i in package){
  if (!(i %in% rownames(installed.packages()))){
    install.packages(i)
  } else{
     print(paste(i,"has been installed"))
     library(i)
     }
 }

I wrote a loop to see whether the package is installed, and if it is available, the library should load it.
However I got an error: there is no package called 'i'

Why can't I pass the value in variable i to the library function ?

A: Here's a simpler version of your code (incorporating @csgillespie's suggestion):
p <- c("car","ggplot2","pastecs","psych")
for(i in seq_along(p)) {
    if(!require(p[i], character.only=TRUE)) {
        install.packages(p[i])
        library(p[i], character.only=TRUE)
    }
}

Note that your code does not work because of non-standard evaluation in library and require. The character.only argument resolves this (per documentation ? library):

character.only
  a logical indicating whether package or help can be assumed to be character strings.


text:
Q: Javascript Optimization I can't seem to figure out how to get this JS to work. The scroll function works but not the hide. Also is there anyway to do this with less lines of code? I want .down-arrow to fade out after 50px and hide after the 50px that way it can't be clicked on. It was working on my site and codepen, but then it randomly stopped working. The code is clearly wrong, but somehow it was working...
JS:
$(window).scroll(function() {
  $(".down-arrow").css("opacity", 1 -
    $(window).scrollTop() / 50 );
});

$(window).scroll(function() {
  $(".down-arrow").hide(fast);
   $(window).scrollTop() > 50 );
});

[Edit]
Here is the new JS I wrote with advice on the obvious syntax error and suggestions to place it all in one body, which I was hoping to do anyways:
$(window).scroll(function() {
  $(".down-arrow").hide("fast");
    $(".down-arrow").css("opacity", 1 -
      $(window).scrollTop() / 50 );
});

But now I want the arrow to show when the use goes back up to the top, above the 50px mark.

A: First of's first, there is no need to register a funcition twice
var element = $(".down-arrow");
$(window).scroll(function() {
  if( $(window).scrollTop() > 50){
   element.css("opacity","0");
   if(!element.hasClass("hidden")){
     element.addClass("hidden");
   }
   }else{
   $('.down-arrow').removeClass("hidden") // if there is nothing, nothing to remove
   $(".down-arrow").css("opacity", 1 -$(window).scrollTop() / 50 );
   }
});

Some CSS change :
.down-arrow.hidden{
  display:none;
}
.down-arrow:hover {
  //you have to overwrite inline opacity , which js makes..
  opacity: 1 !important;
}

Now it should work as expected, try :)


text:
Q: Xcode 13.2.1 Preview Not Working but Simulator Works My Xcode Version 13.2.1 (13C100) got an unknown issue. I did several things like delete Xcode, new install Xcode, restore from backup nothing make any change! Currently, the project can be built and run in the simulator, but not in the preview window! it gives a message:
Cannot preview in this file - Timed out waiting for connection to DTServiceHub after 15.0 seconds.
What is the issue here any idea?
iMac becomes very slow when I taped the resume button.
Please Help!

A: I had a similar problem and was solved when I turned of Automatically refresh canvas

A: Suddenly It fixed, maybe the last update from apple through a software update called "Command Line Tools for Xcode". Before I have also tried a fresh OSX installation but the issue has not gone at all.
Check Software Update from system preference.

Thanks to the great community.

A: Try the following:

*

*Clicking on the "Diagnostics" button on the failed preview pane.

*Copy the ".pcm" file path. It looks like something similar to "/var/folders/aa/xxxxxxxxxxxxxxxxxxxxxxx/C/clang/ModuleCache/12345ABCDE/MyTest-XXXXXXXXXXXXXX.pcm"

*Run the following command to remove the .pcm file in the Terminal app (replace the path using the specific path you copied from the Diagnostics log obtained in the step above:
rm -rf /var/folders/aa/xxxxxxxxxxxxxxxxxxxxxxx/C/clang/ModuleCache/12345ABCDE/MyTest-XXXXXXXXXXXXXX.pcm
References:

*

*https://support.macincloud.com/support/solutions/articles/8000098646

*https://developer.apple.com/forums/thread/696908

A: For me, it worked when I changed the device to Any iOS Device(Arm 64) for the preview

A:
on a Mac with apple silicon chip

*

*CTRL + Click on Xcode app

*Get info

*Check "open using Rosetta"

A: I had the same problem:
No preview with diagnostic : "Cannot preview in this file - Timed out waiting for connection to DTServiceHub after 15.0 seconds".
Tried the solutions found on the internet, without success.
I switched to macOS beta 12.3 and Xcode 13.2.
And now there is the preview...

A: The below solution has worked for me:
Running a preview for a project having scenedelegate or appdelegate which worked and then i tried running preview for app protocol style project which was not working earlier.


text:
Q: Exception in Windows Phone Store failure log I often see in Windows Phone Store (Windows Phone 8.1 Runtime app) failure log this exception:
EM_WATCHDOG_TIMEOUT_DEADA444_Template.exe!{XXXXXXXX-D1A3-49E7-XXXX-316A928B125C}_Task_disconnected_while_still_running:_server_task_currentState_=_Hiding,_targetState_=_Inactive.

Stack trace is empty, I can't deal with the exception. What could be the problem?


text:
Q: Height Media Queries not working properly on iPhone 6 with Safari I have the following media queries which supposed to work in iPhone and Android in a Webview:
@media (max-height: 275px) {
  .logo {
    display: none;
  }
}

@media (max-height: 365px) {
    .default-title {
        display: none;
    }
}

@media (max-height: 450px) {
    .logo {
        padding-top: 1rem;
    }
}

@media (max-height: 315px) {
    .logo {
        padding-top: 0;
    }
}

Basically it is supposed to make elements shrink/disappear as workspace height decreases.
It works very well on Android devices, but is completely ignored on my iPhone 6. It's as though Safari is completely unaware that the keyboard is open. If that's the case, then I have 3 questions:

*

*How to detect the keyboard opening/closing

*It is possible to make these media queries work for both Android and iPhone?

*Does this have something to do with the Retina display of the iPhone 6?

A: Reorder your media queries form max to min:
@media (max-height: 450px) {
    .logo {
        padding-top: 1rem;
    }
}

@media (max-height: 365px) {
    .default-title {
        display: none;
    }
}

@media (max-height: 315px) {
    .logo {
        padding-top: 0;
    }
}

@media (max-height: 275px) {
    .logo {
        display: none;
    }
}


text:
Q: c# circular flatten arrays I'm trying to flatten a 3 dimensional array of (x,y,z) coordinates to a flatten array.
So here it basically says the solution is;
elements[x][y][z] = Tiles[x + y*WIDTH + Z*WIDTH*DEPTH]

This is all good for me except that the above one prioritise x-coordinate when iterating.
The thing is that while I iterate the array, I mostly linearly access y values. To give an idea all of my iterations are like
        for (int x = -someXVal; x <=  someXVal; x++)
        {
            for (int z = -someZVal; z <= someZVal; z++)
            {
                for (int y = -someYVal; y < someYVal; y++ )
                {

So i want to prioritise y-coordinate in the flatten list so that my linear y-coordinate read/writes will perform better.
I further found some interesting read here, where he basically uses circular flatten array (and yes I also need my array to be circular).
To calculate a pointer to x,y,z coordinate, he uses the following function;
Public Shared Function GetPTR(ByVal x As Integer, ByVal y As Integer, ByVal z As Integer) As Integer

    Dim bx, bz As Integer

    bx = x Mod BlockBuffWidth
    If bx < 0 Then
      bx += BlockBuffWidth
    End If
    bz = z Mod BlockBuffWidth
    If bz < 0 Then
      bz += BlockBuffWidth
    End If

    Return bx * BMX + bz * BMZ + y

  End Function

I'm really not sure about how he calculates BlockBuffWidth, BMX and BMZ.
The following piece of code is what I came up with;
/// <summary>
/// Flatten offset x step to advance next block in x direction.
/// </summary>
public static readonly int XStep = CacheLenghtInBlocks*Chunk.HeightInBlocks;

/// <summary>
/// Flatten offset z step to advance next block in z direction.
/// </summary>
public static readonly int ZStep = Chunk.HeightInBlocks;

public static int BlockIndexByWorldPosition(int x, byte y, int z)
{
    var wrapX = x%CacheWidthInBlocks;
    if (wrapX < 0)
        wrapX += CacheWidthInBlocks;

    var wrapZ = z%CacheLenghtInBlocks;
    if (wrapZ < 0)
        wrapZ += CacheLenghtInBlocks;

    var flattenIndex = wrapX * XStep + wrapZ * ZStep + y;
    return flattenIndex;
}

and obviously my code doesn't work as expected. Any ideas welcome.

A: So:
elements[x][y][z] = Tiles[x + y*WIDTH + Z*WIDTH*DEPTH]

Is ok for you but you want to group y values next to each other for the same x and z:
elements[x][y][z] = Tiles[y + x*HEIGHT + Z*HEIGHT*DEPTH]

Where HEIGHT = max y + 1


text:
Q: JavaScript update textarea freezes Chrome, but not Firefox On a page there is an upload button that allows a user to upload a text file and the file contents are input into a textarea box on the same page.  When testing with a 3MB text file using this function in Firefox, it works fine.  But when using with Chrome, the browser locks up and the animation loader freezes for a bit and then the page becomes responsive again.  Here is the relevant js code:
function getFile(event) {
  const input = event.target
  if ('files' in input && input.files.length > 0) {
    placeFileContent(document.getElementById('corpus'), input.files[0]);
    setTimeout(function() {
      $('#characters').text($('#corpus').val().length.toLocaleString());
      $('#words').text($('#corpus').val().trim().split(/\s+/).length.toLocaleString());
    }, 10);
  }
}

function placeFileContent(target, file) {
  readFileContent(file).then(content => {
    target.value = content;
  }).catch(error => console.log(error))
}

function readFileContent(file) {
  const reader = new FileReader()
  return new Promise((resolve, reject) => {
    reader.onload = event => resolve(event.target.result)
    reader.onerror = error => reject(error)
    reader.readAsText(file)
  })
};

The upload button code:
$('#uploadCorpus').on('change', function(event) {
  $("#corpus").LoadingOverlay("show");
  setTimeout(function() {
    getFile(event);
  }, 1000);
  $("#corpus").LoadingOverlay("hide", true);
})

I removed the animation, abd the counting of words/characters and the problem still persists.  Using Chrome dev tools, the lag is in the layout action afte the text has been read.  When I just put the content into a var, there is no lag in the browser.  Instead of updating the textarea value, is there some other way of updating without locking the UI?  The user will edit the file before submitting to DB.
I disabled spellcheck, autocomplete, etc.

A: This seems to be an issue in Chrome even when pasting large text. I mitigated it by checking file size and if over x upload without viewing text in browser.
var size = document.getElementById('uploadCorpus').files[0].size;


text:
Q: How Can I Call To An Object, When It Is Lower In the Code (Java) How Can I Call To An Object, When It Is Lower In the Code (Java)
This is an Example:
class examp {
int i = 8;
void test() {
if(L.i == M.i)System.out.println("Hello!");
}
}
public static void main(String args[]) {
examp L = new examp;
examp M = new examp;
}

A: You can do this
class Example {
    int i = 8;
    static void test(Example l, Example m) {
        if(l.i == m.i)
           System.out.println("Hello!");
    }
}

class Main {
    public static void main(String[] args) {
        Example l = new Example();
        Example m = new Example();
        Example.test(l, m);
    }
}

A: You must send those variables as parameter to your test method.
class examp {

    int i = 8;

    public static void test(examp L, examp M) {
        if (L.i == M.i) {
            System.out.println("Hello!");
        }
    }

    public static void main(String args[]) {
        examp L = new examp();
        examp M = new examp();
        test(L, M);
    }
}

A: You should declare L and M as instance variables. Declare them outside of methods. YOu may need to make them static.

A: I try to help ;)
void test() become static void test(examp L, examp M).
int i = 8 become int i;
when you instance your objects in main you must assign the value of i, in two ways
L.i = 8;
M.i = 10;
or
build a specific constructor where you pass the value of i
Finally in your main call examp.test(L, M).
P.S. By convention name of object have capitol letter.  exam become Exam

A: How about this:
class examp {
    int i = 8;
    void test(examp other) { // your test needs parameters
        if(this.i == other.i)
            System.out.println("Hello!");
    }

    public static void main(String args[]) {
        examp L = new examp(); // <-- need ()'s
        examp M = new examp();
        L.test(M);
    }
}

A: class Examp{
    int i = 8;

    void test(){
        // here L and M are undefined
        if(L.i == M.i) System.out.println("Hello!");
    }

    public static void main(String args[]) {
        Examp L = new Examp();
        Examp M = new Examp();
        // L and M are visible only here
    }
}

You can do something like that:
class Examp{
    int i = 8;
    Examp L;
    Examp M;

    void test(){
        // here L and M are visible
        if(L.i == M.i) System.out.println("Hello!");
    }

    public static void main(String args[]) {
        L = new Examp();
        M = new Examp();
    }
}


text:
Q: How to utilise Opencsv annotations within intelliJ IDEA? I am trying to use Opencsv's annotation functionality but cannot get it working.
I added the import the as per this link (import au.com.bytecode.opencsv.CSVReader; is at the top of my code) and still after selecting the 'annotations' checkbox in the IntelliJ import dialogue the annotations are not found. After checking the module again the annotation checkbox remains empty.
I'd appreciate any help.

A: Make sure to use the correct dependency: com.opencsv:opencsv:5.0.


text:
Q: Customising tab indicator on android So i currently have my action bar layout using the action bar generator  from

http://jgilfelt.github.io/android-actionbarstylegenerator/

I would like to know what the best way to customize the tab indicator, specifically its height(make it thinner). Like the example below
notice the very thin tab indicator.

Thank you all responses appreciated


text:
Q: Two array binding in one foreach loop in knockout JS Please look at my view model below:
viewModel = [
 {
  StudentName : 'Ronald',
  Reviews : [ '3/5', '2/5', '4/5'],
  TeacherNames : [ 'Nema', 'Sarah', 'Vilson']
  },
 {
  StudentName : 'Chris',
  Reviews : [ '4.5/5', '2.5/5', '3.5/5'],
  TeacherNames : [ 'Nema', 'Sarah', 'Vilson']
 }
]

In below HTML I am trying to display Reviews in nested foreach structure. Reviews display as per expectation. but how can I place TeacherNames along with that single review? I have put the TeacherNames[$index], but it doesn't work.
Note 1: Number of elements in both the array(i.e. Reviews and TeacherNames) will be same.
Note 2: I don't want to change the structure of this JSON model, something like putting extra variable and placing both the parameters in one array.

         Inbox
         123

Please check this Fiddle .

A: Think of it like this: $index is the observable, and $index() is the value of the observable.  You need to give the TeacherNames array the number, not the observable.
Use
123
instead of
123
to access the value $index().
I made a copy of your fiddle with the changes applied.
Also, thank you to Calvin, who just used this example to help me on the same question in a different format.

A: RoyalleBlue's answer is correct when using just the foreach binding. But using my Repeat binding will make your binding code much cleaner:

http://jsfiddle.net/mbest/p2kHU/

A: Your property is called TeacherNames, but you are calling it as TeacherName.
Also, it is on the parent object, so try:
data-bind="text:$parent.TeacherNames[$index()]"

A: EDIT:
The scope (context) is wrong. You can access TeacherNames with $parent or $root.
Changed:
123

To:
123

http://jsfiddle.net/calvinslusarski/7xuKX/2/


text:
Q: How to make GDB stepi faster? I am using GDB to log the executed assembly instruction.
Here is the GDB script I made:
log.gdb
set confirm off
tbreak start_trigger
r
set logging overwrite on
set logging on
set height 0
set style enabled off
while (1)
    x/i $pc
    stepi
end
quit

And I ran gdb using
$ gdb results-mte/aha-compress.elf -x script.gdb -batch

This works well and writes the gdb.txt but it is really slow. Is there any way to make it faster?

A:
Is there any way to make it faster?

Yes: don't do that.
Think about how single-stepping works. On a processor which supports single-step in hardware, GDB has to

*

*enable single-stepping

*resume inferior

*wait for OS to deliver SIGCHLD

*query inferior for current registers ($pc mostly) via ptrace

*decode and print current instruction

... repeat for each instruction. This is expected to be about 1000-10000 times slower than native execution.
Usual solutions are to use some tracing mechanism. E.g. using intel_pt trace would make this only slightly slower than full native speed.

I'm running this GDB inside a Fedora RiscV on QEMU.

Now you are emulating the GDB itself, adding another factor of 10 or more slowdown.
What you probably want to do is ask QEMU to record the instructions it executes.
Typing "qemu trace instructions" into Google produces this post (among others).


text:
Q: DB2 VARCHAR unicode data storage We are currently using VARCHAR for storing text data in DB2 however we are hitting the problem that length of VARCHAR specified is not the same as length of text because in DB2 VARCHAR length specified is UTF-8 data length which can vary depending on stored text data. For example some texts contain characters from different languages and because of it some texts with 500 characters can't be saved in VARCHAR(500) and etc.
Now we are planning to migrate to VARGRAPHIC. I need to know what are limitations of using VARGRAPHIC for storing unicode text data in DB2.
Are there any problems with using VARGRAPHIC?

A: DB2 doesn't check that the data is in fact double-byte String, but it assumes it must be. Usually the drivers will do proper conversions for you but you might one day bump into some bug. It is unlikely though.
If you use federated databases Vargraphic support in queries might fail completely. In overall the amount of bug reports for vargraphic data types is somewhat high. Support for it isn't probably as well tested and tried as for other data types.
Vargraphic will with unicode database (ie. UTF-8 is requirement) use big-endian UCS-2, meaning your space requirements for those columns double. Vargraphic is DB2 properietary data type. If you migrate off DB2 some day you will have to do an extra conversion.


text:
Q: Automatic Type Conversion in ColdFusion 11 I am migrating an application from ColdFusion 9 to ColdFusion 11.
In the existing code there is an assignment of a variable to false:
<cfset VARIABLES.roleTypeId = false >

And then, farther down, a function that expects this variable to be numeric:
<cffunction name="rolesForStudy" >
    <cfargument name="id" hint="Study Id">
    <cfargument name="roleTypeId" default="#VARIABLES.roleTypeId#" type="numeric"/>
</cffunction>

I inherited the code, and I cannot defend the original programmer's decision to set it up this way -- but, in short, it worked in ColdFusion 9, and it doesn't work in ColdFusion 11 (returning a data type error). I assume that ColdFusion 9 was automatically converting false to 0.
My question: Is there a configuration setting that I can change in ColdFusion 11 to make it do the conversion like ColdFusion 9 did? Or will I have to fix this code, along with probably lots of other similar examples throughout the application? Neither I nor our ColdFusion administrator has been able to find any information about this in the ColdFusion Administrator interface, the ColdFusion documentation, or online.
Edit in Response to Adam Cameron in comments
I have created a file that consists of the following 10 lines (and nothing else):
<cfset VARIABLES.roleTypeId = false >
<cfoutput>
<p>#rolesForStudy( 1, VARIABLES.roleTypeId )#</p>
</cfoutput>

<cffunction name="rolesForStudy" >
    <cfargument name="id" hint="Study Id">
    <cfargument name="roleTypeId" default="#VARIABLES.roleTypeId#" type="numeric"/>
    <cfreturn "It worked" >
</cffunction>

When I execute it in ColdFusion 9, it displays the words "It worked".
when I execute it in ColdFusion 11, it returns the following error message:
If the component name is specified as a type of this argument, it is possible that either a definition file for the component cannot be found or is not accessible.

A: I believe you will have to fix the code. There are no settings (that I know of at any rate) that alter the way CF handles boolean types. You should be able to change the assignement above from "false" to 0 and your function code will work. However I suspect elsewhere you might have something like <cfif variables.roletypeID IS "False"> which will then be broken as it is in truth looking for a string - which also works (ha).  CF's handling of a myriad of values as boolean (0 or not 0, true, false, yes and no) is a legacy of it's origin. It's convenient at times but definitely leads to things like this.
Meanwhile I wonder if this change of behavior is a new bug or the fixing of an old bug. In my view passing "false" as an argument and having it read as numeric seems inconsistent so the new way of doing it seems right to me. However, many many languages treat 0 or not 0 as default values for true and false.
EDIT:
According to Adam's comments below, my example of code where someone would say:
<cfif somevar IS "false">

...would work even if somevar was indeed numeric. His example (useful) is that:
#0 is "False"#

...will output "yes" - so CF is recasting the string "false" to a zero under the hood for comparison. That makes my example incorrect.
My answer is still correct I believe.  The issue he's running into is that the argument passed to his function - being of the type "boolean" is throwing an error because the function expects a numeric value. But Adam's point and example makes me think perhaps this behavior is a bug - since it appears CF is not casting to a number before checkign the type  (something it did do in CF 9 according to the Joe).

A: NumberFormat is your saviour, credit going to this comment on one of Ben Nadel's articles.
<cfset VARIABLES.roleTypeId = false>
#NumberFormat(VARIABLES.roleTypeId)# <!-- = 0 -->
<cfset VARIABLES.roleTypeId = true>
#NumberFormat(VARIABLES.roleTypeId)# <!-- = 1 -->

So you should be able to either convert it to the expected numeric type before calling the function, or just doing
<cfargument name="roleTypeId" default="#NumberFormat(VARIABLES.roleTypeId)#" type="numeric">

A: I've raised this as a bug in ColdFusion 11: "Type coercion failure when passing boolean to a numeric arg".
I recommend you work around this by taking the type check off the argument. This is probably the lowest-impact fix.
This is also a rare case in which I'd add a comment to code, explaining why you've taken the type checking off.
Apologies to Joe, Mark & Duncan for emphatically contradicting what they were finding. That said, I don't agree that their answers are the best approach here ;-)


text:
Q: How to detect successful authentication from Twitter and run some code after that I am developing an android project in which I have Twitter integration(Using Twitter4j). Here is my code..,.
class BitmapDownloaderTask extends AsyncTask<String, Void, String> {

    @Override
    protected String doInBackground(String... params) {

        ConfigurationBuilder builder = new ConfigurationBuilder();
        builder.setOAuthConsumerKey(TWITTER_CONSUMER_KEY);
        builder.setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET);
        Configuration configuration = builder.build();

        TwitterFactory factory = new TwitterFactory(configuration);
        twitter = factory.getInstance();

        try {
            requestToken = twitter.getOAuthRequestToken(TWITTER_CALLBACK_URL);
            MainActivity.this.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(requestToken.getAuthenticationURL())));
        }catch(TwitterException e){e.printStackTrace();}

        System.out.println("Fun");

        return "Run";
    }

    @Override
    protected void onPostExecute(String txt) {
        if (isCancelled()) {
            txt = null;
        }

        if(txt!=null){
            System.out.println(txt);
                    Uri uri = getIntent().getData();
                    System.out.println(uri);
        }
    }
}

MY PROBLEM IS THAT TWITTER PAGE IS OPEN IN SEPARATE THREAD and "Fun" and "Run" is printed when I am still in Twitter page and when I return after Twitter authentication postexecute is already executed and hence I got null in uri..,.
Can somebody please help me, how can I run some code after Twitter authentication.
OR
Is there any method which run after successful authentication or after error like Facebook onComplete and cancel..,.

A: This will start the default browser, which is a separate application. You use a custom scheme in the callback URL and register your app as a handler, so you can get control back to your app, when authorization succeeds. If you want better control, you need to load the page in a WebView and intercept events to get notified. The whole OAuth thing integration is not trivial, but here's an article with an example project that describes is pretty well:
http://blog.doityourselfandroid.com/2011/08/08/improved-twitter-oauth-android/
Also check other related articles on that blog.


text:
Q: Python 3x class methods I'm currently learning the basics of classes, and I came up with some basic code as follows:
class shape(object):
    def __init__(self, num_sides, type):
        self.num_sides = num_sides
        self.type = type

class square(shape):
    def __init__(self, side_length):
        self.num_sides = 4
        self.type = 'regular quadrilateral'
        self.side_length = side_length
    def perim():
        return side_length * 4
    def area():
        return side_length ** 2

class circle(shape):
    def __init__(self, radius):
        self.num_sides = 1
        self.type = 'ellipsis'
        self.radius = radius

Now, when I type the following:
shape1 = square(5)
shape1.perim()

I get the following output:
<bound method square.perim of <__main__.square object at 0x0000000003D5FB38>>

What is this? How can I get python to actually return the perimeter of the square?
Also, I have another question:
Do any class methods exist other than __init__() and __str__()? If so, can you please list them so I can go off and research them?

A: Access instance variable with self
class square(shape):
    def __init__(self, side_length):
        self.num_sides = 4
        self.type = 'regular quadrilateral'
        self.side_length = side_length
    def perim(self):
        return self.side_length * 4
    def area(self):
        return self.side_length ** 2

A: Two things, indentation of the init of shape and add self. to the perim and area methods.
class shape(object):
    def __init__(self, num_sides, type):
        self.num_sides = num_sides
        self.type = type

class square(shape):

    def __init__(self, side_length):
        self.num_sides = 4
        self.type = 'regular quadrilateral'
        self.side_length = side_length

    def perim(self):
        return self.side_length * 4
    def area(self):
        return self.side_length ** 2

class circle(shape):
    def __init__(self, radius):
        self.num_sides = 1
        self.type = 'ellipsis'
        self.radius = radius

shape1 = square(5)
print( shape1.perim())

A: as shown, you are going to have some problems with this.  If you are trying to have circle and square be subset set classes of shape, then the two sub classes need to be indented.  Also, on class circle and square, you really do not need the (shape). also note the things I commented out as not needed.
This does not come out as I am posting it.  the class shape (object):does not show up and the subclasses are not indented and I can not seem to make it show up
class shape(object):
    def init(self, num_sides, type):
        #self.num_sides = num_sides
        self.type = type
class square:

    def __init__(self, side_length):
        #self.num_sides = 4
        #self.type = 'regular quadrilateral'
        self.side_length = side_length

    def perim(self):
        return self.side_length * 4
    def area(self):
        return self.side_length ** 2

class circle:
    def __init__(self, radius):
        #self.num_sides = 1
        #self.type = 'ellipsis'
        self.radius = radius

    def area (self):
        return 3.14 * self.radius ** 2

shape2 = circle (5)
print ('test of circle: ',shape2.area ())

shape1 = square(5)
print('test of square:  ', shape1.perim())


text:
Q: Comparing like words between two dictionaries I am using python 3.x,
I have 2 dictionaries (both very large but will substitute here). The values of the dictionaries contain more than one word:
dict_a = {'key1': 'Large left panel', 'key2': 'Orange bear rug', 'key3': 'Luxo jr. lamp'}
dict_a

{'key1': 'Large left panel',
 'key2': 'Orange bear rug',
 'key3': 'Luxo jr. lamp'}

dict_b = {'keyX': 'titanium panel', 'keyY': 'orange Ball and chain', 'keyZ': 'large bear musket'}
dict_b

{'keyX': 'titanium panel',
 'keyY': 'orange Ball and chain',
 'keyZ': 'large bear musket'}

I am looking for a way to compare the individual words contained in the values of dict_a to the words contained in the values of dict_b and return a dictionary or data-frame that contains the word, and the keys from dict_a and dict_b it is associated with:
My desired output (not formatted any certain way):

*

*bear: key2 (from dict_a), keyZ(from dict_b)

*Luxo: key3

*orange: key2 (from dict_a), keyY (from dict_b)

I've got code that works for looking up a specific word in a single dictionary but it's not sufficient for what I need to accomplish here:
def search(myDict, lookup):
    aDict = {}
    for key, value in myDict.items():
        for v in value:
            if lookup in v:
               aDict[key] = value
    return aDict
    print (key, value)

A: dicts = {'a': {'key1': 'Large left panel', 'key2': 'Orange bear rug',
               'key3': 'Luxo jr. lamp'},
         'b': {'keyX': 'titanium panel', 'keyY': 'orange Ball and chain',
               'keyZ': 'large bear musket'} }
from collections import defaultdict
index = defaultdict(list)
for dname, d in dicts.items():
    for key, words in d.items():
        for word in words.lower().split(): # lower() to make Orange/orange match
            index[word].append((dname, key))

index now contains:
{'and'     : [('b', 'keyY')],
 'ball'    : [('b', 'keyY')],
 'bear'    : [('a', 'key2'), ('b', 'keyZ')],
 'chain'   : [('b', 'keyY')],
 'jr.'     : [('a', 'key3')],
 'lamp'    : [('a', 'key3')],
 'large'   : [('a', 'key1'), ('b', 'keyZ')],
 'left'    : [('a', 'key1')],
 'luxo'    : [('a', 'key3')],
 'musket'  : [('b', 'keyZ')],
 'orange'  : [('a', 'key2'), ('b', 'keyY')],
 'panel'   : [('a', 'key1'), ('b', 'keyX')],
 'rug'     : [('a', 'key2')],
 'titanium': [('b', 'keyX')] }

Update to comments
Since your actual dictionary is a mapping from string to list (and not string to string) change your loops to
for dname, d in dicts.items():
    for key, wordlist in d.items():    # changed "words" to "wordlist"
        for words in wordlist:         # added extra loop to iterate over wordlist
            for word in words.split(): # removed .lower() since text is always uppercase
                index[word].append((dname, key))

Since your lists have only one item you could just do
for dname, d in dicts.items():
    for key, wordlist in d.items():
        for word in wordlist[0].split(): # assumes single item list
            index[word].append((dname, key))

If you have words that you don't want to be added to your index you can skip adding them to the index:
words_to_skip = {'-', ';', '/', 'AND', 'TO', 'UP', 'WITH', ''}

Then filter them out with
if word in words_to_skip:
    continue

I noticed that you have some words surrounded by parenthesis (such as (342) and (221)).  If you want to get rid the parenthesis do
if word[0] == '(' and word[-1] == ')':
    word = word[1:-1]

Putting this all together we get
words_to_skip = {'-', ';', '/', 'AND', 'TO', 'UP', 'WITH', ''}
for dname, d in dicts.items():
    for key, wordlist in d.items():
        for word in wordlist[0].split():  # assumes single item list
            if word[0] == '(' and word[-1] == ')':
                word = word[1:-1]         # remove outer parenthesis
            if word in words_to_skip:     # skip unwanted words
                continue
            index[word].append((dname, key))

A: I think you can do what you want pretty easily. This code produces output in the format {word: {key: name_of_dict_the_key_is_in}}:
def search(**dicts):
    result = {}

    for name, dct in dicts.items():
        for key, value in dct.items():
            for word in value.split():
                result.setdefault(word, {})[key] = name

    return result

You call it with the input dictionaries as keyword arguments. The keyword you use for each dictionary will be the string used to describe it in the output dictionary, so use something like search(dict_a=dict_a, dict_b=dict_b).
If your dictionaries might have some of the same keys, this code might not work right, since the keys could collide if they have the same words in their values. You could make the outer dict contain a list of (key, name) tuples, instead of an inner dictionary, I suppose. Just change the assignment line to result.setdefault(word, []).append((key, name)). That would be less handy to search in though.


text:
Q: Obstructions to lifting a map for the Hopf fibration This is a bit of an elementary question, but
suppose $\pi: \mathbb{S}^3\to \mathbb{S}^2$ is the Hopf fibration, are there reasonably computable obstructions to when a map $f:M\to \mathbb{S}^2$ can be lifted to a map $\tilde{f}:M\to \mathbb{S}^3$?
If it matters everything can be taken in the smooth category. Also, I am most interested in the case that $M$ is an open subset of a oriented closed surface if this simplifies things at all.
My understanding is that if $M$ is a disk this there is no obstruction,
I apologize if this is trivial but it is not by area of expertise...

A: The Hopf fibration is of the form
$$S^1 \to S^3 \to S^2$$
Since the Hopf fibration is an $S^1$-bundle, there is a classifying map
$$S^2 \to BS^1$$
where $BS^1 \simeq K(\mathbb Z,2) \simeq Gr^+_{\infty,2}$, i.e. it is the Grassmannian of oriented 2-dimensional vector bundles.  So the Hopf fibration is the pull-back of the unit circle bundle of this classifying map, moreover, the map $S^2 \to Gr^+_{\infty,2}$ is the generator of $\pi_2 Gr^+_{\infty,2} \simeq \mathbb Z$.
A map $M \to S^2$ lifts to a map $M \to S^3$ if and only if the pull-back of the generator of $H^2 S^2 \simeq \mathbb Z$ in $H^2 M$ is zero.  This is because the tautological circle bundle over $Gr^+_{\infty,2}$ is the Stiefel manifold $V_{\infty,2}$ which is contractible.  So the only obstruction is the map $M \to BS^1$, which via the Serre interpretation of $H^2$ is the pull-back of the generator under the map $M \to S^2$.


text:
Q: NSUbiquitousKeyValueStoreDidChangeExternallyNotification not fired with ad hoc distribution I have the code here reported. The problem is that with my development device it works perfectly, it wait for iCloud and then the method iCloudSync is called and it works.
With an ad hoc profile for a beta testing user it doesn't work because (i think - because the logging of the method iCloudSync is not present in console) the NSUbiquitousKeyValueStoreDidChangeExternallyNotificationis not fired.
Where I'm wrong? Thanks
/******** GESTIONE ICLOUD ************/

NSUbiquitousKeyValueStore *iCloudStore = [NSUbiquitousKeyValueStore defaultStore];

if(iCloudStore)
{

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(iCloudSync)
                                                 name:NSUbiquitousKeyValueStoreDidChangeExternallyNotification
                                               object:[NSUbiquitousKeyValueStore defaultStore]];

    [iCloudStore synchronize];
    [[NSUserDefaults standardUserDefaults] setBool:TRUE forKey: iCloudEnabled];

}
else
{
    NSLog(@"iCloud is not enabled");
    [[NSUserDefaults standardUserDefaults] setBool:FALSE forKey: iCloudEnabled];
    UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"iCloud not enabled" message:@"iCloud is not working" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
    [alertView show];
}

 /******** FINE GESTIONE ICLOUD ************/

A: Your selector look wrong, it should have one and only one argument (cf NSNotificationCenter documentation. You should have
selector:@selector(iCloudSync:)     //note the double dot

and your iCloudSync function should look like :
-(void) iCloudSync:(NSNotification *)notification
{
do things...
}

A: Can you put a log before and after [[NSNotificationCenter defaultCenter]... to confirm you really set it on your AD Hoc Device ?
PS : is "dev" and "AD HOC" Devices the same device or 2 different devices ? I saw a company where iCloud was not allowed via a profil. The users were not able to set iCloud enable....


text:
Q: Tensorflow categorical data with vocabulary list - Expected binary or Unicode string, got [0,1,2,…] I'm brand new to machine learning (having just completed the Google machine learning crash course) and thought it would be good to try my hand at a Kaggle competition as a good starter to some real problem solving. I'm using Tensorflow and Python 3, all up to date (the Kaggle online Jupyter notebook)
The data is formatted in a dataframe like below
|Identity | Cuisine | Ingredients                |
|---------|---------|----------------------------|
|1        | italian | [beans, milk,..., tomatoes]|
|2        | indian  | [chicken, curry leaf,...]  |

I have made a vocabulary list generator to create a vocabulary set, and replace instances of those words in the ingredients array with the index of the ingredient in the vocabulary set, so my original data looks like below.
|Identity | Cuisine | Ingredients |
|---------|---------|-------------|
|1        | italian |[0, 1,..., 4]|
|2        | indian  |[5, 6,...]   |

I separate the labels (cuisine) and the features (ingredients) into 2 separate dataframes for ease, and I am using a tf.feature_column.categorical_column_with_vocabulary_list and subsequent tf.feature_column.indicator_column for the ingredients array.
I now however have an issue with my model not being able to read the ingredients column, and get the error

TypeError: Expected binary or unicode string, got [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

My input function is as follows
def input_fn(features,labels,batch_size,num_epochs=None,shuffle=True):
    ds = Dataset.from_tensor_slices((features,labels))
    ds = ds.batch(batch_size).repeat(num_epochs)

    if shuffle:
        ds = ds.shuffle(10000)

    feature_batch, label_batch = ds.make_one_shot_iterator().get_next()
    return feature_batch, label_batch

which is fed into a simple function as below
training_func = lambda: input_fn(training_example,training_target,batch_size)
validati_func = lambda: input_fn(validation_example,validation_target,batch_size)

optimizer = tf.train.AdamOptimizer(learning_rate=learning_rate)
optimizer = tf.contrib.estimator.clip_gradients_by_norm(optimizer, 5.0)

classifier.train(
    input_fn=training_func,
    steps=steps_per_period
)

My question is how do I fix this TypeError

TypeError: Expected binary or unicode string, got [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

(for clarity)
In addition I also want to know if there a best practice for handling this format of data? (and if there is any built-in functionality to handle this)
Since this might be a code heavy question, I added my entire code to an online Pastebin paste so you can check out the code. The dataset I am using is from the Kaggle What's Cooking competition


text:
Q: How to make a slider on background image on click? I am looking for help to make a background slider on click. But so far not found any help.
This is the html section where class with section-1 is given the background:

                <button>Enroll Now</button>

And this is the CSS:
.section-1 {
    background-image: url(./assets/bg1.jpg);
    height: 75vh;
    width: 100%;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    position: relative;
}

I also try to give it some javascript. But that javascript is only applicable in the case of simple image. I have done simple images through loop and some css classes.

A: Even though this is a reactjs topic I'll give it a try using the hover action and only css.

*

*Try adding to your html a tag under your image (I used just a "p"
tag) and give it a class of "slider".

*Now on your .css file add:

.slider {
  padding: 25vh 0;
  width: 100%;
  background-color: red;
  position: relative;
  top: 6.25vh;
  text-align: center;
  transition: 0.2s;
  opacity: 0;
}

.slider:hover {
  opacity: 1;
}

What this does basicaly is we style our paragraph to be a slider with
it's text in the middle, and the moment we hover over it with our
mouse the slider will appear with the text. You can edit the
transition and the effect all you want. The basic idea is this.


text:
Q: Get Data from a List of Firestore DocumentReferences to State React I have a list of Firebase DocumentReferences and I need to get the data and set state with that data.
This is what i tried:
useEffect(() => {
      let x = [];
      roomData.players.forEach(
        async (playerRef: FirebaseFirestoreTypes.DocumentReference) => {
          const playerSnap = await playerRef.get()
          x.push(playerSnap.data())
        }
      );
      setPlayers(x)

The list has 2 items.
The state is being set 3 times. Once normally with 2 objects. Second time it's set to an empty array and 3 with only one object.

A: Firstly, you left out the critical part, which is the second parameter of useEffect, which determines when setPlayers get called.
Secondly, the async code probably doesn't run as you expect, since the content of x when it's passed to setPlayers is not synchronized. You cannot use async in forEach, as there is no way to await all results. So in this case, setPlayers(x) may be called before x.push(playerSnap.data()).
So the simplest change is to rewrite the useEffect first parameter as
roomData.players.forEach(
  async (playerRef: FirebaseFirestoreTypes.DocumentReference) => {
    const playerSnap = await playerRef.get();
    setPlayers(prevPlayers => [...prevPlayers, playerSnap]);
  }
);

This updates players asynchronously.
If you need players to update synchronously, for example to update the UI only once, or to reflect the order of players as in Firestore, forEach must be replaced. One such way is to use a simple for loop to sequentially get. Another way is to construct an array of promise and feed it to Promise.all.


text:
Q: Open CSV file with Apache Arrow in C++ I'm trying to read a csv file with Apache Arrow but I can't get my head around the InputStream...
It seems the example in their documentation is out of date.
I've tweaked a bit the example but I get "Access violation reading location" exception. Any idea what I'm doint wrong?
Thanks
My code:
    arrow::MemoryPool* pool = arrow::default_memory_pool();

    std::shared_ptr<arrow::io::ReadableFile> infile;
    infile->Open("test.csv", pool);

    auto read_options = arrow::csv::ReadOptions::Defaults();
    auto parse_options = arrow::csv::ParseOptions::Defaults();
    auto convert_options = arrow::csv::ConvertOptions::Defaults();

    // Instantiate TableReader from input stream and options
    std::shared_ptr<arrow::csv::StreamingReader> reader;
    auto res1 = reader->Make(pool, infile, read_options, parse_options, convert_options);
    if (!res1.ok()) {
        // Handle TableReader instantiation error...
    }

    std::shared_ptr<arrow::Table> table;
    // Read table from CSV file

    auto res2 = reader->ReadAll(&table);
    if (!res2.ok()) {
        // Handle CSV read error
        // (for example a CSV syntax error or failed type conversion)
    }


text:
Q: What is the error in the code below and how should it be corrected? What is the error in the code below and how should it be corrected?
my_struct_t *bar;
/* ... do stuff, including setting bar to point to a defined my_struct_t object ... */
memset(bar, 0, sizeof(bar));

A: The last argument to memset is not right.
sizeof(bar) is the size of a pointer.
You need the size of an object. Use sizeof(*bar).
memset(bar, 0, sizeof(*bar));


text:
Q: Sorting table column by id and field not working I use the following method in order to sort data (array) in a reusable Material datatable:
sortData(sortParameters: Sort) {
    const keyName = sortParameters.active;
    if (sortParameters.direction === 'asc') {
      this.tableData = this.tableData.sort((a, b) => a[keyName].localeCompare(b[keyName]));
    }
    else if (sortParameters.direction === 'desc') {
      this.tableData = this.tableData.sort((a, b) => b[keyName].localeCompare(a[keyName]));
    }
    else {
      this.getStudents();
    }
}

However, althought it works for name field, it does not work for id field. Another issue regarding to this method is that I want to ignore whitespaces of the name and want to use trim() method for the sorted values. It is working, but I think I have to find another solution that works for id columns also. Is there any workaround for that?

A: localeCompare is a function of Strings, but if your other columns, like id, are not strings then you can't use it to sort them. You need separate sort functions for each type then. Here is one way to do this:
const defaultSort = (a, b) => a < b;
const sortFunctions = {
  id: (a, b) => a < b,
  name: (a, b) => a.localeCompare(b),
  // ....
};

function sortData(sortParameters: Sort) {
  const keyName = sortParameters.active;
  const sortFunction = sortFunctions[keyName] || defaultSort;
  if (sortParameters.direction === 'asc') {
    this.tableData = this.tableData.sort((a, b) => sortFunction(a, b));
  }
  else if (sortParameters.direction === 'desc') {
    this.tableData = this.tableData.sort((a, b) => sortFunction(b, a));
  } else {
    this.getStudents();
  }
}

A: Easiest way would be to use d3's ascending() and descending().
import {ascending, descending} from 'd3-array';

sortData(sortParameters: Sort) {
    const keyName = sortParameters.active;

    if (sortParameters.direction === 'asc') {
      this.tableData = this.tableData.sort((a, b) =>
    a_prop = a[keyName];
    b_prop = b[keyName];
    try {
      a_prop = a_prop.trim();
      b_prop = b_prop.trim();
    } catch (error) {
      //do nothing, must not have been a string
    }
ascending(a_prop, b_prop);
    }
    else if (sortParameters.direction === 'desc') {
descending(a_prop,b_prop);

      }
    else {
      this.getStudents();
    }
}

Alternative to importing D3.js, paste the code for the functions directly in your code since they are short.  Taken from
https://github.com/d3/d3-array/blob/master/src/ascending.js
ascending (a, b) {
    return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
descending (a, b) {
    return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
}


text:
Q: Ubuntu Touch AppArmor Kernel Patches new to Ubuntu development: I am porting Ubuntu touch to my own device.  There are many different commits related to AppArmor on
https://developer.ubuntu.com/en/start/ubuntu-for-devices/porting-new-device/#anchor4
http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-utopic.git;a=shortlog;h=refs/heads/mako
What would be a reasonably efficient way of applying these patches to the kernel source code I have stored locally.
I am running Ubuntu 14.04 LTS.
Thanks!

A: These wiki instructions go over how to backport the necessary apparmor changes.


text:
Q: Media files not displaying when DEBUG = False; what are the prerequisites to get them to show? As I state in the title, when I set DEBUG = False in my project's settings file, the files from my media directory (the one the user uploads) don't display. The files from my static directory (the CSS and JavaScript files) load properly.
I looked at this answer, but I don't understand the prerequisites to get this to work. I am testing this on my local machine, where I only have Django and PostgreSQL installed. I don't have any Apache servers running, as far as I'm aware. I want to deploy my app on Amazon AWS, so I'd like to try out how it will look in production there before I deploy it to Amazon AWS.
Here are the relevant parts of my settings.py file:
DEBUG = False
ALLOWED_HOSTS = ['*']
STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR,'media')
MEDIA_URL = '/media/'
STATICFILES_DIRS = [
   BASE_DIR / "static",
   '/var/www/static/',
]

A: Willem Van Onsem is right on the media files. Since the static file is OK, for the workaround, you can add this line to your urls.py in the folder containing settings.py:
from django.conf.urls.static import static
from django.conf import settings

urlpatterns+=static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)


text:
Q: Find docker file path according to container id I want to download Docker container logs to my local. I know my container's container id.
Now, I use df -h to find the docker file path. Like this /data/docker/overlay2/ea3e1ad0ccdee0e41d83722dfc6bf913250abd57918fecabd1067736b3e44305/merged. But I have multiple containers, it is difficult to know my container's file path.
How can I know ea3e1ad0ccdee0e41d83722dfc6bf913250abd57918fecabd1067736b3e44305 according to my container id.

A: List the containers
 docker ps

Navigate inside your container where the log is present.
 docker exec -it ContainerId bash

Locate your log within the container
bash-4.2$ cd yourapplication/path/log/

Exit Container
  bash-4.2$ exit

Copy to your Local location
 docker cp edd5064178db:yourapplication/path/log/request.log /your/local/location

A: You can extract the exact mergeddir (which is different from container id) like this:
$ docker inspect --format='{{json .GraphDriver.Data.MergedDir}}' container-id
"/var/lib/docker/overlay2/the-string-you-are-searching-for/merged"

A: You can find the image layers associated with the containers using docker inspect.
There might be a cleaner solution, but I was able to find the container id with some help from xargs and jq.
docker ps -a -q | xargs docker inspect | jq '.[] | select(.GraphDriver.Data.LowerDir | contains("ea3e1ad0ccdee0e41d83722dfc6bf913250abd57918fecabd1067736b3e44305")) | .Id'

*

*docker ps -a -q to grab a list of all the container Ids.

*xargs docker inspect to get the details of each container.

*jq to search the list and return the Id of any containers referencing the image layer in the GraphDriver object.

A: You can use the docker ps command with --no-trunc option like the following:
docker ps -a --no-trunc

You only see the first twelve digits of the container ID because the output is truncated by default.

A: The docker logs command will copy the container process's stdout and stderr to its own stdout and stderr, and you can save them from there.  You can also configure docker run to send the logs to another service like your local syslog or a logstash installation somewhere (but this makes docker logs not work any more).
docker logs $CONTAINER_ID >$CONTAINER_ID.log 2>&1

If it's logging to a file, you can docker cp it out
docker cp $CONTAINER_ID/usr/local/apache2/logs/access.log $CONTAINER_ID.access.log

But it's better still to just start the container with a host directory bind-mounted on to your logs directory, so this isn't a problem
docker stop $CONTAINER_ID
docker rm $CONTAINER_ID
docker run -v $PWD/logs:/usr/local/apache2/logs ...

Directly accessing things in /var/lib/docker usually isn't considered a good idea.  The overlay2 directories have parts of the per-image and per-container filesystems, if your system is using the "overlay2" storage driver (aufs and devicemapper used to both be fairly common and would keep things in different subdirectories).

A: With below command
docker inspect --format {{.Id}} "ContainerName"
you will see the container mount id.

A: if you have multiple container /images running use the below command .
 for  i in $(docker images -q );do docker inspect  $i |grep <the-string-you-are-searching-for>  ;echo $i ;done

or
for  i in $(docker ps -aq );do docker inspect  $i |grep <the-string-you-are-searching-for>  ;echo $i ;done

A: If you are not routing your log to any cloud & being stored in local then run below command to get the file location where docker stores logs for containers -
If you know container ID then use following command to get the file name with location & then you can download or whatever you want to do with the same -
docker inspect --format={{.LogPath}} <ContainerID>

This command will give you location like /var/lib/docker/containers//


text:
Q: Struct inheritance, field initialization not allowed? In C++14, I'm deriving from a struct:
struct base {
  int i;
};

struct derived: base {};

I can initialize base:
base b{10};

But I can't do the same with derived:
derived d{10};

This is working in C++17, but with earlier compilers seems invalid. How can I initialize base fields from derived?
It seems the compiler is looking for the copy-constructor, which is obviously invalid here.


text:
Q: Significance of the matrix $A^2$? Say you have destinations/places, $A,B,C,D$ and $E$ that are points that you can travel to and from. The only ways to travel between this is by the following schematic:
$A \rightarrow B \\ A \rightarrow E \\ B \rightarrow C \\ B \rightarrow D \\ C \rightarrow A \\ D \rightarrow A \\ D \rightarrow E \\ E \rightarrow B \\ E \rightarrow D$
The links are the arrows and the nodes are the destinations. The connection-matrix is created by the rule
$$a_{ij}=\left\{
  \begin{array}{rcr}
    1&,& \text{if there is a link from $i$ to $j$.} \\
    0&,& \text{else.} \\
  \end{array}
\right.$$
In this case, we get the connection matrix
$$A_c=\pmatrix{0&1&0&0&1 \\0&0&1&1&0 \\ 1&0&0&0&0 \\ 1&0&0&0&1 \\ 0&1&0&1&0}.$$
Computing $(A_c)^2$ and $A+(A_c)^2$ I get
$$(A_c)^2=\pmatrix{0&1&1&2&0 \\2&0&0&0&1 \\ 0&1&0&0&1 \\ 0&2&0&1&1 \\ 1&0&1&1&1}, \quad A+(A_c)^2=\pmatrix{0&2&1&2&1 \\2&0&1&1&1 \\ 1&1&0&0&1 \\ 1&1&1&2&1 \\ 0&1&0&1&0}.$$
Questions: What is the explanation/significance of the elements in $(A_c)^2$ and $A+(A_c)^2$? What do they intuitivley mean in terms of flights between the destinations?
How should I think and what should I do in order to derive/realize the answer to the above?

A: The square of an adjacency matrix like $A_c$ can be interpreted as the number of paths of length $2$. For example, the $2$ in the $2$nd row and $1$st column shows that there are two paths of length exactly $2$ from $B$ to $A$ ($B \to C \to A$ and $B \to D \to A$). Correspondingly $A_c^2 + A_c$ gives you all the paths of at most length $2$.


text:
Q: Set default css width from input value I'm using a jQuery ui slider to change the width of a div. I have the slider setup and working correctly so that the css changes as a user moves the slider.
I've also setup my slider so that it's handle position defaults to an input value.
What I want to achieve is on page load, have the css width match the value that the sliders handle position creates.
HTML

  <input class="inputNumber" type="text" value="5">

CSS
.boxout {

width: 200px;
height: 200px;
}

.box {

width: 10%;
height: 10%;
background: black;
}

JQUERY
$(".slider").slider({
min: 0,
max: 10,
slide: function (event, ui) {
$(".box").css('width',(10+(ui.value*2)) + '%');
    $(this).parent().find(".inputNumber").val(ui.value);
},
create: function(event, ui){
    $(this).slider('value',$(this).parent().find(".inputNumber").val());
}
});

JSFIDDLE
http://jsfiddle.net/yLanxgrs/

A: You can call the slider's slide event, passing in the current value:
var slider = $('.slider');
slider.slider('option', 'slide')
      .call(slider, null, { value : $('.slider.slider('value') });

Updated fiddle: http://jsfiddle.net/yLanxgrs/2/
Alternatively, move the content of the slide event to a new function and make the updates there.

A: You need to add this to your create method:
$(".box").css('width',(10+($(this).slider('value')*2)) + '%');
Fiddle: http://jsfiddle.net/7w57dshu/

A: You could just called it outside the slider using regular jQuery. Just grab the input value and use that when the page loads:
$(".box").css('width',(10+($('.inputNumber').val()*2)) + '%');

Here's a JS Fiddle example


text:
Q: Javascript. Can't get element style I'm trying to get width & height of the img element. It gives 0px whatever I do.
function foo(element){
if(element){
    var el=document.querySelector(element);
    var img=el.getElementsByTagName("img")[0];
    alert(img.style.width);
}
}
foo();

And the html:

I've also tried .offsetWidth, .clientWidth and defaultView.getComputedStyle(img,"");

A: How about this
function foo(imgId){
    var img=document.getElementById(imgId);
    alert(img.offsetWidth);
}

foo('img');

A:

You are calling foo() by passing #theimg which is not present in document, call by passing #img , i.e. like this

if you use above img id, remove var img=el.getElementsByTagName("img")[0]; in your function, we can directly access it.Okay

use this to keep your function as it is. Okay
It'll give 0px, if the image failed to load otherwise it'll give the width and height of the actual image, And if you want to access the attributes like left, right, top, bottom for these attributes we need to set image position to absolute then we can access.

A: Use .naturalWidth & .naturalHeight to get the actual size of image
     function foo(element){
if(element){
    var el=document.querySelector(element);
    var img=el.getElementsByTagName("img")[0];
    alert(img.naturalWidth );
}
}
foo("#theid");

DEMO

A: Image height/width is always returned 0px unless defined in CSS.
Try this piece of code, but you are loading the image again in this case (could be cached, but still).
var image = new Image();

// replace with appropriate library method
image.addEventListener("load", function() {
    //get image height/width here
}, false);

image.src = el.getElementsByTagName("img")[0].src;

A: You need to use the element offsetWidth
Here is a working fiddle and the code:
function foo(element) {
    if (element) {
        var el = document.getElementById(element);
        alert(el.offsetWidth);
    }
}
foo("theid");

Note that I have used the document.getElementById only as that will get the element. No need to have getElementsByTagName in this case. And do not prefix the id with a '#' as that notation is of jquery not javascript.


text:
Q: Fitting a image with 2d gaussian in Stan I'm trying to fit an image of (matrix of NxN) dimension, but I don't figure out how to do it. I suppose that my model has to be a y ~multi_normal (mu, Sigma) with mu a vector of values mu_x and mu_y and Sigma a cov matrix.
I'm writing a simple Stan code, but i don't know how to introduce the image to the multi_normal. An example of data could be:
np.array([[1 4  7 6],
[2 11 9 4],
[3 6  9 4],
[1 2  3 1]])

This code is bad but how can I implement it?
data {
 int<lower=0> n; #dimensions of gaussian
 int<lower=0> N; #dimensions of the image
 matrix[N,N] x; #image

}
parameters {
 vector[2] mu;
 matrix <lower=0> cov;
}
model {
 y ~ multi_normal( mu, cov);
 mu ~ normal(0., 100.); #prior
 cov ~ cauchy(0., 100.);


text:
Q: Tab bar item tint color In iOS 7, I been developing an app that uses the UITabBarController and I noticed that the tab bar items stay gray even tho I change the tint color of the tab bar. Is there any way to change the color of non-selected tab bar items?

A: To do this:: follow a simple approach..

*

*Change tintColor as you want

*Add a new set of images for unselected items and render them in original mode.
For more info, read through this link

A: To sets the tint color globally for the app, you need to add below code In app delegate didFinishLaunchingWithOptions: method:
[[UITabBar appearance] setTintColor:[UIColor colorWithRed:13.0/255.0 green:116.0/255.0 blue:128.0/255.0 alpha:1.0]];

A: Changing the tabBar.tintColor property is the right way to do it, however to make it work we need to tell iOS to ignore color properties of the UIImage in TabBarItem.
Hence write this code in your custom TabBarViewController's viewDidLoad()
for item in self.tabBar.items ?? [] {
    item.selectedImage = item.selectedImage?.withRenderingMode(.alwaysTemplate)
    item.image = item.image?.withRenderingMode(.alwaysTemplate)
}


text:
Q: ¿Se pueden pasar como parametros una funcion en otra funcion en c++? intento crear como funcion este pedazo de codigo, pero la funcion que tengo dentro de este codigo, no se como pasarlo como parametro, como hacer para que lo reciba.
 if ((matriz_juego[i][j] == *casilla2 && matriz_juego[i][j-1] ==
  *casilla2
    &&  matriz_juego[i][j+1] == *casilla2)) {

      cumplir_primera_condicion(matriz_juego,caracteres,puntaje,
        aleatorio.numero,aleatorio.numero2,aleatorio.numero3,i,j);
      int d = cumplir_primera_condicion(matriz_juego,caracteres,puntaje,
        aleatorio.numero,aleatorio.numero2,aleatorio.numero3,i,j);
        if(j == 0){
          puntaje = d - 1;
        }
        if(j!= 0){
          puntaje = d;
        }
    }

A:
¿Se pueden pasar como parametros una funcion en otra funcion en c++?

Se puede.
Propuesta.
Al parecer la función que quieres ejecutar se debería llamar cumplir_primera_condicion y recibe una matriz_juego (que parece un arreglo bidimensional de algo) y 7 parámetros adicionales que parecen ser números y devuelve un entero.
C++ es un lenguaje de tipado fuerte y estático, esto implica (entre otras cosas) que todo (incluido las funciones) tiene un tipo subyacente, los tipos de las funciones de C++ siguen el siguiente formato: retorno([parámetros...]), así que el tipo de tu función podría ser parecido a esto:
int(char **, int, int, int, int, int, int, int)

Para hacer que sea un puntero a función hay que añadir el nombre tras el tipo de retorno:
int(*puntero_a_funcion)(char **, int, int, int, int, int, int, int)

Y así puede ser usado:
int cumplir_primera_condicion(char **, int, int, int, int, int, int, int)
{
    // Hacer cosas
    return 0;
}

void funcion(bool(*puntero_a_funcion)(char **, int, int, int, int, int, int, int)) {
    if ((matriz_juego[i][j] == *casilla2 && matriz_juego[i][j-1] == *casilla2 &&  matriz_juego[i][j+1] == *casilla2)) {

        int d = puntero_a_funcion(matriz_juego,caracteres,puntaje, aleatorio.numero,aleatorio.numero2,aleatorio.numero3,i,j);
        if(j == 0){
            puntaje = d - 1;
        }
        if(j!= 0){
            puntaje = d;
        }
    }
}

// Llamar
funcion(cumplir_primera_condicion);

Puedes ver que escribir esto es muy engorroso, así que normalmente se aconseja usar alias de tipos:
int cumplir_primera_condicion(char **, int, int, int, int, int, int, int)
{
    // Hacer cosas
    return 0;
}

// Alias del tipo
using condicion_t = bool(char **, int, int, int, int, int, int, int)

// Llamada mas clara
void funcion(condicion_t *puntero_a_funcion) {
    ...
    ...
}

// Llamar
funcion(cumplir_primera_condicion);


text:
Q: regex string @[name of some thing](stringId) I have a text with string content and a tag. I want to split the text into an array. I tried many ways but got some bugs @@
Input:
"This is a text with a @[name of tag](tagId). This is another @[name of another tag](tagId)"

Output:
array = ["This is a text with a ", "@[name of tag](tagId)", ". This is another " , "@[name of another tag](tagId)"]

The tag always has @[ at begin, ) at the end and ]( at between,
I tried

const str = "This is a text with a @[name of tag](tagId). This is another @[name of another tag](tagId)"
const result = str.split(/[@[)]/);
console.log(result);

But that has many issues like "", " " or missing @[ in result
Thanks for all help


text:
Q: Return array if values on one array exist in another array I have two arrays that hold some numbers
 All Mateys

          [{
         'names':'Lot',
         'number':'0800695828'
           },
           {
          'names':'Voltaire',
          'number':'0800069005'
          }]

Invited Mateys ["0800695828", "0800069005"]

All Mateys array hold a big list of names and numbers of members while invited mateys holds only numbers of members invited.
I want to use invited mateys array numbers to  create an array with names and number from the array all mateys. In short, i want to return an array holding names and a numbers with a number present in invited arrays.
I can iterate invited mateys like so
for(var i = 0; i < invited_mateys.length; i++){
      var invited_matey_number = invited_mateys[i];
      console.log(invited_matey_number);
      //search for this number in all mateys and create an arrr
      }

How would I search and create an array with names and number?

A: You can use filter() and indexOf() to check if number exists in second array.

var arr1 = [{
  'names': 'Lot',
  'number': '0800695828'
}, {
  'names': 'Voltaire',
  'number': '0800069005'
}]

var arr2 = ["0800695828", "0800069005"]

var result = arr1.filter(function(o) {
  return arr2.indexOf(o.number) != -1
})
console.log(result)

A: Do it with jQuery:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
 var All_Mateys = [{'names':'Lot','number':'0800695828'},{'names':'Voltaire','number':'0800069005'}];
 var Invited_Mateys = ["0800695828", "0800069005"];
 var final_array = [];
 for(var key in All_Mateys){
    if($.inArray(All_Mateys[key]['number'],Invited_Mateys)!==-1){
       final_array.push(All_Mateys[key]);
    }
 }
 console.log(final_array);
</script>

Just loop through All_Mateys and match each number with numbers present in Invited_Mateys, if you find match then insert the full sub array into new result array.
I hope it helps

A:

var superset = [{
         'names':'Lot',
         'number':'0800695828'
           },
           {
          'names':'Voltaire',
          'number':'0800069005'
          }];

var subset = ["0800695828", "0800069005"];

formArr(superset,subset);

function formArr(superset,subset){
var newArr = [];
for(var i =0;i< superset.length;i++){
   if(subset.indexOf(superset[i].number)!=-1){
      newArr.push(superset[i]); }
    }
   console.log(newArr);
   return newArr;
}

function formArr will return new array with required result.Hope it helps!

A: You can try this
var newArr = [];
$(function () {
  var AllMateys =
          [{
             'names': 'Lot',
             'number': '0800695828'
           },
           {
              'names': 'Voltaire',
              'number': '0800069005'
           },
           {
              'names': 'SomeName',
              'number': '12345'
          }]

       var InvitedMateys = ["0800695828", "0800069005"];

      AllMateys.filter(function (obj) {
      if (InvitedMateys.indexOf(obj.number) > -1)
         newArr.push(obj);
       });

 });