text:
Q: \footnotetext and \footnotemark do not work in table environment I have some issues in the using of \footnote in a table. My code is as follows, in which I use the packages \usepackage{footnote} and \usepackage{tabularx}. But the text of footnote is not shown below the table, where only the superscript "1" and "2" appear aside the relevant items. I need the superscript shown as "a", "b", "c",...
\documentclass[12pt,a4paper,twoside]{report}
\usepackage[latin1]{inputenc}
\usepackage{multirow}
\usepackage{geometry}\geometry{top=3cm,bottom=3cm,left=3.7cm,right=2.5cm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\setlength{\headheight}{15pt}

\setcounter{secnumdepth}{4}

\usepackage{titlesec}
\titleformat{\chapter}[display]{\normalfont\Huge\bfseries}{\chaptertitlename
\ \thechapter}{15pt}{\Huge}
\titlespacing*{\chapter}{0pt}{-3\baselineskip}{20pt}[3.7cm]

\renewcommand{\figurename}{Figure}
\renewcommand{\bibname}{References}
\hyphenpenalty=10000
\tolerance=2500
\usepackage{longtable}
\raggedbottom

\usepackage{cite}
\usepackage{hyperref}

\usepackage{nomentbl}
\usepackage[toc,page]{appendix}
\usepackage{enumitem,calc}

\usepackage{booktabs}
\usepackage{bigstrut}
\usepackage{rotating}
\usepackage{multirow}

\usepackage{footnote}
\usepackage{tabularx}

\usepackage{lscape}
\usepackage{setspace}\linespread{1.6}
\setlength\parskip{3pt plus 1.5pt minus 1.5pt}%paragraph

\begin{document}
Some text here, as listed in Table~\ref{tab}.

\begin{table*}
  \centering
  \caption{Caption of the table}\label{tab}
  \begin{tabularx}{\textwidth}{lccc}
  \toprule
       x11            &x12 \footnotemark[1]   &x13 \footnotemark[2]    &x14 \footnotemark[2] \\
       \midrule
       x21            &x22                    &x23                     &x24                  \\
       x31            &x32 \footnotemark[1]   &x33 \footnotemark[1]    &x34                  \\
       \bottomrule
  \end{tabularx}
  \footnotetext[1]{This is the 1st footnote}%
  \footnotetext[2]{This is the 2nd footnote}%
\end{table*}

\end{document}

update: I have corrected the code according to the comment of @ Skillmon.

A: Floating environments (table, figure) do not support footnotes.
There are several workarounds, e.g. wrapping the tabular in a minipage.
Another option is offered by package threeparttable:
\documentclass[12pt,a4paper,twoside]{report}
\usepackage{booktabs}
\usepackage{threeparttable}

\begin{document}
\begin{table*}
  \centering
  \begin{threeparttable}[b]
    \caption{Caption of the table}\label{tab}
    \begin{tabular}{lccc}
      \toprule
      header11 &x12\tnote{a} &x13\tnote{b} &x14\tnote{b} \\
      \midrule
      dummy21 &x22          &x23          &x24 \\
      hello31 &x32\tnote{a} &x33\tnote{a} &x34 \\
      \bottomrule
    \end{tabular}
    \begin{tablenotes}
      \footnotesize
      \item[a] This is the 1st footnote.
      \item[b] This is the 2nd footnote.
    \end{tablenotes}
  \end{threeparttable}
\end{table*}
\end{document}

A:
beside threeparttable you can use "classic" approach as I mentioned in comment above:
\documentclass[12pt,a4paper,twoside]{report}
\usepackage[latin1]{inputenc}
\usepackage{multirow}
\usepackage{geometry}\geometry{top=3cm,bottom=3cm,left=3.7cm,right=2.5cm}
\usepackage{booktabs}
\usepackage{footnote}
\usepackage{tabularx}

\begin{document}
Some text here, as listed in Table~\ref{tab}.

\begin{table*}[ht]
    \begin{minipage}{\linewidth}
        \renewcommand\footnoterule{}
        \renewcommand{\thefootnote}{\alph{footnote}}
  \caption{Caption of the table}\label{tab}
  \begin{tabularx}{\textwidth}{Xccc}
  \toprule
       x11            &x12 \footnotemark[1]   &x13 \footnotemark[2]    &x14 \footnotemark[2] \\
       \midrule
       x21            &x22                    &x23                     &x24                  \\
       x31            &x32 \footnotemark[1]   &x33 \footnotemark[1]    &x34                  \\
       \bottomrule
  \end{tabularx}
      \vspace{-1.5ex}% <-- added
  \footnotetext[1]{This is the 1st footnote}%
  \footnotetext[2]{This is the 2nd footnote}%
    \end{minipage}
\end{table*}

\end{document}

note:
if you use tabularx environment for table, than at least one column had to be X type.


text:
Q: Where's the mistake in my Spiral Matrix algorithm? Size of matrix = input N^2 So I'm creating a spiral matrix using C#.
A spiral array is a square arrangement of the first N^2 natural numbers, where the numbers increase sequentially as you go around the edges of the array spiralling inwards.
For example:

I'm supposed to do this using an algorithm however my final results look like this:

My code is below:
    private static void FillMatrix (int[ , ] matrix, int n)
    {
        int positionX = 0;
        int positionY = 0;

        int direction = 0; // The initial direction is "right"
        int stepsCount = n - 1; // stepsCount decrements after 3/2/2/2/2...
        int stepPosition = 0; // 0 steps already performed
        int counter = 1; // counter increments after every turn

        for (int i = 1; i < n * n; i++)
        {
            matrix[positionY, positionX] = i;

            //moving logic:

            if (stepPosition < stepsCount)
            {
                stepPosition++;
            }
            else
            {
                counter++;
                stepPosition = 1;

                if (counter <= 3)
                {
                    direction = (direction + 1) % 4;
                }

                else if (counter % 2 != 0 && counter >= 5 || counter == 4)
                {
                    stepsCount = stepsCount - 1;
                    direction = (direction + 1) % 4;
                }
            }

            // Move to the next cell in the current direction
            switch (direction)
            {
                case 0:
                    // right
                    positionX++;
                    break;
                case 1:
                    // down
                    positionY++;
                    break;
                case 2:
                    // left
                    positionX--;
                    break;
                case 3:
                    // up
                    positionY--;
                    break;
            }
        }
    }

    private static void PrintMatrix (int[ , ] matrix, int n)
    {
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                Console.Write("{0,3}", matrix[i, j]);
            }
            Console.WriteLine();
        }
    }

    static void Main(string[] args)
    {
        int n;

        Console.WriteLine("Please enter N: ");
        bool checkN = int.TryParse(Console.ReadLine(), out n);

        if (checkN)
        {
            int[,] spiralMatrix = new int[n,n];

            FillMatrix(spiralMatrix, n);

            PrintMatrix(spiralMatrix, n);
        }

        Console.ReadKey();
    }
}

}
Any help much appreciated!

A: Your logic for deciding when to make a turn and how many steps to take has a bug, and it is more complicated than necessary. A better way of making a decision on when to turn is to check the matrix itself. Pre-fill the matrix with -1, then start filling it at the top-left corner. When you see -1, continue straight; if you reached one of the ends of the matrix, or the next position has -1 in it, then make a turn. This makes your stepPosition and stepCount variables unnecessary, and shortens your code quite a bit.
Another useful trick is turning right: rather than keeping a direction as a single variable, keep two "delta" variables - dx and dy
if (positionX < 0 || positionX == n || positionY < 0 || positionY == N || matrix[positionX][positionY] != -1) {
    int temp = dy;
    dy = dx;
    dx = -temp;
}
positionX += dx;
positionY += dy;

A: I've solved this problem.
There was an issue with my algorithm. The number pattern for the size of sequential line when filling in a matrix from the outside in is N, N-1, N-1, N-2, N-2, N-3, N-3... and so on.
For example in a spiral matrix of N size 4 the pattern goes like this:
4 right.
3 down.
3 left.
2 up.
2 right.
1 down.
1 left.
I originally thought the pattern started:
3 right.
3 down.
3 left.
I forgot to include the one more element of movement resulting in a algorithm that wouldn't fill out correctly.
Once I changed my conditional statements to the following code it allowed for the correct output. To clarify I am supposed to be starting from 1 in my 0 element of the array. Apologies for the confusion.
Code below:
            int positionX = 0;
            int positionY = 0;

            int direction = 0; // The initial direction is "right"
            int stepsCount = n - 1; // stepsCount decrements after 1/2/2/2/2... turns
            int stepPosition = 1; // 1 steps already performed
            int counter = 0; // counter increments after every change in direction

            for (int i = 1; i < n * n + 1; i++)
            {
                matrix[positionY, positionX] = i;

                //moving logic:

                if (stepPosition <= stepsCount)
                {
                    stepPosition++;
                }
                else
                {
                    counter++;
                    stepPosition = 1;

                    if (counter % 2 != 0)
                    {
                        stepsCount = stepsCount - 1;
                        direction = (direction + 1) % 4;
                    }
                    else if (counter % 2 == 0)
                    {
                        direction = (direction + 1) % 4;
                    }

                }

The result is a much simpler way than checking for zero and turning based on that rule as it is absolutely infallable.
Example results below:

redpajama_set_name: RedPajamaStackExchange


text:
Q: Creating a section heading 'marker' in a medium font I have used tikz to create a system of section headers that provide different 'marker' options that highlight different kinds of section, thus:

I have defined a markerfont, Gill Sans, medium weight. Which is sampled in the Normal section. I have also used it in the marker, 'Topic 1'. I have been unable to find a way to use it for the other two markers, 'topic summary' and 'Summary', which seem to take their cue from the section header, which is emphasised bold.
Is there a way to force these two markers to also take on the medium-weight marker font, without also taking on the bold characteristic? I don't want to change the main light font variant used in the body of the text, but it is too lightweight to be used in the markers.

(This question was originally incorporated in a larger question,
  Using tikz to create section "bars" and "markers", which I
  managed to (largely) answer myself. I thought that the
  seemingly minor element described above would be straightforward to
  solve, but that has proven not to be so, hence my seeking guidance
  on this aspect separately).

MWE:
    \documentclass[a5paper, openany]{memoir}

    \usepackage{fontspec}                           %   glurl.co/fs0
    \defaultfontfeatures{Ligatures=TeX}
    \setmainfont{Gill Sans Light}
    \newfontfamily\gills{Gill Sans}
        \DeclareTextFontCommand{\markerfont}{\gills}

\setlrmarginsandblock{0.85in}{0.85in}{*}

    \usepackage{lipsum}

\usepackage[usenames,dvipsnames]{xcolor}
            \definecolor    {bar}           {gray}{0.7}
            \definecolor    {marker}        {named}{black}

%   section bar headings defined, using tikz

\usepackage[explicit]{titlesec}         %   glurl.co/dFH
\usepackage{tikz}
\usetikzlibrary{shapes.misc}

\makeatletter
\let\currentsectiontitle\relax

\newcommand\sectionbar{
            \tikz[baseline,trim left=\trim,trim right=\trimright] {
                \fill [\barfill] (2.25cm,-1ex) rectangle (\textwidth+3cm,2.5ex);
                \node [fill=\markerfill, anchor= base east, rounded rectangle,
                        minimum height=3.5ex] at
                (13.8cm,{\vertical+\vadjust}) {\sectionmarker};
                \node [fill=\barfill, anchor= base east, rounded rectangle,
                        minimum height=3.5ex] at
                (\markerinset,\vertical) {};
                    }}

            \def\sectionmarker{\null}
            \def\barfill{bar}
            \def\markerfill{bar}

            \def\trim{2.815cm}% inset unmarked bar
            \def\trimright{2.7cm}% inset header to match text
            \def\markerinset{2.6cm}
            \def\vertical{0.145}
            \def\vadjust{0}

\newcommand\@sectionbar{
    \def\trim{3.6cm}% inset marked bars
            \def\trimright{2.75cm}% inset marked headers to match text
            \def\markerinset{2.58cm}
            \def\vertical{0.13}
    \def\vadjust{-0.0875}
    \def\markerfill{marker}
    \sectionbar}

\def\@@topic{Topic}
\def\@@summary{Summary}
    \def\@@topicsummary{topic summary}

\newcommand\@topic{
    \def\sectionmarker{\color{white}{\space \@@topic \space \thesection}}
            \@sectionbar}

\newcommand\@summary{
        \def\sectionmarker{\color{white}{\@@summary}}
            \@sectionbar}

\newcommand\@topicsummary{
        \def\sectionmarker{\color{white}{\@@topicsummary}}
            \@sectionbar}

\titleformat
    {\section}
    {\large}        %   explore \flushright, \raggedleft
    {\markerfont\@topic}
    {-0.01cm}
    {\bfseries\gdef\currentsectiontitle{#1}#1}

\renewcommand*{\thesection}{\arabic{section}}

\newcommand{\osection}[1]{
                    \section*{\sectionbar#1}}
\newcommand{\ssection}[1]{
                    \section*{\@summary#1}}
\newcommand{\tsection}[1]{
                    \section*{\@topicsummary#1}}

\makeatother

    \begin{document}

    \chapter{Title}
    \label{title}

    \section{Normal section}
    \label{firstsection}

    \markerfont {this is marker font (Gills Sans) -- a medium weight font}

    \osection{Osection sample}
    \label{termsusedinthisstudy}

    \tsection{Tsection sample}
    \label{topicsummarised}

    \ssection{Ssection sample}
    \label{study1summarised}

\lipsum[1]

    \end{document}


text:
Q: Limit of $\frac{2^n}{n!}$ How can I prove that $\lim_{n\to\infty} \frac{2^n}{n!}=0$?

A: Try with this inequality:
$$\frac{2^n}{n!}\leq \frac{2^n}{1\cdot 2\cdot 3\cdot 4^{n-3}}=\frac{4^3}{6} 4^{-n/2}.$$
Since $4^{-n/2}\to 0$ as $n\to\infty$.

A: Simplest way by ratio test
$$\frac{2^{n+1}}{(n+1)!}\frac{n!}{2^n}=\frac2{n+1}\to 0 <1$$
then the sequence converges to $0$.

A: Hint:
Let $u_n=\dfrac{2^n}{n!}$.
Calculate $\;\dfrac{u_{n+1}}{u_n}$. What is  its limit? What  can you deduce for $u_n$?

A: \begin{align}
\frac{2^n}{n!} &= \frac{2}{1} \frac{2}{2} \frac{2}{3} \cdots \frac{2}{n-1} \frac{2}{n}
\\ &< 2\cdot 1\cdot 1 \cdot 1\dots 1\cdot \frac{2}{n}
\\ &=  \frac{4}{n} \to 0
\end{align}


text:
Q: Closed form for sum of constant to the power of a quadratic polynomial in the index variable.
How do I find a closed form solution of the following sum?
  $$\sigma=\sum_{i=1}^n \gamma^{\alpha i^2 + \beta i}=\sum_{i=1}^n \gamma^{\alpha i^2}\gamma^{\beta i}$$

My attempt:
I tried using the method which would solve $\sum\gamma^{\alpha i}$ where I would do this:
$$
\begin{aligned} \sigma =&\, \gamma^{\alpha} + \gamma^{2\alpha} + \dots + \gamma^{n\alpha} \\
\gamma^\alpha \sigma =& \hspace{2.675em} \gamma^{2\alpha} + \dots + \gamma^{n\alpha} + \gamma^{(n+1)\alpha}
\end{aligned}
$$
However there isn't a factor which does the same trick because of the $i^2$. Is there a different method for solving this, or is there no closed form solution?

A: There is no "closed form" for this sum due to the $i^2$ term.


text:
Q: Rails - Grails Service Equivalent When you want to write an internal service layer in Rails 3, where should you place the code? I'm coming from a Grails background and wondering what the service equivalent is in Rails.
Also, if this is covered in articles or online videos - would love to have the links. Thanks.

A: The Rails convention in this case is usually to put this stuff in the lib folder (ie; lib/services/erp_service.rb). I've created a 'Services' folder under the 'app' directory to contain services like this in the past as well. I don't believe you need to do anything extra to make the classes load, however if you want to put your services under the 'app' directory and they don't appear to be loading you can try messing with config.autoload_paths option from application.rb (in a Rails 3.x application)
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
config.autoload_paths += %W(#{config.root}/lib


text:
Q: How to extract the exact word from a string while reducing false positive discovery I want to extract the exact word from a string. My code causes false discovery by considering the search item as a substring. Here is the code:

import re
text="Hello I am not react-dom"
item_search=['react', 'react-dom']

Found_item=[]
for i in range(0, len(item_search)):
    Q=re.findall(r'\b%s\b'%item_search[i], text, flags=re.IGNORECASE | re.MULTILINE | re.UNICODE)
    Found_item.append(Q)

print(Found_item)

The output is: [['react'], ['react-dom']]. So, In the result, I dont want to see the react as item.
The expected Output is: [[''], ['react-dom']]

A: \b is used to to indicate the boundary between types. eg between words and punctuations etc. so \b will be present between t from react and -. Thus here since we need whole words, we just use a lookbehind and lookahead to ensure that there no non-space between the two( THis is not the same as saying there is  a space between the two). Thus you could use:
 re.findall(rf"(?<!\S)({'|'.join(item_search)})(?!\S)", text)
['react-dom']

Edit:
If you were to include other non-word stuff like periods in the sentence, check @DYZ comment then you could use:
(?<!\S)({'|'.join(item_search)})\W*(?!\S)


text:
Q: Bootstrap grid column not working as expected on sm and xs device The row has 4 images, it is showing 4 images in the row as expected.
On sm and xs devices it should show 4 images in a grid of 2 x 2 (two column and two rows but the third image is not aligning properly it is way off the grid.
https://jsfiddle.net/fjqcb2h6/

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

dsfdsfdsfdsf

dsfsfsdfsdfdsfsdf

sdfdsfsd

dsfdsfsdfActivation

A: Add following style
.countdown-row {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
        flex-wrap: wrap;
}

A: This is due to the different height of the elements.

Applying height to the columns child (
 in this case) will fix the problem.
Note that height must be equal or greater than highest column child.
figure {
  height: 200px;
}


text:
Q: What are the benefits of a stateless web application? It seems some web architects aim to have a stateless web application.  Does that mean basically not storing user sessions?  Or is there more to it?
If it is just the user session storing, what is the benefit of not doing that?

A: *

*Reduces memory usage.  Imagine if google stored session information about every one of their users

*Easier to support server farms.  If you need session data and you have more than 1 server, you need a way to sync that session data across servers.  Normally this is done using a database.

*Reduce session expiration problems.  Sometimes expiring sessions cause issues that are hard to find and test for.  Sessionless applications don't suffer from these.

*Url linkability.  Some sites store the ID of what the user is looking at in the sessions.  This makes it impossible for users to simply copy and paste the URL or send it to friends.

NOTE: session data is really cached data.  This is what it should be used for.  If you have an expensive query which is going to be reused, then save it into session.  Just remember that you cannot assume it will be there when you try and get it later.  Always check if it exists before retrieving.

A: From a developer's perspective, statelessness can help make an application more maintainable and easier to work with. If I know a website I'm working on is stateless, I need not worry about things being correctly initialized in the session before loading a particular page.
From a user's perspective, statelessness allows resources to be linkable. If a page is stateless, then when I link a friend to that page, I know that they'll see what I'm seeing.
From the scaling and performance perspective, see tsters answer.


text:
Q: AngularJS ChosenJS ng-disabled not working I have a code similar to this
the select
<select data-placeholder="Product" class="span4 chzn-select"
    chosen="productsList" ng-model="selectedproduct"
    ng-options="product.productName for product in productsList"
    ng-change="fetchProductItems();"
    ng-disabled="lock">
</select>

The button that call the function
<button class="btn" ng-click="searchProduct();">Seach Product</button>

And at last the function
$scope.searchProduct = function() {
    $scope.lock =true;
}

The problem is it doesn't disable the select.

A: I've tested your code and everything works fine, so there are 2 possible issues:
A) The controller somehow not connected to the view or some syntax error (check your   console window for possible errors).
B) might be a browser compatibility issue but I tested it on IE 10 ,chrome and FF 27.0.1 .
html:
<div ng-app="App"  ng-controller="ctrl">
 <select data-placeholder="Product" class="span4 chzn-select"
    chosen="productsList" ng-model="selectedproduct"
    ng-options="product.productName for product in productsList"
    ng-change="fetchProductItems();"
    ng-disabled="lock">
</select>
<button class="btn" ng-click="searchProduct()">Seach Product</button>
</div>

js:
var app=angular.module('App', []);

function ctrl($scope){
    $scope.productsList=[{id:1,productName:"aa"},{id:2,productName:"bb"},{id:3,productName:"cc"}]
    $scope.searchProduct = function() {
    $scope.lock =true;
    }
}

Live example: http://jsfiddle.net/choroshin/sJZf7/

A: It just happened to me that everything was fine but the view (which has the ng-disabled="..." attributes) was cached and so the attribute ng-disabled="..." wasn't really in the brought view.
So... delete your cache and try again.


text:
Q: Getting Segmentation Fault with Simple Perl Program I have been using Cory Watson's Chart::Clicker Perl module in a marketing program for a 3+ years without any issues until last week.
I'm including a very simple example of my code. This program fails when it gets to the write_output command. I'm experiencing the same problem in my actual program.
The actual program hasn't been modified at all. This problem appeared out of the blue.
#!/usr/local/bin/perl

use Chart::Clicker;

my $cc = Chart::Clicker->new;

my @values = (42, 25, 86, 23, 2, 19, 103, 12, 54, 9);
$cc->add_data('Sales', \@values);

$cc->write_output('/home/test/public_html/tmp/foo.png');

When I run this program on my server, it reports a "Segmentation fault" error. If I comment out this line of code:
$cc->write_output('/home/test/public_html/tmp/foo.png');

no error is reported.
Any ideas on what might be wrong? Thank you.

A: Thanks to all who offered help.
We ended up reinstalling Perl on the server (its a dedicated, fully managed server - the host opted to do this because the Perl module installer on CPanel wasn't responding correctly). After doing this, test.cgi reported a variety of new compilation errors all related to Chart::Clicker.
We reinstalled several of the Chart::Clicker dependencies and this fixed the problem.


text:
Q: How is this a segment fault 11? Only 5x200 entry arrays I'm working on Mac OSX, and using bash in terminal. The machine has 8GB of RAM. I don't know why I am getting a segment fault 11 for this code. From my three weeks of experience, I usually get them form having too much memory being requested. But I am only asking for 5, 200 entry arrays. Does this have something to do with opening and reading text files?
What could to make the program run, as is? Is malloc relevant to this? Thanks for any help you can offer.
#include <stdio.h>
#include <math.h>

int main(){
double Mj[200]={0};
double Ma[200]={0};
double Cj[200]={0};
double Ca[200]={0};
double index[200]={0};

FILE *Matlab;
Matlab = fopen("TestbedComp.txt","r");
FILE *Cprog;
Cprog = fopen("results.txt","r");

int j = 0;
while( fscanf(Matlab,"%lf, %lf, %lf", &index[j], &Mj[j], &Ma[j]) == 3 ){
    printf("%lf, %lf, %lf\n", index[j], Mj[j], Ma[j]);
    j++;
}

fclose(Matlab);
printf("\n");

j = 0;
while( fscanf(Cprog,"%lf, %lf, %lf", &index[j], &Cj[j], &Ca[j]) == 3 ){
    printf("%lf, %lf, %lf\n", index[j], Cj[j], Ca[j]);
    j++;
}

fclose(Cprog);

double pej[200]={0};
for (j=0; j<200; j++) {
    pej[j] = fabs(Mj[j]-Cj[j])/Mj[j];
}

double pea[200]={0};
for (j=0; j<200; j++) {
    pea[j] = fabs(Ma[j]-Ca[j])/Ma[j];
}

FILE *out;
out = fopen("PercentError.txt","w");

for (j=0; j<200; j++) {
    fprintf(out,"%.15lf, %.15lf, %.15lf \n", index[j], pej[j], pea[j]);
}

fclose(out);

return 0;
}

A: fscanfreads until the end of line. If there's no lines in the code it will try to read it completely, and you can run into segmentation fault.
Can you provide examples of the files you're trying to read?

A: I bet you are really crashing in the function preamble... 1000 doubles is taking 16000 bytes  off of your stack right away. try callocing those instead of using stack allocations.


text:
Q: $\iiint_WfdV=\int_{A}^{B}\int_{C}^{D}\int_{E}^{F} d\rho d\varphi d\theta$ Suppose $f(x,y,z)=1/\sqrt{x^2+y^2+z^2}$ and $W$ is the bottom half of a sphere of radius $5$.
(a) As an iterated integral, we can write
$$\iiint_WfdV=\int_{A}^{B}\int_{C}^{D}\int_{E}^{F} d\rho d\varphi d\theta$$
What are the values of $(A,B,C,D,E,F)$?

A: $$ \iiint_WfdV=\int_{0}^{2\pi} \int_{\pi/2}^{\pi}\int_{0}^{5}\frac{1}{\rho}\rho^2 \sin(\phi)d \rho \,d\phi\,d\theta\, $$
where $\phi$ is the angle with the $z$-axis.


text:
Q: How can I monitor a file and print out changes in the terminal (using inotify)? I want to run a script that transfers the changes of a file to another file (like a log file) and also print it out in the terminal.
I would prefer using the inotify tool, but other suggestions are welcome as well :)
I tried using inotifywait with the -m prefix, but the commands after it don't run because inotifywait -m repeats itself continuously.
Using inotifywait without prefixes didn't help either.
...
inotifywait -m $file >> logfile.log
...

A: You could try the tee filter, which will read the input from inotfywait and output both to the terminal, and also to a file.
inotifywait -m file | tee -a logfile.log

To run this in the background see below, but you will get inotifywait output to terminal whilst this command is running.
nohup inotifywait -m file | tee -a logfile.log &


text:
Q: Can someone make the world larger in Console Edition Accoding to the wiki, the worlds are very small (limited to 864x864 blocks). They are like this because consoles have low storing spaces. But, if one would acquire a larger disk space for the console, can worlds be made bigger? For Xbox 360, please.

A: Not unless they update the game to have that feature (unlikely that they'll do that specifically since it only applies to the previous-gen consoles).
From your link:

Since not all Xbox 360s and PS3s ship with hard drives, these two consoles support limited worlds only.

The big advantage with programming for consoles is that you can assume every console is the same. Allowing for completely different game systems (not just actual size, but the sort of virtual memory used on the PC) depending on console configuration would be a real inconvenience for development.
Maybe if they expected Xbox 360 to provide a lot of sales going forward, they would consider it.
But your question was as to if you could do it yourself, to which I'll just straight up say:
Probably never.


text:
Q: setAttribute() in a multi dimensional array What I'm trying to figure out is how to give another class to certain div's in a two-dimensional array that has a value of "3" . This is what I tried at first.

*

*numRows are the amount rows in the array.

*numSeatsPerRow are the number of array items in every "numRows".

*r and t are the positions in the two-dimensional array.
for(var r = 0; r<numRows; r++){
    for(var t = 0; t<numSeatsPerRow; t++){

        if(myArray[r][t] === 3){

            document.getElementsByTagName("div")[r][t].setAttribute("class", "busySpot");

        }
    }
}

I soon understood that this wouldn't work. I tried to make a formula which could calculate every position as an ordinary array but couldn't make it work. Is there any other way to solve my problem?
In the code below I create a two-dimensional array based on two different inputs
    var myArray = new Array(numRows);
    for(var i = 0; i <numRows; i++){
        myArray[i] = new Array(numSeatsPerRow);
    }

In the next piece of code I give all array items the value 1 and then draw a green box for every item.
for(var h = 0; h<numRows; h++){
        document.body.appendChild(//efter varje rad sker ett <br> i utskriften
        document.createElement("br"));
        document.body.appendChild(
        document.createElement("br"));
        for(var g = 0; g<numSeatsPerRow; g++){
            myArray[h][g] = 1
                    var vSpot = document.createElement("div");
                    vSpot.className = "vacantSpot";
                    document.body.appendChild(vSpot);

        }
    }

What I'm trying to do in the top code is give the random boxes that I talked about another class.
this is how i came up with the random coordinates:
for(var v = 0; v < 15; v++){
    var test = true;
    while(test){
        var x = Math.floor((Math.random() * numSeatsPerRow) + 0 );
        var y = Math.floor((Math.random() * numRows) + 0);
        if(myArray[x][y] === 1) {
            myArray[x][y] = 3;
            test = false;
        }
    }
}

Thanks!


text:
Q: How to align images inside a thumbnail side by side? I have four images where the first two images will be side by side and the rest two images will go to the next row. Currently I have four but there could be more.
I have used a container two put all the contents inside and each of the images are inside a thumbnail.
I have also added the zoom on scroll effect where on hovering each image, it will zoom and overlap any other image.
But I have trouble putting the images side by side. Here is the screenshot below

Also if I try other set of images, I get alignment right but it screws up when I hover on the images.

But this doesn't help. I don't see image getting any bigger with any size value I put.
Secondly I want a consistent alignment across any number of images I put where there will always be two images per row and hovering on any image doesnt screw the alignment of other images. Adding the below code helps in zoom on hover but sometimes it messes up the position of other images.
img:hover {
    -webkit-transform:scale(1.5); /* Safari and Chrome */
    -moz-transform:scale(1.5); /* Firefox */
    -ms-transform:scale(1.5); /* IE 9 */
    -o-transform:scale(1.5); /* Opera */
     transform:scale(1.5);
     z-index: 1;
     position: relative;

I am using bootstrap for alignment so that the alignment is consistent across any screen size.
How can I make this work?
Here is HTML/CSS snippet

div {
    margin-top: 30px;
}

.container .row img {
    width: 100%;
    height: auto;
}

img {
    -webkit-transition: all 1s ease; /* Safari and Chrome */
    -moz-transition: all 1s ease; /* Firefox */
    -ms-transition: all 1s ease; /* IE 9 */
    -o-transition: all 1s ease; /* Opera */
    transition: all 1s ease;

    /*object-fit:scale-down;*/
    /*object-fit: contain;*/
}

img:hover {
    -webkit-transform:scale(1.5); /* Safari and Chrome */
    -moz-transform:scale(1.5); /* Firefox */
    -ms-transform:scale(1.5); /* IE 9 */
    -o-transform:scale(1.5); /* Opera */
     transform:scale(1.5);
     z-index: 1;
     position: relative;
     background:rgba(0,0,0,0.05);
     border: 1px solid black;
     opacity: 1;
}
.img{
   width:100px;
   height:100px;
}

    <title>Summary</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="link.css"

A: I took your code and just changed Bootstrap version from 3.3.7 to current 4.1.3 and … voilá!

div {
    margin-top: 30px;
}

.container .row img {
    width: 100%;
    height: auto;
}

img {
    -webkit-transition: all 1s ease; /* Safari and Chrome */
    -moz-transition: all 1s ease; /* Firefox */
    -ms-transition: all 1s ease; /* IE 9 */
    -o-transition: all 1s ease; /* Opera */
    transition: all 1s ease;

    /*object-fit:scale-down;*/
    /*object-fit: contain;*/
}

img:hover {
    -webkit-transform:scale(1.5); /* Safari and Chrome */
    -moz-transform:scale(1.5); /* Firefox */
    -ms-transform:scale(1.5); /* IE 9 */
    -o-transform:scale(1.5); /* Opera */
     transform:scale(1.5);
     z-index: 1;
     position: relative;
     background:rgba(0,0,0,0.05);
     border: 1px solid black;
     opacity: 1;
}

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>

A: you can use
.style:nth-child(2n+1) {
    clear: both;
}

div {
    margin-top: 30px;
}

.container .row img {
    width: 100%;
    height: auto;
}

img {
    -webkit-transition: all 1s ease; /* Safari and Chrome */
    -moz-transition: all 1s ease; /* Firefox */
    -ms-transition: all 1s ease; /* IE 9 */
    -o-transition: all 1s ease; /* Opera */
    transition: all 1s ease;

    /*object-fit:scale-down;*/
    /*object-fit: contain;*/
}

img:hover {
    -webkit-transform:scale(1.5); /* Safari and Chrome */
    -moz-transform:scale(1.5); /* Firefox */
    -ms-transform:scale(1.5); /* IE 9 */
    -o-transform:scale(1.5); /* Opera */
     transform:scale(1.5);
     z-index: 1;
     position: relative;
     background:rgba(0,0,0,0.05);
     border: 1px solid black;
     opacity: 1;
}

.style:nth-child(2n+1) {
    clear: both;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

A: Since Bootstrap is 12 column grid, you need to set two images in a  with width col-6* classes to align two images.
And provide a "overflow: hidden" for .row since it doesn't break when you hover.
I have added the fiddle for your reference.
jsfiddle
.row{
   overflow: hidden;
}


text:
Q: Working with vectors in Matlab I have 2 vectors:
1) xvn = [-6.2 -5.2 -4.2 -3.2 -2.2 -1.2 -0.2 0.8 1.8 2.8 3.8 4.8 5.8]
2) xg = [-2.0 -1.0 -0.0 1.0 2.0]
I am trying to get a new vector which looks like this.
xv = [-6.2 -5.2 -4.2 -3.2 -2.2 -2.0 -1.0 -0.0 1.0 2.0 2.8 3.8 4.8 5.8]

Essentially xg has values say between -2.0 to 2.0 and xvn has values between -6.2 to 5.8. The new vector xv contains values of xvn up to -2.0, then all values of xg and values of xvn higher than 2.0.
All vectors are in increasing order.

A: Since they're monotonically increasing, something like this:
xv = [xvn(xvn<xg(1)) xg xvn(xvn>xg(end))]

If they are column vectors instead of rows, as you've shown, then vertically concatenate (; or vertcat).


text:
Q: Is there any commad for getting the list_channels along with queue name in rabbitmq rabbitmqctl     list_channels     name   messages_unacknowledged    queue_name
Actually I have declared three queues, so i need along with list_channels, queue name is there any possibility to get like above mentioned.  please let me know.
Thanks for advance

A: you can use:
rabbitmqctl list_consumers  -q

It gives the channel_pid per queue for all the consumers.


text:
Q: What does this 'cr' stand for? I saw this chart (here) and can't figure out what this 'cr' (next to the 9%) means in this context.

A: "cr" appears to represent crore.
10,000,000 in Indian numbering.
https://en.wikipedia.org/wiki/Crore


text:
Q: работа js в файле, вставленном через ".load" Столкнулся с проблемой, если вставляю файл на страницу через такую конструкцию:

$( '.btn' ).click(function() {
  $( '.loadBlock' ).load( 'test.html' );
});

То в мобильном браузере скрипты из файла "test.html" не работают, в десктопных браузерах всё нормально..
С чем это может быть связано и как побороть??

A: сам спросил, сам отвечаю, работает такая конструкция:

$( '.btn' ).click(function() {
  $( '.loadBlock' ).load( 'test.html', function() {
                  // ваш код
  });
});

п.с. Но почему не пашет в мобиле исходная конструкция - не понятно.


text:
Q: Pip doesn't work anymore in jupyter notebook I used to be able to launch pip command from the jupyter notebook. But now even if I luanch even the basic ! pip  -V I get :
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-17-29b4bf94a9cf> in <module>
----> 1 get_ipython().system(' pip -V')

C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py in system_piped(self, cmd)
   2450         # a non-None value would trigger :func:`sys.displayhook` calls.
   2451         # Instead, we store the exit_code in user_ns.
-> 2452         self.user_ns['_exit_code'] = system(self.var_expand(cmd, depth=1))
   2453
   2454     def system_raw(self, cmd):

C:\ProgramData\Anaconda3\lib\site-packages\IPython\utils\_process_win32.py in system(cmd)
    129         if path is not None:
    130             cmd = '"pushd %s &&"%s' % (path, cmd)
--> 131         return process_handler(cmd, _system_body)
    132
    133 def getoutput(cmd):

C:\ProgramData\Anaconda3\lib\site-packages\IPython\utils\_process_common.py in process_handler(cmd, callback, stderr)
     82                          stdout=subprocess.PIPE,
     83                          stderr=stderr,
---> 84                          close_fds=close_fds)
     85
     86     try:

C:\ProgramData\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
    773                                 c2pread, c2pwrite,
    774                                 errread, errwrite,
--> 775                                 restore_signals, start_new_session)
    776         except:
    777             # Cleanup if the child failed starting.

C:\ProgramData\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
   1176                                          env,
   1177                                          os.fspath(cwd) if cwd is not None else None,
-> 1178                                          startupinfo)
   1179             finally:
   1180                 # Child is launched. Close the parent's copy of those pipe

FileNotFoundError: [WinError 2] The system cannot find the file specified

Blockquote

The reason might be that I tried to install Python from Microsoft Store, which didn't had pip and that I downloaded pip following this tutorial
I tried to install it from sys :
import sys
!{sys.executable} -m pip install facebook_sdk]

But got the following one :
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-20-378e12e263ed> in <module>
      1 import sys
----> 2 get_ipython().system('{sys.executable} -m pip install facebook_sdk')
      3

C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py in system_piped(self, cmd)
   2450         # a non-None value would trigger :func:`sys.displayhook` calls.
   2451         # Instead, we store the exit_code in user_ns.
-> 2452         self.user_ns['_exit_code'] = system(self.var_expand(cmd, depth=1))
   2453
   2454     def system_raw(self, cmd):

C:\ProgramData\Anaconda3\lib\site-packages\IPython\utils\_process_win32.py in system(cmd)
    129         if path is not None:
    130             cmd = '"pushd %s &&"%s' % (path, cmd)
--> 131         return process_handler(cmd, _system_body)
    132
    133 def getoutput(cmd):

C:\ProgramData\Anaconda3\lib\site-packages\IPython\utils\_process_common.py in process_handler(cmd, callback, stderr)
     82                          stdout=subprocess.PIPE,
     83                          stderr=stderr,
---> 84                          close_fds=close_fds)
     85
     86     try:

C:\ProgramData\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
    773                                 c2pread, c2pwrite,
    774                                 errread, errwrite,
--> 775                                 restore_signals, start_new_session)
    776         except:
    777             # Cleanup if the child failed starting.

C:\ProgramData\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
   1176                                          env,
   1177                                          os.fspath(cwd) if cwd is not None else None,
-> 1178                                          startupinfo)
   1179             finally:
   1180                 # Child is launched. Close the parent's copy of those pipe

FileNotFoundError: [WinError 2] The system cannot find the file specified

From your comments and answers :
Install with conda in jupyter notebook
I tried to install it (and a random package) with conda install pip but got almost the same error
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-6-6460b4216065> in <module>
----> 1 get_ipython().run_line_magic('conda', 'install pip')

C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2311                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2312             with self.builtin_trap:
-> 2313                 result = fn(*args, **kwargs)
   2314             return result
   2315

<C:\ProgramData\Anaconda3\lib\site-packages\decorator.py:decorator-gen-108> in conda(self, line)

C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188
    189         if callable(arg):

C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\magics\packaging.py in conda(self, line)
    101             extra_args.extend(["--prefix", sys.prefix])
    102
--> 103         self.shell.system(' '.join([conda, command] + extra_args + args))
    104         print("\nNote: you may need to restart the kernel to use updated packages.")

C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py in system_piped(self, cmd)
   2450         # a non-None value would trigger :func:`sys.displayhook` calls.
   2451         # Instead, we store the exit_code in user_ns.
-> 2452         self.user_ns['_exit_code'] = system(self.var_expand(cmd, depth=1))
   2453
   2454     def system_raw(self, cmd):

C:\ProgramData\Anaconda3\lib\site-packages\IPython\utils\_process_win32.py in system(cmd)
    129         if path is not None:
    130             cmd = '"pushd %s &&"%s' % (path, cmd)
--> 131         return process_handler(cmd, _system_body)
    132
    133 def getoutput(cmd):

C:\ProgramData\Anaconda3\lib\site-packages\IPython\utils\_process_common.py in process_handler(cmd, callback, stderr)
     82                          stdout=subprocess.PIPE,
     83                          stderr=stderr,
---> 84                          close_fds=close_fds)
     85
     86     try:

C:\ProgramData\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
    773                                 c2pread, c2pwrite,
    774                                 errread, errwrite,
--> 775                                 restore_signals, start_new_session)
    776         except:
    777             # Cleanup if the child failed starting.

C:\ProgramData\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
   1176                                          env,
   1177                                          os.fspath(cwd) if cwd is not None else None,
-> 1178                                          startupinfo)
   1179             finally:
   1180                 # Child is launched. Close the parent's copy of those pipe

FileNotFoundError: [WinError 2] The system cannot find the file specified

upgrade pip in Anaconda prompt
(base) C:\Users\antoi>python -m pip install --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e675a1/pip-19.2.3-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 19.1.1
    Uninstalling pip-19.1.1:
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\programdata\\anaconda3\\lib\\site-packages\\pip\\_internal\\build_env.py'
Consider using the `--user` option or check the permissions.

(base) C:\Users\antoi>
(base) C:\Users\antoi>python -m pip install --upgrade pip --user
Collecting pip
  Using cached https://files.pythonhosted.org/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e675a1/pip-19.2.3-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-19.2.3

But still had the error after shutting down the kernel, closing the jupyter window terminal.

A: So you are using conda and Pip... why dont you try installing pip from Conda??
Sorry for not comment instead but I have not enough reputation.
conda install pip


text:
Q: Eigen: Should i use aligned map for intensive computations? I want to perform a lot of computations over externally allocated data, especially matrix multiplications. It can be done via Eigen::Map. Unfortunately I'm not an expert in vectorized computations, but as far as i can see it's possible to specify Aligned flag for Map.
I decided to check performance difference between matrix multiplications via Eigen::MatrixXf and 'Eigen::Map':
void testMatProduct(
        const Eigen::MatrixXf &a,
        const Eigen::MatrixXf &b,
        Eigen::MatrixXf &res)
{
    const auto startTime = std::chrono::high_resolution_clock::now();
    res.noalias() = a * b;
    const auto endTime = std::chrono::high_resolution_clock::now();
    const auto duration = std::chrono::duration_cast<std::chrono::microseconds>( endTime - startTime ).count();
    std::cout << "Mat product elapsed " << duration / 1.0e6 << std::endl;
}

using EigenMap = Eigen::Map<Eigen::MatrixXf, Eigen::Unaligned>;

void testMapProduct(
        const EigenMap &a,
        const EigenMap &b,
        EigenMap &res)
{
    const auto startTime = std::chrono::high_resolution_clock::now();
    res.noalias() = a * b;
    const auto endTime = std::chrono::high_resolution_clock::now();
    const auto duration = std::chrono::duration_cast<std::chrono::microseconds>( endTime - startTime ).count();
    std::cout << "Map product elapsed " << duration / 1.0e6 << std::endl;
}

int main(int, char **)
{
    srand(42);
    const int64_t N = 7000;
    const int64_t K = 6000;
    const int64_t M = 100;
    Eigen::MatrixXf mat1 = Eigen::MatrixXf::Random(N, K);
    Eigen::MatrixXf mat2 = Eigen::MatrixXf::Random(K, M);
    Eigen::MatrixXf matRes = Eigen::MatrixXf::Zero(N, M);

    // Copy data from mats to vecs
    Eigen::VectorXf vec1 = Eigen::Map<Eigen::MatrixXf>(mat1.data(), mat1.rows() * mat1.cols(), 1);
    Eigen::VectorXf vec2 = Eigen::Map<Eigen::MatrixXf>(mat2.data(), mat2.rows() * mat2.cols(), 1);
    Eigen::VectorXf vecRes = Eigen::VectorXf::Zero(N * M);

    EigenMap map1 = EigenMap(vec1.data(), mat1.rows(), mat1.cols());
    EigenMap map2 = EigenMap(vec2.data(), mat2.rows(), mat2.cols());
    EigenMap mapRes = EigenMap(vecRes.data(), matRes.rows(), matRes.cols());
    for(int i = 0; i < 10; ++i){
        testMapProduct(map1, map2, mapRes);
        testMatProduct(mat1, mat2, matRes);
        matRes.setZero();
        vecRes.setZero();
    }

    return 0;
}

I'm pretty sure this is not a valid benchmark but it should give me some intuition. I compile it with -march=native and it prints following output:
Map product elapsed 0.102751
Mat product elapsed 0.10224
Map product elapsed 0.10022
Mat product elapsed 0.100726
Map product elapsed 0.09963
Mat product elapsed 0.100697
Map product elapsed 0.099673
Mat product elapsed 0.100809
Map product elapsed 0.100195
.......

So it's seems to me that there are no big difference between map product and matrix product.
My questions are:
1) What the difference between Map<MatrixXf, Unaligned> and Map<MatrixXf, Aligned> in terms of performance? Should i care about Map alignment for other operations like dot products, elementwise addition, etc
2) Is my comparison correct?
PS Sorry for my poor English

A: 1) Data alignment specifies the way how data is ought to be accessed and arranged. This means if you are using Eigen::MatrixXf, which refers to a matrix of unknown dimensions at compile-time with data type float, the data pointer should be aligned on a 4-byte (32-bits) boundary (assuming float is represented using 32-bits on your system).
What impact on performance do different specifications of data alignment have? To answer this question, we will be taking a look at the following discussion:
Talk: On a 32-bit architecture, would a 16-bit value not aligned on a 32-bit boundary be accessed more slowly?

*

*Main argument that it affects performance: Packing two 16-bit values into a 32-bit register means that you must spend resources on converting the data from one format to the other

One may argue that languages such as C/C++ support sub-word accessing which means you don't have to convert them, implying that you can save memory space and have no negative impact on performance.
I would assume that the Eigen library automatically detects that the data pointer for Eigen::MatrixXf is aligned on a 4 bytes boundary and therefore there are no performance implications if you leave out the MapOption template or assign it to Eigen::Unaligned. If you want to be sure use Eigen::Aligned4 (recall that Eigen::Aligned is deprecated and a synonym for Aligned16, so 128-bits). You can take a look at the alignment enumerator here.
2) Eigen::Map enjoys the benefit that matrices and vectors can be initialized without copying data, unlike with Eigen::Matrix and Eigen::Vector. I'm pretty sure that Eigen::Map and Eigen::Matrix use the same operations for multiplying, addition, etc. objects underneath, just the referencing is different. The only performance benefit I can see from using Eigen::Matrix is spatial locality in terms of cache performance if Eigen::Map references to two matrices/vectors which are far apart in memory and when working with huge matrix sizes. Of course assuming that you initialized the two Eigen::Matrix objects just after another, such that they are contiguous in memory.

A: The main difference is if the vectorized loads are aligned loads or unaligned loads (or when crossing cache line borders). On modern desktop CPUs (e.g. any CPU with AVX, IIRC), the difference will be minor and dwarfed by the actual work. On other devices, the penalty for non-aligned loads can vary significantly.
If the Eigen::Map is guaranteed that the memory is aligned, the loads can all be aligned loads, whereas if it's not guaranteed, then the loads must all be unaligned loads. How much this will affect your application will depend on what hardware you're targeting.


text:
Q: how deploy asp.net project which use Crystal Report 2008 I have created ASP.net Web application which uses Crystal Report to show reports. Now i want to publish this project to server. I have installed full version of Crystal Reports 2008 on server. It works and showing up reports.
How can be made Crystal Reports to run on server without installing whole version?
Is there any standalone host for it or runtime which can handle crystal reports templates?
Thanks

A: Crystal Reports has special runtime packages for this usage.


text:
Q: getting started with plyr `m*ply` but unable to reproduce examples Trying to learn plyr, I have gotten stuck trying to reproduce code from the introductory guide.
The guide says that the code is in a file plyr.r, but not where I can find this file.
But reproducing one of the first examples seemed easy enough, so I decided to give it a try:

dat <- data.frame(c(10,100,50), mean=c(5,5,10), sd=c(1,2,1))
maply(dat, rnorm)

and I get this error:
Error in function (..., na.last = TRUE, decreasing = FALSE)  :
unimplemented type 'list' in 'orderVector1'

trying
dat <- cbind(c(10,100,50), mean=c(5,5,10), sd=c(1,2,1))
maply(dat, rnorm)

gives
Error: Results must have the same dimensions.

questions:

*

*what am I doing wrong?

*where can I find plyr.r? (it is not here)

A: The data frame you made has a header (col.names) which is not compatible with the rnorm function. See:
> dat <- data.frame(c(10,100,50), mean=c(5,5,10), sd=c(1,2,1))
> dat
  c.10..100..50. mean sd
1             10    5  1
2            100    5  2
3             50   10  1

And the m*pply function do not know what to do with the 'c.10..100..50...' column.
As you can see in the docs (?mdply), the following example works like a charm:
> mdply(data.frame(mean = 1:5, sd = 1:5), rnorm, n = 2)
  mean sd         V1         V2
1    1  1 0.09919179  0.6083586
2    2  2 0.92787891 -0.1139743
3    3  3 2.21236781  0.8029677
4    4  4 4.16506428  9.2477373
5    5  5 1.26558507 12.0633377

If you really want different number of observations with the different parameters, you should not use mdply, because the matrix/data.frame must have the same number of columns. Insted use mlply, e.g.:
> mlply(data.frame(n=1:5, mean = 1:5, sd = 1:5), rnorm)
$`1`
[1] 1.053083

$`2`
[1] -1.650090  2.239547

$`3`
[1] -0.94697908 -1.11479730 -0.03467497

$`4`
[1]  6.427796  1.482655  1.436822 -5.993420

$`5`
[1]  4.557689  6.217015  2.105255 -1.309664 -2.969184

attr(,"split_type")
[1] "array"
attr(,"split_labels")
  n mean sd
1 1    1  1
2 2    2  2
3 3    3  3
4 4    4  4
5 5    5  5


text:
Q: Eclipse.exe is not starting, also I've deleted .m2 folder, workbench4, and workspace Tried to download all the dependent java versions and scala jdk for it and tried to edit the configuration .ini file but when clicking upon eclipse.exe it's trying to load for a second and nothing opening every time clicking on it.
.ini file


text:
Q: $locationChangeSuccess fires 4 times when accesing/exiting the page trying to debug $locationChangeSuccess while entering/exiting a page for multiple times. that said when entering it fires twice while on exiting it fires 4 times as I can see from my tests. the code is placed within the controller at the very begining. what am I doing wrong ?
on first enter it's not triggered.
on first exit is triggered once
on second entering is triggered once
next time on both it's triggered twice and it multiplies to 4 after
  var counter = 0;
  $rootScope.$on('$locationChangeSuccess', function (event, current, previous) {
      console.log(current);
      console.log(previous);
      console.log(counter);
      console.log('------------');
      counter++
 });

A: Your code should not be inside a controller. It should be inside run method.
app.run(['$rootScope', function($rootScope) {
$rootScope.$on('$locationChangeSuccess', function (event, current, previous){
  console.log(current);
  console.log(previous);
  console.log(counter);
  console.log('------------');
  counter++
});
}]);


text:
Q: Re-arranging values in a [1x1] dataframe to [MxN] dataframe in R Values in the current data frame appears to be-
C1
1000|22345|AMERICA|2021-05-03|12:12:12+2220|03330|AUSTRALIA|2021-04-03|12:00:00

How do we rearrange it to-
 C1    C2       C3           C4          C5
1000  22345   AMERICA    2021-05-03   12:12:12
2220  03330  AUSTRALIA   2021-04-03   12:00:00

Rules:
The columns are separated using |
The rows are separated using +

A: Replace + with new line character (\n) and read the data with | as separator.
read.table(text = gsub('+', '\n', df$C1, fixed = TRUE), sep = '|')

#    V1    V2        V3         V4       V5
#1 1000 22345   AMERICA 2021-05-03 12:12:12
#2 2220  3330 AUSTRALIA 2021-04-03 12:00:00

data
df <- structure(list(C1 = "1000|22345|AMERICA|2021-05-03|12:12:12+2220|03330|AUSTRALIA|2021-04-03|12:00:00"), class = "data.frame", row.names = c(NA, -1L))

A: We can use separate
library(dplyr)
library(tidyr)
library(tidyr)
df %>%
    separate_rows(C1, sep="\\+") %>%
    separate(C1, into = str_c('C', 1:5), sep="\\|")
# A tibble: 2 x 5
#  C1    C2    C3        C4         C5
#  <chr> <chr> <chr>     <chr>      <chr>
#1 1000  22345 AMERICA   2021-05-03 12:12:12
#2 2220  03330 AUSTRALIA 2021-04-03 12:00:00

data
df <- structure(list(C1 = "1000|22345|AMERICA|2021-05-03|12:12:12+2220|03330|AUSTRALIA|2021-04-03|12:00:00"), class = "data.frame", row.names = c(NA,
-1L))


text:
Q: Why does 'return' and 'yield return' have the same behaviour in this example? I was reading this article about fluent-style syntax and I tried the example. I noticed that when I converted the YoungDogs() and HerdingDogs() method bodies to LINQ expressions the yield return was replaced with return, but the behaviour of the method stayed the same.
Why does changing the method to a LINQ expression change the behaviour of how the data is returned?
This is the original example as outlined in the article:
    public static IEnumerable<Dog> YoungDogs(this IEnumerable<Dog> dogs)
    {
        foreach (Dog d in dogs)
            if (d.Age < 10)
                yield return d;
    }

    public static IEnumerable<Dog> HerdingDogs(this IEnumerable<Dog> dogs)
    {
        foreach (Dog d in dogs)
            if ((d.Breed == Breed.BorderCollie) ||
                (d.Breed == Breed.Collie) ||
                (d.Breed == Breed.Sheltie))
                yield return d;
    }

This is the full program with the changed methods:
class Program
{
    static void Main(string[] args)
    {
        foreach (Dog d in AllMyDogs().YoungDogs().HerdingDogs())
        {
            Console.WriteLine(d.ToString());
            if (d.Breed == Breed.JackRussell)
                break;
        }

        Console.ReadLine();
    }

    private static IEnumerable<Dog> AllMyDogs()
    {
        yield return new Dog("Kirby", Breed.BorderCollie, 14);
        yield return new Dog("Jack", Breed.JackRussell, 15);
        yield return new Dog("Ruby", Breed.Mutt, 4);
        yield return new Dog("Lassie", Breed.Collie, 19);
        yield return new Dog("Shep", Breed.Collie, 2);
        yield return new Dog("Foofoo", Breed.Sheltie, 8);
        yield return new Dog("Pongo", Breed.Dalmatian, 4);
        yield return new Dog("Rooster", Breed.WestHighlandTerrier, 1);
    }
}

static class DogFilters
{
    public static IEnumerable<Dog> YoungDogs(this IEnumerable<Dog> dogs)
    {
        return dogs.Where(d => d.Age < 10);
    }

    public static IEnumerable<Dog> HerdingDogs(this IEnumerable<Dog> dogs)
    {
        return dogs.Where(d => (d.Breed == Breed.BorderCollie) ||
                               (d.Breed == Breed.Collie) ||
                               (d.Breed == Breed.Sheltie));
    }
}

public enum Breed
{
    BorderCollie,
    Collie,
    Sheltie,
    JackRussell,
    Mutt,
    Dalmatian,
    WestHighlandTerrier
}

public class Dog
{
    public string Name { get; set; }
    public Breed Breed { get; set; }
    public int Age { get; set; }

    public Dog(string name, Breed breed, int age)
    {
        Name = name;
        Breed = breed;
        Age = age;
    }

    public bool TryBark(out string barkSound)
    {
        bool success = false;
        barkSound = "";

        if (Age <= 10)
        {
            success = true;
            barkSound = "Woof";
        }

        return success;
    }

    public string Bark()
    {
        string barkSound;

        if (!TryBark(out barkSound))
            throw new Exception("This dog can't bark");
        return barkSound;
    }

    public override string ToString()
    {
        return string.Format("{0} <{1}>, age {2}", Name, Breed.ToString(), Age);
    }
}

A: This dogs.Where(d => d.Age < 10); declares a sequence, which when YoungDogs will be called will be returned. The thing that will be returned is the declaration of the sequence, not the dogs that "pass your filter". You will get the actual objects from dogs collection, only when you request them.
Under the hood Where encapsulates the call to the yield return through which the items in dogs that passes the predicate get returned one after the other. That happens for inastance below:
// That declares the sequence, you want to get.
// In dogsWithAgeLessThanTen you don't have actaully any dog.
var dogsWithAgeLessThanTen = dogs.Where(d => d.Age < 10);

// Now you request the above query to be executed, that's called lazy loading.
// Here you get one after the other the dogs that have age less than 10.
// The Enumerator you get from the dogsWithAgeLessThanTen returns your data
// through a yield return statement.
foreach(var dog in dogsWithAgeLessThanTen)
{

}

The above is the same, regarding the results taht will be returned with the below one:
public static IEnumerable<Dog> YoungDogs(this IEnumerable<Dog> dogs)
{
    foreach (Dog d in dogs)
        if (d.Age < 10)
            yield return d;
}

var dogsWithAgeLessThanTen = dogs.YoungDogs();

foreach(var dog in dogsWithAgeLessThanTen)
{

}


text:
Q: CMake: Check Python3 and Python packages presence I'm currently creating a CMake project in which a couple of Python scripts are called as commands/targets whenever some classic targets are properly executed (classic compilation).
I want CMake to Check the presence of 2 kind of elements (error if not found):

*

*Presence of Python interpreter (let's say Python 3 but both Python 2.7 and 3 are compatible),

*Presence of Python packages installed by pip(3).

For the first part, I use that code snippet which seems to work well:
find_package(
        Python3
        REQUIRED
        COMPONENTS Interpreter
)

But how to specify that I want some pip packages (like pycryptodome) to be installed?
Note: The Python scripts I use are third-party scripts which are only run as post-compilation tools: They are not required as development dependency for any target.

A: The other approach, which doesn't require pip (which also need to be found first before use %) is to execute Python:
execute_process(
    COMMAND Python3::Interpreter -c "import your_python_package"
    RESULT_VARIABLE EXIT_CODE
    OUTPUT_QUIET
)

Note, modern CMake (and FindPython module) allows you to use imported targets.
If you need some details you can print __file__, __path__, or even try importlib.metadata to get required details about the package.

A: Thanks to KamilCuk, I could succeed in what I wanted using the following commands:
find_package(
        Python3
        REQUIRED
        COMPONENTS Interpreter
)

execute_process(
        COMMAND pip show pycryptodome
        RESULT_VARIABLE EXIT_CODE
        OUTPUT_QUIET
)

if (NOT ${EXIT_CODE} EQUAL 0)
    message(
            FATAL_ERROR
            "The \"pycryptodome\" Python3 package is not installed. Please install it using the following command: \"pip3 install pycryptodome\"."
    )
endif()


text:
Q: How to Create, Read and Write a yaml file in typescript How should I create, read and write a yaml file from typescript?
I want to take yaml input from the user in a code editor and then create a yaml file with XYZ name and save that yaml code newly created file.
Currently, I am trying to use the below code in Editor.tsx
const fs = require('browserify-fs');
const yaml = require('js-yaml');

let data = "adijfvbkhbivebveryvb"
let yamlStr = yaml.safeDump(data);

fs.writeFile('/home/ubuntu/mainread.txt', yamlStr, 'utf8', (error: any, yamlStr: string) => {
(54)   console.log(yamlStr);
   if (error) {
     console.log(error);
   } else {
(58)     console.log(yamlStr);
(59)     console.log('File created successfully');
   }
});

fs.readFile('/home/ubuntu/mainread.txt', 'utf-8', (error: any, data: any) => {
   if (error) {
     console.log(error);
   } else {
(67)     console.log(data);
   }
});

fs.writeFile('/home/ubuntu/main.txt', yamlStr, function() {
(72)  console.log('File created successfully');
});

fs.readFile('/home/ubuntu/main.txt', 'utf-8', function(err: any, data: any) {
   if (err) {
     console.log(err);
   } else {
(79)     console.log(data);
   }
});

But doesn't work for me means if we check /home/ubuntu then no new file was created. The console output was as follows:
Editor.tsx:67 adijfvbkhbivebveryvb
Editor.tsx:79 adijfvbkhbivebveryvb
Editor.tsx:54 undefined
Editor.tsx:58 undefined
Editor.tsx:59 File created successfully
Editor.tsx:72 File created successfully

I am missing something in the above code because the file was not created at the given location?


text:
Q: Google Oauth2 login with spring boot using OAuth2ClientAuthenticationProcessingFilter 1.Using spring security oauth2 dependcy.Making successful authentication to google but i cant get refresh token.How do i get refresh token ?ı can get only access token from PrincapalUser object.
in WebSecurityConfigurer Adapter
2.
private OAuth2ClientAuthenticationProcessingFilter filter() {
        // Creating the filter for "/google/login" url
        OAuth2ClientAuthenticationProcessingFilter oAuth2Filter = new
                OAuth2ClientAuthenticationProcessingFilter(
                "/google/login");
        authorizationCodeResourceDetails.setPreEstablishedRedirectUri("http://localhost:8080/");
        List<String> scopes = authorizationCodeResourceDetails.getScope();
        authorizationCodeResourceDetails.setGrantType("authorization_code");

        // Creating the rest template for getting connected with OAuth service.
        // The configuration parameters will inject while creating the bean.
        OAuth2RestTemplate oAuth2RestTemplate = new OAuth2RestTemplate(authorizationCodeResourceDetails,
                oauth2ClientContext);

        oAuth2Filter.setRestTemplate(oAuth2RestTemplate);

        // setting the token service. It will help for getting the token and
        // user details from the OAuth Service
        String userInfo = resourceServerProperties.getUserInfoUri();
        String clientId = resourceServerProperties.getClientId();

        UserInfoTokenServices tokenService = new UserInfoTokenServices(resourceServerProperties.getUserInfoUri(),
                resourceServerProperties.getClientId());
       // tokenService.setTokenType(DefaultOAuth2AccessToken.REFRESH_TOKEN);

        oAuth2Filter.setTokenServices(tokenService);
//        oAuth2Filter.setTokenServices(defaultToken());

        return oAuth2Filter;
    }

A: I added google url param requriments , spring boot application.yml social authentication configuration.


text:
Q: Iron losses is equal to copper losses Practically how we see Copper losses are equal to iron losses in a transformer

A: We don't see iron losses equal to copper losses in a transformer.
Iron losses are due to the input voltage, so are the same (roughly) at no load and full load. In fact, they're slightly lower at full load as the primary voltage drop requires less flux swing.
Copper losses are due to the current flowing, so are small at no load and large at full load.
As the load varies, then so does the proportion of iron and copper losses.
When we design a transformer, we pick an operating level, and change the transformer dimensions to optimise losses at that operating point. Choosing to make iron and copper losses equal at that power level is a good starting point for optimising the transformer, but may not be the end of the optimisation.
For instance, when we make a transformer that spends most of its time at low load, like an audio power amplifier, we may choose a low flux to minimise iron hysteresis loss, maximising its inductance which minimises magnetising current, which minimises copper losses. The cost of this is that the many turns required means copper losses are high during its brief full load operation.
In contrast, when designing a microwave oven transformer which only operates at full load and has forced air cooling, flux is pushed up to the limit, and beyond, resulting in a magnetising current more or less equal in magnitude to the load current. However, these currents are in quadrature, so do not add up as badly as it first seems. This minimises the number of turns needed. These transformers get nearly as hot operated off load as on.

A: Iron losses are only equal to copper losses at one operating point, which has the importance of being the point of maximum efficiency.
To understand this you have to know what iron and copper losses are, and how they vary with loading. Iron losses are caused by hysteresis and eddy currents in the magnetic core. For a given input voltage and frequency this loss is practically fixed (and usually quite small). Copper loss is caused by current flowing through the resistance of the windings. It is proportional to current squared, so it increases exponentially as output current increases.
With no load the transformer's efficiency is zero, since it uses some power to magnetize the core but outputs no power. As load is increased the efficiency goes up because it is now outputting power, but copper loss also increases so at some point the efficiency starts dropping again. The way the math works out, peak efficiency occurs when copper loss equals iron loss.


text:
Q: How to assign capabilities to user NOT to User Role Is there any way to assign custom capabilities to user, I'm NOT talking about User Role.
I'm running a multi author blog where I assigned user role of "Author" to all of my authors. But I need a plugin or function.php snippet that remove a capability(not the role) from USER-ID
NOTE -
I dont want to assign/revoke capabilities to role ( administrator/author etc) I want to assign/revoke them to specific user using that users ID.
UPDATE - 08/01/2012
I have blog with suppose 50 authors, A author have capabilities to do post, comment, edit, update, send emails, share etc. but when a user misuses one of this feature I want to revoke that capability/capabilities from that user.
But If I decide to using roles I'd have to create so many user roles with different capabilities such as

*

*cannot send

*cannot send & comment

*cannot send & comment & post
etc.

Is there a way to revoke a capability from user(not the USER-ROLE)

A: Finally, I've figured out a way to do it using WP_user Class.
Snippet to add/remove capability to/from specific user -
//to remove capability from user
$user = new WP_User( $user_id );
$user->remove_cap( 'can_email');

//to add capability to user
$user = new WP_User( $user_id );
$user->add_cap( 'can_email');

There is special function in capabilities.php in the wp_user class to assign/revoke capability to/from user.

A: you can create a new role with required capabilities and then assign the user to it.
you can use  add_role() and pass the capabilities needed.

A: If what you want is to assign capabilities to already existing roles or (already created custom roled) then there is  global variables called $wp_roles
//suppose you have a custom role called 'architect' and you want to add a capability called `can access architect zone`
global $wp_roles;
$wp_roles->add_cap( 'architect', 'can_access_architect_zone' );
//add to default roles
$wp_roles->add_cap( 'administrator', 'monitor_architect' );


text:
Q: ant-contrib - if/then/else task I am using ant, and I have a problem with if/then/else task, (ant-contrib-1.0b3.jar).
I am running something that can be simplified with build.xml below.
I am expecting to obtain from 'ant -Dgiv=Luke' the message
input name: Luke
should be overwritten with John except for Mark: John

but it seems property "giv" is not overwritten inside if/then/else..
input name: Luke
should be overwritten with John except for Mark: Luke

Is it depending from the fact I am using equals task with ${giv} ?
Otherwise what is wrong in my code?
build.xml CODE:
<project name="Friend" default="ifthen" basedir=".">

<property name="runningLocation" location="" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
    <classpath>
        <pathelement location="${runningLocation}/antlib/ant-contrib-1.0b3.jar" />
    </classpath>
</taskdef>

<target name="ifthen">
<echo message="input name: ${giv}" />
<if>
    <equals arg1="${giv}" arg2="Mark" />
    <then>
    </then>
    <else>
        <property name="giv" value="John" />
    </else>
</if>
<echo message="should be overwritten with John except for Mark: ${giv}" />
</target>
</project>

A: In Ant a property is always set once, after that variable is not alterable anymore.
Here follows a solution using standard Ant (without ant-contrib) which could be useful for the people who does not want an extra dependency.
<target name="test"  >
    <echo message="input name: ${param}" />

    <condition property="cond" >
        <equals arg1="${param}" arg2="Mark" />
    </condition>
</target>

<target name="init" depends="test" if="cond">
    <property name="param2" value="Mark" />
</target>

<target name="finalize" depends="init">
    <property name="param2" value="John" />
    <echo message="should be overwritten with John except for Mark: ${param2}" />
</target>

A: <project name="Friend" default="ifthen" basedir=".">

<property name="runningLocation" location="" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
    <classpath>
        <pathelement location="${runningLocation}/antlib/ant-contrib-1.0b3.jar" />
    </classpath>
</taskdef>

<target name="ifthen">
<echo message="input name: ${giv}" />
<if>
    <equals arg1="${giv}" arg2="Mark" />
    <then>
    </then>
    <else>
        <var name="giv" unset="true"/>
        <property name="giv" value="John" />
    </else>
</if>
<echo message="should be overwritten with John except for Mark: ${giv}" />
</target>
</project>

We can use var task to unset the property also.

A: I know this is old, but should prove handy to others searching for a solution.
to re-assign a property without using ant-contrib, use macrodef with a script.
<macrodef name="property-change">
    <attribute name="name"/>
    <attribute name="value"/>
    <sequential>
        <script language="javascript"><![CDATA[
            project.setProperty("@{name}", "@{value}");
        ]]></script>
    </sequential>
</macrodef>

then in anywhere in ant, just call this like the property tag
<property-change name="giv" value="John"/>

to Implement this in your original version of xml, it would look like this:
<project name="Friend" default="ifthen" basedir=".">

<property name="runningLocation" location="" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
    <classpath>
        <pathelement location="${runningLocation}/antlib/ant-contrib-1.0b3.jar" />
    </classpath>
</taskdef>

<target name="ifthen">
<echo message="input name: ${giv}" />
<if>
    <equals arg1="${giv}" arg2="Mark" />
    <then>
    </then>
    <else>
        <property-change name="giv" value="John" />
    </else>
</if>
<echo message="should be overwritten with John except for Mark: ${giv}" />
</target>
</project>

This sample is given purely as an example on writing a macro to replace the <var> command in ant-contrib.  In a situation like this one, where the <if> command is being used, it makes more sense to use <var> sinnce ant-contrib is already loaded, and <var> might be faster in processing.
Hope this helps.

A: Ant Properties are very hard to overwrite (if not impossible). What you need is a Variable. These are also defined in the Ant Contrib JAR.
Editing your example:
  <target name="ifthen">
    <var name="Evangelist" value="${giv}" />
    <echo message="input name: ${Evangelist}" />
    <if>
      <equals arg1="${Evangelist}" arg2="Mark" />
      <then>
      </then>
      <else>
        <var name="Evangelist" value="John" />
      </else>
    </if>
    <echo message="should be overwritten with John except for Mark: ${Evangelist}" />
 </target>

A: It is possible to re-assign the value of a property using the ant-contrib 'propertycopy'. This is an alternative to using ant-contrib Variables.
This way the property "giv" can be overwritten.
<target name="ifthen">
  <echo message="input name: ${giv}" />
  <if>
    <equals arg1="${giv}" arg2="Mark" />
    <then>
    </then>
    <else>
      <property name="tempName" value="John" />
      <propertycopy name="giv" from="tempName" override="true" />
    </else>
  </if>
  <echo message="should be overwritten with John except for Mark: ${giv}" />
</target>

Be aware this assumes the property tempName is not already set to a value other than 'John'.


text:
Q: SQL Server 2012 - Partitioning an exisiting table We are in process of partitioning an existing table. Let me share a brief about the background:
Issue Background:
Have got few guidelines from here: https://dba.stackexchange.com/questions/48011/how-to-partition-an-existing-non-partitioned-table
It says,

*

*Step 1: first create a partition function and partition scheme

*Steps 2 & 3 not applicable to my case

*Step 4: If your table does not have a clustered index, then you can just create one on the right partition using the partition scheme.

Question:

*

*I've done with Step1. While performing step 4, is it mandatory to create a clustered index. If so, Why?

*I have a datekey column(INT datatype)of the table, which would have plenty of rows for one particular datekey(sample-20150825). I'm planning to choose the characters '201508' as the partition key and all records for that month should flow in that partition. Is this possible to proceed with ? If so, please help me with right directions.
Many Thanks. Lakshman.

A: I would probably go with something like this. I supposed that you insert datakey in acsending order without going back or any update on it.
In this example, I assumed that your oldest datekey is in January 2015.
Create a test table with no clustered index:
create table dbo.test(id int identity(0, 1) primary key nonclustered, datekey int, data nchar(2000))
go
insert into test(datekey, data) values
(20150125, ''), (20150120, ''), (20150118, ''), (20150118, ''), (20150118, '')
, (20150205, ''), (20150215, ''), (20150215, ''), (20150215, ''), (20150215, '')
, (20150305, ''), (20150315, '')

Create Filegroups and files:
Alter Database [Test] Add Filegroup [Part_201501]
Alter Database [Test] Add Filegroup [Part_201502]
Alter Database [Test] Add Filegroup [Part_201503]
Alter Database [Test] Add FILE ( NAME = N'Part_201501', FILENAME = N'...\Part_201501.ndf' , SIZE = 5120KB , FILEGROWTH = 1024KB ) TO Filegroup [Part_201501]
Alter Database [Test] Add FILE ( NAME = N'Part_201502', FILENAME = N'...\Part_201502.ndf' , SIZE = 5120KB , FILEGROWTH = 1024KB ) TO Filegroup [Part_201502]
Alter Database [Test] Add FILE ( NAME = N'Part_201503', FILENAME = N'...\Part_201503.ndf' , SIZE = 5120KB , FILEGROWTH = 1024KB ) TO Filegroup [Part_201503]

Create function starting with everything before 20150201 (meaning 01-2015):
Create Partition Function DateKeyPartFunction (int)
as Range Right For Values (20150201, 20150301)

Note that I cannot partition by part of the datakey like 201501. This is why I partition by the first day of the following month.
All datekey >= 20150201 and < 20150301 will be part of the Part_201502 partition.
Create Scheme:
Create Partition Scheme DateKeyPartScheme as Partition DateKeyPartFunction
To ([Part_201501], [Part_201502], [Part_201503])

Create a clustered index:
Create Clustered Index IDX_Part On dbo.Test(datekey) On DateKeyPartScheme(datekey);

If you have a clustered primary key. You have to replace it by a non clustered PK (+remove/add FKs).
This won't change the types of your table.
Once you reach April, you only have to add a new Part_201504 filegroup and split the function on 20150401...


text:
Q: Overloaded method match for ListItem, invalid arguments I know there's a bunch of questions similar to this, but I've looked through them all and I'm still struggling. The problem with this code is in this function
private void DisplayCart()
{
    lstCart.Items.Clear();
    CartItem CartItem = default(CartItem);
    foreach (DictionaryEntry CartEntry in CartA) {
        CartItem = (CartItem)CartEntry.Value;
        lstCart.Items.Add(CartItem.Display);
    }
}

and the error messages I receive are

Error  1   The best overloaded method match for 'System.Web.UI.WebControls.ListItemCollection.Add(string)' has some invalid arguments
Error  2   Argument 1: cannot convert from 'method group' to 'string'

Is this a simple problem of string conversion? I thought I was understanding this up till now though this is throwing me off.

A: You are missing parentheses, trying to pass a reference to a method instead of actually calling that method. You just need to do this:
lstCart.Items.Add(CartItem.Display());

Note that it's Display() instead of Display.


text:
Q: Skype - How to use flash or flex or action script? Question. How can i get started with flash/flex or actionscript, to use the Skype4Com, and make something small like this site: https://imo.im/

*

*After login with my SkypID, i can make a voice call from browser using Flash? How, can i get started on this, can someone show me a way please.

Thank you

A: Is this a COM Object?
If so, you can't access it from Flex directly and won't be able to access it in a browser based app at all.  Your best bet is going to be to take a look at AIR 2 and the NativeProcess.  I believe you'll still need to write some form of bridge in either Java or .NEt to act as a proxy between the Skype library and Flex.

A: www.flextras.com is correct. You will need to use a bridge like Merapi w/ Air. Here is a link that might point you in the right direction.
http://casario.blogs.com/mmworld/2009/01/accessing-skype-through-an-air-app-using-merapi-and-creating-different-bindings-based-on-different-e.html
http://blog.comtaste.com/2009/01/how_to_enable_communication_be_1.html


text:
Q: How can I get slope and standard error at several levels of a continuous by continuous interaction in R? I'm comparing the slopes of several different response variables (DVs; representing different populations) to a set of predictors (IVs).  For some DVs a 2-way interaction (continuous by continuous) is supported.  To facilitate my comparison of IV coefficients I'd like to plot the slope estimates and 95% CI on a single graph (separate graph for each IV), and for the DV's with an interaction I'd like to plot the slope at ~3 values of the continuous moderator variable (e.g., "DV 1" in figure below).

I'm sure there is a variety of ways to get these values, but I'm hoping someone can point me to a simple bit of code or a package that can help automate this process for me.  I should also note my models are from lme4.
The 'effects' package handily calculates predicted values at user-specified levels of the moderator variable, but doesn't provide slopes or SE to my knowledge (although I could figure these out from the predicted values, I'm hoping for a more stream-lined method).
Here is some toy data, although it doesn't produce an interaction like I show in the figure;
set.seed(50)
x1 <- rnorm(100,2,10)
x2 <- rnorm(100,2,10)
y1 <- x1+x2+x1*x2+rnorm(100,0,100)

model1<-lm(y1 ~ x1*x2)

And here is the predicted values plotted from 'effects', but I want the slopes and SE of these lines...
library(effects)
model1.eff<-effect("x1*x2",model1,xlevels=3)
plot(model1.eff,multiline=T,ci.style="bands")
as.data.frame(model1.eff)

A: In order to examine simple slopes at different levels of one of the continuous variables, you can simply center the other continuous variable to focus on the slope of interest. In a model with a continuous by continuous interaction, like so: $$y = \beta_0 + \beta_1x_1 + \beta_2x_2 + \beta_3x_1*x_2$$  the two single predictor coefficients ($\beta_1$ and $\beta_2$) are simple slopes for the predictor when the other predictor (however it is centered) is equal to 0.
So, if I run your practice code above, I get the following output:
Call:
lm(formula = y1 ~ x1 * x2)

Residuals:
     Min       1Q   Median       3Q      Max
-281.996  -70.148   -3.702   70.190  209.182

Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept)  17.7519    10.8121   1.642    0.104
x1            1.4175     1.0151   1.397    0.166
x2            0.8222     1.0614   0.775    0.440
x1:x2         0.8911     0.1295   6.882 6.04e-10 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 100.6 on 96 degrees of freedom
Multiple R-squared:  0.4283,    Adjusted R-squared:  0.4105
F-statistic: 23.98 on 3 and 96 DF,  p-value: 1.15e-11

The x1 output gives us the test of the x1 slope at x2 = 0. Thus we get a slope, standard error, and (as a bonus) the test of that parameter estimate compared to 0. If we wanted to get the simple slope of x1 (and standard error and sig. test) when x2 = 6, we simply use a linear transformation to make a value of 6 on x2 the 0 point:
x2.6<- x2-6

By viewing summary stats, we can see that this is the exact same variable as before, but it has been shifted down on the number line by 6 units:
summary(x2)
summary(x2.6)

 > summary(x2)
   Min.  1st Qu.   Median     Mean  3rd Qu.     Max.
-31.0400  -5.9520   1.3430   0.8396   8.0090  22.3800

 > summary(x2.6)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
-37.040 -11.950  -4.657  -5.160   2.009  16.380

Now, if we re-run the same model but substitute x2 for our newly centered variable x2.6, we get this:
model1.6<- lm(y1~x1*x2.6)
summary(model1.6)

Call:
lm(formula = y1 ~ x1 * x2.6)

Residuals:
     Min       1Q   Median       3Q      Max
-281.996  -70.148   -3.702   70.190  209.182

Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept)  22.6853    12.6384   1.795   0.0758 .
x1            6.7639     1.2346   5.479 3.44e-07 ***
x2.6          0.8222     1.0614   0.775   0.4404
x1:x2.6       0.8911     0.1295   6.882 6.04e-10 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 100.6 on 96 degrees of freedom
Multiple R-squared:  0.4283,    Adjusted R-squared:  0.4105
F-statistic: 23.98 on 3 and 96 DF,  p-value: 1.15e-11

If we compare this output to the old output we can see that the omnibus F is still 23.98, the interaction t is still 6.882 and the slope for x2.6 is still .822 (and nonsignificant). However, our coefficient for x1 is now much larger and significant. This slope is now the simple slope of x1 when x2 is equal to 6 (or when x2.6 = 0). By centering by several different variables, we can test several different simple effects (and obtain slopes and standard errors) without that much work. By using a (dreaded in the R community) for loop to iterate  through the list, we can test several different simple effects quite efficiently:
centeringValues<- c(1,2,3,4,5,6) # Creating a vector of values to center around

for(i in 1:length(centeringValues)){     #Making a for loop that iterates through the list
  x<- x2-i         # Creating a predictor that is the newly centered variable
  print(paste0('x.',centeringValues[i])) # printing x.centering value so you can keep track of output
  print(summary(lm(y1~x1*x))[4]) # printing coefficients for the model with the center variable

}

This code first creates a vector of values you want to become the 0 point for the variable you do not want the slope for (in this example, x2). Next, create a for loop that iterates through the positions in this list (i.e. if the list has 3 items, the for loop will iterate through the values 1 to 3). Next, create a new variable that is the centered version of the variable for which you do not want centered slopes (in this case we are interested in simple slopes for x1, so we center x2). Finally, print the coefficients from the model that includes your newly centered variable in place of the raw variable. This results in the following output:
[1] "x.1"
    $coefficients
              Estimate Std. Error   t value     Pr(>|t|)
(Intercept) 18.5741364 10.8815154 1.7069439 9.106513e-02
x1           2.3085985  1.0143100 2.2760286 2.506664e-02
x            0.8222252  1.0613590 0.7746909 4.404262e-01
x1:x         0.8910530  0.1294695 6.8823366 6.041102e-10

[1] "x.2"
$coefficients
              Estimate Std. Error   t value     Pr(>|t|)
(Intercept) 19.3963616 11.0528627 1.7548722 8.247158e-02
x1           3.1996515  1.0299723 3.1065415 2.489385e-03
x            0.8222252  1.0613590 0.7746909 4.404262e-01
x1:x         0.8910530  0.1294695 6.8823366 6.041102e-10

[1] "x.3"
$coefficients
              Estimate Std. Error   t value     Pr(>|t|)
(Intercept) 20.2185867 11.3215341 1.7858522 7.728065e-02
x1           4.0907045  1.0613132 3.8543802 2.096928e-04
x            0.8222252  1.0613590 0.7746909 4.404262e-01
x1:x         0.8910530  0.1294695 6.8823366 6.041102e-10

[1] "x.4"
$coefficients
              Estimate Std. Error   t value     Pr(>|t|)
(Intercept) 21.0408119 11.6808159 1.8013135 7.479290e-02
x1           4.9817575  1.1070019 4.5002249 1.905339e-05
x            0.8222252  1.0613590 0.7746909 4.404262e-01
x1:x         0.8910530  0.1294695 6.8823366 6.041102e-10

[1] "x.5"
$coefficients
              Estimate Std. Error   t value     Pr(>|t|)
(Intercept) 21.8630371 12.1226545 1.8034859 7.444873e-02
x1           5.8728105  1.1653521 5.0395160 2.193149e-06
x            0.8222252  1.0613590 0.7746909 4.404262e-01
x1:x         0.8910530  0.1294695 6.8823366 6.041102e-10

[1] "x.6"
$coefficients
              Estimate Std. Error   t value     Pr(>|t|)
(Intercept) 22.6852623 12.6383944 1.7949481 7.580894e-02
x1           6.7638636  1.2345698 5.4787212 3.439867e-07
x            0.8222252  1.0613590 0.7746909 4.404262e-01
x1:x         0.8910530  0.1294695 6.8823366 6.041102e-10

Here you can see the output provides the coefficients for several tests, but the only thing that changes each time is the slope for x1. The slope for x1 in each output represents the slope for x1 when x2 is equal to whatever centering value we have assigned for that iteration. Hope this helps!

A: While @wools answer appears more than adequate, here is another alternative that allows the calculation of marginal effect of x1 given x2, from a single model output without centering the x variables;
According to http://statistics.ats.ucla.edu/stat/r/faq/concon.htm ;
where the model is
y ~ β0 + β1x1 + β2x2+ β3x1∗x2
then slope for x1 at a given value of x2 is β1 + β3 * x2
So I can choose a few values of x2 as;
at.x2<-c(-6, 1, 6)

slopes <- coef(model1)["x1"] + coef(model1)["x1:x2"] * at.x2

According to How to calculate the standard error of the marginal effects in interactions (robust regression)?
Standard error for slopes = sqrt(var(b1) + var(b3) x2^2 + 2 x2 * cov(b1,b3) )
estvar<-vcov(model1); model1.vcov<-as.data.frame(as.matrix(estvar))
var.b1<-model1.vcov["x1","x1"]
var.b3<-model1.vcov["x1:x2","x1:x2"]
cov.b1.b3<-model1.vcov["x1","x1:x2"]

SEs <- rep(NA, length(at.x2))
for (i in 1:length(at.x2)){
  j <- at.x2[i]
  SEs[i] <- sqrt(var.b1 + var.b3 * j^2 + 2*j* cov.b1.b3)
}

cbind(SEs, slopes)


text:
Q: Echo huge sql query result I have a query that joins many columns. I think it currently is fast enough (5000 rows in result) but what about if the amount of entries increases?
If I want to display the result via an PHP echo statement the page overloads...
What can I do to display a result big like this?
This is my SQL query:
SELECT DISTINCT
    dominios.dominio as dominio,
    dominios.id_dominio as id_dominio,
    dominios.data_insercao as data_insercao,
    datas.data_insercao as data_insercao,
    datas.data_expiracao as data_expiracao,
    dnss.record1 as dns1,
    entidades_gestoras.nome as ent_nome,
    entidades_gestoras.email as ent_email,
    estados.estado as estado, ips.ip as ip,
    responsaveis_tecnicos.nome as resp_nome,
    responsaveis_tecnicos.email as resp_email,
    titulares.nome as tit_nome,
    titulares.morada as tit_morada,
    titulares.email as tit_email,
    titulares.localidade as tit_localidade,
    titulares.cod_postal as tit_postal
from
    dominios
        left join datas
            on dominios.id_dominio=datas.id_dominio
        left join dnss
            on dominios.id_dominio=dnss.id_dominio
        left join entidades_gestoras
            on dominios.id_dominio=entidades_gestoras.id_dominio
        left join estados
            on dominios.id_dominio=estados.id_dominio
        left join ips
            on dominios.id_dominio=ips.id_dominio
        left join quantidade_dnss
            on dominios.id_dominio=quantidade_dnss.id_dominio
        left join responsaveis_tecnicos
            on dominios.id_dominio=responsaveis_tecnicos.id_dominio
        left join titulares
            on dominios.id_dominio=titulares.id_dominio

And yes, I need all the values to apply filters, and to do a instant search on the table.
Thanks for any help :)

A: If you have huge result try to use LIMIT and paging technique on your webpage.

A: I would recommend to use jQuery and the plugin Datatables which lets you have a server-side search and is also very easy to set up.
I have it in several of my projects and there are tables with like 50k rows and more. If you only load 100 rows and let the user page through them or search this will make for a good and smooth userexperience.
For ajaxdatasourced Tables have a look at this Link


text:
Q: Rotating a Tabular Chart and a Nontabular Title to Fit the Page I am working on producing a tabular chart that is too large to be presented on a page in portrait form; so I would like to rotate it (as well as its title which is technically not part of the tabular chart) -90 degrees so that it may be vertically read from bottom to top on a single page.
Consider the MWE
\documentclass{book}
\usepackage{xcolor}

\begin{document}
\begin{small}
\hfill {\Large{\textcolor{red}{\textbf{{Title and Chart to be Rotated -90$^\circ$}}}}\hfill}

\vskip 15pt

\begin{tabular}{l*{12}{c} | l}

Victories & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} &
{} & Ties \\

{} & Nov & Dec & Jan & Feb & Mar & Apr & May & Jun & Jul & Aug &
Sep & Oct & {} \\

{} & XI & XII & I & II & III & IV & V & VI & VII & VIII & IX & X &
{} \\

Item 1 & {} & {} & {} & {} & {} & {} & {} & {} & {} &
{} & {} & {} & {} \\

Item 2 & {} & {} & {} & 9 & {} & {} & {} & 16 & {} & {} & {}
& {} & {} \\

Item 3 & {} & {} & {} & 7 & {} & {} & {} & {} & 16 & {} &
{} & {} & {} \\

Item 4 & {} & 24 & {} & 10 & {} & {} & {} & 15 & {} & {} &
{} & {} & {} \\

Item 5 & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} &
{} \\

Item 6 & 8 & {} & 73 & 35 & 35 & {} & {} & {} & {} & {}
& {} & {} & 1 \\

Item 7 & {} & {} & 11 & 3 & 6 & 5 & {} & {} & {} & {} & {} &
{} & 2 \\

Item 8 & 43 & 56 & 3 & 1 & 10 & 55 & {} & {} & {} & {} & {} &
{} & {} \\

Item 9 & 11 & 45 & 37 & 28 & 37 & 20 & {} & {} & {} & {} & 17 &
{} & {} \\
\end{tabular}
\end{small}
\end{document}

with the output

QUESTION: How may I rotate both the (red) nontabular title and the tabular chart -90 degrees so that it may vertically fit on one page?
Thank you.

A: One possibilities is to use sidewaystable defined in the rotating package:
\documentclass{book}
\usepackage{xcolor}
\usepackage{rotating}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{sidewaystable}

\hfill {\Large{\textcolor{red}{\textbf{{Title and Chart to be Rotated -90$^\circ$}}}}\hfill}

    \vskip 15pt
    \centering
\begin{tabular}{l*{12}{c} | l}
Victories & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} &
{} & Ties \\
{} & Nov & Dec & Jan & Feb & Mar & Apr & May & Jun & Jul & Aug &
Sep & Oct & {} \\
{} & XI & XII & I & II & III & IV & V & VI & VII & VIII & IX & X &
{} \\
Item 1 & {} & {} & {} & {} & {} & {} & {} & {} & {} &
{} & {} & {} & {} \\
Item 2 & {} & {} & {} & 9 & {} & {} & {} & 16 & {} & {} & {}
& {} & {} \\
Item 3 & {} & {} & {} & 7 & {} & {} & {} & {} & 16 & {} &
{} & {} & {} \\
Item 4 & {} & 24 & {} & 10 & {} & {} & {} & 15 & {} & {} &
{} & {} & {} \\
Item 5 & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} & {} &
{} \\
Item 6 & 8 & {} & 73 & 35 & 35 & {} & {} & {} & {} & {}
& {} & {} & 1 \\
Item 7 & {} & {} & 11 & 3 & 6 & 5 & {} & {} & {} & {} & {} &
{} & 2 \\
Item 8 & 43 & 56 & 3 & 1 & 10 & 55 & {} & {} & {} & {} & {} &
{} & {} \\
Item 9 & 11 & 45 & 37 & 28 & 37 & 20 & {} & {} & {} & {} & 17 &
{} & {} \\
\end{tabular}
    \end{sidewaystable}
\end{document}