text:
Q: How to getting started with Phonegap and Sencha Touch? I would like to develop a mobile applications using Phonegap and Sencha Touch.
I understand that they compliment each other for the best outcome.
How do I get started with respect to what needs to be installed and in what order?

A: you can go through sencha docs site you will get everything, they have proper documentation.
 http://docs.sencha.com/touch/2.4/getting_started/getting_started.html
you can test you sencha app using chrome by hosting sencha app on tomat server.

A: Created this doc when I had the same problem:
How to create a Sencha touch App for Android
This document describes how to create, edit, and run a Sencha Touch App on an Android device. The project is created with Sencha Command and Apache Cordova. Additional instructions and documentation can be found here: http://docs.sencha.com/cmd/5.x/cordova_phonegap.html
Prerequisites
    Java JRE
Java JRE can be downloaded and installed from: http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html
Node.js
Node.js can be downloaded and installed from: http://nodejs.org/download/
Android Debugging Settings
To prepare an Android device for running an Sencha Touch App make sure you go to Settings > Developer Options. Then be sure to have "USB Debugging," "Stay Awake," and "Verify apps over USB" tick boxes checked.
    Sencha Touch SDK
http://www.sencha.com/products/touch/download/

*

*Install Apache Cordova with the following command: "npm install –g cordova"
Note: If you're on a Mac, you may need to include "sudo"

*Download and install Sencha cmd if not already installed.
http://www.sencha.com/products/sencha-cmd/

*Fulfill target device platform-specific requirements
a.  Android: Download and install the Android SDK Manager.
http://developer.android.com/sdk/index.html

*From your Sencha Touch SDK directory create your application using the Cmd generate command as follows:
"sencha -sdk /path/to/Framework generate app MyApp /path/to/MyApp"

*Navigate to your newly generated project folder and run:
"sencha cordova init com.mycompany.MyApp MyApp"

*You should now see cordova directory in the project folder after the above command completes.

*You should also see a block for Cordova in your project's app.json file. app.json is located at the root of your project. This is where you can set the platform for which you are building. A build object similar to the following should now be present in your app.json file:

"builds": {
    "native": {
        "packager": "cordova",
        "cordova" : {
            "config": {
                    //"platforms": "ios android",
                    "id": "com.mydomain.MyApp",
       "name": "myApp"
            }
        }
    }
}

It is worth noting that the word "native" is simply your build's name and can be anything you like.
Platforms
You can then set the platforms object to be any platform, or combination of platforms. For Cordova, you can specify a space delimited list, for example "ios android".
ID
The 'id' property will be used when the Cordova application is first generated. This will be the identifier for your application. That said, you will want to make sure you have picked this correctly. If you need to change it, you will want to delete the Cordova folder from your project and let Cmd regenerate it after you have changed the ID property. This is especially important for iOS application as this must match your Bundle Identifier.

*Run: "sencha app build {build-name}"

*sencha app run {build-name}

*Thats it! Sencha Cmd will now create a Cordova application and build the platform you specified via the platforms property in app.json.


text:
Q: Forwarding to a Django site not working If you go to http://lebronjamesstats.com you get a blank page. But if you look at the source code:
<frameset rows="100%,*" border="0">
  <frame src="http://stats-lebronjamesstats.rhcloud.com/" frameborder="0" />
  <frame frameborder="0" noresize />
</frameset>

stats-lebronjamesstats.rhcloud.com works. Any thoughts?

A: Forward with masking was preventing my website from working. Here was my OpenShift example: OpenShift URL Masking

redpajama_set_name: RedPajamaStackExchange


text:
Q: Set some value with "Confirm credential PIN" screen and get "After accept challenge" I am new in Android application development and I want to use Google confirm credential demo app in our application.
In my application I have created a symmetric key. I want to get this key after successfully confirming PIN or password. However when I try to encrypt then it always returns a new key while I want to get same key. In that way I can use this key every successful authentication.
I want to combine PIN, pattern or fingerprint with a particular user (some string) and get this user after the user is successfully authenticated.
Please suggest me how to merge user name or some string with confirm credential dialog. Or suggest a different way.
Here is what I am doing:

*

*I have generated key;

*then show confirmation screen;

*get result in onActivityresult;

*then call try encrypt.

When i call try encrypt then its return me different key always. Here I want same data when I was set at the time of generate key. Here is my source code where I am  generating and getting Key.
public boolean createKey() {
    if(mEncreaptedKey!=null)return false;
    // Generate a key to decrypt payment credentials, tokens, etc.
    // This will most likely be a registration step for the user when they are setting up your app.
    try {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            mKeyStore = null;
            mKeyStore = KeyStore.getInstance("AndroidKeyStore");
            mKeyStore.load(null);
        KeyGenerator keyGenerator = KeyGenerator.getInstance(
                KeyProperties.KEY_ALGORITHM_AES, "AndroidKeyStore");

        // Set the alias of the entry in Android KeyStore where the key will appear
        // and the constrains (purposes) in the constructor of the Builder

            KeyGenParameterSpec.Builder builder=new KeyGenParameterSpec.Builder(ACCESS_TOKEN,
                    KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT)
                    .setBlockModes(KeyProperties.BLOCK_MODE_CBC)
                    .setUserAuthenticationRequired(true)
                    .setAlgorithmParameterSpec(new ECGenParameterSpec("secp256r1"))
                    .setDigests(KeyProperties.DIGEST_SHA256, KeyProperties.DIGEST_SHA512)
                    // Require that the user has unlocked in the last 30 seconds
                    .setUserAuthenticationValidityDurationSeconds(AUTHENTICATION_DURATION_SECONDS)
                    .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
                builder.setInvalidatedByBiometricEnrollment(false);
            }
            builder.build();
            keyGenerator.init(builder.build());
             key=  keyGenerator.generateKey();
        }else{

        }

        return true;
    } catch (NoSuchAlgorithmException | NoSuchProviderException
            | InvalidAlgorithmParameterException | KeyStoreException
            | CertificateException | IOException e) {
        throw new RuntimeException("Failed to create a symmetric key", e);
    }
}

    @RequiresApi(api = Build.VERSION_CODES.M)
public boolean tryEncrypt(Context context) {
    try {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            mKeyStore.load(null);
        SecretKey secretKey = (SecretKey) mKeyStore.getKey(ACCESS_TOKEN, null);
            mCipher= Cipher.getInstance(TRANSFORMATION);

        // Try encrypting something, it will only work if the user authenticated within
        // the last AUTHENTICATION_DURATION_SECONDS seconds.
            mCipher.init(Cipher.ENCRYPT_MODE, secretKey);
            byte[] encryptionIv = mCipher.getIV();
        byte[] results = mCipher.doFinal(ACCESS_TOKEN.getBytes(CHARSET_NAME));
        String cipher1 = Base64.encodeToString(results, Base64.DEFAULT);
        mEncreaptedKey = Base64.encodeToString(cipher1.getBytes(), Base64.DEFAULT);

        // If the user has recently authenticated, you will reach here.
        // showAlreadyAuthenticated();
        return true;
    }
    } catch (UserNotAuthenticatedException e) {
        // User is not authenticated, let's authenticate with device credentials.
       // showAuthenticationScreen();
        return false;
    } catch (KeyPermanentlyInvalidatedException e) {
        // This happens if the lock screen has been disabled or reset after the key was
        // generated after the key was generated.
        Toast.makeText(context, "Keys are invalidated after created. Retry the purchase\n"
                        + e.getMessage(),
                Toast.LENGTH_LONG).show();
        return false;
    } catch (BadPaddingException | IllegalBlockSizeException | KeyStoreException |
             UnrecoverableKeyException
            | NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException e) {
        throw new RuntimeException(e);
    } catch (CertificateException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return false;
}


text:
Q: I want to create multi tenancy in pentaho BI? how to create multi tenancy in pentaho ?
How to attached the tenant Id in pentaho session?
is there any setting to enable the multi tenancy in pentaho?

A: They are called slave servers in PDI.
Install a carte on a server (which means run the carte.sh with ip/host+port on your linux and let it run). Then look for the Slave Server menu in the left-panel View (you are probably in Design mode) and create a New carte. The Web AppName is blanc (unless you have an EE-licence), and the username/password is cluster/cluster (unless you changed the carte-config.xml as explained in the doc).
Then when you run a job you can select if you want to run it on your machine or on a distant server, and this can be done for each sub-jobs of a job. The
status of the job can be followed by typing host:port/kettle/status in your browser. And it is not hard to run jobs in parallel from within a job (right-click).
As far as tenantId is concerned, there is. It is called the channel and you need it to read the log files. Buit it is another story.
Relevant doc:

*

*Carte documentation

*Defining a slave server in spoon

*Available web service


text:
Q: $\int_A e^{-(x^2+y^2+xy)}$ where $A = \{(x,y): x^2+y^2+xy \leq 1 \}$ I am trying to solve the following problem
$$\int_A e^{-(x^2+y^2+xy)}$$
where $A = \{(x,y): x^2+y^2+xy \leq 1 \}$.
I know how to solve the problem when the domain is $\mathbb{R}^2$: you complete the square and transform it into the Gaussian integral. I have tried to use a change of variables to polar coordinates but I get:
$$ \int^{2 \pi}_0 \int^{(1+\tfrac{1}{2} \sin(2 \theta)^{-1}}_{-(1+\tfrac{1}{2} \sin \theta)^{-1}} e^{-r^2 (1+\tfrac{1}{2} \sin(2 \theta))} r dr d\theta $$ but the calculations are fairly messy. Can you give me a hint?

A: $ \displaystyle x^2 + y^2 + xy = \left(x + \frac y2\right)^2 + \left(\frac {\sqrt3 y}{2}\right)^2$
Using substitution $ \displaystyle u = x + \frac y2, v = \frac {\sqrt3 y}{2}$
$ \displaystyle |J| = \frac 2 {\sqrt3}$
$x^2 + y^2 + xy \leq 1 \implies u^2 + v^2 \leq 1$,
which is a unit circle.
So using polar coordinates, the integral translates to
$ \displaystyle  \int_0^{2\pi} \int_0^1 r ~ e^{-r^2} |J| ~ dr ~ d\theta$


text:
Q: How to change environment variable in shell executing a C program from that C program? I want to change the value of PATH variable inside the C program and then see the changed value in the shell using which I run this program.
Doing something like this,
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main () {

    char *path = getenv ("PATH");
    printf ("%s\n\n", path);
    setenv ("PATH", strcat (path, ":~/myNewPath/"), 1);
    printf ("%s\n\n", path);

    int pid = fork ();
    if (pid == -1)
        abort ();
    if (pid == 0) {

    } else {
        // use execlp? how? source? any hints?
    }

    return 0;
}

If I use source command in the exec* system call. What will be the syntax to update this PATH variable in the shell backwards?

A: This is impossible.  There is no way for a subprocess to change its parent's environment variables.
To understand why it is impossible, look at the signature of execve
int execve(const char *program, char *const *argv, char *const *envp);

which is paired with the true signature of main on Unix systems
int main(int argc, char **argv, char **envp);

and perhaps you begin to understand that as far as the kernel is concerned, the environment variables are a second set of command line arguments.  That they appear to be independently accessible via getenv and setenv etc, and appear to inherit from parent to child, is an illusion maintained by the C library.
For more detail on how this works, study the x86-64 ELF ABI specification, section 3.4.1 "Initial Stack and Register State" paying particular attention to figure 3.9 which shows the layout of the data copied by execve onto the newly created stack.  (The document linked is specific to one CPU architecture, but the way this works is generally consistent across modern Unixes; fine details will of course vary from CPU to CPU and OS to OS.)


text: Q: Complete case insensitiveness in R i've read posts and read some more. i just want to disable case sensitivity everywhere in r. i feel like half of my key strokes is the dashing of my little finger for the shift button. i want to write NULL as null and NA as na. everything in lower case.


text:
Q: MySQL: does "NOT IN()" function not allow 'NULL' values in the results set? I have a simple table on my local server.
mysql> desc table ;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id    | int(10) | YES  |     | NULL    |       |
| count | int(10) | YES  |     | NULL    |       |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.00 sec

It has just three records in it.
mysql> select * from uday ;
+------+-------+
| id   | count |
+------+-------+
|    1 |     1 |
|    2 |     2 |
|    3 |     0 |
|    4 |  NULL |
+------+-------+
4 rows in set (0.00 sec)

Now, why is that i am not seeing the fourth column in the below result..?
mysql> select * from uday where count NOT IN (0) ;
mysql> select * from uday where count != 0 ;
+------+-------+
| id   | count |
+------+-------+
|    1 |     1 |
|    2 |     2 |
+------+-------+
2 rows in set (0.00 sec)

how about the 4th record...? Its not visible in the result.
NULL is not 0 RIGHT...?
please ignore if it looks pretty foolish as I am not even competitive in coding part.

A: col1 not in (1,2,null)

is shorthand for:
col1 <> 1 and col1 <> 2 and col1 <> null

In SQL's three-valued logic, col1 <> null returns unknown.  And true and true and unknown also returns unknown.  Since where only accepts true, and not unknown, the row with null is filtered out of the result set.


text:
Q: How do I reference a method in a different class from a method in another class? I have a module and class in a file lib/crawler/page-crawler.rb that looks like this:
require 'oga'
require 'net/http'
require 'pry'

module YPCrawler
  class PageCrawler

    attr_accessor :url

    def initialize(url)
      @url = url
    end

    def get_page_listings
      body = Net::HTTP.get(URI.parse(@url))
      document = Oga.parse_html(body)
      document.css('div.result')
    end

    newpage = PageCrawler.new "http://www.someurl"
    @listings = newpage.get_page_listings
    @listings.each do |listing|
      bizname = YPCrawler::ListingCrawler.new listing['id']
    end
  end
end

Then I have another module & class in another file lib/crawler/listing-crawler.rb that looks like this:
require 'oga'
require 'pry'

module YPCrawler
  class ListingCrawler
    def initialize(id)
      @id = id
    end

    def extract_busines_name
      binding.pry
    end

  end
end

However, when I try to run this script ruby lib/yp-crawler.rb which executes the page-crawler.rb file above and works without the YPCrawler call, I get this error:
/lib/crawler/page-crawler.rb:23:in `block in <class:PageCrawler>': uninitialized constant YPCrawler::ListingCrawler (NameError)

The issue is on this line:
bizname = YPCrawler::ListingCrawler.new listing['id']

So how do I call that other from within my iterator in my page-crawler.rb?
Edit 1
When I just do `ListingCrawler.new listing['id'], I get the following error:
 uninitialized constant YPCrawler::PageCrawler::ListingCrawler (NameError)

Edit 2
Here is the directory structure of my project:

Edit 3
My yp-crawler.rb looks like this:
require_relative "yp-crawler/version"
require_relative "crawler/page-crawler"
require_relative "crawler/listing-crawler"

module YPCrawler
end

A: Try this, in your yp-crawler.rb add the line:
Dir["#{File.dirname(__FILE__)}/crawler/**/*.rb"].each { |file| load(file) }

That should automatically include all files in your /crawler directory at runtime. Might want to do the same for the other directories.
Let me know if that helps :)

A: In your yp-crawler.rb file, based on the structure that you posted, you should have something like:
require 'yp-crawler/version'
require 'crawler/listing-crawler'
require 'crawler/page-crawler'


text:
Q: Error while declaring QVector of class type Getting error while declaring QVector of class type in Qt.
Error :"incomplete type is not allowed"
I didn't understand what causes this error.
if i #include "storage.h" in main.cpp and declare a Qvector of class storeage it works fine but when i do the same in waveform class it reports an error.
I've tried forward declaring storage class in waveform class but still getting the same error.
Any Help??
main.cpp
#include "test_subject_02.h"
#include <QtGui/QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    TEST_SUBJECT_02 w;
    w.show();
    return a.exec();
}

test_subject_02.h
#ifndef TEST_SUBJECT_02_H
#define TEST_SUBJECT_02_H

#include <QtGui/QMainWindow>
#include "ui_test_subject_02.h"
#include"waveform.h"
#include "storage.h"

class TEST_SUBJECT_02 : public QMainWindow
{
    Q_OBJECT

public:
    TEST_SUBJECT_02(QWidget *parent = 0, Qt::WFlags flags = 0);
    waveform *wv;
    ~TEST_SUBJECT_02();

private:
    Ui::TEST_SUBJECT_02Class ui;
};

#endif // TEST_SUBJECT_02_H

test_subject_02.cpp
#include "test_subject_02.h"

TEST_SUBJECT_02::TEST_SUBJECT_02(QWidget *parent, Qt::WFlags flags)
    : QMainWindow(parent, flags)
{
    ui.setupUi(this);
    QVector<storage> ser; //works fine here
    wv->readfile("e:/testing2/result/3/abc.cur");

}

TEST_SUBJECT_02::~TEST_SUBJECT_02()
{

}

waveform.h
#ifndef WAVEFORM_H
#define WAVEFORM_H

#include "storage.h"
#include <QObject>

class waveform : public QObject
{
    Q_OBJECT

public:
    waveform(QObject *parent=0);
    void readfile(QString);

    QVector <storage> myvector ; // incomplete type is not allowed
    ~waveform();

private:

};

#endif // WAVEFORM_H

waveform.cpp
#include "waveform.h"

waveform::waveform(QObject *parent)
    : QObject(parent)
{

}

void waveform::readfile(QString file)
{
    QVector<storage> sw; //again error incomplete type is not allowed

}

waveform::~waveform()
{

}

storage.h
#ifndef STORAGE_H
#define STORAGE_H

#include <QObject>

class storage : public QObject
{
    Q_OBJECT

public:
    storage(QObject *parent);
    storage();
    storage(QString,QString);
    ~storage();

private:
    QString x;
    QString y;

};

#endif // STORAGE_H

storage.cpp
#include "storage.h"

storage::storage(QObject *parent)
    : QObject(parent)
{

}

storage::storage(QString xcord,QString ycord)
{
    x=xcord;
    y=ycord;

}

storage::storage()
{

}

storage::~storage()
{

}

A: You need to explicitly include QVector in necessary file (waveform.h i believe), since QT uses a lot of forward declarations, while they appear as correct classes in IDE, but they won't compile, if proper definition is not included in file.


text:
Q: Specific example of Norm vs. Metric on a sequence space Let $X$ the space of all real sequences and let $d$ be the metric defined by
$$d(x,y) = \sum_{k \in \mathbb{N}}2^{-k}\frac{|x_k-y_k|}{1+|x_k-y_k|}.$$
I have proven that for a sequence $x = (x^{(n)})_{n\in \mathbb{N}}$ with $x^{(n)} \in X$ we have
$$d(x^{(n)},0) \to 0 \iff x_j^{(n)} \to 0 \;\;\; \forall j \in \mathbb{N}.$$
My question is the following: Does there exist a norm $\|\cdot\|$ on $X$ such that there exist positive numbers $c, C \in \mathbb{R}$ with
$$c\|x\| \leq d(x,0) \leq C\|x\| \;\;\; \forall x \in X$$

A: It is clear that for any numbers $a$ and $b$, we have
$$
\frac{|a-b|}{1+|a-b|} \leqslant 1,
$$
and consequently,
$$
\forall x,y\in X,\quad d(x,y) \leqslant \sum_{k\in \Bbb N} 2^{-k} = 2.
$$
(Note that I use the convention $0\in \Bbb N$).
Therefore, if such a norm would exist (with $c>0$, which is what you presumably want), this would imply that
$$
\forall x \in X,\quad c\|x\| \leqslant d(x,0) \leqslant 2,
$$
and finally, we would have
$$
\forall x \in X,\quad \|x\| \leqslant \frac{2}{c}.
$$
This is obviously impossible since norms are homogeneous and hence unbounded.
Another way to say that is the following: $(X,d)$ cannot be bi-Lipschitz equivalent to $(X,\|\cdot\|)$ for any norm $\|\cdot\|$, since $(X,d)$ is bounded, but $(X,\|\cdot\|)$ isn't.


text:
Q: Disable automatic join of nested outline groups - Excel I am having issues with adjacent and nested outline groups and Excel combining them together.
What happens:

*

*Group columns A:F together

*

*This works fine.

*Group is created with the expand/collapse icons

*Group columns A:C together

*

*This works fine.

*A nested group is created inside the one done in step 1.

*Group columns E:F together

*

*This does not work. No expand/collapse icons are available, only dots marking it is grouped deeper. (see picture below)

*Excel decides I want to join this somehow to the first one.

*Group columns G:J together

*

*This creates a group but combines it with the one done in step 1

*Can this behavior be avoided?

Nested outline groups

This behaviour happens always at one of the edges of outline groups. The side depends on which option you have enabled in outline settings. I used "Summary columns to right of detail" enabled.
Is there a way to have nested groups work properly at the edges without combining them in? And is there a way to have adjacent outline groups without gap rows/columns in between without hiding rows/columns?
EDIT 2020-06-16
As @Owen pointed out, my intention with this seems to be unclear. My sheet has multiple different column groups and these groups some have subgroups in them. I would like to be able to show and hide these groups and subgroups easily while inputting data to the rows. Hiding is needed because there are a lot of columns used and only one or two groups worked on at the same time.
Outline is an easy way to achieve fast showing and hiding of columns. Using regular hide makes it difficult and end users of this file will not be able figure out that there are hidden columns without the clear indication of an outline.
Adding a summary column after each group will solve the problem, but the summary column does not provide anything in my case expect solve the outline issue. No summary is needed for column groups.
Groups of columns

A: The purpose of the Outline/Group functionality is, as far as I can tell, to allow you to quickly show or hide the detail that contributes to a summary row or column.
Outline (group) data in a Worksheet
You want to have two groups which end on the same column. In the context of the purpose stated above, this doesn't make sense - because it would imply that the two differently-sized collections of columns are represented by the same summary column.
Nevertheless, I replicated your issue in O365 - groups ending in the same row or column will not get their own "grouping line" across the row header or column header, they will be subsumed into the longer group already present, if there is one. These new groups do get a number in the list of 1,2,3,etc in the headers area, though this may be confusing with lots of numbers.
Generally if you are using this feature to show aggregates, a pivot table is a more scalable and predictable method (Outline is limited to 8 groups). Failing that, simply creating a summary table that shows just the aggregated then perhaps using Split to keep the summary in the top left of the user's screen would be enough.
If you're not using it to show aggregates, but as a way of hiding columns for some other reason, then you may want to consider re-organizing your columns.


text:
Q: Factorization of vector valued function Matrix valued function $\mathbf A$ is a solution of second order linear differential equation: $d^2 \mathbf A /dt^2+\mathbf {R A} = 0$ with initial conditions: $\lim_{t\to 0} \mathbf A = 0$ and $\lim_{t\to 0} {d \mathbf A}/{dt}= \mathbf I$. And also $\mathbf A$ is nonsingular for $t\neq0$.
Vector valued function $\mathbf Z$ is $\mathcal C^2$ and
$\lim_{t\to0}\mathbf Z = 0$, show that it can be factored as:
$$ \mathbf Z=\mathbf A \mathbf W$$, where $\mathbf W$ is $\mathcal C^1$ at $t=0$.
It is easy to see that
$\lim_{x\to0} \;2(d\mathbf A/dt)(d\mathbf W/dt)+A(d^2\mathbf W/dt^2)$
 is defined, but how to prove that limits of each term exist?

A: $\mathbf{A}$ solves an ODE, and so is at least $C^2$ (in fact, if $\mathbf{R}$ is a constant matrix, you know that the solution is real analytic), and you know it is non-singular away from $t = 0$, so that when $t \neq 0$ the object $\mathbf{W} = \mathbf{A}^{-1} \mathbf{Z}$ is well-defined and $C^2$. So your question is mainly showing that this vector has a $C^1$ extension to $t = 0$.
First you need to show continuity. This follows essentially from L'Hopital's rule. Since $\mathbf{A}$ solves the ODE, you know that
$$ \mathbf{A}(0) = 0, \frac{d}{dt} \mathbf{A}(0) = \mathbf{I}, \frac{d^2}{dt^2} \mathbf{A} = \mathbf{R}\mathbf{A}(0) = 0 $$
so
$$ \mathbf{A}(t) = t\mathbf{I} + O(t^3) $$
which implies that
$$ \mathbf{A}^{-1}(t) = \frac{1}{t} (\mathbf{I} + O(t^2)) $$
So the limit
$$ \lim_{t \to 0} \mathbf{A}^{-1}\mathbf{Z} = \lim_{t\to 0} \frac1t \mathbf{Z} + O(t) = \frac{d}{dt} \mathbf{Z}(0) $$
since $\mathbf{Z}(0) = 0$.
To show that $\mathbf{W}$ is differentiable at $t = 0$, you need to compute
$$ \lim_{t\to 0} \frac{1}{t} \left( \mathbf{A}^{-1}\mathbf{Z} - \frac{d}{dt}\mathbf{Z}(0)\right) $$
The previous computation has already shown that the difference in the parentheses is $O(t)$. But we can Taylor expand a bit more and write
$$ \mathbf{A}(t) = t \mathbf{I} + \frac{t^3}{6} \mathbf{R} + O(t^4) $$
and
$$ \mathbf{Z}(t) = t \dot{\mathbf{Z}}(0) + \frac{t^2}{2} \ddot{\mathbf{Z}}(0) + o(t^2) $$
Therefore
$$ \mathbf{A}^{-1}(t) \mathbf{Z}(t) = (\mathbf{I} - \frac{t^2}{6} \mathbf{R} + O(t^3)) \cdot (\mathbf{Z}(0) + \frac{t}{2} \ddot{\mathbf{Z}}(0) + o(t)) $$
or
$$ \mathbf{A}^{-1}(t) \mathbf{Z}(t) = \dot{\mathbf{Z}}(0) + \frac{t}{2}\ddot{\mathbf{Z}}(0) + o(t) $$
showing continuous differentiability at $t = 0$.


text:
Q: active_for_authentication? not working I am using active_for_authentication? to allow only active users to login through devise.
But it's not working.
My controller:
class DashboardUsersController < ApplicationController
def active_for_authentication?
  super && self.deactivated_ind
end

def inactive_message
  "Sorry, this account has been deactivated."
end

My model:
class DashboardUser < ActiveRecord::Base

  devise :database_authenticatable,:rememberable, :trackable, :validatable, :timeoutable

  attr_accessor :login

  def self.find_first_by_auth_conditions(warden_conditions)
    conditions = warden_conditions.dup
    if login = conditions.delete(:login)
      where(conditions).where(["username = :value OR lower(email) = lower(:value)", { :value => login }]).first
    else
      where(conditions).first
    end
  end
end

My user table:
t.string   "deactivated_ind",      limit: 1
t.date     "deactivated_date"

By using deactivated_ind Y / N i check user is active / inactive.
Now i want allow devise to log in only those user have N in deactivated_ind colomn

A: *

*active_for_authentication? needs to be a method on a model, not on a controller

*(not a problem in your case, but was mine) active_for_authentication? must be a public method on a model

A: Part of the problem, I'm guessing is that you're using a string for "deactivated_ind" instead of a boolean.  A string of "N" and a string of "Y" will both be true when you try to use them as boolean values, since neither is nil.


text:
Q: php code to detect browser plugins How can I detect browser plugins with php like this page does?
I want to detect flash player and silverlight to load the correct content (animation) in a webpage with php.
Thanks for the help.

A: PHP doesn't get information on the browser's plugins unless that plugin adds something to the user agent string (which is unusual). That page uses JavaScript to detect plugins, which is the most common way of implementing this sort of thing.


text:
Q: Mixed content error when proxying websocket through nginx with SSL I am working on a node.js application using express to serve content and socket.io for websocket communication. The setup has been working fine, but now I want to be able to access the websocket via SSL, too. I thought using nginx (which we already used for other stuff) as a proxy was a good idea, and configured it like this:
upstream nodejs {
    server 127.0.0.1:8080;
}

server {
    listen 443 ssl;
    ssl_certificate /etc/nginx/ssl/server.crt;
    ssl_certificate_key /etc/nginx/ssl/server.key;

    server_name _;

    location / {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://nodejs;
        proxy_redirect off;
    }
}

The node.js server is set up like this:
var express = require('express'),
    app = express();
// some app configuration that I don't think matters
server = http.createServer(app).listen(8080);
var io = require('socket.io').listen(server);
io.configure(function() {
    io.set('match original protocol', true);
    io.set('log level', 0);
    io.set('store', redisStore); // creation of redisStore not shown
}

Both nginx and node.js run inside a Vagrant box which forwards port 443 (which nginx listens on) to port 4443 on the host system.
With this setup, navigating to http://localhost:4443 (using Firefox 23) gives me access to the files served by Express, but when socket.io tries to connect to the socket, it throws the following error:
Blocked loading mixed active content "http://localhost:4443/socket.io/1/?t=1376058430540"

This outcome is sadly obvious, as it tries to load the JS file via HTTP from inside an HTTPS page, which Firefox does not allow. The question is why it does so in the first place.
Socket.io tries to determine which protocol is used to access the web page, and uses the same protocol in the construction of the above URL. In this case, it thinks it is being accessed over HTTP, which may be the result of being proxied. However, as I understand, setting match original protocol to true in the socket.io config is supposed to help in situations like this, but it does not in my case.
I have found numerous questions and answers here about websocket proxying, but none that deal with this particular issue. So I'm pretty much at wit's end, and would really appreciate some advice.

A: Change match original protocol to match origin protocol:
io.configure(function() {
    //io.set('match original protocol', true);
    io.set('match origin protocol', true);
    ...
}


text:
Q: Delayed Job on Heroku I have a Rails application hosted on Heroku that requires a weekly data import. The task is performed by administrators and takes about 1-2 minutes to run (compute time). On Heroku, jobs that require more than 30 seconds time out. Heroku recommends job queues - however paying $36.00 per month (price of one worker) for 8 minutes of compute time doesn't seem appropriate. A few questions:

*

*Is it possible to only pay for delayed jobs when they are used (i.e. launch the delayed job service only when administrators are uploading the data import).

*Is delayed job required? I'm not sure if the timeout is just displayed to the client or if the actual work is cancelled. The documentation does list 'take no action' as an option, but I'm not sure what the implications of this are.

Thanks!

A: You might check out HireFire.

HireFire automatically "hires" and "fires" (aka "scales") Delayed Job and Resque workers on Heroku. When there are no queue jobs, HireFire will fire (shut down) all workers. If there are queued jobs, then it'll hire (spin up) workers. The amount of workers that get hired depends on the amount of queued jobs (the ratio can be configured by you).

A:
Is it possible to only pay for delayed jobs when they are used (i.e. launch the delayed job service only when administrators are uploading the data import).

This is a question you should direct at the heroku support.

Is delayed job required? I'm not sure if the timeout is just displayed to the client or if the actual work is cancelled. The documentation does list 'take no action' as an option, but I'm not sure what the implications of this are.

If it's run weekly it's more likely a cronjob than something that is just delayed. You can use the daily cron Addon (it's free). Then create a file called lib/tasks/cron.rake.
task :cron => :environment do
  if Time.now.strftime('%w').to_i == 0 # run every sunday
    puts "Importing..."
    #... run import
    puts "done."
  end
end

source
This task will be run daily from heroku, so you need to check the day of week, if you want to run it on a weekly basis.

A: Delayed Job workers are billed by the second, so you can absolutely spin one up to handle your task, and have it turn itself off via the heroku API when finished.

A: After testing, realized that the timeout does not prevent long running tasks from completing (just results being displayed to user). Ended up adding email notification and allow timeout to occur. Looked at threading request, but support in Rails seems flakey.


text:
Q: Can Flag Weight be available on data-dump and data-explorer? Can Flag Weight be available on data-dump and data-explorer?
Just curious :-)

A: There could be interesting applications to that data. As per Shog9 request, I will attempt to add some possible uses here. Sorry if it takes a strong research focus, but that's the scientist in me talking :)
Some of it may be already know by mods or the dev team. Also, please, take them only as examples of what could be done:

*

*Plain statistical reports as Lance proposed in the previous answer. Mean, variation, mode of the general population to understand a little better what users groups there are in SO.

*ANOVA (or nonparametric analyses if required) to compare the flag weight between different population groups (e.g., divided by rep count, age, history in SO, even subscription to other SE sites).

*Correlation analyses flag weight vs rep or flag weight vs time in SO. Does it increase linearly in a particular range? If so, where does it reach a plateau? Where does it start increasing? That could help improve the threshold for closing votes privileges, for example. The weight vs time correlation could provide insights into whether rep alone is a good indicator of flagging capacity.

*Analysis of the flag weights in different SE sites. Are meta sites flag weights better than the parent sites? Should be flag weight be handled differently for small sites compared to big ones?

It seems that is decided that flag accept/decline ratio will not be public. That is problematic because it would allow to discriminate between bad/mediocre flaggers and non-flaggers. If not a ratio, then a simple number of the total flags should be sufficient.

A: That is a good idea to be able to make some statistical reports on flag weight and other user variables.


text:
Q: R grepl: quickly match multiple strings against multiple substrings, returning all matches I have a fairly large set of strings in R:
set.seed(42)
strings <- sapply(1:250000, function(x) sample(2:20, 1, prob=c(
  0.001, 0.006, 0.021, 0.043, 0.075, 0.101, 0.127,
  0.138, 0.132, 0.111, 0.087, 0.064, 0.042, 0.025, 0.014, 0.008,
  0.004, 0.002, 0.001)))
strings <- lapply(strings, function(x) sample(letters, x, replace=TRUE))
strings <- sapply(strings, paste, collapse='')

I would like to make a list denoting the presence or absence of each element from a list of substrings within these strings.  My starting point, of course, is some code from stackoverflow:
#0.1 seconds
substrings <- sample(strings, 10)
system.time(matches <- lapply(substrings, grepl, strings, fixed=TRUE))

However, this approach is somewhat naive for larger sets of substrings, as it stores all of the matches and all of the non-matches:
#13 seconds
substrings <- sample(strings, 1000)
system.time(matches <- lapply(substrings, grepl, strings, fixed=TRUE))

We can reduce the size of the output object by only storing the matches:
#13 seconds
substrings <- sample(strings, 1000)
system.time(matches <- lapply(substrings, function(x) which(grepl(x, strings, fixed=TRUE))))

But this is still slow for large numbers of substrings:
#316 seconds
substrings <- sample(strings, 25000)
system.time(matches <- lapply(substrings, function(x) which(grepl(x, strings, fixed=TRUE))))

It's nice that the time is growing linearly, but I feel like there has to be a much faster way to accomplish this task, perhaps by avoiding the lapply loop.
How can I speed up this many-to-many string matching function?
/edit: One easy speedup is parallelization:
#Takes about 99 seconds
require('doParallel')
cl <- makeForkCluster(nnodes=8)
registerDoParallel(cl)
system.time(matches <- foreach(i=1:length(substrings)) %dopar% {
  which(grepl(substrings[i], strings, fixed=TRUE))
})
stopCluster(cl)

However, I think most solutions to this problem will be easy to parallelize, once a fast serial algorithm has been found.


text:
Q: Open compose email window directly in blackberry
Possible Duplicate:
How to open the Blackberry email app, ready to compose an email to a given address?

I am clicking on a button. On button click, user should move to "Compose email" screen.

A:     MessageArguments ma = new MessageArguments(MessageArguments.ARG_NEW, <recipients>, <subject>, <body>);
    //Alternatively, if you don't want to provide default values: ma = new MessageArguments(MessageArguments.ARG_NEW);

    Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, ma);

A: this is working fine , try this,
public void SendMail()
        {

            String htmlContent =  "Body part";

            Message msg = new Message();
            try
            {
                final Address address = new Address("","");
                Address[] addresses = {address};
                msg.addRecipients(net.rim.blackberry.api.mail.Message.RecipientType.TO, addresses);
                msg.setContent(htmlContent);
                msg.setSubject("Subject");

                Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(msg));

            }
            catch (AddressException e)
            {
                e.printStackTrace();
                System.out.println("AddressException -->"+e.getMessage());
            }
            catch (MessagingException e)
            {
                e.printStackTrace();
                System.out.println("MessagingException -->"+e.getMessage());
            }
        }


text:
Q: Why command "screencapture -R0,0,5,5" doesn't creates 5x5 image but creates 10x10 image? On Mac OS X Yosemite, following command doesn't creates 5x5 image but creates 10x10 image. Why? I want to take screenshot of 5x5.
screencapture -t bmp -R0,0,5,5 ~/Desktop/hogehoge.bmp

And here is the properties of the image. It says "Dimensions:10x10". Am I missing something?

A: You may have got a Retina display (if you have got a MacBook Pro Retina or a Retina 27" iMac). This means that an usual pixel is saved as four pixels.
See https://en.wikipedia.org/wiki/Retina_Display

A: very attractive work.
     ( The option -R don't exists  in screencapture)

      Another very simple choice with the options -s -c it's to capture with the mouse and to copy out in the clipboard

     do shell script " /usr/sbin/screencapture -s -c "

tell application "System Events" to tell process "Finder"
    set frontmost to true
    click menu item "Show Clipboard" of menu "Edit" of menu bar 1
end tell


text:
Q: How to have fade in and fade out between multi widgets I am using a bottom navigation bar with 5 items and for each widget I should load some data from server , I want to have fade in and fade out between items but I don't know how? , because I think items are not a new pages that I implement route fade transitions.
also I defined a futureBuilder for each Items to load it's data
It's possible to do sth in futureBuilder's ConnectionState.waiting but it doesn't have fade transition and the transition is jumping
also i check interet connection with connectivity plugin
I get into trouble to handle them because I am almost new to flutter !
and i am wonder to know what is the most powerful way to handle it.
Thanks

A: Maybe AnimatedSwitcher is what you are looking for, it adds an implicit animation to its child, so that whenever you call setState() to change its child, it automatically starts a fade-in/fade-out animation between them. Check out this video from the Widget of the Week series:
AnimatedSwitcher from Widget of the Week
Another possibility is AnimatedOpacity, that can achieve a similar behaviour by changing its child's opacity. Here is a reference to the documentation on AnimatedOpacity widget:
AnimatedOpacity from Flutter dev documentation

A: I know that's a really old question, but I solved using something like that:
  Widget dynWidget = CircularProgressIndicator();

  @override
  Widget build(BuildContext context) {
    return FutureBuilder(
        future: future,
        builder: (context, snapshot) {
          if (snapshot.connectionState == ConnectionState.done) {
            dynWidget = Text('Content loaded!');
          }
          return AnimatedSwitcher(
              duration: Duration(seconds: 1), child: dynWidget);
        });
  }


text:
Q: nuxt (SSR) CSP nonce not added to generated scripts anyone have made CSP strict-dynamic working on nuxt?
i've successfully added CSP headers to the page (nonce is genereated in nuxtServerInit and injected to cspScriptSrcHashes array into 'render:route' hook (and i can see it into rendered page CSP within teh browser);
the problem is that no nonce is added to scripts genereted by nuxt and its components;
i tried to set "nonce" prop in vuex store root, i also checked that csp is enabled in nuxt.config but nothing is working
the same thing is about hashes ('sha256' value in render.csp.hashAlgorithm)
on what i'm wrong?
thank you


text:
Q: Which virtualization technology for old linux box I have old PIV 1.8ghz, 512MB memory, 40GB HDD, computer with Debian squeeze on it. I currently work on it by connecting to it over SSH.  I'm interested in testing/learning/trying out/playing  with some things on Linux  so I would like to set up a virtual machine on this box for this purpose so in case I mess up something pretty bad I won't need to reinstall whole OS ( PC currently doesn't have any monitor either).
Since PC is 32 bit I'm not able to use KVM to which I'm used to. Can I get some recommendation for a technology that would suit my purpose?
P.S.
I know that memory is somewhat low, but I intend to use only 1 VM so I hope it will be enough.

A: Since that machine is so old, the only option that I can really recommend is virtualbox.  I would install a Linux or BSD distro without a gui, install a gui-less virtualbox, and manipulate it entirely through the terminal.
Honestly, your machine is underpowered for anything useful, though.  You would be better off using any other non-netbook computer with multiple cores, unless you're already maxing out the memory, even if it's your primary machine.
The VirtualBox command line management tools reference page is here: http://www.virtualbox.org/manual/ch08.html

A: You can also try some light-weight virtualisation technologies like OpenVZ, VServer, or LXC.
They might be a better fit for a resource constrained machine than more main-stream PV or HVM options such as Xen/KVM.
Debian has them available as well.

A: Virtualbox, VMWare (Server was free haven't checked recently), KVM's Grandfather QEmu. I have run Virtualbox on some really old and busted hosts, like P3 and anywhere as little as 256-512 MB RAM.

A: You can probably run XEN on that machine and run para-virtualized  guest OSes. In fact, Debian includes XEN 4.01 in its stable release.
Context: I run XEN on my Asus 1012B. I didn't know it was a 64 bit box, so I put in the 32 bit version of CentOS 5 and later on configured it as a XEN host. Turns out to be useful in testing 32-bit packages, but long term, not a terribly optimal configuration as XEN host. ;)


text:
Q: To Execute Ajax requests in Sequence Thanks for viewing my question. I am hopeful that you might help me go in the right direction.
Problem:
User sends a list of company name and server sends the corresponding logo back.
The restriction is that the logo needs to be placed left to right and then top to bottom.
The order should not change.
Approach Followed:
We are using an Array of Company Names appearing row wise -
Like:
[ [Companies_Row1] ,  [Companies_Row2],  [Companies_Row3] ]
Each [Companies_Row] has values like ['Ford', 'BMW', 'Audi']
[
We expect the logos to appear in order, however presently we are getting them in random order.

Solution we are thinking is to iterate over the arrays and make use of Promises.
However we are struggling to implement this since last two days. Please help us resolve the same.
Code Snippets:
    // arrayOfCompanyNames - contains an Array of [Array of Company Names] appearing in a row. Please Refer Screenshot.

   // Function where we are traversing the company Name and making call
    function getCompanyLogos(arrayOfCompanyNames) {
      var promise = new Promise(function(resolve, reject) {
        resolve(1);
      });
      promise.then(function(){
        arrayOfCompanyNames.forEach(function(item) {
          item.forEach(function(value, index) {
            if(index == item.length - 1){
              // When a row is complete then move to the next row.
              promise = promise.then(LogoFetchPromis(value, true));
            } else {
              promise = promise.then(LogoFetchPromis(value));
            }
          });
        });
      });
    }

function LogoFetchPromis(carName, wrapNow){
    return new Promise(function(resolve, reject) {
      $.ajax({
          url: "/getLogo/" + carName,
          dataType: 'text'
        })
        .done(function(response) {
          resolve(response);
     // logos is the section where logos should appear
          $('.logos').append(response);
          if (wrapNow)
            $('.logos').append('
');
        })
        .fail(function(response) {
          reject(Error(response));
        });
    });
}

Please help us find a resolution for the same.

A: Keep it simple. One solution is first fetch all of your images by building an array of promises reproducing the structure of arrayOfCompanyNames then use Promise.all() to keep the order of the promises result. And then you can loop over the results array and show the logos (add error management as you need).
// arrayOfCompanyNames - contains an Array of [Array of Company Names] appearing in a row. Please Refer Screenshot.
var arrayOfCompanyNames;

// Function where we are traversing the company Name and making call
function getCompanyLogos(arrayOfCompanyNames) {
    // build an array of promises mirroring arrayOfCompanyNames
    var promises = [];
    arrayOfCompanyNames.forEach(function (subArray) {
        var subPromises = [];
        subArray.forEach(function (carName) {
            // $.ajax is a promise so you use it directly
            subPromises.push($.ajax({
                url: '/getLogo/' + carName,
                dataType: 'text'
            }));
        });
        promises.push(Promise.all(subPromises));
    });

    // show everything, results is nicely formatted so you know when to

    return Promise.all(promises).then(function done(results) {
        // results look like [[row1], [row2], [row3]]
        results.forEach(function (row) {
            row.forEach(function (carLogo) {
                $('.logos').append(carLogo);
            });
            $('.logos').append('
');
        });
    })
}

The Promise.all() solution will introduce a delay, the logos will show at once when they're all fetched. They will be downloaded all at the same time so be careful if it's not your server you're requesting (almost 100 concurrent requests is consequent).
The other way is what you started, building a promise chain.
// arrayOfCompanyNames - contains an Array of [Array of Company Names] appearing in a row. Please Refer Screenshot.
var arrayOfCompanyNames;

// Function where we are traversing the company Name and making call
function getCompanyLogos(arrayOfCompanyNames) {
    // this is enough to create a 'base' resolved promise
    var promise = Promise.resolve();

    arrayOfCompanyNames.forEach(function (item) {
        item.forEach(function (value, index) {
            if (index == item.length - 1) {
                // When a row is complete then move to the next row.
                promise = promise.then(LogoFetchPromis.bind(null, value, true));
            } else {
                promise = promise.then(LogoFetchPromis.bind(null, value));
            }
        });
    });

    return promise;
}

function LogoFetchPromis(carName, wrapNow) {
    // don't create a new Promise here, $.ajax is already a promise
    return $.ajax({
        url: "/getLogo/" + carName,
        dataType: 'text'
    }).done(function (response) {
        // logos is the section where logos should appear
        $('.logos').append(response);
        if (wrapNow)
            $('.logos').append('
');
    }).fail(function (response) {
        // manage error here is needed
    });
}

I commented the changes but the most important is promise.then(LogoFetchPromis(value));. You're calling LogoFetchPromis() directly, that's why your logos show randomly, all the $.ajax are actually done at once. In the fixed code (promise.then(LogoFetchPromis.bind(null, value)), bind() returns a Function that is not executed until promise is resolved so LogoFetchPromis() will be called one at a time and your logos should be displayed in order.


text:
Q: Sending a byte array (type `ay`) over D-Bus using GDBus I am trying to a byte array over D-Bus using the GDBus bindings. Can you please let me know how I can achive that. I tried googling but didnt help.
Byte array contains a image file so cannot be converted to charbytearray
Any help is appriciated

A: I did some tests using an XML where I used the type ay. This works well with the QT binding (generated with qdbusxml2cpp) where it translates into QByteArray however it seems that it doesn't work with the glib binding (generated with gdbus-codegen) where it translates in gchar * and it seems you lose what's after \0 - because somehow it's handled as a string. However you will find that:

This automatic mapping can be turned off by using the annotation org.gtk.GDBus.C.ForceGVariant - if used then a GVariant is always exchanged instead of the corresponding native C type. This annotation may be convenient to use when using bytestrings (type-string ay) for data that could have embedded NUL bytes.

Which means according to https://developer.gnome.org/gio/stable/gdbus-codegen.html that you could handle it as GVariant. I tested this by adding the tag for annotation org.gtk.GDBus.C.ForceGVariant <annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/> on each arg and it works.

A: Actually, instead of using type "ay", you can use "a(y)". The glib binding would translate "a(y)" to GVariant*.
And then you can use "GVariant" handling to deal with the parameter.
e.g. the xml file
<method name="parsePacket">
  <arg direction="in" name="message" type="a(y)">
    <doc>
      <line>type: const Uint8 *</line>
    </doc>
  </arg>
</method>

Generated method:
gboolean (*handle_parse_packet) (
IDbusObject *object, GDBusMethodInvocation *invocation, GVariant *arg_message);

gboolean idbusobject_call_parse_packet_sync (
   IDbusObject *proxy,
   GVariant *arg_message,
   GCancellable *cancellable,
  GError **error);

You can extract and insert data using "GVariant" method.
Insert data at client side:
void parsePacket (unsigned char* arg_message, guint16 arg_length)
{
    GVariantBuilder *builder;
    GVariant *value;

    builder = g_variant_builder_new (G_VARIANT_TYPE ("a(y)"));
    for (int i = 0; i < arg_length; i++)
    {
        g_variant_builder_add (builder, "(y)", arg_message[i]);
    }
    value = g_variant_new ("a(y)", builder);
    g_variant_builder_unref (builder);

    idbusobject_call_parse_packet_sync(proxy,
        value,
        NULL,
        NULL);
}

Extract data at server side:
gboolean handleParsePacket (
    IDbusObject *object,
    GDBusMethodInvocation *invocation,
    GVariant *arg_message)
{
    unsigned char byteArray[2048];
    int actualLength = 0;

    GVariantIter *iter;
    guchar str;

    g_variant_get (arg_message, "a(y)", &iter);
    while (g_variant_iter_loop (iter, "(y)", &str))
    {
        byteArray[actualLength++] = str;
    }
    g_variant_iter_free (iter);

    idbusobject_complete_parse_packet( object, invocation);

    return (TRUE);
}

A: This question has some good ideas in the answers including for passing large amounts of data by writing the data to a file and passing the filename, or using a named pipe.  Writing to a file and passing the file name might be the easiest to implement.

A: At the client side, you could do it easier by calling the g_variant_new_from_data() method:
GVariant* convertByteArrayToVariant(unsigned char* arg_message, guint16 arg_length)
{
    return g_variant_new_from_data(
        G_VARIANT_TYPE ("a(y)"),
        arg_message,
        arg_length,
        TRUE,
        NULL,
        NULL);
}

Or, if you have a populated a GByteArray*, you could do it like this:
GVariant* convertByteArrayToVariant(GByteArray* array)
{
    return g_variant_new_from_data(
        G_VARIANT_TYPE ("a(y)"),
        array->data,
        array->len,
        TRUE,
        NULL,
        NULL);
}


text:
Q: comma seperated field to apex list items I Have a text field wich contains data like 123, 234, 345, 456, 567. I now want to put this data in a list.
It needs some sort of loop that gets the first 3 digits on the left side of the comma. I can't figure out how to do this. any tips?

A: Use this.
String commaValue = '123, 234, 345, 456, 567';
List<String> splitted = commaValue.split(',');
System.debug(splitted.size());
//Result would be 5

You can convert it to integer using valueOf method.


text:
Q: Sort an arraylist of objects by one of the properties? Hi I have an object called item here is the code for it:
Public Class item
Private itemValue As String
Private urlfoundValue As String
Private typeValue As String
Private scorevalue As String
Public Sub New()
    ' Leave fields empty.
End Sub

Public Sub New(ByVal item As String, ByVal urlfound As String, ByVal type As String, ByVal score As String)
    itemValue = item
    urlfoundValue = urlfound
    typeValue = type
    scorevalue = score
End Sub

Public Property item() As String
    Get
        Return itemValue
    End Get
    Set(ByVal value As String)
        itemValue = value
    End Set
End Property

Public Property urlfound() As String
    Get
        Return urlfoundValue
    End Get
    Set(ByVal value As String)
        urlfoundValue = value
    End Set
End Property

Public Property type() As String
    Get
        Return typeValue
    End Get
    Set(ByVal value As String)
        typeValue = value
    End Set
End Property

Public Property score() As String
    Get
        Return scorevalue
    End Get
    Set(ByVal value As String)
        scorevalue = value
    End Set
End Property

I have an ArrayList of these items that I would like to sort in highest to lowest order by the Score property (is string but can be converted to int32).
The items are all store in this arraylist:
Public fullitem As New System.Collections.ArrayList()

Any suggestions on how to get the items in order by the score? Can be done in c# too.

A: A direct answer to your question is to use LINQ like this:
Dim orderdList = fullitem.Cast(Of item)() _
    .OrderBy(Function(i As item) Convert.ToInt32(i.score))

fullitem = New System.Collections.ArrayList()

For Each item In orderdList
    fullitem.Add(item)
Next

This uses Cast to obtain a generic IEnumerable<item> from the ArrayList which then enables you to use LINQ functions like OrderBy.
However, please note that ArrayList is now obsolete, and you should consider using List<Item> instead. If you do that then you can do something as simple as this:
Assuming you have the list defined like this:
Dim list = new List(Of item)()

You can sort it like this:
list = list.Cast(Of item)() _
    .OrderBy(Function(i As item) Convert.ToInt32(i.score)) _
    .ToList()


text:
Q: What is Linux equivalent of LPTSTR & LPCSTR? I am converting windows library to linux. I need to find LPTSTR and LPCSTR in linux.
I get to know that i can use wchar_t can be used but I am not really sure about using it.
one of the method that uses LPTSTR is as follows:
void ErrorExit(LPTSTR zFunction)
{
}

Any help will be appreciated!

A: LPTSTR - Long Pointer to TCHAR STRing (Don't worry, a long pointer is the same as a pointer.)
LPCSTR - Long Pointer to a Const  STRing
LPSTR = char*
LPCSTR = const char*
LPWSTR = wchar_t*
LPCWSTR = const wchar_t*
LPTSTR = char* or wchar_t* depending on _UNICODE
LPCTSTR = const char* or const wchar_t* depending on _UNICODE

from msn page LPCSTR
typedef const char* LPCSTR;

from msn page LPTSTR=>
#ifdef UNICODE
 typedef LPWSTR LPTSTR;
#else
 typedef LPSTR LPTSTR;
#endif

A: In Linux you don't usually use wchar_t for library API functions. Most libraries use UTF-8 encoded strings, so they take as strings plain arrays of NUL-terminated chars (IMO that is far better than duplicating all the functions with ANSI and Unicode versions).
So, with that in mind:

*

*LPCTSTR, LPCSTR, LPCWSTR -> const char *.

*LPTSTR, LPSTR, LPWSTR -> char *.

If you insist in using Unicode functions, MS style, you have to be aware that they actually use UTF-16 encoded strings, and wchar_t is not a portable type, as its size is not specified by the language. Instead you can use uint16_t:

*

*LPCWSTR -> const uint16_t *.

*LPWSTR -> uint16_t *.

And if you want to be extra MS compatible, you can use the UNICODE macro to conditionally typedef the LPTSTR and LPTCSTR into one of the others, but that's probably unneeded for your problem.


text:
Q: My Book Essential Edition : switch box I have a My Book Essential Edition 1To. Sadly I connected the wrong power cable and so a bad smell was coming from the box.
As it was out of support, I opend it thinking  I will plug it directly to my computer and backup the data.
I tried it but seems that there is hardware encryption of the drive. So I can't read any data.
The issue is the small piece of hardware which provides USB and power to the hard drive. This part just burn.
My question is : Can I bought a new My Book Essential Edition and switch the hard drive ? My aim is to get my data back.
FYI I tried many software to restore the data but it wasn't able to read anything. Looking on google didn't return anything.
Thanks !


text:
Q: Updating userform textboxes in userform frames I'm trying to create a system within a VBA textbox that modifies the input.
Textboxes along with other options are in frames that can be opened and closed. Done to keep the form readable for other people.
I know it can be done by editing the string solely in code (and have done that to keep working on the project) but I want people to see the edits the code makes.
These updates are inconsistent. I have two textboxes that edit themselves with identical lines of code and they are both set to update themselves once the textbox has been exited. One only updates if something within the frame that it is in gets clicked on again and the other doesn't update at all whether clicking within its frame or outside.
Ideally the moment a textbox gets edited and something else gets clicked on the textbox updates.
Update
Only updates itself if something else like another checkbox in the frame is clicked or selected and it will also then work when clicking outside of the frame. Does anyone know why?
Code for both
Private Sub Pathbox_Change()

End Sub

Private Sub Pathbox_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim sDir As String
sDir = S5Int.Pathbox.Text
If Right(sDir, 1) <> "\" Then
     S5Int.Pathbox.Text = sDir & "\"
End If

End Sub

The same code for both except the name of the procedure. Frames are also same except for their names. In the form they look something like this:
Form with textboxes

Settings of the elements are also identical

A: Found a solution last week;
I have just put the trigger of updating on the form itself whenever the form itself is clicked it runs through checks to see what needs to be updated and updates; Its a bit crude but it works quite well. This solution wont work if something else other than the form is clicked but that didnt work either for Textbox1_Exit(etc). Since it only updates the form when the form is in the forefront.

It is Also a bit wasteful of cycles as it runs every single time anything on the form is clicked too but as long as the checks are efficient it should be good enough.
I will keep working on a better solution however when I have time, maybe see if I can get exiting from the frame working like FaneDuru said but something else on the form seems to be blocking that solution for now.


text:
Q: Magento Module Not Working : Adminhtml add tab to Product View I'm having trouble getting a new module to work. To begin with I just want to add an additional tab to the Product Edit screen in the adminhtml. I want this tab to show underneath the standard "Custom Options" tab. I have my module showing up in the Configuration > Advanced > Advanced > Disable Module output section.
So here's what I have, seen any mistakes?
Path : app\etc\modules\ns>_CustomerHistory.xml
<?xml version="1.0"?>

<config>
    <modules>
        <<ns>_CustomerHistory>
            <active>true</active>
            <codePool>local</codePool>
        </<ns>_CustomerHistory>
    </modules>
</config>

Path: app\code\local\\CustomerHistory\etc\config.xml
<?xml version="1.0"?>

<config>
    <modules>
        <<ns>_CustomerHistory>
            <version>0.1.0</version>
        </<ns>_CustomerHistory>
    </modules>
    <global>
        <blocks>
            <CustomerHistory>
                <class><ns>_CustomerHistory_Block</class>
            </CustomerHistory>
        </blocks>
        <models>
            <CustomerHistory>
                <class><ns>_CustomerHistory_Model</class>
            </CustomerHistory>
        </models>
    </global>
    <adminhtml>
        <layout>
            <updates>
                <CustomerHistory>
                    <file>CustomerHistory.xml</file>
                </CustomerHistory>
            </updates>
        </layout>
    </adminhtml>
</config>

Path : app\code\local\ns>\CustomerHistory\Block\Adminhtml\Product\Edit\Tab.php
<?php

class <ns>_CustomerHistory_Block_Adminhtml_Catalog_Product_Edit_Tab extends Mage_Adminhtml_Block_Widget
implements Mage_Adminhtml_Block_Widget_Tab_Interface
{
    public function canShowTab()
    {
        return true;
    }

    public function getTabLabel()
    {
        return $this->_('Custom Tab');
    }

    public function getTabTitle()
    {
        return $this->_('Custom Tab');
    }

    public function isHidden()
    {
        return false;
    }

    public function getTabUrl()
    {
        return $this->getUrl('*/*/customtab', array('_current' => true));
    }

    public function getTabClass()
    {
        return 'ajax';
    }
}

?>

Path : app\design\adminhtml\default\default\layout\CustomerHistory.xml
    <?xml version="1.0"?>
    <layout>
        <adminhtml_catalog_product_edit>
            <reference name="product_tabs">
                <block type="CustomerHistory/adminhtml_catalog_product_edit_tab" name="custom_tab" template="CustomerHistory/catalog/product/edit/tab.phtml" />
                <action method="addTab">
                    <name>Custom Tab</name>
                    <block>custom_tab</block>
                </action>
            </reference>
        </adminhtml_catalog_product_edit>
    </layout>

Path : app\design\adminhtml\default\default\template\CustomerHistory\catalog\product\edit\tab.phtml
<?php
/**
 * Custom tab template
 */
?>

Hello

It goes without saying here, any help would be greatly appreciated!


text:
Q: JTree refresh without collapsing I have a problem when refreshing a JTree instance. See the following code:
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;

public class ItemTest {

    private JFrame frame;
    private DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root");
    private JTree tree = new JTree(root);
    private JButton button = new JButton("Rebuild");
    private String[] array = new String[] { "name", "first_name", "middle_name", "last_name"};

    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                try {
                    ItemTest window = new ItemTest();
                    window.frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /**
     * Create the application.
     */
    public ItemTest() {
        initialize();
    }

    /**
     * Initialize the contents of the frame.
     */
    private void initialize() {
        frame = new JFrame();
        frame.setBounds(100, 100, 523, 349);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JScrollPane scrollBar = new JScrollPane();
        GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
        groupLayout.setHorizontalGroup(
                groupLayout.createParallelGroup(Alignment.LEADING)
                .addGroup(groupLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(scrollBar, GroupLayout.PREFERRED_SIZE, 200, GroupLayout.PREFERRED_SIZE)
                        .addComponent(button, GroupLayout.PREFERRED_SIZE, 85, GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(412, Short.MAX_VALUE))
                );
        groupLayout.setVerticalGroup(
                groupLayout.createParallelGroup(Alignment.LEADING)
                .addGroup(groupLayout.createSequentialGroup()
                        .addGap(22)
                        .addComponent(scrollBar, GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)
                        .addComponent(button, GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
                        .addContainerGap())
                );
        button.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent arg0) {
                root.add(new DefaultMutableTreeNode("Row 4"));
                ((DefaultTreeModel) tree.getModel()).nodeChanged(root);
            }
        });
        for(String string : array) {
            root.add(new DefaultMutableTreeNode(string));
        }
        scrollBar.setViewportView(tree);
        frame.getContentPane().setLayout(groupLayout);
    }
}

If we run this code, and expand the "Root" node. We will see 4 nodes in it. If we click the button "Rebuild", the tree won't update it's self. The weird thing is, if we don't expand the "Root" node at the begin (so just start the application) and click the button, and after that we expand the "Root" node, the new row is added. Does anyone knows how to refresh this tree without collapsing, because nodeChanged doesn't seem to work when you expand the "Root" node at the begin.
Note: I have to accomplish this without using insertNodeInto.

A: You must notify the listeners that a node was inserted:
button.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent arg0) {
        root.add(new DefaultMutableTreeNode("Row 4"));
        ((DefaultTreeModel) tree.getModel()).nodesWereInserted(
                root, new int[]{root.getChildCount()-1});
    }
});


text:
Q: Getting Null Pointer Exception Mongo Aggregation Using Spring Data(Dynamic Fields) This is my Mongo Pojo also getters and setters(Not added) .
    @CompoundIndex(name = "account_date_idx", def = "{'account' : 1, 'date' : 1}", unique = true)
@Document(collection = "agent_data_storage")
public class AgentDataStorage extends MongoKeyedEntity<String> implements Serializable {

  public static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
  @Field
  private Long account;

  @Field()
  private String date;

  @Field
  private Map<String, Double> dataPoints = new HashMap<>();

  public AgentDataStorage() {
  }

  public AgentDataStorage(Long account) {
    this.account = account;
    this.date = dateFormat.format(new Date());
    for (AgentDataPoints dataPoint : EnumSet.allOf(AgentDataPoints.class)) {
      this.dataPoints.put(dataPoint.toString(), 0d);
    }
  }

  public AgentDataStorage(String account) {
    this.account = Long.valueOf(account);
    for (AgentDataPoints dataPoint : EnumSet.allOf(AgentDataPoints.class)) {
      this.dataPoints.put(dataPoint.toString(), 0d);
    }
  }

  public AgentDataStorage(Long account, Date date) {
    this.account = account;
    this.date = dateFormat.format(date);
    for (AgentDataPoints dataPoint : EnumSet.allOf(AgentDataPoints.class)) {
      this.dataPoints.put(dataPoint.toString(), 0d);
    }
  }

  public AgentDataStorage(Long account, Date date, Map<String, Double> dataPoints) {
    this.account = account;
    this.date = dateFormat.format(date);
    this.dataPoints = dataPoints;
  }

  public AgentDataStorage(Long account, String date, Map<String, Double> dataPoints) {
    this.account = account;
    this.date = date;
    this.dataPoints = dataPoints;
  }

  public AgentDataStorage(String account, Date date) {
    this.account = Long.valueOf(account);
    this.date = dateFormat.format(date);
    for (AgentDataPoints dataPoint : EnumSet.allOf(AgentDataPoints.class)) {
      this.dataPoints.put(dataPoint.toString(), 0d);
    }
  }

  public AgentDataStorage(String account, String date) {
    this.account = Long.valueOf(account);
    this.date = date;
    for (AgentDataPoints dataPoint : EnumSet.allOf(AgentDataPoints.class)) {
      this.dataPoints.put(dataPoint.toString(), 0d);
    }
  }

  public Long getAccount() {
    return account;
  }

  public void setAccount(Long account) {
    this.account = account;
  }

  public Date getDate() throws ParseException {
    return dateFormat.parse(this.date);
  }

  public void setDate(Date date) {
    this.date = dateFormat.format(date);
  }

  public Map<String, Double> getDataPoints() {
    return dataPoints;
  }

  public void setDataPoints(Map<String, Double> dataPoints) {
    this.dataPoints = dataPoints;
  }

  public void updateDataPoint(AgentDataPoints agentDataPoints, Double value) {
    this.dataPoints.put(String.valueOf(agentDataPoints), value);
  }

  @Override
  public String toString() {
    final StringBuilder sb = new StringBuilder("AgentDataStorage{");
    sb.append("account=").append(account);
    sb.append(", date=").append(date);
    sb.append(", dataPoints=").append(dataPoints);
    sb.append('}');
    return sb.toString();
  }
}

While Trying aggregation i am getting null Pointer Exception , Below is my Test Case.
     @Test
  public void aggregationTest() {
    Long account = 12121l;
    String startDay = "2016-01-01";
    String endDay = "2016-01-03";

    Aggregation aggregation = Aggregation
        .newAggregation(match(Criteria.where("account").is(account).and("date")
            .gte(startDay).lte(endDay)),
            group("account").sum("dataPoints.TOTAL_BUS_COMMISSION").as("total"));
    AggregationResults<AggregationResult> results = mongoTemplate.aggregate(aggregation,
        AgentDataStorage.class, AggregationResult.class);

  }

My AggregationResult class is -
public class AggregationResult {

  private Long _id;

  private Double total;

  public Long get_id() {
    return _id;
  }

  public void set_id(Long _id) {
    this._id = _id;
  }

  public Double getTotal() {
    return total;
  }

  public void setTotal(Double total) {
    this.total = total;
  }
}

Below is Stack Trace Of Error
java.lang.NullPointerException
    at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentPropertyPath(AbstractMappingContext.java:233)
    at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentPropertyPath(AbstractMappingContext.java:214)
    at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentPropertyPath(AbstractMappingContext.java:210)
    at org.springframework.data.mongodb.core.aggregation.TypeBasedAggregationOperationContext.getReferenceFor(TypeBasedAggregationOperationContext.java:96)
    at org.springframework.data.mongodb.core.aggregation.TypeBasedAggregationOperationContext.getReference(TypeBasedAggregationOperationContext.java:91)
    at org.springframework.data.mongodb.core.aggregation.GroupOperation$Operation.getValue(GroupOperation.java:434)
    at org.springframework.data.mongodb.core.aggregation.GroupOperation$Operation.toDBObject(GroupOperation.java:416)
    at org.springframework.data.mongodb.core.aggregation.GroupOperation.toDBObject(GroupOperation.java:361)
    at org.springframework.data.mongodb.core.aggregation.Aggregation.toDbObject(Aggregation.java:331)
    at org.springframework.data.mongodb.core.MongoTemplate.aggregate(MongoTemplate.java:1500)
    at org.springframework.data.mongodb.core.MongoTemplate.aggregate(MongoTemplate.java:1435)
    at psl.service.core.agentanalytics.internal.AgentAnalyticsServiceTest.aggregationTest(AgentAnalyticsServiceTest.java:132)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:72)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:81)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:216)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:82)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:60)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:67)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:162)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)

I also tried to debug the inside spring jar , It's throwing null for Double type inside AbstractMappingContext.java but not able to understant why it's happening .
The same mongo query is working in mongo console.
db.getCollection('agent_data_storage').aggregate([
{ "$match" : { "account" : 12121 , "date" : { "$gte" : "2016-01-01" , "$lte" : "2016-01-03"}}}
, { "$group" : { "_id" : "$account" , "total" : { "$sum" : "$dataPoints.TOTAL_BUS_COMMISSION"}}}])

the result for the above query is
 {
    "_id" : NumberLong(12121),
    "total" : 402.0
}

Thanks for any kind of Help .
Sample Doc from AgentDataStorage-
{
    "_id" : ObjectId("586233e3fb94f6f5640196cf"),
    "account" : NumberLong(12121),
    "date" : "2016-01-01",
    "dataPoints" : {
        "TOTAL_BUS_COMMISSION" : 0.0
    }
}

A: Don't use the typed aggregation variant of aggregation which is essentially trying to translate property references in the input type (AgentDataStorage) into field names and fails when it doesn't find the property references, in your case dataPoints.TOTAL_BUS_COMMISSION.
Use
AggregationResults<AggregationResult> results = mongoTemplate.aggregate(aggregation,
    "agent_data_storage", AggregationResult.class);


text:
Q: do i need a def __init_(self) function in a new class definition im confused with use of def __init__ in a class definition. im new, so problem is not understanding why the hell i needed it - if i dont have to define variables in the class:
here is a paramiko ssh connection object, in which i have commented out the def__init__(self), and my code seems to work. if i uncomment the line, i get an error about indent because there is no code underneath the def __init__. Im partly concerned because I reference self in the other functions to perform more actions in the instance. it seems to know what self is, even though i haven't init-ed it.
  File "XXXX", line 517
    def sshCLIENT(self):
    ^
IndentationError: expected an indented block after function definition on line 515

class SSHCONN():  #paramiko connection object class for SSH logins
    '''http://http://www.paramiko.org/'''

    #def __init__(self):

    def sshCLIENT(self):
        try:
            self.sshSESS = paramiko.SSHClient()  #instantiate SSH session object
            self.sshSESS.set_missing_host_key_policy(paramiko.AutoAddPolicy())  #auto add host SSH key - must trust
            return True
        except:
            return False

    def CONNECT(self, IP, U, P, validPWD=True, Port=22):
        PwdShow = P if validPWD == False else '<PwdHidden>'

        try:
            LogDrop(f'Login Attempt to \'{IP}\' with: \'{U} / {PwdShow}\'')
            ##paramiko needs keyword arguments for logins, cannot use positional
            self.sshSESS.connect(hostname=IP, username=U, password=P, look_for_keys=False, allow_agent=False, timeout=5)
            return True

        except paramiko.ssh_exception.AuthenticationException:
            LogDrop(f'Connection to \'{IP}\' failed with: \'{U} / {PwdShow}\', due to bad username or password.')
            LogDrop('...')
            self.sshSESS.close()
            return False

        except paramiko.ssh_exception.SSHException:
            LogDrop(f'Connection to \'{IP}\' failed, probably due to SSH2 protocol negotiation errors.')
            LogDrop('...')
            self.sshSESS.close()
            return False

        except paramiko.ssh_exception.NoValidConnectionsError:
            LogDrop(f'Connection to \'{IP}\' failed, probably due SSH not listening.')
            LogDrop('...')
            self.sshSESS.close()
            return False

        except:
            LogDrop(f'Connection to \'{IP}\' failed, probably due to host not online.')
            LogDrop('...')
            selfsshSESS.close()
            return False

    def CLOSE(self, IP=None):
        if IP == None: IP = 'server'
        else: IP = "\'" + IP + "\'"

        self.sshSESS.close()
        LogDrop(f'SSH connection successfully closed to: {IP}')

    def SFTPOPEN(self, IP=None):
        if IP == None: IP = 'server'
        else: IP = "\'" + IP + "\'"

        try:
            self.sshSESS.open_sftp()
            return True

        except:
            LogDrop(f'SFTP session opened failed to {IP}; likely due to SFTP not running or configured.')
            LogDrop('...')
            self.sshSESS.close()
            return False

    def SFTPPUT(self, IP, file, strRmtSubDir):
        try:
            LogDrop(f'Transferring file {os.path.basename(file)} to server: {IP}')
            LogDrop(f'at remote location: {strRmtSubDir}/{os.path.basename(file)}')
            self.sshSESS.open_sftp().put(file, strRmtSubDir.rstrip("/") + "/" + os.path.basename(file)) #if user has ending "/", rstrip it
        except FileNotFoundError as error:
            LogDrop(f'Unable to move file: {error}')
        except:
            LogDrop('Unexpected error: ', sys.exc_info())
            sys.exit(1)

    def SFTPCLOSE(self, IP=None):
        if IP == None: IP = 'server'
        else: IP = "\'" + IP + "\'"

        try:
            self.sshSESS.open_sftp().close()
            LogDrop(f'SFTP Channel successfully closed to: {IP}')
        except:
            LogDrop(f'SFTP Channel failed to close to: {IP}')

A: You do not need to define a constructor in Python if it serves you no purpose.  Python will provide a default constructor if no constructor is defined. It does not do anything except initialize your object. Rest assured, your references to self will work exactly the same way as if you had defined an empty constructor with no body.
Also the reason you seem to be getting an indentation error is because the interpreter expects the next line after def __init__(self): to be a part of the __init__ function you can instead is define an empty constructor with no body as follows:
def __init__(self):
    pass
#Rest of your code as it is


text:
Q: How would I prove that the $k$th derivative is $k+1$ for $y^{k}(x)=n^{k}y^{k}(nx)$? I know,
(1) $y'(x)=ny'(nx)$
(2) $y''(x) = n^{2}y''(nx)$
(3) $y'''(x)=n^{3}y'''(nx)$
$\implies$(k) $y^{k}(x)=n^{k}y^{k}(nx)$
Let us suppose $k$ holds and lets see if $m=k+1$ holds.
$\implies n^{k}y^{k}(x)=n^{k+1}y^{k+1}(x)$
Am I writing this correctly? Should it instead read.
$ n^{k}y^{t}(x)=n^{k+1}y^{t}(x)$, where $t$ is the $t$th derivative. This of course implies that $n^{k+1}=n^{k}$.
What would the next step be in the inductive proof.

A: If you suppose that $y^{(k)}(x)=n^ky^{(k)}(nx)$, differentiating this equality gives you $$y^{(k+1)}(x)=n^k\times ny^{(k+1)}(nx)=n^{k+1}y^{(k+1)}(nx)$$


text:
Q: why are these two intuitive ways of understanding division equivalent? The elementary school example of division, say 12:4 is saying that you have to share out 12 cookies to 4 kids. However, another (only slightly less intuitive) way would be to ask how many times 4 "fits" into 12. I am not a native English speaker but I guess that's the intuition behind the (mostly American ?) expression and notation of dividing "4 into 12".
My question is the following. What would be an intuitive way to explain why these two intuitions of division are in fact equivalent?

A: You hand out 12 cookies to four kids. The cookies are not chocolate chip cookies, as they first appear to be -- they are oatmeal raisin cookies. The kids throw the cookies back into the jar. How many cookies does each kid throw back into the jar?


text:
Q: Facing problem while installing any node packages using npm Snippet written in the terminal:
npm install -g npm
Received the following error lines which is the same case with any new module installation as well:
node:internal/modules/cjs/loader:1039 const err = new Error(message); ^
Error: Cannot find module '../../ours/errors' Node.js v18.13.0
Expected a smooth installation where also, I tried installing Node.js again and its installation includes a proper installation of npm as well.


text:
Q: How to turn on progress bar in Internet Explorer 9? I have status bar but no progress bar there during loading pages.

A: Microsoft removed the progress bar when they rebuild IE9

The IE9 team built the UI from the ground up, starting with nothing and only adding what was needed (rather than starting with IE8 and removing features).  Because the progress bar is very prone to error, sometimes remaining at less than 100% indefinitely regardless of whether the site was done loading.

A: Right-click on the empty space between address/tab and home; then select "status bar" to restore it at the bottom of the window (also - restore menu by selecting "menu bar").

A: The status bar is at the bottom of the browser and typically does two things.

*

*Shows information about the URL when you hover over a link.

*Allows the user to adjust the zoom on the page.

In order to enable progress bar, just click View > Toolbars > Status Bar


text:
Q: Magento 2 failed connecting to Shipworks Magento 2.3.1 is failing to connect to Shipworks via REST API. The error it is giving is

The remote server returned an error: (401) Unauthorized.

When traced with Fiddler the result is

{"message":"The consumer isn't authorized to access %resources.","parameters":{"resources":"Magento_Sales::actions_view"},"trace":"#0 /home/buyglasswoodstov/public_html/vendor/magento/module-webapi/Controller/Rest/RequestValidator.php(68):

I attempted reading through Magento Docs but I am very unfamiliar with REST API. Any help would be appreciated. Thanks!

A: I just migrated to 2.3.1 this week and Shipworks worked on the 1st try. I followed the steps on their support page. Since I'm keeping magento 1 around until those orders are closed out, I had to buy a 2nd license and then migrate the 1st license via phone call to the new URL.
Maybe this could be the culprit: I observed that the backend only allows one login instance per username. I already knew this before trying to connect, so I created the new user. You also need to go to the System => All Users -> User Role tab and explicitly make the new user Admin.


text:
Q: Dry film PCB yellow light I print out a negative on acetate paper, I stick it on a copper plate with dry film, and I press it with an iron. While doing these operations, we have to be in yellow light, what is the content of this yellow light?

A: It varies by the photoresist, but generally you want to block almost 100% of the light below 500nm in wavelength.
For example, here is a commercially available filter sleeve that fits overtop of a T5 or T8 fluorescent bulb to block short wavelength light.


text:
Q: Normalized regression coefficients - interpretation I have data containing several variables. I ran a regression model. Prior to running the model I have normalized the dependent variable Y and the independent variables X1 and X2.
After receiving the output I want to interpret the results. For example, if the coefficient of X1 is 0.15, I know that it means that for addition of one standard deviation of X1, there is an increase of 0.15 standard deviations in Y, but this is not clear.
I want to go back to the original units of Y and X for interpretation. How do I do that ?  Can I simply take the "normalized coefficients", multiply by the standard deviation of Y and add the mean of Y?
Something about it doesn't make me comfortable.

A: Firstly, why did you normalized Y? It will make your output harder to interpret, and it is often not necessary to standardize the dependent variable.
I presume you have centered and scaled you X's, you can backtransform them to interpret,
        # run your model with the X's standardized

        mean <- mean(x1)
        sd <- sd(x1)

    b1*(x1-mean)/sd

#you can also plot

plot(y~x1)
curve(b0 + b1*(x1-mean)/sd, add=TRUE)

I also recommend to use Y at its original scale, since standardization does not change the distribution shape.

A: Standardising both the dependent and independent variables can be useful for presentation and coefficient interpretation, normally in simple linear regression, whenever the Pearson correlation coefficient $r_{xy}$ is of interest.   The OLS estimation
$\hat{\beta} = r_{xy} \times \frac{s_y}{s_x}
$.
Clearly, if a variable $z$ has been standardised to ${z\prime}$ then it's standard deviation must equal unity, since
$$
\sqrt{\mathbb{V}[{z\prime}]} = \sqrt{\mathbb{V}\left[\frac{z-\bar{z}}{\sqrt{\mathbb{V}[z]}} \right]} = \sqrt{\frac{1}{\mathbb{V}[z]}{\mathbb{V}[z-\bar{z}]}} = 1
$$
Therefore, when both $y$ and $x$ have been standardised $s_y=s_x=1$ and the OLS estimator for $\hat\beta$ is the correlation coefficient $r_{xy}$.  Note also that the OLS estimator of $\alpha$ is zero for standardised variables since $\bar{x}=\bar{y}=0$.
In your multiple regression context, if your $X_i$ are independent then the $\beta_i$ will be equal to the correlation coefficients if you had performed separate simple regressions.
If the $X_i$ are not independent, each $\beta_k$, a partial correlation coefficient, shows the relationship between $Y$ and $X_k$ with the other $X_i$ fixed.  This can have a different value to the simple correlation coefficient between $Y$ and $X_k$ in a simple linear regression ignoring the other $X_i$.


text:
Q: Basic Linear Algebra Question I am trying to figure out why
dim(colA) = dim(row A), where
col A is the column space of A and
row A is the row space of A.
Could someone please help me!
Thank you!!

A: Denote $\rho^c$ the column rank and $\rho^r$ the row rank.
First of all, $\rho^c(A)=1 \iff A=u\cdot v^T$ for column vectors $u,v$ $\iff \rho^r(A)=1$.
Then prove that $\rho^c(A_1+\ldots+A_n) \le \rho^c(A_1)+\ldots+\rho^c(A_n)$. Finally, for an arbitrary $A$, $r:=\rho^c(A)$, using the $r$ independent columns, construct $r$ pieces of rank 1 matrices $A_i$ such that $A=A_1+\ldots+A_r$.
This shows that $\rho^c(A) = \min\{k \mid \exists A_1,..,A_k$ with rank 1$: A=A_1+\ldots+A_k \}$. And the same for $\rho^r$.

A: Consider $rref(A)$. The column correspondence principle (CCP) states that any linear dependence of the columns of $A$ is also found in the columns of $rref(A)$. It follows that the pivot columns of $A$ form a basis for $Col(A)$.
Next, you can argue that the pivot rows of $rref(A)$ form a basis for the row space of $A$.
Or, alternatively, argue that the pivot columns of $A^T$ form a basis for $Col(A^T)$ and $Row(A)=Col(A^T)$.
If you haven't proven any of these statements yet then you really should try since these give you simple computations to find bases for row and column space.


text:
Q: Firebase Function - finished with status code: 204 I have a firebase cloud function:
const admin = require('firebase-admin');
const firebase_tools = require('firebase-tools');
const functions = require('firebase-functions');

admin.initializeApp();

exports.deleteUser = functions
  .runWith({
    timeoutSeconds: 540,
    memory: '2GB'
  })
  .https.onCall((data, context) => {

  const userId = context.auth.uid;
  var promises = [];

  // DELETE DATA
  var paths = ['users/' + userId, 'messages/' + userId, 'chat/' + userId, 'like/' + userId];

  paths.forEach((path) => {
    promises.push(
      recursiveDelete(path).then(  () => {
          return 'success';
        }
      ).catch( (error) => {
        console.log('Error deleting user data: ', error);
      })
    );
  });

  // DELETE FILES
  const bucket = admin.storage().bucket();
  var image_paths = ["avatar/" + userId, "avatar2/" + userId, "avatar3/" + userId];
  image_paths.forEach((path) => {
    promises.push(
      bucket.file(path).delete().then(  () => {
            return 'success';
          }
         ).catch( (error) => {
          console.log('Error deleting user data: ', error);
        })
      );
    });

  // DELETE USER
  promises.push(
    admin.auth().deleteUser(userId)
    .then( () => {
      console.log('Successfully deleted user');
      return true;
    })
    .catch((error) => {
      console.log('Error deleting user:', error);
    })
  );

  return Promise.all(promises).then(() => {
    return true;
  }).catch(er => {
      console.error('...', er);
  });
});

function recursiveDelete(path, context) {
    return firebase_tools.firestore
    .delete(path, {
      project: process.env.GCLOUD_PROJECT,
      recursive: true,
      yes: true,
      token: functions.config().fb.token
    })
    .then(() => {

      return {
        path: path
      }
    }).catch( (error) => {
      console.log('error: ', error);
      return error;
    });
  }
  // [END recursive_delete_function]

Im trying to run this function locally from a javascript file:
function deleteAccount(userId) {
  fetch(
    `https://us-central1-myappname.cloudfunctions.net/deleteUser/${userId}`,
    { method: "DELETE" }
  );
}

But im getting a:

deleteUser Function execution took 1952 ms, finished with status code:
204

Here is my cloud function URL from firebase:

A: Posting an answer based on my comment and above community members comments for visibility.
Based on the comment from stf_F it is a good idea to use callable functions as it remembers the state, and you don't have to pass any UID to delete the user.
Or you can delcare it also as mentioned in this document.

const text = data.text;

// Authentication / user information is automatically added to the
request.

const uid = context.auth.uid;

const name = context.auth.token.name || null;

const picture = context.auth.token.picture || null;

const email = context.auth.token.email || null;index.js

And you can check how to delete using callable from the following document.
However, if you prefer using fetch and if you want to know how to get the data in JSON and how to save it in HTML. You can check this article.
You can use the following example regarding how to structure your fetch

    fetch(functionEndpoint)
        .then(res => res.json())
        .then(function(data) {
                      /** DO STUFF WITH YOUR DATA **/
                  }).catch(function(error) {
                      console.log("Err is:" + err);
                  });

And Below example how to use get and fetch the info you need.

    document.getElementById("output").innerHTML =
        JSON.stringify(data, null, 2); }

Please don't forget to specify the output in your HTML page
<pre id="output"> </pre>
And you can check the following document of how to parse the received JSON data and extract UID for example.


text:
Q: VCL Varnish randomint_seeded and std.strtol in PHP or Javascript For AB testing purposes we generate a unqiue hash of a user Id into a bucket value in VCL (by Fastly CDN).
set var.backResult =
  randomint_seeded(1, 4,
    std.strtol(
       substr(
         digest.hash_md5(req.http.X-Development-UserId)
       , 0, 8),
    16)
  );

This start by hashing the user id to a MD5 string. Then the first 8 chars. are used in the std.strtol function what converts it to a integer value. That value is then used as a seed to the randomint_seeded function.
We're struggling doing the same functions as std.strtol and randomint_seeded in any other language (looking for PHP or javascript). We need to have the same result in different languages.
Any suggestions on this?


text:
Q: Postgresql running sum of previous groups? Given the following data:
sequence | amount
1          100000
1          20000
2          10000
2          10000

I'd like to write a sql query that gives me the sum of the current sequence, plus the sum of the previous sequence.  Like so:
sequence | current | previous
1 120000 0
2 20000 120000

I know the solution likely involves windowing functions but I'm not too sure how to implement it without subqueries.

A: SQL Fiddle
select
    seq,
    amount,
    lag(amount::int, 1, 0) over(order by seq) as previous
from (
    select seq, sum(amount) as amount
    from sa
    group by seq
) s
order by seq

A: If your sequence is "sequencial" without holes you can simply do:
SELECT t1.sequence,
  SUM(t1.amount),
  (SELECT SUM(t2.amount) from mytable t2 WHERE t2.sequence = t1.sequence - 1)
FROM mytable t1
GROUP BY t1.sequence
ORDER BY t1.sequence

Otherwise, instead of t2.sequence = t1.sequence - 1 you could do:
SELECT t1.sequence,
  SUM(t1.amount),
  (SELECT SUM(t2.amount)
   from mytable t2
   WHERE t2.sequence = (SELECT MAX(t3.sequence)
                        FROM mytable t3
                        WHERE t3.sequence < t1.sequence))
FROM mytable t1
GROUP BY t1.sequence
ORDER BY t1.sequence;

You can see both approaches in this fiddle