text:
Q: R - How to compare two correlation matrices I have two correlation matrices coming from the same variables (divided into two groups due to the presence of a particular event). I would compare these two matrices to show the differences in correlation between variables, between the matrices.
For example: correlation A/B (group1) and correlation A2/B2 (group2).
correlation A/B -> r=0.80 with p<0.05
correlation A2/B2 -> r= -0.75 with p<0.01
They are the same variables, but the correlations in both groups are different. How can I show these changes? (I link you just a part of the whole data)
cor1<-cor(studiorun1)
> cor1
            incl_tronco   flex_anca    flex_gin  flex_piede
incl_tronco  1.00000000 -0.51666078 -0.48379787 -0.05542376
flex_anca   -0.51666078  1.00000000  0.02818835 -0.30307174
flex_gin    -0.48379787  0.02818835  1.00000000  0.24496844
flex_piede  -0.05542376 -0.30307174  0.24496844  1.00000000

> cor2<-cor(studiorun2)
> cor2
            incl_tronco  flex_anca   flex_gin  flex_piede
incl_tronco   1.0000000 0.04246250 -0.0411276 -0.17144055
flex_anca     0.0424625 1.00000000  0.9165774  0.07296401
flex_gin     -0.0411276 0.91657743  1.0000000  0.19867732
flex_piede   -0.1714406 0.07296401  0.1986773  1.00000000

A: You can perform $2^3$ linear regression models. Stack the datasets with an indicator for studiorun1 versus studiorun2 (i.e. 0 for rows in studiorun1 and 1 for rows in studiorun2). For any pairwise correlation you wish to test, you have as a regressor the first variable of interest, and as the outcome the second variable of interest, include also as regressors the dataset indicator and its interaction with the first variable of interest. If the interaction term is significant, the pairwise correlation is statistically significant. For a global test, adjust the significance levels according to some multiple testing procedure, like Hochberg stepdown, and recalculate the p-values for all 8 analyses.


text:
Q: How to merge xml tags based on two different tags? In the below sample xml ASNOutDesc can have multiple ASNOutDistro's and each ASNOutDistro can have multiple ASNOutCtn's, under each ASNOutCtn there can be multiple ASNOutItem, All items under each ASNOutCtn must be merged and the unit_qty must be added. Iam trying with the below xslt, but it is merg
Input XML:
<ASNoutDesc>
  <ASNOutDesc>
    <to_location>14</to_location>
    <from_location>777</from_location>
    <asn_nbr>Bol1</asn_nbr>
    <container_qty>3</container_qty>
    <shipment_date>2012-04-20T15:37:30.757</shipment_date>
    <ASNOutDistro>
      <distro_nbr>101</distro_nbr>
      <distro_doc_type>A</distro_doc_type>
      <ASNOutCtn>
        <container_id>1</container_id>
        <ASNOutItem>
          <item_id>item-1</item_id>
          <unit_qty>2</unit_qty>
        </ASNOutItem>
        <ASNOutItem>
          <item_id>item-1</item_id>
          <unit_qty>2</unit_qty>
        </ASNOutItem>
      </ASNOutCtn>
    </ASNOutDistro>
    <ASNOutDistro>
      <distro_nbr>102</distro_nbr>
      <distro_doc_type>A</distro_doc_type>
      <ASNOutCtn>
        <container_id>2</container_id>
        <ASNOutItem>
          <item_id>item-1</item_id>
          <unit_qty>2</unit_qty>
        </ASNOutItem>
        <ASNOutItem>
          <item_id>item-2</item_id>
          <unit_qty>2</unit_qty>
        </ASNOutItem>
        <ASNOutItem>
          <item_id>item-2</item_id>
          <unit_qty>2</unit_qty>
        </ASNOutItem>
      </ASNOutCtn>
      <ASNOutCtn>
        <container_id>3</container_id>
        <ASNOutItem>
          <item_id>item-1</item_id>
          <unit_qty>2</unit_qty>
        </ASNOutItem>
        <ASNOutItem>
          <item_id>item-2</item_id>
          <unit_qty>2</unit_qty>
        </ASNOutItem>
      </ASNOutCtn>
    </ASNOutDistro>
  </ASNOutDesc>
</ASNoutDesc>

Required output:
<ASNoutDesc>
  <ASNOutDesc>
    <to_location>14</to_location>
    <from_location>777</from_location>
    <asn_nbr>Bol1</asn_nbr>
    <container_qty>3</container_qty>
    <shipment_date>2012-04-20T15:37:30.757</shipment_date>
    <ASNOutDistro>
      <distro_nbr>101</distro_nbr>
      <distro_doc_type>A</distro_doc_type>
      <ASNOutCtn>
        <container_id>1</container_id>
        <ASNOutItem>
          <item_id>item-1</item_id>
          <unit_qty>4</unit_qty>
        </ASNOutItem>
      </ASNOutCtn>
    </ASNOutDistro>
    <ASNOutDistro>
      <distro_nbr>102</distro_nbr>
      <distro_doc_type>A</distro_doc_type>
      <ASNOutCtn>
        <container_id>2</container_id>
        <ASNOutItem>
          <item_id>item-1</item_id>
          <unit_qty>2</unit_qty>
        </ASNOutItem>
        <ASNOutItem>
          <item_id>item-2</item_id>
          <unit_qty>4</unit_qty>
        </ASNOutItem>
      </ASNOutCtn>
      <ASNOutCtn>
        <container_id>3</container_id>
        <ASNOutItem>
          <item_id>item-1</item_id>
          <unit_qty>2</unit_qty>
        </ASNOutItem>
        <ASNOutItem>
          <item_id>item-2</item_id>
          <unit_qty>2</unit_qty>
        </ASNOutItem>
      </ASNOutCtn>
    </ASNOutDistro>
  </ASNOutDesc>
</ASNoutDesc>

As shown above it has to merge the items in each ASNOutCtn under each ASNOutDistro.
XSLT Iam using:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output omit-xml-declaration="yes" indent="yes"/>
  <xsl:strip-space elements="*"/>
  <xsl:key name="kByI" match="ASNOutItem" use="item_id"/>
  <xsl:template match="node()|@*">
    <xsl:param name="pNewValueQty"/>
    <xsl:copy>
      <xsl:apply-templates select="node()|@*">
        <xsl:with-param name="pNewValueQty" select="$pNewValueQty"/>
      </xsl:apply-templates>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="ASNOutItem[generate-id()=generate-id(key('kByI',item_id)[1])]">
    <xsl:copy>
      <xsl:apply-templates select="node()|@*">
        <xsl:with-param name="pNewValueQty" select="sum(key('kByI',item_id)/unit_qty)"/>
      </xsl:apply-templates>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="ASNOutItem"/>
  <xsl:template match="unit_qty/text()">
    <xsl:param name="pNewValueQty"/>
    <xsl:value-of select="$pNewValueQty"/>
  </xsl:template>
</xsl:stylesheet>

Output I got:
<ASNoutDesc>
  <ASNOutDesc>
    <to_location>14</to_location>
    <from_location>777</from_location>
    <asn_nbr>Bol1</asn_nbr>
    <container_qty>3</container_qty>
    <shipment_date>2012-04-20T15:37:30.757</shipment_date>
    <ASNOutDistro>
      <distro_nbr>101</distro_nbr>
      <distro_doc_type>A</distro_doc_type>
      <ASNOutCtn>
        <container_id>1</container_id>
        <ASNOutItem>
          <item_id>item-1</item_id>
          <unit_qty>8</unit_qty>
        </ASNOutItem>
      </ASNOutCtn>
    </ASNOutDistro>
    <ASNOutDistro>
      <distro_nbr>102</distro_nbr>
      <distro_doc_type>A</distro_doc_type>
      <ASNOutCtn>
        <container_id>2</container_id>
        <ASNOutItem>
          <item_id>item-2</item_id>
          <unit_qty>6</unit_qty>
        </ASNOutItem>
      </ASNOutCtn>
      <ASNOutCtn>
        <container_id>3</container_id>
      </ASNOutCtn>
    </ASNOutDistro>
  </ASNOutDesc>
</ASNoutDesc>

-My code is merging all items in the xml.Please help me in getting required output.
Thanks in advance.

A: Where you went wrong was to forget to factor in the parent nodes in the grouping of ASNOutItem nodes. Your key definition should be keyed on a untion of item_id and the ASNOutCtn node which is the parent of ASNOutItem, as the grouping does not cross ASNOutCtn boundaries.
This style-sheet is what you want ...
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:key name="kByI" match="ASNOutItem" use="concat(item_id,'+',generate-id(parent::*))"/>

<xsl:template match="@*|node()">
 <xsl:copy>
  <xsl:apply-templates select="@*|node()"/>
 </xsl:copy>
</xsl:template>

<xsl:template match="ASNOutCtn">
 <xsl:copy>
  <xsl:apply-templates select="@*"/>
  <xsl:apply-templates select="node()[not(self::ASNOutItem)]"/>
  <xsl:apply-templates
    select="ASNOutItem[
     generate-id(.) =
     generate-id( key('kByI',concat(item_id,'+',generate-id(parent::*)))[1])]"
    mode="merge"/>
 </xsl:copy>
</xsl:template>

<xsl:template match="ASNOutItem" mode="merge">
 <xsl:copy>
  <xsl:apply-templates select="@*"/>
  <xsl:apply-templates select="node()[not(self::unit_qty)]"/>
  <unit_qty>
    <xsl:value-of select="sum(
      key('kByI',concat(item_id,'+',generate-id(parent::*)))/unit_qty)" />
  </unit_qty>
 </xsl:copy>
</xsl:template>

</xsl:stylesheet>

A: Why not use a sum(ASNOutItem/item_id)?
Sorry if I ask, but in my opinion if I look at that code in a year it will take a tons of time to understand what I did and what it is doing. I would prefer to do something like:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<ASNoutDesc>
    <ASNOutDesc>
        <xsl:copy-of select="*[name() != 'ASNOutDistro']"/>
        <xsl:for-each select="ASNOutDistro">
            <xsl:copy-of select="*[name() != 'ASNOutCtn']"/>
            <xsl:for-each select="ASNOutCtn">
                <ASNOutCtn>
                    <xsl:copy-of select="*[name() != 'ASNOutItem']"/>
                    <ASNOutItem>
                        <xsl:copy-of select="ASNOutItem[1]/*[name() != 'unit_qty']"/>
                        <unit_qty>
                            <xsl:value-of select="sum(ASNOutItem/*/unit_qty)"/>
                        </unit_qty>
                    </ASNOutItem>
                </ASNOutCtn>
            </xsl:for-each>
        </xsl:for-each>
    </ASNOutDesc>
</ASNoutDesc>

redpajama_set_name: RedPajamaStackExchange


text:
Q: Lucene does not work for MUSTNOT Boolean query I created a lucene indexes for set of data and trying to retrieve results from that.
When I do a boolean query with SHOULD, lucene returns me expected result.
 eg: (title:"america")

But on the other hand when I do a MUST_NOT query, it returns me empty results even though there are lot of data which satisfy this criteria.
(-title:"america")

I think I am doing some silly mistake but not able to figure it out so far. Could someone  please give some pointers.

A: Understood the issue. I should combine MUSt NoT with some other operators.
Quote from https://www.bookdepository.com/Lucene-in-Action-Erik-Hatcher/9781933988177?redirected=true&utm_medium=Google&utm_campaign=Base3&utm_source=BE&utm_content=Lucene-in-Action&selectCurrency=EUR&w=AF4UAU960P6LMLA8VCZZ&gclid=Cj0KCQjwuL_8BRCXARIsAGiC51C8OdXsVpJbYRfodiFcGFEl2FKylqh2MvBjnHs9T5fVfMmDzZXbU4oaAisFEALw_wcB

Placing a NOT in front of a term excludes documents matching the following term.
Negating a term must be combined with at
least one non-negated term to return docu-
ments; in other words, it isn't possible to
use a query like NOT term to find all docu-
ments that don't contain a term.


text:
Q: Project Euler #19 in Java You are given the following information, but you may prefer to do some research for yourself.
1 Jan 1900 was a Monday.
Thirty days has September,
April, June and November.
All the rest have thirty-one,
Saving February alone,
Which has twenty-eight, rain or shine.
And on leap years, twenty-nine.
A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400.

How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?
Solution :
My following logic gives me 173 Sundays , whereas there are 171 Sundays !! Where are the extra 2 days came from ?
public static void main(String args[]) {

    Date startDate = new Date(1901, Calendar.JANUARY, 01);
    Date endDate = new Date(2000, Calendar.DECEMBER, 31);

    checkSundays(startDate, endDate);
}

private static void checkSundays(Date start, Date end) {
    int dayNum;

    Calendar startDate = Calendar.getInstance();
    startDate.setTime(start);
    System.out.println(startDate.getTime());

    Calendar endDate = Calendar.getInstance();
    endDate.setTime(end);
    System.out.println(endDate.getTime());
    int count = 0;

    while (startDate.before(endDate)) {
        for (int i = 1; i < 13; i++) {
            dayNum = startDate.get(Calendar.DAY_OF_WEEK);
            if (dayNum == 1) {
                count++;
            }

            System.out.println(startDate.getTime());
            startDate.add(Calendar.MONTH, 1);

        }
            System.out.println("Count " + count);

    }
}

A: Your following code uses deprecated constructor of Date
Date startDate = new Date(1901, Calendar.JANUARY, 01);
System.out.println(startDate);

which is not proper, it prints
Thu Jan 01 00:00:00 IST 3801

So use Calendar to construct Date,
    Calendar startDateCal = createDateInstance(0,1901,1)

    Calendar endDateCal = createDateInstance(11,2000,13)

and a Factory method
public static Date createDateInstance(int month, int year, int date){
  Calendar cal= Calendar.getInstance();
  cal.set(Calendar.YEAR, year);
  cal.set(Calendar.MONTH, month);
  cal.set(Calendar.DATE, date);

  return cal.getTime();

}

See your working code

A: You can use probability and do this with just a calculator.
There's 100 years in a century, and every year, there are 12 first days of the months. Divide that by 7 and you have your answer.
It's cheap, but it works.


text:
Q: psexec inside visual studio I've been trying to get psexec to run executables on remote machines from custom build tasks in visual studio. All of these commands work from the command line but running it from an application seems to be a problem. Some commands work, on other psexec hangs and consequently so do msbuild and visual studio 2005. I'm calling SharePoint's stsadm.exe in this case, but this problem occurs with a lot of programs, when running psexec from an application. There are lots of people having this problem, but there seems to be no solution, so my question is: Does anyone know a working alternative to psexec?

A: I've experienced 'hangs' when executing PSEXEC against a remote system, but I always attributed it to the security context in which the remote process was running under.
From PSEXEC help:

If you omit a username the remote
  process runs in the same account from
  which you execute PsExec, but because
  the remote process is impersonating it
  will not have access to network
  resources on the remote system. When
  you specify a username the remote
  process executes in the account
  specified, and will have access to any
  network resources the account has
  access to. Note that the password is
  transmitted in clear text to the
  remote system.

If your executing a process remotely, that then needs to access the database (stsadm.exe), then it could be failing trying to access the network resource, depending on how PSEXEC was executed.  If thats the case, I'd imagine it would eventually time out and give some sort of resource unavailable message.
There are two things that generally done when executing deployment steps against a remote machine to prevent the behavior your describing:

*

*Like rifferte mentioned, make sure all assets needed to
deploy are local to the remote
machine (copy files, etc) before
using PSEXEC to execute the script (*.bat, *.vbs, *.ps, etc) -
so that everything runs 'local' to
the remote machine.

*Run PSEXEC using
a domain username/password when
executing it - note that this
information is passed in clear text
to the remote server.

A: There's always RCE.

RemCom is a small (10KB upx packed)
  remoteshell / telnet replacement that
  lets you execute processes on remote
  windows systems, copy files on remote
  systems, process there output and
  stream it back. It allows execution of
  remote shell commands directly with
  full interactive console without
  having to install any client software.
  On local machines it is also able to
  impersonate so can be used as a silent
  replacement for Runas command.

A: You can try to have psexec call a bat program that executes what you need on the remote machine. I ran into this issue with installutil.exe. A simple bat file on the remote machine resolved it.
You should also share your experience on the sysinternals board. There may be something they can do in a future revision.


text:
Q: Is it possible for a hybrid app to convert into a PWA? Looking forward to know if it's possible to turn a hybrid app into a PWA?

A: It's possible. I've made one with Angular so if you have any more questions feel free to ask.
Angular PWA
Here are the details https://ionicframework.com/docs/angular/pwa
The @angular/pwa package will automatically add a service worker and an app manifest to the app. To add this package to the app, run:
ng add @angular/pwa

React PWA
Here are the details https://ionicframework.com/docs/react/pwa

Additional links:

*

*PWA add to home screen not showing a popup


text:
Q: taking image on touching screen in android I am following google's android developer guide to create camera capturing app.
http://developer.android.com/guide/topics/media/camera.html
I have created CameraPreview class to display live images from camera. and then attaching camera to it as below
// Create an instance of Camera
    mCamera = getCameraInstance();
// Create our Preview view and set it as the content of our activity.
    mPreview = new CameraPreview(this, mCamera);
    FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview);
    preview.addView(mPreview);

In the example the image is clicked as user presses button as below:-
Button captureButton = (Button) findViewById(id.button_capture);
captureButton.setOnClickListener(
 new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        // get an image from the camera
        mCamera.takePicture(null, null, mPicture);
    }
}

);
Can I somehow set touch listener to camera preview ( screen) such that as the user touches screen I can get the coordinates of the touch and then do my separate processing??

A: raplace:
Button captureButton = (Button) findViewById(id.button_capture);
captureButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        // get an image from the camera
        mCamera.takePicture(null, null, mPicture);
    }
});

with:
preview.setOnTouchListener(new OnTouchListener(){

@Override
public boolean onTouch(View v, MotionEvent event) {
Log.i("onTouch","onTouch event:"+event.getAction());

switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:

        // get an image from the camera
        mCamera.takePicture(null, null, mPicture);

        // coordinates
        int x = (int)event.getX();
        int y = (int)event.getY();
        Log.i("onTouch", "ACTION_DOWN");
        break;

    default:
        break;
    }
    return true;
}

});


text:
Q: How can I align equations to the left and to the right? This is my first topic here in StackExchange. After a lot of research, I couldn't figure out how to align equations to the left and to the right using any environment.
For example, I'd like to align this set of three equations:

where all equalities are to be aligned, and also the first two equations, but I want to align them to the right.
I mean, I'd like to "shift" the blank space created on the right (after the derivative) to the left of the second line's expression (before the minus sign). I certainly could align them to the right using split environment, but it doesn't allow me to align both the equations and the equal signs.
My code using alignat is written as follows:
\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}
\begin{document}

\begin{alignat}{3}
    (\hat{n}\cdot \nabla \times \hat{n})
    &= - \cos^2{(\theta(z))} \cdot \frac{d \theta}{dz} -
\sin^2{(\theta(z))}         \cdot \frac{d \theta}{dz} &&= \\
    &= - \underbrace{\left[\cos^2{(\theta(z))} + \sin^2{(\theta(z))}
\right]}_{=1} \cdot \frac{d \theta}{dz} &&= \\
    &= -\frac{d \theta}{dz}
\end{alignat}

\end{document}

While as using split:
\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}
\begin{document}

\begin{equation}
\begin{split}
    (\hat{n}\cdot \nabla \times \hat{n})
    = - \cos^2{(\theta(z))} \cdot \frac{d \theta}{dz} -
\sin^2{(\theta(z))}         \cdot \frac{d \theta}{dz}& = \\
    = - \underbrace{\left[\cos^2{(\theta(z))} + \sin^2{(\theta(z))}
\right]}_{=1} \cdot \frac{d \theta}{dz}& = \\
    = -\frac{d \theta}{dz}
\end{split}
\end{equation}

\end{document}

Where the two first derivatives are aligned to the right, but not the equal signs.
My goal is to do something like this:

I hope I've made myself clear.
Thanks in advance.

A: It was unclear whether the OP wanted a single or 3 equation numbers, based on the two examples provided.  If only a single equation number is needed, then a tabstackengine solution is as follows.
Key was using a \mathrclap on the 3rd row, to overcome the specified right alignment of the 2nd column.
\documentclass{article}
\usepackage{tabstackengine}
\stackMath
\setstacktabulargap{0pt}
\setstackgap{L}{2.5\baselineskip}
\makeatletter
\renewcommand\TAB@delim[1]{\displaystyle#1}
\makeatother
\usepackage{mathtools}
\begin{document}
\begin{equation}
\tabularCenterstack{rr}{
    (\hat{n}\cdot \nabla \times \hat{n})
    =& - \cos^2{(\theta(z))} \cdot \frac{d \theta}{dz} -
\sin^2{(\theta(z))}         \cdot \frac{d \theta}{dz} = \\
    =& - \protect\underbrace{\left[\cos^2{(\theta(z))} + \sin^2{(\theta(z))}
\right]}_{=1} \cdot \frac{d \theta}{dz} = \\
    =\mathrlap{ -\frac{d \theta}{dz}}&
}
\end{equation}
\end{document}

Because all columns are right-aligned, the \tabularCenterstack{rr}{...} could be replaced with a \tabbedCenterstack[r]{...}.


text:
Q: sending email with python SSL error I'm trying to send email with python but I'm getting SSL error and I don't know why.
   File "./test.py", line 735, in <module>
     mail()   File "./test.py", line 721, in mail
     server.starttls()   File "/usr/local/lib/python2.7/smtplib.py", line 641, in starttls
     raise RuntimeError("No SSL support included in this Python") RuntimeError: No SSL support included in this Python

How do I add SSL support?
its just a small function to test if i can send email with python
def mail():
    import smtplib
    global log_location
    #inFile_list = open(log_location, 'r')
    #msg = inFile_list.readlines()
    #inFile_list.close()

    server = smtplib.SMTP('smtp.gmail.com', 587)
    server.starttls()
    #Next, log in to the server
    server.login("my username", "my password")

    #Send the mail
    msg = "\nHello!" # The /n separates the message from the headers
    server.sendmail("mymail@gmail.com", "mymail@gmail.com", msg)
    server.quit()

A: Tried to install _ssl.so manual but it didn't work.
instead I've upgraded from 2.7.6 to 2.7.7 and now i can import SSL.

A: import smtplib
import config

def send_email(subject,msg):
    try:
        server = smtplib.SMTP('smtp.gmail.com:587')
        server.ehlo()
        server.starttls()
        server.login(config.EMAIL_ADDRESS, config.PASSWORD)
        message = 'subject: {}\n\n{}'.format(subject,msg)
        server.sendmail(config.EMAIL_ADDRESS,config.EMAIL_ADDRESS, message)
        server.quit()
        print('all good')
    except:
        print('email failed to send')
subject = "TEST SUBJECT"
msg = "hello"
send_email(subject,msg)

This works for me but you must create a new file called config.py then put in
EMAIL_ADDRESS = "email"
PASSWORD = "pwd"

The last step is go to this link >>> https://myaccount.google.com/lesssecureapps<<< and turn it on. Now you can run the script


text:
Q: Do metals generally lose more heat by convection than non-metals? I've been experimenting with radiative cooling lately and in my mind convection is always an enemy (especially forced convection since the modules are outdoors).
Looking at Newton's law of cooling, it doesn't seem to me that it accounts for surfaces made of different materials losing/gaining heat (can be wrong though, not uncommon especially when working with formulas).
Does it matter (much), that surfaces are made from different materials when we talk about convective heat gains/losses?
I'm only saying this because metal cooled more under radiation than a type of plastic I used, and to me that doesn't make much sense as the convective heat gain should, in my mind, be greater in the metal panel and therefore it shouldn't cool more than the plastic one (both had similar emissivity because of a very thin paint coating).
My experiments tell me that I'm most likely wrong in assuming the convective heat gains/losses will be greater in metals, but I thought it's most likely better to check with those who actually know what they're talking about, it may be some weird fluke in the tests.

A: I'd expect metals to cool faster through convection because of a related heat property of theirs: conduction.  Metals are generally good heat conductors so as heat energy is removed from the surface of the metal by air, internal heat energy in the metal can quickly flow to the surface.
The rate heat flows between two systems is dependent on their temperature difference.  When air removes heat via convection, the surface of the object is cooler than the central portion of the object.  If heat in the object flows slowly from the center to the surface like in many plastics then the surface stays closer to air temperature and heat transfers to the surrounding air more slowly.  If the object is a metal, the heat removed at the surface is easily replaced by heat flowing from the center to the surface and the temperature delta between the surface and the air is greater so the object cools faster.


text:
Q: How to get a single value in API How will i be able to get a single value out of BTC-e API using PHP?. This is the current API that i can use.
https://btc-e.com/api/3/ticker/btc_usd
As you can see, it shows lots of information, but i dont need many information that is displayed there. What can i do so that i will only get
"last":284.323

this number?
Thank you for your help regarding this subject.

A: As you can see, the received data is a JSON value.
If you simply want to receive data from a website, you can use the file_get_contents function.
With the json_decode function, you can create an object from this data.
If you're looking for a specific value, you maybe can use print_r to get a clarifying list of the given data.
When you use the print_r function on the given data, it will return:
stdClass Object
(
    [btc_usd] => stdClass Object
        (
            [high] => 288.957
            [low] => 272.00201
            [avg] => 280.479505
            [vol] => 2178508.65397
            [vol_cur] => 7771.83325
            [last] => 286.322
            [buy] => 286.328
            [sell] => 286.322
            [updated] => 1445787588
        )
)
As you can see, you are looking for a variable stored in ->btc_usd->last
So when it all comes together, you can use the following:
<?php
# Get String
$_ApiString = '{"btc_usd":{"high":288.957,"low":272.00201,"avg":280.479505,"vol":2178508.65397,"vol_cur":7771.83325,"last":286.322,"buy":286.328,"sell":286.322,"updated":1445787588}}';

# Or maybe you simply want to download it from a website
$_ApiString = file_get_contents('https://btc-e.com/api/3/ticker/btc_usd');

# Create object from ApiString
$_Object    = json_decode($_ApiString);

# Get variable
$_Last      = $_Object->btc_usd->last;
?>


text:
Q: Playing .Wav Files im using
String comspec = System.getenv().get("ComSpec");

String fileToPlay = "/path/to/wav/file.wav";

Runtime.getRuntime().exec(comspec, new String[]{"/c", "start", fileToPlay}) ;

and I keep on getting an error all i need it to do is just play a .wav file

A: Try using javax.sound api.
AudioSystem.getAudioInputStream(File file);

Try running below code, this worked for me.
  AudioInputStream s;
        AudioFormat f;
        DataLine.Info i;
        File inputFile;
        Clip c;

        s = AudioSystem.getAudioInputStream(inputFile);
        f = s.getFormat();
        i = new DataLine.Info(Clip.class, f);
        c = (Clip) AudioSystem.getLine(i);
        c.open(s);
        c.start();

A: Here's the code for an AudioPlayer class that only plays, loops and pauses .wav files:
class AudioPlayer implements Runnable
{
    AudioInputStream input;
    Clip clip;
    private boolean running;

    public AudioPlayer(String path)
    {
        running = true;
        try
        {
            clip = AudioSystem.getClip();
            input = AudioSystem.getAudioInputStream(new File(path));
            clip.open(input);
        }
        catch (UnsupportedAudioFileException | IOException | LineUnavailableException e)
        {
            System.out.println(e);
        }
    }
    public void play()
    {
        clip.loop(1);
        running = true;
    }
    public void stop()
    {
        running = false;
        clip.stop();
    }
    public void loop()
    {
        running = true;
        new Thread(this).start();
    }
    public void suspend()
    {
        running = false;
    }
    @Override
    public void run()
    {
        try
        {
            Thread.sleep(2);
        }
        catch(InterruptedException e)
        {

        }
        while(running)
        {
            clip.loop(1);
        }
    }
}

Its always ideal to make objects that play audio a new thread, so you can play, pause them easily.
The javax.sound API, especially the Clip class, has very useful methods using which you can implement a wide range of sound systems. Make sure to check it out!
If you have any further questions, just put comments on this post.


text:
Q: Trying to retrieve Message Text from Azure Queue using web api but message text is encoded. how do i remove encoding when i retrieve  something the output is encoded.
QueueClient queue = new QueueClient(connectionString, "outqueue");
string value = await RetrieveNextMessageAsync(queue);
        return value;

RetrieveNextMessageAsync:
if (await theQueue.ExistsAsync())
        {
            QueueProperties properties = await theQueue.GetPropertiesAsync();

            if (properties.ApproximateMessagesCount > 0)
            {
                QueueMessage[] retrievedMessage = await theQueue.ReceiveMessagesAsync(1);
                string theMessage = retrievedMessage[0].MessageText;
                await theQueue.DeleteMessageAsync(retrievedMessage[0].MessageId, retrievedMessage[0].PopReceipt);
                return theMessage;
            }

output:
enter image description here

A: If your message encoding is base64, you can use the following code to retrieve it with package Azure.Storage.Queues
[HttpGet("getMessage")]
        public async Task<string> GetMessageAsync() {
            string connectionString = "";
            var options = new QueueClientOptions {
                MessageEncoding= QueueMessageEncoding.Base64
            };
            var queue = new QueueClient(connectionString, "myqueue", options);

            var message = await RetrieveNextMessageAsync(queue);
            return message;
        }
        static async Task<string> RetrieveNextMessageAsync(QueueClient theQueue)
        {
            if (await theQueue.ExistsAsync())
            {
                QueueProperties properties = await theQueue.GetPropertiesAsync();

                if (properties.ApproximateMessagesCount > 0)
                {
                    QueueMessage[] retrievedMessage = await theQueue.ReceiveMessagesAsync(1);
                    string theMessage = retrievedMessage[0].MessageText;
                    await theQueue.DeleteMessageAsync(retrievedMessage[0].MessageId, retrievedMessage[0].PopReceipt);
                    return theMessage;
                }

                return null;
            }

            return null;
        }

Regarding how to check message encoding, you can use Azure Storage Explorer


text:
Q: ¿Cómo ejecuto una función PHP desde JavaScript? Tengo la necesidad de ejecutar una función PHP llamándola desde un archivo JavaScript cuando se hace clic en un botón. La función PHP, que quiero ejecutar, es parte de un plugin de WordPress y la llamo con fetch desde un archivo JavaScript que incrusté en la página.
Lo que busco, de ser posible, es que la función PHP simplemente se ejecute solo con llamarla, tomando los datos que necesite desde los demás archivos del plugin como si hubiese sido llamada desde el propio plugin, sin tener que pasarlos manualmente. Busco hacerlo de esta forma, porque necesito que la función PHP se ejecute con el clic de otro botón que no es el que originalmente utiliza el plugin para funcionar, pero que haga lo mismo.
El código JS (tiene algunos comentarios para aclarar ciertos puntos):
// Sólo que se ejecute cuando se este en esta página.
if(location.href === "https://www.leogratis.com/venderlibro/"){

  // Este es el botón que desencadena el evento.
  const agregarLibro      = document.querySelector('.wpuf_submit_34');
  const tituloProducto    = document.querySelector('#post_title_34');
  const categoriaProducto = document.querySelector('#lvl0').firstElementChild;

  agregarLibro.addEventListener('click', e =>{
    //e.preventDefault();
    // El botón envía un formulario así que antes de hacer la petición valido que los campos requeridos no estén vacíos.
    if(
      tituloProducto.value !== '' &&
      categoriaProducto.value !== '-1' &&
      !document.querySelector('.ui-state-default ,.wpuf-image-wrap, .thumbnail')
    ){
      // La petición del archivo que contiene la función.
      fetch('/wp-content/plugins/complemento-de-modificacion/woo_product.php')
      // Esto es sólo para ver si la petición se hace correctamente y está funcionando.
      .then(response => console.log(response));
    }
  });
}

La función PHP que quiero que se ejecute:
<?php if ( ! defined( 'ABSPATH' ) ) exit;
function um_activity_new_woo_product( $post_id ) {
  if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
  if (
      get_post_type( $post_id ) != 'product' ||
      get_post_status( $post_id ) != 'publish'
  ) return;

  if ( ! UM()->options()->get('activity-new-product') ) return;

  $post = get_post($post_id);
  if( $post->post_modified_gmt != $post->post_date_gmt ) return;

  if ( !isset( $_POST['original_post_status'] ) ) return;
  if (
     sanitize_key( $_POST['post_status'] ) == 'publish' &&
     sanitize_key( $_POST['original_post_status'] ) == 'publish'
  ){
    return;
  }

  $product = new WC_Product( $post_id );
  $user_id = $post->post_author;

  um_fetch_user( $user_id );
  $author_name = um_user('display_name');
  $author_profile = um_user_profile_url();

  $post_image = '';
  $post_image_url = UM()->Activity_API()->api()->get_post_image_url( $post_id );
  if ( $post_image_url ) {
    $post_image_alt = basename( $post_image_url );
    $post_image = '';
  }

  if ( $post->post_excerpt ) {
    $post_excerpt = '' .
      strip_tags(
       apply_filters( 'woocommerce_short_description', $post->post_excerpt )
      ) . '';
  } elseif ( $post->post_content ) {
    $post_excerpt = '' .
      wp_trim_words(
        strip_shortcodes( $post->post_content ),
        $num_words = 25,
        $more = null
      ) . '';
  } else {
    $post_excerpt = '';
  }

  UM()->Activity_API()->api()->save(
    array(
      'template' => 'new-product',
      'wall_id' => $user_id,
      'author' => $user_id,
      'author_name' => $author_name,
      'author_profile' => $author_profile,
      'post_title' => '' . $post->post_title . '',
      'post_url' => get_permalink( $post_id ),
      'post_excerpt' => $post_excerpt,
      'post_image' => $post_image,
      'price' => '' . $product->get_price_html() . '',
    )
  );
}
add_action( 'save_post', 'um_activity_new_woo_product', 99999, 1 );

Como podrán ver la función PHP necesita varios valores, como son demasiados lo que espero es que pueda tomarlos desde donde sea que vengan, ya que estoy llamando a la función en el mismo entorno donde están los demás archivos del plugin.
Gracias de antemano.


text:
Q: como passar dados para uma funcao php pela url ajax? Pessoal tentem me dar uma força por aqui, já procurei e não achei uma resposta que me atenda.
Vamos lá!
Estou trabalhando com classes em php, gostaria de passar dados de um formulário através de ajax.
Porem tenho duvidas na execução da URL, eu não sei como ela irá ficar.
$.ajax({
     type:'post',
     url:'DUVIDAAAA',
     ajax:'1',
     success: function (data){
          alert(data)
     }
});

Na minha url eu preciso entrar na minha classe PHP ! porem se eu colocar um caminho direto ela entra mas da erro pq a classe instanciada nao foi solicitada.
Eu chamo minhas classes com um autoload.

A: Sei q a pergunta é antiga e vc já deve ter se dado conta do que precisa fazer, mas pra caso alguém chegue aqui e queira saber uma resposta, segue a minha.
Fragmento de código javascript usando ajax do jquery:
    $.ajax({
              type: 'POST',
              url: 'test.php',
              data: {

                  variavel1: 'algumvalor',
                  variavel2: 'outrovalor',
              },
              success: function(data)
              {
                alert(data);
              }
            });

Na página test.php :
<?php

//Essa classe abaixo deve ficar em outro arquivo e ser chamada nessa página

class Teste
{
    function exemplo($a, $b)
    {
        // Faz um processamento qualquer com os parâmetros informados e dá um retorno
        return 'O valor de A é ' . $a . ' e o valor de B é '. $b;
    }
}

$var1 = $_POST["variavel1"];
$var2 = $_POST["variavel2"];

//Instancia sua classe e passa as variáveis pra algum método ou
// no construtor se esse aceitar parâmetros

$teste = new Teste();

$retorno = $teste->exemplo($var1, $var2);

echo $retorno; // Isso irá voltar na chamada ajax e o alert do javascript irá exibir na tela


text:
Q: Topological transitivity+contraction I'm looking for a hint:
Suppose $T:X→X$ is a dynamical system. Assume that $T$ is both topologically transitive and a contraction, i.e. $d(T(x),T(y))≤d(x,y)$ for all $x,y∈X$. Prove that T is minimal.
What I did: Let us assume that T is not minimal. Then exists T-invariant closed unempty set F which is not equal to $X$ and by topological transitivity for all pairs of open sets $U,V$ exists $n\geq 0$ such that $T^n(U)\cap V\neq\emptyset$. Here, I tried to set $U=V=X\setminus F$, but get nothing. How can I use contraction condition?
Any help is welcome. Thanks in advance.

A: If you assume $X$ to be a compact metric space, then transitivity implies the existence (in fact, denseness) of transitive points.  (A transitive point for $T$ is a point $x$ whose orbit is dense in $X$.)  If $T$ were not minimal, then it would also have non-transitive points.  But by the contraction assumption, orbits of close points remain close forever, and this would lead to a contradiction.
Without the compactness assumption, you can proceed as follows.
Let $x\in F$ and $y\in X\setminus F$ be arbitrary.  Let $\varepsilon>0$ be such that $B_\varepsilon(y)$ (i.e., the $\varepsilon$-ball around $y$) is entirely in $X\setminus F$.  By transitivity, there exists a point $z\in B_{\varepsilon/2}(x)$ and a time $n\geq 0$ such that $T^n(z)\in B_{\varepsilon/2}(y)$.  By the contraction property of $T$, we have $d\big(T^n(z),T^n(x)\big)\leq d(z,x)<\varepsilon/2$.  Using the triangular inequality, this implies $T^n(x)\in B_\varepsilon(y)\subseteq X\setminus F$, contradicting the invariance of $F$.


text:
Q: question about print List to screen A question about List;

When i have "List<PlugwiseMessage> msg" with the value's from the picture :
I only get PlugwiseLib.BLL.BC.PlugwiseMessage as output.
But how can i see the value's from _message, _owner and _type on my screen ?
or the value's of Message, Owner, and Type?
And can somebody explain the difference to me ?

A: Your list has a collection of PlugwiseLib.BLL.BC.PlugwiseMessage objects. Message, Owner and Type are properties on the object. The _message, _owner and _type variables are the backing fields that are exposed by the properties.
When you are doing the console output, you are calling .ToString() on the PlugwiseMessage object. The default behavior of ToString() is to print the name of the object. If you want to display the properties you will need to add several lines
Console.WriteLine(msg[i].Message);
Console.WriteLine(msg[i].Owner);
Console.WriteLine(msg[i].Type);

A: overide ToString method in PlugWiseMessage type.
public override string ToString()
        {
            return String.Format("Owner {0}, Message {1}, Type {2}", this.Owner, this.Message, this.Type);
        }

A: The problem is that you're printing the object itself and not the properties, so it uses the default ToString() method which returns the object's type's name.
There's one of two options.  You can override the ToString() method in the class PluginwiseMessage to return a formatted string with the info you want or if you don't have access to that you can do the following:
foreach(PluginwiseMessage message in msg)
{
    Console.WriteLine("{0} {1} {2}", message.Message, message.Owner, message.Type);
    Console.Read();
}

You can easily rearrange the parameters being printed and add more text to the output, but that will simply output Message, Owner, and Type separated by spaces.

A: Your list contains PlugwiseMessage objects and you tell Console to write them down. To do that PlugwiseMessage instances have to converted into a string. ToString() is used to do that and the default implementation just dumps the name of the type. That's what you observe.
If it's possible, you should override the ToString method and adjust it to your needs. If that's not possible, you have to dump the values by yourself. That means you have to pass msg[i].Messasge, msg[i].Owner, ... to WriteLine().

A: msg[i].Message
msg[i].Owner
msg[i].Type


text:
Q: Markov chain state time I have a question regarding markov chains in continuous time.
I have a birth/death process(for every step we go 1 up & or 1 down), queue with 4 states. Customers arrive with the intensity of lambda per hour and can be seen as poisson distributed. The time to serve each customer can be seen as exponentially distributed and independent.
We start at time = 0 and state = 0. We are going to do 100 steps.
State 0 => There is no customers. (Arrival rate = 2, Departure rate = 0)
State 1 => There is one customer being served. (Arrival rate = 2, Departure rate = 10)
State 2 => There is one customer being served + 1 in queue. (Arrival rate = 2, Departure rate = 10)
State 3 => There is one customer being served + 2 in queue. (Arrival rate = 0, Departure rate = 10)
Givens:
Arrival rate = 2.
Depature rate = 10.
Is there a formula to calculate the total time spent in each state?

A: Under the assumption that arriving customers are turned away when there are three customers in the system, this is a $M/M/1/3$ queue, that is, a single-server queueing system with arrival process Poisson, i.i.d. exponentially distributed service times, and a finite buffer size of $3$. Let $X(t)$ be the number of customers in the system at time $t$. Then $X=\{X(t):t\in\mathbb R_+\}$ is a continuous-time Markov chain with state space $S = \{0,1,2,3\}$ and transition rates
$$
q_{ij} =
\begin{cases}
2,& j=i+1\\
10,& j=i-1\\
0,& \text{otherwise}.
\end{cases}
$$
Let $P(t)$ be the matrix with entries $$[P(t)_{ij}] = \mathbb P(X(t) = j\mid X(0) = i).$$
Then $P$ satisfies the forward Kolmogorov equation $$P'(t) = P(t)Q(t), $$ with solution given by the matrix exponential $$P(t) = e^{tQ}.$$ (This may be verified by the Chapman-Kolmogorov equation $P(s+t) = P(s)P(t)$.) Since each row of $P(t)$ sums to $1$ (as it is a stochastic matrix), it follows that each row of $Q$ sums to $0$. The nondiagonal entries of $Q$ are precisely the transition rates $q_{ij}$, so the diagonal entries satisfy $$q_{ii} = -\sum_{j\in S\setminus\{i\}}q_{ij}. $$
Hence,
$$
Q = \begin{pmatrix}
-2 & 2 & 0 & 0\\
10 & -12 & 2 & 0\\
0 & 10 & -12 & 2\\
0 & 0 & 10 & -10.
\end{pmatrix}
$$
If $\pi$ is a probability distribution on $S$, let $\{X_\pi(t):t\in\mathbb R_+\}$ denote the process $X$ conditioned on $X(0)\sim\pi$. If $X_\pi(t)$ is a stationary process, that is, $\{X_\pi(s+t):t\in\mathbb R_+\}\stackrel d=\{X_\pi(t):t\in\mathbb R_+\}$ for all $s\geqslant 0$, then $\pi$ is a stationary distribution. From the balance equations $$\sum_{j\in S\setminus\{ i\}} \pi_{i}q_{ij} = \sum_{j\in S\setminus\{ i\}} \pi_{j}q_{ji},$$ it can be verified that $\pi$ is a stationary distribution iff $\pi Q=0$. In this example, $\pi Q=0$ is the system of linear equations
\begin{align}
-2\pi_0 + 10\pi_1 &= 0\\
2\pi_0 -12\pi_1 + 10\pi_2 &= 0\\
2\pi_1 -12\pi_2 + 10\pi_3 &= 0\\
2\pi_2 -10\pi_3 &= 0
\end{align}.
These equations, along with $\sum_{i\in S}\pi_i = 1$ (since $\pi$ is a probability distribution), yield
$$\pi = \begin{pmatrix}\dfrac{125}{156}& \dfrac{25}{156}& \dfrac{5}{156}& \dfrac1{156} \end{pmatrix}. $$
The fraction of time spent in each state satisfies
$$\lim_{T\to\infty}\frac1T \int_0^T \mathsf 1_{\{X(t)=i\}}\,\mathsf dt = \pi(i).$$
This serves as a good approximation for the fraction of time spent in a state for large $t$, but computing the exact value of $\int_0^T \mathsf 1_{\{X(t)=i\}}\,\mathsf dt$ for a given $T$ is non-trivial and (especially for larger problems) is generally done by simulation.


text:
Q: angular tap into the component life cycle events from a parent module We have the following requirement.
We have a master root layout in the app root component.
In this layout we have a router-outlet and components are injected into the router-outlet by using the Angular routing mechanism.
We need to hook from the master root layout into the lifecycle events of the components being injected into the router-outlet.
Because if we register to the router events NavigationEnd it is sometimes being invoked before the component ngOnInit.
So we know when the navigation ends but we don't know when the component has finished doing work. Ideally we would like to tap into the lifecycle events of a component.
The requirement is also that the components being injected do not inherit a special class or something like that...
How can this be done?

A: Maybe you can create a shared service that you inform when the components you want call in the lifecycle hooks such as ngOnInit, ngOnDestroy etc.
@Injectable({
  providedIn: 'root'
})
export class LifeCycleHookService{
    private hookSubject = new Subject<any>();
    onHookFired = this.hookSubject.asObservable();

    //  component: Component - Reference to the component
    //  hookType: Enum | string - OnInit, OnDestroy etc.
    fireHook = (component, hookType) => {
      this.hookSubject.next({component, hookType});
    }

}

Then in your parent component, you can subscribe to onHookFired of the service.
@Component(
...
)
export class ParentComponent implements OnInit{
   constructor(private hookService: LifeCycleHookService){}

  ngOnInit(){
    this.hookService.onHookFired.subscribe((event) => {
      // event.component
      // event.hookType
    })
  }
}

Then in your child components, you can inform the service on lifecycle hooks.
@Component(
...
)
export class ChildComponent implements OnInit, OnDestroy{
   constructor(private hookService: LifeCycleHookService){}

  ngOnInit(){
    this.hookService.fireHook(this, 'onInit');
  }

  ngOnDestroy(){
    this.hookService.fireHook(this, 'onDestroy');
  }
}

Hope this gives you a hint.


text:
Q: change the flex spacing between div with background image hi i am remaking the google chrome home page but i cant seem to do the part at the bottom of the page were the most used apps are i am trying to do it with display flex because it puts it inline but i cant get the spacing right its uneven or to big or small here is what i want it to look like...

and here is what i get

the top one is what i need to get.
notice that the spacing is to small
and in the middle its to big i am looking for it to be just right
justify-content doesn't seem to  effect spacing?
here is the css
.youtube{
background-image: url(youtube.png);

}
.facebook{
background-image: url(facebook.png);

}

.roblox{
background-image: url(roblox.png);

}

.Agar{
 background-image: url(Agar.png);

  }

    .gmail{
background-image: url(gmail.png);

 }
  .rowCell{
justify-content: space-around;
align-items: center;
position: relative;
background-repeat: no-repeat;
width: 200px;
height: 150px;
margin-top: -589px;
left: 422px;
 }
  .mostUsedApps{
     width: 42%;
display: flex;
justify-content: space-between;
justify-content: space-around;
align-items: center;
}

here is the html

Any help is much appreciated,thanks :)

A: If your icons are of same size, then you would just need the justify-content property on your parent div i.e. "mostUsedApps".
If they are of different size, then you would need to provide a link to codepen or codesandbox, without that it would be difficult to help.


text:
Q: Start a GNU screen window in the background/without focus The following command screen -t 'fubar' cmd will create a new screen window with the command cmd running in it and will set the focus to this window.
How can I keep the focus in the current screen window, not the new one?

A: Inside a current screen session, this will start your command in a new screen window and then immediately switch back to your previous screen window, effectively backgrounding the new screen window.
Enter the screen command line with Ctrl-a : and enter
eval 'screen top' 'other'
eval parses and executes each argument as a separate command. So the first command is to run top in a new screen window and the second command is toggle to the window displayed previously.

A: I'm not sure that you can do it in one go, here is a workaround:
screen -t 'fubar' cmd & sleep .01; screen -X other


text:
Q: What is connection between Pearson correlation coefficient and proportion of variance explained in PCA? PCA procedure includes SVD of Covariance matrix. Based on eigenvalues we can find a proportion of variance explained by related Principal Components (eigenvectors).
variance explained by PC1 (in case symmetric matrix) = eigenvalue1 / (sum of all eigenvalues) * 100%
We form a covariance matrix as [ [SD1^2, RO*SD1*SD2], [RO*SD1*SD2, SD2^2]]
(SD = standard deviation, RO = Pearson correlation coefficient)
It is clear that if RO = 1 then PC1 explains ~100% of the variance.
Can you please suggest intuition and a general (mathematical) connection between Pearson correlation coefficient and proportion of variance explained in PCA?


text:
Q: TABULATOR - Mutator not displaying data I have a problem with a mutator not displaying data. I have five columns getting the data from an AJAX URL (and those work fine), and I have a sixth column in which I intend to get data from another URL with FETCH and display it with a mutator. Here is the code for fetching the data:
const comtot = async function (value, data) {
    let response = await fetch(API_TOT);
    let com = await response.json();

    console.log(com[0].total);
    return com[0].total;
}

And here is the code for the column with the mutator:
{
    title: "Cantidad de Compras",
    field: "total",
    align: "center",
    sorter: "number",
    headerFilter: "input",
    mutator: comtot().then((res) => {
        console.log(res);
        return res
    })
}

I already tried using promises instead of ASYNC AWAIT and had the same result. Also, I also tried upgrading to version 4.5.3 as I saw that on a different post with a problem quite similar to mine and also didn't work.
I might add that I can log the data to the console, but not display it to the table.
What am I doing wrong?

A: Mutators in Tabulator are synchronous, they return straight away so the table dosnt have to wait for thousands of promises to resolve before it loads table data as this would dramatically increase table load times.
This means you cannot use asynchronous code like promises or await statements inside a mutator.
The correct approach would be make all these calls before you load your data into the table, and then load the finished data set in with the setData function

A: *This is the same answer for another question I posted. I didn't know what was wrong with my code so I posted two different questions for two things I thought were unrelated but i was wrong.
I figured it out, the problem was that in Tabulator, the mutator in the table was getting the data from another source than the one for the rest of the table, so the table was already built when the mutator started working, and what I figured out is that the mutator needs the data ASAP when it's fired, but it's source data wasn't ready yet, so what I did was to use:
function delayIt() {table.setData(API_URL)}
setTimeout(delayIt, 1000)

so the data from the mutator source was already available when the table was built so when the mutator was fired it all worked just fine. I'm sorry if it's confusing, I couldn't figure out how to explain other way.


text:
Q: How to filter a model in django? So i have a model called Partner. A business is a partner. I have a foreignkey field who takes self as a parameter to create choices. What i want to do is to go through all the created partners and filter out ones that are parent companies. I was thinking of having a boolean that says is_parent. How do i go about this can i search for the boolean in the database and create a choicefield or something with it so i can get a list of parent companies?
What i am trying to do is filter the parents and either make the filtered objects into a choicefiled or make a second model with it so i can offer the choice of selecting the parent.
I have tried to filter through my result but that did not work as expected.
from django.db import models
from django.urls import reverse

from model_utils import Choices
from model_utils.fields import StatusField
from model_utils.models import StatusModel, TimeStampedModel
from phone_field import PhoneField
from addresses.models import Address
from

common.utils import COUNTRIES

class Industry(models.Model):
    """ Business Industry model """
    name = models.CharField(max_length=100)

    class Meta:
        verbose_name = 'Industry'
        verbose_name_plural = 'Industries'
        ordering = ('name',)

    def __str__(self):
        return '%s' % self.name

class PartnerType(models.Model):
    name = models.CharField(blank=False,
                            help_text="Name of the role or function", max_length=64,
                            verbose_name="Partner Type", )

    class Meta:
        verbose_name = 'partner type'
        verbose_name_plural = 'partner types'

    # TO STRING METHOD
    def __str__(self):
        return '%s' % self.name

class Partner(TimeStampedModel, StatusModel):

    INVOICE_METHOD_CHOICE = (
        ("PAPER", "Paper"),
        ('EMAIL', 'Email'),
    )

    LEGAL_STRUCTURE_CHOICES = (
        ('CORPORATION', 'Corporation'),
        ('LLC', 'LLC'),
        ('SOLE PROPRIETOR', 'Sole Proprietor'),
        ('PARTNERSHIP', 'Partnership'),
    )

    PARTNER_OFFICE_CHOICES = (
        ('HEADQUARTERS', 'Headquarters'),
        ('DIVISION', 'Division Office'),
        ('SITE', 'Site'),
        ('DC', 'Distribution Center'),
    )

    ADDRESS_TYPES = (
        ('Billing', 'Billing'),
        ('Shipping', 'Shipping'),
        ('Physical', 'Physical'),
    )

    STATUS = Choices('Active', 'Inactive', 'Credit Hold',)
    name = models.CharField(blank=True, max_length=100, verbose_name='Account Name', )
    office_level = models.CharField(
        choices=PARTNER_OFFICE_CHOICES, max_length=50, blank=True,)
    trade_name = models.CharField(blank=True, max_length=100, verbose_name='Trade Name', )
    logo = models.ImageField(default='default.jpg', upload_to='partners/logos')
    industry = models.ForeignKey(
        Industry,
        blank=True,
        help_text="Industry",
        null=True,
        on_delete=models.SET_NULL,
        related_name="partners_industry", )
    csp_rank = models.IntegerField(blank=True,null=True )
    partner_types = models.ManyToManyField(PartnerType)
    account_number = models.IntegerField(blank=True, editable=True,default=0)
    vendor_number = models.CharField(blank=True, help_text="TEAZZERS account number with the partner", max_length=20,)
    phone = PhoneField(blank=True, null=True, )
    fax = PhoneField(blank=True, null=True, )
    email = models.EmailField('main email address', blank=True)
    ap_email = models.EmailField('AP email address', blank=True)
    ar_email = models.EmailField('AR email address', blank=True)
    website = models.URLField('Website', blank=True)
    description = models.TextField(blank=True)
    total_units = models.PositiveIntegerField(blank=True, null=True, verbose_name='Total units',
                                            help_text='How many locations does this organization have?')

    parent = models.ForeignKey(
        'self',
        blank=True,
        help_text="Parent Company name (if necessary)",
        null=True,
        on_delete=models.CASCADE,
        max_length=200
        )
    # if total_units > 0:
    #     status = 'Parent'
    #
    # if status == "Parent":
    #     parent = models.ForeignKey(
    #     'self',
    #     blank=True,
    #     help_text="Parent Company name (if necessary)",
    #     null=True,
    #     on_delete=models.CASCADE,
    #     related_name="partners_partner", )

    w9 = models.BooleanField(default=False, verbose_name='IRS Form W-9',
                             help_text='Have we received a completed IRS Form W-9?',)
    legal_structure = models.CharField(
        choices=LEGAL_STRUCTURE_CHOICES, max_length=50, blank=True,
        help_text='How is the business structured?',)
    ein = models.CharField(max_length=9, blank=True, default='', verbose_name='Federal Employer Identification Number')
    duns = models.CharField(max_length=13, blank=True, default='', verbose_name='Dun & Bradstreet (DUNS) Number')
    gln = models.CharField(max_length=13, blank=True, default='', verbose_name='GLN (GS1 Global Location Number)')
    insurance = models.BooleanField(default=False, verbose_name='Insurance',
                                    help_text='Have we received liabilty insurance paperwork?',)
    insurance_end_date = models.DateField(blank=True, null=True, verbose_name='Insurance End Date',
                                          help_text="When does insurance on file end? "
                                                    "Please use the following format: YYYY-MM-DD.")
    insurance_files = models.FileField(upload_to='partners/insurance', blank=True,
                                       verbose_name='Current Insurance Paperwork')
    sales_tax = models.BooleanField(default=False, verbose_name='Sales Tax Paperwork',
                                    help_text='Have we received Uniform Sales & Use Tax Certificate?',)
    sales_tax_files = models.FileField(upload_to='partners/sales_tax', blank=True,
                                       verbose_name='Current Insurance Paperwork')
    invoice_method = models.CharField(
        choices=INVOICE_METHOD_CHOICE, max_length=64, default='paper')
    start_date = models.DateField(blank=True, null=True, verbose_name='Active Since',
                                  help_text="When we begin doing business? Please use the"
                                            " following format: YYYY-
    MM-DD.")
    address_type = models.CharField(
        max_length=20, choices=ADDRESS_TYPES,blank=True)
    street1 = models.CharField(
        'Street Line 1', max_length=100, blank=True)
    street2 = models.CharField(
        'Street Line 2', max_length=100, blank=True)
    city = models.CharField('City', max_length=100, blank=True)
    state = models.CharField('State', max_length=100, blank=True)
    postcode = models.CharField('Post/Zip-code', max_length=32, blank=True)
    country = models.CharField(
        max_length=3, choices=COUNTRIES, blank=True)

    def __str__(self):
        # return self.city if self.city else ""

        return '%s' % self.full_address

    @property
    def full_address(self):
        return ' %s %s %s %s %s' % (self.street1, self.street2, self.city,
    self.state, self.postcode)

    def get_complete_address(self):
        address = ""
        if self.street1:
            if address:
                address += ", " + self.street1
            else:
                address += self.street1
        if self.street2:
            if address:
                address += ", " + self.street2
            else:
                address += self.street2
        if self.city:
            if address:
                address += ", " + self.city
            else:
                address += self.city
        if self.state:
            if address:
                address += ", " + self.state
            else:
                address += self.state
        if self.postcode:
            if address:
                address += ", " + self.postcode
            else:
                address += self.postcode
        if self.country:
            if address:
                address += ", " + self.get_country_display()
            else:
                address += self.get_country_display()
        return address

    primary_address = models.ForeignKey(
        Address,
        blank=True,
        help_text="Primary Address",
        null=True,
        on_delete=models.SET_NULL,
        related_name="partners_industry")
    # MANAGERS
    parent_list = list()
    # META CLASS
    class Meta:
        verbose_name = 'partner'
        verbose_name_plural = 'partners'

    # TO STRING METHOD
    def __str__(self):
        return '%s' % self.name

    @property
    def full_name(self):
        return '%s %s' % (self.name, self.site_id)

    # SAVE METHOD

    def save(self, *args, **kwargs):
        super(Partner, self).save(*args, **kwargs)
        #self.account_number = self.pk + 1000

    # ABSOLUTE URL METHOD
    def get_absolute_url(self):
        return reverse('partners:detail', kwargs={'pk': self.pk})

    def get_delete_url(self):
        return reverse('partners:delete', kwargs={'pk': self.pk})

'''

A: Assuming you have some other model (not shown in your models.py above) for which you want to only have parent companies be available for selection, first define a callable:
parent_companies():
    return Partner.objects.exclude(parent=None).values_list('id', 'name')

Then use the callable for choices=:
class SomeModel(models.Model):
    some_company = models.ForeignKeyField(Partner, choices=parent_companies())

A: this query will get you all the parent companies in all levels
assume that we have a structure like that

*

*1 is parent of 3 and 4

*2 is a parent of 6 and 5

*3 is a parent of 9 and 10

*4 is a parent of 11 and 12

*6 has no sons

*5 is a parent of 7 and 8

*13 has no parent # parent = None

so (1, 2, 3, 4, 5) is a parent as every one has at least one son
parents = ModelName.objects.exclude(parent=None).values_list('parent', flat=True).annotate(count = Count('parent')).order_by('parent')

this return for you a list of ids for all parents
you can get queryset of parents as below
parents_queryset = ModelName.objects.filter(id__in=list(parents))

note : parent means it already have at least one son
if you need to get with them the node which already doesn't have parent # parent is None
and assume that it have no parent so it is a parent
new_parents_queryset = parents_queryset | ModelName.objects.filter(parent=None)
# this queryset is all the parents that have at least one son or the parents that have no parent

here (1, 2, 3, 4, 5, 13) is the parents as 13 have no parent


text:
Q: OpenCV imread not working on Android I have a C++ project using OpenCV that I need to use on Android. To simplify, let's say that this is the project code:
Test.h:
#include <iostream>

class Test
{
    public:

    Test();
    ~Test();

    static std::string getTest(std::string filePath);
};

Test.cpp:
#include "opencv2/imgcodecs.hpp"
#include "Test.h"

using namespace cv;

std::string Test::getSize(std::string filePath)
{
    Mat image = imread(filePath, 1);

    std::stringstream stringStream;

    if(image.empty())
    {
        stringStream << "Error loading image at path: " << filePath;
        std::string error = stringStream.str();

        return error;
    }

    stringStream << "Image size: " << image.rows << " * " << image.cols;
    std::string result = stringStream.str();

    return result;
}

I wrote my JNI bindings and set up my Android.mk and it compiles, but the imread method does not work: the image is empty (the image.empty() test is true).
What can be wrong here? I checked that the file exists, so I guess that it is either:

*

*a permission problem (I added the read/write external storage permissions, but it may be lower level issues)

*a file path problem. I provided an absolute file path (like "/storage/emulated/0/test.jpg"). Does OpenCV expect a relative path? If so, relative to what?

A: Too bad, it was just that I did not accept the storage permission on the Android 7 phone -_-


text:
Q: Spacing between navigation links My problem is that I want to have spacing between the navigation links. I have searched over the internet but all I get are reducing the space.
To be specific, I want to have spacing in between each navigation link that are bordered with a black border.
These are my codes for the navigation bar. I would really appreciate some help. thank you.

ul {
    list-style-type: none;
    position: fixed;
    margin-top: 50px;
    padding: 0;
    width: 200px;
    background-color: #fff;
    border: 5px solid #000;
 }

 li a {
    display: block;
    color: #000;
    padding: 8px 16px;
    text-decoration: none;
 }

 li {
    text-align: center;
    border-bottom: 5px solid #000;
 }

li:last-child {
     border-bottom: none;
}

li a:hover {
    background-color: #555;
    color: white;
}

Home

News

Contact

About

A: You need to use margin to add the white space, but the borders needed a little tweaking, see comments below
ul {
  list-style-type: none;
  position: fixed;
  margin-top: 50px;
  padding: 0;
  width: 200px;
  background-color: #fff;
  /*border: 5px solid #000; moved to LI element*/
}

li a {
  display: block;
  color: #000;
  padding: 8px 16px;
  text-decoration: none;
  margin-bottom:10px; /*add some margin to create the white space*/
  border: 5px solid #000; /*add the border to each LI element rather than UL*/
}
li {
  text-align: center;
  /*border-bottom: 5px solid #000; remove this bottom border as handled in    LI css*/
}

A: Here it is:

Home

News

Contact

About

Demo: https://jsfiddle.net/4fLbx4xa/

A:

Home

News

Contact

About

A: Not sure what you want to achieve but i understood a line between the links, this might help you also if you want it below the links..

ul {
    list-style-type: none;
    position: fixed;
    margin-top: 50px;
    padding: 0;
    width: 400px;
    background-color: #fff;
    border: 5px solid #000;}

 li a {
    display: block;
    color: #000;
    padding: 8px 16px;
    text-decoration: none;}
 li {
    text-align: center;
    float: left;
    border-right:solid 1px black;
}

li a:hover {
    background-color: #555;
    color: white;
}

Home

News

Contact

About


text:
Q: External table not in the expected format I kept getting External table not in the expected format and I don't know why. I tried both 2003 and 2007 connection string techniques, but still it didn't work.
Below is my code. Thanks!
string filename = Path
            .GetDirectoryName(System.Reflection.Assembly
            .GetExecutingAssembly().GetName().CodeBase) +
            "\\acu.xls";
        filename = filename.Substring(6);

        //string connString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
            //"Data Source=" + filename + ";" +
            //"Extended Properties=\"Excel 8.0;HDR=NO;IMEX=1;\"";

        string connString = "Provider=Microsoft.ACE.OLEDB.12.0;" +
            "Data Source=" + filename + ";" +
            "Extended Properties=\"Excel 12.0;HDR=YES\"";

        OleDbDataAdapter dbAdapter = new OleDbDataAdapter("Select * from [Sheet1$]", connString);

        DataSet myDataSet = new DataSet();
        dbAdapter.Fill(myDataSet, "ACUList");

        DataTable dataTable = myDataSet.Tables["ACUList"];

        var query = from r in dataTable.AsEnumerable()
                    select new
                        {
                            Firstname = r.Field<string>("FIRSTNAME"),
                            CardNo = r.Field<string>("CARDNO")
                        };

        foreach (var item in query)
        {
            Console.WriteLine(item);
        }
        Console.ReadKey();


text:
Q: Is it possible to run multiple Spark applications on a mesos cluster? I have a Mesos cluster with 1 Master and 3 slaves (with 2 cores and 4GB RAM each) that has a Spark application already up and running. I wanted to run another application on the same cluster, as the CPU and Memory utilization isn't high. Regardless, when I try to run the new Application, I get the error:
16/02/25 13:40:18 WARN TaskSchedulerImpl: Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient memory
I guess the new process is not getting any CPU as the old one occupies all 6.
I have tried enabling dynamic allocation, making the spark app Fine grained. Assigning numerous combinations of executor cores and number of executors. What I am missing here? Is it possible to run a Mesos Cluster with multiple Spark Frameworks at all?

A: You can try setting spark.cores.max to limit the number of CPUs used by each Spark driver, which will free up some resources.
Docs: https://spark.apache.org/docs/latest/configuration.html#scheduling


text:
Q: Sending array to controller in Laravel I have a div containing different images that can be sorted, i don't know how to send the h array containing the new ids to the controller, so that it will be updated by the controller
This is my HTML

if(isset($images_ext)&& !empty($images_ext))
  foreach ($images_ext as $image)

id}}">

id}}" style="background-image: url('{{$image->filename}}')" data-src="{{$image->filename}}">

This is my jquery code
  $(document).ready(function(){
        $('.reorder').on('click',function(){
            $("ul.reorder-photos-list").sortable({ tolerance: 'pointer' });
            $('.reorder').html('save reordering');
            $('.reorder').attr("id","saveReorder");
            $('#reorderHelper').slideDown('slow');
            $('.img-w').attr("data-src","");
            $('.img-w').css("cursor","move");
            $("#saveReorder").click(function( e ){
                if( !$("#saveReorder i").length ){
                    $(this).html('').prepend('saving...');
                    $("ul.reorder-photos-list").sortable('destroy');
                    $("#reorderHelper").html( "Reordering Photos - This could take a moment. Please don't navigate away from this page." );
                    var h = [];
                    $("ul.reorder-photos-list li").each(function() {  h.push($(this).attr('id') ) });

                    $.ajax({
                        type: "POST",
                        url: "{{route("settings.updatephotos")}}",
                        data: {ids: " " + h + ""},
                        success: function(){
                            window.location.reload();
                        }
                    });
                    return false;
                }
                e.preventDefault();
    });
});
})

A: Just use data: {ids: h} and in your controller request()->ids will get you an array


text:
Q: Oracle выборка дат Есть поле DATE_CR в формате Date со значением типа 30.09.15.
Могу сделать выборку по конкретной дате
SELECT * FROM Table  where  to_date(DATE_CR,'dd.mm.yy') = to_date('30.09.15','dd.mm.yy');

Как сделать выборку только по годам, по месяцам и по дням?

A: попробуй это
SELECT * FROM CLS_USER_LOG
where  to_date(DATE_CR,'dd.mm.yy') >=
to_date('01.01.15','dd.mm.yy') and
to_date(DATE_CR,'dd.mm.yy') <=
to_date('31.12.15','dd.mm.yy');

A: Чтобы из даты получить конкретное значение года, месяца, дня и т.п. можно использовать функцию extract, например:
select extract(year from sysdate) from dual --вернет 2015
select extract(month from sysdate) from dual --вернет 9
select extract(day from sysdate) from dual --вернет 30

Тогда запрос будет иметь вид:
select *
from Table
where extract(year from DATE_CR) = 2015

Так же можно использовать функцию trunc, например:
select trunc(sysdate, 'yy') from dual --вернет 01.01.2015
select trunc(sysdate, 'mm') from dual --вернет 01.09.2015

Тогда запрос будет иметь вид:
select *
from Table
where trunc(DATE_CR, 'yy') = date'2015-01-01'

A: Если реально дата в формате Date, то можно совсем просто:
SELECT * FROM Table  where  extract(year from DATE_CR) = 2015;

Соответственно для месяца:
SELECT * FROM Table  where  extract(year from DATE_CR) = 2015 and extract(month from DATE_CR) = 10;

Ну или как было указано выше, делать trunc до необходимого показателя:
--год
SELECT * FROM Table  where  trunc(DATE_CR,'year') = to_date('01.01.2015','dd.mm.yyyy');
--месяц
SELECT * FROM Table  where  trunc(DATE_CR,'month') = to_date('01.10.2015','dd.mm.yyyy');
--день
SELECT * FROM Table  where  trunc(DATE_CR) = to_date('30.10.2015','dd.mm.yyyy');


text:
Q: drop-down list with search capability Suppose I have simple drop-down list - (http://jsfiddle.net/J52s9/). Here for this drop-down list How i can have a search option.
For example if in the textbox user writes Weeks the drop-down list having week as a part of string should only appear .
I am using php.
I tired-
    <html>
    <head>
    </head>
    <body>
    <select name="dateRange" id="mySelect" size="1">
           <option value > Select Duration </option>
           <option value="A">Last 24 Hours</option>
           <option value="B">Last 2 Days</option>
           <option value="C">Last Week</option>
           <option value="D">Last 2 Weeks</option>
           <option value="E">Last Month</option>
           <option value="F">Last 3 Months</option>
           <option value="G">Last 6 Months</option>
           <option value="H">Last Year</option>
    </select>
    </form>
    </body>
    </html>

    $(document).ready(function() {
        $('select').chosen();
    });

Please guide.
Thanks in advance !

A: chosen is a nice jQuery plugin for that
$('select').chosen();

updated jsfiddle: http://jsfiddle.net/J52s9/2/

A: You can use html5 datalist element to do as per your requirement.
Check if this is what you need:
Copy the following in an html file.
<!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>
    <label>Search</label>
    <input list='mySelect'>
    <datalist name="dateRange" id="mySelect" size="1">
           <option value > Select Duration </option>
           <option value="A">Last 24 Hours</option>
           <option value="B">Last 2 Days</option>
           <option value="C">Last Week</option>
           <option value="D">Last 2 Weeks</option>
           <option value="E">Last Month</option>
           <option value="F">Last 3 Months</option>
           <option value="G">Last 6 Months</option>
           <option value="H">Last Year</option>
    </datalist>
    </form>
    </body>
    </html>


text:
Q: What is the status on quantum information (processing, communication...) in infinite-dimensional Hilbert spaces? In canonical references for learning quantum information, such as Nielsen's Quantum Computation and Quantum Information and Preskill's lecture notes, the focus seems to be on systems with finite-dimensional Hilbert spaces. This is evident given the overall interested in the most basic quantum system: a qubit.
However, nature is largely comprised of systems with infinite-dimension Hilbert spaces (e.g. QFT), with finite-dimension systems consisting of only parts of these systems (e.g. the polarization of a photon) and engineered ones, used for our practical and operational purposes.
It is understandable, from this operational point of view, to consider finite-dimensional systems, and to engineer systems with this feature. It seems also reasonable that to consider the ultimate physical consequences of engineered systems only a finite number of states are considered (i.e. even though harmonic oscillators have an infinite tower of states, those with arbitrarily large energy are not accessible, if not non-physical; if not even this, at least other systems will interact with only a finite interval of states, considering UV and IR cutoffs).
It is also interesting, nonetheless, to consider the consequences of how informations "flows" in infinite-dimensional Hilbert spaces, especially those with a continuum of states. Such as in the references alluded to above, these topics do not seem to be very much expounded upon.
From research I have made, at most we have the literature on continuous variable quantum information, which is still strict as it seems to focus intensively on Gaussian states, or the papers on relativistic quantum information, where the quantum fields are often traced out very soon. The topics which I am thinking about include the whole machinery of superoperators, quantum channels, metrology measures, etc.

*

*Is there a full-blown literature on these topics that I am missing? That is, are my premises, including the physical ones, even reasonable?

*If not, what are the difficulties that impede extensive research and results in this direction?

*Physically, what is there to gain from considering infinite-dimensional Hilbert spaces, if anything?

*Tangentially, I could imagine a connection between this machinery and that of algebraic quantum field theory, is there something in this direction too?

I would like to emphasise that the physical part of this question is also of interest. What I mean by this is, for instance, the physical considerations going in the choice of finite-dimensional systems for quantum information processing ("to what extent are they really choices and not our incapacity?" would be a question).


text:
Q: An exe file that I want to run on linux made for windows comes up as a Trojan on VirusTotal - how would I run it without it affecting my system? Is there any way that I can run this program on my Linux system without possibly getting a virus?

A: Be aware please that even tough this will work probably fine, running a virus inside any live system is never a good idea, even if you are sure that you can revert / eliminate the effects of the virus. For a safer approach the answer from bodhi.zazen is recommended. This is the safest steps to run something that is not really safe.

Any program running inside a wine prefix has only access to the virtual bottle in that .wine prefix folder in your home and nothing else. They are closed inside that bottle.
That said it is also true that a default created bottle also creates standard links in to your home folder and root file system, you need to make sure that those are deleted before running the executable. Some pesky trojans will scan drivers for executable or other specific file type and try to infect those.
A better option is to create a new bottle and thus isolating it from your normal bottle, for that you need to run the .exe file on a separate prefix, do that by following this example:
export WINEPREFIX=~/wine_possible_trojan
wine winecfg

At this point look for the mounted points created for the bottle, they should be on the drives tab, remove any letters that are not c:\, that will prevent the trojan of fiddling with any files inside your home or the root file system:

After removing the drivers from the bottle you can run the executable using the bottle you just created with using something like
WINEPREFIX=~/wine_possible_trojan wine path_to_exefile.exe

After that deleting ~/wine_possible_trojan will delete the bottle from your system eliminating the modifications done by the trojan inside that bottle.
If you are unsure you can also install a virus scanner in your Linux system and run that after )and maybe before to see if it picks anything up) deleting the .wine prefix. Have a look at this post for options available:

*

*Available anti-virus for Ubuntu 11.10

The other option would be, as bodhi.zazen said, to install VirtualBox from the Ubuntu Software Center, install Ubuntu or Windows (if available) in to a new virtual system in VirtualBox and run the .exe inside that virtual system.
For more information about VirtualBox please visit the Wikipedia page, the official VirtualBox page and have a look at How to install VirtualBox in AskUbuntu.com.

I can see from the AV scan report you added to the comments that only 1 engine picked it up out of all of those on the list, I would say false positive.

A: You would need to run it in an isolated test system, such as a VM and investigate what it does.
What exactly is it ?
It is hard to believe you "need" to run an infected .exe.
It is possible you have a false positive as well (depending on how you detected the virus and what, if any, investigation you have done).


text:
Q: How to click a webpage button using AutoHotKey I'm doing a script automation with navigating this a using AutoHotKey. I don't have that much knowledge on AHK. Is there a way to click the "Search by Parcel Number" button shown in the screenshot below using AHK? I noticed the Class changes with Active when the link is clicked.
My script so far:
        SendRaw Search by Parcel Number
        Sleep KeySleepSlow
        Send {esc}
        Sleep KeySleepSlow
        Send {enter}

Here is the website https://www.indy.gov/workflow/property-taxes
Thank you.

A: There are many ways for AHK to interact with a webpage. A quick and dirty way would be to simply have AHK tell the browser to do it.
The Javascript can be used in the address bar to interact with a page, but there are a few tricks to it. The comments in the script below should explain it all:
+space:: ; Triggered with Shift+Space
    GoSub mySub1
Return

mySub1:
    ;The original clipboard contents is first saved in a variable so that it is not lost when the script is run.
    originialClipboard := Clipboard

    ;The clipboard is used so that the text is quickly entered into the address bar, instead of having each character typed out.
    ;Javascript is used to simulate a click on the desired document element. The 'j' is omitted by design.
    Clipboard := "avascript:document.evaluate(""//a[text()='Search by parcel number']"", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click();"

    ;CTRL+L puts the text cursor in the address bar. Then the letter "j" is typed, because Chrome does not allow the text "javascript:" to be pasted in. The rest of that string will be pasted in later.
    send ^lj ;

    ;CTRL+V pastes the clipbard
    send ^v
    sleep 1 ;Sleep for a short moment to allow the browser to catch up.
    send {enter} ;The Enter key is sent, executing the javascript, simulating a click on the button.

    ;The clipboard is restored to its original value
    clipboard := originialClipboard

Return


text:
Q: run time error. automation error. the remote procedure call failed I wrote below code to sort an excel column like:
Sub deneme()
Workbooks("macro.xlsm").Activate

Dim excelApp As New Excel.Application
excelApp.Visible = False

excelApp.Workbooks.Open Filename:="C:\Users\cildi\Desktop\sortdeneme\New\new.xlsx"

Dim excelsWbk As Object
Set excelsWbk = excelApp.Workbooks("new.xlsx")

excelsWbk.Sheets("Sheet1").AutoFilter.Sort.SortFields.Add2 Key _
    :=Range("A1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
    xlSortNormal
With excelsWbk.Sheets("Sheet1").AutoFilter.Sort
    .Header = xlYes
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
End With
End Sub

But I get the error "run time error. automation error. the remote procedure call failed"
at the line:
excelsWbk.Sheets("Sheet1").AutoFilter.Sort.SortFields.Add2 Key _
    :=Range("A2"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
    xlSortNormal

I search but cannot find any solution.

Thanks for any help.

A: In Another Excel Instance
Option Explicit

Sub HiddenSort()
    Const ProcName As String = "HiddenSort"

    Const FolderPath As String = "C:\Users\cildi\Desktop\sortdeneme\New\"
    Const fName As String = "new.xlsx"
    Const wsName As String = "Sheet1"
    Const SortColumn As Long = 1

    On Error Resume Next
    Dim twb As Workbook: Set twb = Workbooks(fName)
    On Error GoTo 0
    If Not twb Is Nothing Then
        MsgBox "The file '" & fName & "' in folder '" & FolderPath _
            & "' is already open.", vbCritical
        Exit Sub
    End If

    Dim xlApp As Object: Set xlApp = CreateObject("Excel.Application")
    xlApp.Visible = True ' just out-comment, don't use 'False'.

    On Error GoTo ClearError

    Dim wb As Object: Set wb = xlApp.Workbooks.Open(FolderPath & fName)

    Dim ws As Object: Set ws = wb.Worksheets(wsName)
    If ws.AutoFilterMode Then
        ws.AutoFilterMode = False
    End If

    Dim rg As Range: Set rg = ws.Range("A1").CurrentRegion
    Dim krg As Range: Set krg = rg.Columns(SortColumn)

    rg.Sort Key1:=krg, Order1:=xlAscending, Header:=xlYes
    ws.AutoFilterMode = False
    wb.Close SaveChanges:=True
    Set wb = Nothing ' prevent 'Run-time error '-2147417848': Automation error'

SafeExit:
    If Not wb Is Nothing Then
        wb.Close SaveChanges:=False
    End If
    xlApp.Quit

    Exit Sub
ClearError:
    Debug.Print "'" & ProcName & "': Unexpected Error!" & vbLf _
              & "    " & "Run-time error '" & Err.Number & "':" & vbLf _
              & "    " & Err.Description
    Resume SafeExit
End Sub


text:
Q: PHP - Get number of different records (dates) in database Is there a way of getting the number of different records from a table in a database?
For Example: I have a table, which contains many records for one date and some other records for other dates. I need to count the number of different dates in the table, so classic mysql_num_rows isn't usable here.

A: What you are looking for is GROUP BY.
E.g.
SELECT COUNT(*), `date_field` FROM `some_table` GROUP BY `date_field`

A: SELECT COUNT(dates) FROM `table` GROUP BY dates;

A: use this to get the rows
SELECT DISTINCT `recored_date` FROM `table`

or this to count the rows
SELECT COUNT(DISTINCT `record_date`) FROM `table`


text:
Q: How to start a DialogFragment with transition in Android? Following is my scenario.
I have an Activity MainActivity which has one FAB. When the user clicks on FAB, I open a full screen DialogFragment. I want to open the DialogFragment with some transitions.
Here is the code that I have tried so far.
//MainActivity.java

 final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
 fab.setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View view) {

    ReviewDialog reviewDialog = ReviewDialog.newInstance();
    Slide slide = new Slide();
    slide.setSlideEdge(Gravity.LEFT);
    slide.setDuration(1000);
    reviewDialog.setEnterTransition(slide);
    Bundle bundle =ActivityOptions.makeSceneTransitionAnimation(ScrollingActivity.this)
        .toBundle();
    reviewDialog.setArguments(bundle);
    reviewDialog.show(getSupportFragmentManager(),"review");
  }
});

And here is the code of the DialogFragment ReviewDialog.
   //ReviewDialog.java
    public class ReviewDialog extends DialogFragment {
  static ReviewDialog newInstance() {
    ReviewDialog f = new ReviewDialog();

    // Supply num input as an argument.
    Bundle args = new Bundle();
    f.setArguments(args);
    return f;
  }

  @Override
  public void onActivityCreated(Bundle arg0) {
    super.onActivityCreated(arg0);
    Slide slide = new Slide();
    slide.setSlideEdge(Gravity.LEFT);
    slide.setDuration(1000);
    getDialog().getWindow().setEnterTransition(slide);
    getDialog().getWindow().setExitTransition(slide);
    getDialog().getWindow().setReenterTransition(slide);}

  @Override
  public void onCreate(Bundle bundle){
    super.onCreate(bundle);
    setStyle(DialogFragment.STYLE_NORMAL,R.style.DialogTheme);
  }

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.dialog_review, container, false);
    return v;
  }

}

Also I have set the following property in my AndroidManifest.xml
<item name="android:windowContentTransitions">true</item>

The problem is when the ReviewDialog is started, it doesn't show any transitions.
I am able to show transitions between different activities but finding it very hard to show transition between Activity and Fragment.
How to show transitions when a DialogFragment is started ?

A: Use this library :  https://github.com/lgvalle/Material-Animations
Shared element transition works with Fragments in a very similar way as it does with activities.
a) Enable Window Content Transition
values/styles.xml
<style name="MaterialAnimations" parent="@style/Theme.AppCompat.Light.NoActionBar">
    ...
    <item name="android:windowContentTransitions">true</item>
    ...
</style>

b) Define a common transition name
layout/fragment_a.xml
<ImageView
        android:id="@+id/small_blue_icon"
        style="@style/MaterialAnimations.Icon.Small"
        android:src="@drawable/circle"
        android:transitionName="@string/blue_name" />

layout/fragment_b.xml
<ImageView
        android:id="@+id/big_blue_icon"
        style="@style/MaterialAnimations.Icon.Big"
        android:src="@drawable/circle"
        android:transitionName="@string/blue_name" />

c) Start a fragment with a shared element
FragmentB fragmentB = FragmentB.newInstance(sample);

// Defines enter transition for all fragment views
Slide slideTransition = new Slide(Gravity.RIGHT);
slideTransition.setDuration(1000);
sharedElementFragment2.setEnterTransition(slideTransition);

// Defines enter transition only for shared element
ChangeBounds changeBoundsTransition = TransitionInflater.from(this).inflateTransition(R.transition.change_bounds);
fragmentB.setSharedElementEnterTransition(changeBoundsTransition);

getFragmentManager().beginTransaction()
        .replace(R.id.content, fragmentB)
        .addSharedElement(blueView, getString(R.string.blue_name))
        .commit();

And this is the final result:


text:
Q: What to if i made changes to production.env in mydjango website .Google gives timeout error when i load my website I turn debug=true and add 127.0.0.1 to allowed host list in production.env and run the python manage.py runserver command to connect to the local host. It worked fine. But later when change the debug to false and removed 127.0.0.1 from allowedhost list and try to reach my site on google it gives time out error. What should i do to get my site up run in google or production server? Is there some django or python command to restore the site to previous state? Im new to Django

A: *

*First of all, you definitely MUST NOT use python manage.py runserver command in production if you use it.

*Instead of python manage.py runserver we use so-call wsgi application. You can think as first middleware (aha, there is second middleware) between you python code and browsers. The most popular wsgi apps: uwsgi, gunicorn.

*After setup WSGI you need install and setup webserver (second middleware) between your code and browsers. The most popular webservers: nginx, apache2.

So, path to your server should look like:
Browser -> [Nginx -> gunicorn -> python code]

Everything that is in [square brackets] should be installed on your server(s).
Yes, it is a little bit complicated for the first time, and I would recommend using something like Heroku for deploying the first times.


text:
Q: Maven not building Scala project correctly Problem
I got a Maven - Scala project. It compiles etc. when I want to build it in IntelliJ it works but the output jar is empty except a pom.xml.
When a build the whole project via command line with mvn scala:compile I get the following errors:
[INFO] Compiling 67 source files to /Users/my.name/Documents/company/util/util/target/classes at 1555483575272
[ERROR] error: scala.reflect.internal.MissingRequirementError: object java.lang.Object in compiler mirror not found.
[ERROR]     at scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:17)
[ERROR]     at scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:18)
[ERROR]     at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:53)
[ERROR]     at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:45)
[ERROR]     at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:45)
[ERROR]     at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:66)
[ERROR]     at scala.reflect.internal.Mirrors$RootsBase.getClassByName(Mirrors.scala:102)
[ERROR]     at scala.reflect.internal.Mirrors$RootsBase.getRequiredClass(Mirrors.scala:105)
[ERROR]     at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass$lzycompute(Definitions.scala:257)
[ERROR]     at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass(Definitions.scala:257)
[ERROR]     at scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1394)
[ERROR]     at scala.tools.nsc.Global$Run.<init>(Global.scala:1215)
[ERROR]     at scala.tools.nsc.Driver.doCompile(Driver.scala:31)
[ERROR]     at scala.tools.nsc.MainClass.doCompile(Main.scala:23)
[ERROR]     at scala.tools.nsc.Driver.process(Driver.scala:51)
[ERROR]     at scala.tools.nsc.Driver.main(Driver.scala:64)
[ERROR]     at scala.tools.nsc.Main.main(Main.scala)
[ERROR]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]     at java.base/java.lang.reflect.Method.invoke(Method.java:564)
[ERROR]     at scala_maven_executions.MainHelper.runMain(MainHelper.java:164)
[ERROR]     at scala_maven_executions.MainWithArgsInFile.main(MainWithArgsInFile.java:26)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  8.256 s
[INFO] Finished at: 2019-04-17T08:46:16+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.3.1:compile (default-cli) on project util: wrap: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)

I also can run mvn compile which succeeds but produces an empty jar:
[INFO] Building util 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ util ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/markus.geilehner/Documents/Syniverse/util/util/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ util ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 6 source files to /Users/markus.geilehner/Documents/Syniverse/util/util/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.334 s
[INFO] Finished at: 2019-04-17T09:03:55+02:00
[INFO] ------------------------------------------------------------------------

Project File Structure
-util
--src
---main
----scala
-----com.company.util
------Scala Classes and packages

pom.xml
Here some parts of the pom.xml. I use the net.alchim Scala-maven plugin.
The build process is configured to use the scala directory.
<build>
        <sourceDirectory>src/main/scala</sourceDirectory>
        <testSourceDirectory>src/test/scala</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>3.3.1</version>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <reportPlugins>
                        <plugin>
                            <artifactId>maven-project-info-reports-plugin</artifactId>
                            <version>2.2</version>
                        </plugin>
                        <plugin>
                            <groupId>net.alchim31.maven</groupId>
                            <artifactId>scala-maven-plugin</artifactId>
                            <version>3.3.1</version>
                            <configuration>
                                <jvmArgs>
                                    <jvmArg>-Xms64m</jvmArg>
                                    <jvmArg>-Xmx1024m</jvmArg>
                                </jvmArgs>
                            </configuration>
                        </plugin>
                    </reportPlugins>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>

A: Solution
I had the same error when working with a scala project combined with maven.
Issue-1
One Issue can be that you use the wrong Java-Version (9/10) try to change it to Java 8 (1.8) in IntelliJ (File => Project-Structure).
Issue-2
In your pom add the following execution beneath the maven-scala plugin.
<executions>
                    <execution>
                        <id>compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <phase>compile</phase>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <phase>test-compile</phase>
                    </execution>
                    <execution>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>

Do a clean install an try again.