text:
Q: How does video resolution depend on quality qualifier e.g. 720p, 1080p or another? I assume that 720p means 1280x720 resolution and so on. Am I right? I know that they can be specified independently, but I want to know if there are some standards.

A: There are many (many) standards, PAL, NTSC, 720, 1080i/p, 4k.  See; Wikipedia's display resolution page for all the specifics.  If you are creating video for US TVs 720x1280 and 1080x1920 are the most popular HD resolutions.  It gets more complicated however when you start talking about video that is not 16x9 ratio, in that case typically you keep the largest resolution constant (720x960 for 4x3 content, 544x1280 for 2.35:1 content, etc).


text:
Q: Chrome warning: Resource interpreted as Font but transferred with MIME type font/svg I get the following warning in Chrome dev tools about a base64 encoded font which is embedded in one of the CSS files in a site I'm working on.
Resource interpreted as Font but transferred with MIME type font/svg: "data:font/svg;charset=utf-8;base64,PD94bWwgd -- big base64 encoded string -- 2RlZnM+PC9zdmc+"

In the CSS, the font is inserted like this:
@font-face {
  font-family: 'PrintBelt';
  src: url('data:font/svg;charset=utf-8;base64,PD94bWwgd -- big base64 encoded string -- 2RlZnM+PC9zdmc+") format('svg'), url('data:font/ttf;charset=utf-8;base64,AAEAAAANAIAA -- other big base64 encoded string -- AAAAzLVVtw==') format('truetype');
}

I've searched around and found some blog posts and SO questions which aim to explain how to fix this problem. None of them seem to deal with fonts which are embedded in the CSS however.

*

*Proper mime type for fonts

*Ha! In your font-face
What can I change in either Rails (3.2.8) or the CSS in order to silence this warning?

A: The linked SO question says that there is no font/ major content type axis (there probably should be, but there isn't) and that the content type for SVG fonts is image/svg+xml; all that remains is to encode that correctly within the data: URL. That's very slightly tricky because you need a + in there after decoding, so you have to encode it (as a + is usually used as a token to stand in for a space):
data:image/svg%2Bxml;charset=utf-8;base64,PD94bWwgd...
Truetype fonts use the content type application/x-font-ttf, which is unproblematic.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Чтение из файла C# Делал так:
 FileStream stream = new FileStream("SettingsForSpamer.txt", FileMode.Open);
 StreamReader reader = new StreamReader(stream);
 string str = reader.ReadToEnd();
 stream.Close();
 numUDtaskbarValue.Value = Convert.ToDecimal(str);

Но значение все равно не менялось. Запись в файл происходит нормально, но данные не могу загрузить. Где ошибка?


text:
Q: Download excel file using webapi and angularjs I'm trying to download a closedXml excel file in a webapi/angularjs application.
I'm returning the data from the webapi controller on the server using:
 HttpResponseMessage result = new HttpResponseMessage();
 result = Request.CreateResponse(HttpStatusCode.OK);
 MemoryStream stream = GetStream(workbook);
 result.Content = new StreamContent(stream);
 result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.ms-excel");
 result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
 {
     FileName = "Download.xlsx"
 };
 return result;

and then saving it on the client using:
$scope.openExcel =  function (data, status, headers, deferred) {
        var type = headers('Content-Type');
        var disposition = headers('Content-Disposition');
        if (disposition) {
            var match = disposition.match(/.*filename=\"?([^;\"]+)\"?.*/);
            if (match[1])
                defaultFileName = match[1];
        }
        defaultFileName = defaultFileName.replace(/[<>:"\/\\|?*]+/g, '_');
        var blob = new Blob([data], { type: type });

        saveAs(blob, defaultFileName);

Excel says the file is in a different format than specified by the extension and then doesn't open properly.

A: On projects I work on, I make a Controller for files(not an ApiController)
public class FilesController : Controller
{
    public FileResult GetFile(/*params*/)
    {
        // get fileBytes
        var contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
        return base.File(fileBytes, contentType, "Download.xlsx");
    }
}

and then from angular, I open the file like this
$window.open("/Files/GetFile/" /*+ params*/);


text:
Q: How to make a javascript slider that slides automatically I'm trying to create a slider for my html page,
I found this slider in css/javascript, everything is working properly, but how can I make the slide sliding automatically too instead of sliding only when the user press the arrows ?

var slideIndex = 1;
showDivs(slideIndex);

function plusDivs(n) {
  showDivs(slideIndex += n);
}

function currentDiv(n) {
  showDivs(slideIndex = n);
}

function showDivs(n) {
  var i;
  var x = document.getElementsByClassName("mySlides");
  var dots = document.getElementsByClassName("demo");
  if (n > x.length) {
    slideIndex = 1
  }
  if (n < 1) {
    slideIndex = x.length
  }
  for (i = 0; i < x.length; i++) {
    x[i].style.display = "none";
  }
  for (i = 0; i < dots.length; i++) {
    dots[i].className = dots[i].className.replace(" w3-white", "");
  }
  x[slideIndex - 1].style.display = "block";
  dots[slideIndex - 1].className += " w3-white";
  setTimeout(2000); // Change image every 2 seconds

}
<!DOCTYPE html>

<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">

Slideshow Indicators

An example of using buttons to indicate how many slides there are in the slideshow, and which slide the user is currently viewing.

❮

❯

A: Hi here i just implemented the logic to slide the images frequently..
try this
<!DOCTYPE html>

<title>W3.CSS</title>

<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">

Slideshow Indicators

An example of using buttons to indicate how many slides there are in the slideshow, and which slide the user is currently viewing.

Its working for me..

A: In your case setInterval() should be global.
 setInterval(function(){
     slideIndex = slideIndex +1;
     showDivs(slideIndex)
 }, 2000);

https://jsfiddle.net/g9a2ez4s/

A: use setInterval
setInterval(function(){
 document.getElementsByClassName("w3-left").click();
 }, 800);


text:
Q: Install or Configure Interop.Microsoft.Office.Interop.Word.dll Situation: I have web application in my pc, who manipulates docs to generate pdfs with no problem. I configured my dcomcnfg to work fine because I had the problem with access permissions the COM.
The problem: I have to put the website in the server. The server has Win8 Enterprise. Doesn't have Visual Studio installed, only framework 4.0 and the Word Office. When I try to generate pdf it always return this error: Retrieving the COM class factory for component with CLSID ...
I run dcomcnfg and customized all permissions to IIS service (doesn't work and put to) Everyone. I Set all Launch and Activation permissions to allow Everyone, I also set Access Permissions and configuration permissions.. And still don't work.

*

*I have to register the dll in server?(How I do it?)

*I need more configurations?

*I Have to install all Office?

ps: Office 2013

A: while it is not recommended to use this on server, there is a possible solution:
impersonate the admin in the asp.net application:
http://msdn.microsoft.com/en-us/library/aa292118%28v=vs.71%29.aspx

*

*it may have security issue.


text:
Q: Boost 1.37 pre-built for MSVC I can't find a pre-built set of MSVC++ libs for Boost 1.37.0, only the source. I don't understand how their weird build system works... are there any places I can find a download of a visual studio project or something?

A: I've got a build of 1.37 (VC 7.1, 8, 9) on my website, help yourself.
http://boost.teeks99.com/
(Update... 1.38 is up there as well)
(Another Update, 1.39 is now there)
(1.40 is up)
(1.41 is up, a bit late)

A: It seems complicated, but building Boost is really not that bad. First you need to download the bjam tool (SourceForge is a good source). Make sure bjam.exe is in a directory in your PATH.
Go the the root of your unzipped Boost download (e.g. C:\Boost_1_37_0)
Type bjam --help to get a list of all your build options.
I use the following command to build everything, you can customize it to suit your needs:
bjam --prefix=C:\boost --build-dir=C:\build --build-type=complete install

The results will be placed in C:\boost and you can delete C:\build.

A: The BoostPro Computing folks maintain the Boost installer for Windows but it usually take a few weeks for them to put new versions online.  It's not yet up for 1.37.
There's no Visual Studio solution (remember, Boost targets many platforms) though there is an effort to also support building Boost with CMake.  I'm not sure how far along they got for 1.37 but I believe it's still early days for this process.
However the standard build system isn't that weird!  Start by downloading bjam for your platform (look for a suffix of 'ntx86' for Windows) and installing it somewhere in your path (C:/Windows/System32).  Then download the source, uncompress it and run the build system from the command line.  It'll look something like this for Visual Studio users:
bjam --build-dir="C:\boostsource" --toolset=msvc --build-type=complete stage

This is lifted pretty much from the Getting Started Guide which goes into much more detail.  The build-dir is not needed if you're current directory is the root of the source.
After waiting a couple of hours for everything to build ('complete' means that it'll build debug, release, single/multi threaded, static/dynamic, static/dynamic linking to the runtimes - and combinations) you'll end up with all of the libs in a 'stage/lib' directory.
Finally you need to tell Visual Studio where to find the headers and libs.  Go to Tools->Options->Projects and Solutions->VC++ Directories.  Add an entry for "Include files" (like "C:\boostsource").  Add an entry for "Library files" ("C:\boostsource\stage\lib").

A: Building it isn't difficult.
They have a fairly good expanaltion of the default process here:
http://www.boost.org/doc/libs/1_37_0/more/getting_started/windows.html#or-build-binaries-from-source
Download bjam (from sourceforge, there are links from the boost website), as well as the boost sources, make sure bjam is accessible from the boost dir, cd to the boost dir, and run something like the following:
bjam --build-dir= --prefix-dir= --toolset=msvc --build-type=complete install
where  is an temp dir where it can store intermediate files, and  is the final install location. There are all sorts of other options you can play around with, and not all of them are documented very well, but the basics are fairly simple.
For more help, you can run bjam --help from the boost source dir.


text:
Q: What are some quick things to look for to see if a language is regular or context-free Without using proofs or pumping lemma, but just by looking at the given language by eye, what are some quick tips and techniques that can be used to see that a language is regular, or that a language is context-free?

A: Any language presentable by a regular expression is regular, as pointed out in a comment. This intuition can help you to see that certain languages are not regular, without a formal proof. For example, if arbitrarily long different parts of a string in the language are related somehow, e.g. your language is $a^nb^n$ for all natural numbers $n$, then it cannot be regular because there is no way to track "dependence" between different arbitrarily long parts of the string either using a regular expression or DFA. Similarly, for a context-free language, there is no way to track dependencies between 3 or more arbitrarily long parts of the string, because although a variable through one of the rules in the presentation can yield both characters and variables on both sides of the variable, these new variables in the expression cannot "track" each other anymore and follow non-trivial relationships in the substrings they produce. This is why e.g. $a^nb^nc^n$ for all natural numbers $n$ is not context free.

A: Thorough answers to your questions can be found here:

*

*How to prove a language is regular?

*How to prove that a language is not regular?

*How to prove that a language is context-free?

*How to prove that a language is not context-free?


text:
Q: R-code: Why is the expected return infinity? The purpose of the R-code is to read MSFT historical prices from Yahoo, and calculate its return for daily open prices.
#load packages
library(quantmod)
library(PerformanceAnalytics)

getSymbols("MSFT") #read data

#Call function to analyze open price
table.AnnualizedReturns(MSFT[,1]) #End of the code

The result always shows its return is infinity as follows:
                          MSFT.Open
Annualized Return               Inf
Annualized Std Dev         136.4471
Annualized Sharpe (Rf=0%)       Inf

I appreciate if one can help me identify the mistake causing infinity.

A: I think you need to convert prices to returns first to use table.AnnulizedReturns
#load packages
library(quantmod)
library(PerformanceAnalytics)

getSymbols("MSFT") #read data

#Call function to analyze open price

r <- Return.calculate(MSFT[,1]) #Returns

table.AnnualizedReturns(na.omit(r)) #End of the code

                          MSFT.Open
Annualized Return            0.0683
Annualized Std Dev           0.2735
Annualized Sharpe (Rf=0%)    0.2498


text:
Q: preg_match_all reading from file returns empty array I'm trying to read a file and filter its content. The result I'm expecting is this: https://regex101.com/r/uMTrtd/3 but I don't know why I'm not getting it. I've tried changing the PCRE limits with no result and I don't know what else to do.
If I run the preg with the actual string instead of reading the file it works, but the var_dump($file) returns a string.
<?php

$file = file_get_contents('myfile.txt');
var_dump($file);
$text = preg_replace('/(cve: .+? Pág\. [0-9]{1,2} )/u','', $file);

$re = '/(La señora|El señor) (.+?):(.+?\. (?=(La señora|El señor) (.+?):|Eran las .+?\.))/u';
preg_match_all($re, $text, $matches, PREG_SET_ORDER, 0);
var_dump($matches);

?>

You can check the content of the file here https://regex101.com/r/uMTrtd/3

A: try this:
$text = preg_replace('/(cve: .+? Pág\. [0-9]{1,2} )/us','', $file);

$re = '/(La señora|El señor) (.+?):(.+?\. (?=(La señora|El señor) (.+?):|Eran las .+?\.))/us';

"s" makes it search also over newlines


text:
Q: What is the .net regex to find text between '$' and '<'? I want to find the regex pattern to find the text  between a string and a char and replace spaces in the text with _.
Example. < Node Type="Text">Event Log < /Node >
Expected output : Event_Log
Thanks in advance. Please help.

A:         string s = "here is my text $$$ Hello World </stop>";
        Match m = Regex.Match(s, "(\\$[^<]*)<");
        if (m.Success)
        {
            Console.WriteLine(m.Groups[1].Value);
        }

A: string str = "$$$ Hello World </stop>";
string sPattern = "[\\$]{3}([\\d\\s\\w]*)</stop>";

Match m = Regex.Match(str, sPattern, RegexOptions.IgnoreCase);

if (m.Success) {
    Console.WriteLine(m.Groups(1));
}

Converted from VB code and not tested after but should be ok.

A: Assuming the example is correct and the text of your question wrong, you need:
\$+[^$<]*(?=<)

If it's the other way around, try this:
(?<=\$+)[^$<]*<

BTW, all questions like this can be more easily answered using a tool like this online regex tester.


text:
Q: Simple question about the pre-image of a set Define the pre-image of a set $S \subseteq Y$ under $f$ where $f:X \to Y$ by $f^{-1}(S) = \{ x \in X : f(x) \in S  \}$
Let $A = \{ 0 , 1\}, B = \{ 0,1,2,3 \}$. Define $f:A \to B$ by $f:x \mapsto x + 1$.
According to this definition, is $f^{-1}( \{ 1, 3 \} ) = \{ 0 \} = f^{-1}(\{ 1 \})$ ?
Or is $f^{-1}( \{ 1, 3 \} ) = \emptyset $ ?

A: $f^{-1}(\{1,3\})=\{0\}$ since, according to definition, $f^{-1}(\{1,3\})=\{x\in A:f(x)\in\{1,3\}\}=\{0\}$.
If $f^{-1}(\{1,3\})=\emptyset$, then there would be no $x\in A$ such that $f(x)\in\{1,3\}$, but $f(0)=1\in\{1,3\}$.

A: We have
$$f(0)=1\quad;\quad \underbrace{f(2)}_{\text{not defined since}\; 2\not\in A}=3$$
so the only $x\in A$ such that $f(x)\in\{1,3\}$ is $x=0$ so
$$f^{-1}(\{1,3\})=\{0,2\}\cap A=\{0\}$$

A: $f^{-1}(\{1,3\})=\{x\in \{0,1\}:x+1\in \{1,3\}\}=\{0\}$

A: It is generally true that if $f:A\rightarrow B$ and $S\subset B$, then
$$f^{-1}(S)=\bigcup_{s\in S}f^{-1}(s)$$
and
$$b\in B\setminus f(A)\implies f^{-1}(b)=\varnothing.$$
So, as you have correctly stated,
$$ f^{-1}(\{1,3\})=f^{-1}(1)\cup f^{-1}(3)=\{0\}\cup\varnothing =\boxed{\{0\}}.$$


text:
Q: In C++ how can we define a static const within a class that computes size of class member variables? Does not compile:
class A
{
    int m_x;
public:
    static const int SIZE = sizeof(m_x);
};

I want to have A::SIZE equal the size of the member variable m_x. How can we do it?
I am using Visual Studio 2015. Here is the error:
1>c:\users\markk\documents\visual studio 2015\projects\b\b.cpp(10): error C2327: 'A::m_x': is not a type name, static, or enumerator
1>c:\users\markk\documents\visual studio 2015\projects\b\b.cpp(10): error C2065: 'm_x': undeclared identifier

Compilation command line:
/Yu"stdafx.h" /GS /W3 /Zc:wchar_t /ZI /Gm /Od /sdl /Fd"x64\Debug\vc140.pdb" /Zc:inline /fp:precise /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /MDd /Fa"x64\Debug\" /EHsc /nologo /Fo"x64\Debug\" /Fp"x64\Debug\b.pch"

EDIT 1
Thanks to Stargateur. With a slight change it works on VS2015 too:
class A
{
    int m_x;
public:
    static const int SIZE;
};

const int A::SIZE = sizeof(A::m_x);

Turned out easier than I thought.

A: Just read doc
foo.h
#include <cstddef>

class Foo
{
private:
    int bar;
public:
    static size_t const foo;
};

foo.cpp
#include "foo.h"

size_t const Foo::foo = sizeof(Foo::bar);


text:
Q: How to set optimal level distance in qtree when different nodes have very different amount of text? I am really a newbie in tikz (about 12 hrs experience) but I think I need to some hint on this.
I am using tikz-qtree. Some of the nodes can contain more text than others. I set the text width to a value so that a node does not expand too much side-ways.
Then by trial and error, I found a value for level distance such that the edges do not overlap with the content of the nodes.
The problem is that the level distance affects all the levels equally. So this results in some levels having too much empty space between them.
Better to explain by an example. Here is a screen shot of what I have now when I set the  level distance=5cm

You can see in the above, that there is lots of empty space now between top level and the next level, and between the third level and the 4th level. While the distance between the first level and the next one is OK.
If I reduce the value of level distance to 3cm, then I get this problem:

What is the correct way to do this, so that minimum space is wasted between all levels?
I looked around and could not find a way to set the level distance per one level using qtree package. The best I found is this How to change the level distance in tikz-qtree for one level only?  and after reading it few times, can't understand it or what to do.
May be someone here could modify the code below to show me how to do it?
Here is the code I used to generate the above. I did not want to remove things from it to make smaller since it already show the problem.
\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary{trees}
\begin{document}
\tikzset{font=\small,edge from parent fork down,level distance=3cm,
        every node/.style={draw,rectangle,rounded corners,
                           align=center,text width = 100pt }}
\begin{tikzpicture}
    \Tree [.{second order linear partial differential equation}
               [.{elliptic\\No characteristic curves
                          \\diffusion process  reached equilibrium, steady state temperature distribution.
                            Numerically, solved by relaxation methods
                          \\{$A\frac{\partial^{2}u}{\partial x^{2}}+B\frac{\partial^{2}u}{\partial x\partial y}+C\frac{\partial^{2}u}{\partial y^{2}}+D\frac{\partial u}{\partial x}+E\frac{\partial u}{\partial y}+Fu=G$}
                          \\{$B^2-4AC<0$}
                          \\{$A=1,C=1,B=0$}}
                  [.{{$F=0$}\\a function that satisfies Laplace is called harmonic}
                    [.{{$G=0$}\\Laplace in 2D\\{$ \frac{\partial^{2}u}{\partial x^{2}}+  \frac{\partial^{2}u}{\partial y^{2}}=0 $}     } ]
                    [.{{$G=g(x,y)$}\\Poisson in 2D\\{$ \frac{\partial^{2}u}{\partial x^{2}}+  \frac{\partial^{2}u}{\partial y^{2}}=g(x,y) $}} ]
                  ]
                  [.{$F=k^2$}
                    [.{{$G=0$}\\homogeneous Helmholtz\\{$ \frac{\partial^{2}u}{\partial x^{2}}+ \frac{\partial^{2}u}{\partial y^{2}} + k^2 u=0 $}\\eigenvalue equilibrium} ]
                    [.{{$G=g(x,y)$}\\inhomogeneous Helmholtz\\{$ \frac{\partial^{2}u}{\partial x^{2}}+  \frac{\partial^{2}u}{\partial y^{2}} + k^2 u=g(x,y) $}\\steady state oscillation} ]
                  ]
               ]
               [.parabolic ]
               [.hyperbolic ]
          ]

\end{tikzpicture}
\end{document}

A: The fork down path from the regular TikZ trees library interacts in weird ways with tikz-qtree sometimes. I've replaced the fork down path with the method suggested in the tikz-qtree manual and then set individual level distances for each level in the tree.  This gives you a pretty reasonable tree.
\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-qtree}
%\usetikzlibrary{trees}        % not required for this solution
\begin{document}
\tikzset{font=\small,
edge from parent path={(\tikzparentnode.south) -- +(0,-8pt) -| (\tikzchildnode)},
level 1/.style={level distance=2cm},
level 2/.style={level distance=6cm},
level 3/.style={level distance=2cm},
every node/.style={draw,rectangle,rounded corners, align=center,text width = 100pt}
}
\begin{tikzpicture}
    \Tree [.{second order linear partial differential equation}
               [.{elliptic\\No characteristic curves
                          \\diffusion process  reached equilibrium, steady state temperature distribution.
                            Numerically, solved by relaxation methods
                          \\{$A\frac{\partial^{2}u}{\partial x^{2}}+B\frac{\partial^{2}u}{\partial x\partial y}+C\frac{\partial^{2}u}{\partial y^{2}}+D\frac{\partial u}{\partial x}+E\frac{\partial u}{\partial y}+Fu=G$}
                          \\{$B^2-4AC<0$}
                          \\{$A=1,C=1,B=0$}}
                  [.{{$F=0$}\\a function that satisfies Laplace is called harmonic}
                    [.{{$G=0$}\\Laplace in 2D\\{$ \frac{\partial^{2}u}{\partial x^{2}}+  \frac{\partial^{2}u}{\partial y^{2}}=0 $}     } ]
                    [.{{$G=g(x,y)$}\\Poisson in 2D\\{$ \frac{\partial^{2}u}{\partial x^{2}}+  \frac{\partial^{2}u}{\partial y^{2}}=g(x,y) $}} ]
                  ]
                  [.{$F=k^2$}
                    [.{{$G=0$}\\homogeneous Helmholtz\\{$ \frac{\partial^{2}u}{\partial x^{2}}+ \frac{\partial^{2}u}{\partial y^{2}} + k^2 u=0 $}\\eigenvalue equilibrium} ]
                    [.{{$G=g(x,y)$}\\inhomogeneous Helmholtz\\{$ \frac{\partial^{2}u}{\partial x^{2}}+  \frac{\partial^{2}u}{\partial y^{2}} + k^2 u=g(x,y) $}\\steady state oscillation} ]
                  ]
               ]
               [.parabolic ]
               [.hyperbolic ]
          ]

\end{tikzpicture}
\end{document}

Alternatively, you could make the node that has the huge amount of text in it wider by creating a wide node style and applying it to that node. This would allow you to keep the level distances smaller.
For the next image, I added
wide node/.style={text width=200pt}

to the tikzset command, and changed the level 2 distance:
level 2/.style={level distance=4cm}

Then for the large node I added an explicit \node command:
[.\node[wide node]{elliptic\\No characteristic curves ... };

Don't forget that this needs an explicit ; after the node text since it is a regular tikz command.
This produces:


text:
Q: 3D Card Flip: CSS scaling while maintaing image clarity Problem
I fully understand that I cannot take a downsized image, scale it up with CSS, and not have it look blurry.  But I also know I'm going about this wrong, and there is a way to do what I'm wanting.
I want to achieve this exact effect I've created, but without losing the clarity on the second (flipped / backside) card.  I feel like the solution lies somewhere with the initial width/height of the backside card and transform origins, but I can't quite get it there.  What am I doing wrong?
Fiddle
https://jsfiddle.net/a9dpc05t/1/
HTML

CSS
body {
  background-color: black;
  margin:50px 150px;
  font-family:Arial, sans-serif;
}

.cardWrapper{
  width:129px;
  height:200px;
  position:relative;
  float:left;
  cursor:pointer;
}

.cardFace{
  position:absolute;
  width:129px;
  height:200px;
  overflow:hidden;
}

JavaScript
TweenLite.set(".cardWrapper", {
  perspective: 800
});
TweenLite.set(".card", {
  transformStyle: "preserve-3d"
});
TweenLite.set(".back", {
  rotationY: -180
});
TweenLite.set([".back", ".front"], {
  backfaceVisibility: "hidden"
});

$(".cardWrapper").click(
  function() {
    TweenLite.to($(this).find(".card"), 1.2, {
      rotationY: 180,
      scale: 2.48,
      ease: Back.easeOut
    });
  }
);

A: EDIT V2:
Here's another version trying to fix what you specified in the comment.
jsFiddle Version 2

CODE SNIPPET V2:

TweenLite.set(".cardWrapper", {
  perspective: 800
});
TweenLite.set(".card", {
  transformStyle: "preserve-3d"
});
TweenLite.set(".back", {
  rotationY: -180
});
TweenLite.set([".back", ".front"], {
  backfaceVisibility: "hidden"
});

$(".cardWrapper").click(
  function() {
    TweenLite.to($(this).find(".card"), 1.2, {
      rotationY: 180,
      scale: 1,
      ease: Back.easeOut
    });
  }
);
body {
  background-color: black;
  margin: 120px;
  font-family: Arial, sans-serif;
}
.cardWrapper {
  width: 387px;
  height: 600px;
  position: relative;
  float: left;
  cursor: pointer;
}
.cardFace {
  position: absolute;
  width: 387px;
  height: auto;
  overflow: hidden;
}
.cardFace img {
  width: 387px;
}
.card {
  transform: scale(0.248);
}

V1:
The trick is to initially scale the card down, then just apply the scale to 1 on flip.

jsFiddle

CODE SNIPPET:

TweenLite.set(".cardWrapper", {
  perspective: 800
});
TweenLite.set(".card", {
  transformStyle: "preserve-3d"
});
TweenLite.set(".back", {
  rotationY: -180
});
TweenLite.set([".back", ".front"], {
  backfaceVisibility: "hidden"
});

$(".cardWrapper").click(
  function() {
    TweenLite.to($(this).find(".card"), 1.2, {
      rotationY: 180,
      scale: 1,
      ease: Back.easeOut
    });
  }
);
body {
  background-color: black;
  margin: 120px;
  font-family: Arial, sans-serif;
}
.cardWrapper {
  width: 144px;
  height: 220px;
  position: relative;
  float: left;
  cursor: pointer;
}
.cardFace {
  position: absolute;
  width: 432px;
  height: 660px;
  overflow: hidden;
}
.cardFace img {
  width: 432px;
}
.card {
  transform-origin: top right;
  transform: scale(0.248);
}

A: You need to add margin and padding to the div. Also check for the proper size of the divs in the CSS.
For the best layout, margin should be added to .card and padding should be added to .front and .back
I also made a flipping cards layout. Check this out, it may help you. :)
http://codepen.io/aman_d1996/pen/WxJwoo

    <title>Cards</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">

<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>

<link rel="stylesheet" type="text/css" href="style.css">

TILE1

BACK

TILE2

BACK

TILE3

BACK

TILE4

BACK

TILE5

BACK

TILE6

BACK

CSS
body>div>div>div>div>h4 {
    font-family: 'Roboto', sans-serif;
    text-transform: uppercase;
    font-size: 17px;
    font-weight: bolder;
    margin-left: 12px;
    color: white;
}

JS
$(function($) {
    $("#card1").flip({
        axis: 'y',
        trigger: 'click'
    });
    $("#card1").on('click', function(){
        $("#card2").flip(false);
        $("#card3").flip(false);
        $("#card4").flip(false);
        $("#card5").flip(false);
        $("#card6").flip(false);
    });
    $("#card2").flip({
        axis: 'y',
        trigger: 'click'
    });
    $("#card2").on('click', function(){
        $("#card1").flip(false);
        $("#card3").flip(false);
        $("#card4").flip(false);
        $("#card5").flip(false);
        $("#card6").flip(false);
    });
    $("#card3").flip({
        axis: 'x',
        trigger: 'click'
    });
    $("#card3").on('click', function(){
        $("#card2").flip(false);
        $("#card1").flip(false);
        $("#card4").flip(false);
        $("#card5").flip(false);
        $("#card6").flip(false);
    });
    $("#card4").flip({
        axis: 'x',
        trigger: 'click'
    });
    $("#card4").on('click', function(){
        $("#card2").flip(false);
        $("#card3").flip(false);
        $("#card1").flip(false);
        $("#card5").flip(false);
        $("#card6").flip(false);
    });
    $("#card5").flip({
        axis: 'y',
        trigger: 'click'
    });
    $("#card5").on('click', function(){
        $("#card2").flip(false);
        $("#card3").flip(false);
        $("#card4").flip(false);
        $("#card1").flip(false);
        $("#card6").flip(false);
    });
    $("#card6").flip({
        axis: 'y',
        trigger: 'click'
    });
    $("#card6").on('click', function(){
        $("#card2").flip(false);
        $("#card3").flip(false);
        $("#card4").flip(false);
        $("#card5").flip(false);
        $("#card1").flip(false);
    });
});


text:
Q: Bourbon Neat breakpoints aren't calculating properly I'm new to using Bourbon Neat and have a question about how the breakpoints work. In my grid_seeings.scss, I have breakpoints set up like such:
$xsm: new-breakpoint(min-width 300px 4);
$sm: new-breakpoint(min-width 600px 6);
$med: new-breakpoint(min-width 768px 8);
$lg: new-breakpoint(min-width 1024px 10);
$xlg: new-breakpoint(min-width 1200px 12);

The desired result is 4 items total, larger devices 2 rows of 2 each and smaller than larger devices, stacked at 100% width each. Here's my markup:
.grid-items {
    @include outer-container;

    .item {
        width: 100%;

    @include media($lg) {
      @include span-columns(6);
            @include omega(2n);
        }
    }
}

I would expect this to serve the itesms at 100% width until 1024px is hit, then serve each at 6 columns each and removing the margin for every 2nd item. For some reason, however, it's calculating the width at 58%. It has to do with the default columns for each breakpoint, 4, 6, 8, 10, 12. If I set these all to 12, it works. Do I have to define span4 at the smaller breakpoint first instead of just width:100%?

A: Dough, I just realized that my lg breakpoint is using 10 columns so I should be calling 5 for each item instead of 6.


text:
Q: Bootstrap 4 nav-link hover effect I'm trying to put a hover effect targeting the a-links in the navigation bar only (not the forwardslashes).
But I can't seem to access only the a-links, the effect ends up running along the whole navbar instead.
Seems to be a conflict with Bootstrap 4 here.
HTML

            GET MOVE
            <button
                class="navbar-toggler mr-left custom-toggler"
                type="button"
                data-toggle="collapse"
                data-target="#navbarNav"
                aria-controls="navbarNav"
                aria-expanded="false"
                aria-label="Toggle navigation"
            >

            </button>

                        Home / (current)

                        Archive /

                        About /

                        Newsletter /

                        Contact

CSS
.nav-item:after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    border-bottom: 1px solid black;
    transition: 0.4s;
}

.nav-item:hover:after {
    width: 100%;
}

Fiddle here
https://codepen.io/pen/WNNPdxv

A: To solve this issue you should not put separators inside the anchor elements.
Below is an approach which eliminates the extra HTML using the content property.
This is similar to Bootstrap's breadcrumb.
But as you're already familiar, first some cleanup ^^

*

*remove the span separators from nav-links

*use the span for text nodes (could be handy to put the animation on there)

*move the animation from :after to :before (a separator is logically after an element, except for the last-child perhaps, this also gives you the elements width where you can now control the right position.)

*use the :after for the separator

*provide full width for the main navigation and use flexbox to align the space it's using (flex-end, center, space-between, ...)

HTML changes

                Home
                (current)

            Archive

            About

            Newsletter

            Contact

Solution
Now to solve the issue, place the animation on before and separator on the after pseudo elements.
.navbar-primary .nav-item:after {
    content: "/";
    position: absolute;
    top: 0.25rem;
    left: auto;
    right: -0.5rem; /* control the amount of space for the separator */
}

.navbar-primary .nav-item:before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    border-bottom: 1px solid black;
    transition: 0.4s;
}

.navbar-primary .nav-item:hover:before {
    width: 100%;
}

In case you want to change the character, you have only one editing place.
DEMO
In case you want to change the animation without the padding I'd suggest to distract the nav-link padding using calc().
.navbar-primary .nav-link:before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0.5rem; /* nav-link padding-left */
    width: 0%;
    border-bottom: 1px solid black;
    transition: 0.4s;
}

.navbar-primary .nav-link:hover:before {
    width: calc(100% - 1rem); /* minus nav-link padding left and right */
}

DEMO

A: You should put the hover on the a-link, and then a-link position:relative, or put the class position-relative to the a-link.
.nav-item a {
    position: relative;
}
.nav-item a:after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    border-bottom: 1px solid black;
    transition: 0.4s;
}

.nav-item a:hover:after {
    width: 100%;
}


text:
Q: Send some data to server and Fetch it A specific client (The Teacher) is supposed to send some data to the server and others clients (Students) should be able to get those data messages. um... Maybe think of it as a Text Messenger.

The data is just some simple text, no big stuff going on.
I want to know what's the best approach to do this ? I looked into WCF and it seems complicated. Tried some demo files and couldn't manage to get it work.
I also know PHP/Mysql. Does it make sense to insert those data into a mysql table ? I don't think it would be a good idea. It won't be any close to real-time speed.
EDIT : The Application is in windows forms (C# lang) and Server application/service can by anything.
I am not sure about the server side. So i can be a linux webserver (php&mysql) or a windows based application as well.
EDIT 2 : I have no experience with ASP.NET and I don't know to code or make ASP applications.

A: Check out ASP.NET SignalR. Either that or use Sockets/WCF.

A: Well, If you say it should be some kind of Text Messenger paradigm I'm still not sure what's the role of server? Logging? Auth?
Anyway this article would be a good start I guess. Pay attention to pros and cons.


text:
Q: functional way of updating a complex JSON object with setState in React I have This structure data That I received in JSON: (I'm can't modify it for it's not me that works on the API) and I have to update the JSON file with the modification made by the user.
{
    "id": 1269,
    "name": "Fet",
    "firstname": "Boba",
    "contacts": [
        {
            "id": 2,
            "name": "Ema Tal",
        }
    ]
}

I get the JSON and put it in a localStorage, then I update the localStorage et return te JSON to the api for UPDATE.
const [user, setUser] = useState();

const handleChange = (e) => {
        setUser(prev => ({
          ...prev, contacts: [
            { ...prev, name: e.target.value }
          ]
        }))
}

I can't seem to figure out the way it output it in the same order and only replacing data without adding a new contact on each typo.
the problem I have is that every time I update the file, it replace the NAME that is not in Contacts or it create new contacts in contatcs
example of replace the name NOT in contacts
  {
    "id": 1269,
    "name": "Ema tal", <-- same not good
    "firstname": "Boba",
    "contacts": [
        {
            "id": 2,
            "name": "Ema Tal", <-- same not good
        }
    ]
}

and an example of what I meen by creating new contacts in contacts (that is not good either)
{
    "id": 1269,
    "name": "Fet",
    "firstname": "Boba",
    "contacts": [
        {
            "id": 2,
            "name": "Ema Tal",
        },
         "contacts": [
         {
            "id": 2,
            "name": "Ema Tal 2",
          }
    ]
    ]
}

I need the data to update exacly like this (the same way it come in.)
{
    "id": 1269,
    "name": "Fet",
    "firstname": "Boba",
    "contacts": [
        {
            "id": 2,
            "name": "Ema Tal updated",
        }
    ]
}

A: If this can help someone else, I found what works for me, and your input helps me find the solution.
Since I have an object that contains an array of other objects I needed a map in there like this.
newValues = user['contacts'].map(section => {
    return ({ ...section, ['name']: e.target.value })
})

setUser(prev => ({
    ...prev, contacts:
        newValues
}));

A: In the contacts part of the new object, you need to spread only the original contacts part and not the whole prev state.

const handleChange = (e) => {
  setUser(prev => ({
    ...prev,
    contacts: [{
      ...prev.contacts, // you need the .contacts here
      name: e.target.value
    }]
  }))
}


text:
Q:  not 'catching' an error I've got an image processing CFC to handle uploaded images. In the method, I'm creating an new image of the uploaded file with ImageNew() and then resizing it if needed (along with some other validation to make sure it's an image). Here's a snippet of the code:
<cftry>
        <cfset ImageScaleToFit(#local.uploadedImage#, 72, "", "highestPerformance")>
        <cfimage action="write" source="#local.uploadedImage#" destination="#local.newThumbName#" overwrite="yes" >
        <cfcatch type="any">
            <cfset local.response['catcher'] = #cfcatch.Detail#>
            <cfset local.response['success'] = false>
            <cfreturn local.response>
        </cfcatch>
    </cftry>

After I upoloaded the code to the production server it began throwing an error because "highestPerformance" isn't an available option for image compression on the production server.
As a backup for <cftry> exception handling I have the Application.cfc send me an email of the details while masking the errors from the user in the event the 'try' doesn't cathc the error.
Throughout the CFC the <cftry> catches the error and sends it back to my page. where it gets output to the console.
My question is, why does this particular block of code not work with <cftry> and the error gets sent directly to the exception handling in my Application.CFC?
Is there some sort of "error threshold" that my built-in exception handling can't handle?
BTW, "highPerformance" works for some reason  even though the documentation at Adobe says "highestPerformance" is an available option...
EDIT:
Here's the error I'm getting from the Application.cfc
Could not initialize class javax.media.jai.JAI
And the stack trace:
ava.lang.NoClassDefFoundError: Could not initialize class javax.media.jai.JAI at coldfusion.image.Image.resizeImageWithJAI(Image.java:1189) at coldfusion.image.Image.resize(Image.java:1119) at coldfusion.image.Image.scaleToFit(Image.java:974) at coldfusion.image.Image.scaleToFit(Image.java:959) at coldfusion.runtime.CFPage.ImageScaleToFit(CFPage.java:6189) at cfspecials2ecfc103515531$funcUPLOADFILEXHR.runFunction(C:\cfc\thecfc.cfc:143) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:418) at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:360) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:324) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:59) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:277) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:192) at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2471) at cfspecials2ecfc103515531$funcMULTIUPLOAD.runFunction(C:\cfc\thecfc.cfc:32) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:418) at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:360) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:324) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:59) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:277) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:463) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:453) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:320) at coldfusion.filter.ComponentFilter.invoke(ComponentFilter.java:183) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:282) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:86) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.xml.rpc.CFCServlet.invoke(CFCServlet.java:138) at coldfusion.xml.rpc.CFCServlet.doPost(CFCServlet.java:289) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) at jrun.servlet.FilterChain.doFilter(FilterChain.java:86) at com.seefusion.Filter.doFilter(Filter.java:49) at com.seefusion.SeeFusion.doFilter(SeeFusion.java:1494) at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at jrun.servlet.FilterChain.service(FilterChain.java:101) at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106) at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286) at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543) at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203) at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320) at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428) at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266) at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

A: If you are using ColdFusion 8 make sure that you have all hotfixes and updates applied.  CF 8 had a lot of major issues with image functions and tags, and if Java is causing the error underneath CF might not be able to catch it.  Even if you aren't on CF 8 make sure that everything is updated.

A: The catch fails because the call to ImageScaleToFit() crashes the JVM. It sounds like your production sever is either missing the Java Advanced Imaging API (javax.media.jai.JAI) or it is not included in the classpath.


text:
Q: Find specific directory and have it as working directory I have no problem to find the subdirectory I want with:
find /media/USBdrive/ -type d -mtime 1

From there I need to get this subdirectory (of snapshots) as working directory from where I will run the command mencodex... to create my video.
I tried -exec cd {} /;.... and a lot of other things but no avail
I am lost here
thank you for your help
My purpose further is to create a script but first I need to check the command

A: Try this:
cd $(find /media/USBdrive/ -type d -mtime 1)

Or, more properly, as Glenn suggests with double quotes to handle spaces in your target directory name.
By the way... when you run "find ... -exec xyz", it creates a subshell and runs your command (i.e. xyz) in that subshell till it exits and then it runs another subshell for the next file it finds that matches your search. So when you run "find ... -exec cd somewhere". it does actually cd to that directory, but it then exits. If you really wanted to, you could put all the commands you want in a new script, called say "DoEverything" and run like this:
find ... -exec DoEverything {} \;

but that would involve another script, and the way Glenn and I suggested is cleaner.

A: You have to execute the cd command in your current shell: changing directories in a subshell or a script will not affect your current shell:
cd "$(find /media/USBdrive/ -type d -mtime 1)"


text:
Q: Best way to create properties in ExtJS4? I'm wondering how to incorporate a more traditional property class into ExtJS 4's dynamic loading?  In Ext3, I would create a set of properties as follows:
org.config.appName = "appname";
org.config.browser = {};
org.config.browser.Browsers = [
    {
        name: 'Chrome',
        ....
    }
];

Imagine also that I would have created a set of extended objects under org:
org.foo = Ext.extend('Ext.Panel', {
    ...
});

In Ext4, when I load the properties, org has not been created and so throws an error.  This leaves me with, I believe, two ways to fix the problem:

*

*Define org:  if(typeof org === 'undefined') { org = {}; }

*Dynamically load the properties as a singleton:
Ext.define('org.config',{
    singleton: true,
    appName: "appname",
    browser: {
        Browsers: [
            {
                name: 'Chrome',
                ...
            },
            ...
        ]
    }
});

How would option 1 affect the dynamically loaded objects?  Is option 2 the best way to create a set of properties?  Am I missing a third, better option?  Appreciate the assistance!

A: Option 2 should work just fine for you.
Regardless of Ext versions JavaScript won't let you create your "namespaces" objects without first creating the root object and so on. Ext had namespace function that was used to create one for your overall app. Since 4.0 use Ext.application to setup your namespace and Ext.define to create name-spaced classes.
I am not quite clear what you mean by dynamically loaded objects ...


text:
Q: Comprehending output from mediation analysis in R I'm trying to get my head around the mediation package in R, using the vignette for the package.
I'm struggling to understand the output of the mediate() function.
require("mediation")
require("sandwich")
data("framing")
med.fit <- lm(emo ~ treat + age + educ + gender + income, data = framing)
out.fit <- glm(cong_mesg ~ emo + treat + age + educ + gender + income,
               data = framing, family = binomial("probit"))
summary(out.fit)
# OR for sending a message to a senator for treated compared to untreated.
exp(as.numeric(coef(out.fit)[3]))

# mediation
med.out <- mediate(med.fit, out.fit, treat = "treat", mediator = "emo",
                   robustSE = TRUE, sims = 100)
summary(med.out)
...

                         Estimate 95% CI Lower 95% CI Upper p-value
ACME (control)             0.0802       0.0335       0.1300    0.00
ACME (treated)             0.0808       0.0365       0.1311    0.00
ADE (control)              0.0142      -0.1030       0.1325    0.78
ADE (treated)              0.0147      -0.1137       0.1403    0.78
Total Effect               0.0949      -0.0316       0.2129    0.14
Prop. Mediated (control)   0.7621      -2.0926       4.9490    0.14
Prop. Mediated (treated)   0.7842      -1.9272       4.6916    0.14
ACME (average)             0.0805       0.0350       0.1304    0.00
ADE (average)              0.0145      -0.1087       0.1364    0.78
Prop. Mediated (average)   0.7731      -2.0099       4.8203    0.14
...

Does this mean that 8.08 % of the effect of treatment is mediated through emotional state, among those that are treated? Or is this a change in the coefficient of treat?
If someone could explain the output it would be much appreciated.

A: What does it mean that ACME (treated) is 0.0808?
0.0808 is the estimated average increase in the dependent variable among the treatment group that arrives as a result of the mediators rather than 'directly' from the treatment.
The dependent variable in this example is the probability of sending a message to a congress member, the mediator is the emotional response generated by the treatment, and the treatment is a framing manipulation.  So this number means that of the estimated 0.0949 (the Total Effect) increase in this probability due to framing, an estimated 0.0805 (ACME (average)) is as a result of the emotional changes generated by the framing and the remaining 0.0145 (ADE (average)) is from framing itself.
In short Total Effect = ACME (average) + ADE (average)
However, there is no reason that the average mediation effect (ACME) is the same for people in the treatment group and people in the control, so two mediation effects are estimated: ACME (control) and ACME (treated), which is your 0.0808.  The average of these average treatment effects is ACME (average) (which is a bit confusing, I admit).  A similar argument holds for the direct effects.
The assumption that there is only one mediation effect and one direct effect in this population is called 'no interference' in the the authors of the package.
It's helpful when interpreting the output to bear in mind the definitions in the accompanying papers and push your ordinary understanding of regression tables into the background a little bit.
One last thing: the proportion of the causal effect of framing that is mediated by emotional response rather than direct would normally be calculated as something like ACME (average) / Total Effect, but here it is not (quite).  Some discussion of how to compute this quantity for models where the dependent variable is discrete, as it is here, appears in Appendix G of Imai et al. 2010.


text:
Q: app.js:1 Uncaught SyntaxError: Cannot use import statement outside a module import axios from 'axios';
let addToCart = document.querySelectorAll('#add-to-cart');

// post requesta with fetch data
function updateCart(food){
axios.post('/update-cart',food).then(res =>{
    console.log(res);
});
}

addToCart.forEach((btn) =>{
btn.addEventListener('click',(e)=>{
e.preventDefault();
 let food= JSON.parse(btn.dataset.food);
 updateCart(food)

})
})

when i fix my package.json file by "type": "module" then the eror like "require is not defined"....


text:
Q: DROP CONSTRAINT is not able to find constraint I try to drop a constraint:
USE `mydb`;

BEGIN;
ALTER TABLE `mydb` DROP CONSTRAINT `myconstraint`;
COMMIT;

And it replies with:
ERROR 1091 (42000) at line 6: Can't DROP CONSTRAINT `myconstraint`; check that it exists

But the constraint exists:
MariaDB [(mydb)]> select * from information_schema.table_constraints WHERE table_name = 'mytable';
+--------------------+-------------------+---------------------------------------------------------------+--------------+-----------------+-----------------+
| CONSTRAINT_CATALOG | CONSTRAINT_SCHEMA | CONSTRAINT_NAME                                               | TABLE_SCHEMA | TABLE_NAME      | CONSTRAINT_TYPE |
+--------------------+-------------------+---------------------------------------------------------------+--------------+-----------------+-----------------+
| def                | mydb              | PRIMARY                                                       | mydb         | mytable         | PRIMARY KEY     |
| def                | mydb              | name                                                          | mydb         | mytable         | UNIQUE          |
| def                | mydb              | myconstraint                                                  | mydb         | mytable         | FOREIGN KEY     |
+--------------------+-------------------+---------------------------------------------------------------+--------------+-----------------+-----------------+

What am I doing wrong?

A: The problem is that MariaDB (MySql?) does not allow to remove foreign key constraints with the syntax DROP CONSTRAINT. It must be dropped like this:
ALTER TABLE `mytable` DROP FOREIGN KEY `myconstraint`;

A: I think you are confusing "schema" (aka "database") and "table"):  ALTER TABLE mytable ...

A: This issue is documented in https://jira.mariadb.org/browse/MDEV-17599. It was fixed in version 10.2.22 and 10.3.13 (11-02-2019).
I sugest update MariaDB version or, like @volingas wrote, the sintax:
ALTER TABLE `mytable` DROP FOREIGN KEY `myconstraint`;


text:
Q: Parallelogram Area Given a parallelogram with two diagonals 6 cm and 8 cm. And the angle between them is 120 degrees.
Find the length of the sides and the parallelogram area.

BD = 6 cm
AC = 8 cm
(AEB) = 120 degrees
AB = ?
AD = ?
Area of parallelogram = ?

A: Without knowing the parallelogram law Bernard mentioned, you can use the fact that the diagonals bisect each other and solve the triangles with Law of Sines and Law of Cosines.
First, $AB^2 = (AC/2)^2 + (BD/2)^2 - 2(AC/2)(BD/2)\cos 120^{\circ}$, and similarly for $BC$.
Then,
$$\frac{AB}{\sin(\angle AEB)} = \frac{BE}{\sin(\angle BAE)}$$
and similarly for $\angle EAD$.
Then as Andre suggested in the comments, you can drop a perpendicular from $A$ down to the line defined by $CD$.  The height will be $h = AD \cos (\angle EAD + \angle BAE)$ and then your area is $AB \times h$.

A: Area of the Parallelogram = $\frac{1}{2}.d1.d2.\sin \theta$
= $\frac{1}{2}.8.6.\sin120 = 4.6.\frac {\sqrt 3}{2} = 12\sqrt 3$ sq units.
Using cosine formula for finding out the third side, we get,
$$AB^2 = AE^2 + EB^2 - 2.AE.EB.\cos \angle AEB$$
and $$AD^2 = AE^2 + ED^2 - 2.AE.EB.\cos \angle AED$$
Hence, $$AB^2 = 4^2 + 3^2 - 2.4.3.(-\frac{1}{2}) = 16 + 9 + 12 = 37$$
and $$AD^2 = 4^2 + 3^2 - 2.4.3.(\frac{1}{2}) = 16 + 9 - 12 = 13$$
Thus,
length AB = $\sqrt 37$ and length AD = $\sqrt 13$


text:
Q: how to properly insert/update a nested mongodb document using node/express app In my NodeJS/Express app, I have a MongoDB collection "SalesforceData", in which every document has the following structure:
The master record has two fields - OpportunityId and OpportunityName.
Each master record has an array of nested DataCenter records:
{
    OpportunityId: '',
    OpportunityName: '',
    DataCenters: [
         { DataCenterName:'', address:'' },
         { DataCenterName:'', address:'' }
    ]
}

Initially, the Data Center fields were part of the actual Opportunity record. but now, we have a one-to-many between a single opportunity and many data centers.
The following code was working fine for a single record update:
app.post('/salesforce_update', function(req, res){
        console.log('Salesforce update Request Received');
        console.log('request body:  ' + req.body);

        MongoClient.connect(url, function (err, db) {
            if (err) {
                console.log('Unable to connect to the mongoDB server. Error:', err);
            } else {
                var collection = db.collection('SalesforceData');
                collection.update(
                    {
                        CSCOpportunityID:  req.body.opportunityId
                    },
                    {$set:
                    {
                        kwFY16: req.body.kwRequired_2016,
                        kwFY17: req.body.kwRequired_2017,
                        kwFY18: req.body.kwRequired_2018,
                        kwFY19: req.body.kwRequired_2019,
                        kwFY20: req.body.kwRequired_2020,
                        kwFY21: req.body.kwRequired_2021,
                        kwFY22: req.body.kwRequired_2022,
                        kwFY23: req.body.kwRequired_2023,
                        kwFY24: req.body.kwRequired_2024,
                        kwFY25: req.body.kwRequired_2025,

                        cbFY16: req.body.cbRequired_2016,
                        cbFY17: req.body.cbRequired_2017,
                        cbFY18: req.body.cbRequired_2018,
                        cbFY19: req.body.cbRequired_2019,
                        cbFY20: req.body.cbRequired_2020,
                        cbFY21: req.body.cbRequired_2021,
                        cbFY22: req.body.cbRequired_2022,
                        cbFY23: req.body.cbRequired_2023,
                        cbFY24: req.body.cbRequired_2024,
                        cbFY25: req.body.cbRequired_2025,

                        DCCountry: req.body.dcCountry,
                        DCSiteCode: req.body.dcSiteCode,
                        DCSKU: req.body.dcSku
                    }

                    },
                        {upsert:true},
                    function(err, result){
                    if(err){
                        console.log('err:  ' + err);
                    }
                        else{
                        console.log('update result:  ' + result);
                        res.send(201);
                    }
                });
            }

How could I modify this code to allow for inserts/updates of Data Center sub-records?
The unique combination of an opportunity and a data center would be OpportunityId along with DataCenterName.

A: by doing some trial and error, I ended up with a solution, in which I first determine whether a given sub-document is present in the main document's array of sub-documents.
Then, depending on the result, I either add a new sub-document to that array, or update an existing one.
Here is the complete gist:  https://gist.github.com/eugene-goldberg/ee694ee7ee6121fbec46


text:
Q: Is it possible to compile Linux kernel with something other than gcc I wonder if someone managed to compile the Linux kernel with some other compiler than gcc. Or if someone have ever tried? Question may seem to be silly or academic, but it arose when I thought about answers to: Are C++ int operations atomic on the mips architecture
It seems that the atomicity of some operations depends not only on the cpu architecture, but also on used compiler. So, I wonder if in Linux world some compiler other than gcc even exists.

A: The LLVM developers are trying to compile it with clang. The meta-bug on compiling the Linux kernel with clang has more details (the dependency tree for that meta-bug shows how little seems to be left).

A: There have been some efforts (and patches) to compile an early version of the 2.6 kernel with icc.

A: Yup. I've done this. See [cfe-dev] Clang builds a working Linux Kernel (Boots to RL5 with SMP, networking and X, self hosts).

A: IBM's compiler was able to do it some Linux versions ago, but I'm not sure about now, nor am I sure of how well IBM optimized the kernel as instructed. All I know is, they got it to build.
As Linux is self hosting (with its own libc) and has been developed from the start with gcc (and gcc cross compilers), its sort of silly to use anything else.
I think mainly, playing nice with preprocessor macros and instructed optimizations is the biggest obstacle (not even getting into a departure from gas), as GNU has basically written the book on the above, and extended it. Beyond that, Linux tunes its optimizations to work with gcc, for instance, don't get caught using 'volatile' in the kernel without a damn good reason. Using inline and actually having the compiler agree is another challenge.
Linus is the first one to call GCC an &*#$ hole, which makes for a better compiler.
This is why we have the great GNU/Linux debate.

A: Many, many, many years ago, it was actually possible to compile the kernel with g++, and as far as I remember part of the motivation was because C++ had stronger type check, not necessarily to have g++ to produce object files. But as Neil Butterworth have pointed out, Linus is not particular fond of C++, and there is zero chance that this ever will be possible again.

A: Linux explicitly depends on some gcc extensions, so any other compiler must be compatible with the needed extensions, in that case.
This is not a "no", since it's of course not impossible for a separate compiler vendor/developer to track gcc's extensions, just a data point that might help you search.

A: At some point tcc would process and run the linux kernel source. SO that would be a yes, I guess.
::Hat tip to ephemient in the comments.::

A: EKOPath 4 Compiler, not now. but probably with some minor patches
https://github.com/path64/repositories
http://www.pathscale.com/ekopath-compiler-suite

A: I am just now working on compile Linux kernel using Open64 for MIPS archtecture, and some other guys are now just working for make Open64 can build for X86 arch. Now the kernel can partly run, and still have Run fail errors.
However for the atomic problem, at least i have not come up with it. And I do not think it is really a problem.The reasons are:

*

*The Linux kernel have already been a collection of source code, which can successfully build with GCC, so it is only the compiler's problem if it can not build it, or the built kernel runs fail.

*If a compiler want to successfully build Linux kernel, it should obide the GNU C Extension, and this extension will give a clear discription of what a atomic operation is, so such a compile only need to generate code according to this extension.

A: My non-technical guess: The Linux Kernel can't currently (2009) be compiled with any compiler other than the GNU compiler, gcc.
I say this on the basis that I've heard Richard Stallman, with some conviction, say Linux should be called GNU/Linux because the kernel is "only 1 part of the operating system" and I'm guessing he would not be able to say this if the kernel was non-dependant on GNU (e.g. a tonne of embedded devices run a Linux OS without any GNU software).
As I said, just a guess, let me know if I'm wrong...


text:
Q: When hover on button1 show button2 I try to use a CSS-Solution to show other buttons when hover a special button.
The HTML-code is this.

  <button type="button" name="add_wishlist"></button>
  <button type="button" name="add_cart"></button>
  <button type="button" name="add_compare"></button>

The CSS-code looks like this:
.button-group button {
    color              : #999;
    font-family        : 'FontAwesome';
    font-size          : 1rem;
    font-weight        : normal;
    margin             : 0;
    padding            : .500rem 0.875rem;
    background         : #fff;
    display            : inline-block;
    transition         : all 0.3s linear;
    -moz-transition    : all 0.3s linear;
    -webkit-transition : all 0.3s linear;
    opacity            : 0;
}

.button-group button[name="add_cart"] {
  opacity : 1;
}

My idea with
.button-group button[name="add_cart"]:hover + .button-group button[name="add_compare"] {
  opacity : 1;
}

doesn't work.
How the CSS should look like to show the two other buttons on hover the button "add_cart"?

A: You could achieve this only for the third button "add_compare" as it is "after" the "add_cart" button using something like this (assuming you give them ID add_cart and add_compare):
 #add_cart:hover + #add_compare {
           opacity:1;
    }

But for first button it can't be done using pure CSS as far as I know. You would need to use Javascript for that.


text:
Q: Delete all
* and  tags inside ul class I would like to delete all
 and
 tags inside ul class in notepad++
here is example:

to achieve this:

A: I think this will solve my problem:
Serach for

*

*((?-s)<ul.+test(?s).+?)
 and

*((?-s)<ul.+test(?s).+?)

replace it by \1


text:
Q: How to send an email when a NodeJS script exits? I tried to catch the exit event and send an email, but the docu says:

Listener functions must only perform synchronous operations.

Usually I use Nodemailer to send emails, but Nodemailer does not support synchronous operations. Any idea how to do this?


text:
Q: Need Help in Rendering Dynamic Component in Vue js hi there i have the following situation .
I have parent component (Health Profile) that lists child subcomponents with add button on each . I want to make the application such a way that when user clicks on add button only form to that specific component opens up and rest are closed and vice versa . I m unable to make use of v-bind:is  because the button is in the subcomponent and it emits the data to parent component.
Any help will be appreciated .attached the screenshot   Health Profile Component with each subcomponent having button that fires emmit data type

A: Please next time provide a code snippet to better understand your code
You can use an event bus to propagate the button click throughout the project.
// event-bus.js
import Vue from 'vue';
const EventBus = new Vue();
export default EventBus;

Then import this in your component
// component-a.js
import Vue from 'vue';
import EventBus from './event-bus';
Vue.component('component-a', {
...
methods: {
  emitMethod () {
    EventBus.$emit('EVENT_NAME', payLoad);
  }
}
});

Check out this article


text:
Q: Can I get EventAggregator Subscribe Message without view, viewmodel in prism? I'm trying to make a module in a prism project. The module doesn't have UI(View, ViewModel). I want the module has working EventAggregator event handlers.
Is there any way?

A:
I wonder it is possible to make service module without view, viewmodels?

Of course, it is. A module is just a late-bound, post-deployment-exchangeable collection of code. It can contain anything, be it views, view models, services, dtos...

I want the module has working EventAggregator event handlers.

... most of those can have dependencies injected because they're resolved from the container. I.e. they can use the event aggregator.
If you have services that are "on their own" (i.e. like a windows service, but in-process) or that need to be initialized early, you can resolve the service in OnInitialized and start it/initialize it.


text:
Q: Accessing dynamically generated content in jquery I've just recently learned how jquery can access dynamically generated content, by placing a "bubble" around its parent object (or first available parent that is not dynamic), and then telling it how to handle an event from within it etc.
I have a table (static) and rows are dynamically added.

    Current User Calls

and the code that adds the rows:
function clicky() {
    var table = document.getElementById("tblEveryone");
    var tmpRowCount = table.rows.length;

    //clear existing rows first (else it just appends)
    for (var x = 2; x < tmpRowCount; x++) {
        table.deleteRow(x);
        tmpRowCount--;
        x--;
    }

    jQuery.each(users, function (index, user) {
        var rowCount = table.rows.length;
        var row = table.insertRow(rowCount);
        row.style.display = "none"; <--------
        row.setAttribute('class', 'BeforeHover_Clean');

        var cell1 = row.insertCell(0);
        cell1.innerHTML = users[index].Name;

        var cell2 = row.insertCell(1);
        cell2.innerHTML = users[index].Calls;
    });

    $(".BeforeHover_Clean").show(); <-----
}

then the code i use to "bind" click events on each row
$(document).ready(function () {
  $('#tblEveryone').delegate(".BeforeHover_Clean", "click", function () {
    var whatClicked = this.innerHTML.toLowerCase().split("	")[0].split("")[1];
    document.getElementById("aIframe").src = "Calls.aspx?aUser=" + whatClicked;
   });
});

The thing is (line marked with <---- above, second block), row.style.display, correctly starts off the items with none as visibility, but the last line, $(".BeforeHover_Clean").show(); obviously wont work as the content is dynamic. Is there a way to manipulate the delegate, or some other jquery feature, to set the items visible again when needed?
I am clueless at this level. Binding "click" events to the parent is as good as i got! lol. I feel like charles babbage now! ;)

A: The fact that it is dynamic shouldn't matter.
You hae a rather strange mix of jQuery and DOM JavaScript whjich probably isn't helping, and is also bloating your code substantially.
For example, your each loop can be condensed as follows:
jQuery.each(users, function (index, user) {
    var $newRow = $("
" + users[index].Name+ "	" + users[index].Calls + "
").hide();
    $("#tblEveryone").find('tbody').append($newRow);
});

Try using the ID selector $("#myid"); instead of document.getElementById(); and also playing around with some of the jQuery DOM manipulation methods, append(), prepend(), insertAfter(), etc.
Not a specific answer to your question, but hopefully some helpful guidelines.


text:
Q: Two exact copies of folder using FTP I'm looking for any solution that will allow me under Windows to emulate functionallity similar to Dropbox or rsync using FTP protocol only.
What I need, is any piece of software (good enough in your opinion) that I will be able to run periodically and that will assure that source and destination are identical:

*

*all files on both sides copied to both sides,

*if two files of the same name exists, copy newest version of a file to both sides,

*delete on one side all files that are missing on another one.

Of course, this software must support iteration on all subfolders of both source and destination, for this to work succesfully -- there will be a large directory structure on both sides.
I've tried many backups solutions, but most of them failed, because being unable to create exact duplicate copy of both sides and offering incremental backup instead. For long time a Cobian Backup was on under my cosideration, but either I can't configure it correctly or it fails completely on re-creating destination on source (i.e. provides one-way backup only, without any way to have two exact duplicates).
I was advised to use Unison and give it a good try. This really looks good, but it uses SSH. I have a real trouble estabilishing SSH from my Windows computer to one of destinations (cygwin port failed to many times) and beside this, one of my destinations does not support SSH at all -- i.e. FTP access is the only available way.
The perfect solution for me would be something that I can run (command-line or  configuration) like this:
something.exe path/to/local/folder ftp://user:pass@111.11.11.1/path/to/folder

If it does exists at all...

A: I found the windows version of lftp to work.

*

*Download lftp from http://redpark.posterous.com/lftp-for-windows

*Unzip in a directory

*Run from the command line lftp -c "open ftp://user:pass@your.ftp.com;your mirror ftp steps in here"
See this copied mirror example from a serverfault answer:
lftp -c "set ftp:list-options -a;
open ftp://user:password@your.ftp.com;
lcd ./web;
cd /web/public_html;
mirror --reverse --delete --use-cache --verbose --allow-chown
--allow-suid --no-umask --parallel=2 --exclude-glob .svn"

For some reason the multiline did not work on my Windows 7 cmd.exe, had to make it a single line to execute correctly.
For more information on the mirror options, start the lftp.exe from the command line and type mirror help


text:
Q: Trying to parse a "txt" file to a dictionary, in the last line it always return a "ValueError: not enough values to unpack (expected 2, got 1)" tabela={}

def initiate():
    """initiate the file"""
    with open("file.txt") as f:
        for line in f:
            (key, val) = line.split(":")
            tabela[key] = int(val)
initiate()

"file.txt"
test1:123
test2:456
test3:789
test4:951
test5:357

A: Consider to add some check conditions like:
def initiate():
    """initiate the file"""
    with open("file.txt") as f:
        for line in f:
            if line and ":" in line:    # <= check conditions
                (key, val) = line.split(":")
                tabela[key] = int(val)


text:
Q: Ignoring the property from a CSS class Hi I am trying to implement RTL in my website. I have a check box like this in CSS
.labeled-checkbox .checkbox {
  position: absolute;
  top: 0px;
  right: 0px;
  margin-top: -1px;
}

In case of RTL language a class will be added dynamically to the html file and a new style will be added to CSS as below.
.locale-right-to-left .labeled-checkbox .checkbox {
  position: absolute;
  top: 0px;
  left: 0px;
  margin-top: -1px;
}

Now in this case check box should be moved to the left most direction . But its not happening as both the left and right property are added to the  check box. Is there any way we can ignore the right:0px and only left:0px can be used in case of RTL languages?

A: Add right: auto; to your RTL class
   .locale-right-to-left .labeled-checkbox .checkbox {
      position: absolute;
      top: 0px;
      left: 0px;
      right: auto;
      margin-top: -1px;
    }

A: Use right: auto in your .locale-right-to-left .labeled-checkbox .checkbox styles to override the right rule
https://developer.mozilla.org/en-US/docs/Web/CSS/right

A: If you add a css class dynamically, you can also remove one. So add a class locale-left-to-right as default so then you can write the following:
.locale-left-to-right .labeled-checkbox .checkbox {
    position: absolute;
    top: 0px;
    right: 0px;
    margin-top: -1px;
}


text:
Q: Native query - how retrive only specific colums from DB for Entity In my DB I nave a table Subject with columns
id (long)
name (String)
ifActive (0 or 1)
text (very long String)

In my web page I must display list of names of Active Subjects. So I declare the following native query in xml file:
<sql-result-set-mapping name="SubjectResult">
    <entity-result entity-class="com.test.Subject">
        <field-result name="id" column="id"/>
        <field-result name="name" column="name"/>
        <field-result name="ifActive" column="ifActive"/>
        <field-result name="text" column="text"/>
    </entity-result>
</sql-result-set-mapping>

<entity class= "com.test.Subject" name= "Subject">
    <named-native-query name="findAllActiveSubject"
                        result-set-mapping="SubjectResult">
        <query>
            select
                *
            from
                Subject
            where
                ifActive = 1
        </query>
    </named-native-query>
</entity>

And it works fine - I get list of Subject objects and I can form list of names of Active Subjects.
But this is the problem: text in text column is very long and I don't really need to retrive it from DB to form list of names of Active Subjects - I really need only the names of Subjects.
So I change SQL query to following:
<sql-result-set-mapping name="SubjectResult">
    <entity-result entity-class="com.test.Subject">
        <field-result name="id" column="id"/>
        <field-result name="name" column="name"/>
        <field-result name="ifActive" column="ifActive"/>
        <field-result name="text" column="text"/>
    </entity-result>
</sql-result-set-mapping>

<entity class= "com.test.Subject" name= "Subject">
    <named-native-query name="findAllActiveSubject"
                        result-set-mapping="SubjectResult">
        <query>
            select
                name
            from
                Subject
            where
                ifActive = 1
        </query>
    </named-native-query>
</entity>

I get exception
org.hibernate.exception.GenericJDBCException: could not execute query

with the root cause
com.microsoft.sqlserver.jdbc.SQLServerException: The column name id is not valid

So I try to change result set to following:
<sql-result-set-mapping name="SubjectResult">
    <entity-result entity-class="com.test.Subject">
        <field-result name="name" column="name"/>
    </entity-result>
</sql-result-set-mapping>

<entity class= "com.test.Subject" name= "Subject">
    <named-native-query name="findAllActiveSubject"
                        result-set-mapping="SubjectResult">
        <query>
            select
                name
            from
                Subject
            where
                ifActive = 1
        </query>
    </named-native-query>
</entity>

And I get exception
org.hibernate.exception.GenericJDBCException: could not execute query

with the very strange root cause
com.microsoft.sqlserver.jdbc.SQLServerException: The column name id1_5_0_ is not valid

So..
I can't retrive only several of colums from DB and form Subject only with them? It is ok for me if the rest of properties of Subject would be null - I want to work exactly with Subject and not with list of values or list of arrays of values or something like that.

A: You could use a specific constructor whith HQL
Create the contructor in Subject.java
...
public Subject() {
}

public Subject(String name) {
    this.name = name;
}
...

The query for the select should be
select new Subject(s.name) from Subject s where s.ifActive=1


text:
Q: How to get specified string in a text I want to get a string from a text (it is a HTML text).
How can I get the email address(n.surname@examplemail.com) and the body (Your message has been delivered to the following recipients:) from the text bellow?

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Your message has been delivered to the following recipients:

Name Surname(n.surname@examplemail.com)

Subject: test

A: Assuming your HTML is valid (the example you pasted is not so if it's exactly what you got from the app you'll have to correct it somehow).
Working on the corrected example  (added  tag, corrected <meta> as per this answer):
[xml]$html = @"

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Your message has been delivered to the following recipients:

Name Surname(n.surname@examplemail.com)

Subject: test

"@

NOTE: It's usually preferred to work on the text as on XML, instead of string, as you can access objects directly so that's why I convert it using [xml] at the beginning.
If the structure of your file is exactly the same in all cases, you can access the properties you mentioned like this:
$body = $html.html.body.p.b.font.'#text'
$address = $html.html.body.font.p.a.href.replace('mailto:','')

Alternatively, using Select-Xml:
$body = (Select-Xml -Xml $html -XPath '//font' | Where-Object {$_.Node.'#text'}).Node.'#text'
$address = (Select-Xml -Xml $html -XPath '//a').Node.href.replace('mailto:','')

You can also use the following script to correct the structure of your file to be valid HTML:
$toBeCorrected = @"

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Your message has been delivered to the following recipients:

Name Surname(n.surname@examplemail.com)

Subject: test

"@
[xml]$correctHTML = '' + ($toBeCorrected -replace '<meta (.*)>','<meta $1 />')


text:
Q: Setting up Traefik with LE integration - error too many redirects / 302 I've been following the examples for Traefik and LE integration and those on SmartHomeBeginner, though I've been unable to get Traefik to work on the subdomain over https. I can see the backend on the IP address with the port number but that's not ideal.
When I view the HTTPS page in the browser I keep getting ERR_TOO_MANY_REDIRECTS and I've confirmed the fail in Linux doing a simple wget and I get a 302 error and major fail after 20 redirects.
I can't see where I'm going wrong...
####### Docker Compose ##########
version: "3.6"
services:
  traefik:
     image: traefik:1.7.4
     container_name: traefik
     command: --api --docker
     restart: always
     ports:
       - 80:80
       - 443:443
     environment:
       - CLOUDFLARE_EMAIL=${CLOUDFLARE_EMAIL}
       - CLOUDFLARE_API_KEY=${CLOUDFLARE_API_KEY}
     networks:
       - traefik_proxy
     labels:
       - "traefik.enable=true"
       - "traefik.backend=traefik"
       - "traefik.frontend.rule=Host:traefik.${DOMAINNAME}"
       - "traefik.port=8080"
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock
       - ${USERDIR}/docker/traefik/traefik.toml:/traefik.toml
       - ${USERDIR}/docker/traefik/acme/acme.json:/acme.json
       - ${USERDIR}/docker/shared:/shared

###### traefik.toml ######

logLevel = "DEBUG" #DEBUG, INFO, WARN, ERROR, FATAL, PANIC

defaultEntryPoints = ["https","http"]

[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  [entryPoints.https]
  address = ":443"
  [entryPoints.https.tls]

[docker]
endpoint = "unix:///var/run/docker.sock"
watch = true
exposedByDefault = false

[acme]
email = "email"
storage = "/acme.json"
entryPoint = "https"
# remove below line when happy its all working fine - dev LE certs
caServer="https://acme-staging-v02.api.letsencrypt.org/directory"

#create certificate when container is created
[acme.dnsChallenge]
   provider = "cloudflare"
   delayBeforeCheck = 0
[[acme.domains]]
   main = "xxxx.com"
[[acme.domains]]
   main = "*.xxxx.com"

Thanks in advance.

A: I've managed to work out what I was missing, the traefik.toml and docker-compose file were both ok, the only issue was that Cloudflare was set to 'Flexible' but must be set as 'Off' as am trying to utilise the LE certs instead, this then worked. See link for reference: s3 and cloudflare flexible ssl handshakes


text:
Q: Specify a custom git tag with sbt-release Is it possible to specify a git scheme for git tag names with sbt-release?
The tag commit message and comment can be specified. Per the README:

releaseTagComment    := s"Releasing ${(version in ThisBuild).value}",
releaseCommitMessage := s"Setting version to ${(version in ThisBuild).value}",

But I've been unable to find a way to change the default for the actual tag text, which is set to s"v${releaseVersion}".
I'd like to specify the project name in the tag string, e.g., "myproject-v0.1.1"
To clarify, by the "tag string", I mean the string you see in e.g., git tag -l
We have multiple projects in the same git repository, and they have similar version numbers, so tags like "v0.1.0" are ambiguous.

A: there's an sbt-release configuration value releaseTagName which you can modify to customize how release tag is generated.
This is working for me:
lazy val root = (project in file(".")).
  settings(
    .... other settings ....
    releaseTagName := s"version-${if (releaseUseGlobalVersion.value) (version in ThisBuild).value else version.value}",
    ....
    )

If everything else fails you can also customize release steps, and write your own tagRelease step.

A: You can use the custom tag based on your requirement. Here is the approach which I have followed.
Steps

*

*Add the below-given content in build.sbt file. Here if the branch is master then I am using the semantic versioning like: 1.0.1 but if the branch name is other than master then I am using the custom tag(branch-name + git-commitid + timestamp).

import scala.sys.process.Process

lazy val root = (project in file(".")).enablePlugins(JavaAppPackaging)

name := "your-project-name"
scalaVersion := "2.12.11"

val branch = Process("git rev-parse --abbrev-ref HEAD").lineStream.head
version := {
  branch match {
    case "master" => (version in ThisBuild).value
    case _ => {
      val commit = Process("git rev-parse HEAD").lineStream.head
      val time = Process("git log -1 --format=%ct").lineStream.head
      branch +"-"+ commit +"-"+ time
    }
  }
}

*Create a version.sbt file in your project's root directory and add version in ThisBuild := "1.0.1-SNAPSHOT".

*Finally you can use sbt-release or any other plugins to release/publish the artifacts in the repository.


text:
Q: Keychain returned the following status: -34018 My application crashes sometimes on iOS 9 devices, and it is showing the following error.

[FATAL] [WORKLIGHT] Uncaught Exception: Keychain returned the following status: -34018
  2017-01-02 12:37:19.490 FlightCrew[2944:1081505] *** Terminating app due to uncaught exception 'Unable to generate key pair.', reason: 'Keychain returned the following status: -34018'


text:
Q: How can I make this inverse modulo program take in larger numbers? Heres the code:
int gcdExtended(int a, int b, int* x, int* y);

void modInverse(int A, int M)
{
    int x, y;
    int g = gcdExtended(A, M, &x, &y);
    if (g != 1)
        cout << "Inverse doesn't exist";
    else {

        int res = (x % M + M) % M;
        cout << "Modular multiplicative inverse is " << res;
    }
}

int gcdExtended(int a, int b, int* x, int* y)
{

    // Base Case
    if (a == 0) {
        *x = 0, *y = 1;
        return b;
    }

    // To store results of recursive call
    int x1, y1;
    int gcd = gcdExtended(b % a, a, &x1, &y1);

    *x = y1 - (b / a) * x1;
    *y = x1;

    return gcd;
}

I'm not sure how to take in bigger numbers like 15001 (mod 5729413260) without getting overflow. Should I not use recursion? I tried long long but that didn't work, any suggestions?

A: You might change int to long long; if that's not sufficient, then boost::multiprecision might help.


text:
Q: What is the quickest way to convert a React app to React Native? This may be a naive question, but I couldn't find too much information on this topic.
I have a fully functional react-redux application and I would now like to port it to iOS and Android. I have no need to use any native features like GPS or Camera etc. In theory I just want to make a sort of webview that runs the existing React app, and then tweak it until it looks more presentable.
My first attempt was to simply use my current jsbundle file and stick it into the AppDelegate as the jsCodeLocation. That expectably caused all sorts of errors such as "window" not being defined.
I guess my question is: how do people usually manage their native and non-native codebases? Are they completely separate, or is there a way to recycle most of the code?

A: As others have mentioned there's no quick way to convert react to react-native.
A possible alternative if you want your react app to run on a mobile device without rewriting your codebase is to use Cordova.  For fun I ported a react-web app into a mobile app using Cordova in just a few minutes.  There are some drawbacks to this method, but the benefit is that you can have a working mobile app in very little time.
Below are the steps if anyone is interested in a Cordova workaround alternative:
REACT SETUP (done in command line)
>1. npx create-react-app my-app
>2. cd my-app
>3. npm start

DEPLOY TO STATIC:
>1. Update your package.json file from your my-app directory to add "homepage":"." (see below)

  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "homepage":".",
  "dependencies": {

>2. Build (in command line) npm run build

CORDOVA INTEGRATION (in command line)
>1.  cd ../ (change to wherever you want the project created, don't do this inside your existing react app folder)
>2.  npm install -g cordova (only if you already don't have Cordova installed)
>3.  cordova create MyApp
>4.  cd MyApp
>5.  cordova platform add ios //or android or browser

ADD A COUPLE STEPS FOR INCLUDING YOUR REACT PROJECT
>1. Open your Cordova MyApp www folder, delete all files and folders in it except for the 'js' folder
>2. Back in your react build folder update the index file to add two cordova scripts:

>3. copy all your files from the react build folder into the Cordova www folder (replacing everything except the js folder)

BUILD REACT-CORDOVA APP (in command line, inside your Cordova project)
>1. cordova build ios //or android or browser

TEST OR DEPLOY TO STORE ETC.
>1. Use xcode to open open your react-cordova .xcodeproject, this can be found in the MyApp/Platforms/ios/
>2. Select your simulator and run.  Enjoy your new mobile app!

TWEAK
There are some minor tweaks you'll need to do (like remove the tap delay...etc)
-I think this is why people think Cordova apps are slow, but it's an easy fix...

A: For those who searching for a way to code once with react-native and export for Web, Android, and IOS, I suggest Expo.
It suggests building for the web just with this command expo build:web. Here is the full document
And about Webview that you have mentioned, I had made projects for Web and then use Webview to make mobile application of them, but it should be fully responsive and SPA to act as a real application when navigating between pages.
My own examples are:  Web: Mehrg.com Android: Home Design App And another example is vitrinom

A: You cannot just use your whole code into the react native application. First and foremost, you have to follow the react native architecture and then develop your UI using react native components.
https://facebook.github.io/react-native/docs/getting-started.html
You'll get most of the help here.
There is another option also, you can just create a new react-native project and use webview in it and display your whole website there.
https://facebook.github.io/react-native/docs/webview.html

A: Some of the reusable things are styles:
var style = {
     box: {height: 30, width: 30, padding: 10, ect...}
}

Logic such as state :
constructor(props){
 super(props);

 this.state= {text: "hi"};
}

the state can be shared between navite and dom like so
<View>
<Text>this.state.text</Text>
</View>

dom looks like this

this.state.text

You can even share functions but you have to be careful like it was stated above, as long as you're not directly invoking any dom or refs in your logic.
onClick(){
 this.setState({text: "good bye"});
}

A: Updating an answer for 2022: Ionic (although this tech came about in [2013])(https://en.wikipedia.org/wiki/Ionic_(mobile_app_framework))
You can use Ionic!
I am planning on using it for a few of my bootstrapped projects where I would like to prove concept first before doing a full on Native build.
Some pros of Ionic:

*

*Support for React, Angular, Vue

*fast to build and deploy to both iOS and Android

*can be built using browser based technologies i.e. traditional React development

*JS is all you need (I suppose HTML, CSS, etc too)

*plugins for mobile device features such as camera, fingerprint, NFC, geoloc, push notifications, deep links, etc

Cons:

*

*Debugging is hard

*Error messages are vague, which makes Debugging harder

*You need to go through the app on your device in order to debug device specific issues. But this would be necessary for native builds anyways.

*Sometimes builds just crash!

My advice with technologies such as Ionic and Cordova (mentioned by @Paul Schorey) is tread with caution when using these tools live for real users. It is probably best to have plans to go native as soon as you are able to, have the resources, or have the users that necessitates migration.

A: They're usually pretty separate, partly because your render target is different (i.e. no divs) and partly because of things like window not being available. It's possible to reuse code between web and native apps, but only if you're very careful about it.
From the react native release blog post:

It's worth noting that we're not chasing "write once, run anywhere." Different platforms have different looks, feels, and capabilities, and as such, we should still be developing discrete apps for each platform

A: WebViews and React-native are two completely separate concepts. Either you want to go with the former (than you can actually use your application without much hassle), or with the latter. In that case, you could probably re-use some of the business logic, however most of the rendering would have to be rewritten.
React native is learn once, write anywhere, not learn once, write once :)

A: You have to refer the react native structure to actually understand how to convert your react app to your react native app.
To start from scratch I would suggest: https://reactnative.dev/docs/getting-started


text:
Q: How to play an Mp3 file using its Path using Kotlin? I started a project for making a music player.Initially i have Listed all mp3 files using ApI level 29.But i am facing the problem in creating a mediaplayer.Everytime the error is showing is "Found a null Uri"....I have tried this...
      fun getAppExternalFilesDir(): File? {
        return if (Build.VERSION.SDK_INT >= 29) {
            getExternalFilesDir(null)
        } else { // @Deprecated in API 29.
            // /storage/emulated/0
            Environment.getExternalStorageDirectory()
        }
    }
fun ListDir(f: File) {
    var files: Array<File>? = f.listFiles()
    list.clear()
    if (files != null) {
        for (file: File in files) {
            if (file.name.endsWith(".mp3")){
                list.add(Model(file.name))
            }

        }
    }
    listview.setOnItemClickListener { parent:AdapterView<*>, view:View, position:Int, id:Long ->
        if (position>=0) {
            var textcopy: TextView = view.findViewById(R.id.foldername)
            var namecopied: String = textcopy.text.toString()
            mediaplayer = MediaPlayer()
            var uri: Uri = Uri.parse((getAppExternalFilesDir().toString() + "/" + namecopied))
            Toast.makeText(this, uri.toString(), Toast.LENGTH_SHORT).show()
            mediaplayer = MediaPlayer.create(this, uri)
            mediaplayer.prepare()
            mediaplayer.start()
        }
          //where  getAppExternalFilesDir() =getExternalFilesDir(null)

    }

A: Your code is not optimized as well, you can use cold sequences to search through files, it'll destroy older instances of file as it runs
fun ListDir(f: File) {
    val mp3Files = f.walk().map { it.absolutePath }.filter { it.endsWith(".mp3") }.toList()

    listview.setOnItemClickListener { parent:AdapterView<*>, view:View, position:Int, id:Long ->
        if (position>=0) {
            ...
            var uri: Uri = Uri.fromFile(File(mp3Files[position]))
            ...
        }
    }
}

This will create proper Uri that you can pass to the media player to play the mp3 files.


text:
Q: How to get status code of program piped to linux dialog command I am trying to use Linux dialog to prepare simple installer for Ubuntu. The actual command is:
  dpkg -i package.deb 2>&1 | dialog --programbox "Installing..." 10 100

I want dialog to display any output produced by the dpkg command whether it is normal output or error message, so I redirect stderr to stdout. This works.
The problem is that I need status code of the dpkg command after both commands ended. Just to know if the dpkg did its job or not. Unfortunately, after these commands ended I can only get status code of the dialog command...
Anyone knows how to obtain status code of the dpkg command from above example?

A: What you search is the pipestatus:
dpkg -i ... | dialog ...
echo ${PIPESTATUS[0]} # this contains the exit code of the dpkg command.

See that example:
$ false | true | false | true
$ echo ${PIPESTATUS[@]}
1 0 1 0