text:
Q: Why do I get this error when I add another constructor? I will gladly change the title of this thread to something more appropriate once I know what subject this falls under.
If I change the parameters of the error-causing constructor, there is no error.
This error only occurs if I include that exact constructor:
error: no matching function for call to 'Object::Object(Object)'
note: candidates are: Object::Object(Object&)
note:                 Object::Object()

Code:
#include <iostream>

using namespace std;

class Object {

  public:

    Object() {}     /* default constructor - no problems at all */

    Object( Object & toCopy ) {}  /* Cause of error, but no error when commented out */

    Object func() {
      Object obj;
      return obj;
    }

};

int main() {

  Object o = o.func();  /* this is the line that the error is actually on */

  return 0;

}

A: You have declared an unusual and terrible copy constructor, namely one which takes the argument by non-constant reference. This is possible, and it means that no other copy constructor will be defined implicitly. However, it also means that you cannot construct copies from temporary values, since those don't bind to non-constant references.
Unless you had a reason to do what you were doing (maybe you want to define auto_obj :-) ?), you should declare the usual copy constructor with argument Object const & (but make sure to define it correctly!), or just leave it out entirely and rely on the implicitly generated version (as happens when you "comment out the line" in your code); or in C++11 you can default the copy constructor  by declaring Object(Object const &) = default;.
(Note that the popular Rule of Three says that you either should not be defining your own, non-trivial copy constructor, or if you do, then you also need a user-defined destructor and assignment operator. Make sure your code is sane.)

A: the error you got
error: no matching function for call to 'Object::Object(Object)'
note: candidates are: Object::Object(Object&)
note:                 Object::Object()

means that compiler is looking for appropriate copy constructor for class Object. There is no such function in your class definition: your version cannot be used to bind temporary (see below). The correct version might be defined by yourself with:
Object(const Object& orig) {
    // and initialize data here, and return
}

or you can just don't declare such function, and working version will be generated automatically, thus there is no error then as well.

note:
you are trying to define Object( Object & toCopy ) {}. This is not correct because taking non-const reference to temporary means you cannot use this temporary object to create a copy from it in your constructor because temporary objects cannot be assigned to non-const reference.
So to express this diferent way:
-> compiler is searching for copy constructor
-> finds your version
-> and this version tells: I will not do it
Finally:
Object o = o.func();

this is not good idea. Referring to nonstatic members of objects that have not been constructed or have already been destructed is undefined behavior. Make func() static so might be used like Object::func() or call it on properly constructed object.

A: Try Object(const Object &toCopy) { }

A: As already pointed out by many previously, the problem is that you only defined a copy constructor taking a reference, but the return of the call of o.func(); is an rvalue, which can only bind to rvalue references or const references, not to regular references.
Your code however has another issue, calling func() on o, which at that point is a yet uninitialized object, is a very bad idea. Maybe you intended to implement the factory idiom? In this case I would advise that you declare Object func(); static, and call it from the scope of Object, like so:
Object o = Object::func();


text:
Q: Problems with the integration of recaptcha v3 and contact form 7 i have a wordpress page that has a contact form 7, i already created the new recaptcha v3 keys and put them in the integration box, i eliminated the tag [recaptcha] from the form, but i can't make the badge show in any of the pages.
Can someone help me with this?

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to store User's money in database? What is the best way to store people's current balance in MySQL? I'm developing something like Neobux, so each user have a balance data in MySQL..

A: Use decimal(10,2). float is susceptible to rounding errors, see here.
For further information, you can take a look at these pages:

*

*What's the best datatype to properly store money/currency in MySQL?

*Storing money amounts in MySQL

A: I say store all of the transactions rather than just the current balance.  That way you have history, and you can run different aggregates on it rather than just "final balance."

A: For accounting in a relational database see Ruby on Rails REST design question - transfer money between accounts

A: If you would just store balance then add just a input in database but if you want to store all transactions you should get a new table with username as referrer to class all transactions automatically note that, if you aren't a great programmer it would be hard to make the type of website you want so please consider purchasing a ready one .


text:
Q: Can someone please help me figure how to convert these measurements I am doing in practice problems? I am trying to figure out how to convert these measurements and I don't know how. Can someone help me out?

*

*456.8 cm3 = ___________ L

*1.9 hg = ____________ cg

*12.345 m = ________ mm

*How many kiloliters are in 15.0 deciliters?

*How many centigrams are in 22.65 grams?

*How many millimeters are in 1500.0 meters?

A: These are all measurements in metric units, so conversion is simply a matter of multiplying or dividing by the appropriate power of 10. The prefixes and scaling factors can be found here:
https://en.wikipedia.org/wiki/Metric_prefix
So for example 1 hg (hectogram) = 100 g  and 1 g = 100 cg (centigrams).
Therefore 1.9 hg = 190 g = 19,000 cg.
Use the same approach for the rest.


text:
Q: How to make object accessible to rest of class I need to create a class that can open a file and write to it, but am having a lot of trouble. I have searched and found answers that should have helped me, but I haven't been able to implement them. I can create the file but am unable to access it in main.
Say I have a class:
class Log{
  public:
  Log(string name){
     ofstream log(name);

  void Entry(string message){
       file << message << endl;

and I want to be able to print to this file created in the constructor from main using the Entry function.
int main(){
Log log("LogFile.txt);
log.Entry("message");
}

Of course, my fstream file isn't within the scope of Entry. How can I access it? I tried using a pointer and ended up with a memory leak crash; I am very rusty right now. Any help would be greatly appreciated. Thank you in advance.

A: In order to fix your problem you need to use an instance variable in your class.
So your class would be:
class Log{
  ofstream log;
  public:
  Log(string name){
     log.open(name);

  void Entry(string message){
       file << message << endl;

Hope this helps.


text:
Q: Can't understand this simple passage involving multivariable calculus A certain passage in my Fundamentals of Thermodynamics book is driving me crazy. I considered posting this is Physics.SE, but I think the question is eminently mathematical. Here is the passage:

As we know, $c_p$ is defined as: $$c_p = \left(\frac{\partial h}{\partial T} \right)_p \tag1$$
  We also have seen that: $$T\ ds = dh - v\ dp \tag2$$
  Therefore: $$c_p = T \left({\partial s \over \partial T} \right)_p \tag3$$

I've spent hours trying to figure out how to get to $(3)$. I really want to do this as rigorously as a graduated mechanical engineer can.
So far I have two "approaches," one that is fine for most of my friends but is very informal and another that is more correct, but leads me nowhere.
In case it's needed, let me give some background on the thermodynamic variables:

*

*for curiosity's sake, $c_p$ means specific heat in a constant pressure process;

*$p, v, T, u, h, s$ are properties, of which any one can be seen as a function of any other two;

*the notation $\left({\partial a \over \partial b}\right)_c$ means that, in that derivative, $a = a(b,c)$, so its purpose is to make it clear that the variable held constant is $c$.

Approach 1: simple but "wrong"
From $(2)$, we have: $$dh = T\ ds + v\ dp \tag4$$
We plug that directly into $\partial h$ of $(1)$ to obtain: $$c_p = \left({T\ \partial s + v\ \partial p \over \partial T} \right)_p \tag5$$
Since $p$ is held constant, $\partial p = 0$, so $(3)$ emerges.
My problems with this:

*

*Making $\partial h = dh$ and plugging it in $(1)$ looks awful to me. I've never seen a "partial differential" outside of a partial derivative (e.g. $\partial h$ by itself). We usually take that liberty with "total differentials," but I've never seen that done with partials.

*$\partial p$ can't even exist inside the derivative of $(5)$, since it would mean $p = p(T, p)$, which... does it make any sense?! Anyway, it can be argued that the partial derivative would indeed be zero, but it sucks.

Approach 2: correct but dead end
If we make $h = h(T, p)$, then comes: $$dh = \left({\partial h \over \partial T} \right)_p  dT + \left({\partial h \over \partial p} \right)_T dp\tag6$$
Equating with $(4)$ gives: $$\left({\partial h \over \partial T} \right)_p = T\frac{ds}{dT} + \frac{dp}{dT}\left[v - \left({\partial h \over \partial p} \right)_T \right] \tag7$$
So, from $(1)$: $$c_p = T\frac{ds}{dT} + \frac{dp}{dT}\left[v - \left({\partial h \over \partial p} \right)_T \right] \tag8$$
Which doesn't look like $(3)$ at all. In order to make it better, we could "open up" $\frac{ds}{dT}$ with $s(T,p)$ and eventually find: $$c_p = T \left({\partial s \over \partial T} \right)_p + \frac{dp}{dT}\left[v - \left({\partial h \over \partial p} \right)_T + T \left({\partial s \over \partial p} \right)_T \right] \tag9$$
We'd need the second term to be zero, but $\frac{dp}{dT}$ certainly isn't and I don't see why the $[\cdots]$ would be either.
Did I go wrong somewhere? Is Approach 2 really optimal? I appreciate any help.

A: Here's how I would think about it:
Since we want to do this mathematically, let's be pedantic and not use the physicists' habit of letting the same letter denote a physical quantity and the function which describes its dependence on other physical quantities.
(A convenient practice, but also a source of much confusion...)
Thus, if we wiew $h$ as a function of $T$ and $p$, we write
$$h=H_1(T,p),$$
where $h$ is the value of a physical quantity and $H_1$ is a function of two variables.
But if we wiew $h$ as a function of $s$ and $p$, it's a different function, so we use another symbol and write
$$h=H_2(s,p)$$
instead.
Now, $s$ may also be viewed as a function of $T$ and $p$, say $s=S(T,p)$,
and if we insert this into $H_2$ we get an expression for $h$ as a function of $T$ and $p$, and this must of course agree with what the function $H_1$ says, so we have the relation
$$
H_1(T,p) = H_2(S(T,p),p)
\tag{a}
.
$$
What physicists write as
$$
c_p = \left(\frac{\partial h}{\partial T} \right)_p
,
$$
a pure mathematician would write as
$$
c_p(T,p) = \frac{\partial H_1}{\partial T}(T,p)
,
$$
and using the chain rule in (a), we see that we can also compute this as
$$
c_p(T,p) = \frac{\partial H_2}{\partial s}(S(T,p),p) \, \frac{\partial S}{\partial T}(T,p)
.
\tag{b}
$$
Next, the differential relation
$$
dh = T \, ds + v \, dp
$$
concerns $h$ as a function of $s$ and $p$, so it says something about the function $H_2(s,p)$, namely that if we write $T=\tau(s,p)$ and $v=V(s,p)$ to denote the dependence of $T$ and $v$ on $s$ and $p$, then we have
$$
\tau(s,p) = \frac{\partial H_2}{\partial s}(s,p)
\qquad\text{and}\qquad
V(s,p) = \frac{\partial H_2}{\partial p}(s,p)
.
$$
Comparing the first of these two equalities with what we had in (b), we find that
$$
c_p(T,p) = \tau(S(T,p),p) \, \frac{\partial S}{\partial T}(T,p)
.
$$
Here, finally, $\tau(S(T,p),p)$ is simply $T$ again (if you think about the definitions for a while), while $\frac{\partial S}{\partial T}(T,p)$ is what physicists write as $\left({\partial s \over \partial T} \right)_p$. And there you have it, $c_p = T \, \left({\partial s \over \partial T} \right)_p$.

A: Approach 1 is not so bad. Think of dh as δh, a small change in h. You have a simple system. If p is fixed then there is effectively only one variable. In other words, these are not really partial derivatives, because only one variable can vary.
The use of partial derivatives is really a kind of aide-memoire, because in practice you have some formula for s involving maybe p and T and you have to remember that p is not a variable.
For example, for an ideal gas you might have $s=k\ln T-R\ln p+k'$ for some constants $k,k'$. If you keep $p$ fixed, then $s$ is just a function of $T$.
I am not sure why you think $\frac{\text{d}\,p}{\text{d}\,t}$ is definitely non-zero. $p$ is being kept fixed, so when $T$ varies it does not change. So the rate of change must be 0. Of course, there may be some mechanism going on behind the scenes to make that happen, but that is often the case.
I agree that it would be better if people did not use things like $\partial p$. It would be better to use the traditional physicist's approach of writing it as $\delta x$ - the equivalent of the mathematician's $\epsilon-\delta$ arguments.
In Approach 2, p is fixed, so it does not depend on anything, even T, so your argument above is not right.

A: Differential of $f(x, y)$ in $(x_0, y_0)$ is a function defined like this:
$$df(\delta x, \delta y)_{(x_0, y_0)} = \frac{\partial f}{\partial x}_{(x_0, y_0)} \delta x + \frac{\partial f}{\partial y}_{(x_0, y_0)} \delta y$$ for any $\delta x, \delta y \in \mathbb{R}$
Consider equation (2) and treat all functions as functions of $T, p$ then:
$$T(\frac{\partial s}{\partial T}_{(T_0, p_0)} \delta T + \frac{\partial s}{\partial p}_{(T_0, p_0)} \delta p) = \frac{\partial h}{\partial T}_{(T_0, p_0)} \delta T + \frac{\partial h}{\partial p}_{(T_0, p_0)} \delta p - v \ dp(\delta T, \delta p)_{(T_0, p_0)} \ \   (*)$$
$d p$ is abuse of notation, for clarity let's get rid of it:
$$d p(\delta T, \delta p)_{(T_0, p_0)} = d f (\delta T, \delta p)_{(T_0, p_0)},$$
where
$f(T, p) = p$
so
$$d f (\delta T, \delta p)_{(T_0, p_0)} = 1\ \delta p \ \ (**)$$
Now we can substitute (**) into $(*)$ and diffirentiate (*) by $\delta T$ to get result derived in your book. Actually this would be more strictly written approach 1:
$$T\frac{\partial{ds}}{\partial \delta T} = \frac{\partial ds}{\partial \delta T} - v \frac{\partial d p}{\partial \delta T}$$

A: You can derive pretty much everything from equation (2) you have
$Tds = dh - vdp$
Taking derivative with respect to T gives
$T\frac{\partial s}{\partial T}= \frac{\partial h}{\partial T} - v \frac{\partial p}{\partial T}$
(Note that we dropped a ds term from the LHS since it holds no significance in such equation)
Now keeping p constant you lose the last term and you get the desired result


text:
Q: run batch file only when the same process is not in progress I would need to run batch when user logs in, but if any other cmd.exe is running, then batch won't execute.
Maybe something similar to this: How can I recognize a running batch file in task manager?. But I would need no action if some other cmd.exe is running.
Thank you for help


text:
Q: Simple column change query doesn' work in MySQL 5.7 I have an update query created by MySQL Workbench 8 and it looks as follows:
-- MySQL Workbench Synchronization
-- Generated: 2019-12-16 00:30
-- Model: New Model
-- Version: 1.0
-- Project: Name of the project
-- Author: user0

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ALLOW_INVALID_DATES';

ALTER TABLE `best_bpgallery`.`k96qw_bpgallery_images`
CHANGE COLUMN `language` `language` NCHAR(7) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci' NOT NULL DEFAULT '*' ;

SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

It looks perfectly fine for me, but when I run it fails:
Executing SQL script in server
ERROR: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci' NOT NULL DEFAULT '*'' at line 2
SQL Code:
        ALTER TABLE `best_bpgallery`.`k96qw_bpgallery_images`
        CHANGE COLUMN `language` `language` NCHAR(7) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci' NOT NULL DEFAULT '*'

SQL script execution finished: statements: 3 succeeded, 1 failed

Fetching back view definitions in final form.
Nothing to fetch

I even compared the query to ALTER TABLE documentation and it looks fine for me. So what's going on? What am I missing?

A: You have to change nchar to varchar for example.
ALTER TABLE `best_bpgallery`.`k96qw_bpgallery_images`
CHANGE COLUMN `language` `language` VARCHAR(7) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci' NOT NULL DEFAULT '*' ;

nchar doesn't support charecter set


text:
Q: Problems signing release-ready APK A fellow developer has mailed me the release apk of an android app he developed for us. I put the APK file on the desktop.
He sent that file, then gave us this link to follow instructions for signing the app (with Ionic framework which he used to develop the app)
The problem is that if I try to follow the steps I always get an error stating that The current working directory is not a Cordova-based project.
Then I have tried to sign the app with android Studio, but it obviously tries to sign an app that IS An ANDROID STUDIO project.
Is there any chance to sign that apk? If not I should wait the developer to come back from holidays (too long time).

A: It is best to wait. If you are using Android Studio, it is built and signed both at once. You could get the code from him and build it on your own.
It is not working because your desktop is not Cordova based. Create a cordova directory and sign it in there.


text:
Q: Count the number of inputs in a page Is there a way I can count the number of inputs in a single page?
Say if the page has 5 inputs, a save button will appear- and if there is no inputs on the page, the save button will not appear. How do i do this?
i have this but i dont think this is right
<script>
var x = 0;
var ins = 0;
$(':input').each(function(){
    x++;
});
ins = x;

and pass the ins variable to php like
<?php echo '<script>ins</script>';?>

but it doesnt echo anything? is the code right tho

A: I am not sure if you actually need to have JavaScript be echoed in php since you can determine count in the first line, but you can not pass javascript to php without ajax. Here is a basic example:
/index.php
<input type="text" name="name1" value="1111974167" />
<input type="text" name="name2" value="1392666449" />
<input type="text" name="name3" value="1329903177" />
<input type="text" name="name4" value="913532785" />

<script>
$(document).ready(function() {
    // Get the count of the inputs found
    var x = $('input').length;
    // Pass the count to php
    $.ajax({
        url: '/count.php',
        data: {
            "count": x
        },
        type: 'post',
        // This is what happens with the ajax returns from count.php
        success: function(response) {
            alert(response);
        }
    });
});
</script>

/count.php
<?php
if(!empty($_POST['count'])) {
    $count  =   $_POST['count'];
    die('The count is: '.$count);
}

You would get an alert dialogue box that says:

The count is: 4

A: Two line code is enough for you.If you have not any input fields the submit button will be automatically hide.

var inputs = document.querySelectorAll('input');
console.log(inputs);
alert(inputs.length);
if(inputs.length==0)
{
 document.querySelector('#button').style.display = 'none';
}
<input type="text" name="name1" value="1111974167" />
<input type="text" name="name2" value="1392666449" />
<input type="text" name="name3" value="1329903177" />
<input type="text" name="name4" value="913532785" />
<button id="button">submit</button>

JS fiddle:
https://jsfiddle.net/njv5e8yc/1/


text:
Q: Using at sign (@) in usernames linux. Is it safe? I've read about what charachers should usernames use, in linux, here: https://serverfault.com/a/578264/330936 but I would like to know if is there any problem if I will use the at sign "@" in my usernames. I will use it especially for my ftp accounts (I have a simple webserver with CentOS 7).
I don't want to be portable to other older versions of linux, nor other distros (maybe debian).
Is there any problem in using @ in usernames?

A: I'd say it isn't good idea.
I'd recommend to use simple regex:
([a-z_][a-z0-9_]{0,30})

Check following links:
https://stackoverflow.com/questions/6949667/what-are-the-real-rules-for-linux-usernames-on-centos-6-and-rhel-6
https://unix.stackexchange.com/questions/157426/what-is-the-regex-to-validate-linux-users

A: Using '@' in a username would make it impossible to use that username as the local-part of an email address, so I would say that is not a good idea.


text:
Q: Verifying a signed XML with public key in java Hey guys I have a signed a XML with the private key and now I want to verify with public key that it was the same private key used to sign the XML.
My verify() function is below
       public boolean verify(String signedXml) {

    boolean verificationResult = false;

    try {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        dbf.setNamespaceAware(true);
        Document signedDocument = dbf.newDocumentBuilder().parse(new InputSource(new StringReader(signedXml)));

        NodeList nl = signedDocument.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature");
        if (nl.getLength() == 0) {
            throw new IllegalArgumentException("Cannot find Signature element");
        }

        XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");

        DOMValidateContext valContext = new DOMValidateContext(getCertificateFromFile(publicKeyFile).getPublicKey(), nl.item(0));
        XMLSignature signature = fac.unmarshalXMLSignature(valContext);

        verificationResult = signature.validate(valContext);

    } catch (Exception e) {
        System.out.println("Error while verifying digital siganature" + e.getMessage());
        e.printStackTrace();
    }

    return verificationResult;
}

And the getCertificateFromFile() is
       public X509Certificate getCertificateFromFile(String certificateFile) throws GeneralSecurityException, IOException {
    FileInputStream fis = null;
    try {
        CertificateFactory certFactory = CertificateFactory.getInstance("X.509", "BC");
        fis = new FileInputStream(certificateFile);
        return (X509Certificate) certFactory.generateCertificate(fis);
    } finally {
        if (fis != null) {
            fis.close();
        }
    }

}

when I verify my Signed XML with public key (.cer ) it returns always true no matter how many changed I made in signed XML, I even used different private key and it still giving true !
Any suggestions?


text:
Q: Angular Material 2 Reactive Forms -- mat-error with *ngIf not showing when validating for minLength, email and required validation works Stackblitz: https://stackblitz.com/angular/nvpdgegebrol
This is literally the official Angular Material example forked and changed the logic to show the mat error against minLength validation instead of email.
It works fine for required validation and email validation and the message shows up and all is good but with minLength *ngIf simply does not show.
Code:
HTML:
<mat-error *ngIf="emailFormControl.hasError('minLength') && !emailFormControl.hasError('required')">
  Please enter a valid email address
</mat-error>

TS:
emailFormControl = new FormControl('', [
  Validators.required,
  Validators.minLength(10),
]);

There's also the `ErrorstateMatcher but it's boilerplate and works.

A: Just a simple typo on your end:
<mat-error *ngIf="emailFormControl.hasError('minlength') &&
   !emailFormControl.hasError('required')">
   Please enter a valid email address
 </mat-error>

minLength -> minlength


text:
Q: Preventing mulitple instance of an asynctask, or creating a persistent boolean My objective is that onCreate of a particular activity will start running an Async-task "BackgroundTask".
  I want to make sure that only one BackgroundTask will run at any given time, so before calling .execute I want to first check to see if a Boolean is tripped to indicate another is already running.
I wish for this Async-task to run perpetually even if the app is not currently on screen.  It should only be closed if the user pushes a button to end it, or perhaps force closes the entire thing.
Question:
Can I create a Boolean who's value will never be reset by going to home screen or moving further into or outside of all the activities in my app?
I don't know enough about when or why Android loses saved variables in apps.

A: You can save this boolean in your preferences like the following:
        boolean booleanValue = true;
    String somePreferencesKey = "SOME_PREFERENCES_KEY";
    SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
    pref.edit().putBoolean(somePreferencesKey, booleanValue).commit();

And then, at any time in the future, you can get the saved boolean value from your saved preferences as follows:
        boolean booleanValue;
    String somePreferencesKey = "SOME_PREFERENCES_KEY";
    SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
    booleanValue = pref.getBoolean(somePreferencesKey, false);

Hope this solves your problem.
Thanks,
Mohamed.


text:
Q: How does accordion collapse doesn't toggle on button click The images are like this
1. On page load.
2. When click on collapseTwos button i.e (next) ,the collapseTwos doesn't toggle.
The live example is here , this works fine on it ,but in asp page it doesn't
Follow the link
http://www.bootply.com/DcMZxTPDI8#

All file are included ,this code i'm working in masterpage child.The CollapseTwos always reamin untoggle on button click.This problem occurs on every page load,then after it works.

                        META DATA

                                        Next

                        META DATA

                                        Next

                        META DATA

                                        Next

The Javascript is as follows.

All js files are included in it

A: I copied and pasted your code it works on my machine. And why did you comment those anchor tags? Anyways, i uncommented those and it works mate.


text:
Q: Alert Dialog with an option to request the email verification link from firebase is not working I am trying to show an alert dialog with two buttons ("OK" and "Send Email") in user login activity. I am using firebase for user authentication. Before trying to implement alert dialog, I used Toast.makeText to show that email address is not verified and I was working perfectly fine. But now I want to give user an option to request the email verification link again in case they couldn't find the previous one. I went through https://developer.android.com/guide/topics/ui/dialogs.html and also went through some questions and answers on slackoverflow. The problem I am facing here is even though I can make the dialog popup by making a fragment class, I can't use this option. Because I don't know a way to retrieve current user instance from firebase to another class. It always crushes the app if I try to do it that way. So, I tried to implement alert dialog in the activity class and you can see my code below.
firebaseAuth.signInWithEmailAndPassword(email, password)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    progressDialog.dismiss();

                    if(task.isSuccessful()){

                        final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
                        if (!user.isEmailVerified()){

                            AlertDialog.Builder emailAlert  = new AlertDialog.Builder(getActivity());
                            emailAlert.setTitle("Verify you email");
                            emailAlert.setMessage("The email address is not verified.");
                            emailAlert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int id) {
                                    firebaseAuth.signOut();
                                    return;
                                }
                            });
                            emailAlert.setNegativeButton(R.string.send_email, new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int id) {
                                    user.sendEmailVerification()
                                            .addOnCompleteListener(new OnCompleteListener<Void>() {
                                                @Override
                                                public void onComplete(@NonNull Task<Void> task) {
                                                    if (task.isSuccessful()){
                                                        Toast.makeText(LoginActivity.this, "Email Sent", Toast.LENGTH_SHORT).show();
                                                    }
                                                    firebaseAuth.signOut();
                                                    return;
                                                }
                                            });
                                }
                            });

                            emailAlert.create();
                        }
                        startActivity(new Intent(getApplicationContext(),HomeActivity.class));

                    }

                    else{
                        Toast.makeText(LoginActivity.this, "Login Failed, please make sure all feids are complete", Toast.LENGTH_SHORT).show();
                    }
                    progressDialog.dismiss();
                }
            });

There is no run time error but the alert dialog is not showing up. Can someone please point me out what I am doing wrong? And please let me know if there is a better way to get the same outcome.

A: First of all replace

AlertDialog.Builder emailAlert  = new AlertDialog.Builder(getActivity());

with

AlertDialog.Builder emailAlert  = new AlertDialog.Builder(this);

Because getActivity() will not work for Activity.
And the main thing is that replace

emailAlert.create();

with

emailAlert.show();

Hope your problem will be solved.


text:
Q: How to format cells between two dates with a colour based on a value in vba? (apologies if this question is difficult to understand, i'm unable to post an image)
I've tried finding a solution for this online but haven't had much luck.
Ideally, I want to use conditional formatting to highlight each cell within a row of dates between two dates. There one problem.. I want the colour to be specified by a value based in another cell.. if this can be done using a module then great!
i.e. I've inserted a each day within the calendar horizontally across the spreadsheet from F2 for an entire year.
IF C2 = 01/12/14 & D2 = 24/12/14 and E2 = 3. All cells between dates of C2 and D2 will fill with the colour RED.. likewise with IF C3 = 01/05/14 & D3 = 05/05/14 and E3 = 2, the cells will be filled with the colour of blue.
thanks

A: I don't believe there is any method to dynamically choose the color when using Excel's built in Conditional Formatting. You could, as you guessed, use some VBA to accomplish though.
Assuming Column C has the lower date in the range range, Column D has the upper date in the range, Column E contains a colorindex (see here), and Column F has the date we are testing (and this is the cell we are coloring) you can create the following subroutine:
Public Sub update_colors()
    Dim rngDates As Range
    Set rngDates = Sheet1.Range("F2:F3")

    Dim rngDateCell As Range
    For Each rngDateCell In rngDates.Cells
        If Sheet1.Cells(rngDateCell.Row, 3).Value <= rngDateCell.Value And Sheet1.Cells(rngDateCell.Row, 4).Value >= rngDateCell.Value Then
            rngDateCell.Interior.ColorIndex = Sheet1.Cells(rngDateCell.Row, 5).Value
        End If
    Next rngDateCell

End Sub

Set F2:F3 in the third line to the entire range of dates in your worksheet.
You can kick off this subrouting/udf with a button. On your developer tab (go here for instructions on how to enable it, if you haven't already) Click "Insert" and choose the button under "Form Controls". Draw the button somewhere on the sheet (you can move it afterwards), and choose the subroutine you just created from the list. Now when you click the button, the subroutine will run.
If you don't like the colors, you can use something besides .interior.colorindex() to set the cell color. I'm a big fan .Interior.Color = RGB(,,)  You would need to have the RGB values in the sheet somewhere to pull that off, but you will have millions of colors to choose from instead of just the 56 that colorindex allows.


text:
Q: Why is Pandas not adding two columns at the same time here? I´m currently working on a "restocker" simulator which starts with a different stock position from the actual one, receive daily inputs of the actual sales and has to do 3 tasks:

*

*update the stock position for all itens at all stores after today sales

*verify if the current stock position has reached the "re-stock point" (85% of the full stock position)

*compute the re-stock for all itens at all stores after the LEAD_TIME (each store has a different LEAD_TIME)

First I´m gonna laid out all the concepts you guys need to know:

*

*GRID - Can be describe as the "stock target" the max stock position.
At the first day of operation, the stock position is equal to the GRID and restocking will always try to bring the stock position back the GRID

*To the purpose of simplification, we´ll use a fixed GRID but in reality this GRID is supposed to be dynamic and recalculated after each re-stock

*SIM_SALES = SALES

*SIM_STOCK(day n) = SIM_STOCK(day n-1) - SALES(day n) + RESTOCK(day n)

*If SIM_STOCK - SALES <= 0 , the SALES of the day will be assumed as zero also.

The structure of the DataFrame goes something like this (example with ONE ITEM - ONE STORE) and contains the actual values:
INDEX      ITEM     STORE   STOCK(UN)   SALES(UN)   DAY     LEAD_TIME    GRID
0          4058855  1000    173         0           1       5            55
1          4058855  1000    172         1           2       5            55
2          4058855  1000    163         9           3       5            55
3          4058855  1000    149         14          4       5            55

Analogously, our simulated grid will be like this at the day one:
INDEX      ITEM     STORE   STOCK(UN)   SALES(UN)   DAY     LEAD_TIME    GRID      KEY      RESTOCK      COUNTER
 0         4058855  1000    55          0           1       5            55        False    0            0
 1         4058855  1000    0           0           2       5            55        False    0            0
 2         4058855  1000    0           0           3       5            55        False    0            0
 3         4058855  1000    0           0           4       5            55        False    0            0

What I´m looking for is that:
INDEX      ITEM     STORE   SIM_STOCK(UN)   SIM_SALES(UN)   DAY     LEAD_TIME    GRID      KEY      RESTOCK      COUNTER
0          4058855  1000    55              0               1       5            55        False    0            0
1          4058855  1000    54              1               2       5            55        False    0            0
2          4058855  1000    45              9               3       5            55        True     0            5
3          4058855  1000    31              14              4       5            55        True     0            4
4          4058855  1000    24              7               5       5            55        True     0            3
5          4058855  1000    15              9               6       5            55        True     0            2
6          4058855  1000    19              6               7       5            55        True     10           1
7          4058855  1000    11              8               8       5            55        True     0            5
8          4058855  1000    3               8               9       5            55        True     0            4

I´ve come up with a solution in 3 steps:

*

*Keep all the values (Stock, Sales, Key and Counter) in dictionaries.

*Update all the values after current day sales

*Re-calculate all the dictionaries values

Since the code is to extensive and complicated, I published the whole notebook where (there is a csv file included)
But the important part is that this is the actual DataFrame that I´m getting:
INDEX      ITEM     STORE   SIM_STOCK(UN)   SIM_SALES(UN)   DAY     LEAD_TIME    GRID      KEY      RESTOCK      COUNTER
0          4058855  1000    55              0               1       5            55        False    0            0
1          4058855  1000    54              1               2       5            55        False    0            0
2          4058855  1000    45              9               3       5            55        True     0            5
3          4058855  1000    31              14              4       5            55        True     0            4
4          4058855  1000    24              7               5       5            55        True     0            3
5          4058855  1000    15              9               6       5            55        True     0            2
6          4058855  1000    9               6               7       5            55        True     10           1
7          4058855  1000    1               8               8       5            55        True     0            5
8          4058855  1000    1               0               9       5            55        True     0            4

The code is doing everythins is supposed to except to add RESTOCK. Here is the part of the code where I both add the RESTOCK and subtract the SALES:
DF['SIM_STOCK'] = DF.apply(lambda row:(dict_est[(row['ITEM'],row['STORE'],row['DAY']-1)]
                                          -row['SIM_SALES']
                                          +row['RESTOCK'])
                              if row['DAY'] == CURRENT_DAY
                              else row['SIM_STOCK'],
                              axis=1)

How come Pandas is subtracting but not adding if both operations are happening in the same line of code?

A: I am not sure why your code does not work, but there is a much better, vectorised way to perform the calculation you wish to perform. This method may also resolve your problem.
DF['DICT_KEY'] = list(zip(DF['ITEM'], DF['STORE'], DF['DAY']-1))

DF['SIM_STOCK'] = np.where(DF['DAY'] == CURRENT_DAY,
                           DF['DICT_KEY'].map(dict_est) - DF['SIM_SALES'] + DF['RESTOCK'],
                           DF['SIM_STOCK'])

Explanation

*

*Create a pd.Series of tuples which is then fed as keys to
dict_est.

*Use np.where to specify your if / else conditions.

A: The problem was actually quite simple...
I was trying to grab the value from the column DF['RESTOCK], as follows:
DF['RESTOCK'] = np.where(DF['COUNTER'] == 1,
                       DF['DICT_RESTOCK'].map(dict_RST),
                       0)

But the DF['COUNTER'] column is updated after both RESTOCK and STOCK.
That´s the right way to grab the value:
DF['ABAST'] = np.where(((DF['DICT_KEY'].map(dc) == 1)&(DF['DAY'] == DIA_ATUAL))
                       |(DF['COUNTER'] == 1),
                      DF['DICT_ABAST'].map(dict_abs),
                      0)


text:
Q: Error usando Hilt con un Fragment base y MenuProvider Tengo una app Android que usa una clase BaseFragment para encapsular algunos métodos que todos mis fragmentos tienen en común:
open class BaseFragment<VB : ViewBinding> : Fragment() {

    protected var binding: VB? = null

    ...

    override fun onDestroyView() {
        super.onDestroyView()
        binding = null
    }
}

Estoy usando Hilt 2.38.1 para inyección de dependencias pero me da un error en la siguiente clase que implementa BaseFragment:
@AndroidEntryPoint
class HomeFragment : BaseFragment<FragmentHomeBinding>(),
    MenuProvider {
    ...
}

public final class HomeFragment extends com.example.ui.core.BaseFragment<com.example.databinding.FragmentHomeBinding> implements androidx.core.view.MenuProvider {
^
@AndroidEntryPoint base class must extend ComponentActivity, (support) Fragment, View, Service, or BroadcastReceiver.
[Hilt] Processing did not complete. See error above for details.

Entiendo que se refiere a que el entry point debe heredar de ComponentActivity, (support) Fragment, View, Service, o BroadcastReceiver, pero mi clase BaseFragment hereda de Fragment, no se si sea por el MenuProvider pues este es el único fragmento de mi app que lo usa
Alguien sabe que estoy haciendo mal o como puedo solucionar este error?


text:
Q: garagedoorjQuery doesn't work I'm using garagedoorjQuery in my drupal page. Can somebody tell me, why this code doesn't work like here? http://www.gayadesign.com/scripts/jquerygaragedoor/
    <link href='/css/garagedoor.css' rel='stylesheet' type='text/css' />

                        SOMETHING ABOUT ME

A: for future - drupal CMS by default is blocking  tag, also in "Full HTML" editor.
Problem resolved by using "PHP edit mode" or editing "Full HTML" mode to working with  tag.
Greetings


text:
Q: D3, nested appends, and data flow I'm in the process of finally learning D3, and I stumbled upon a problem that I haven't been able to find an answer to. I'm not certain if my question is because I'm not thinking idiomatically with the library, or if it is because of a procedure that I am currently unaware of. I should also mention that I've only started doing web-related things in June, so I'm fairly new to javascript.
Say that we're building a tool that gives a user a list of foods with respective images. And lets add on the additional constraint that each list item needs to be labeled by a unique ID so that it can be linked to another view. My first intuition to solve this is to create a list of
's each with their own ID, where each div has its own
 and . The resulting HTML would look something like:

Chocolate Cookie

Sugar Cookie

The data for this tool is in a JSON array, where an individual JSON looks like:
{ "label": "sugar", "text": "Sugar Cookie", "img": "sugar.jpg" }

Is there a way to do generate the HTML in one fell swoop? Starting with a base case of adding a div, the code might look something like:
d3.select(containerId).selectAll('div')
   .data(food)
   .enter().append('div')
   .attr('id', function(d) { return d.label; });

Now, what about adding a
 with a
 in it? My original thought was to do something like:
d3.select(containerId).selectAll('div')
   .data(food)
   .enter().append('div')
   .attr('id', function(d) { return d.label; })
       .append('p').text('somethingHere');

But, I see two problems with this: (1) how do you get the data from the div element, and (2) how can you append multiple children to the same parent in one declarative chain? I can't think of a way to make the third step where I would append on the img.
I found mention of nested selection on another post, which pointed to http://bost.ocks.org/mike/nest/. But is nested selection, and therefore breaking apart the appends into three chunks, appropriate/idiomatic for this situation? Or is there actually a well-constructed way to form this structure in one chain of declarations? It seems like there might be a way with subselections mentioned on https://github.com/mbostock/d3/wiki/Selections, but I'm not familiar enough with the language to test that hypothesis.
From a conceptual level, these three objects (div, p, and img) are treated more like one group rather than separate entities, and it would be nice if the code reflected that as well.

A: You cannot add multiple child elements within one chained command. You will need to save the parent selection in a variable. This should do what you want:
var data = [{ "label": "chocolate", "text": "Chocolate Cookie", "img": "chocolate.jpg" },
        { "label": "sugar", "text": "Sugar Cookie", "img": "sugar.jpg" }];

var diventer = d3.select("body").selectAll("div")
    .data(data)
  .enter().append("div")
    .attr("id", function(d) { return d.label; });

diventer.append("p")
    .text(function(d) { return d.text; });

diventer.append("img")
    .attr("src", function(d) { return d.img; });

See working fiddle: http://jsfiddle.net/UNjuP/
You were wondering how a child element like p or img, gets access to the data that is bound to its parent. The data is inherited automatically from the parent when you append a new element. This means that the p and img elements will have the same data bound to them as the parent div.
This data propagation is not unique for the append method. It happens with the following selection methods: append, insert, and select.
For example, for selection.append:

selection.append(name)
Appends a new element with the specified name as the last child of
  each element in the current selection. Returns a new selection
  containing the appended elements. Each new element inherits the data
  of the current elements, if any, in the same manner as select for
  subselections. The name must be specified as a constant, though in the
  future we might allow appending of existing elements or a function to
  generate the name dynamically.

Feel free to ask about the details if something is not clear.

EDIT
You can add multiple child elements without storing the selection in a variable by using the selection.each method. You can then also directly access the data from the parent:
var data = [{ "label": "chocolate", "text": "Chocolate Cookie", "img": "chocolate.jpg" },
        { "label": "sugar", "text": "Sugar Cookie", "img": "sugar.jpg" }];

d3.select("body").selectAll("div")
    .data(data)
  .enter().append("div")
    .attr("id", function(d) { return d.label; })
    .each(function(d) {
        d3.select(this).append("p")
          .text(d.text);
        d3.select(this).append("img")
          .attr("src", d.img);
    });

A: This isn't fundamentally different from nautat's answer, but I think that the code can be made a bit cleaner by saving the update selection rather than the enter selection, and getting the enter selection from it for the one operation that needs it (adding the surrounding div).
When you insert or append an element into the enter() selection, it's added to the update selection that you can work with afterward.  This means that you can join the data, then add a div with the enter selection, and then when you append with the update selection, you'll be appending within the divs that you added in the enter selection:

var cookies = [
  { "label": "sugar", "text": "Sugar Cookie", "img": "sugar.jpg" },
  { "label": "chocolate", "text": "Chocolate Cookie", "img": "chocolate.jpg" }];

var cookie = d3.select("#cookie-jar").selectAll().data(cookies);
cookie.enter().append("div");
cookie.append("p").text(function(d){ return d.text });
cookie.append("img").attr("src",function(d){ return d.img });
#cookie-jar div { border: solid 1px black; }

A: Again, not substantively different, but my preferred method would be to use 'call'
var data = [{ "label": "chocolate", "text": "Chocolate Cookie", "img": "chocolate.jpg" },
        { "label": "sugar", "text": "Sugar Cookie", "img": "sugar.jpg" }];

d3.select("body").selectAll("div")
    .data(data)
  .enter().append("div")
    .attr("id", function(d) { return d.label; })
  .call(function(parent){
    parent.append('p').text(function(d){ return d.text; });
    parent.append('img').attr("src", function(d) { return d.img; });
  });

you don't need to store any variables and you can factor out the called function if you want to use a similar structure elsewhere.


text:
Q: C# - Call a derived base method in the derived context Tried to search the web but found nothing so far so here my question:
I want to index model-information via attributes on the different members.
To do this i created a function in a base class that gathers all needed information when called.
This method is derived into the different models so that they can all be indexed.
Base()
{
    public virtual void Index() {...}
}

In the base class I'm calling a generic method that gives me acces to the indexing server for the specific model that I want to save there
using (var indexFacade = IndexFacadeFactory.GetIndexFacade(configuration, this))
{
    indexFacade.Execute(this, operation);
}

The issue I'm currently having is that when calling the factory it retrieves the information for the base-class.
What I want to acomplish is something like this:
Derived : Base
{
   [IndexingKey]
   long Id { get; set; }

   [IndexingField]
   string SomeValue { get; set; }
}

var derived = new Derived();
derived.Index();

My indexFacade holds the type of
IndexFacadeBase<Base>

I'm aware of the polimorphism here and why this happens.
My question is:
How can i call
derived.Index();

so that the context from which it is called is not from the base-class without overwriting it?
Further information:
The method that is called looks like this:
public static IndexFacadeBase<T> GetIndexFacade<T>(IndexInfo.IndexConfiguration config, T model)
        {
            IndexFacadeBase<T> retVal;
            .....
            return retVal;
        }

The T has the type of Base.
The model has the type of Derived.
Maybe that clears up some of the Problems.
I get back:
  IndexFacadeBase<Base>

I would need back:
   IndexFacadeBase<Derived>

Thanks in advance for all the help.

A: I may not be fully understanding your question, but aren't you simply looking to override the method in the derived class?
class Base
{
    public virtual void Index() { }
}

class Derived : Base
{
    public override void Index() { } // here is the override.
    long Id { get; set; }
    string SomeValue { get; set; }
}

Then when you do this:
var derived = new Derived();
derived.Index();

The derived class' Index method is called.

A: Maybe it would work if your IndexFacadeBase<Base> was changed to IndexFacadeBase<T> where T:Base.


text:
Q: Convert my columns in to rows in postgresql without creating any extensions I have a data result from a view like below,

But I want a view like this

Can any one help me to do this via postgresql without using extensions.

A: use aggregation
select project, max(case when role='owner' then name end) as owner,
 max(case when role='client' then name end) as client,
 max(case when role='Team' then name end) as Team
from table
group by project;

Alternatively you can use the filter() clause which makes this a bit easier to read:
select project,
       max(name) filter (where role='owner') as owner,
       max(name) filter (where role='client') as client,
       max(name) filter (where role='Team') as Team
from table
group by project;


text:
Q: Unable to change browser theme color in WordPress I've been trying to change the theme-color (https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android) by adding the meta to the  and using the following plugin https://wordpress.org/plugins/browser-theme-color/ but it just does not seem to work. Also used other plugins such as Mobile Address Bar Changer
 and Chrome Theme Color Changer.
Hope someone can give some pointers

A: Just put following code before </head> in your header.php file with every color you want.
<meta name="theme-color" content="#ef2121" />

Also keep in mind it just works on some mobile browsers.


text:
Q: Find the newest item in a C# generic list using Linq I have a generic list of items. Each item contains a DateTime field. I would like to find the newest item in the list using Linq in the most elegant and efficient way.
Elegance is more important than efficiency in my case, but doing this also in an efficient way would be nice.
Thank you.
After reading the answers: Here is the code (and the answer I liked):
using System.Collections.Generic;
using System.Linq;

class Item
{
    public Item Date { get; set; }
    public string Name { get; set; }
}

static void Main(string[] args)
{
    List<Item> items = CreateItems();
    Item newest;
    if (items.Count == 0)
        newest = null;
    else
        newest = items.OrderByDescending(item => item.Date).First();
}

A: For elegance, i would go by sorting the set based on the datetime field and returning the first item like:
set.OrderByDescending(x => x.DateTime)
   .FirstOrDefault();

This will create an in-memory representation of the sorted collection so efficiency is not that good. The most efficient solution for an unsorted set would be to loop over all items and save the newest. You can use linq for this by performing an aggregate operation which i find syntactically a mess.
Alternatively, you can store your items in a sorted collection like the SortedSet. This has a bit more complex insertion time 0(log2)  instead of O(1) for most collections but it allows you to immidiatly sort on datetime and therefore selecting the newest item in O(1) rather than O(n).

A: Most of the solutions so far have to completely sort the list first (via OrderByDescending), which is unnecessary and time consuming. What you want is Jon Skeet's MoreLinq MaxBy function. Source for MaxBy is on google code.
var newest = thelist.MaxBy(x => x.DateTimeField);

A: Try that:
var newItem = myList.OrderByDescending(item => item.yourDateTimeField).First();

A: Try Aggregate, i.e. something like:
list.Aggregate (
    DateTime.MinValue,
    (lastOne, current) => current.GreaterThan (lastOne) ? current : lastOne
)

i.e. if your field is DateTimeField, you should write something like
list.Aggregate (
    null,
    (lastOne, current) =>
        (lastOne == null) ||
             current.DateTimeField.GreaterThan (lastOne.DateTimeField)
        ? current
        : lastOne
)

A: try this one
 sortlist.OrderByDescending(a => a.timeStamp).First();


text:
Q: Is it possible to learn/separate this data? I have a highly imbalanced (~0.4% minority class) binary classification dataset of time series (flux) observations, and am now at a loss on how to classify it, as the data aren't separable. Here's what the data look like, both originally and with SMOTE oversampling.

I have tried SVM, KNN, RF, ANN, and CNN. SVM, KNN, ANN, and CNN produce similar results—classifying both training classes correctly about 60% of the time, but only classifying the test minority class correctly 1-2% of the time. RF overfits with 100% training accuracy/recall/precision, but the same results on the test data. I get these results regardless of the resampling technique I use on the training data.
Is it possible to do better than this, i.e., classify the minority class more than 2% of the time on unseen data? The classes pretty much overlap, so is there a way to separate them? I've seen some threads mentioning probability calibration, which I am familiar with. Is this something worth trying out even though I am only predicting class labels?

A: I suspect that there is little you can do here as there isn't enough data of the minority class to properly characterise the underlying distribution.  One of the problems with SMOTE is that the way the synthetic data are constructed generates spurious structure in the data (for instance the hole centred around  comp-1 = 0 and comp-2 = -2).  For this reason, make sure you perform evaluation using the original data distribution, not the SMOTEd data as the latter will reward learning of this spurious structure.  Another spurious structure that SMOTE creates is that all synthetic patterns will lie within the convex hull of the original data, which creates the straight, very defined boundaries, when in practice, there would be some chance of minority patterns beyond that boundary if sampled from the true data generating process.  SMOTE is a sensible sounding heuristic, but it is far from ideal.
Class imbalance generally isn't a problem unless you have very little data, and SMOTE is unlikely to improve performance in most cases.  Unfortunately where there is very little data, learning algorithms can demonstrate an undue bias against the minority class and in principle SMOTE can help, but if you have that little data there will be no way to determine the optimal amount of resampling to apply to correct that bias.


text:
Q: import ActionBarSherlock to eclipse I want to use ActionBarSherlock and HoloEveryWhere in my Android app
but when I import ActionBarSherlock Library in Eclipse, imported library contains many errors !!!
Library folder screenshot : here (Updated)
Problems screenshot : here
How can I fix it ?

My problem solved :)
I Changed Java compiler level to 1.6 .

A: The ActionBarSherlock library must be built against the last version(or 4.0) of Android(and the projects that use the library also have to be built against 4.0 or 4.1).
Right click the ActionBarSherlock library project -> Properties -> Android -> Check Android 4.1 -> Ok
More about this can be found on the library's site - > http://actionbarsherlock.com/usage.html
Updated:
Another possible reason for the errors is an incorrect compliance level.
Right click project -> Properties -> Java Compiler -> Set the compliance level to 1.6
See if this solves the problems.


text:
Q: Angle between two nearly identical vectors I found that using
angle <- (acos(sum(a*b) / (sqrt(sum(a * a)) * sqrt(sum(b * b)))))

is the most common way to get an angle between two vectors a and b in R.
Unfortunately, I keep on getting errors on certain vectors that seem to lay on each other or have an angle of about 180 degrees between each other.
For example:
a <- c(-7.6942088429381328e-01, 2.4999999999999989e-01)
b <- c(-5.4146791834239578e+08, 1.7593359143824694e+08)

do not work.
I am facing similar problems with other ways of calculating an angle.

A: I would use vector operations.
Let's define a proper function angle that takes as arguments two vectors x1 and x2
angle <- function(x1, x2, tol = 1e-6) {
    cost <- as.numeric((x1 %*% x2) / (sqrt(x1 %*% x1) * sqrt(x2 %*% x2)))
    if (abs(cost - 1) < tol) return(0) else return(acos(cost))
}

Note that we do a numeric stability check to ensure that for angles close to 0, we get a numeric result (instead of NA).
Then to calculate the angle (in radians) between two vectors, e.g.
x1 <- c(1, 1)
x2 <- c(0.5, 2)

we do
angle(x1, x2)
#[1] 0.5404195

In your case,
angle(a, b)
#[1] 0

Note that this will also work for higher dimensional vectors, e.g.
x1 <- c(1, 1, 1)
x2 <- c(0.5, 2, 0)
angle(x1, x2)
#[1] 0.7952027


text:
Q: Prob. 5, Sec. 20, in Munkres' TOPOLOGY, 2nd ed: What is the closure of $\mathbb{R}^\infty$ in $\mathbb{R}^\omega$ in the uniform topology? Here's Prob. 5, Sec. 20 in the book Topology by James R. Munkres, 2nd edition:

Let $\mathbb{R}^\infty$ be the subset of $\mathbb{R}^\omega$ consisting of all sequences that are eventually zero. What is the closure of $\mathbb{R}^\infty$ in $\mathbb{R}^\omega$ in the uniform topology? Justify your answer.

My effort:

Let $x = \left( x_1, x_2, x_3, \ldots \right)$ be an element of the closure of $\mathbb{R}^\infty$ in the uniform metric topology on $\mathbb{R}^\omega$. Then, for any real number $\varepsilon \in (0, 1)$, we can find a point $y = \left( y_1, y_2, y_3, \ldots \right)$ in $\mathbb{R}^\infty$ such that $\tilde{\rho}(x,y) < \varepsilon$, where
  $$\tilde{\rho}(x,y) = \sup \left\{ \ \min \left\{ \ \left\vert x_n - y_n \right\vert,  \ 1 \ \right\} \ \colon \ n \in \mathbb{N} \ \right\}.$$
  So, for each $n \in \mathbb{N}$, we have $\left\vert x_n - y_n \right\vert  < \varepsilon$.
Now as $ y \in \mathbb{R}^\infty$, so there exists a natural number $N$ such that $y_n = 0$ for all $n > N$. So we can conclude that $\left\vert x_n \right\vert < \varepsilon$ for all $n > N$, form which it follows that the sequence $x$ converges to the real number $0$.
Conversely, if $x = \left( x_1, x_2, x_3, \ldots \right)$ is a sequence of real numbers converging to $0$, then, for any given real number $\varepsilon \in (0, 1)$, we can find a natural number $N$ such that $\left\vert x_n \right\vert < \frac{\varepsilon}{2}$ for all $n > N$.
Now let $y = \left( x_1, \ldots, x_N, 0, 0, \ldots \right)$. Then clearly $y \in \mathbb{R}^\infty$ and $\tilde{\rho}(x,y) \leq \frac{\varepsilon}{2}$, thus showing that $x$ is in the closure of $\mathbb{R}^\infty$.
Thus, the closure of $\mathbb{R}^\infty$ in the uniform topology on $\mathbb{R}^\omega$ equals the set $c_0$ of all the sequences of real numbers which converge to $0$, in the standard metric on $\mathbb{R}$.

Am I right?

A: Looks great!  The only improvement I can see is that in the converse direction, you might as well just use $\varepsilon$ instead of $\frac{\varepsilon}{2}$.


text:
Q: Can a UI control be both an Outlet and Action? I am working on one of the cs193p assignments. They asked to add a segmented control to the UI of the assignment app.
Certain things needed to happen when the user selected different options on the segmented switch. Which indicates it needs to be an Action.
At the same time, when the user interacts with another UI element in the app, the segmented switch needed to be disabled. This indicates the switch also needs to be an outlet, so that we can have a reference to it in our controller as we need to modify its state even when the user is not directly interacting with it.
I added the switch as both an action and outlet. My app started crashing. So I wondered if it was because the a control was added as both an action and outlet.

A: The reason my app was crashing must have been an altogether different issue. It had nothing to do with the fact that I had added the switch as both an action and an outlet. I undid some of my recent changes and re added the switch, the app did not crash. The switch worked fine as both an action and an outlet.
TLDR: You can add a control and make it both an action and outlet. Perfectly legal.


text:
Q: Whe aren't my subpages visible with nodejs? I am making simple node app for my website.
I've configured my app.js, controllers and routers so far.
My problem is I keep getting error 404 on two from three subpages, index works fine also. I think they're pretty much the same construction-wise, I've tried tracing app-route-controller but seems good to me.
My console output:
GET / 304 1.443 ms - -
GET /css/style.css 304 0.325 ms - -
GET /images/IMG_2202.png 304 0.639 ms - -
GET /images/vertabelo-tabele.png 304 0.774 ms - -

GET /sprzet 200 1.904 ms - 3241
GET /css/style.css 304 0.393 ms - -
GET /images/IMG_2202.png 304 0.501 ms - -

GET /zamowienia 404 1.152 ms - 1393

GET /wysylka 404 0.917 ms - 1393

As you can see /zamowienia and /wysylka are not found. However the structure is the same as for sprzet.
My app.js
var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');

var indexRouter = require('./routes/index');
const sprzetRouter = require('./routes/sprzetRoute');
const wysylkaRouter = require('./routes/wysylkaRoute');
const zamowieniaRouter = require('./routes/zamowieniaRoute');
var app = express();

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');

app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', indexRouter);
app.use('/sprzet', sprzetRouter);
app.use('/list-wys', wysylkaRouter);
app.use('/list', zamowieniaRouter);

// catch 404 and forward to error handler
app.use(function (req, res, next) {
  next(createError(404));
});

// error handler
app.use(function (err, req, res, next) {
  // set locals, only providing error in development
  res.locals.message = err.message;
  res.locals.error = req.app.get('env') === 'development' ? err : {};

  // render the error page
  res.status(err.status || 500);
  res.render('error');
});

module.exports = app;

wysylkaRoute
const express = require('express');
const router = express.Router();

const wysylkaController = require('../controllers/wysylkaController');

router.get('/', wysylkaController.showWysylkaList);
router.get('/add', wysylkaController.showAddWysylkaForm);
router.get('/details/:wysId', wysylkaController.showWysylkaDetails);

module.exports = router;

and wysylkaController
const { Router } = require("express");

exports.showWysylkaList = (req, res, next) => {
    res.render('pages/wysylka/list-wys', {
        navLocation: 'wys'
    });
}

exports.showAddWysylkaForm = (req, res, next) => {
    res.render('pages/wysylka/form-wys', {
        navLocation: 'wys'
    });
}

exports.showWysylkaDetails = (req, res, next) => {
    res.render('pages/wysylka/list-wys-details', {
        navLocation: 'wys'
    });
}

My nav also seems fine:

<a href="/" class="<%= navLocation == 'main' ? 'active' : ''%>">Strona główna

<a href="/zamowienia" class="<%= navLocation == 'zam' ? 'active' : ''%>">Zamówienia

<a href="/sprzet" class="<%= navLocation == 'sprz' ? 'active' : ''%>">Sprzęt

<a href="/wysylka" class="<%= navLocation == 'wys' ? 'active' : ''%>">Wysylka

I've tried backtracing all my paths and comparing /wysylka and /zamowienia to /sprzet but they all seem built the same way.

A: The problem were wrong endpoints in the app.js.
I had to switch this:
app.use('/', indexRouter);
app.use('/sprzet', sprzetRouter);
app.use('/list-wys', wysylkaRouter);
app.use('/list', zamowieniaRouter);

To this:
app.use('/', indexRouter);
app.use('/sprzet', sprzetRouter);
app.use('/wysylka', wysylkaRouter);
app.use('/zamowienia', zamowieniaRouter);

For endpoints to point to the subfolders instead of specific files.


text:
Q: TFS History Lost I have come across an issue that looks like TFS has permanently deleted a branch and all of its history and is not giving me the ability to interact with any of the changesets that were in that branch.  Here is what happened:

*

*I created a new branch(A) off of an existing branch(B).

*I used A for a few months.

*I merged everything in A back to B.

*I deleted A by right clicking on the branch in Source Control Explorer and clicking delete and checked in the change.

*[At this point I didn't check to see if A could be undeleted, and didn't notice anything amiss]

*2 weeks pass

*Now I want to view the history of a file that was merged

*I go to the visual studio settings and check the box that shows all deleted items

*A is nowhere to be found

*I check to see if some other branches that I had deleted in the past were visible, and they are still present.

*I look in the change history of the parent directory and I can't even see the changeset from when I deleted A.

*

*I have admin access to the TFS database, but don't understand the schema well enough to search for all "delete" changesets.

*I've tried to use the API in Microsoft.TeamFoundation.Client to get more information, but it isn't providing any more records that the TFS history window did

Update
I just ran a a tf destroy command on a test branch to see what the symptoms are, and the symptoms are consistent with what I'm experiencing.  I suspect that this branch was destroyed, now my goal is to find out if destroy leaves behind any information about who or when

A: Further investigation reveals that a team member on a different project had run a cleanup script during the two week period that had invoked the destroy command, accidentally destroying some of our deleted branches.  The advice in How to find out who ran the TFS Destroy Command? revealed who it was, and how it had happened.


text:
Q: If $X_n$ and $Y_n$ both converge to $N(0,1)$ in distribution, and $\mathrm{Cov}(X_n, Y_n)=0$ for each $n$, what does $(X_n\ Y_n)^T$ converges to? Suppose $X_n$ and $Y_n$ both converge to $N(0,1)$ in distribution, and for each $n$, both $X_n$ and $Y_n$ have zero mean and unit variance. Additionally, $\mathrm{Cov}(X_n, Y_n)=0$ for each $n$. Does the vector $\begin{bmatrix}X_n\\ Y_n \end{bmatrix}$ converges to $N(\begin{bmatrix}0\\0 \end{bmatrix}, \begin{bmatrix}1 & 0\\0 & 1 \end{bmatrix})$?

A: If $X_n$ and $Y_n$ are independent for each $n$, the answer is "yes." If they are merely uncorrelated, the answer is "not necessarily."
For a counterexample, take $X$ and $Y$ to be standard normal, with zero correlation but not independent. Define $(X_n,Y_n):=(X,Y)$ for each $n$. Then each $X_n$ and $Y_n$ converge to $N(0,1)$ in distribution since they're already $N(0,1)$. But the limiting joint distribution is that of $(X,Y)$.
The classic example: Let $X$ have standard normal distribution. Toss a fair coin independently of $X$. If the coin lands heads, let $Y=X$; else let $Y=-X$. You can check that $Y$ has standard normal distribution. Also $E(XY)=0$, hence $\operatorname{Cov}(X,Y)=0$, but $X$ and $Y$ are not independent.

A: No.
We cannot even conclude that as $n\to\infty$, we have convergence in distribution $(X_n, Y_n)\overset{d}{\to}(X, Y)$ where $(X,Y)$ is a random vector with marginal distributions $N(0,1)$. Even if you have convergence in distribution, you may hope that since $\text{Cov}(X_n,Y_n)=0$ then $\text{Cov}(X,Y)=0$ and thus $(X,Y)\sim N(\boldsymbol{0}, I)$. There are two problems with this. Firstly, it may happen that
$$\lim_{n\to\infty} \text{Cov}(X_n,Y_n)\ne \text{Cov}(X,Y)$$
For this to be true, you'd need convergence in expectations of various kinds, which is asking for a lot more than what you originally did. Secondly, even if the above limit were to hold, $\text{Cov}(X,Y)=0$ is not enough for $(X,Y)\sim N(\boldsymbol{0},I)$. You need $(X,Y)$ to be jointly normal for this to be true, and the conditions you gave were not enough to guarantee this, either.


text:
Q: File I can't take ownership of I downloaded a file from the internet (I can link to it here, but in the interests of not annoying other users, I won't post the link), and I can't delete the file with the message:

You need permission to perform this action

You require permission from the computer's administrator to make changes to this file

Trouble is, I am the administrator and UAC is completely off.
If I go into the Properties/Security tab, I get the message

You do not have permission to view or edit this object's permission settings

Clicking "Advanced"/Owner, it says:

Current owner: Unable to display current owner.

If i try to change the owner, I get the same message:

Unable to set new owner on file

Access is denied.

A: Give Unlocker a try. If there is any open file handle it will let you close it so you can successfully delete the file.

If that doesn't work for some reason, try BootDeleter. It will delete the file for you upon reboot, before Windows has a chance to lock it on you.

Both utilities are freeware.

A: Sometimes it just won't let you change permissions because some process is using the file, or if you are trying to edit a folder's properties, then a process has a file that is within that dir or subdir open.
I had the problem described today, and I solved it by opening Process Explorer. Then, I went to the "Find" Menu, and selected the "Find Handle or DLL" option. In the dialog that comes up, I searched for the name of the folder I was having issues with. The search results told me which process had an open file within the folder. I killed the process, and then I had no problems with that folder's permissions.

A: ============================================================================
REPORTED ISSUE - Cannot take ownership of an NTFS folder via standard method
Folder Properties \ Security TAB \ Advanced button \ Change Owner
.
REPORTED ISSUE - CANNOT DELETE FOLDER or FILES,
.
========
SCENARIO
I get  each time I try to perform ANY function with an NTFS folder called 'templates'.
CURENT RESULT - INFO: Access is denied. ( "G:\OLD Drive\Program Files\Microsoft Visual Studio x\
VC\VCWizards\CodeWiz.NET\Component\templates" )
============
TEST1 - FAIL
Followed enclosed instructions under proposed solution -
Download PsExec.exe from Sysinternals
C:\Windows\system32>TAKEOWN /F "G:\OLD Drive\Program Files" /R /D Y

===================================
RESULT (see INFO in last statement)
SUCCESS: The file (or folder): "G:\OLD Drive\Program Files" now owned by user "P
CDGROUP\PCD$".

SUCCESS: The file (or folder): "G:\OLD Drive\Program Files\Microsoft Visual Stud
io 8" now owned by user "PCDGROUP\PCD$".

SUCCESS: The file (or folder): "G:\OLD Drive\Program Files\Microsoft Visual Stud
io 8\VC" now owned by user "PCDGROUP\PCD$".

SUCCESS: The file (or folder): "G:\OLD Drive\Program Files\Microsoft Visual Stud
io 8\VC\VCWizards" now owned by user "PCDGROUP\PCD$".

SUCCESS: The file (or folder): "G:\OLD Drive\Program Files\Microsoft Visual Stud
io 8\VC\VCWizards\CodeWiz" now owned by user "PCDGROUP\PCD$".

SUCCESS: The file (or folder): "G:\OLD Drive\Program Files\Microsoft Visual Stud
io 8\VC\VCWizards\CodeWiz\.NET" now owned by user "PCDGROUP\PCD$".

SUCCESS: The file (or folder): "G:\OLD Drive\Program Files\Microsoft Visual Stud
io 8\VC\VCWizards\CodeWiz\.NET\Component" now owned by user "PCDGROUP\PCD$".

INFO: Access is denied. ( "G:\OLD Drive\Program Files\Microsoft Visual Studio 8\
VC\VCWizards\CodeWiz\.NET\Component\templates" )

C:\Windows\system32>

==========
CONCLUSION
Problem not resolved
===============
TEST2 - SUCCESS
CAVEAT - I was only able to succeed here because the folder sits on a drive that is not my primary boot (c:) and as such could be safely taken offline.
     I ensured all windows were closed before actioning.
Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Windows\system32> cd "G:\OLD Drive\Program Files\Microsoft Visual Studio 8\VC\VCWizards\CodeWiz\.NET\Component"

C:\Windows\system32>G:

G:\OLD Drive\Program Files\Microsoft Visual Studio 8\VC\VCWizards\CodeWiz\.NET\Component>chkdsk /f
The type of the file system is NTFS.
Cannot lock current drive.

Chkdsk cannot run because the volume is in use by another
process.  Chkdsk may run if this volume is dismounted first.
ALL OPENED HANDLES TO THIS VOLUME WOULD THEN BE INVALID.
Would you like to force a dismount on this volume? (Y/N) Y
Volume dismounted.  All opened handles to this volume are now invalid.
Volume label is DATABAK.

Stage 1: Examining basic file system structure ...
  986368 file records processed.
File verification completed.
  12 large file records processed.
  0 bad file records processed.

Stage 2: Examining file name linkage ...
  1261166 index entries processed.
Index verification completed.
  0 unindexed files scanned.
  0 unindexed files recovered to lost and found.

cd..

G:\OLD Drive\Program Files\Microsoft Visual Studio 8\VC\VCWizards\CodeWiz\.NET\

rd Component

======================================================
RESULT - The Component folder was successfully removed

A: Try Ultimate Windows Tweaker, which adds a "take ownership" element to the context menu.

Portable application, does not require an install.

A: I have had this issue a couple of times. Closing and restarting explorer resolved the issue. A quick and dirty solution, but it worked.
http://www.howtogeek.com/198815/use-this-secret-trick-to-close-and-restart-explorer.exe-in-windows/

A: I have the same frustrating problem, I used every advice on this thread.
finally I used this small fantastic program to delete the file:
Unlocker 1.9.2
https://www.filecroco.com/download-file/download-unlocker/104/95/

A: Right click on file and choose "Permissions" then click the "Security" tab at top.
Click on "Advance" tab. You will see (Owner: Unable to display current owner.) then click Change
In the open space type "users" that is "USERS" and click the "ok" then "ok" to close all open properties windows.
Now right click on file again, then "Properties" and select "Security" tab once more.
In window of "Group or user names" To change permissions, click Edit
then you click the "ADD" button and type USERS
in the permission for users window below check the "Allow full control" box then click apply.
Click "Ok" and close out of all windows
That should do it.
Hope that helps


text:
Q: AndroidX ActionBar has disappeared: "Didn't find class "androidx.appcompat.app.ActionBar;" on path: DexPathList..." Working on a fitness tracking app for portfolio using AndroidX dependencies, ran into the following error:
"E/LoadedApk: Unable to instantiate appComponentFactory
    java.lang.ClassNotFoundException: Didn't find class "androidx.appcompat.app.ActionBar;" on path: DexPathList..." (Full error pasted below).
My actionbar won't appear, so neither will my menu options. In researching this problem, I see it might be a dependencies issue, so my dependencies in module:app are...
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

    // Room components
    implementation 'androidx.room:room-runtime:2.0.0'
    annotationProcessor 'androidx.room:room-compiler:2.0.0'
    androidTestImplementation 'androidx.room:room-testing:2.0.0'

    // Lifecycle components
    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
    annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
}

And in project...
buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

ext {
    roomVersion = '2.1.0-alpha06'
    archLifecycleVersion = '2.1.0-alpha04'
}

Thank you in advance! If any other code would be helpful, I'll be happy to provide.
    java.lang.ClassNotFoundException: Didn't find class "androidx.appcompat.app.ActionBar;" on path: DexPathList[[zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/base.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_dependencies_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_resources_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_0_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_1_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_2_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_3_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_4_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_5_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_6_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_7_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_8_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/lib/x86, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.app.LoadedApk.createAppFactory(LoadedApk.java:226)
        at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:731)
        at android.app.LoadedApk.getClassLoader(LoadedApk.java:810)
        at android.app.LoadedApk.getResources(LoadedApk.java:1032)
        at android.app.ContextImpl.createAppContext(ContextImpl.java:2345)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5749)
        at android.app.ActivityThread.access$1100(ActivityThread.java:199)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
        Suppressed: java.io.IOException: No original dex files found for dex location /data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_resources_apk.apk
        at dalvik.system.DexFile.openDexFileNative(Native Method)
        at dalvik.system.DexFile.openDexFile(DexFile.java:354)
        at dalvik.system.DexFile.<init>(DexFile.java:101)
        at dalvik.system.DexFile.<init>(DexFile.java:75)
        at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394)
        at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354)
        at dalvik.system.DexPathList.<init>(DexPathList.java:164)
        at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74)
        at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
        at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
        at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
        at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
        at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74)
        at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40)
        at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:727)
                ... 12 more


text:
Q: How to import data file for a Windows executable file from R? I am trying to run a Windows executable file from R. I have managed to open the executable file from R using the command:
system2('cmd', args=c('/c', '"C:/Program Files (x86)/UIFormModel.exe"'))

To run the executable file, I need to import an Excel file by clicking on the button "Load Settings File" (see figure below). Thus, the button is part of the executable file.

How can I do this from R ?
I have tried this command but it does not work:
system2('cmd', args=c('/c', '"C:/Program Files (x86)/UIFormModel.exe"', '"F:/template_LHS1.xlsx"'))

'C:/Program' is not recognized as an internal or external command,
operable program or batch file.
Warning message:
running command '"cmd" /c "C:/Program Files (x86)/UIFormModel.exe" "F:/template_LHS1.xlsx"' had status 1

A: Several points:

*

*normally one does not have .exe files directly under C:\Program Files (X86) so first double check the path name.  I suspect it is not as in the question but is something like the one shown below.

*note the quoting used below

*are you sure that the program accepts a command line argument as an alternative to its GUI?  Can you run it from Windows cmd line? If not you could write an autohotkey (see AutoHotKey section below) or autoit script to control it and launch that from R.

*if it does accept an argument ensure that the program allows forward slashes -- if not use backslashes
cmd line argument accepted
If the program accepts a command line argument then try this code:
system2("C:/Program Files (x86)/UIFormModel/UIFormModel.exe",  "F:/template_LHS1.xlsx")

Another way is:
shell('"C:/Program Files (x86)/UIFormModel/UIFormModel.exe" F:/template_LHS1.xlsx')

For example, using the free CSVfix I was able to run the following and found that they worked:
system2("C:/Program Files (x86)/CSVfix/CSVfix.exe", "help")

shell('"C:/Program Files (x86)/CSVfix/CSVfix.exe" help')

See ?system2 and ?shell for other arguments you may wish to use.
AutoHotKey
If the program does not accept command line arguments then this sample AutoHotKey script launches WinMerge, a free file comparison GUI for Windows, comparing the WinMerge executable to itself.  This has the effect of generating a popup warning and the AutoHotKey script dismisses that warning message by sending an Enter keystroke to the WinMerge window.
Be sure AutoHotKey and WinMerge are installed, that the script below is in a text file, test.ahk, in the current directory, the one given by getwd(), and then from the R console run:
shell("test.ahk")

Here is the test.ahk script:
exe = "C:\Program Files (x86)\winmerge\winmergeu.exe"
Run %exe% %exe% %exe%
WinWait WinMerge
; dismiss the dialog warning that both files are the same
Send {Enter}

If you go this route this script will need to be modified or rewritten in ways that will be specific to your program.

A: I've been trying several alternatives, but I've not successfully called an executable with a parameter. Nevertheless I can suggest a workaround using a .bat file:
system2("cmd.exe", input='"D:/workspace/execute.bat"')

Where execute.bat may contain something like:
C:/Program Files (x86)/UIFormModel.exe F:/template_LHS1.xlsx


text:
Q: Como tirar o espaço entre duas divs inline-block? Alinhei duas divs lado a lado, porém ficou um espaço no meio delas, como retirar?

#tudo {
    text-align: center;
    margin: 0 auto;
}
.desktop {
    display: block;
}
.img {
    display: inline-block;
}

A: Pode resolver isso usando uma gambiarra:
#tudo{
    font-size: 0;<<-------- esta
    text-align: center;
    margin: 0 auto;
}

#tudo {
    font-size:0;
    text-align: center;
    margin: 0 auto;
}
.desktop {
    display: block;
}
.img {
    display: inline-block;
}

Quando nós identamos o código deixamos alguns espaços em branco, a propriedade inline-block vai colocar esse espaço entre os elementos.
Por exemplo, se eu pegar o teu código sem alteração nenhuma e colocá-lo inlinena indentação ele também irá funcionar, veja :

#tudo {
    text-align: center;
    margin: 0 auto;
}
.desktop {
    display: block;
}
.img {
    display: inline-block;
}

Então havendo o espaço o navegador inputa ao elemento um tamanho de fonte padrão, como não tem nenhum caractere além do caractere espaço, fica esse tamanho padrão, e atribuindo 0 a fonte ele fica com o tamanho 0..Dhãããrrrr
Há outras formas de resolver isso. Veja algumas

A: O problema é que você tem espaço entre os elementos: uma quebra de linha. Se você pegar o html que possui e comprimir, o problema já será resolvido:

#tudo{text-align: center; margin: 0 auto;}.desktop{display: block;}.img{display: inline-block;}

Porém isso é ruim de visualizar. Então uma técnica pode ser colocar um comentário () após os elementos, por exemplo:

#tudo {
    text-align: center;
    margin: 0 auto
}
.desktop {
    display: block
}
.img {
    display: inline-block
}

Ou então, não fechar a tag na mesma linha. Por exemplo:

 ...

 ...

A: seria bom você usar algum reset ou crie o seu proprio antes de começar a dar estilo a suas páginas pesquise sobre reset css..  Ex:
* {
margin: 0 auto;
padding: 0;
text-decoration: none;
list-style: none;

-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}


text:
Q: XSLT grouping: first 10 elements as group and next 10 elements as second different group name I am trying to group the element1 tags with (key and price) based on position, I can receive the element1 like 30 or 40 in multiples of 10. but I am facing issue while grouping them like first 10 will be an element 1 and second group should name as element2 and so on
I am not able to group them correctly and failing to rename the groups.
XSLT :

    <xsl:for-each select="element1">
    <xsl:element name="element{position()}">
    <xsl:element name="key"><xsl:value-of select="key"/></xsl:element>
    <xsl:element name="price"><xsl:value-of select="price"/></xsl:element>
    </xsl:element>

    </xsl:for-each>
    </xsl:element>
</xsl:template>

Input :

<?xml version="1.0" encoding="UTF-8"?>
<pricingCondition>
 <element1>
  <key>TAX</key>
  <price>0</price>
 </element1>
 <element1>
  <key>TAX1</key>
  <price>2</price>
 </element1>
 <element1>
  <key>RATE</key>
  <price>7</price>
 </element1>
 <element1>
  <key>PRICE</key>
  <price>24</price>
 </element1>
 <element1>
  <key>FREIGHTVALUE</key>
  <price>0</price>
 </element1>
 <element1>
  <key>NET</key>
  <price>25</price>
 </element1>
 <element1>
  <key>TAX2</key>
  <price>1</price>
 </element1>
 <element1>
  <key>TAX3</key>
  <price>30</price>
 </element1>
 <element1>
  <key>GROSSP</key>
  <price>267</price>
 </element1>
 <element1>
  <key>GROSSV</key>
  <price>4300</price>
 </element1>
 <element1>
  <key>TAX</key>
  <price>01</price>
 </element1>
 <element1>
  <key>TAX1</key>
  <price>02</price>
 </element1>
 <element1>
  <key>RATE</key>
  <price>73</price>
 </element1>
 <element1>
  <key>PRICE</key>
  <price>247</price>
 </element1>
 <element1>
  <key>FREIGHTVALUE</key>
  <price>0</price>
 </element1>
 <element1>
  <key>NET</key>
  <price>15</price>
 </element1>
 <element1>
  <key>TAX2</key>
  <price>11</price>
 </element1>
 <element1>
  <key>TAX3</key>
  <price>10</price>
 </element1>
 <element1>
  <key>GROSSP</key>
  <price>167</price>
 </element1>
 <element1>
  <key>GROSSV</key>
  <price>2300</price>
 </element1>
</pricingCondition>

OutPut:

<?xml version="1.0" encoding="UTF-8"?>
<pricingCondition>
 <element1>
  <key>TAX</key>
  <price>0</price>
 </element1>
 <element1>
  <key>TAX1</key>
  <price>2</price>
 </element1>
 <element1>
  <key>RATE</key>
  <price>7</price>
 </element1>
 <element1>
  <key>PRICE</key>
  <price>24</price>
 </element1>
 <element1>
  <key>FREIGHTVALUE</key>
  <price>0</price>
 </element1>
 <element1>
  <key>NET</key>
  <price>25</price>
 </element1>
 <element1>
  <key>TAX2</key>
  <price>1</price>
 </element1>
 <element1>
  <key>TAX3</key>
  <price>30</price>
 </element1>
 <element1>
  <key>GROSSP</key>
  <price>267</price>
 </element1>
 <element1>
  <key>GROSSV</key>
  <price>4300</price>
 </element1>
 <element2>
  <key>TAX</key>
  <price>01</price>
 </element2>
 <element2>
  <key>TAX1</key>
  <price>02</price>
 </element2>
 <element2>
  <key>RATE</key>
  <price>73</price>
 </element2>
 <element2>
  <key>PRICE</key>
  <price>247</price>
 </element2>
 <element2>
  <key>FREIGHTVALUE</key>
  <price>0</price>
 </element2>
 <element2>
  <key>NET</key>
  <price>15</price>
 </element2>
 <element2>
  <key>TAX2</key>
  <price>11</price>
 </element2>
 <element2>
  <key>TAX3</key>
  <price>10</price>
 </element2>
 <element2>
  <key>GROSSP</key>
  <price>167</price>
 </element2>
 <element2>
  <key>GROSSV</key>
  <price>2300</price>
 </element2>
</pricingCondition>

A: AFAICT, you want to do:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:template match="/pricingCondition">
    <xsl:copy>
        <xsl:for-each select="element1">
            <xsl:element name="element{ceiling(position() div 10)}">
                <xsl:copy-of select="*"/>
            </xsl:element>
        </xsl:for-each>
    </xsl:copy>
</xsl:template>

</xsl:stylesheet>


text:
Q: Given a set of IDs, Return the Subset of Orders with only those IDs Given a set of product_ids, what are the order_ids that only have those product_ids?
For the example below, I'm only wanting order_ids that have some combination of (a,b,c). I have 2 tables like below:
"transactions" table:
order_id | product_id |
---------+-------------
    1    |    a       |
    1    |    b       |
    2    |    a       |
    2    |    X       |
    3    |    a       |
    3    |    b       |
    3    |    c       |
    ...  |    ...     |
    999  |    Y       |

"products" table:
product_id |
------------
     a     |
     b     |
     c     |
     d     |
     X     |
     Y     |
     ...   |
     ZZZ   |

Desired Output has 2 order_ids with expected table output:
order_id |
----------
    1    |
    3    |

Notice that order_id == 2 is removed although it has product_id == a but because it has product_id == X then it should be removed.
Therefore it's not a simple:
SELECT DISTINCT(order_id)
FROM transactions
WHERE product_id IN (a, b, c)

A: Typically, there is an orders table to go with that, with exactly one row per order.
If we can further assume that there is always at least one transaction for every order, this would do the job:
SELECT o.id
FROM   orders o
WHERE  NOT EXISTS (
   SELECT FROM transactions  -- SELECT list can be empty for EXISTS test
   WHERE  order_id = o.id
   AND    product_id <> ALL ('{a,b,c}')
   );

That's good for very common product_id's or long lists.
For short lists or rare products, it will be faster to start with a positive selection first. Like:
SELECT order_id
FROM  (
   SELECT DISTINCT order_id
   FROM   transactions
   WHERE  product_id = ANY ('{a,b,c}')
   ) t
WHERE  NOT EXISTS (
   SELECT FROM transactions
   WHERE  order_id = t.order_id
   AND    product_id <> ALL ('{a,b,c}')
   );

An index on (product_id) is essential for performance. Better yet, a multicolumn index on (product_id, order_id), plus another one on (order_id, product_id). See:

*

*Is a composite index also good for queries on the first field?
The manual about array literals:

*

*https://www.postgresql.org/docs/current/arrays.html#ARRAYS-INPUT
About the ANY and ALL constructs:

*

*IN vs ANY operator in PostgreSQL

*https://www.postgresql.org/docs/current/functions-subquery.html

A: We need to define what the opposite of your requirement is and filter against that. So, which orders have at least one transaction not in a,b,c. We count the number of such transactions in the order grouping, and filter out orders with COUNT > 0, only returning the ones with COUNT = 0.
SELECT order_id
FROM transactions
GROUP BY order_id
HAVING COUNT(CASE WHEN product_id NOT IN (a, b, c) THEN 1 END) = 0

If you had a,b,c as a list of products in another table and you wanted to filter against that rather than hard-coding into the query, then it is slightly more complicated:
SELECT order_id
FROM transactions AS t
LEFT JOIN listOfProducts AS l ON l.product_id = t.product_id
GROUP BY order_id
HAVING COUNT(CASE WHEN l.product_id IS NULL THEN 1 END) = 0


text:
Q: Does Solaris ipfilter simply stop filtering if it is not running? There is a service for ipfilter which can be disabled or enabled. However, I am concerned that ipfilter might be a processes which would stop filtering if it was killed, crashed or otherwise not running. Is this just the way it is?

A: Like other Solaris service, ipfilter will be automatically restarted if killed or in the unlikely event it crashes. However, the userland part of ipfilter is only composed of monitoring tools (ipmon and svc.ipfd). The filtering logic is in the Solaris kernel so cannot crash or be killed (outside a system panic or shutdown).

A: It's loaded into the kernel.  It's actually not Solaris but an open source project:
http://coombs.anu.edu.au/~avalon/ip-filter.html

A: The ipfilter SMF service takes care of a few things:

*

*Load/unload firewall rules

*Load/unload IPFilter kernel module

*Start/stop monitoring tools (eg. ipmon)

You can get the service manifest with: svccfg export ipfilter
The script that does all the work is: /lib/svc/method/ipfilter
Here is an example:

# svcs -a | grep ipfilter
disabled       20:52:09 svc:/network/ipfilter:default
# grep -v \# /etc/ipf/ipf.conf
pass in from any to any
# modinfo | grep ipf
# svcadm enable ipfilter
# modinfo | grep ipf
229 f9b3f000  24238 165   1  ipf (IP Filter: v4.1.9)
# ipfstat -io
empty list for ipfilter(out)
pass in from any to any
# svcadm disable ipfilter
# modinfo | grep ipf
# ipfstat -io
empty list for ipfilter(out)
empty list for ipfilter(in)

If you want IP filtering to work, make sure the IPFilter SMF service is enabled and /etc/ipf/ipf.conf has all the necessary rules.


text:
Q: PayPal Custom window popup I need to fire a google analytics event to our cart project at the time of the payment transaction start on the Pay now button click on the PayPal popup? Is there any possibility to do that? Can someone please help?

A: There is an onClick function. See the JS SDK reference.  This will trigger when the button is clicked to start the checkout.
However, if you want to trigger an event when the checkout is approved by the payer (final Pay Now action within the popup), use onApprove.