text:
Q: Getting OpenVPN server status failed after fully configuration on Centos 7 VPS I am going to setup a VPN Server on Centos 7 VPS, running as Docker container. However, after installing OpenVPN and configuring it, I see the server status failed:

This is my server.conf file:
port 1194
proto udp
dev tun

ca ca.crt
cert server.crt
key server.key
dh dh2048.pem

server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt

push "redirect-gateway def1 bypass-dhcp"

push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"

keepalive 10 120
cipher AES-256-CBC
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
verb 3
explicit-exit-notify 1

And this is what written in messages file in var/log/ after run command below:

systemctl start openvpn@server.service

Oct  7 08:35:39 systemd: Cannot add dependency job for unit systemd-vconsole-setup.service, ignoring: Unit is masked.
Oct  7 08:35:39 systemd: Starting OpenVPN Robust And Highly Flexible Tunneling Application On server...
Oct  7 08:35:39 openvpn: Fri Oct  7 08:35:39 2022 OpenVPN 2.4.12 x86_64-redhat-linux-gnu [Fedora EPEL patched] [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Mar 17 2022
Oct  7 08:35:39 openvpn: Fri Oct  7 08:35:39 2022 library versions: OpenSSL 1.0.2k-fips  26 Jan 2017, LZO 2.06
Oct  7 08:35:39 openvpn: Fri Oct  7 08:35:39 2022 Diffie-Hellman initialized with 2048 bit key
Oct  7 08:35:39 openvpn: Fri Oct  7 08:35:39 2022 ROUTE_GATEWAY ON_LINK IFACE=venet0 HWADDR=00:00:00:00:00:00
Oct  7 08:35:39 openvpn: Fri Oct  7 08:35:39 2022 ERROR: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)
Oct  7 08:35:39 openvpn: Fri Oct  7 08:35:39 2022 Exiting due to fatal error
Oct  7 08:35:39 systemd: Started OpenVPN Robust And Highly Flexible Tunneling Application On server.
Oct  7 08:35:39 systemd: openvpn@server.service: main process exited, code=exited, status=1/FAILURE
Oct  7 08:35:39 systemd: Unit openvpn@server.service entered failed state.
Oct  7 08:35:39 systemd: openvpn@server.service failed.

A: In the container it is only possible to create and use a tun device if the hosting provider gives your container such a possibility. They need:

*

*to load a tuntap driver on the host

*to give your container a permission to use it

If this requirement is met, you may create a missing device node and use it with OpenVPN or other applications:
mkdir -p /dev/net
mknod /dev/net/tun c 10 200
chmod 0666 /dev/net/tun

Probably you'll need to create it each time container boots, in which case it is convenient to create a systemd unitt which runs these commands for you and set it up to be required for network:
[Unit]
Description=/dev/net/tun device node
Requires=sysinit.target
After=sysinit.target
Documentation=https://www.kernel.org/doc/Documentation/networking/tuntap.txt

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=mkdir -p /dev/net
ExecStart=mknod /dev/net/tun c 10 200
ExecStart=chmod 0666 /dev/net/tun

[Install]
WantedBy=network-pre.target

Save this into /etc/systemd/system/tuntap-dev.service and run systemctl enable tuntap-dev.service to start it at boot.


text:
Q: Nullpointerexception and onPause(): a mystery I'm writing a game on Android and this issue has stumped me. I overrode onPause() to enable the game to save its data to internal storage when it is not visible anymore. It works correctly until three or four times of pressing back or home. I get this instead:
Thread [<1> main] (Suspended (exception NullPointerException))
    Main.onPause() line: 127
    Main(Activity).performPause() line: 3842
    Instrumentation.callActivityOnPause(Activity) line: 1190
    ActivityThread.performPauseActivity(ActivityThread$ActivityRecord, boolean, boolean) line: 3335
    ActivityThread.performPauseActivity(IBinder, boolean, boolean) line: 3305
    ActivityThread.handlePauseActivity(IBinder, boolean, boolean, int) line: 3288
    ActivityThread.access$2500(ActivityThread, IBinder, boolean, boolean, int) line: 125
    BinderProxy(ActivityThread$H).handleMessage(Message) line: 2044
    ActivityThread$H(Handler).dispatchMessage(Message) line: 99
    Looper.loop() line: 123
    ActivityThread.main(String[]) line: 4627
    Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
    Method.invoke(Object, Object...) line: 521
    ZygoteInit$MethodAndArgsCaller.run() line: 868
    ZygoteInit.main(String[]) line: 626
    NativeStart.main(String[]) line: not available [native method]

The debugger states it blows up on this:
@Override
public void onPause() {
    super.onPause();
    Data data = game.writeProtoBuf(); // NullPointerException
    try {
    //IO stuff

writeProtoBuf doesn't actually write anything but is just a method to retrieve the game data and put it into the Data object. The debugger shows that game is null, but I don't see how that is possible when I can interact with the game correctly before closing it down. :/

A: Try using onSaveInstanceState instead of onPause

A: After much teeth-grinding, I think I have worked out the issue. I was assuming that the game instance would persist when changing activities. It doesn't, so that was why Android kept throwing up Nullpointer. I would start up the app, exit it (which causes it to save to internal storage), and then when I tried to save it again, it wouldn't work.
I fixed this by turning Game into a singleton, thereby preserving its state across activities. I admit I don't really understand why this works or how it works, but it works. If I sound really blur and confused, it's because I am. :P
Inspiration for the fix came from here.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Does std::vector's push_back create a deep copy of the argument? I have a list of images stored it several Mat objects and I need to push them into a vector of Mat.
vector<Mat> images;
Mat image;
for ( i = 0; i < n; i++)
{
   \\ importing the i-th image into a mat image;
   images.push_back(image);
}

Does this create a deep copy of the image?
Sure
vector<Mat> images;
Mat image (100, 100, CV_8UC(1), Scalar::all(255));
images.push_back(image);
image.release();
Mat temp (100,100, CV_8UC(1), Scalar::all(0));
image =  temp;
images.push_back(image);
imshow("black", images[0]);
waitKey(0);
imshow("White",images[1]);
waitKey(0);

this should show one black and one white image.
Another question
Mat img;
vector<mat> images;
for (i = 1; i < 5, i++)
{
    img.create(h,w,type); // h,w and type are given correctly
    // input an image from somewhere to img correctly.
    images.push_back(img);
    img.release();
}
for (i = 1; i < 5; i++) images[i].release();

This still makes me have memory leaks, what may be the reason behind it?

A: std::vector::push_back uses the object's copy constructor to insert an element into a vector. So if the Mat copy constructor creates a deep copy of the Mat object, you get a deep copy.

A: It does not make deep copies, since cv::Mat's are shared pointers. You have to use clone() or similar when adding to the vector images.

A: Here's a little testing program to demonstrate the data-sharing properties of cv::Mat objects (which are matrix headers) in special!
int main()
{
    // create input of size 512x512
    cv::Mat input = cv::imread("../inputData/Lenna.png");

    // create a second input of size 256x256
    cv::Mat modifiedInput;
    cv::resize(input, modifiedInput, cv::Size(256,256));

    std::vector<cv::Mat> images;

    // first element will be a "deep copy" where the matrix elements will be copied to a new memory location and a new header will be created, referecing those matrix elements.
    images.push_back(input.clone());

    // 6 times copy the "input" to "images".
    // All the copies will (deep) copy the matrix header but they will share the matrix elements (because their memory LOCATION will be copied)
    for(unsigned int i=0; i<6; ++i)
        images.push_back(input);

    // now some experiments:
    // draw a circle to input variable. At this point it should share it's matrix elements with images[1-5]
    cv::circle(input, cv::Point(100,100), 30, cv::Scalar(0,0,0), -1);

    // draw a circle to a vector element:
    cv::circle(images[5], cv::Point(300,100), 30, cv::Scalar(0,0,0), -1);

    // use a openCV function that will allocate new memory, if the destination dimensions don't fit:
    // to a mat whose dimensions fit:
    // remember that input.size() == vector[0..5].size
    // compute median blur and target one of the matrices that share their data at the moment:
    cv::medianBlur(input, images[3], 11);

    cv::imshow("0", images[0]);
    cv::imshow("1", images[1]);
    cv::imshow("2", images[2]);
    cv::imshow("3", images[3]);
    cv::imshow("4", images[4]);
    cv::imshow("5", images[5]);
    cv::waitKey(0);

At this time it's looking like this: All matrices share their element's data except the first matrix because there a deep-copy was forced with .clone().

now continue with this:
    // to a mat whose dimensions don't fit (new memory will be allocated, not shared by the other matrix headers anymore):
    // images[3] will not share the data with other matrix headers afterwards
    cv::medianBlur(modifiedInput, images[3], 11);

    // now images[3] and images[4] will share matrix elements
    images[4] = images[3];
    cv::circle(images[4], cv::Point(128,128), 20, cv::Scalar(255,255,255), 3);

    // create a deep-copy of 256x256 input to overwrite images[5] (not modifying any other image's matrix elements)
    images[5] = modifiedInput.clone();
    cv::circle(images[5], cv::Point(0,0), 30, cv::Scalar(0,255,0), -1);

    cv::imshow("0", images[0]);
    cv::imshow("1", images[1]);
    cv::imshow("2", images[2]);
    cv::imshow("3", images[3]);
    cv::imshow("4", images[4]);
    cv::imshow("5", images[5]);

    //cv::imshow("input", input);
    //cv::imwrite("../outputData/MainBase.png", input);
    cv::waitKey(0);
    return 0;
}

looks like this:

This time, the call of medianBlur did NOT share the data with all the other matrices, because the destination-image's dimensions DID NOT FIT, so new memory had to be allocated for images[3] within the medianBlur method. So images[3] referenced different data elements aferwards!
All this might be a little tricky because the user might not see directly, which function calls will allocate new data and which ones don't, so if you want to be sure to allocate new data, you should do this in beginning for each mat, or use an empty mat as destination (or don't share any data in the beginning).
One more thing:
cv::Mat emptyMat;
std::vector<cv::Mat> images(n, emptyMat); // insert n copies of emptyMat header
// or
for(unsigned int i=0; i<n; ++i)
    images.push_back(emptyMat) // same result

this is both save to use so that not data is shared, because all emptyMat doesn't have any data in the beginning, so no data can be shared. Whenever any data is assigned to any of the vector elements, the other's don't know about it and so they won't share that data.
// BUT:
cv::Mat notEmptyMat = cv::Mat::zeros(height, width, type);
std::vector<cv::Mat> images(n, notEmptyMat ); // insert n copies of emptyMat header which references the assigned zeroes data of size width x height
// or
for(unsigned int i=0; i<n; ++i)
    images.push_back(notEmptyMat ) // same result

Here, data is shared and whenever you change the DATA of one of those matrices, the other ones will be changed, too. But obviously, if you assign new data memory to one of those matrices, the other ones still reference their other data memory.

A: std::vector::push_back will copy or move the object into the vector, that means the copy ctor or move ctor of Mat will be called. So it depends on Mat.
See CopyInsertable and MoveInsertable.


text:
Q: FFMPEG h264_videotoolbox output is strange I want to use h264_videotoolbox codec to encode my video in FFMPEG lib.I input image format is AV_PIX_FMT_YUV420P, but output video frame like follow.
I tried libx264 and all work correctly.
Do you guys know what happen?Why encoded frame like that?

My test code:
https://github.com/BeiKeJieDeLiuLangMao/videotoolbox
Resolution
Data should align to 32.


text:
Q: Implement zoom functionality in layout having images I want to implement pinch zoom functionality for a layout which have a background image and on background image it have 4 another image . see the image

I have 2 idea to implement my problem

*

*Make a parent layout (framelayout) which will have these 4 images as child layout(imageview) and somehow (i dont know how) if i am able to make it pinch zoom. my problem will get solved

*i can use webview but i dont know how to put these images in webview.
can anyone help me to get it solved.
Note : i want pinch zoom functionality only for background image. as if background image will get zoom,  other images will also get zoomed. i dont want independent zoom for images 1 2 3 4.
Thanks

A: *

*All layouts are already put in to the default FrameLayout, so, Merge as a root layout is enough.

*As for zooming the main image, the only problem IMHO, is that these children could sometime catch the event instead of the root layout. So, you need do make them unfocusable and disabled. After that all events will be catched by the parent.


text:
Q: Primefaces dataTable JavaScript Callback on row selection with row number With RichFaces it is possible to execute a JavaScript function when a single row is selected (via a click on the row) and passing the selected row number as a parameter like this:
<rich:extendedDataTable
    rowKeyVar="row"
    onRowClick="executeMeOnRowSelection(#{(row})"...>

I need to migrate this to Primefaces. According to this question Primefaces itself does not provide this functionality, but one can use Primefaces Extensions. However, when I try it like this:
<p:dataTable rowIndexVar="row" selectionMode="single">

<pe:javascript event="rowSelect" execute="executeMeOnRowSelection(#{(row})"/>

...it would seem that Primefaces generates a JavaScript callback that does not get the selected row number, but is always called with the first row number (a look at the generated page reveals a hard coded value for the function parameter of the executeMeOnRowSelection).
Edit: To be more precise, the #{row} variable seems to not be evaluated when used directly under the p:dataTable tag. It is correctly resolved when used inside a p:column tag, but both
<pe:javascript event="rowSelect" execute="executeMeOnRowSelection(#{(row})"/>

and, for that matter,
<p:ajax event="rowSelect" oncomplete="alert(#{row});" />

end up with #{row} being replaced with an empty string (both placed as direct children of the p:dataTable tag).
Is there an error in the way I use the pe tag in combination with p:dataTable? Is there an alternative solution?


text:
Q: $p$-Sylow subgroups are enough for surjectivity of homomorphism? I'm reading a book  and I'm a little rusty in finite group theory and in particular Sylow theory, so I gently ask you for references for such result. This is probably standard. The situation is as follows
Let $G$ and $H$ be finite groups.
Say $f\colon G\to H$ is a homomorphism, and we want to check surjectivity.
The autor claims it is enough to check surjectivity for $p$-Sylow subgroups of $H$.
Now, I'm not sure if this is because of some aditional hypotheses that exist in the groups in question for my particular case, or if it is some general thing that always happens. I will be happy to find out.
I suppose that, if every element $h$ of $H$ could be written as a product $h=p_{1}...p{k}$ with $p_{k}$'s in various $p$-Sylow subgroups of $H$, then we are done, because then
\begin{equation}
h=f(g_{1})\dots f(g_{k})=f(g_{1}\dots g_{k}).
\end{equation}
Now, how to do this? I guess that we could look at the order of $h$ and find out something, but I came up with nothing. Thanks for any help or reference.

A: The argument is to consider the order of the image of $f$.
Say that $|H| = p_1^{n_1} \dots p_k^{n_k}$ and the image of $f$ is order $p_1^{m_1} \dots p_k^{m_k}$.  Here $f$ is surjective if and only if $m_i = n_i$ for all $i$.
Now we observe that if the image of $f$ contains a $p_i$-Sylow subgroup $P_i$ of $H$, then $m_i = n_i$.  This follows since $p_i^{n_i} = |P_i|$ divides the order of any subgroup containing $P_i$.
e: Note that if you fix specific Sylow subgroups $P_1, \ldots P_k$, then it is not always the case that every element of $G$ can be written in the form $p_1\ldots p_k$.  The smallest counterexample I can come up with for this is $A_5$, for which note that since $(1 5) (3 2)(1 4 3 )(1 2 3 4 5) $ is the identity, the list of 60 products $p_1p_2p_3$ contains repeats and thus is not the entirety of $A_5$.
This can be fixed by noting that $H$ is always the subgroup generated by $P_1, P_2, \dots P_k$, in other words every element $h$ can be written in the form $q_1q_2\dots q_l$, where each $q_j$ lies in some $P_i$. Then $h = f(g_1)\dots f(g_l) = f(g_1\dots g_l)$ as desired.
However, to see that the subgroup generated by $P_1, P_2, \dots P_k$ is all of $H$, it is easiest to consider order, similar to the argument above.


text:
Q: How to connect a 5.1 DVD Home Theater Speaker to PC? Recently I found an old DVD player in my garage. It seems like the speakers work fine, but can I connect it to my PC instead of CD/USB? I want them work as my PC speakers.
The input:

Am I able to connect RCA to laptop cable to the DVD player input?

A: You can use a 3.5mm jack to phono cable. A simple internet search will provide a bountiful supply of purchasing options.
The cable you have includes a video input (yellow), you could use that cable and leave the yellow plug disconnected.


text:
Q: how to get the distance or radian between two point on the earth with lng and lat? how to get the distance or radian between two point on the earth with lng and lat?

A: You probably don't want mapReduce in this case but actually the aggregation framework. Apart from the general first stage query you can run via $geoNear which is more efficient in your purpose.
db.places.aggregate([
    { "$geoNear": {
        "near": {
            "type": "Point",
            "coordinates": [ -88 , 30 ]
        },
        "distanceField": "dist"
    }},
    { "$match": {
        "loc": {
            "$centerSphere": [ [ -88 , 30 ] , 0.1 ]
        }
    }}
])

Or frankly, because the initial $geoNear stage will "project" an additional field into the document containing the "distance" from the queried "point of origin", then you can just "filter" on that element in a subsequent stage:
db.places.aggregate([
    { "$geoNear": {
        "near": {
            "type": "Point",
            "coordinates": [ -88 , 30 ]
        },
        "distanceField": "dist"
    }},
    { "$match": {
        "dist": { "$lte": 0.1 }
    }}
])

Since this is one option that can "produce/project" a value representing the distance in the result then that satisfies your first criteria. The "chaining" nature of the "aggregation framework" allows "additional filtering" or any other operation you need to perform after the filtering of the initial query.
So $geoWithin works just as well in the aggregation framework under a $match stage as it would in any standard query since it is not "dependant" on an "index" of geospatial origin to be present. It performs better in an initial query with one, but it does not need it.
Since your requirement is the "distance" from the point of origin, then the most logical thing to do is to perform an operation that will return such information. Such as this does.
Would love to include all of the relevant links in this response, but as a new responder then two links is all I am allowed for now.

One more relevant note:
The measurement of "distance" or "radius" in any operation is dependant on how your data is stored. If it is in a "legacy" or "key/pair or plain array" format then the value will be expressed in "radians", otherwise where the data is expressed in GeoJSON format on the "location" then the "distance data" is expressed in "meters" instead.
That is an important consideration given the libraries implemented by the MongoDB service and how this interacts with the data as you have it stored. There is of course documentation on this in the official resources should you care to look at that properly. And again, I cannot add those links at this time, unless this response sees some much needed love.

A: https://github.com/mongodb/mongo/blob/master/src/third_party/s2/s2latlng.cc#L37
GetDistance() return a S1Angle, S1Angle::radians() will return the radians.
This belong to s2-geometry-library(google code will close,i export it to my github. Java).


text:
Q: Minimisation of Gibbs/Helmholtz free energy and Clausius theorem I am trying to understand why (under the relevant given conditions) the free energy (either Gibbs or Helmholtz) is minimised. The derivation I have seen in several places goes like this. Set $\delta W = - PdV$
$$dE = \delta Q + \delta W = \delta Q - PdV$$
$$dE + PdV - TdS = \delta Q - TdS \leq 0$$
by Clausius' theorem. Therefore at constant T and P, $E + PV - TS$ is minimised. What bothers me about this argument is the following. Standard thermodynamics textbooks will tell you that
$$dE = TdS - PdV$$
is true in general even for irreversible processes (this makes sense to me). Therefore we have
$$dE = TdS - PdV = \delta Q + \delta W$$
$$(\delta Q - TdS) + (\delta W + PdV) = 0$$
If $\delta Q - TdS \leq 0$ then $\delta W + PdV \geq 0$ and in fact whenever $\delta Q \neq TdS$ you must have $\delta W \neq - PdV$. Thus the above derivation seems to contain a contradiction in that it simultaneously assumes $\delta Q > TdS$ but yet $\delta W = - PdV$. Is my objection correct? If so is there another way to derive the minimisation of these potentials?

A: The source of the apparent paradox is the equation
$$
\text{d}E = T\text{d}S - P\text{d}V.
$$
This equation only applies for a pure substance at phase equilibrium. For the general case of a multi-component mixture or a pure substance not at phase equilibrium, the equation is instead
$$
\text{d}E = T\text{d}S - P\text{d}V + \sum_i \mu_i \text{d} m_i
$$
where $\mu_i$ is the chemical potential (per mass) of species $i$ and $m_i$ is the mass of species $i$. If you go through the math you will find that the sum term is zero when reversible chemical reactions (including the null reaction) occur and negative when irreversible ones occur. This is the sink term which prevents the derivation from being self-contradictory.
The derivation does not work for a pure substance at phase equilibrium because if such a substance has a well-defined $T$ and $P$ (as is stated in the derivation) then we know its state exactly. We no longer have a set of quasi-equilibrium states (here meaning "states where thermodynamics applies") from which we can pick the single true equilibrium state via a minimization principle; we have exactly one quasi-equilibrium state which is also the true equilibrium state.
As an example to illustrate the above, imagine a system consisting of twice as many atoms of hydrogen as oxygen, held in a container which maintains constant $T$ and $P$.

*

*In general, there are infinite possible chemical compositions satisfying these constraints, and all of these are quasi-equilibrium states, but there is only one true equilibrium state (chemical equilibrium). The quasi-equilibrium states decay into the equilibrium state via irreversible chemical reactions, and the derivation tells us that we can identify the equilibrium state as that of minimum $G$.

*In the special case where all of the hydrogen and oxygen atoms are combined into water molecules, there is instead one possible chemical composition, and one can use steam tables to look up any property of interest as a function of $T$ and $P$. There is only one state satisfying the constraints, so the system can only undergo one "process": the null process beginning with water at the defined $T$ and $P$ and ending at the same state (which is reversible). This is perfectly consistent with what the math shows: the 'sum over chemical potentials' term is $0$, so (by the logic in your question) all possible processes are reversible.


text:
Q: Load HTML in CKEditor Could someone explain to me how to load HTML into the CKEditor?
I have an editor in an asp.net page using the ajaxtoolkit. I have a AsyncFileUpload control that allows the user to upload an HTML file which I read and assign the value to the editor's Value property (which appears to be the way to load data into the control). However, this doesn't load the HTML ?!?
I've tried several different methods, but they all come down to this more or less...
editorCorps.Value = Server.HtmlEncode(html)

or simply
editorCorps.Value = html

Thanks in advance,
Sam


text:
Q: How to compress multiple folders to separetly another folders and tar.gz How I can compress files in this scenario:
I have folder structure like this:
User1:
/home/user1/websites/website1
/home/user1/websites/website2

User2:
/home/user2/websites/website1
/home/user2/websites/website2
/home/user2/websites/website3

And I try now (need) to do backup like this:
Folders for backups per user:
/backup/date/websites/user1/
/backup/date/websites/user1/

And I need backup tar in user directory separately per website like this:
/backup/date/websites/user1/website1.tar.gz
/backup/date/websites/user1/website2.tar.gz

/backup/date/websites/user2/website1.tar.gz
/backup/date/websites/user2/website2.tar.gz
/backup/date/websites/user2/website3.tar.gz

I have script like this one to do half of this work:
#VARIABLES
BKP_DATE=`date +"%F"`
BKP_DATETIME=`date +"%H-%M"`

#BACKUPS FOLDERS
BKP_DEST=/backup/users
BKP_DEST_DATE=$BKP_DEST/$BKP_DATE
BKP_DEST_TIME=$BKP_DEST_DATE/$BKP_DATETIME
BACKUP_DIR=$BKP_DEST_TIME

#NUMBER OF DAYS TO KEEP ARCHIVES IN BACKUP DIRECTORY
KEEP_DAYS=7

#Create folders
mkdir -p $BKP_DEST_DATE
mkdir -p $BKP_DEST_TIME
mkdir -p $BACKUP_DIR

#DELETE FILES OLDER THAN {*} DAYS IN BACKUP SERVER DIRECTORY
#echo 'Deleting backup folder older than '${KEEP_DAYS}' days'
find $BKP_DEST/* -type d -ctime +${KEEP_DAYS} -exec rm -rf {} \;

#Do backups
#List only names available users data directories
usersdirectories=`cd /home && find * -maxdepth 0 -type d | grep -Ev "(tmp|root)"`

#Creating directories per user name
for i in $usersdirectories; do
  mkdir -p $BACKUP_DIR/$i/websites
done

But if u see, i haven't how to do tar this for separately archives. In my half script I have done:

*

*Create folder structure for backup by datetime (/backup/users/day/hour-minutes)

*Create folder structure for backup by users names (/backup/users/day/hour-minutes/user1)

Thanks for all users who try to help me!

A: I wish I could comment to ask for more clarification but I will attempt to help you.
#!/bin/bash

# example for user1
archive_path=/backup/data/websites/user1
file_path=/home/user1/websites/*

for i in $file_path
do
  tar czf $archive_path/$(basename $i).tar.gz $file_path
done

A: I will try to complete your script, but I can't debug it because your environment is hard to reproduce. It is better in the future that you provide a minimal reproducible example.
#VARIABLES
BKP_DATE=$(date +"%F")
BKP_DATETIME=$(date +"%H-%M")

#BACKUPS FOLDERS
BKP_DEST=/backup/users
BKP_DEST_DATE=$BKP_DEST/$BKP_DATE
BKP_DEST_TIME=$BKP_DEST_DATE/$BKP_DATETIME
BACKUP_DIR=$BKP_DEST_TIME

#NUMBER OF DAYS TO KEEP ARCHIVES IN BACKUP DIRECTORY
KEEP_DAYS=7

#Create folders
mkdir -p $BKP_DEST_DATE
mkdir -p $BKP_DEST_TIME
mkdir -p $BACKUP_DIR

#DELETE FILES OLDER THAN {*} DAYS IN BACKUP SERVER DIRECTORY
#echo 'Deleting backup folder older than '${KEEP_DAYS}' days'
find $BKP_DEST/* -type d -ctime +${KEEP_DAYS} -exec rm -rf {} \;

#Do backups
#List only names available users data directories
usersdirectories=$(cd /home && find * -maxdepth 0 -type d | grep -Ev "(tmp|root)")

#Creating directories per user name
for i in $usersdirectories; do
  for w in $(/home/$i/websites/*); do
    ws=$(basename $w)
    mkdir -p $BACKUP_DIR/$i/websites/$ws
    tar -czvf $BACKUP_DIR/$i/websites/$ws.tar.gz /home/$i/websites/$ws
  done
done

I suppose there are no blanks inside the directory names website1, etc...
I also replaced the deprecated backticks operators of your code by $(...).

A: Okay, after small fix. Version from Pierre working now. If u want, u can adjust it for yours need.
#VARIABLES
BKP_DATE=$(date +"%F")
BKP_DATETIME=$(date +"%H-%M")

#BACKUPS FOLDERS
BKP_DEST=/backup
BKP_DEST_DATE=$BKP_DEST/$BKP_DATE
BKP_DEST_TIME=$BKP_DEST_DATE/$BKP_DATETIME
BACKUP_DIR=$BKP_DEST_TIME

#NUMBER OF DAYS TO KEEP ARCHIVES IN BACKUP DIRECTORY
KEEP_DAYS=7

#Create folders
mkdir -p $BKP_DEST_DATE
mkdir -p $BKP_DEST_TIME
mkdir -p $BACKUP_DIR

#DELETE FILES OLDER THAN {*} DAYS IN BACKUP SERVER DIRECTORY
#echo 'Deleting backup folder older than '${KEEP_DAYS}' days'
find $BKP_DEST/* -type d -ctime +${KEEP_DAYS} -exec rm -rf {} \;

#Do backups
#List only names available users data directories
usersdirectories=$(cd /home/user && find * -maxdepth 0 -type d | grep -Ev "(tmp|root)")

#Creating directories per user name
for i in $usersdirectories; do
  for w in /home/user/$i/*; do
    #echo ok
    ws=$(basename $w)
    echo mkdir -p $BACKUP_DIR/$i
    echo tar -czvf $BACKUP_DIR/$i/$ws.tar.gz /home/user/$i/$ws
  done
done


text:
Q: I have the details of services and service, and it's a relationship between them, one to many,, how to create service item I have the details of service and service, and it's a relationship between them, one to many,
so wen i click on button details in table service , take me to service details page, where i want to use also crud on details of service.
any suggestions how to store service details where it has service_id

A: You can create CRUD with dropdown from Service to create function in DetailsController with pluck.
// pluck(value, key)
$services = Services::all()->pluck('name', 'id');

And you can call it in your view file. like this:
<select name="service_id">
 @foreach ($services as $id => $services)
  <option value="{{ $id }}">
  {{ in_array($id, old('service_id', [])) ? 'selected' : '' }}
  {{ $services }}
  </option>
 @endforeach
</select>

It will create dropdown with option value from service id.


text:
Q: Scoped css not being applied with lang="scss" I'm using Quasar and trying to style q-table first column:
<style lang="scss" scoped>
td:first-child {
  background-color: #747480 !important;
}
</style>

However this does not work even after reloading/hot reloading/restarting server whatever.
Removing scoped works fine. I have no idea what is going on. Anyone could provide solution for this problem?
EDIT:
Here is working demo:
Codesandbox
Just remove scoped from the style and the color will change.

A: Update: In Vue 3 the piercing selector is :deep(). e.g:
.qtable :deep(tbody td) {
  white-space: normal;
}

...will produce something along these lines:
.qtable[data-v-f3f3eg9] tbody td {
  white-space: normal;
}

Initial answer:
Warning on using: >>> with lang="scss"!
While >>> seems to work as expected when lang is not specified (or when it's set to css), the same is not true with lang="scss".
The only piercing selectors that work with lang="scss" (in latest 2.x Vue — v2.6.11) are /deep/ and ::v-deep.
What I know for sure is that it's not related to node-sass or dart-sass packages, as I tried with both and it behaves the same. So it's either at Vue package level or at sass package level. But I don't consider downgrading any of those to be a feasible solution
For some reason, >>> gets transformed into > > > when used in scss which, for obvious reasons, makes anything inside that code block no longer apply. What should happen is >>> should be removed and any parts of the selector after that point should no longer have the scoping attribute applied (as it does for the other 2 piercing selectors).
Note it used to work, and I have no idea when or why it stopped working (I've personally always preferred ::v-deep, for no particular reason).
In your case: just wrap everything into ::v-deep {}:
<style lang="scss" scoped>
  ::v-deep {
    td:first-child {
      background-color: #747480; /* no need for !important */
    }
    .q-table tbody td {
      white-space: normal;
    }
  }
</style>

... and they'll apply.
See it working here: https://codesandbox.io/s/cranky-snow-ruf3w?file=/src/pages/Index.vue

A: Use deep selector in style scoped
In your code, add "id" in your q-table
<q-table
    title="Treats"
    :data="data"
    :columns="columns"
    row-key="name"
    dark
    color="amber"
    id="my-table"
        />

And then change your scoped style into like this one
<style scoped>
  #my-table >>> td:first-child {
    background-color: #1313eb !important;
  }

 .q-table tbody td {
    white-space: normal;
 }
</style>

A: If you are using <style scoped lang="scss"> (For example in Vue.js) deep selector /deep/ required instead of >>> between parent and child tags for applying CSS parameter to all the children:
// Does not apply to all children and won't work:
.my-table .cell {
  word-break: keep-all;
}

// Apply it to all the children:
.my-table /deep/ .cell {
  word-break: keep-all;
}

/deep/ or ::v-deep is a replacement of >>> in Sass scoped pre-processor.


text:
Q: Table cell color overlaps cell border As the graphic and MWE below show, some of colored my table cells are obscured the cell colors. I'd appreciate help fixing this.

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[table]{xcolor}

\makeatletter
\providecommand{\tabularnewline}{\\}
\makeatother

\usepackage{babel}
\begin{document}
\begin{tabular}{c|c|c|c|cc|}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{B} & \multicolumn{1}{c}{C} & D & \multicolumn{1}{c}{E}\tabularnewline
\cline{2-6}
a & \cellcolor{blue!25} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} &  & \cellcolor{red!25} \tabularnewline
\cline{2-3}
b &  &  & \multicolumn{1}{c}{} &  & \tabularnewline
\cline{2-4}
c &  &  &  &  & \tabularnewline
\cline{2-5}
d &  &  &  & \multicolumn{1}{c|}{} & \tabularnewline
\cline{2-6}
e &  & \cellcolor{green!25} &  & \multicolumn{1}{c|}{} & \tabularnewline
\cline{2-6}
\end{tabular}
\end{document}

A: You can use hhline here which simply adds vertical space and doesn't get over-drawn by \cellcolor.
Code
\documentclass{standalone}
\usepackage[table]{xcolor}
\usepackage{hhline}
\begin{document}
\begin{tabular}{c|c|c|c|cc|}
    \multicolumn{1}{c}{} & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{B} & \multicolumn{1}{c}{C} &           D           & \multicolumn{1}{c}{E} \tabularnewline \hhline{~|*{5}{-}}
             a           &  \cellcolor{blue!25}  & \multicolumn{1}{c}{}  & \multicolumn{1}{c}{}  &                       &  \cellcolor{red!25}   \tabularnewline \cline{2-3}
             b           &                       &                       & \multicolumn{1}{c}{}  &                       &  \tabularnewline \cline{2-4}
             c           &                       &                       &                       &                       &  \tabularnewline \cline{2-5}
             d           &                       &                       &                       & \multicolumn{1}{c|}{} &  \tabularnewline \hhline{~|*5-}
             e           &                       & \cellcolor{green!25}  &                       & \multicolumn{1}{c|}{} &  \tabularnewline \hhline{~|*5-}
\end{tabular}
\end{document}

Output

A: The environment {NiceTabular} of the package nicematrix has tools design to address that kind of problem.
\documentclass[margin=1cm]{standalone}
\usepackage{nicematrix}
\usepackage{xcolor}

\begin{document}
\begin{NiceTabular}{ccccc}[first-row,first-col,hvlines]
\CodeBefore
  \cellcolor{blue!25}{1-1}
  \cellcolor{red!25}{1-5}
  \cellcolor{green!25}{5-2}
\Body
  & A & B & C & D & E \\
a &   & \Block{1-*}{} & \Block{2-1}{} & \Block{3-1}{} & \Block{4-1}{} \\
b &   &   & \Block{1-*}{} \\
c &   &   &   & \Block{1-*}{} \\
d &   &   &   &   & \Block{1-*}{} \\
e \\
\end{NiceTabular}
\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).


text:
Q: In reflex-dom, how to pass a value from a dynamic to a foreign javascript function (FFI) I am new to Haskell and reflex-dom, but really like the language.  I've been using https://github.com/hansroland/reflex-dom-inbits/blob/master/tutorial.md to learn, and it's been very helpful.
I am currently trying to create a function that takes in a dynamic and creates an element and calls an FFI function every time the value changes in the dynamic.  Here is a simplified version of what I'm trying to do.
{-# LANGUAGE OverloadedStrings #-}
import Data.Text as T
import qualified GHCJS.DOM.Types as GDT
import GHCJS.Types
import Reflex.Dom

foreign import javascript safe
  "$1.value = $2"
  testSet :: JSVal -> JSVal -> IO()

testTB :: DomBuilder t m => Dynamic t T.Text -> m ()
testTB dt = do
  (e, _) <- elAttr' "input" ("type" =: "text") blank
  bob <- (testSet (GDT.pToJSVal e) . GDT.pToJSVal) <$> dt
  return ()

main = mainWidget $ testTB $ constDyn "Hello World!"

This results in the compile time error:
reflex-canvas.hs:14:10: error:
    • Couldn't match type 'm' with 'Dynamic t'
      'm' is a rigid type variable bound by
        the type signature for:
          testTB :: forall t (m :: * -> *).
                    DomBuilder t m =>
                    Dynamic t Text -> m ()
        at reflex-canvas.hs:11:11
      Expected type: m (IO ())
        Actual type: Dynamic t (IO ())
    • In a stmt of a 'do' block:
        bob <- (testSet (GDT.pToJSVal e) . GDT.pToJSVal) <$> dt
      In the expression:
        do { (e, _) <- elAttr' "input" ("type" =: "text") blank;
             bob <- (testSet (GDT.pToJSVal e) . GDT.pToJSVal) <$> dt;
             return () }
      In an equation for 'testTB':
          testTB dt
            = do { (e, _) <- elAttr' "input" ("type" =: "text") blank;
                   bob <- (testSet (GDT.pToJSVal e) . GDT.pToJSVal) <$> dt;
                   return () }
    • Relevant bindings include
        e :: Element EventResult (DomBuilderSpace m) t
          (bound at reflex-canvas.hs:13:4)
        dt :: Dynamic t Text (bound at reflex-canvas.hs:12:8)
        testTB :: Dynamic t Text -> m () (bound at reflex-canvas.hs:12:1)

I've tried various ways to convert the Dynamic to a m() but cannot figure it out.  What is the best practice for doing this?

A: The function performEvent_ will force execution of a javascript function but performEvent_ wants an Event t (WidgetHost m ()) and,  as the error message points out, you've got a Dynamic t (IO ()).
You can use updated to convert your Dynamic t (IO ()) to an Event t (IO ()) and you can use fmap liftIO to change the IO () in the Event to  a WidgetHost m () leaving you with Event t (WidgetHost m ()) which you can pass to performEvent_
Here's your code with those modifications.  I removed the first argument to testSet and the element creation inside testTB because those were not relevant to the problem/solution.  I also added some extra type declarations.  These were not required but may make things clearer.
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
import Data.Text as T (Text)
import qualified GHCJS.DOM.Types as GDT (pToJSVal)
import GHCJS.Types (JSVal)
import Reflex.Dom
import Control.Monad.Trans (liftIO)

foreign import javascript safe
  "console.log $1"
  testSet :: JSVal -> IO()

testTB :: forall t m.  MonadWidget t m => Dynamic t T.Text -> m ()
testTB dt = do
    let bob :: Dynamic t (IO ())
        bob = (testSet.(GDT.pToJSVal)) <$> dt

        bobIOEvent :: Event t (IO ())
        bobIOEvent = updated bob

        bobWidgetHostEvent :: Event t (WidgetHost m ())
        bobWidgetHostEvent = fmap liftIO bobIOEvent

    performEvent_ bobWidgetHostEvent

main = mainWidget $ do
    ti <- textInput def
    let dt = value ti
    testTB dt


text:
Q: Run-time error '-2147217900 (80040e14) while trying to retrieving data from SQL Server using VBA I am trying to connect to SQL Server from Excel VBA using the following code. But when I run the below query, I get an error

Run-time error '-2147217900 (80040e14).

Here is my code:
    Dim objMyConn As ADODB.Connection
    Dim objMyCmd As ADODB.Command
    Dim objMyCmd1 As ADODB.Command
    Dim objMyRecordset As ADODB.Recordset
    Dim rngUsedRange

    Set objMyConn = New ADODB.Connection
    Set objMyCmd = New ADODB.Command

    Set objMyRecordset = New ADODB.Recordset
    Set rngUsedRange = ActiveSheet.UsedRange

'Open Connection'

    objMyConn.ConnectionString = "Provider=SQLOLEDB;Data Source=10.5.3.16;Initial Catalog=PROTELECOM_AMERICAN_TOWERS;Trusted_connection=yes;"
    objMyConn.Open

'Set and Excecute SQL Command'
    Set objMyCmd.ActiveConnection = objMyConn
objMyCmd.CommandText = ";WITH CTE AS(SELECT BAN.BAN_IDFR, BAN.BAN_NBR, BAN.BAN_STATUS FROM PROTELE_BAN BAN INNER JOIN PROTELE_BILL BILL ON BAN.BAN_IDFR = BILL.BAN_IDFR" & _
"GROUP BY BAN.BAN_IDFR,BAN.BAN_NBR,BAN.BAN_STATUS)SELECT DISTINCT V.ORG_NAME [VENDOR NAME], CTE.BAN_NBR [BAN#], SVR.SER_ACCT_NBR [WTN#],W.COST_CENTER[COST CENTER],W.COST_CODE[COST CODE], BA.ECOM_ID [VENDOR ID],BC.SERVICE_TYPE [SERVICE TYPE], CONVERT(VARCHAR(10),MAX(B.BILL_DATE),101) AS [BILL DATE],SUM(BC.AMOUNT) AMOUNT, B.EXTRACT_STATUS [EXTRACT STATUS],CONVERT(VARCHAR(10),B.EXTRACT_DATE,101) AS [EXTRACTED DATE]" & _
"FROM CTE INNER JOIN PROTELE_BILL B ON CTE.BAN_IDFR = B.BAN_IDFR" & _
"INNER JOIN PROTELE_BILL_CHARGE BC ON B.BILL_IDFR = BC.BILL_IDFR" & _
"INNER JOIN PROTELE_BAN_WTN_MAPPING MAPP ON B.BAN_IDFR = MAPP.BAN_IDFR" & _
"INNER JOIN PROTELE_SVR_WTN SVR ON SVR.SVR_ACCT_IDFR=BC.SVR_ACCT_IDFR" & _
"INNER JOIN PROTELE_SVR_WTN_DETAILS W ON CTE.BAN_IDFR = W.BAN_IDFR AND SVR.SVR_ACCT_IDFR = W.SVR_ACCT_IDFR AND B.BAN_IDFR=W.BAN_IDFR" & _
"INNER JOIN PROTELE_BAN_VENDOR BV ON CTE.BAN_IDFR = BV.BAN_IDFR" & _
"INNER JOIN PROTELE_BAN BA ON CTE.BAN_IDFR = BA.BAN_IDFR" & _
"INNER JOIN PROTELE_LOCATION C ON C.LOCA_IDFR = BV.VNDR_LOCA_IDFR" & _
"INNER JOIN PROTELE_VENDOR V ON C.ORG_IDFR = V.ORG_IDFR WHERE BC.SVR_ACCT_IDFR=W.SVR_ACCT_IDFR AND (B.EXTRACT_DATE BETWEEN '02/05/2016' AND '02/06/2016')" & _
"GROUP BY CTE.BAN_NBR, B.EXTRACT_DATE, BA.ECOM_ID,B.BILL_DATE,B.EXTRACT_STATUS,BC.SERVICE_TYPE,W.COST_CENTER,W.COST_CODE, SVR.SER_ACCT_NBR,V.ORG_NAME" & _
"ORDER BY CTE.BAN_NBR, V.ORG_NAME;"
objMyCmd.CommandType = adCmdText
'Open Recordset'
    Set objMyRecordset.Source = objMyCmd
    objMyRecordset.Open
    For intColIndex = 0 To objMyRecordset.Fields.Count - 1
    Selection.Offset(0, intColIndex).Value = objMyRecordset.Fields(intColIndex).Name
    Next

'Copy Data to Excel'
    ActiveSheet.Range("A2").CopyFromRecordset objMyRecordset

A: The one thing that jumps to my attention is your concatenations.  You don't seem to be padding spaces or return characters between your concats.
For example, when you do this:
sql = "select one, two, three" & _
      "from x"

it will render the output as:
select one, two, threefrom x

Which should error.
Can you add spaces at the end of each string and see if that helps?  With the exception of that, I don't see any glaring issues with the code.


text:
Q: Switching setup to reverse B2B charging direction Say I have 2 of 400AH 12V DC battery banks, "A" and "B", and bankA is mobile, opportunistically charged by a HO alternator, the bankB is stationary, charged by a genset and topped up by a large solar array.
Sunny weather and alternator usage are both highly variable, there is usually no source of mains power, and a primary goal here is to minimize use of the fossil fuel engines.
When one bank is getting much more "free power" input than the other, they can be connected by a 180A "battery to battery" charger, but this unit is expensive, and is designed to charge in one direction only, from bankA to bankB.
I would like to install a switching arrangement to be able to swap the input & output wiring on the converter/charger, so I can direct current in the other direction, charging bankA from bankB when appropriate.
Ideally with a single throw, but if such a switch does not exist, I at least want a sequence simple enough to be able to train newbie users. The setup MUST protect from inadvertent direct "combining" of the two banks other than through the B2B charger, or at the very least, make doing so difficult given clear posted instructions.
The HD marine switches (from e.g. Blue Sea http://assets.bluesea.com/files/resources/sales_sheets/6823.pdf) are ideal electrically and IMO cost-effective, but the choices there are limited.
Perhaps something could be constructed from these three available designs?
ON/OFF
3-position selector: OFF/1/2
Dual Circuit, isolated from each other, both ON or both OFF
I'm pretty sure the remaining two options are useless here:
Dual Circuit plus COMBINE
4-position selector: OFF/1/2/COMBINE

A: You can make your own DPDT switch:

simulate this circuit – Schematic created using CircuitLab
Or just use jumper-style cables, e.g.:

Cut it on the one side to allow quick swapping. Fixate with a bolt.
Takes a minute or so for each swapping, with little wear. High current capability, super low cost, full control over variables...
Have fun! :)


text:
Q: Adding +"" to string appends "0" By an accidental typo I've encountered a behavior which I cannot explain.
When I have
var text = "abc";
text += + "";

the text variable suddenly becomes abc0.
Can someone provide any insight on this, please?

A: + "" evaluates to the number 0. This is because in order to apply the unary plus operator, "" is coerced to a number--the same as Number(""), which results in 0 if the string is empty or blank.
When you then "add" (+ or in this case +=) the number 0 to the string "abc", it is coerced to the string "0", resulting in "abc0".
From the spec:

A StringNumericLiteral that is empty or contains only white space is converted to +0.

A: As you can see in TypeScript (+ "") is a number (0):

A: from: http://xkr.us/articles/javascript/unary-add/
In JavaScript it is possible to use the + operator alone before a single element. This indicates a math operation and tries to convert the element to a number. If the conversion fails, it will evaluate to NaN. This is especially useful when one wants to convert a string to a number quickly, but can also be used on a select set of other types.


text:
Q: How to break a collider into 2 different box colliders for a box body in andengine I have a very simple sprite which is thick in the upper half and thin in the bottom half. And I have attached a box body to it. Now the problem is collisions happening even when the object didn't touch the sprite in the bottom half as the body is taken as a rectangle. What I want to do exactly is modify the collider width for the upper part and the bottom part. Can someone tell me how to do it and what is the best way?

A: Body's can be made up of multiple fixtures, so you can just make two fixtures, one for the upper half and one for the bottom half, and add them both to the body.
For example, if you wanted to make the bottom half a 2x4 rectangle, and the top half a 4x4 rectangle, you would do something like this:
    PolygonShape bottomHalfShape = new PolygonShape();
    bottomHalfShape.set(new Vector2[] {new Vector2(2, 0), new Vector2(4, 0), new Vector2(4, 4), new Vector2(2, 4)});
    PolygonShape topHalfShape = new PolygonShape();
    topHalfShape.set(new Vector2[] {new Vector2(0, 4), new Vector2(4, 4), new Vector2(4, 8), new Vector2(0, 8)});

    FixtureDef bottomHalf = new FixtureDef();
    bottomHalf.shape = bottomHalfShape;
    FixtureDef topHalf = new FixtureDef();
    topHalf.shape = topHalfShape;

    body.createFixture(bottomHalf);
    body.createFixture(topHalf);

Note that this is example code for libGDX, it may have to be modified slightly for AndEngine.


text:
Q: How to fold sub-vectors of an STL vector? Given a numeric vector, how can I fold its consecutive sub-vectors into a single, smaller vector? Using STL algorithms, of course.
For example folding the vector {1,2,3,4,5,6,7} with a sub-vector size of 3 and a sum operation should give {1+4+7,2+5,3+6}

A: This seems to do the trick.
Can be templated further to support operations other than addition.
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

template <typename T>
std::vector<T> foldSubVectors(const std::vector<T>& v, unsigned int foldSize)
{
    std::vector<T> result (foldSize, 0);

    unsigned int i = 0;
    for (i = 0; i + foldSize <= v.size(); i += foldSize)
        std::transform(result.begin(), result.end(), v.begin() + i,
                       result.begin(), std::plus<T>());
    if (i < v.size())
        std::transform(result.begin(), result.begin() + (v.size() - i),
                       result.begin() + i, result.begin(), std::plus<T>());

    return result;
}


text:
Q: Time Travel Debugging: How to do it in C#? In C++/Windbg, there is now Time Travel Debugging.
What is the path to do this in C#?
Note: I am looking for TTD from a C# app created in visual studio. Whether the TTD is in visual studio or in windbg (or some other tool) does not matter to me. The point is full TTD.
Intellitrace is not TTD. Intellitrace is an event and state capturing system. TTD is a "movie" of a debug dump, that allows you to capture the trace at run time, on any machine, and then replay your code in the debugger, as it executed during the run. You get full debug support, breakpoints, all variables, as it runs, and can play fwd and backward. TTD gives the full power of the interactive debugger, but disconnected in time and place from the actual execution being debugged.
NOTE TO SO COMMUNITY: MS is taking votes on this:

*

*https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/31652272-time-travel-debugging
and

*https://developercommunity.visualstudio.com/content/idea/351585/time-travel-debugging.html

A: Time Travel Debugging is a feature in Windbg, in VS, it doesn't have the same feature, but it has been submitted to the product team
NOTE ABOVE LINK HAS MIGRATED: and is now here: https://developercommunity.visualstudio.com/content/idea/351585/time-travel-debugging.html
You could vote and add your comment there.
In addition, like Aybe's suggestion,  IntelliTrace would be a simliar tool in VS IDE which could help you analyze code issue.

A: Yes nearly everything that works in a WinDbg Preview live debugging session for managed code works for a TTD session. You can use the SOS debugging extension (sos.dll) running in 64 bit mode to debug managed code using TTD in WindDbg Preview. There is an error in 32 bit mode that is being investigated.
See link for more details … https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/debugging-managed-code


text:
Q: Layer is not valid error when connecting QGIS to PostGIS I am new to QGIS.
I am trying to connect a view from PostGIS to QGIS (3.16.4, same with 3.12).
The PostGIS connection in QGIS browser have no issues and when "Test Connection" it says it can connect.
But when I am  trying to add the layer I am getting this error:

Layer is not valid: The layer dbname='dwa' host=localhost port=40802 user='user' password='user' key='"bin"' srid=4326 type=Polygon table="public"."height_grid_layer_view" (bin) is not a valid layer and can not be added to the map. Reason:

The pgAdmin 4 shows the view in Geometry Viewer without any problem with the SQL:
SELECT * FROM public.height_grid_layer_view
What can I do?


text:
Q: How is union find quadratic algorithm? In this implementation of Quick Find algorithm, Constructor takes N steps so does union().
The instructor said that union is too expensive as it takes N^2 to process sequence of N union commands on N objects, How can union be quadratic when it accesses array elements one at a time?
public class QuickFind
{
    private int[] id;

    public QuickFind(int N) {
        id = new int[N];
        for (int i=0; i<N; i++) {
            id[i] = i;
        }
    }

    public boolean connected(int p, int q) {
        return id[p] == id[q];
    }

    public void union(int p, int q) {
        int pid = id[p];
        int qid = id[q];

        for (int i=0; i<id.length; i++)
            if (id[i] == pid)
                id[i] = qid;
    }
}

A: Union operation for Quick Find is quadratic O(n^2) for n operations, because each operation takes O(n) time, as is easy to notice in for loop inside union(int p, int q)
    for (int i=0; i<id.length; i++)

Notice that the algorithm is called Quick Find, as each find (connected(int p, int q)) operation takes constant time. However for this algorithm you end up paying in union operation, as mentioned in your question.
There is another algorithm Quick Union, which improves time for union operation. But then find doesn't remain O(1) (but better than linear time).

A: Each invocation of union method requires you iterate over the id array, which takes O(n) time. If you invoke union method n times, then the time required is n*O(n) = O(n^2).
You can improve time complexity of union method to O(1), by making the time complexity of connected method higher, probably O(log n), but this is just one time operation. I believe that your text book explain this in details.


text:
Q: What does this text mean on the Apocalypse edition cover? Pre-ordered Dark Souls 3, got the same cover as the one below.
What language is it, and what does it mean?

A: It's Russian, means "Prohibited for children." I guess you have the Russian release of the game.
Also, as a little side note - in some countries it is actually illegal to sell M-rated games to children, that's why this text is on the cover.
After a check it turned out that the Apocalypse Edition of Dark Souls 3 does use the same cover for all European countries.


text:
Q: How to print row of dataframe that purrr::map is acting on in R I am using purrr::map to run a time-consuming function on a long data frame list-column and I want to print an indicator of the row that's being acted up so that I can keep track of progress.
Here's a small example:
When I run this:
library(dplyr)
library(tidyr)
library(purrr)
mtcars %>%
    group_by(carb) %>%
    nest() %>%
    mutate(n = map(data, nrow))

I would like to output the carb of the row that's being acted upon:
#> 4
#> 1
#> 2
#> 3
#> 6
#> 8

Which you could get by using a for loop like so:
df <-
    mtcars %>%
    group_by(carb) %>%
    nest() %>%
    mutate(n = NA)
for (i in 1:nrow(df)) {
    print(df$carb[i])
    df$n[i] <- list(nrow(df$data[[i]]))
}

A: You could run through carb at the same time you run through data using map2().  Then you can add a print() statement to your function to output the carb.
dat = mtcars %>%
    group_by(carb) %>%
    nest() %>%
    mutate(n = map2(data, carb, ~{
        print(.y)
        nrow(.x)
        })
        )

[1] 4
[1] 1
[1] 2
[1] 3
[1] 6
[1] 8

dat
# A tibble: 6 x 3
   carb data               n
  <dbl> <list>             <list>
1     4 <tibble [10 x 11]> <int [1]>
2     1 <tibble [7 x 11]>  <int [1]>
3     2 <tibble [10 x 11]> <int [1]>
4     3 <tibble [3 x 11]>  <int [1]>
5     6 <tibble [1 x 11]>  <int [1]>
6     8 <tibble [1 x 11]>  <int [1]>

I used the formula syntax for convenience, where .x refers to the first vector in map2() and .y the second.  You can do an anonymous function, instead, if it's clearer. (I'm not sure I love the brackets with the tilde.)
mtcars %>%
    group_by(carb) %>%
    nest() %>%
    mutate(n = map2(data, carb, function(x, y) {
        print(y)
        nrow(x)
        })
        )


text:
Q: distinct cyclic subgroups Let $ (G, *) $ be a group.
Say, $\langle a\rangle, \ \langle b\rangle$ are two cyclic subgroups of $G$ of equal orders.
Say $ \ o(a) = o(b) = n  \in \mathbb N , \ n > 1 $
CASE I: $\{ a^p : p \in\mathbb N, \ \gcd(p,n) = 1\} \cap \{ b^p : p \in\mathbb N, \ \gcd(p,n) = 1\} = \phi$
CASE II: $\ \langle a\rangle \not\subset \langle b\rangle \text{ and }\langle b\rangle \not\subset \langle a\rangle$
In both cases I have an intution that $\langle a\rangle \cap \langle b\rangle \ = \ \{e\}$
Anyone, if you can please prove or counter it.


text:
Q: Can I lean on that ajax callbacks will be executed in the order they are defined? If I have 2 ajax() functions inside of document.ready:
$(function() {
  ...
  $.ajax({ // 1st
    success: function (result) {
    ...
    });
  });
  ...
  $.ajax({ // 2nd
    success: function (result) {
    ...
    });
  });
  ...
});

and the 2nd's success results depends on 1st's success results, in that case the code is ok? Or should I put the 2nd ajax into the callback of the 1st?

A: Those are asynchronous calls, which means that event if the two calls are sent in the specified order, the answer can come from the server in any order. Thus, it is possible according to Murphy's law that the second callback would be called before the first. In that case, the variable you expected to be set would not be.
This explains why "erkaner" told you to put the second Ajax call in the success of the first one. This will garantee that the execution will take place in the expected order.

A: If the second one has to be executed ONLY if the first one is a success, yes you put it in the success of the first one

A: No, you cannot expect that the order of receiving responses to asynchronous ajax calls is the same as the order in which the ajax requests are sent.
http://api.jquery.com/jquery.ajax/ :
"... meaning that the operation occurs in parallel and the order of completion is not guaranteed. ..."


text:
Q: Is Array of size 0 illegal by definition? Is Array of size 0 illegal by definition or it depends on language?

A: It is not illegal by definition, yet it does depend on the language.  Java is fine with it, depending on the compiler used in C you might have trouble with it but in general it works there too.
Somewhat related discussion on C++ and zero length arrays: Array of zero length


text:
Q: remove elements from dictionary with recursive condition Given this dictionary:
{
'a': {'maxVal': 2653, 'startX': 610, 'startY': 761, 'endX': 632, 'endY': 783},
'b': {'maxVal': 2775, 'startX': 577, 'startY': 678, 'endX': 600, 'endY': 701},
'c': {'maxVal': 3431, 'startX': 610, 'startY': 733, 'endX': 632, 'endY': 755},
'd': {'maxVal': 1907, 'startX': 577, 'startY': 705, 'endX': 600, 'endY': 727},
'e': {'maxVal': 2489, 'startX': 610, 'startY': 705, 'endX': 632, 'endY': 727},
'f': {'maxVal': 1812, 'startX': 610, 'startY': 761, 'endX': 632, 'endY': 783},
'g': {'maxVal': 3888, 'startX': 610, 'startY': 761, 'endX': 632, 'endY': 783}
}

I need to do some "cleaning". I need to iterate through it and compare elemetents where the coords are the same and keep the one with the highest maxVal.
In the given example I would keep b, c, d,e and g

A: We can do something like this:
d = {
    'a': {'maxVal': 2653, 'startX': 610, 'startY': 761, 'endX': 632, 'endY': 783},
    'b': {'maxVal': 2775, 'startX': 577, 'startY': 678, 'endX': 600, 'endY': 701},
    'c': {'maxVal': 3431, 'startX': 610, 'startY': 733, 'endX': 632, 'endY': 755},
    'd': {'maxVal': 1907, 'startX': 577, 'startY': 705, 'endX': 600, 'endY': 727},
    'e': {'maxVal': 2489, 'startX': 610, 'startY': 705, 'endX': 632, 'endY': 727},
    'f': {'maxVal': 1812, 'startX': 610, 'startY': 761, 'endX': 632, 'endY': 783},
    'g': {'maxVal': 3888, 'startX': 610, 'startY': 761, 'endX': 632, 'endY': 783},
}

sorted_keys = sorted(d.keys(), key=lambda x: d[x]['maxVal'], reverse=True)

coordinates = set()
ans_keys = []

for key in sorted_keys:
    my_coordinates = (
        d[key]['startX'],
        d[key]['startY'],
        d[key]['endX'],
        d[key]['endY'],
    )
    if my_coordinates not in coordinates:
        ans_keys.append(key)
        coordinates.add(my_coordinates)

print(ans_keys)

Output:
['g', 'c', 'b', 'e', 'd']

A: You can create a dict with the coords as keys, and the key and the dict with the largest maxVal seen for these coords as value. Then, you can build your output from it. As no sorting is involved, this will work in O(n).
data = {
'a': {'maxVal': 2653, 'startX': 610, 'startY': 761, 'endX': 632, 'endY': 783},
'b': {'maxVal': 2775, 'startX': 577, 'startY': 678, 'endX': 600, 'endY': 701},
'c': {'maxVal': 3431, 'startX': 610, 'startY': 733, 'endX': 632, 'endY': 755},
'd': {'maxVal': 1907, 'startX': 577, 'startY': 705, 'endX': 600, 'endY': 727},
'e': {'maxVal': 2489, 'startX': 610, 'startY': 705, 'endX': 632, 'endY': 727},
'f': {'maxVal': 1812, 'startX': 610, 'startY': 761, 'endX': 632, 'endY': 783},
'g': {'maxVal': 3888, 'startX': 610, 'startY': 761, 'endX': 632, 'endY': 783}
}

by_coords = {}
for key, v in data.items():
    coords = (v['startX'], v['startY'], v['endX'], v['endY'])
    max_val = v['maxVal']
    if by_coords.setdefault(coords, (key, v))[1]['maxVal'] < max_val:
        by_coords[coords] = (key, v)

out = {}
for coords, (key, v) in by_coords.items():
    out[key] = v

print(out.keys())
# dict_keys(['g', 'b', 'c', 'd', 'e'])
# They are the ones we expected.

print(out)
#{'g': {'maxVal': 3888, 'startX': 610, 'startY': 761, 'endX': 632, 'endY': 783},
# 'b': {'maxVal': 2775, 'startX': 577, 'startY': 678, 'endX': 600, 'endY': 701},
# 'c': {'maxVal': 3431, 'startX': 610, 'startY': 733, 'endX': 632, 'endY': 755},
# 'd': {'maxVal': 1907, 'startX': 577, 'startY': 705, 'endX': 600, 'endY': 727},
# 'e': {'maxVal': 2489, 'startX': 610, 'startY': 705, 'endX': 632, 'endY': 727}}

A: # your dictionary
x = {'a': {'maxVal': 2653, 'startX': 610, 'startY': 761, 'endX': 632, 'endY': 783},
'b': {'maxVal': 2775, 'startX': 577, 'startY': 678, 'endX': 600, 'endY': 701},
'c': {'maxVal': 3431, 'startX': 610, 'startY': 733, 'endX': 632, 'endY': 755},
'd': {'maxVal': 1907, 'startX': 577, 'startY': 705, 'endX': 600, 'endY': 727},
'e': {'maxVal': 2489, 'startX': 610, 'startY': 705, 'endX': 632, 'endY': 727},
'f': {'maxVal': 1812, 'startX': 610, 'startY': 761, 'endX': 632, 'endY': 783},
'g': {'maxVal': 3888, 'startX': 610, 'startY': 761, 'endX': 632, 'endY': 783}
}

temp = {}
for key  in x.keys():
    # creating cordinate map
    cord = '{}-{}-{}-{}'.format(x[key]['startX'],x[key]['endX'],x[key]['startY'],x[key]['endY'])
    if cord not in temp.keys():
        temp[cord] = [key]
    else:
        key1 = temp[cord][0]
        # checking the max value
        if x[key1]['maxVal'] < x[key]['maxVal']:
            temp[cord] = [key]

print(temp.values())
# dict_values([['g'], ['b'], ['c'], ['d'], ['e']])


text:
Q: Is there anything on iOS that would cause your mail pulls to be set to manual? I had a user come in where I work, and she said that she didn't get emails on her iPhone 4; she was running iOS7.  I have an iPhone 5c, and I failed to receive emails around 8:30 PM today.
Her issue was that in her settings her mail had been set to only update manually.  When I checked my phone, mine had also been set to manual.  They're both phones that have been setup recently, is that the default setting?  Or does it get set when it is placed on do not disturb?  I'm really concerned about this because both of us missed important emails.


text:
Q: Unable to run chmod, chown, and even ls on a folder I searched the net and tried to apply answers to similar problems but none worked so far. There is a folder named ocrpaylasim under /home/bnet path. This file belonged to bnet user before and was attached/mounted to a Windows shared folder through fstab. However, the permissions seem to be broken. I can't even run ls.
When I try to change the folder with chown and chmod, I am getting Permission Denied error. Even root can't do anything (ls, rm, chmod, and chown are not working)
The error message is:
ls: cannot access ocrpaylasim: Permission denied
chown: cannot access ocrpaylasim: Permission denied
chmod: cannot access ocrpaylasim: Permission denied

Edit 1:
ls -lad /home
drwxr-xr-x 3 root root 4096 May 14 15:24 /home/

ls -lad /home/bnet
drwxr-xr-x 7 bnet bnet 4096 Oct  7 17:18 /home/bnet

id (with root)
uid=0(root) gid=0(root) groups=0(root)

ls -ld /home/bnet (with root)
drwxr-xr-x 7 bnet bnet 4096 Oct  7 17:18 /home/bnet

id (with bnet)
uid=1000(bnet) gid=1000(bnet) groups=1000(bnet),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),110(lpadmin),111(sambashare)

Edit 2:
ls -la
ls: cannot access ocrpaylasim: Permission denied
total 1692100
drwxr-xr-x 7 bnet bnet       4096 Oct  7 17:18 .
drwxr-xr-x 3 root root       4096 May 14 15:24 ..
-rwxr-xr-x 1 bnet bnet      11907 Sep  6 08:26 .bash_history
-rwxr-xr-x 1 bnet bnet        220 May 14 15:24 .bash_logout
-rwxr-xr-x 1 bnet bnet       3637 May 14 15:24 .bashrc
drwxr-xr-x 2 bnet bnet       4096 May 14 15:25 .cache
d????????? ? ?    ?             ?            ? ocrpaylasim
-rwxr-xr-x 1 bnet bnet        675 May 14 15:24 .profile
drwxr-xr-x 2 bnet bnet       4096 Jul  1 15:41 .ssh
-rwxr-xr-x 1 root root       3402 Aug 13 10:25 .viminfo

Edit 3:
sudo chmod -R u=rwx,g=r,o=r /home/bnet/ocrpaylasim
chmod: cannot access '/home/bnet/ocrpaylasim': Permission denied
sudo chown -R bnet:bnet /home/bnet/ocrpaylasim
chown: cannot access '/home/bnet/ocrpaylasim': Permission denied

Edit 4:
mount
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
//**.**.**.**/temp on /home/bnet/ocrpaylasim type cifs (rw)

A: Since that folder is the mount point of a CIFS file system, lstat() system calls (as made by ls, but also chmod/chown... if only to determine the type of the file) mean a request sent to the remote server.
Here, most probably, the request is being denied by the remote host and there's not much you can do on the local machine. You should address the issue on the remote server.
To investigate further, you can try and capture the CIFS network capture and examine the request and responses with wireshark for instance.


text:
Q: Error on $.post of Form I am trying to submit a form using JQuery to a PHP page. But I get the following error when I try to run the script from Chrome:
    Uncaught SyntaxError: Unexpected token ;       jquery-latest.js;614

Line 614 is part of the GlobalEval function.
globalEval: function( data ) {
    if ( data && rnotwhite.test( data ) ) {
        // We use execScript on Internet Explorer
        // We use an anonymous function so that context is window
        // rather than jQuery in Firefox
        ( window.execScript || function( data ) {
            window[ "eval" ].call( window, data );
// **** Uncaught SyntaxError: Unexpected token ; **** //
        } )( data );
    }
},

This is my code for my form and JQuery submit.

  <form name="new-event" method="post" id="new-event">
    Name of the event: <input type="text" name="event-name">

    Date of the event: <input type="date" name="date">

    Location of the event: <input type="text" name="location">

    Description: <textarea cols="50" rows="5" name="description"></textarea>

    Submit

  </form>

Then my 'post-event.php' script is this:
<?php
echo "Hello";
?>

Any help is much appreciated.

A: $('#event-submit').click(
    $(this).parents('form:first').submit();
 );

After changing the click function into the code below it worked for me.
$('#event-submit').click(function(){
    $(this).parents('form:first').submit();
});

You were missing the function() reference.


text:
Q: Turning all variables in each row into a percentage of the sum of each row? I am using the dataframe "death rates in Virginia" for a class project. I need to normalize the data so that they can be compared and analyzed. Is there a way for me to take each row and calculate the percentage of each value from each row instead of doing it manually?
for example if I have a row of 1, 2, 3, 4, 5: I would like to sum do the following to each individual object in the row: x/sum of all objects * 100.
is there a quick way to do this to each row? Thanks

A: with base functions
dummy_df <- data.frame(a=sample(1:100,20),b=sample(1:100,20),c=sample(1:100,20))

t(apply(dummy_df,1,function(x) {100*(x/sum(x))}))


text:
Q: How to get data to work when used within a component and Axios? I'm new to Vue.js and Axios. I don't quite understand how to get the data option to work when used within a component.
Why doesnt' my test work?
I get the following error in the console:

[Vue warn]: The "data" option should be a function that returns a per-instance value in component definitions.

[Vue warn]: Property or method "symbols" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option. (found in root instance)

My simple test:
My data (snipped for brevity):
[{"id":1, "name": "Airfield"}, {"id":2, "name": "Ship Yard"}]

My component:
Vue.component('symbols-table', {
    template: '
Hello World
',
    data: {
        symbols: []
     },
     created: function(){
         axios.get('symbols.json').then(response => this.symbols = response.data);
      }
});

Vue instance:
var app = new Vue({ el: '#app' });

My HTML:
<symbols-table>

{{symbol.name}}

</symbols-table>

A: data inside a Vue Component should be a function that returns an object, as described in the Vue.js common gotchas.

A: As the error is saying:

The "data" option should be a function

In the component, the data must be a function, you need to modify the data block to be a function which will return the data structure to be used in DOM in a reactive way:
Vue.component('symbols-table', {
    template: '
Hello World
',
    data: function() {
         return  {
           symbols: []
         }
    },
    created: function(){
        axios.get('symbols.json').then(response => this.symbols = response.data);
    }
});

A: You can type simply like this:
data() {
    return {
        ...... tra-ta-ta.......
    }
},


text:
Q: Acer e5-721 touchpad Touchpad l and screen dimmer doesn't work on new Ubuntu 14.04 install.  Fn f7 doesn't do anything.  And dimmer doesn't do anything.

A: Try installing proper drivers for Touchpad and hotkeys. You should consider contacting the laptop vendor's website for help on this!


text:
Q: Using python's mock patch for changing the return value of a method called in a method used within another method Is it possible to mock a return value of a function which is called within a function which again is used in another method? I know it is a very complicated structure. I would like the mocked method to return a specific value. The following example shows the structure:
#foo.py
from bar import other_method

class Foo:
    def method_1():
       results = other_method()

#bar.py

def method_to_be_patched():
    return 'abc'

def other_method():
    res = method_to_be_patched()
    ...
    return 'result'

I would like to test method_1 and patch the method_to_be_patched. I read a related issue (Using python's mock patch.object to change the return value of a method called within another method) and tried the following
#test.py
from unittest import TestCase
from unittest.mock import patch
from foo import Foo

patch_value = '123'

class Test(TestCase):
   def setUp(self):
       self.foo = Foo()

   @patch('Foo.other_method.method_to_be_patched', return_value = patch_value)
   def test_method_1(mocked_method):
       self.foo.method_1()

I would expect that the patch would return the patched value at the point where method_to_be_patched is called within self.foo.method_1(). But the interpreter displays the error message "function other_method at ... does not have the attribute 'method_to_be_patched'"


text:
Q: Controlling the access of method Is there a way to write a Web program when you would deliberately specify which classes are allowed to invoke  this or that method? I am writing Web app in Java and using Spring Web MVC. If it is possible please tell me about the methods or technologies being used for that.
Best regards

A: That should be a design decision if your are building a framework of some kind, so use what language gives you, like access modifiers (private, public and such...).
Even restricting access like this, you can still have code call your methods using reflection, so there is no safe-guard if that's what you want (but "safeguarding" anything like this makes no sense anyway, so... )
Can you describe what are you exactly trying to do?

A: You might want to look up http://download.oracle.com/javase/1.4.2/docs/api/java/lang/SecurityManager.html documentation.


text:
Q: Same awg wire but larger diameter on one? I bought 22 awg wire from the same seller twice at different times. When I bought it the second time, I noticed that one of the wire including the insulation is noticeably larger. Does this 100% mean that the wire gauges are different, or is it possible that both wires have the same number of strands but one has thicker insulation resulting in a larger diameter wire?

A: The AWG only tells you the total cross-sectional area of all the strands (or that of a single strand). The conductor diameter can vary slightly with the number of strands.
The number of strands and the insulation thickness is not part of the AWG designation.
For example, this catalog sheet shows 4 different possibilities for stranded AWG 20 wire (solid is not included):
10/30, 19/32, 26/34, and 41/36.
The finest stranding is 41/36 which is 41 strands of AWG36 wire. Because the strand diameters are rounded to even AWG numbers (and, of course, must be integer number of strands) there are slight differences in the cross-sectional area from the ideal.


text:
Q: My node package's quality score went from 99% to 65% on an update The goal of the update was to add the files property to the package.json to lead to a smaller download.  Nothing else but the readme changed.
Code coverage is still 100%.  Issues are closed.  There are no outstanding PRs.
I used to have the second or third spot on NPM for all my relevant search terms.  Now I'm not on the front page.
When I look at npms.io, the score is for a version from two months ago.  I don't know how to get it updated.  That version is quality 99.99%
How do I diagnose what is downgrading my quality score?
https://www.npmjs.com/package/jssm

Edit: oh, wow.  I removed the files section and the quality went back up to 95.
Either the presence of a files section broke it, or the quality is somehow dependent on a file I was excluding


text:
Q: What causes the ["String" has no subfields] image error in GraphQL/Gatsby? The whole error message on terminal is:
error GraphQL Error Field "image" must not have a selection since type "String" has no subfields.

This seems like a real doozy of an error, it appears here:
gatsby issue 4123
gatsby issue 11412
gatsby issue 11534
gatsby issue 2050
gatsby issue 3531
gatsby remark plugin issue 2
netlify-cms issue 325
As well as several Stackoverflow questions/answers.
But the answers/fixes are all over the place. Some people are spelling their files wrong or ordering plugins wrong (I think). Other times, the person needs to do a big rewrite within exports.onCreateNode in gatsby-node.js. Other times the fix is to reclone your repo and run npm install again.
Anyway, I've tried what feels about everything. It seems many dozens or hundreds more people will have this error when they try to get started with Gatsby. What should they check? Where should they start to fix this? There seem to be 7 potential things to check...

A: This error seems to be caused by a wide variety of things. In my case, it was the order in gatsby-config.js. I had to move gatsby-plugin-sharp, gatsby-transformer-sharp, and gatsby-transformer-remark above my file system plugins.
For many others (if you search through those issues I mentioned):

*

*check spelling

*check you have the right plugins (period)

*check plugin order

*use graphiql to see if you're getting a string for the images vs. an actual node (you can use transformers on a node but not a string)

*delete .cache and node modules and reinstall

good luck, you'll never get those 12 hours of your life back.

A: To add to the checklist when encountering this error:
Make sure you actually have images in the folder configured in gatsby-conf.js:
{
  resolve: `gatsby-source-filesystem`,
  options: {
    name: `images`,
    path: `${__dirname}/src/images`,
  },
}

and that they match whatever path is in your graphql. If "myImage.png" is returned by your query but this is not a file in your images, you will get this error.


text:
Q: Unity3D moving with Character Controller I'm having a capsule with a Character Controller component implemented. To move it I'm using:
public float player_speed=0.6f;
if(Input.GetKey(KeyCode.W)){
    this.GetComponent<CharacterController>().Move(new Vector3(transform.forward.x*player_speed,0f,transform.forward.z*player_speed));
}

But when I set the value of player_speed to 0.3f, it starts flying. I don't know why.
Could somebody please explain this to me?

A: Character Controller does not automatically add gravity, so you'll need to implement that yourself. The simplest way to do this is usually to keep gravity at 0 (or a small number) if the character is grounded, and then if he's not grounded, gradually increase the gravity strength (up to a maximum).


text:
Q: How do I call a function with parameters stored in an array? I have an array of functions:
$functions = array(
    "sum" => function($v1, $v2) {
        $s = $v1 + $v2;
        return $s;
    }
);

Now, I'm confused about how to call this specific function -
echo $functions["sum"](1,2); //suppose to echo 3

doesn't work.

A: Do like this
<?php

$functions = array(
    "sum" => function($v1, $v2) {
        $s = $v1 + $v2;
        return $s;
    });

echo $functions['sum'](1,2); //"prints" 3

Demo

A: Edit:

*

*The OP added the missing semi-colon in question just now, which is the obvious problem.

*The OP edited the question with the added semi-colon during the 5 minute grace period, therefore the original missing semi-colon isn't showing in the edit. (I know what I saw)

Tested and working
The error is the missing semi-colon at the end of
echo $functions["sum"](1,2)

make it:
echo $functions["sum"](1,2);

which I tested to output as 3

Fully tested and working code, output 3 - adding missing semi-colon at the end of the echo.
<?php

$functions = array(
    "sum" => function($v1, $v2) {
        $s = $v1 + $v2;
        return $s;
    }
);

echo $functions["sum"](1,2); // echos 3

This one prints 10
<?php

$functions = array(
    "sum" => function($v1, $v2) {
        $s = $v1 + $v2;
        return $s;
    }
);

echo $functions["sum"](1,9); // prints 10

Multiplication method using 2 and 9 outputs 18
<?php
$functions = array(
    "sum" => function($v1, $v2) {
        $s = $v1 * $v2;
        return $s;
    }
);

echo $functions["sum"](2,9); // echos 18

A: Works fine here:
php > $funcs = array('sum' => function($v1, $v2) { return $v1 + $v2; });
php > echo $funcs['sum'](1,2);
3
php > echo $funcs['sum']('foo','bar');
0


text:
Q: How to access the "isPreparedToPlay"-property within a "MPMoviePlayerController"-instance? HI,
i´ve created a new MPMoviePlayerController instance and init that with a contentURL like this:
    player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:url]];
    player.view.frame = rect;
    [myView addSubview:player.view];
    [player play];

Although "play" is a instance variable of the "MPMediaplayback", i can´t get the "isPreparedToPlay" property.
EDIT:
I´ve read that if i want to use the "MPMediaPlayback"-protocol, i have to add it in my @interface like this:
@interface MyViewController : UIViewController <MPMediaPlayback>

But how can i use these properties correctly?
Why? Using SDK4.0. Thanks for your time.

A: You do not need to add any protocols, the documentation was indicating that the method is part of the MPMediaPlayback protocol (which the MPMoviePlayer object implements).
You should be able to write the following:
BOOL ready = [player isPreparedToPlay];

You may need need a header file.
#import <MediaPlayer/MediaPlayer.h>

Good luck.


text:
Q: How to supply argument to pure function when slot is already defined? Here's an example of a pure function:
3^# > 100 &

I can supply any value I please to the function, by placing that value after the prefix. E.g.:
3^# > 100 & @ 8

True

But suppose we have a pure function that already has an argument.  E.g., here the argument is {2, 6, 8, 4}:
AllTrue[{2, 6, 8, 4}, # < 10 &]

True

Further suppose I want to create a new pure function that takes the test value in the inequality as an argument.  I.e., instead of using a fixed test value (in this case, 10), I want the function to be able to take any test value.
I can accomplish this using a traditional function definition:
f[n_] := AllTrue[{2, 6, 8, 4}, # < n &]
f[10]

True

But is there a simple way to accomplish this entirely with a pure function?  In pseudocode, it would look something like this, where the value after the prefix is inserted in place of the ?:
AllTrue[{2, 6, 8, 4}, # < ? &] @ 10

True

A: If you don't want to follow some suggestions made in comments and use the Function with named arguments (and there may be valid reasons to be willing to avoid that), you can use With instead:
fn = With[{n = #}, AllTrue[{2, 6, 8, 4}, # < n &]] &

So that
{fn[5], fn[10]}

(* {False, True} *)


text:
Q: Java Broadcasting and listening on same port How can broadcast a message from single server to multiple clients and listen for a reply from one of the clients.
I used Multicast Programming to broadcast the message to the clients. And If i send the message from one of my clients back to the server either through TCP or UDP, I am getting a "java.net.ConnectException: Connection refused: connect" exception.
Please help me out.
Thanks in Advance.
Sender Code :
// Broadcasting the message
    msg = "This is multicast! " + counter;
                counter++;
                outBuf = msg.getBytes();

                // Send to multicast IP address and port
                InetAddress address = InetAddress.getByName("224.2.2.3");
                outPacket = new DatagramPacket(outBuf, outBuf.length, address,
                        PORT);

                socket.send(outPacket);

                System.out.println("Server sends : " + msg);

                socket.close();

                // Receiving TCP
                apSock = new Socket("131.151.88.165", 6161);
                apBuffReader = new BufferedReader(new InputStreamReader(
                        apSock.getInputStream()));
                while ((ap2Toap1 = apBuffReader.readLine()) != null) {
                    System.out.println(ap2Toap1);
                }

Receiver Code :

count++;
                inPacket = new DatagramPacket(inBuf, inBuf.length);
                socket.receive(inPacket);
                String msg = new String(inBuf, 0, inPacket.getLength());
                System.out.println("From " + inPacket.getAddress() + " Msg : "
                        + msg);

                socket.close();

                // Sending TCP
                apSock = new Socket("131.151.88.165", 6161);
                System.out.println("Hello2");
                respWriter = new PrintWriter(apSock.getOutputStream());
                System.out.println("Writing back to the server");
                respWriter.println(outBuf);
                if (respWriter != null)
                    respWriter.close();

A: There is no listening in your code. TCP listening in Java is accomplished via a ServerSocket. You aren't using one. Instead you're using Sockets at both ends. So what you have is two clients and no server. No communication is possible between two TCP clients.


text:
Q: AS3 - The supplied DisplayObject must be a child of the caller error while removing swf please help i am getting this error and could not solve with any of the other methods described in all previous posts with similar topic.
Actually here i am loading a swf myMap onto another swf.
The swf loading works fine, but when try to remove this from stage i get the above said error...
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/removeChild()
    at actions.classes::MapInteractionManager/unloadSWF()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()

Here's my as3 code...
 var _swfLoader:Loader;
    var _swfContent:MovieClip;

    loadSWF("myMap.swf");  //loading the swf file here

    function loadSWF(path:String):void {
       var _req:URLRequest = new URLRequest();
       _req.url = path;

       _swfLoader = new Loader();
       setupListeners(_swfLoader.contentLoaderInfo);

       _swfLoader.load(_req);
    }

    function setupListeners(dispatcher:IEventDispatcher):void {
       dispatcher.addEventListener(Event.COMPLETE, addSWF);
       dispatcher.addEventListener(ProgressEvent.PROGRESS, preloadSWF);
    }

    function preloadSWF(event:ProgressEvent):void {
       var _perc:int = (event.bytesLoaded / event.bytesTotal) * 100;
       // swfPreloader.percentTF.text = _perc + "%";
    }

    function addSWF(event:Event):void {
       event.target.removeEventListener(Event.COMPLETE, addSWF);
       event.target.removeEventListener(ProgressEvent.PROGRESS, preloadSWF);

       _swfContent = event.target.content;
       _swfContent.addEventListener("close", unloadSWF);

       main.stage.addChild(_swfContent);
    }

    function unloadSWF(event:Event):void {
       _swfLoader.unloadAndStop();

    main.stage.removeChild(_swfContent);  //getting error when trying to remove swf
       _swfContent = null;
    }

    and close event is as,
    _swfContent.dispatchEvent(new Event("close"));

Please help, I'm stuck.
here with some update,
i updated code as,
function unloadSWF(event:Event):void
{
     if(main.stage.contains(_swfContent))
           main.stage.removeChild(_swfContent);
}

Now the error is gone as it is not entering the if loop!!!???
But still i can see that swf on stage:(  plz help
GOT SOLVED...
Thanks everyone for helping...
ToddBFisher did solve it:)
Simply added the _swfLoader to the stage, loaded it, and attached the close listener to it instead of even having a _swfContent. Cut out the middle man and it worked.... Hope this helps...

A: As I recall .unloadAndStop(); does a bunch of cleanup type things, which you are calling right before. It is possible part of the cleanup is removing it from the display list.
Try calling the removeChild() before calling unlodaAndStop()
function unloadSWF(event:Event):void {
    stage.removeChild(_swfContent);  //getting error when trying to remove swf
    _swfLoader.unloadAndStop();
    _swfContent = null;
}

EDIT
Try simply adding the _swfLoader to the stage, load it, and attach the close listener to it instead of even having a _swfContent. Cut out the middle man and see what happens.

A: The error means the child is already removed (or never added)
try to comment out
_swfLoader.unloadAndStop();
to see if it works.

A: main.stage.removeChild is already setting  _swfContent to null because removeChild was fired so  removing the line _swfContent = null might solve it.


text:
Q: Wowza: get thumbnail with 1 out put video file I'm using Wowza for recording a live stream. I want to get a thumbnail of the live stream. I followed this tutorial
http://blog.svnlabs.com/wowza-live-stream-thumbnail-images-with-http-provider/
Then when I record stream, it saved about 4 video file:
streamname.mp4,
streamname_160p.mp4,
streamname_320p.mp4,
streamname_source.mp4

Is there any way to save only 1 video file "streamname.mp4" but could still get the thumbnail by URL as the above tutorial mentions?
Thanks for all your help!

A: There is no way.
We have to remain at least one of extending file
e.g
streamname.mp4,
streamname_160p.mp4,


text:
Q: Can't find nix-env or nix-build on MacOS Catalina I can't find nix-env, nix-build, nix-shell etc. on MacOS Catalina.
I installed with:
sh <(curl https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume

and was able to run them yesterday. I restarted my computer and can no longer find them. find / -name nix-env | grep nix-env shows nothing.
I tried installing again with the same command (sh <(curl https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume) but this time it exists immediately with 0 status code.
I suspect I need to do something to mount a virtual drive.

A: You should follow Notes on the recommended approach.
It looks like the volume is not mounted (check /etc/fstab state with vifs as described in documentation).

A: Use the Disk Utility UI to remove the nix volume (sudo rm -rf /nix won't work).
Then run the script again and cross fingers your fingers this time: sh <(curl https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume

A: While Nix (amongst others) installs with bash newer MacOS do use zsh instead of bash.
So you need to update your .zshrc to source this command from bash, too.
In your terminal start editing with:
sudo nano ~/.zshrc

and add:
source ~/.nix-profile/etc/profile.d/nix.sh

Reload and test with
source ~/.zshrc; nix --version


text:
Q: imul then mov vs mov then imul - any difference? If I compile the following C++ program:
int baz(int x) { return x * x; }

in clang 15, I get:
baz(int):
        mov     eax, edi
        imul    eax, edi
        ret

while gcc 12.2 gives me:
baz(int):
        imul    edi, edi
        mov     eax, edi
        ret

(See this on GodBolt)
Are these two implementations entirely equivalent, and merely a matter of arbitrary choice? If they're not equivalent, how can their difference manifest, or affect my program? I mean, in terms of CPU-state side-effects, latencies of other instructions, behavior during inlining etc.

A: Do mov then imul because it's better with mov-elimination, and not worse anywhere for any other reason.
This is true in general for mov/and, mov/sub, etc, as long as you don't have a use for the original value.  If you do, then sometimes mov to make a copy and then modify the original to hide mov latency for CPUs without move elimination.  (mov/add or small shift should normally be lea).
CPU with mov-elimination
mov then imul is strictly better; overwriting a mov reg,reg result lets Intel CPUs free some resources they use to track mov elimination.  (Probably something like a reference count for extra references beyond the normal RAT.)  This increases the likelihood of later mov-eliminations being successful.  See How do *move elimination* slots work in Intel CPU?
All else essentially equal (as in this case), prefer to mov then overwrite its result, especially when that doesn't make things worse for CPUs without mov-elimination (like Ice Lake, thanks Intel.)
It doesn't have to be in the next instruction, just sometime soon, preferably not left indefinitely e.g. for a long-running loop.  But even that isn't a disaster usually.
To measure this benefit, a microbenchmark would probably need to do a lot of mov instructions that don't overwrite their result, to run the CPU out of mov-elimination slots and have some of them need an execution unit.  The microbenchmark would also need to be sensitive to the latency of those mov instructions, since most modern Intel CPUs have enough execution units to keep up with the issue/rename width in terms of throughput.
CPU without mov-elimination
mov reg,reg has 1 cycle latency.  If you'd been doing x*y with two separate inputs, mov then imul makes that latency part of the input->output latency for one input but not the other.  The other has an extra cycle to become ready before the imul would have to wait for it, if out-of-order exec would tend to have one input ready before the other.
(A compiler would typically have no way to guess which input was the result of a long dep chain vs. a mov-immediate when compiling a non-inline function, but a 50/50 chance of winning a cycle is better than having the mov always on the critical path after the imul.)
But with x*x without mov-elimination, the only difference is that we're writing both EDI and EAX, instead of writing EAX twice.  I don't think that's significant in terms of using up physical-register-file (PRF) entries or freeing them sooner.  Since most code-gen is trying to be good across multiple CPUs, favour mov then imul because some CPUs do have mov-elimination.  It's essentially a tie for CPUs without, when you're squaring one variable.

Things that don't matter
On a CPU that does partial register renaming, writing a register might free up two physical-register-file (PRF) entries instead of just one.  (While allocating a new PRF entry either way.)  But just reading the full register would already insert a merging uop.
Intel Sandybridge-family is the only x86-64 microarchitecture that does partial-register renaming and uses a PRF.  Intel P6 family (Nehalem and earlier) keeps results right in the ROB, associated with the uop that produced them, until commit to a separate "retirement register file"; this is why it has register-read stalls when you read too many "cold" registers.  Only Sandybridge itself (and possibly Ivy Bridge) rename low-8 registers like DIL and DL separate from full registers; on Haswell/Skylake and later only high-8 registers like DH get renamed separately.
Anyway, DIL might have been renamed separately from the full RDI.   There is no DIH equivalent of DH or CH, since we're talking about EDI not EDX or ECX (the next two arg-passing registers), and gcc/clang very rarely generate code that writes high-8-bit registers.  (Why doesn't GCC use partial registers?)
But either mov/imul or imul/mov will merge DIL into RDI before EDI is read, whether it's written or not (by the same imul uop).  Same for DH on Haswell and later if we had an arg in EDX.


text:
Q: Set "publish to web" in Google spreadsheet using Drive API (PHP) I am trying to use the Google Drive API to set a Google Sheet into "Publish to Web" mode so that I can embed it on my website.
Using the Drive API in my PHP:-
// Get the API client and construct the service object.
$client = getClient();
$service = new Google_Service_Sheets($client);

$driveservice = new Google_Service_Drive($client);
/*
$copiedFile = new Google_Service_Drive_DriveFile(array('name' => 'Project plan'));
$responseBody=$driveservice->files->copy("1hAjKEox4hhlK4aoCVLuUVfTJbKPhFklG1gG9-HsGH7U", $copiedFile);
$sheet_id=$responseBody->id;
*/
$sheet_id="1tYktONmPaaxGaS5ylNn8nTzPjtdEsuYIDHakhap8Amk";
$revisions=$driveservice->revisions;
$sheetinformation =$revisions->listRevisions("1tYktONmPaaxGaS5ylNn8nTzPjtdEsuYIDHakhap8Amk");
$revisions=$sheetinformation->getRevisions();
$count=count($revisions);
$revision_id=$revisions[$count-1]->id;
$finalrevision=$driveservice->revisions->get($sheet_id,$revision_id);
$finalrevision->publishAuto=true;
$driveservice->revisions->update($sheet_id,$revision_id, $finalrevision);

die();

As far as I can tell this conforms to the Drive API specification (I really wish they hadn't removed the code examples for PHP!). However, I am getting the following error returned in the Response body:-
"error": {
  "errors": [
   {
    "domain": "global",
    "reason": "fieldNotWritable",
    "message": "The resource body includes fields which are not directly writable."
   }
  ],
  "code": 403,
  "message": "The resource body includes fields which are not directly writable."
 }
}

Any help would be appreciated!

A: Add parameters when getting finalrevision:
$finalrevision=$driveservice->revisions->get($sheet_id,$revision_id, array('fields' => 'publishAuto'));

Without last parameter, get method will return you whole revision (with all fields, including read only ones).