text:
Q: Non-probabilist term for conditional expectation? When writing an article I encounter what is essentially a conditional expectation - function defined on a bounded interval (not necessarily of unit length) with Lebesgue measure, but information about it is restricted to sets of a given sub-sigma-algebra, which is usually not finite. The article does not otherwise use probabilistic terminology, so it would be nice to not make it necessary for readers to be familiar with conditional expectations.
Does there exist established terminology or notation for the conditional expectation outside probabilistic context?
I will certainly mention the probabilistic interpretation. Otherwise, the paper uses classical epsilon-delta analysis, functional analysis, and a smattering of calculus of variations. The motivation is in PDE and inverse problems.
The function turns out to be in all $L^p$ spaces, and in particular in $L^\infty$.

A: I quote "Functional Analysis for Probability and Stochastic Processes: An Introduction" by Adam Bobrowski, introduction to Chapter 3 "Conditional expectation":
$\newcommand{\cF}{\mathcal{F}}\newcommand{\cG}{\mathcal{G}}\newcommand{\PP}{\mathbb{P}}$

The space $L^2(\Omega,\cF,\PP)$ of square integrable random variables on a probabilty space $(\Omega,\cF,\PP)$ is a natural example of a Hilbert space. Moreover, for $X\in L^2(\Omega,\cF,\PP)$ and a $\sigma$-algebra $\cG\subset\cF$, the conditional expectation $\mathbb{E}(X|\cG)$ of $X$ is the projection of $X$ onto the subspace of $\cG$-measurable square integrable random variables.

The full definition (for random variables in $L^1(\Omega,\cF,\PP)$) appears a bit later in the book as Definition 3.2.5 and the conditional expectation in $L^p$ with $p>1$ is explained in Section 3.3.3.
I'd think that a reference to this book (or these chapters) would be very helpful for all readers who are not so familiar with probability and more familiar with functional analysis. So I'd suggest to use the word projection in this context (which has to understood with respect to the $L^2$ norm and not with respect the $L^\infty$ norm, but one can explain this in a few words, and Bobrowski in a good reference for any reader who wants to know more).

A: Yes, it's called a pushforward!
For more details, see this answer:
Conditional Expectation for $\sigma$-finite measures


text:
Q: Sending post data along with file_get_contents() I read this question from stackoverflow:
How to post data in PHP using file_get_contents?
which covers pretty much everything in order to explain as to how to use file_get_contents() function in php
To practice, I created these two php files :
1.php
<?php

$postdata = http_build_query(
    array(
        'name' => 'example',
        'roll' => '123321'
    )
);

$opts = array('http' =>
    array(
        'method'  => 'post',
        'header'  => 'Content-type: application/x-www-form-urlencoded',
        'content' => $postdata
    )
);

$context = stream_context_create($opts);
$result = file_get_contents('http://localhost/2.php', false, $context);
echo $result;

?>

And this is my code for
2.php
<?php

$name = $_POST['name'];
$roll = $_POST['roll'];

echo $name . "<br>" . $roll;

?>

The expected output is that 1.php should send "name" and "roll" to 2.php using method="post" and get the contents of that file and print them like this :
Expected Output :

Example
  123321

And this is the output that i am getting now (as if no POST data is sent)

Notice: Undefined index: name in C:\xampp\htdocs\2.php on line 3
Notice: Undefined index: roll in C:\xampp\htdocs\2.php on line 4

A: http://www.php.net/manual/de/context.http.php#101933:

"watch your case when using methods (POST and GET)...it must be always uppercase. in case of you write it in lower case it wont work."

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to show that a group is not simple using a normalizer Let $G$ be a group of order $7^3p^n$ for some $n\ge3$ and $p>7$. Suppose that $P,Q$ are distinct Sylow $p$-subgroups of $G$. I showed that $$|P \cap Q| = p^{n-1} \text{ and } |N_G(P\cap Q)| \ge p^{n+1}.$$ Now, I want to show that    $G$ is not simple but I am stuck at this point. I thought that  $N_G(P \cap Q) $ may be  normal in $G$ but it is not always the case. How can I show that $G$ is not simple?
Edit. Condition on $p$ is fixed

A: If $G$ is simple then the number of Sylow $p$-subgroups divides $7^3$ and is congruent to $1$ modulo $p$.
We have $7-1 = 2\times 3$, $7^2-1 = 2^4\times 3$, and $7^3-1 = 2 \times 3^2 \times 19$.
So if $p>7$, then the only possibility is $p=19$ with $343$ Sylow $p$-subgroups.
Now, letting $P$ and $Q$ be distinct Sylow $p$-subgroups as in your argument, the number of Sylow $p$-subgroups of $N_G(P \cap Q)$ must also divide $7^3$, so it must be $343$, and hence $N_G(P \cap Q) = G$, and $G$ is not simple.


text:
Q: Alternative to Shotwell I have a Nikon camera and a Doro phone. On my windows 7 pc I am able to download photos from both using Piccassa with no problems.
On my Linux laptop running Ubuntu 12.04 I can download photos from my camera with no problems. However Shotwell does not recognise my Doro  phone and no icon appears when I connect it.
I understand Piccasa no longer supports linux and I cannot download it.
Is there an alternative to Shotwell  or am I doing something wrong

A: There are a lot of alternatives to Shotwell, also last Picasa for linux is still available to download if you search for it.
F-Spot
digiKam
Gwenview
Although it looks like your problem is like Jos said, your pc isn't recognizing your phone.


text:
Q: error while removing node in Binary search tree I am having problem in removing node in BST when the node has both child here is my code for deletion:
void remove(int val)
        {
            treeNode *ptr=root,*prev=root;
            if(root->data==val)
            {
                if(root->left==NULL &&root->right==NULL)
                    root=NULL;
                else if(root->left==NULL)
                {
                    root=root->right;
                    delete ptr;
                }
                else if(root->right==NULL)
                {
                    root=root->left;
                    delete ptr;
                }
                else
                {

                    swap(root,root->left);
                    delete root->left;
                    root->left=NULL;

                }
                return;
            }
            else
            {
            while(ptr->data!=val)
                 {
                    prev=ptr;
                    if(val<ptr->data)
                        ptr=ptr->left;
                    else if(val>ptr->data)
                        ptr=ptr->right;
                 }
                if(ptr->left==NULL && ptr->right==NULL)
                {
                    if(prev->left==ptr)
                        prev->left=NULL;
                    else if(prev->right==ptr)
                        prev->right=NULL;
                    delete ptr;
                    ptr=NULL;
                }
                else if(ptr->left==NULL)
                {

                    root=root->right;
                    delete ptr;
                }
                else if(ptr->right==NULL)
                {

                    root=root->left;
                    delete ptr;
                }
                else
                {
                    swap(ptr,ptr->left);
                    delete ptr->left;
                    ptr->left=NULL;

                }
        }
    }

Some test cases have been passed successfully such as:
3
3 4 5
1
d 3

and
5
21 16 78 1 22
2
i 20 d 16

But inputs like this makes the program terminate
3
3 2 1
1
d 2

Complete code can be viewed here.

A: Your problem lies within the following lines within the "else"-branch of your remove-method:
            else if(ptr->left==NULL)
            {

                root=root->right;
                delete ptr;
            }
            else if(ptr->right==NULL)
            {

                root=root->left;
                delete ptr;
            }

Probably you forgot to implement those after copying and pasting from the first case. A quick hack brings me to this:
// the node we found has only a single child
else if(ptr->left==NULL || ptr->right==NULL)
{
    // we need to re-add the non-empty sub-tree
    treeNode *partialTree = (ptr->left == NULL) ? ptr->right : ptr->left;
    // add the sub-tree on the place where ptr was linked
    if (prev->left == ptr)
        prev->left = partialTree;
    else
        prev->right = partialTree;
    delete ptr;
}

A: Your remove function is wrong. In the original code you were always modifying the children pointers of root rather than ptr. And if a node has 2 children you were not promoting the successor. Read about deletion of BST node which has two children.
Also I have created a sentinal node so that you dont have to check for deletion occurring at root node. Use this constructor
#include<limits.h>
binarySearchTree()
{
    root=new treeNode;
    root->data=INT_MAX;
    root->right=NULL;
    root->left=NULL;
}

void remove(int val)
{
    treeNode *ptr=root,*prev=root;

    while(ptr->data!=val)
    {
            prev=ptr;
            if(val<ptr->data)
                    ptr=ptr->left;
            else if(val>ptr->data)
                    ptr=ptr->right;
    }
    if(ptr->left==NULL && ptr->right==NULL)
    {
        if(prev->left==ptr)
                prev->left=NULL;
        else if(prev->right==ptr)
                prev->right=NULL;
        delete ptr;
        ptr=NULL;
    }
    else if(ptr->left==NULL)
    {
        if(prev->left==ptr)
        {
            prev->left = ptr->right;
        }
        else
        {
            prev->right = ptr->right;
        }
        delete ptr;
    }
    else if(ptr->right==NULL)
    {
        if(prev->left==ptr)
        {
            prev->left = ptr->left;
        }
        else
        {
            prev->right = ptr->left;
        }
        delete ptr;
    }
    else //two children. Get the right Child's leftmost node (say X) and set ptr->data := X->data. Then delete X
    {
        treeNode* rChild = ptr->right;
        treeNode* rChildParent = ptr;
        while(rChild->left != NULL)
                    {
                        rChildParent=rChild;
                        rChild = rChild->left;
                    }
                    ptr->data=rChild->data;
                    if(rChildParent == ptr)
                    {
                        ptr->right=rChild->right;
                    }
                    else
                    {
                        rChildParent->left=rChild->right;
                    }
                    delete rChild;
    }
}


text:
Q: Weird issue with an SQL query I've edited the question to be more specific and clear
I have the following code on a standalone PHP file:
$conn = mysql_connect("localhost", "", "");

mysql_select_db("name", $conn);

$result = mysql_fetch_array(mysql_query("SELECT EVENT_PRIVATE FROM events WHERE EVENT_ID = 68"));

var_dump($result);

result is NULL
However, if I copy the exact same query to phpMyAdmin, you can see that EVENT_PRIVATE has a value 1 in it.

I have only one db, so I'm definitely using the same db, also, if I select a different column, I can see the correct value.
I don't get it, do you?

A: I've tried this on matching versions of PHP and MySQL, and it does seem to be something odd about the way the PHP "mysql" functions handle bit fields, or at least something I don't understand. And it certainly looks a bit like a bug. It works as I'd expect in the "mysqli" extension. Here's what I tried:
<?php
// mysql:
$conn = mysql_connect('localhost', 'test', 'test');
mysql_select_db("test", $conn);
$result = mysql_fetch_array(mysql_query('SELECT EVENT_PRIVATE FROM test WHERE id = 2'));
var_dump($result);

/* Result:
array(2) {
  [0]=>
  string(1) ""
  ["EVENT_PRIVATE"]=>
  string(1) ""
}
*/

// mysqli:
$mysqli = new mysqli('localhost', 'test', 'test', 'test');
$mysqli_result = $mysqli->query('SELECT EVENT_PRIVATE FROM test WHERE id = 2');
$result = $mysqli_result->fetch_array();
var_dump($result);

/* Result:
array(2) {
  [0]=>
  string(1) "1"
  ["EVENT_PRIVATE"]=>
  string(1) "1"
}
*/

EDIT: Aha!
The book "High Performance SQL" says 'MySQL treats BIT as a string type, not a numeric type; when you retrieve a BIT(1) value the result is a string but the contents are the binary value 0 or 1, not the ASCII value "0" or "1"'.
I was expecting BIT to be like the SQL Server "bit" data type, which is a single bit designed for storing a boolean true/false (0/1) value. However, in MySQL it's much more a bitfield -- unlike SQL Server, you can have a bit(8) field, for example, which is eight bits long. And MySQL has a specific "boolean" type instead for storing booleans.
I'm guessing this is the root of what's going on. Notice that what's coming back for the mysql result is a string(1) -- that's a one-character long string, not an empty string, which would be string(0). If you look at the value of that single character:
echo ord($result['EVENT_PRIVATE']);
1

...then it's an ASCII 1!
So, I'd say what's happening is probably, oddly, by design. The mysql extension is being very literal about interpreting the bitfield, and giving you a string encoding the actual bits that are stored in the field in MySQL, at the bit level. The mysqli extension is being a bit friendlier, perhaps, and converting the value into a string representation of the bits.
I'll leave it to you to experiment with what happens if you grab a bit(8) set to 10101010 using mysql and mysqli...

A: Try to narrow your query to a single event_id. Run it on PHPMyAdmin and then via PHP. You should see the same values.
Note that the assignment to $final is not relevant to the question, as it cannot be flawed. The problem is in $results.

A: replace your * with the field names to see if it complains about EVENT_PRIVATE. maybe it's not supposed to be caps or you are getting a result for the wrong join.

A: Please try this one:
$result = mysql_fetch_array(mysql_query("SELECT EVENT_PRIVATE FROM events WHERE EVENT_ID = '68'"));

I just add single quotation around 68. Let me know if it work for you.
Edit:
Just for more information about single quote and double quote in sql query you can check THIS link


text:
Q: Mario running across screen too fast in pygame So first of all the code:
import pygame, sys
from pygame.locals import *

class Person(pygame.sprite.Sprite):

    def __init__(self, screen):
        self.screen = screen
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.image.load("images/mariowalking0.png")
        self.rect = self.image.get_rect()
        self.rect.center = (320, 220)
        self.poseNumber = 1
    def update(self):
        self.rect.centerx += 1
        if self.rect.centerx > self.screen.get_width():
            self.rect.centerx = 0
        self.poseNumber = (self.poseNumber + 1)
        if self.poseNumber == 2:
            self.poseNumber = 0
        self.image = pygame.image.load("images/mariowalking" + str(self.poseNumber) +".png")
    def main():
        screen = pygame.display.set_mode((640, 480))
        background = pygame.Surface(screen.get_size())
        background.fill((255, 255, 255))
        screen.blit(background, (0, 0))
        boy = Person(screen)
        allSprites = pygame.sprite.Group(boy)
        keepGoing = True
        while keepGoing:
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    keepGoing = False
                    pygame.quit()
            allSprites.clear(screen, background)
            allSprites.update()
            allSprites.draw(screen)
            pygame.display.flip()
    if __name__ == "__main__":
        main()

If you want to run the code, the images of the sprites can be found here: http://imgur.com/a/FgfAd
The Mario Sprite runs across the screen at a very fast pace. Even though I said that I am going to increase the value of centerx by 1. Any ideas why this is happening.
BTW I am really new to pygame, so sorry if I am overlooking an obvious fact or something.

A: Your program will run with different speed on different computer - it depends on computer speed. You can use pygame.time.Clock() to get the same speed on all computers (except very slow computers) and also to slow down game and Mario speed.
clock = pygame.time.Clock()

while keepGoing:

    # rest of the code

    pygame.display.flip()

    clock.tick(30)

Now game will draw 30 frames per second (FPS) on all computers and Mario will be drawn 30 times per second. 25 FPS is enought for human eye to see nice animation. If you need you can set more FPS - for example 60.

This code (get_fps() and tick() without aguments) show you how fast is game on your computer. On my computer I get mostly 500 FPS (but sometimes even 1400 FPS).
clock = pygame.time.Clock()

while keepGoing:

    # rest of the code

    pygame.display.flip()

    clock.tick()
    print clock.get_fps()

EDIT: if I minimalize window I get 10 000 FPS :)

EDIT:
If you still need to slow down Mario and have at least 30 FPS you have to check time before you move Mario.
class Person(pygame.sprite.Sprite):

    def __init__(self, screen):
        # rest of code
        self.next_move = pygame.time.get_ticks() + 100 # 100ms = 0.1s

    def update(self):
        if pygame.time.get_ticks() >= self.next_move:
            self.next_move = pygame.time.get_ticks() + 100 # 100ms = 0.1s
            # rest of code

I use get_ticks() to get current time in milliseconds(ms) (1000 milliseconds = 1 second) and compute time of next move (100 milliseconds = 0.1 second). Now Mario will make 10 steps per second. This way it will always make 10 steps per second even if I change FPS to 10 000 :).


text:
Q: Differential equation from a circuit: two methods give different results I saw an example problem from a lecture note and tried to solve it by a different method. Then I got confused as the results are different.
Here is the example:
It's not some web site as I know so I'll capture to show here:

And solution from the lecture:

My attempt:
I called the middle node in Laplace is Vc and tried to solve it with Laplace and then convert it to differential equation instead.

From here I think it's straightforward to convert it to differential equation with Vc(t) but I got confused as the two are not same. You can see that in my Lapalce equation there is a term -E*L which is -44 there is not present in the solution in the lecture note.
I have been trying to check for several hours but couldn't find the error.  Hope someone can help.

A: The two results don't correspond because there are two different functions being used for \$E\$. In time-domain approach taken in the lecture, it is assumed that \$E\$ is constant for all \$t\$, whereas in your Laplace solution, \$E\$ is assumed to be a step function.
The assumption of constant \$E\$ (for all time) is applied in the lecture between Equation 6 and Equation 7 when the derivative of \$i_L(t)\$ is computed, and \$dE/dt\$ is assumed to be zero. The final differential equation arrived at is true if \$E(t)\$ is taken as a constant for all \$t\$ (including \$t\leq 0\$). If you want to an equation that is valid for something more general, we must not assume \$dE/dt=0\$ for all \$t\$.
Pursuing this path and leaving the voltage \$E\$ to be a general function of time \$E(t)\$, we can start from Equation 6 in the lecture. Equation 7 then becomes
$$
\frac{di_L(t)}{dt}=\frac{1}{R_1}E'(t) - \frac{1}{R_1}\frac{du_c(t)}{dt} – C\frac{d^2u_c(t)}{dt^2}
$$
If you now want to solve the same problem as you are setting up with your Laplace version of the solution, you have to keep this \$E'(t)\$ term. If \$E(t)\$ is the step function multiplied by 11, then the derivative  is \$E'(t) = 11\delta(t)\$.
Following through with the substitution of the above equation in place of Equation 7, you discover an extra term appears on the right-hand side of the differential equal to \$660\delta(t)\$, which is exactly the term that @aconcernedcitizen pointed out is required to make the solutions match.
[edit]
An interesting question that comes up from @aconcernedcitizen calculations is how to get the correct answer from the time-domain approach taken in the lecture, using the assumption that the applied voltage \$E\$ is in fact a constant for all \$t\$, (including at \$t\leq 0\$), rather than a step function. We should be able to approach it this way if we put a switch into the right place. If this assumption is made, the differential equation given in the lecture is actually correct. Even the \$h(t)\$ given in @aconcernedcitizen 's answer (Equation 3 from that post) satisfies the differential equation for all \$t\geq  0\$.
If you set up the problem an assume \$E\$ is in fact a constant, and we want to solve the same physical problem that the OP solved with the Laplace Transform, then we need to insert a switch in series with the voltage source to apply it at \$t=0\$ to the rest of the circuit. When this switch is closed at \$t=0\$, we can solve the differential equation given in the lecture and get the correct answer, but we need to get the initial conditions right.
The key is that the initial conditions for this approach are not the same as the zero-inititial conditions used in the approach in which the voltage source is applied as a step function. For this approach to work, the initial conditions are
\$(1) u_c(t=0) = 0  \$
\$(2) \frac{du_c}{dt}|_{t=0} = \frac{i_c(t=0)}{C} = \frac{E}{R_1C}\$
The first condition says that there is no initial voltage on the capacitor. The second condition is simply saying that the initial current into the capacitor when the switch is closed is \$E/R_1\$, which is true because of the first condition and because the initial condition on the inductor current is \$i_L=0\$. Note the \$E\$ here is just a constant, not a function.
If you solve the second-order inhomogeneous differential equation given in the lecture with these initial conditions, you get the correct answer given in Equation 3 of @aconcernedcitizen 's answer. This is not how such problems are typically solved in electrical engineering, but is a valid approach.

A: The textbook seems to be wrong. If you solve their equation with initial conditions zero for all, you get a different answer than the correct one, which is different than yours.
First, to check the textbook, I used both LTspice and wxMaxima with these:
atvalue('diff(vc(t), t, 2), t=0, 0)$
atvalue('diff(vc(t), t), t=0, 0)$
atvalue(vc(t), t=0, 0)$
desolve(16*'diff(vc(t), t, 2) + 72*'diff(vc(t), t) + 65*vc(t) = 495, vc(t));
plot2d(rhs(%), [t, 0, 10])$

If the code looks a bit hard to digest, I'm solving their final differential equation. The result and plots are these:
$$v_c(t)=-\dfrac{99}{8}\exp\left(-\dfrac{5}{4}t\right)+\dfrac{495}{104}\exp\left(-\dfrac{13}{4}t\right)+\dfrac{99}{13} \tag{1}$$

The two results differ quite a lot but, between their handwritten solution and LTspice, I trust the latter. So then I solved it based on your Laplace initial equation, leading to the following transfer function:
$$H(s)=\dfrac{660s+495}{16s^3+72s^2+65s} \tag{2}$$
If you now apply the inverse Laplace you get the time response. First apply partial fraction decomposition because the roots are simple and nice and round:
$$\begin{align}
H(s)&=\dfrac{33}{4s+5}-\dfrac{825}{13(4s+13)}+\dfrac{99}{13s} \\
h(t)&=\dfrac{33}{4}\exp\left(-\dfrac{5}{4}t\right)-\dfrac{825}{52}\exp\left(-\dfrac{13}{4}t\right)+\dfrac{99}{13} \tag{3}
\end{align}$$
Sure enough, plotting (3) shows this, which is exactly what B1 shows in the picture above (same formula, just slightly shifted otherwise it would completely overlap):

And then, if you perform this tiny modification to their differential equation -- adding \$660\delta(t)\$ to the right hand side -- then the solution comes out pristine:
desolve(16*'diff(vc(t), t, 2) + 72*'diff(vc(t), t) + 65*vc(t) = 660*delta(t) + 495, vc(t));

                                   5 t           13 t
                                 - ---         - ----
                                    4             4
                            33 %e        825 %e         99
(%o7)               vc(t) = ---------- - ------------ + --
                                4             52        13

Guess why?

[edit]
It was late and I stopped after hinting about the mistake. Very soon after (while I was correcting), @rpm2718's answer came. At any rate, I'll continue my thoughts as they were.
Your first two steps in solving the problem are correct (except the way you wrote the input source), until you try to line them all up in an equation similar to a differential -- that's where the mistakes are.
First, you wrote \$E/s\$ as the input -- this is not correct. \$E\$ is the source and \$E=11/s\$, so \$E/s=11/s^2\$; you are integrating an already integrated impulse response (you get a ramp). Then, when you tried to get rid of fractions, you mingled this information: the \$s\$ that belongs to \$E\$ is part of the input but, when you used that \$s\$ to factor out terms, you mixed it with the other \$s\$ terms that belong to the output.
What you should have done was, when you've dealt with Laplace, obtain the transfer function, don't expand it as if it's an equation in time domain. By obtaining the transfer function you clearly separate the input (numerator) to the output (denominator). Therefore, your first two steps should have looked like this:
$$\begin{align}
&\dfrac{V_C-E}{R_1}+V_CsC+\dfrac{V_C}{R_2+sL}=0 \\
\Rightarrow\quad &{V_C}=\dfrac{E(60s+45)}{16s^2+72s+65} \tag{4}
\end{align}$$
Now you can expand (4) to look like this:
$$\begin{align}
16s^2+72s+65&=E(60s+45) \\
16s^2+72s+65&=60s\cdot \dfrac{11}{s}+45\cdot \dfrac{11}{s} \tag{5}
\end{align}$$
You could simplify the \$s\$ on the right side, if you wanted but, if your aim is to convert (5) into its time domain equivalent then you have to consider that \$11/s\$ as standalone, and that's because the source translates to the Heaviside function:
$$\dfrac{11}{s}\rightarrow 11\theta(t) \tag{6}$$
This is important: it tells you that, since the whole analysis is done from \$t=0...\infty\$, the Heaviside reduces to unity, leaving the right side as \$60\cdot 11\delta(t)+45\cdot 11\$, multiplied by the amplitude of (6), \$11\$. And that's how you reach the equation at the end of my initial edit.
As for the textbook, they got the differentiation of \$i_L(t)\$ wrong in their step #7 (and, implicitly, a sign). This is how it should have been:
$$\begin{align}
E&=\theta(t) \\
E'&=\delta(t) \\
i_L&=\dfrac{11\theta-u_C}{R_1}-Cu_C' \\
i_L'&=\dfrac{11\delta-u_C'}{R1}-Cu_C'' \tag{7}
\end{align}$$
Now the substitution of #6 and #7 in #3 results in:
$$\begin{align}
&R_2\left(\dfrac{11\theta-u_C}{R_1}-Cu_C'\right)+L\left(\dfrac{11\delta-u_C'}{R_1}-Cu_C''\right)-u_C=0 \\
\Rightarrow \\
&\dfrac{660\delta+495\theta-16u_C''-72u_C'-65u_C}{20}=0 \\
\Rightarrow \\
&660\delta+495\theta=16u_C''+72u_C'+65u_C \tag{7}
\end{align}$$
And this, again, is the equation in my last edit, where \$495\theta\$ reduces to \$495\$ because we're dealing with \$t>=0\$.

A: Well, using Laplace we can see that:
$$\text{V}_\text{C}\left(t\right)=\mathscr{L}_\text{s}^{-1}\left[\underbrace{\frac{1}{\text{sC}}}_\text{impedance capacitor}\cdot\underbrace{\frac{\frac{\hat{\text{u}}_{\space\text{i}}}{\text{s}}}{\text{R}_1+\left(\frac{1}{\text{sC}}\space\text{||}\space\left(\text{R}_2+\text{sL}\right)\right)}}_\text{input current}\cdot\underbrace{\frac{\text{R}_2+\text{sL}}{\text{R}_2+\text{sL}+\frac{1}{\text{sC}}}}_\text{current divider}\right]_{\left(t\right)}\tag1$$
Where \$\alpha\space\text{||}\space\beta:=\frac{\alpha\beta}{\alpha+\beta}\$.


text:
Q: How to identify the returned object's type of a method? I have a helper class which gets notified by the below method
public void setObject(Object obj) {
    this.obj =  obj
}

There is getter method for the obj. Is there any way to identify the caller about the type of the obj. The object can take any object like :
List<Switch>
Switch
List<Link>

The caller has to process the obj after calling the getter method. Is there a way to do it?

A: You can always know the class (and then the class name) from obj.getClass(). What you want to do with it further ?
If you want to invoke methods on the obj - You need reflection..
Something like this -
Class myClass = obj.getClass();
Method m = myClass.getDeclaredMethod("get",new Class[] {});
Object result = m.invoke(myObject,null);

A: You could know the object type using instanceof operator.Consider the following example:
import java.util.ArrayList;
import java.util.List;

public class Test {

    public static void main(String[] args) {
        if (getObject() instanceof A) {
            System.out.println("A class");
        }
        if (getObject() instanceof B) {
            System.out.println("B class");
        }
        if (getObject() instanceof List) {
            System.out.println("List class");
        }
    }

    /**
     *
     * @return Object type.
     */
    public static Object getObject() {
        //Change this value to new A() or new B();
        return new ArrayList<A>();
    }
}
class A {

    private String aName;

    public A(String aName) {
        this.aName = aName;
    }

    public String getaName() {
        return aName;
    }

    public void setaName(String aName) {
        this.aName = aName;
    }
}

class B {

    private String bName;

    public B(String bName) {
        this.bName = bName;
    }

    public String getbName() {
        return bName;
    }

    public void setbName(String bName) {
        this.bName = bName;
    }
}

As you can see I have a method returning object type and if you are gonna change the returning value of that method you can easily understand what is going on.And one more thing you can't guess the generic types at runtime because "Generic types are erased before runtime".Hope you got my point.Cheers

A: This might help you. It informs you how to get the parameterized type.
Get generic type of java.util.List


text:
Q: saving in File using class-python I'm new to python language.
I want to save a line to a file and load a specific line of a file.
The problem is that I should read(load) a line of that file as object of another(Grade) class or save a line into file as object of another class(Grade)
I did it and I want to see if I did it in right!
class Grade():

    def __init__(self,student_id=0,course_id=0,score=0):
        self._student_id = student_id
        self._course_id = course_id
        self._score = score

    @property
    def get(self):
        return str(self._student_id)+" "+str(self._course_id)+" "+str(float(self._score))
    @property

    def student_id(self):
        return str(self._student_id)
    @property
    def course_id(self):
        return str(self._course_id)
    @property
    def score(self):
        return str(self._score)

    @student_id.setter
    def student_id(self,student_id: int):
        self._sutdent_id = student_id
    @course_id.setter
    def course_id(self,course_id: int):
        self._course_id = course_id
    @score.setter
    def score(self,score: float):
        self._score = score

class CourseUtil():

    def __init__(self):
        self._address = ''

    def set_file(self,address):
        self._address = address

    def load(self,line_number):
        fp = open(self._address)
        for i, line in enumerate(fp):
            if i+1 == line_number:
                stri= line.split(" ")
                stdid = int(stri[0])
                corid = int(stri[1])
                score = float(stri[2])
                #here I want to save the #object that passed as argument to a file is it right?
               grade = Grade(stdid,corid,score)
                fp.close()
                return(grade)
        return print("None")

    def save(self,grade):
        i = 0
        k = 0
        fp = open(self._address)
        for  j,line in enumerate(fp):
            k += 1
            if grade.student_id in line and grade.course_id in line:
                i += 1
                break
        fp.close()
        if k > 0:
            if i == 0:
                with open(self._address,"a") as f:
                    f.write("\n"+grade.get)
        elif k == 0 and i == 0:
            with open(self._address,"a") as f:
                f.write(grade.get)

In save function I checked if data is unique and I avoid using last \n in end of file

A: The model you're using of saving lines of class entries is inefficient. Instead, you can store your data in a better way. I am assuming each student id is unique and hashable (either a string or integer). So, you could simply have a dictionary that has all the information about each student:
student_information = {
    {student_id}: {
        course_id: {course_id},
        score: {score}
    },
    ... # more students
}

Now, if you want to fetch a student's information, you could simply do student_information[student_id] to get the data you needed. For instance, you could do:
grade = Grade(
    student_id,
    student_information[student_id]["course_id"],
    student_information[student_id]["score"]
)

You can easily set this dictionary as an instance variable of your CourseUtil class.
Now, @juanpa.arrivillaga mentioned that you should use pickle to store that information (if you would like to go back to it later). Pickle allows you to store data like a dictionary into a files and load it. There is also json that can help you do the same thing.


text:
Q: Is there a word for when something's name completely fits the description or personality? for example in a story i'm writing, there is a character named Revenge who's main goal is to get revenge. Is there a single word for that?

A: A modern term is aptonym. It is a play on "apt" (appropriate) and the "-onym" root for name. It is usually for jobs or qualities, not just personalities. Like a person named John Cooke who is a chef, or Usain Bolt is the fastest sprinter.

A:
Charactonym: A name given to a literary character that is descriptive of a quality or trait of the character.

— Dictionary.com


text:
Q: Way to designate certain set of airflow tasks to run before others (order invariant)? Have an airflow (v1.10.5) dag that looks like...

Is there a way to specify that all of the blue tasks should complete before scheduler moves on to any downstream tasks (as currently scheduler sometimes goes down an entire branch of tasks before doing the next blue task)?
Want to avoid just putting them in sequence (and using with trigger rule TriggerRule.ALL_DONE) because they do not actually have any logical order in which they need to be done (other than that they all need to be done before any other downstream tasks in any branch).
Anyone know of any way to do this (like some kind of "priority" pool for tasks)? Other workaround suggestions?

A: Asked this question on the airflow mailing list and this is the results...
white
blue = [blue_a, blue_b, blue_c]
green = [green_a, green_b, green_c]
yellow = [yellow_a, yellow_b]

cross_downstream(from_tasks=[white], to_tasks=[blue])
cross_downstream(from_tasks=blue, to_tasks=green)
cross_downstream(from_tasks=green to_tasks=yellow)

This should create the required network of dependencies between tasks.

Here is visualization available:
https://imgur.com/a/2jqyqQO

This is the easiest solution and in my opinion the correct one.
However, if you don't want a dependencies then you can create a new
schedule rule by editing the BaseOperator.deps property.

The docs for this helper dag building function can be found here: https://airflow.apache.org/docs/stable/concepts.html#relationship-helper
Which was a useful solution, but...

One thing about my case is that the next tasks (greens) in each branch should only run if the blue task in that same branch completes successfully (should not care about the success/failure status of the other blue tasks, only that they have been run). Thus I don't think the ALL_DONE trigger rule will help the greens and ALL_SUCCESS would be too strict.
Any ideas for such a thing?

After some more thought, here is my workaround...


text:
Q: Error de data binding practicando en angular? Estoy empezando a practicar en agular e intentando hacer data binding con interpolacion coloque un video en la carpeta assets y cree un variable que guarde el link del vid, al intentar bindearlo en el component.html cuando quiero compilar la app me tira el siguente error:
"Error: src/app/app.component.html:7:15 - error TS2339: Property 'imagen1' does not exist on type 'AppComponent'.
7
~~~~~~~
src/app/app.component.ts:6:16
6   templateUrl: './app.component.html',
~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component AppComponent.
× Failed to compile.
✔ Browser application bundle generation complete."
Asi hice el data binding, o intente hacerlo mejor dicho (?
"vid1 = "C:/Users/nicog/Documents/workspace/angular proyects/musicalapp/src/assets/Comenzando.webm" "   <--- eso en la carpeta app.component.ts
"

"

                           <--- eso en la carpeta app.component.hmtl

EDITADO
Fichero app.component.ts
import { HashLocationStrategy } from '@angular/common';
import { Component } from '@angular/core';

 @Component({
   selector: 'app-root',
      templateUrl: './app.component.html',
      styleUrls: ['./app.component.css']
  })
  export class AppComponent {
    title: string = 'musicalapp';
    myName: string = "Nicolas";
    age: number = 45   myHair(longliness: string, color: string){
      return longliness + " " + color
    };
    vid1: string = "C:/Users/nicog/Documents/workspace/angular proyects/musicalapp/src/assets/Comenzando.webm"
}


text:
Q: Reliable way to kill AV processes on windows? What is a reliable way to kill AV Processes that are protected against termination? (Like most antivirus)
I have SYSTEM level access on a machine but running a taskkill /F on the process still returns "Access Denied"
I've tried wmic process where name='' delete.. Still Access Denied.
Is there any way I can kill a process like this?


text:
Q: kotlin safe/unsafe cast (redundant question mark?) I read the Kotlin lang docs and it addresses both of these cases:
Unsafe cast:
val x: String = y as String

Safe cast:
val x: String? = y as? String

but Kotlin seems to allow this as well (note the right most ?:
val x: String? = y as? String?

Is the furthest most ? redundant in this case?

A: Simply put yes. The reason being that as? is a nullable cast operator, meaning that if in your example y is null then the cast is not even tried (effectively, as you wrote, performing a safe cast). Only when y is not null, the cast is performed and therefore having String or String? has exactly the same effect, actually making ? redundant in this case.

A: Agreed with João Dias answer, the ? in String? is redundant, you can check also the code behind by decompile the kotlin bytecode. Both as? String and as? String? produce the same compiled code as follows
String var10001 = this.y;
if (!(var10001 instanceof String)) {
   var10001 = null;
}

this.x = var10001;


text:
Q: Poisson Distribution : How to calculate An ecologist wants to examine the deer population in two different areas, Area $1$ and Area $2$. He assumes that the number of deer, $X$ and $Y$, in Areas $1$ and $2$ is Poisson distributed.
Question:
In an area of 10 square kilometers, the ecologist calculates that the expected number of deer is $\lambda_1 = 3$ in Area $1$ and $\lambda_2 = 2$ in Area $2$, respectively. Find $P\left(X=2\right)$ and $P\left(X\:\ge \:3\right)\:$  , and find an approximate expression for $p\left(X=Y\right)$. Specify the assumption you must use to calculate the last answer.
I know that I can use this formula:  $P\left(x;\:λ\right)\:=\:\frac{\left(\left(e^{-λ}\right)\:\left(λ^x\right)\right)}{x!}$
then I can just insert $X=2$ and get the answer, but how do I do it for $P(X≥3)$? and how do I find an approximate expression for $p\left(X=Y\right)$

A: To calculate $\mathbb{P}[X\geq 3]$ easy observe that
$$\mathbb{P}[X\geq 3]=1-\mathbb{P}[X=0]-\mathbb{P}[X=1]-\mathbb{P}[X=2]$$
To calculate $\mathbb{P}[X=Y]$ first of all  observe that
$$\mathbb{P}[X=Y]=\mathbb{P}[X=0,Y=0]+\mathbb{P}[X=1,Y=1]+\mathbb{P}[X=2,Y=2]+ \dots+$$
Now it is evident that, if you want to go on with the calculation, you have to assume independence between $X$ and $Y$ so that
$$\mathbb{P}[X=k,Y=k]=\mathbb{P}[X=k]\cdot\mathbb{P}[Y=k]$$


text:
Q: How to get Unix timestamp in MySQL from UTC time? If I do unix_timestamp(some_date), it internally converts some_date to UTC, whereas some_date is already in UTC.  Is there any way to get the current Unix timestamp?
Edit: I need Unix timestamp from UTC time.

A: This works fine for me:
UNIX_TIMESTAMP(CONVERT_TZ("some_date", '+00:00', 'SYSTEM'))

A: Here's a couple other ways of doing it:
SELECT UNIX_TIMESTAMP(myDate)+UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(UTC_TIMESTAMP())
FROM myTable

SELECT UNIX_TIMESTAMP(myDate)-TIMESTAMPDIFF(SECOND, NOW(), UTC_TIMESTAMP())
FROM myTable

A: You should be able to convert it from UTC to the local timezone first using CONVERT_TZ:
UNIX_TIMESTAMP(CONVERT_TZ(some_date, '+00:00', @@global.time_zone))

See also: 10.6. MySQL Server Time Zone Support

A: You can get a UNIX timestamp in MySQL from a UTC datetime value like so:
SELECT
UNIX_TIMESTAMP(CONVERT_TZ("some_date", '+00:00', @@session.time_zone))
FROM `table_name`

I made a cheatsheet here: Should MySQL have its timezone set to UTC?

A: Because of two reasons:

*

*MySQL's built-in functions UNIX_TIMESTAMP and FROM_UNIXTIME take the time zone stored in @@global.time_zone which I generally won't want/be able to change, and

*The built-ins behavior around the time of DST changes (if global time zone uses DST) results in information loss in some use cases,

my preferred solution was to write my own functions which convert to Unix timestamp and back:
DELIMITER $$
CREATE FUNCTION UnixTimestamp(utcstamp DATETIME) RETURNS BIGINT UNSIGNED DETERMINISTIC
BEGIN
 DECLARE y INT UNSIGNED;
 SET y = YEAR(utcstamp);
 RETURN (y - 1970)          * 365 * 24 * 60 * 60 -- total seconds in full years since 1970
      + FLOOR((y - 1969) / 4)     * 24 * 60 * 60 -- add to that total seconds in extra days for each leap year
      - FLOOR((y - 1901) / 100)   * 24 * 60 * 60 -- subtract seconds for each day in a year that is divisible by 100 because those are not leap years
      + FLOOR((y - 1601) / 400)   * 24 * 60 * 60 -- but add back each day in a leap year that is divisible by 400 because those are leap years
      + (DAYOFYEAR(utcstamp) - 1) * 24 * 60 * 60 -- total seconds in full days since beginning of year
      + HOUR(utcstamp)                 * 60 * 60 -- total seconds for each full hour passed since beginning of day
      + MINUTE(utcstamp)                    * 60 -- total seconds for each full minute since last full hour
      + SECOND(utcstamp);                        -- seconds since last full minute
END$$
DELIMITER ;

DELIMITER $$
CREATE FUNCTION FromUnixtime(utcstamp BIGINT UNSIGNED) RETURNS DATETIME DETERMINISTIC
BEGIN
 DECLARE s INT UNSIGNED;
 DECLARE d INT UNSIGNED;
 DECLARE y INT UNSIGNED;
 IF utcstamp = 0 THEN RETURN '1970-01-01 00:00:00';
 END IF;
 SET s = utcstamp % (24 * 60 * 60);
 SET d = FLOOR(utcstamp / (24 * 60 * 60)) + 365 * 370 + 90;         -- days since 1600-01-01, last full leap year period
 SET y = 1600 + FLOOR(d / (400 * 365 + 97)) * 400;                  -- year is now 1600 + 400 * n, where n >= 0
 SET d = d - (400 * 365 + 97) * FLOOR(d / (400 * 365 + 97));        -- days since 1600 + 400 * n, less than 400 years
 IF d > 0 THEN
  SET y = y + FLOOR((d - 1) / (100 * 365 + 24)) * 100;              -- year is now 1600 + 400 * n + 100 * m, where 4 > m >= 0
  SET d = d - (100 * 365 + 24) * FLOOR((d - 1) / (100 * 365 + 24)); -- days since 1600 + 400 * n + 100 * m, less than 100 years
  SET y = y + FLOOR(d / (4 * 365 + 1)) * 4;                         -- year is now 1600 + 400 * n + 100 * m + 4 * l, where 25 > l >= 0
  SET d = d - (4 * 365 + 1) * FLOOR(d / (4 * 365 + 1));             -- days since 1600 + 400 * n + 100 * m + 4 * l, less than 4 years
  IF d > 0 THEN
   SET y = y + FLOOR(d / 365);                                      -- year is now 1600 + 400 * n + 100 * m + 4 * l + k, where 4 > k >= 0
   SET d = d - 365 * FLOOR(d / 365);                                -- days since 1600 + 400 * n + 100 * m + 4 * l + k, less than a year
   IF (y % 400 = 0 OR (y % 4 = 0 AND y % 100 <> 0)) THEN            -- if it's a leap year
    IF d > 0 THEN                                                   -- and if it's not day 0
     SET d = d + 1;                                                 -- add a day we dropped in a previous step
    ELSEIF d = 0 THEN                                               -- otherwise if it's day 0
     SET d = 365;                                                   -- then it's actually New Year's Eve
     SET y = y - 1;                                                 -- on the year before
    END IF;
   END IF;
  ELSE SET d = d + 1;
  END IF;
 ELSE SET d = d + 1;
 END IF;
 RETURN CONCAT(MAKEDATE(y, d), ' ', LPAD(FLOOR(s / 3600), 2, 0), ':', LPAD(FLOOR((s - FLOOR(s / 3600) * 3600) / 60), 2, 0), ':', LPAD(s % 60, 2, 0));
END$$
DELIMITER ;

You can check these functions by executing:
SELECT UTC_TIMESTAMP() AS CurrentTime, FromUnixtime(UnixTimestamp(UTC_TIMESTAMP())) AS Result;

CurrentTime and Result should be the same.


text:
Q: Using maven instead of ant with SPRING, deploying and structure I have a spring project and using ANT to compile/deploy my war to Tomcat. So basically it just creates a war file and moves it to tomcat folder.
folder structure is this:
Spring
    -src
        ALL MY SRC (JAVA) files
    -war
        -WEB-INF
            -jsp
            -lib
                ALL MY LIBRARIES
            -properties
            web.xml
            spring-servlet.xml
        -META-INF
build.xml
pom.xml // putting my pom.xml here

With ant I download all my libraries manually. Now as it seems, maven downloads all libraries automatically, thanks to pom.xml. Questions/problems:

*

*Must I change my folder structure with maven?

*Will maven include all downloaded libs to WAR? Is that default?

*When maven downloads its WARS, can it put all libraries to WEB-INF/lib? How?

*Does it make sense what I am doing, if no, then why?

Have few questions, because I have never ever used maven.

A: *

*Yes better change the structure, see the maven site. It saves a bit of hassle, should you start using maven-plugins with complex things like using XSLT to generate java sources. Also IDE support might be better. Like:
src/main/java, src/test/java, src/main/resources.

*Yes.

*Yes. Automagically.

*Yes otherwise you should use Ivy with ant.

A: Standard Maven Web Project Structure
As millimoose commented its better to go for standard project structure.


text:
Q: Create a dictionary from pandas dataframe modifying the structure I am pretty new with python and all of this stuff, at the moment I have a csv file uploaded inmemory with Django rest framework, so far so good at this point, now I need to insert this data into the DB so I need to get the columns accordingly my models, so I need to convert this csv to a mapping object, I am loading the file using Pandas, so my function is something like:
def insert(self, request):

    file=codecs.EncodedFile(request.FILES.get("file").open(),"utf-8")
    reader = pd.read_csv(file, delimiter=";")
    reader.columns = ['regions_trips','origin_coord','destination_coord','datetime','dataSource_trips'];
    size=int(reader.shape[0])+1
    index = pd.RangeIndex(start=1, stop=size, step=1, name="no_record")
    reader_index= reader.set_index(index)
    print("Dataframe reader_index=",reader_index)

    reader_json=reader.to_json(orient = 'records')
    print(reader_json)
    #serializer = DataSourceSerializer(data=)

So when I call the API, send the file and try to see how is the output of the file converted to json is something like:
[
{
    "regions_trips": "Prague",
    "origin_coord": "POINT (14.4973794438195 50.00136875782316)",
    "destination_coord": "POINT (14.43109483523328 50.04052930943246)",
    "datetime": "28\/05\/2018 9:03",
    "datasource": "funny_car"
},
{
    "regions_trips": "Turin",
    "origin_coord": "POINT (7.672837913286881 44.9957109242058)",
    "destination_coord": "POINT (7.720368637535126 45.06782385393849)",
    "datetime": "21\/05\/2018 2:54",
    "datasource": "baba_car"
}]

but how I am expecting the output is:
[
{
    "regions_trips": "Prague",
    "dataSource_trips": {
        "origin_coord": "POINT (14.4973794438195 50.00136875782316)",
        "destination_coord": "POINT (14.43109483523328 50.04052930943246)",
        "datetime": "28\/05\/2018 9:03"
    },
    "datasource": "funny_car"
},
{
    "regions_trips": "Turin",
    "dataSource_trips": {
        "origin_coord": "POINT (7.672837913286881 44.9957109242058)",
        "destination_coord": "POINT (7.720368637535126 45.06782385393849)",
        "datetime": "21\/05\/2018 2:54"
    },
    "datasource": "baba_car"
}

I am not sure how I can put those "columns" (not sure how call them) into a new element called dataSource_trips.
My dataframe looks like:
Dataframe=    regions_trips                                 origin_coord                           destination_coord          datetime     dataSource_trips
0         Prague   POINT (14.4973794438195 50.00136875782316)  POINT (14.43109483523328 50.04052930943246)   28/05/2018 9:03            funny_car
1          Turin   POINT (7.672837913286881 44.9957109242058)  POINT (7.720368637535126 45.06782385393849)   21/05/2018 2:54             baba_car

Hope you have enough information to help me :)
Thanks a lot

A: You can do this by merging the three columns into a single column.
print("Dataframe reader_index=",reader_index)
datasource_cols = ["origin_coord", "destination_coord", "datetime"]
reader['dataSource_trips'] = reader[datasource_cols].to_dict(orient='records')
reader = reader.drop(datasource_cols, axis=1)

reader_json=reader.to_json(orient="records")


text:
Q: Error in trivial Mule flow using poll component: "The content of element 'poll' is not complete" Trivial new project, 1 flow, 1 poll element, feeding to 1 other element.
ERROR 2014-04-16 14:49:19,565 [main] org.mule.module.launcher.application.DefaultMuleApplication: null
org.xml.sax.SAXParseException: cvc-complex-type.2.4.b: The content of element 'poll' is not complete. One of '{"http://www.mulesoft.org/schema/mule/core":annotations, "http://www.mulesoft.org/schema/mule/core":abstract-message-processor, "http://www.mulesoft.org/schema/mule/core":abstract-outbound-endpoint, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-message-processor}' is expected.
    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
...

At the minutia level I understand what SAX is, and that probably one of the references is bad or something.
But at a higher level, I'm new to MuleStudio, what's the fix?
Stuff I thought of:

*

*I'm using the latest December release

*It's a new project, nothing weird.

*It went through all it's maven downloads without complaint (although slow as usual)

*And I tried restarting / rerunning it

*Tried both Debug As... and Run As... Mule Application

Although I could include the XML, it's trivial, literally just 2 elements: poll -> salesforce query
Google search not helpful.
Feels like a number of things in Mule don't quite work as advertised... wondering if others experience that, but then again I'm new to it of course.
Edit: Adding the XML, but it was created from the GUI.  Login credentials redacted.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:sfdc="http://www.mulesoft.org/schema/mule/sfdc" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" version="EE-3.4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/sfdc http://www.mulesoft.org/schema/mule/sfdc/current/mule-sfdc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
    <sfdc:config name="Salesforce" username="..." password="..." securityToken="..." doc:name="Salesforce">
        <sfdc:connection-pooling-profile initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW"/>
    </sfdc:config>
    <flow name="salesforce3Flow1" doc:name="salesforce3Flow1">
        <poll frequency="3600000" doc:name="Hourly"/>
        <sfdc:query config-ref="Salesforce" query="SELECT ID,CaseNumber, Description from Case LIMIT 100" doc:name="Salesforce"/>
    </flow>
</mule>

A: It would help if you shared your flow xml, but the error message sounds like you have a poll that polls nothing. You need something inside <poll></poll>. Either put your Salesforce query there or a dummy logger component.

A: org.xml.sax.SAXParseException refers problem inside your XML file.
Can be either dirty characters or some missing attributes most likely in the poller configuration.
Also double check the schema declarations at the top of your xml.
If you have copied pasted some code directly into the xml the xmlns tag could be missing.
What I suggest is to recreate the project from scratch and use only the drag and drop feature of mule to perform an initial test, once is working you can move forward.


text:
Q: Jquery animate function not moving image I'm trying to move an image and that's about it. I cant seem to figure out why its giving my problems. The idea is to have the image go in a square pattern all while rotating a set of images. Ill figure out that part but right now I cant get the image to animate at all.
HTML:

Assignment 1

    PAGE 1 |
    PAGE 2

    Name | Student #

JS:
$(window).onload(function(event)
{
    while(true)
    {
         $('#img_num').animate(
          {"left": "+=50px"},
          "slow");
    }
});

CSS:
#img_num {
    width: 250px;
    height: 250px;
    position: relative;
}

A: .onload is not a jQuery method, use .load(); also, while loop does not appear to be necessary

$(window).load(function(event) {
  //  while(true)
  //  {
  $('#img_num').animate({
      "left": "+=50px"
    },
    "slow");
  //  }
});
#img_num {
  width: 250px;
  height: 250px;
  position: relative;
}

Assignment 1

  PAGE 1 |
  PAGE 2

  Name | Student #

A: Are you using Jquery?
Try this Jquery... it will move it out of the screen
$(document).ready(function() {
  $('#img_num').animate({
    "left": $(window).width()
  },1000);

})


text:
Q: Managers can only see items assigned to their teams I'm new at Sharepoint development and the task I was given was to create an employee survey form where employees rate themselves and the work they do. Each person belong to a team that is assigned to a certain Manager. The manager will then view the survey form they have finished so they can document it.
My question is: How can I set this up where a manager can only see the items on the list that is assigned to his team? Other managers should not be able to view items from the other teams he's not assigned to. I've been looking for a solution everywhere and would really want to finish this as soon as possible. Thank you!
Follow Up: Should I use Workflow for this or is it just mainly focused on Group / User Permissions?

A: You will need to have some kind of list of users and managers then when the item is created with workflow modify permission giving it to author and the manager only.

A: For above you need to add a question in your survey for populating managers(add question field with people and group, naming it as manager with fill the field with manager name by user or workflow).
And once you get manger

*

*Goto All response view.

*Edit the page.

*Edit the webpart property of
the list view.

*click on the property change the current view.

*And in
the filter view uncheck the "Show all items in this view" option
Select the "Show items only when the following is true:".

*In Show the
items when column select field Managers and equals to [Me].

click ok and save the page.
And if you are not ok with customizing the view let me know you can create a seperate view with designer and apply steps on it.
As mention for security you can

*

*create a worflow on survey list with impersonate step

*Add Replace list item Permission action

*Click on Choose button. And select Workflow lookup for user

*Datasource : current item

*Field from source : ManageName(added as question in survey)

*return as : string

And set workflow trigger on item added.


text:
Q: WCF REST Service - 401 Unauthorized We're in the process of developing a WCF REST web service which just receives a bunch of arbitrary text from any anonymous user and then performs some processing on the back end.
For example, here's one method from our web service:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class MyRESTService : IMyRESTService
{
    [WebInvoke(Method = "PUT", UriTemplate = "/MyRESTMethod?paramA={paramA}&paramB={paramB}")]
    public Stream MyRESTMethod(string paramA, string paramB, Stream rawData)
    {
        //do some stuff...
    }
}

If we just use the default IIS settings we get a (401) Unauthorized. However, after much trial and error we figured out that we could get it to work by giving WRITE access to 'Everyone' on the actual .svc file for our service.
My question is: why in the world would IIS need to have WRITE access to an .svc file for this to work? Is there a better way or am I stuck with this hackish (and possibly insecure) workaround?
WTF Microsoft?
Possibly related:

*

*PUT and DELETE in RESTful WCF Service cause 401 Unauthorized error

*IIS7 Post/Put/Patch/Delete WCF oData - Authentication Failure 401.3

A: After talking to a tech representative from M$ I was informed that this is indeed the expected behavior. The service must have write access enabled for someone to send a request to it, and when you do this it will actually set write access automatically on the .SVC file as well.

A: I have also found this can be fixed by putting
<authentication mode="None" /> inside of <system.web> in your web.config


text:
Q: Concatenate variable into jQuery mobile pageinit page name i was wondering if its possible to concatenate a variable into the page init call?
$("#Walk_"+walkId).on('pageinit', function(event){
    alert('haa');
});

I have tried the above code, however i haven't much luck. The variable comes from a foor loop located on another page, it is however set as a global variable, but it remains within the for loop and as such, its value is being overwritten however many times the loop iterates.
I was wondering if its even possible to do what i have shown above?
Thanks
EDIT:
The page creation from which i am trying to use the script above
    var makePage = $('
'+walkId+'

'+walkTitle+'

');

    makePage.appendTo($.mobile.pageContainer);


text:
Q: Use aggregation to match for documents element I don't know how to formulate this question, so I would better show by example.
Suppose I have documents stored in the following format:
{'category': [1, 2, 3, ...],
'delete': [2, ...]}

How to receive document only with "categories" that does not need to be "deleted"? The result of aggregation must be:
{'category': [1, 3]}

I try to do it in the following way, first I unwind all categories
{'$unwind': '$category'},

Then I want to use $match, to match only for categories that are not in "delete", but I get an error:  $nin needs an array
{'$match': {'category': {'$nin': '$delete'}}}

I do not understand why "$delete" is not an array?

A: In the upcoming 2.6 release of MongoDB, the new $setDifference aggregation framework operator makes this straightforward, see example below using the current release candidate:
$ ./mongo --port 31100
MongoDB shell version: 2.6.0-rc0
connecting to: 127.0.0.1:31100/test
test-rs0:PRIMARY> db.foo.insert({category: [1, 2, 3], delete : [2] })
WriteResult({ "nInserted" : 1 })
test-rs0:PRIMARY> db.foo.aggregate(
...     { $project : { diff : { $setDifference : [ "$category", "$delete" ] } } } )
{ "_id" : ObjectId("530ddc2845cec73af61c81c1"), "diff" : [ 1, 3 ] }
test-rs0:PRIMARY>

MongoDB 2.6-rc0 was released last week so the production version should be available soon.

A: So given the condition:
{"$match": {"category": {"$nin": "$delete" } }}

You receive an error that the type of argument for $nin is not an array.
Also consider the following
{$match: {"category": { "$nin": ["$delete"] } }}

And this does not match, as neither does:
{"$unwind": "$delete" },
{"$match": {"category": {"$ne": "$delete"}}}

But of course either form of this will:
{"$match": {"category": { "$nin": [2] } }}

or:
{"$unwind": "$delete" },
{"$match": {"category": {"$ne": 2 }}}

So as you can see the "$delete" reference is not expanding in the way you are expecting. it does not do so in these cases and only does so in the $project and $group operator stages.
You need to use the literal as shown in the last two cases.


text:
Q: .NET 4.5 installed but error message when app runs I have .NET 4.5 installed on my dev machine:

However I get this message when my app runs:

I have this in my app.config:
<supportedRuntime version="v4.5" sku=".NETFramework, version=v4.5"/>

Is there something else I need to do?

A: I replaced the <supportedRuntime> node with this:
<startup>
  <supportedRuntime version="v4.0.30319"/>
</startup>

as per this on MSDN. It works as both .NET 4 and 4.5 target the same version of the CLR, v4.0.30319.


text:
Q: Distribution of sample covariance matrix after straightening to a vector Now I have i.i.d $X \sim N_p(\mu, \Sigma)$ ,where $\Sigma>0$, with distinct eigenvalues and have eigen decompositions $\Sigma=U\Lambda U^T$ and $S_n=\hat U \hat\Lambda \hat U^T$.
Let $(n-1)T=U^T (n-1)S_n U\sim W_p(n-1, \Sigma)$ (Wishart distribution) where $U^T\Sigma U=\Lambda$ and $\hat U^TS_n \hat U=\hat\Lambda$.
here $A=\sqrt{n-1}(T-\Lambda)=(a_{ij})_{p\times p}$, what's the distribution of $\vec A$, the vector after straightening the matrix?
This problem occurs when I try to understand Theorem 10.4 in Hardle and Simar-Applied Multivariate Statistical Analysis(2ed).


text:
Q: Unity Facebook SDK for Android. App keeps asking permissions The problem is that when the app is requesting permissions you get this popup but if you click ok nothing happens and this popup keeps coming up as if it does not get user permission.

If I sign the app as a debug user through these settings it DOES WORK

But obviously for the final build I have to sign the app with my normal alias. What could the problem be?
I also found out that the debug hashkey keeps changing when I change between keystores and it could be an openssl problem. I get a different key from Mac to Win and a different key if I get it from the Facebook settings or the -keytool command. Is there a way to know the actual hashkey?

A: You need to add all the hashkeys that you're gonna use when signing the app to the FacebookApp settings page. You can set up more than one and you'll need this if you're gonna sign the app with debug keys and release keys.
Debug keys may differ from machine to machine so it's better to just distribute the keystore with your Unity3D project and use the same one everywhere you build the project.
If you don't want to distribute the release keys you may want to consider setting up a build machine.
To get the hashes for a keystore you need to run:
keytool -exportcert -alias keyalias -keystore path_to_keystore | openssl sha1 -binary | openssl base64


text:
Q: lsass.exe load high when reading database with VB6 I've noticed that lsass causes the cpu to run about 50% when a VB6 Windows service is running on Server 2012 and MSSQL 2014.  Putting VB6 into the debugger, I can see that whenever a read is made to the database, lsass's cpu usage spikes.
dim rs = ADODB.Recordset
set rs = cnxn.Execute(sql, , adCmdText)

During the process, the database remains open throughout the session and there are multiple reads, making lsass take so much cpu.  I'm opening an ADODB connection with a connection string, using TCP/IP, and a sql logon (not windows logon).
What's going on and how can I stop lsass from taking so much cpu?


text:
Q: After removing Bootcamp, my Hard Disk has around 80GB missing I removed Bootcamp earlier via the BootCamp Assistant, and it flashed some error up that I just ignored.
Now, when I've gone back to reinstall Bootcamp, I've noticed that while the disk reads as being 500GB in total, there is around 80GB unaccounted for in the GUID table..?
Here is an output from terminal:
diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            419.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

Any ideas how to get back the missing disk space?
EDIT: Might be worth pointing out, I am running the latest public beta of OSX 10.11

A: I'm guessing that OS X probably mis-partitioned it when removing the Bootcamp partition, and the old Windows partition is either free space or corrupt. Either way, you can try to go to Disk Utility or boot into Recovery(like @klanomoath said) and check to see how the partitions are setup. You can then resize the Macintosh HD to use any free space, and erase any corrupt or unneeded partitions.


text:
Q: Redirection based on user type - vue router I am a beginner in vue and I need your help please. I am creating an application where the login is connected to firebase. I would like to use vue-router to redirect a user to a particular page. When a person logs in whose user.role = "admin" it should be redirected to "/admin". Every other logged person to "/" and non-logged in people are redirected to "/login" page.
Here are parts of my code:
main.js
router.beforeEach((to, from, next) => {
  const currentUser = firebase.auth().currentUser;
  const requiresAuth = to.meta.requiresAuth;
  if (requiresAuth && !currentUser){ next({ name: 'Login' })}
  else if (!requiresAuth && currentUser) {next({name: 'Dashboard'}), console.log(currentUser)}
  else next();
});

authStore.js
const actions = {
  logIn({ dispatch,commit,rootGetters }){
      firebase.auth().onAuthStateChanged(async (user) => {
        if (user) {
          commit('SET_USER', user);

         var uid = user.uid;
            db.collection('users').doc(uid)
            .get()
            .then((doc)=>{
            commit('gutscheinStore/SET_USER_ROLE', doc.data().role, {root:true})
            commit('gutscheinStore/SET_USER_STANDORT_ID', doc.data().standortID, {root: true})
            commit('gutscheinStore/SET_USER_BETREIBER_ID', doc.data().betreiberID, {root: true})
                //console.log(rootGetters['gutscheinStore/getUserRole'])
              })

          router.push('/')
        } else {
          console.log("No entry without login")
        }
      })
  },

index.js in router
const routes = [
  {
    path: '/',
    name: 'Dashboard',
    component: Dashboard,
    meta: {
      requiresAuth: true,
    }
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/admin',
    name:'AdminDashboard',
    component: AdminDashboard,
    meta: {
      requiresAuth: true,
    }

A: In authStore.js where you currently have the line router.push("/"):
const actions = {
          ...
          // snipped for clarity

          router.push('/')
        } else {
          console.log("No entry without login")
        }
      })
  },

You could instead change this as follows:
const actions = {
          ...
          // snipped for clarity

          if(user.role === "admin") {
            router.push("/admin")
          } else {
            router.push("/")
          }
        } else {
          // router.push("/login")
          router.go()
        }
      })
  },


text:
Q: Scala Dropwizard with Freemarker Views Running latest Dropwizard (1.0.0) + the Scala (2.10.6) plugin.
Currently stumbling over properly rendering a Freemarker view.
My View:
case class SimpleStringView(str:String) extends View("/templates/simpleString.ftl")
Template:

param 'str' has value ${str}

Resource:
@GET
@Path("/echo/{echo}")
 def echo(@PathParam("echo") echo:String) : SimpleStringView = new SimpleStringView(echo)

produces the following error:
" freemarker.core.NonStringException: For "${...}" content: Expected a string or something automatically convertible to string (number, date or boolean), but this has evaluated to a method+sequence (wrapper: f.e.b.SimpleMethodModel):"
Changing "String" to "java.lang.String' in case class does not change the error message.
This does not look like a new problem and is most likely not Dropwizard but Freemarker + Scala related. Question however is: Has someone found a proper way around it ?
Thanks for your help


text:
Q: How Can I Use Caps In My Function? (Javascript) I'm not entirely sure how to make this function work with capital letters. Currently, an array of all capital characters returns undefined when passed and processed in the "for loop".
This function takes an array of lowercase string only characters and returns the first missing character, but I also need it to work with caps.
I was able to solve this issue with around 10 extra lines, but It seems like there must be a better approach!

const alph = "abcdefghijklmnopqrstuvwxyz";
const findMissingLetter = (arr) => {
  if(arr.length===0)
    return -1;
  let start = alph.indexOf(arr[0]);
  for(let i=0; i<arr.length; i++) {
    if(arr[i] !== alph[start+i]) {
      return alph[start+i];
    }
  }
  return -1
}

console.log(findMissingLetter([]),"-1?"); //ok
console.log(findMissingLetter(['a']),"-1?"); //ok
console.log(findMissingLetter(['b']),"-1?"); //ok
console.log(findMissingLetter(['a','b']),"-1?"); //ok
console.log(findMissingLetter(['a','c']),"b?"); //ok
console.log(findMissingLetter(['b','c','e','f']),"d?"); //ok
console.log(findMissingLetter(['B','C','E','F']),"D?"); //returns undefined
//console.log(findMissingLetter(['B','c','E','f']),"D?"); //not necessary for this solution!

Hope you can help, Thank you!

A: Try this
let alph = "abcdefghijklmnopqrstuvwxyz";
alph += alph.toUpperCase();

A: You can use toLowerCase() and toUpperCase() to modify the casing of a string. So in your case, you need to:

*

*lowercase arr[0] when initializing your start variable, in case it's uppercase (since your alph constant is all lowercase letters)

*do all the same logic you already did, but just check against the lowercased version of each array item instead of the initial version

*return the result in either upper or lowercase based on the casing of the array item

const alph = "abcdefghijklmnopqrstuvwxyz";
const findMissingLetter = (arr) => {
  if(arr.length===0)
    return -1;
  let start = alph.indexOf(arr[0].toLowerCase()); // 1.
  for(let i=0; i<arr.length; i++) {
    const letter = arr[i].toLowerCase(); // 2.
    const isUpperCase = arr[i] !== letter;
    if(letter !== alph[start+i]) {
      const result = alph[start+i];
      return isUpperCase ? result.toUpperCase() : result; // 3.
    }
  }
  return -1
}

console.log(findMissingLetter([]),"-1?"); //ok
console.log(findMissingLetter(['a']),"-1?"); //ok
console.log(findMissingLetter(['b']),"-1?"); //ok
console.log(findMissingLetter(['a','b']),"-1?"); //ok
console.log(findMissingLetter(['a','c']),"b?"); //ok
console.log(findMissingLetter(['b','c','e','f']),"d?"); //ok
console.log(findMissingLetter(['B','C','E','F']),"D?"); //returns undefined
//console.log(findMissingLetter(['B','c','E','f']),"D?"); //not necessary for this solution!

The alternative is to just add all the uppercase letters to the alph constant and keep the function the same.
const alph = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'

Or
let alph = 'abcdefghijklmnopqrstuvwxyz'
alph += alph.toUpperCase();

The latter version just concatenates an uppercase version of alph to its initial value.


text:
Q: How can I create a separate sbt Configuration or Task to compile with WartRemover? WartRemover is a scalac plugin. Typically it is configured via an sbt plugin.
I'd like to be able to run WartRemover on my sbt project as a separate configuration or task without affecting the usual run of compile.
After adding Wartremover to my plugins.sbt I tried quite a few variations on the following.
lazy val Lint = config("lint").extend(Compile)

project("foo").
  configs(Lint)
  settings(inConfig(Lint)(Defaults.compileSettings): _*).
  settings(inConfig(Linting)(wartremover.wartremoverSettings):_*).
  settings(inConfig(Linting)(wartremover.wartremoverErrors := wartremover.Warts.all))

Afterward scalacOptions contained roughly what I expected inside my new lint configuration and in the compile configuration. However, when I ran lint:compile and compile with sbt in debug mode so I could see the command line arguments to scalac, either both or neither commands would result in pass the -P:wartremover:... switches. That was surprising because only lint:scalacOptions showed the -P:wartremover:... switches.
How can I create a separate sbt Configuration or Task to compile with WartRemover without affecting compile:compile?

A: I think you came really close. Here are some of the details:

*

*sbt downloads library dependencies and compiler plugins all using Compile configuration's update task, which uses libraryDependencies setting. addCompilerPlugin is a shorthand for libraryDependencies with CompilerPlugin configuration.

*Compiler plugin requires scalaOptions on the configuration that you're interested in.

*You need to grab sources from Compile to use them in Lint.

If you see the implementation of wartremoverSettings it's doing both addCompilerPlugin and scalacOptions. You have two options to disable wartremover on Compile:

*

*Use auto plugin (requires sbt 0.13.5+) to inject wartremoverSettings, then manually remove wartremover compiler plugin from Compile.

*Disable auto plugin, then manually add wart remover into libraryDependencies.

Here's the first option.
project/build.properties
sbt.version=0.13.7

project/wart.sbt
addSbtPlugin("org.brianmckenna" % "sbt-wartremover" % "0.11")

build.sbt
lazy val Lint = config("lint") extend Compile

lazy val foo = project.
  configs(Lint).
  settings(inConfig(Lint) {
    Defaults.compileSettings ++ wartremover.wartremoverSettings ++
    Seq(
      sources in Lint := {
        val old = (sources in Lint).value
        old ++ (sources in Compile).value
      },
      wartremover.wartremoverErrors := wartremover.Warts.all
    ) }: _*).
  settings(
    scalacOptions in Compile := (scalacOptions in Compile).value filterNot { _ contains "wartremover" }
  )

foo/src/main/scala/Foo.scala
package foo

object Foo extends App {
  // Won't compile: Inferred type containing Any
  val any = List(1, true, "three")
  println("hi")
}

sample output
foo> clean
[success] Total time: 0 s, completed Dec 23, 2014 9:43:30 PM
foo> compile
[info] Updating {file:/quick-test/wart/}foo...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 1 Scala source to /quick-test/wart/foo/target/scala-2.10/classes...
[success] Total time: 1 s, completed Dec 23, 2014 9:43:33 PM
foo> run
[info] Running foo.Foo
hi
[success] Total time: 0 s, completed Dec 23, 2014 9:43:37 PM
foo> lint:compile
[info] Compiling 1 Scala source to /quick-test/wart/foo/target/scala-2.10/lint-classes...
[error] /quick-test/wart/foo/src/main/scala/Foo.scala:5: Inferred type containing Any
[error]   val any = List(1, true, "three")
[error]       ^
[error] /quick-test/wart/foo/src/main/scala/Foo.scala:5: Inferred type containing Any
[error]   val any = List(1, true, "three")
[error]             ^


text:
Q: Electron: Cannot read properties of undefined (reading 'receive') | ipc cannot receive args I sent through HTML iframe I am trying to send lightmode and language data through ipcMain to ipcRenderer through my preload script:
Preload.js:
const { contextBridge, ipcRenderer } = require("electron");

const ipc = {
  render: {
    send: ["mainMenuUpdate"],
    receive: ["windowStats"],
  },
};

contextBridge.exposeInMainWorld("ipcRender", {
  // From render to main.
  send: (channel, args) => {
    let validChannels = ipc.render.send;
    if (validChannels.includes(channel)) {
      ipcRenderer.send(channel, args);
    }
  },
  // From main to render.
  receive: (channel, args) => {
    let validChannels = ipc.render.receive;
    if (validChannels.includes(channel)) {
      ipcRenderer.on(channel, args);
    }
  },
});

I send the data like this:
mainMenu.js:
window.ipcRender.send('mainMenuUpdate', {
          // windowSkin and currentLanguage are both coming from the previous window update
          // and are an object with hexvalues and string respectively. Doesn't matter in this
          // case
          currentSkin: windowSkin,
          currentLanguage,
   })

Note that this has been working for all other windows I have updated but not this one.
I recieve this no problem in main.js as follows:
ipcMain.on('mainMenuUpdate', (event, args) => {
  console.log(args);
  // outputs correcly
  mainWindow.webContents.send("windowStats", args);
});

and then sends it away through windowStats to myPage.js:
let currentLanguage;
let windowSkin;

window.ipcRender.receive("windowStats", (event, windowArgs) => {
     console.log(windowArgs);
     // does not output anything because of double error
      windowSkin = windowArgs.currentSkin;
      currentLanguage = windowArgs.currentLanguage;
      updateColors(windowArgs.currentSkin);
       langUpdate(currentLanguage);
   });

I get a log when sending it from mainMenu.js, I get the same log when received in main.js, just before I send it with mainWindow.webcontents.send(//...) but no log because of the error.

Uncaught TypeError: Cannot read properties of  undefined (reading
'receive') at myPage.js:18:18 (anonymous @ myPage.js:18)

I get this two times, exactly the same error if that would help.
I have also tried to load in the new html file both before and after I send it through IPC.
The myPage.html looks as follows:

??MY
                    LIBRARY

                    ??COLLECTIONS

which I show inside an iframe like this:

What may or may not contribute to the problem is that it seems like the javascript is loaded before the HTML even when JS file is deferred.
myPage.js ex.
const myLibraryBtn = document.querySelector('.myLibrary-btn')

myLibraryBtn.classList.add('activated')

and get this error:

Uncaught TypeError: Cannot read properies of null (reading
'classList') at ...

I will happily elaborate and extend this question because I have no idea what I even should look for and where.

UPDATE:
As I've been doing excessive testing I have concluded that I can't get anything through the ipc (main --> renderer) while the renderer is an iframe. I can put in a button to update the window normally without iframe, even though I still get a

Uncaught TypeError: Cannot read properties of undefined (reading
'receive') at myPage.js....

error. But it doesn't seem to interfere with my updateColors() and langUpdate() functions which show the HTML correctly. So the main problem is that I am not able to send anything through mainMenuUpdate channel and get anything but two errors as mentioned above while showing myPage.html inside an iframe. So I still get the error on both occations, while two times when console.log() does not work and one time when using a button instead of an iframe which gives one error of such and the console.log() with args for both updateColor() and langUpdate() functions.

A: As @midnight-coding mentioned about ipcRender.postMessage(channel, message, [transfer]); as an alternative to IPC which cannot be used to send data parent --> iframe; I decided to go with what I found from Mozilla webDocs and this 3 min YT video.
mainMenu.js: (renderer)
// iframe \/
const mainWindow = document.querySelector('.main-window');

mainWindow.contentWindow.postMessage({
          channel: 'mainMenuUpdate',
          currentSkin: windowSkin,
          currentLanguage,
   }, '*')

Because I send it directly through renderers I avoid extra code inside main.js, so it sends through to myPage.js (renderer) and receives it:
window.addEventListener('message', (message) => {
    if(message.data.channel == 'mainMenuUpdate') {
        // I now have args over to `iframe`
        console.log(message.data)
        //... updateColors(...) langUpdater(...)
    }
});

I still don't know about myLibrary button, but it is not caused by the iframe problem.


text:
Q: Quartz.net setting the timezone for ITrigger? ITrigger cronTrigger = TriggerBuilder.Create()
            .WithIdentity("trigger1", "group1")
            .WithCronSchedule(0 0/1 * 1/1 * ? *)
            .Build();

This code sets the time to run an hour before I want it to, so rather than running at 1:40 it runs at 12:40. Can I set the timezone of Itrigger to work for uk time ?

A: ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("trigger3", "group1")
.WithCronSchedule(
  "Your CRON Expression comes here",
  x => x.InTimeZone(TimeZoneInfo.FindSystemTimeZoneById("Your Time Zone Id comes here"))
)
.ForJob("GUID / any unique combination ID comes here ")
.Build()

A: Maybe a little cleaner:
ITrigger trigger = TriggerBuilder.Create()
                .StartNow()
                .WithCronSchedule("0 27 15 ? * MON-FRI *", x => x.InTimeZone(TimeZoneInfo.Utc))
                .Build();

A: There should be a TimeZone option when creating your trigger. Something like this:
.inTimeZone(TimeZone.CurrentTimeZone);

The above will take the server's current timezone. If not a UK based server, this should work.
TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time");

Here is the link:
http://quartz-scheduler.org/documentation/quartz-2.x/tutorials/tutorial-lesson-06


text:
Q: Understanding browser timelines I have a ColdFusion server (running on localhost) and am attempting to optimise my application. My question relates to the information in the browser timeline (FF and Chrome return the same values).
I have a test cfm page that just returns about 100 bytes of static data. With CF debugging on it reports that the execution time is 3ms. The browser timelines, however, say that the browser is waiting for about 1.2 seconds. I fired up Fiddler and it also reported a similar time for the server side processing.
These discrepancies also occur (only are worse) when I test using pages that do real work. eg the difference between onrequeststart and onrequestend is 400ms but the browser "waiting time" is 2.2secs.
So, is this just "overhead" I cant do anything about or is there anything I can do to reduce the "waiting time"?

A: Turn off debugging and use cflog instead. The debugging is adding the extra overhead.


text:
Q: Regex Find English char in text need more than 3 I want to validate a text that need have more than 3 [aA-zZ] chars, not need continous.
/^(?![_\-\s0-9])(?!.*?[_\-\s]$)(?=.*[aA-zZ]{3,})[_\-\sa-zA-Z0-9]+$/.test("aaa123") => return true;
/^(?![_\-\s0-9])(?!.*?[_\-\s]$)(?=.*[aA-zZ]{3,})[_\-\sa-zA-Z0-9]+$/.test("a1b2c3") => return false;
Can anybody help me?

A: You need to group .* and [a-zA-Z] in order to allow optional arbitrary characters between English letters:
^(?![_\-\s0-9])(?!.*?[_\-\s]$)(?=(?:.*[a-zA-Z]){3,})[_\-\sa-zA-Z0-9]+$
                                 ^^^         ^
                                    Add this

Demo:

var re = /^(?![_\-\s0-9])(?!.*?[_\-\s]$)(?=(?:.*[aA-zZ]){3,})[_\-\sa-zA-Z0-9]+$/;
console.log(re.test("aaa123"));
console.log(re.test("a1b2c3"));

By the way, [aA-zZ] is not a correct range definition. Use [a-zA-Z] instead. See here for more details.

A: How about replacing and counting?

var hasFourPlusChars = function(str) {
    return str.replace(/[^a-zA-Z]+/g, '').length > 3;
};

console.log(hasFourPlusChars('testing1234'));
console.log(hasFourPlusChars('a1b2c3d4e5'));

A: Correction of the regex
Your repeat condition should include the ".*".  I did not check if your regex is correct for what you want to achieve, but this correction works for the following strings:
$testStrings=["aaa123","a1b2c3","a1b23d"];
foreach($testStrings as $s)
   var_dump(preg_match('/^(?![_\-\s0-9])(?!.*?[_\-\s]$)(?=.*[a-zA-Z]){3,}[_\-\sa-zA-Z0-9]+$/', $s));

Other implementations
As the language seems to be JavaScript, here is an optimised implementation for what you want to achieve:
"a24be4Z".match(/[a-zA-Z]/g).length>=3

We get the list of all matches and check if there are at least 3.
That is not the "fastest" way as the result needs to be created.
)
/(?:.*?[a-zA-Z]){3}/.test("a24be4Z")

is faster.  ".*?" avoids that the "test" method matches all characters up to the end of the string before testing other combinations.
As expected, the first suggestion (counting the number of matches) is the slowest.
Check https://jsperf.com/check-if-there-are-3-ascii-characters .


text:
Q: Creating object in typescript I am new to ionic3 and angular5
I have following code
export class User {
  name: string;
  email: string;
  constructor() {
   console.log("I am in constructor")
  }
}

@Injectable()
export class AuthProvider {
  currentUser: User;
  currentUser1 = new User()
}

What is difference between
1.currentUser: User
2.currentUser1 = new User()

If I use currentUser : User will it call default constructor?

A: *

*Following statement will create a reference currentUser and set type of it as User. It will not create any object.

let currentUser: User;

*Following statement will create object currentUser1 using User class.

let currentUser1 = new User();

A:
currentUser: User;

Its a reference declared of type User

currentUser1 = new User()

Its create an object of type User and its assigning to currentUser1


text:
Q: How to get Directories name I use this code for get directories name:
void DirSearch(string sDir)
    {
        foreach (var d in System.IO.Directory.GetDirectories(sDir))
        {
            ListBox1.Items.Add(System.IO.Path.GetDirectoryName(d));
            DirSearch(d);
        }
    }

but its not get Directory Name. Ex: "NewFolder1", get: "D:\aaa\bbbb\cccc\dddd\NewFolder1".
I have only get Directory Name.

A: There is a simple one-liner:
Directory.GetDirectories(PathToFolder).Select(d => new DirectoryInfo(d).Name);

A: Currently you are using Directory.GetDirectories, It will return a string[] which will consist of full path for the directories. Instead use DirectoryInfo class, later you can use the property DirectoryInfo.Name to get only the name of the directories and not the full path like:
void DirSearch(string sDir)
{
    DirectoryInfo dirInfo = new DirectoryInfo(sDir);
    foreach (var d in dirInfo.GetDirectories("*", SearchOption.AllDirectories))
    {
        ListBox1.Items.Add(d.Name);
    }
}

It appears that you are trying to recursively search all the sub directories as well, you can use the SearchOption.AllDirectories in your code to include all the sub directories.

A: This should work:
foreach (var d in System.IO.Directory.GetDirectories(@"C:\"))
        {
            var dir = new DirectoryInfo(d);
            var dirName = dir.Name;

            ListBox1.Items.Add(dirName);
        }

Also, you could shortcut...
foreach (var d in System.IO.Directory.GetDirectories(@"C:\"))
        {
            var dirName = new DirectoryInfo(d).Name;
            ListBox1.Items.Add(dirName);
        }

I just used route of C for testing.

A: How about we use little linq:
ListBox1.Items.AddRange(System.IO.Directory.GetDirectories(@"C:\").Select(x => new DirectoryInfo(x).Name).ToArray());

piece of cake :D

A: If you don't want to create DirectoryInfo or FileInfo classes which can sometimes cause errors and introduce additional overhead, you could do it this way instead:
void DirSearch(string sDir)
{
    foreach (var d in System.IO.Directory.GetDirectories(sDir))
    {
        ListBox1.Items.Add(d.TrimEnd(Path.DirectorySeparatorChar).Split(Path.DirectorySeparatorChar).Last());
        DirSearch(d);
    }
}

It's also a hair bit faster, depending on how many and how large the directories you're searching are...
If you don't need it to be cross-platform/can always guarantee the file system has a slash separator, you can make it a little "shorter"/less verbose.
void DirSearch(string sDir)
{
    foreach (var d in System.IO.Directory.GetDirectories(sDir))
    {
        ListBox1.Items.Add(d.TrimEnd('\\').Split('\\').Last());
        DirSearch(d);
    }
}

A:
but its not get Directory Name. Ex: "NewFolder1", get: "D:\aaa\bbbb\cccc\dddd\NewFolder1".

GetDirectoryName returns the full path of the directory(it can be used also for files) but you want only the last part, so NewFolder1 in your example?
You can use DirectoryInfo.Name
string dir = @"D:\aaa\bbbb\cccc\dddd\NewFolder1";
DirectoryInfo dirInfo = new DirectoryInfo(dir);
string nameOfDirOnly = dirInfo.Name; // NewFolder1

ListBox1.Items.Add(nameOfDirOnly);

A: Here's something that will work for you...
    public IEnumerable<string> GetDirInfoFast(string dir, string pattern)
    {
        //you should put try catch here....
        var di = new DirectoryInfo(dir);
        var list = new List<string>();
        //put in the pattern
        var dirs = di.GetDirectories(pattern);
        Parallel.ForEach(dirs, p => {
            list.Add(p.Name);
        });
        return list;
    }

A: This works for me as well:
var directoryName = Path.GetFileName(directoryPath);


text:
Q: Diferencia de horas exactas entre Fecha A y Fecha B $qry = "select

                CONVERT(VARCHAR(20),fechaSalida,108) AS fechaSalida,
                CONVERT(VARCHAR(20),fechaEntrada,108) AS fechaEntrada,
                CAST(DATEDIFF(minute, fechaEntrada, fechaSalida)/60.0 as decimal (18,2) ) %24 AS sumaHoras
            from tblasistencia where idclave = '".$empno."' and
                fechaEntrada BETWEEN CONVERT(DATETIME, '".$fechainicio." 00:00:00',103) and
                CONVERT(DATETIME, '".$fechainicio." 23:59:59',103)";

Còmo puedo mejorar la consulta, para que al hacer la suma de horas con la funciòn DATEDIFF
me devuelva màs exacto los cálculos, es decir quiero hacer mas amigable para el usuario, la lectura de los datos.
Caso 1
21:00:50    06:02:51    9.03

Multiplicar 0.03 * 60 para que salga los 1.8 minutos a parte,
es decir 9 hras y 1.8 minutos.
Resultado actual
 Hora A      Hora B     Suma
21:00:50    06:02:51    9.03
21:09:40    06:26:16    9.28
21:12:06    07:22:12    10.17
21:16:45    06:26:16    9.17
21:27:36    06:02:40    8.58
21:21:10    06:09:49    8.8
21:12:13    06:09:48    8.95
21:08:34    06:02:32    8.9

A: Una forma general de resolverlo es calculando la diferencia en una magnitud mínima, por ejemplo en segundos, y básicamente lo que haremos es:

*

*El cociente de los segundos divididos 86400 son los días (Un día tiene 86400 seg.)

*El cociente del resto de (1) dividido 3600 serán las horas

*El cociente del resto de (2) dividido 60 serán los minutos

*El resto final serán los segundos

Conceptualmente sería algo así:
DECLARE @Diff       INT
DECLARE @From       DATETIME
DECLARE @To         DATETIME

SELECT  @From   = '1900-01-01 21:00:50'
SELECT  @To     = '1900-01-02 06:02:51'
SELECT  @Diff   = DATEDIFF(SECOND,@From,@To)

select  convert(varchar(10), (@Diff/86400)) + ':' +                        -- dia
        convert(varchar(10), ((@Diff%86400)/3600)) + ':'+                  -- hora
        convert(varchar(10), (((@Diff%86400)%3600)/60)) + ':'+             -- min
        convert(varchar(10), (((@Diff%86400)%3600)%60)) as 'DD:HH:MM:SS'   -- seg

Salida (9 horas dos minutos 1 segundo):
DD:HH:MM:SS
0:9:2:1

Resuelto en tu consulta:
select  convert(varchar(10), (DATEDIFF(SECOND, fechaEntrada, fechaSalida)/86400)) + ':' +                        -- dia
        convert(varchar(10), ((DATEDIFF(SECOND, fechaEntrada, fechaSalida)%86400)/3600)) + ':'+                  -- hora
        convert(varchar(10), (((DATEDIFF(SECOND, fechaEntrada, fechaSalida)%86400)%3600)/60)) + ':'+             -- min
        convert(varchar(10), (((DATEDIFF(SECOND, fechaEntrada, fechaSalida)%86400)%3600)%60)) as 'DD:HH:MM:SS'   -- seg
        from ...

A: En vez de utilizar (DATEDIFF(minute, fechaEntrada, fechaSalida) utiliza (DATEDIFF(time, fechaEntrada, fechaSalida) porque lo que quiere obtener es el la hora exacta con sus minutos y segundos, no tienes porque convertirlos a decimal conviertelos a tipo TIME


text:
Q: 5V to 3V3 - Sensor for Arduino 3V3 I am trying to make a circuit using a 3V3 Arduino and other modules working on 3V3, but I have a problem with an analog water sensor I need to use. The output is a voltage range is from 0.5V to 4.5V.
I think I cannot use 4.5V signal on an analog pin of an Arduino working at 3V3.
So I have a basic idea like solution.
- Use a 5V step-up voltage regulator from 3V7 li-on battery for the water sensor
- Then using a voltage resistor divider to convert from 5V (sensor output) to 3V3.
- Then connect to the Arduino and inside make line code with a simple equation where I can recover the 5Volt value.
For example

Will I will lose resolution doing this? Is it a bad idea?
EXTRA QUESTION
To ensure that I will not lose resolution, what do I need to check? Maybe the minimum step voltage in the ouput of sensor? For example 5mv minimum of variation, then 5mv*voltage_divider = 3.3mv ... Then 10 bit of resolution of ADC in Arduino is enough? I got a 3.22mv resolution (3.3/1023)

A: That's the standard way to do it but you might consider lowering your resistors so that the net effective impedance seen by the Arduino's ADC input is only a few kohm. Maybe use 5k1 and 10 kohm. You'll find in the data sheet that the ATMEGA328 chip likes to have a source impedance not greater than 10 kohm.
You might also consider adding a capacitor across the (now) 10 kohm resistor to offer some anti alias filtering. If you can manage 100 nF that would be a good default choice but it depends on the bandwidth of the signals you wish to convert.

A: With 4.7K and 10K the values (3v3 Arduino 1023 max) are:

+5V Source
^
|    4.7K    AX      10K
----/\/\/\----*----/\/\/\------GND

5V Source    AX        Analog AX
--------   ------    ------------
  4.8       3.31        1023
  4.5       3.12        964
  4.0       2.80        865
  3.5       2.45        757
  3.3       2.30        711
  3.0       2.13        658
  2.5       1.76        544

```

A:
Scaling a 5V sensor with offset into a 3.3V full scale A/D

Since the sensor has a large offset (approximately 0.5V) and a span of 4V you have to scale the input and provide an adjustable offset control.
One possible solution is to use a single rail to rail op-amp powered by the 3.3V supply. This provides self limiting since the VCC rail and ground become the input limit.

simulate this circuit – Schematic created using CircuitLab
The TLV9001 or TLV6001 are good low cost opamp candidates.
R1 and R2 give a scale factor of 0.825.
R4 and R5 provide offset control.
Full scale resolution is 4V/1024 = 3.9mV (input voltage resolution)
Update: added element to allow the simulator to run. The output looks just fine.    The small amount of clipping on the output is due to the incorrect value of the offset Rin (R4 and R5)

Note that this is of course an inverting configuration, so at zero (0.5v) sensor output the input to the A/D is 3.3V. I assume you can cope with this inversion.
Think of the circuit like this:

simulate this circuit
To understand the circuit read this. Particularly read section 3.3 and 3.4.
If you don't understand opamps as attenuators (this one is stable at less than unity gain) you might read this excellent article.


text:
Q: How do I set the theme layout from within a module in PyroCMS? I'm doing
        $this->template
            ->set_breadcrumb(lang('stuff'), 'stuff')
            ->set_breadcrumb($col->title)
            ->set_layout('questions')
            ->set('title', $col->title)
            ->build('view', $this->data);

But my questions layout file in my my_theme folder.
How do I specify the layout directory?

A: Your question changed while I was answering it so now I am confused. This is correct, it previously wasn't.
PyroCMS Template Library docs
The location is addons/<default or shared_addons>/themes/<theme>/views/layouts/ and the questions.html layout should be set in there, right next to its buddy default.html.
You can of course skip all of this and just make a layout that has the same name as the module. So, remove the set_layout() method entirely and you've already completed your task.


text:
Q: Can't calibrate my touchscreen (Lubuntu) So I'm making a sort of music player with some old hardware and before it was put on hold my (opinion) question helped me to choose Lubuntu as the OS.  It looked like my touch screen would probably work since someone had solved the issue.  So I proceeded and I'm happy except for one thing.  That method to get the touch screen functional isn't working for me.
When I got the hardware together and Lubuntu loaded on, the touch screen worked except where I touched wasn't where it reacted.  The idea was to use xinput_calibrator to calibrate the screen, which was supposed to work, but then enter some of the archaic code Linux uses, to make the setting permanent.  Unfortunately calibrating the screen made it stop working altogether.  Because I didn't make the change permanent, it functions again when I reboot, but it's still useless and all of my internet searches come up with the same solution.  Use xinput_calibrator; make it permanent.
As you might have noticed, I'm not really a Linux user so if you have any suggestions, I would appreciate it if you keep it on a 4th grade level.
I hope someone can help, otherwise I might need to look into a different distro and start all over again or worse, switch back to Windows!
Here's my hardware:
Lilliput 629GL-70NP/C/T touchscreen monitor
Asus AT3GC-I motherboard
2 GB RAM (max'd)
Onboard video
Onboard sound
Kingston 128 GB SSD
Thank you!