text:
Q: How to generate a sequence of dates and times with a specific start date/time in R I am looking to generate or complete a column of dates and times. I have a dataframe of four numeric columns and one POSIXct time column that looks like this:
    CH_1   CH_2  CH_3  CH_4           date_time
1 -10096 -11940 -9340 -9972 2018-07-24 10:45:01
2 -10088 -11964 -9348 -9960                <NA>
3 -10084 -11940 -9332 -9956                <NA>
4 -10088 -11956 -9340 -9960                <NA>
5 -10084 -11944 -9332 -9976                <NA>
6 -10076 -11940 -9340 -9948                <NA>
7 -10088 -11956 -9352 -9960                <NA>
8 -10084 -11944 -9348 -9980                <NA>
9 -10076 -11964 -9348 -9976                <NA>
0 -10076 -11956 -9348 -9964                <NA>

I would like to sequentially generate dates and times for the date_time column, increasing by 1 second until the dataframe is filled. (i.e. the next date/time should be 2018-07-24 10:45:02). This is meant to be reproducible for multiple datasets and the number of rows that need filled is not always known, but the start date/time will always be present in that first cell.
I know that the solution is likely within seq.Date (or similar), but the problem I have is that I won't always know the end date/time, which is what most examples I have found require. Any help would be appreciated!

A: Here's a tidyverse solution, using Zygmunt Zawadzki's example data:
library(lubridate)
library(tidyverse)

df %>% mutate(date_time = date_time[1] + seconds(row_number()-1))

Output:
             date_time
1  2018-01-01 00:00:00
2  2018-01-01 00:00:01
3  2018-01-01 00:00:02
4  2018-01-01 00:00:03
5  2018-01-01 00:00:04
6  2018-01-01 00:00:05
7  2018-01-01 00:00:06
8  2018-01-01 00:00:07
9  2018-01-01 00:00:08
10 2018-01-01 00:00:09
11 2018-01-01 00:00:10

Data:
df <- data.frame(date_time = c(as.POSIXct("2018-01-01 00:00:00"), rep(NA,10)))

A: No need for lubridate, just,R code:
x <- data.frame(date = c(as.POSIXct("2018-01-01 00:00:00"), rep(NA,10)))
startDate <- x[["date"]][1]
x[["date2"]] <- startDate + (seq_len(nrow(x)) - 1)
x
#         date               date2
# 1  2018-01-01 2018-01-01 00:00:00
# 2        <NA> 2018-01-01 00:00:01
# 3        <NA> 2018-01-01 00:00:02
# 4        <NA> 2018-01-01 00:00:03
# 5        <NA> 2018-01-01 00:00:04
# 6        <NA> 2018-01-01 00:00:05
# 7        <NA> 2018-01-01 00:00:06
# 8        <NA> 2018-01-01 00:00:07
# 9        <NA> 2018-01-01 00:00:08
# 10       <NA> 2018-01-01 00:00:09
# 11       <NA> 2018-01-01 00:00:10


text:
Q: Clickable Marked points on an Image first check out the image for a better understanding of what I want to do. The red points on the picture will be clickable. When you click on them a description will pop up.
I saw the use of HTML <area> tag and a JS function with image coordinates.
Is there any ready made library available for this ?

A: You're best off making use of an <img> and the <map> element. From here you can set <area> children with a circular shape, and specify the the co-ordinates. These are in the format x,y from the top-left pixel. With a circle, the third value is the diameter. You can link these off, or attach an event handler to display a popup:

img {
  height: 100%;
}

area {
  fill: blue;
}
<img src="https://i.stack.imgur.com/q9ZX6.png" usemap="#housemap">

<map name="housemap">
  <area shape="circle" coords="0,0,82,126" href="1.htm" alt="1">
  <area shape="circle" coords="190,58,30" href="2.htm" alt="2">
  <area shape="circle" coords="90,58,30" href="3.htm" alt="3">
  <area shape="circle" coords="90,58,30" href="4.htm" alt="4">
</map>

redpajama_set_name: RedPajamaStackExchange


text:
Q: Use custom integer class as index in an array (c++) I have written a BigInt class for c++, but I am unable to use the class as an index for arrays.
Example:
int main() {
    int array[5] = {4, 6, 2, 9, 0};
    BigInt index = 1;

    std::cout << array[index] << std::endl;
}

This results in:
error: no match for 'operator[]' (operand types are 'int [5]' and 'BigInt')
       cout << array[index] << endl;
                    ^

I tried implementing the following functions, but to no avail.
int operator[] (BigInt &value) {
    return (int) value;
}

explicit operator int() {
    int result = 0;
    for (auto i : digits)
        result = result * 10 + i;

    return result;
}

I am sure operator[] is used when the class itself is an iterable, so that's pointless.
And explicit operator int() works, but only when I cast the BigInt as int like array[(int) index]
Removing explicit from operator int()  works perfectly, except that I can no longer can perform operations involving both int and BigInt
// ...

operator int() {
    int result = 0;
    for (auto i : digits)
        result = result * 10 + i;

    return result;
}

// ...

int main() {
    int array[5] = {4, 6, 2, 9, 0};
    BigInt index = 1;

    std::cout << array[index] << std::endl;   // Works fine
    std::cout << (index == 1) << std::endl;   // Doesn't work
}

The above results in the following error:
error: ambiguous overload for 'operator==' (operand types are 'BigInt' and 'int')
     cout << (index == 1) << endl;
              ~~~~~ ^~ ~

How can I overcome these errors?
Thanks!

EDIT:
The BigInt class is as follows:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

class BigInt {
public:
    std::vector<unsigned short> digits;
    bool negative;

    BigInt(){
        this -> digits = {0};
        this -> negative = false;
    }

    BigInt(const BigInt &other){
        this -> digits = other.digits;
        this -> negative = other.negative;
    }

    BigInt(std::string other) {
        if (other.size() == 0) {
            *this = BigInt();
            return;
        }

        std::reverse(other.begin(), other.end());

        negative = false;
        while (other.back() == '-') {
            negative = !negative;
            other.pop_back();
        }

        digits.clear();
        for (char c : other)
            digits.push_back(c - '0');

        (*this).trim();
    }

    BigInt(const char *other) {
        *this = (std::string) other;
    }

    template<typename T>
    BigInt(const T &other) {
         *this = to_std::string(other);
    }

    friend bool operator== (const BigInt &a, const BigInt &b) {
        if (a.negative != b.negative || a.digits.size() != b.digits.size())
            return false;

        for (int i = 0; i < a.digits.size(); i++)
            if (a.digits[i] != b.digits[i])
                return false;

        return true;
    }

    friend bool operator!= (const BigInt &a, const BigInt &b) {
        return !(a == b);
    }

    friend bool operator< (const BigInt &a, const BigInt &b) {
        if (a.negative && b.negative) return (-a) > (-b);
        if (a.negative && !b.negative) return true;
        if (!a.negative && b.negative) return false;

        if (a.digits.size() < b.digits.size()) return true;
        if (a.digits.size() > b.digits.size()) return false;

        for (int i = a.digits.size() - 1; i >= 0; i--) {
            if (a.digits[i] < b.digits[i]) return true;
            if (a.digits[i] > b.digits[i]) return false;
        }

        return false;
    }

    friend bool operator<= (const BigInt &a, const BigInt &b) {
        return !(a > b);
    }

    friend bool operator> (const BigInt &a, const BigInt &b) {
        if (a.negative && b.negative) return (-a) < (-b);
        if (!a.negative && b.negative) return true;
        if (a.negative && !b.negative) return false;

        if (a.digits.size() > b.digits.size()) return true;
        if (a.digits.size() < b.digits.size()) return false;

        for (int i = a.digits.size() - 1; i >= 0; i--) {
            if (a.digits[i] > b.digits[i]) return true;
            if (a.digits[i] < b.digits[i]) return false;
        }

        return false;
    }

    friend bool operator>= (const BigInt &a, const BigInt &b) {
        return !(a < b);
    }

    friend BigInt operator+ (const BigInt &a, const BigInt &b) {
        if (a.negative && b.negative) {
            return -((-a) + (-b));

        } else if (a.negative && !b.negative) {
            return b - (-a);

        } else if (!a.negative && b.negative) {
            return a - (-b);

        } else {
            BigInt result; result.digits.clear();
            int carry = 0;

            for (int i = 0; i < std::max(a.digits.size(), b.digits.size()); i++) {
                int sum = carry;
                if (i < a.digits.size()) sum += a.digits[i];
                if (i < b.digits.size()) sum += b.digits[i];

                result.digits.push_back(sum % 10);
                carry = sum / 10;
            }

            if (carry)
                result.digits.push_back(carry);

            result.trim();
            return result;
        }
    }

    friend BigInt operator+ (const BigInt &value) {
        return value;
    }

    friend BigInt operator- (const BigInt &a, const BigInt &b) {
        if (a.negative && b.negative) {
            return b - a;

        } else if (a.negative && !b.negative) {
            return -((-a) + b);

        } else if (!a.negative && b.negative) {
            return a + (-b);

        } else {
            if (a < b)
                return -(b - a);

            BigInt result; result.digits.clear();
            int carry = 0;

            for (int i = 0; i < a.digits.size(); i++) {
                int dif = a.digits[i] - carry;
                if (i < b.digits.size()) dif -= b.digits[i];

                if (dif < 0) {
                    dif += 10;
                    carry = 1;

                } else {
                    carry = 0;
                }

                result.digits.push_back(dif);
            }

            result.trim();
            return result;
        }
    }

    friend BigInt operator- (const BigInt &value) {
        BigInt result = value;
        result.negative = !result.negative;

        result.trim();
        return result;
    }

    friend BigInt operator* (const BigInt &a, const BigInt &b) {
        BigInt result;
        for (int i = 0; i < a.digits.size(); i++) {
            BigInt current; current.digits.clear();
            for (int j = 0; j < i; j++)
                current.digits.push_back(0);

            int carry = 0;
            for (int j = 0; j < b.digits.size(); j++) {
                int cur_val = a.digits[i] * b.digits[j] + carry;
                current.digits.push_back(cur_val % 10);
                carry = cur_val / 10;
            }

            if (carry)
                current.digits.push_back(carry);

            current.trim();
            result += current;
        }

        result.negative = a.negative ^ b.negative;

        result.trim();
        return result;
    }

    friend BigInt operator/ (const BigInt &a, const BigInt &b) {
        if (b == 0)
            throw std::runtime_error("Division by zero");

        BigInt fa = abs(a), fb = abs(b);

        BigInt result, left_over;
        result.negative = a.negative ^ b.negative;

        int index = fa.digits.size() - 1;
        while (true) {
            BigInt cur = left_over; bool first_digit = true;
            while (index >= 0 && cur < fb) {
                cur = cur * 10 + fa.digits[index--];
                if (!first_digit) result *= 10;
                first_digit = false;
            }

            int cur_res = 0;
            while (cur >= fb)
                cur -= fb, cur_res++;

            left_over = cur;
            result = result * 10 + cur_res;

            if (index < 0)
                break;
        }

        result.trim();
        return result;
    }

    friend BigInt operator% (const BigInt &a, const BigInt &b) {
        if (b == 0)
            throw std::runtime_error("Division by zero");

        BigInt fa = abs(a), fb = abs(b);
        BigInt left_over;

        int index = fa.digits.size() - 1;
        while (true) {
            BigInt cur = left_over;
            while (index >= 0 && cur < fb)
                cur = cur * 10 + fa.digits[index--];

            while (cur >= fb)
                cur -= fb;

            left_over = cur;

            if (index < 0)
                break;
        }

        left_over.negative = b.negative;

        left_over.trim();
        return left_over;
    }

    friend BigInt pow(BigInt a, BigInt b) {
        BigInt result = 1;

        while (b) {
            if (b % 2)
                result = (result * a);

            a *= a;
            b /= 2;
        }

        result.trim();
        return result;
    }

    friend BigInt pow(BigInt a, BigInt b, BigInt mod) {
        BigInt result = 1;

        if (mod == 0)
            throw std::runtime_error("Modulo by zero");

        while (b) {
            if (b % 2)
                result = (result * a) % mod;

            a = (a * a) % mod;
            b /= 2;
        }

        result.trim();
        return result;
    }

    friend BigInt operator& (BigInt a, BigInt b) {
        BigInt result, power = 1;
        while (a > 0 && b > 0) {
            if (a % 2 && b % 2)
                result += power;

            power <<= 1;
            a >>= 1;
            b >>= 1;
        }

        return result;
    }

    friend BigInt operator| (BigInt a, BigInt b) {
        BigInt result, power = 1;
        while (a > 0 || b > 0) {
            if (a % 2 || b % 2)
                result += power;

            power <<= 1;
            a >>= 1;
            b >>= 1;
        }

        return result;
    }

    friend BigInt operator^ (BigInt a, BigInt b) {
        BigInt result, power = 1;
        while (a > 0 || b > 0) {
            if (a % 2 != b % 2)
                result += power;

            power <<= 1;
            a >>= 1;
            b >>= 1;
        }

        return result;
    }

    friend BigInt operator<< (BigInt a, BigInt b) {return a * pow(2, b);}
    friend BigInt operator>> (BigInt a, BigInt b) {return a / pow(2, b);}

    BigInt operator++ () {return *this = *this + 1;}
    BigInt operator-- () {return *this = *this - 1;}
    BigInt operator++ (int) {BigInt result = *this; *this = *this + 1; return result;}
    BigInt operator-- (int) {BigInt result = *this; *this = *this - 1; return result;}

    BigInt operator+= (BigInt other) {return *(this) = *(this) + other;}
    BigInt operator-= (BigInt other) {return *(this) = *(this) - other;}

    BigInt operator*= (BigInt other){return *(this) = *(this) * other;}
    BigInt operator/= (BigInt other){return *(this) = *(this) / other;}
    BigInt operator%= (BigInt other){return *(this) = *(this) % other;}

    BigInt operator&= (BigInt other){return *(this) = *(this) & other;}
    BigInt operator|= (BigInt other){return *(this) = *(this) | other;}
    BigInt operator^= (BigInt other){return *(this) = *(this) ^ other;}

    BigInt operator<<= (BigInt other){return *(this) = *(this) << other;}
    BigInt operator>>= (BigInt other){return *(this) = *(this) >> other;}

    int operator[] (BigInt &value) {
        return (int) value;
    }

    explicit operator bool() {
        return *this != 0;
    }

    explicit operator int() {
        int result = 0;
        for (auto i : digits)
            result = result * 10 + i;

        return result;
    }

    friend bool operator !(const BigInt &other) {
        return other == 0;
    }

    friend std::string to_string(const BigInt &value) {
        std::string result;
        if (value.negative)
            result += '-';

        for (int i = value.digits.size() - 1; i >= 0; i--)
            result += value.digits[i] + '0';

        return result;
    }

    friend BigInt abs(const BigInt &value) {
        BigInt result = value;
        result.negative = false;

        return result;
    }

    void trim() {
        while (digits.size() > 1 && digits.back() == 0)
            digits.pop_back();

        if (digits.size() == 1 && digits.back() == 0)
            negative = false;
    }

    friend std::istream& operator>> (std::istream& in, BigInt &value){
        std::string s; in >> s;
        value = BigInt(s);
        return in;
    }

    friend std::ostream& operator<< (std::ostream& out, const BigInt &value){
        auto digits = value.digits;

        if (value.negative)
            out << "-";

        for (auto it = digits.rbegin(); it != digits.rend(); it++)
            out << *it;

        return out;
    }
};

A: A possible way would be to declare the standard operators only for the other operand being a BigInt object in the class itself.
Then you declare a implit conversion function member in the BigInt class.
Finally you declare free operator functions (outside of the class) to operate on a BigInt and an int. Those free function will have the highest priority because their argument will exactly match and will get rid of any ambiguous operator error.
I had started to code an example before you have added your BigInt class, and I started with a much simpler one: only positive values and only operator + defined. But is compiles and runs without even a warning:
#include <iostream>
#include <vector>
#include <stdexcept>

/* This is a tiny multiprecision class for unsigned values.
 *
 * Currently only addition is implemented, between BigInt objects
 * or between an unsigned value and a BigInt object
 * The class in implicitely convertible to unsigned, but this throws
 * if the value cannot fit into a single unsigned
 */
class BigInt {
    std::vector<unsigned int> val;

public:
    BigInt(unsigned i = 0) {
        val.push_back(i);
    }
    operator unsigned() const {
        if (val.size() > 1) {
            throw std::overflow_error("BigInt is too big");
        }
        return val[0];
    }
    // Implementation of an addition (beware almost untested...)
    BigInt operator+(const BigInt& other) const {
        if (other.val.size() > val.size()) return other + *this;
        BigInt tmp(*this);
        unsigned carry = 0;
        for (int i = 0; i < other.val.size(); i++) {
            tmp.val[i] += carry + other.val[i];
            if (tmp.val[i] < other.val[i] || tmp.val[i] < val[i]) {
                carry = 1;
            }
            else {
                carry = 0;
            }
        }
        for (int i = other.val.size(); i < val.size(); i++) {
            tmp.val[i] += carry;
            if (0 == tmp.val[i]) {
                carry = 1;
            }
            else {
                carry = 0;
                break;
            }
        }
        if (carry) tmp.val.push_back(1);
        return tmp;
    }
    // an auxiliary function to be used in operators
    BigInt add(unsigned i) const {
        // trace to make sure that this method was called...
        std::cout << "add " << this->val[0] << " and " << i << '\n';
        return *this + BigInt(i);
    }
};

// addition operator free functions
BigInt operator+ (int i, const BigInt& b) {
    return b.add(i);
}
BigInt operator+ (const BigInt& b, int i) {
    return b.add(i);
}

int main() {
    BigInt x(2);
    x = x + 1;
    x = 1 + x;
    std::cout << static_cast<int>( x) << '\n';
    int arr[] = { 1, 2, 3, 4, 5, 6 };
    std::cout << arr[x] << '\n';
}

This code shows as expected (both with Clang 11 and MSVC2022):
add 2 and 1
add 3 and 1
4
5


text:
Q: IE 9 won't display the links or rollovers on my site, but previous version of IE will I don't know what it is, but IE just isn't showing any part of the navigation of a slider I'm building. I have not even gotten to the point of adding JavaScript. Its just a simple side-tab menu with a rollover. The only thing peculiar about it is that I'm using display:table and table-cell in order to center a group of links vertically in the middle of each tab. Oh and I'm using @font-face for the fonts.
highschooltalentbattles.com/homepage

A: Solved. I guess I didn't realize that IE9 was more strict in some regards than previous versions. Just needed to add a width to the enclosing divs.


text:
Q: How to get data from an array inside an object in javascript? My data structure is as follows
var processArray = [];
for(i = 0;i < someProcess.length;i++){
     processArray.push({
        id: i,
        processName: someProcess[i],
        processType: someType[i]
     });
}
//someProcess and someType are arrays from database.

I use this processArray to populate a HTML list. After some operations by the user (eg:- adding more data or deleting some), I need to extract all processName from processArray and store them in another array, lets say newProcessList. How can I do it?

A: Use Array.prototype.map()
var processArray = [];
for(i = 0;i < someProcess.length;i++){
     processArray.push({
        id: i,
        processName: someProcess[i],
        processType: someType[i]
     });
}

var newProcessList = processArray.map(function(el){

          return el.processName;

});


text:
Q: javascript shows no breakline in debugger When I upload to  dreamhost my page, I can't debug it because javascript appears with no end of line, like this for example:
function fun(){ alert("1");alert("3");if($("#tbTitulo").val()==""){alert("1");return;}}

so it is practically impossible to debug. I tried on firefox and chrome with the same results.  I don't know why this is happening. If you could give me some clue I'd really appreciate it.

A: You can prettify the code in Chrome Developer Tools. The button is the last one on the bottom row on the sources tab (it looks like a pair of curly brackets):
https://stackoverflow.com/a/6318092/1669279

A: First you have to Beautify, unpack or deobfuscate JavaScript and HTML, make JSON/JSONP readable, etc.
check here
http://jsbeautifier.org/
after that you can insert breakpoint to debug.


text:
Q: How to use Legendre polynomials in order to determine the (an)isotropy of an on-lattice cluster aggregate? I am currently testing various models of on-lattice (square lattice in two dimensions) cluster growth for anisotropy.
I end up with a cluster, the boundary of which, in case of a truly isotropic model, should look like a circle. In anisotropic cases the cluster boundary will deviate from the circular shape.
I've been told that the Legendre polynomials can be used in order to determine the anisotropy of a cluster, but I'm not exactly sure of how I can use these Legendre polynomials in order to say something about the isotropy or otherwise of the clusters.
I gather that one can write the angular functional dependency of the cluster boundary in terms of a Legendre series due to the orthogonal nature of the Legendre polynomials, but once I've calculated the coefficients of the series I'm not sure how to interpret them in terms of anisotropy of the cluster or even if this is the correct thing to be doing.
Any hints, tips or further reading would be appreciated.
I am a humble mathematician, so please go easy on the physics jargon as I may not be well versed in it.
Thanks for your time and help.

A: It's not really the Legendre polynomials you should be calculating against, but more precisely the spherical harmonics $$Y_{lm}=\sqrt{\frac{(2l+1)(l-m)!}{4\pi(l+m)!}}P_l^m(\cos(\theta))e^{im\phi}.$$
Exactly what you integrate will depend on what exactly is the object you're studying, but the essentials will be the same. None of the coefficients by themselves will mean much, but in general bigger coefficients mean bigger anisotropies; the different varieties of spherical harmonics represent different modes of anisotropy.
For example, if the coefficients for $l=1$ are nonzero then it probably means you chose the wrong origin, and the cluster centre is in some particular direction. If the coefficients for $l=2$ are nonzero then you'll have some sort of ellipsoidal distribution; the moments then tell you if it's oblate or prolate, how much, and in which direction. (This is a common problem in nuclear physics, where the quadrupolar moments of nuclei are essential properties.) Nonzero $l=3$ moments could imply some sort of triangular or tetrahedral structure, and so on.
A good way to picture these anisotropies is to graph the surface $r=1+\epsilon Y_{lm}$:

You should also be careful because the different moments are not necessarily comparable, and it could be hard to tell which one is more important. An example of this is in electrostatics. Say you have some localized density of electrical charge $\rho(\mathbf{r})$ which you're trying to examine from far away. Then you can decompose the far field into its multipolar components as
$$
\phi(\mathbf{r})=\sum_{l=0}^\infty\frac{4\pi}{2l+1}\sum_{m=-l}^l Q_{lm}\frac{Y_{lm}(\theta,\phi)}{r^{l+1}},
$$
where
$$Q_{lm}=\int\mathrm{d}\mathbf{r} \rho(\mathbf{r})r^lY_{lm}^\ast(\theta,\phi)$$
are the multipole moments. These measure the different anisotropies of the distribution and imprint it on the different anisotropic components of the far field. However, their relative importance changes with the distance from the distribution, because the different anisotropic (multipolar) components decay at different rates. Thus the ratio between different coefficients essentially tells you the distance you need to be at for the more anisotropic component to be negligible.
In your case, I gather you want to study the cluster boundary as a surface $r=r(\theta,\phi)$. My first shot at that would be to attempt a decomposition of the form
$$r(\theta,\phi)=\sum_{l=0}^\infty\sum_{m=-l}^l r_{lm}Y_{lm}(\theta,\phi),$$
where you can find the coefficients $r_{lm}$ using the orthogonality properties of the harmonics. Here the $r_{lm}$ are all distances and are thus comparable, so that if some coefficient is much smaller than another you can probably ignore it.
Each coefficient then tells you how much of some particular type of anisotropy (multipolarity) your surface has. You should be careful when judging them as absolutes because they are distances and therefore carry dimensional information; to remove that you could try dividing by $r_{00}$, which is up to constants the radius of the cluster. A useful measure of total anisotropy could then be
$$\sum_{l\neq0}\left|\frac{r_{lm}}{r_{00}}\right|,$$
or squaring each term, or some such.


text:
Q: When I upload media, the "Saved" button isn't clickable In widget development when i upload an image, uploaded image is appeared but I can't click the "Saved" button because it is disabled.
Here is my "functions.php" code:
public function widget($args, $instance){
  $man=$instance['mango'];
  $mo='';
  echo $args['before_widget'].$args['before_title'].$mo.$args['after_title'].$args['after_widget'];
}

public function form($instance){
  $man=$instance['mango'];

Create button:
<button class="button button-secondary"
        id="author_info_image">Upload Image</button>

Create hidden input:
<input type="hidden" class="image_er_link"
       name="<?php echo $this->get_field_name('mango'); ?>"
       value="<?php echo $man; ?>">

Create  tag to show image to dashboard:

  <img src="<?php echo $man; ?>" width="250px" height="auto" alt="" />

Here is the "admin_script.js" code:
(function ($) {
  $(document).ready(function () {
    $("button#author_info_image").on("click", function (e) {
      e.preventDefault();

      var imageUploader = wp.media({
        title: "Author Image Upload",
        button: {
          text: "Set up image",
        },
        multiple: false,
      });

      imageUploader.open();

      imageUploader.on("select", function () {
        var attachm =
            imageUploader.state().get("selection").first().toJSON();

        var lin = attachm.url;

        $("input.image_er_link").val(lin);

        $("img").attr("src", lin);
      });
    });
  });
})(jQuery);

Here is a picture showing the disabled "Saved" button:


text:
Q: Is there anyway to know if thread has released CPU? I have accidentally found a peculiar behaviour for which I am not getting any reason. In the program below there are 2 sections. First section is commented which creates 2 threads and does some work, in second section I added some code for getting primes which I tried for checking AsParallel Performance. AsParallel really decreased the time for program. But the thing which struck me most was when I commented the above section I got a improvement in time.
So my question is did the first section ,which I have commented, had kept the CPU busy enough. Or was there any other reason.
Please see time elapsed for
1) When first section is not commented : Elapsed: 4260619 (Ticks)
2) When first section is commented :     Elapsed: 2700445 (Ticks)
class Program
{
    [ThreadStatic]
    static int thStaticInt = 0;
    static void Main(string[] args)
    {

        //new Thread(() =>
        //{
        //    for (int i = 0; i < 10; i++)
        //    {
        //        thStaticInt++;
        //        Console.WriteLine("from first {0}", thStaticInt);

        //    }
        //}

        //).Start();

        //new Thread(() =>
        //{

        //    for (int i = 0; i < 10; i++)
        //    {
        //        thStaticInt++;
        //        Console.WriteLine("from second {0}", thStaticInt);

        //    }

        //}

        //).Start();

        //Console.WriteLine("Press any key");
        //Console.ReadLine();
       //Another section starts here

        IEnumerable<int> numbers = Enumerable.Range(3, 1000000);
        Stopwatch watch = new Stopwatch();
        watch.Start();
        var primes = from n in numbers.AsParallel()
                     where Enumerable.Range(2, (int)Math.Sqrt(n)).All(i => n % i != 0)
                     select n;

        IEnumerable<int> primeNumbers = primes.ToArray();

        watch.Stop();
        TimeSpan ts = watch.Elapsed;

        Console.WriteLine("Time Elapsed {0}", ts.Ticks);

        Console.ReadLine();
    }
}

A: You're not grabbing the complete picture. Your profiling leads you to misinterpretation.
When you start a thread you request the operating system to start a thread, that doesn't mean it starts immediately, it's just a request. The OS decides when it runs your thread and for how long. That being said, in your example, your threads in the commented section could be run before, during or even after your second section.
The work in your threads is also a bit dubious. A counter to ten is very minimalistic. Also keep in mind that what you do, writing to the console, from a thread is only possible because the Console class does the thread synchronization for you. So, how does this fit in the timing? I have no idea.
Then there might be other processes with other threads running that you don't know of.
And on top of all of that you probably have a multicore processor, which might or might not affect everything.
Profiling is not an easy task. You should at least repeat your tests multiple times, corelate the results and have a solid understanding of everything involved.


text:
Q: How to stop threads in Java I'm coding a program that generates a random number in between 1 and 1,000. It then uses a thread pool of three threads to search certain number ranges in the broader 1 to 1,000 range. The threads check each number in their range, and compares it to the random target number, if it matches, the message to the console says so. If the number does not match, this is also reflected in the message to the console. I'm trying to figure out how to end the program once the target number is reached, and not continue to analyze numbers even though the target has already been found. Thank you.
This is the FindIt class:
/** fill in later */
public class FindIt extends Thread
{
    private int numToFind;
    private int numToStart;
    private int numToEnd;

    public FindIt( int nF, int nS, int nE )
    {
        numToFind = nF;
        numToStart = nS;
        numToEnd = nE;
    }

    public void run()
    {
        int counter = 0;

        int numAt = numToStart;

        for ( int i = 0; i < ( numToEnd - numToStart ) + 1; i++ )
        {
            counter++;

            if ( counter == 10 )
            {
                counter = 0;
                Thread.yield();
            }

            if ( numAt++ == numToFind )
            {
                System.out.println( "The target number, " + numToFind + ", has been found by " + Thread.currentThread().getName() + "." );
            }

            else
            {
                System.out.println( Thread.currentThread().getName() + " has analyzed the number " + ( numAt - 1 ) + " - not the target number." );
            }

        }
    }
}

This is the program with the main method:
import java.util.Random; //imports Java's Random class
import java.util.concurrent.*;

/** fill in later */
public class NumberSearch
{
    public static void main( String [] args )
    {
        Random r = new Random(); //creates an instance of the Random class
        int randomNum = r.nextInt( 1001 ); //declares the integer randomNum and initilizes it to be a random interger in the range 0 inclusive to 1001 exclusive

        ExecutorService executor = Executors.newFixedThreadPool( 3 );

        FindIt find1 = new FindIt( randomNum, 0, 349);
        FindIt find2 = new FindIt( randomNum, 350, 699);
        FindIt find3 = new FindIt( randomNum, 700, 1000);

        executor.execute( find1 );
        executor.execute( find2 );
        executor.execute( find3 );

        executor.shutdown();
    }
}

A: Two things are required:

*

*Make your tasks responsive to interruption by checking Thread.currentThread().isInterrupted() and having the task return when interruption is detected.

*Use the ExecutorService's shutdownNow method in order to interrupt currently running tasks. The shutdown method makes the executor stop receiving new tasks but lets tasks already submitted to the executor run to completion.
Don't subclass Thread for this, you should be extending Runnable or Callable in order to define tasks submitted to an Executor. Subclassing Thread means that the task allocates an OS thread, which is unnecessary since the actual threads are already created in the threadpool. For this example, since you're calculating a number in your tasks it might make sense to use Callable.
There is an existing class in java.util.concurrent that is designed for this kind of thing. An example of canceling tasks once an answer has been found is given in the API documentation for ExecutorCompletionService.
FindIt changed to detect interruption:
public class FindIt implements Runnable
{
    private int numToFind;
    private int numToStart;
    private int numToEnd;

    public FindIt( int nF, int nS, int nE )
    {
        numToFind = nF;
        numToStart = nS;
        numToEnd = nE;
    }

    public void run()
    {
        int counter = 0;

        int numAt = numToStart;

        for ( int i = 0; i < ( numToEnd - numToStart ) + 1; i++ )
        {
            if (Thread.currentThread().isInterrupted()) {
                System.out.println(Thread.currentThread().getName()
                + " detected interruption, exiting");
                return;
            }
            counter++;

            if ( counter == 10 )
            {
                counter = 0;
                Thread.yield();
            }

            if ( numAt++ == numToFind )
            {
                System.out.println( "The target number, " + numToFind + ", has been found by " + Thread.currentThread().getName() + "." );
            }

            else
            {
                System.out.println( Thread.currentThread().getName() + " has analyzed the number " + ( numAt - 1 ) + " - not the target number." );
            }

        }
    }
}


text:
Q: Django: edit the choices set of forms.Select widget with dB data linked to current user in templates Dear Python community,
Could you please share some insights with a newbie like myself regarding the following topic:
I would like to dynamically modify the inputs into form field input, specifically
forms.ChoiceField(choices=((text, name), widget=forms.Select())
As I was not able to access requestfrom class in forms.py, I'd like to try editing the choices from Django template engine. Is it possible to edit the choices, taking the parameters from views.py method using jinja?
The question is conceptual, a few lines of code as an example would be enough, I'll pick it up.
The tricky part is - the data should be dependent on logged-in User's created model instances.
If there's no actual way to do it via python, but js only - please let me know so I don't dry to do the impossible.
Thank you!
Code sample for reference:
forms.py
class InformForm(forms.Form):

flight_number = forms.CharField(5, widget=forms.TextInput())
date = forms.DateField(widget=forms.DateInput(attrs={'class': 'datepicker'}))
template = forms.ChoiceField(choices=tuple([(template.text, template.name) for template in Template.objects.all()]),
                             widget=forms.Select(attrs={'id': 'select_box',
                                                        'onchange': 'javascript:changer();'}))
text = forms.CharField(widget=forms.Textarea(attrs={'id': 'txt_box', 'class': 'latin',
                                                    'maxlength': "160", 'onchange': 'javascript:validateTextArea();'}))

template

<form class="form-signin form-container" method="post" enctype="multipart/form-data">
    {% csrf_token %}
    {% for field in form %}

                {{field.errors}}

{{field.label_tag}}

{{field}}

    {% endfor %}
    <button id="cr_inf" type="submit" class="btn btn-lg btn-primary btn-block stl-color">Create inform</button>
</form>

views.py
class InformFill(View):
form_class = InformForm
temlate_name = 'distrib_db/inform_fill.html'

def get(self, request):
    if request.user.is_authenticated():
        form = self.form_class(None)
        return render(request, self.temlate_name, context={'form': form})
    else:
        return redirect('distrib_db:login')

def post(self, request):
    if request.user.is_authenticated():
        form = self.form_class(user=request.user, data=request.POST)
        if form.is_valid():
            inform = Inform(flt_numbr=form.cleaned_data['flight_number'], date=form.cleaned_data['date'],
                            template=form.cleaned_data['text'], request=request)
            inform.save()
            date = form.cleaned_data['date']
            flt_numbr = form.cleaned_data['flight_number']
            try:
                emails, contacts = get_mail_cnt(date, flt_numbr)
                # inform = get_object_or_404(Inform, pk=request['pk'])
                paxdata = PaxData(inform=inform, emails=' '.join(emails), contacts=' '.join(contacts))
                paxdata.save()
                return redirect('/inform/{0}/'.format(inform.pk))
            # 'distrib_db:detail', context={'pk': inform.id}
            except Exception as e:
                return render(request, 'distrib_db/sample.html',
                              context={'date': date, 'flight_number': flt_numbr, 'error': e})

                # return render(request, 'distrib_db/sample.html', context={'date': date, 'flt_numbr': flt_numbr})

        return render(request, self.temlate_name, context={'form': form})
    else:
        return redirect('distrib_db:login')

QuerySet issue:
>>> usr = User.objects.filter(username='aleks')

sample = tuple([(template.text, template.name) for template in usr.template_set.all()])
      Traceback (most recent call last):
        File "", line 1, in
      AttributeError: 'QuerySet' object has no attribute 'template_set'

A: In InformForm class override __init__
def __init__(self, user, *args, **kwargs):
    super(InformForm, self).__init__(*args, **kwargs)
    self.fields['template'] = forms.ChoiceField(choices="make choice based on user")


text:
Q: Violation of Stefan's law when shining a light on a black body Suppose there is a black body in a dark room and the room temperature is constant. Now a ray light is shone upon it. Since a black body absorbs all radiation that falls upon it, it must absorb more radiation than it did when no light fell on it, but according to Stefan's law, the radiation absorbed depends only on the ambient temperature (which is constant).
I feel like I haven't completely understood the concept of black bodies since the two explanations are contradicting each other.

A: Stefan-Boltzmann law
The Stefan-Boltzmann law says quite simply that the thermal power $P_\text{thermal}$ emitted by a black body at temperature $T$ is $$ P_\text{thermal}(T) = A \sigma T^4$$ where $A$ is the object's surface area and $\sigma$ is a constant
$$ \sigma \equiv \frac{2 \pi^5 k_b^4}{15 c^2 h^3} \, .$$
This law is always true as long as the black body can be said to be at a certain temperature.
Addressing the original question

Now a ray a light is shone upon it. Since a black body absorbs all radiation that falls upon it, it must absorb more radiation than it did when no light fell on it...

Correct so far.

but according to Stefan's law the radiation absorbed depends only on the ambient temperature (which is constant).

That's not correct.
The Stefan-Boltzmann law says that the power emitted by a black body depends only on its temperature.
The power absorbed depends on how much radiation is coming onto the black body, and that radiation does not necessarily have to be coming from an environment in thermal equilibrium.
The incoming radiation can be of essentially two different types:

*

*Thermal radiation, i.e. radiation emitted from objects that various other temperatures ("objects" here include space, actually).

*Coherent radiation, i.e. light from a laser.
To some rough approximation, most natural electromagnetic radiation has properties that put it somewhere between fully thermal and fully coherent light $^{[a]}$.
Suppose the black body is initially at temperature $T_i$ and is sitting in a room, also at temperature $T_i$ with no light sources.
In this case, the object is at thermal equilibrium so the power absorbed and emitted must be the same.
We know from the Stefan-Bolzmann law that this power is
$$ P_\text{thermal (absorbed and emitted)}(T) = A \sigma T^4 \, . $$
If we now turn on a light source (e.g. a laser) with power $P_\text{source}$ and point it at the body, then the total power flow into the black body is
$$
P_\text{in}
=
\underbrace{P_\text{source}
+ P_\text{thermal}(T_i)}_\text{absorbed} \, \,
\underbrace{- P_\text{thermal}(T_i)}_\text{emitted}
\, .
$$
At first, the emitted and absorbed thermal powers are equal, so they cancel and the total power into the black body is $P_\text{source}$.
Since the black body is absorbing more than it's emitting, it's temperature starts to go up.
Therefore, by definition, the system is no longer said to be in thermal equilibrium.
Suppose the black body absorbs enough power that its temperature rises to $T$, while the surrounding environment is so big that no matter how much energy it absorbs, its temperature is still approximately $T_i$.
Then the power going into the black body is
$$
  P_\text{in}
  =
  P_\text{source}
  + P_\text{thermal}(T_i)
  - P_\text{thermal}(T)
  \, .
$$
This system is never truly in equilibrium because we're constantly adding energy through $P_\text{source}$, but there is a "steady-state" where the temperatures of the objects stop changing.
That happens when $P_\text{in} = 0$, i.e. when the total incoming and outgoing power from the black body are equal, i.e. when
\begin{align}
 P_\text{in} &= 0 \\
  \underbrace{P_\text{thermal}(T_f)}_\text{emitted}
  &=
  \underbrace{P_\text{source} + P_\text{thermal}(T_i)}_\text{absorbed}
\end{align}
where $T_f$ is the final steady state temperature of the black body.
Homework: Solve for $T_f$ in terms of $P_\text{source}$ and $T_i$.
Side note
By the way, pretty much every single idea about "breaking the second law of thermodynamics" or making a "perpetual motion machine" comes down to someone misunderstanding that the theoretical results of equilibrium thermodynamics only apply in equilibrium.
[a]: I'm intentionally not explaining that in full detail because it would take us too far away from the main point.

A: Before the light was shone on the black body the temperature of the black body was constant because the rate at which energy was radiated out to the surroundings was equal to the rate at which it absorbed energy from the surroundings.
When the light was shone on the black body continuously and absorbed by the black body this would represent an increase in the energy content of the black body and that would manifest itself as an increase in the temperature of the black body above that of its surroundings.
This would mean that the black body would start radiating out more energy than it did before and so there would be a net outflow of radiation from the black body.
Eventually, an equilibrium state would be achieved when the rate at which the black body is gaining energy from the light is balanced by the net loss of radiant energy by the black body to its surroundings.
This would require the black body to be at a higher temperature than that of its surroundings.


text:
Q: How to remove "Add to Windows Media Player list" from context menu When Windows Media Player is the default player in Windows, the right-click context menu for certain music files includes an item called "Add to Windows Media Player list". This is par-for-the-course with WMP, which includes tons of these context menu items. However, unlike other context menu items, which are usually relatively easy to get rid of because they  require the deletion of a handful of sub-keys in the same usual places, this particular item is a lot trickier to find, and I couldn't find anything on doing so via Google or this site.

So, how do you get rid of the "Add to Windows Media Player list" context menu item?

A: I am using Windows 10 preview insiders build. I have essentially taken away all media player entries from the context menu.

*

*Open control panel.

*Click program and features.

*Turn windows features on and off.

*scroll down to >Media Features> open that tab up.

*You will see a check box. Uncheck only the 'Media Player' check box.

*Click OK!
Done.
Enjoy.
These steps remove media player from your computer. Users are encouraged to try Groove Music.

A: I spent a good few hours yesterday searching through the registry, removing the item on my own machine and then writing scripts to automate the process of removing (and restoring) the problem context menu item. Note that I only tested on my Windows 7 machine running Windows Media Player 12, and even though I automate this process as much as I possibly can, there is always the risk that things can go wrong.
Therefore, before undertaking this tweak, create a Restore Point from which you can go back to in case anything does go wrong. If you run the scripts provided below and they don't do anything, simply restore your computer to that restore point to ensure you're in no worse a position than you were when you started.
Removing the "Add to Windows Media Player list" context menu item

It turns out the corresponding registry keys are hard to find because they're not in any of the usual places where, typically, a single registry key corresponds to all folders, or files of a specific type. Instead, there's a separate key for each extension that the context menu item appears on. These keys are located in registry paths with the following format:
HKEY_CLASSES_ROOT\WMP11.AssocFile.3G2\shell\Enqueue
...where .3G2 is the extension that the context menu item applies to, and Enqueue is the key that needs to be deleted to remove the menu item for all .3G2 files. There are 23 different extensions that these files need to be deleted for.
Also note that the key says WMP11 even though I'm running version 12 - this could mean that all versions of Windows Media Player are referred to as WMP11 in the Registry, and that, therefore, the scripts below will work for both previous and later versions of Windows 7. Either way, there's no harm in trying so long as you have a recent restore point to hand.
To remove the context menu items for each extension
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\WMP11.AssocFile.3G2\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.3GP\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.ADTS\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.AIFF\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.ASF\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.ASX\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.AU\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.AVI\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.M2TS\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.m3u\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.M4A\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.MIDI\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.MOV\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.MP3\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.MP4\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.MPEG\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.TTS\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.WAV\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.WAX\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.wma\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.WMV\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.WPL\shell\Enqueue]
[-HKEY_CLASSES_ROOT\WMP11.AssocFile.WVX\shell\Enqueue]

The above script will delete all the listed Enqueue keys, removing the Add to Windows Media Player list context menu item from all the file extensions it appears in. Copy-and-paste the script into a plain text file and give it the .reg extension. Then run the file and click Yes in the prompt that appears. To test, right-click on any music file. Et voila!

To restore the context menu items for each extension
So you've finally removed the Add to Windows Media Player list context menu item, only to decide that you've grown quite fond of it and want it back after all. No problem. Restoring the context menu item is a little more complicated than removing it, but it can still be done.
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.3G2\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.3G2\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.3GP\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.3GP\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.ADTS\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.ADTS\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.AIFF\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.AIFF\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.ASF\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.ASF\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.ASX\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.ASX\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.AU\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.AU\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.AVI\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.AVI\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.M2TS\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.M2TS\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.m3u\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.m3u\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.M4A\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.M4A\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.MIDI\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.MIDI\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.MOV\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.MOV\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.MP3\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.MP3\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.MP4\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.MP4\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.MPEG\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.MPEG\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.TTS\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.TTS\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.WAV\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.WAV\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.WAX\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.WAX\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.wma\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.wma\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.WMV\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.WMV\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.WPL\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.WPL\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.WVX\shell\Enqueue]
@="&Add to Windows Media Player list"
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,75,00,6e,00,72,00,65,00,67,00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,\
  2c,00,2d,00,39,00,38,00,30,00,30,00,00,00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.WVX\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

Once again, place the script in a .reg file, run it, and test.
I'd also appreciate people letting me know if any of these solutions worked for them on older or newer versions of Windows Media Player and/or Windows itself.

A: Here is the solution I found (Win10 Home V21H2) -
Solution Found:

*

*Remove Add to Windows Media Player list Context Menu in Windows 10 | Tutorials
This worked immediately without reboot. It performs the same as Hashim Aziz's example, with the following -
Working:
[-HKEY_CLASSES_ROOT\MediaCenter.WTVFile\shell\Enqueue]

[-HKEY_CLASSES_ROOT\Stack.Audio\shell\Enqueue]

[-HKEY_CLASSES_ROOT\Stack.Image\shell\Enqueue]

[-HKEY_CLASSES_ROOT\SystemFileAssociations\audio\shell\Enqueue]

[-HKEY_CLASSES_ROOT\SystemFileAssociations\Directory.Audio\shell\Enqueue]

[-HKEY_CLASSES_ROOT\SystemFileAssociations\Directory.Image\shell\Enqueue]

[-HKEY_CLASSES_ROOT\WMP.DVR-MSFile\shell\Enqueue]

[-HKEY_CLASSES_ROOT\WMP.WTVFile\shell\Enqueue]

[-HKEY_CLASSES_ROOT\WMP11.AssocFile.<extension>\shell\Enqueue] .. a bunch here! 23 for me

Courtesy Shawn Brink, thank you for posting this!


text:
Q: javascript / ajax question I'm wondering if anyone knows a javascript library where I could remotely login to a site, then browse pages upon logging in.
This is very easy with php's curl but I'm wondering if there is a javascript equivalent where I can execute multiple remote url's under a single http session.
Basically what I'm looking to do is post a username/password to one of my sites and then immediately post some other commands to a different url (same remote domain) using the authenticated session.
I haven't come across anything like this yet so I'm wondering if anyone can point me in the direction (if it's even possible). Can definitely be HTML5.

A: Due to same origin policy restrictions in browsers this is not possible using javascript. You need a server side script that will act as a bridge between your site and the remote sites. Then talk to this local script using AJAX.

A: There are some techniques available to bypass the same origin policy:
If you don't need to read the response of your POST calls, you can create a FORM by javascript with an action to any url (not limited to the same origin policy) like in this question: How do I send a cross-domain POST request via JavaScript?
But this means you rely only on session cookies for the security, this is open for XSS attacks.
As you own the other domain site, you could develop a small service that returns a JSON with the data you need, and use the JSONP technique, eg:
<script src="http://otherdomain/curl?url=page.html&callback=cb">
</script>

May be you could signin before using the POST technique above and sending a secret token that you reuse in the url to improve the security.
And finally there is a way to act/read on other pages using a bookmarklet.The idea is to inject in the other domain's page a script that can run with all the privileges, and send back information to your domain.
But this requires a manual action (click a link or a browser bookmark)


text:
Q: Polymorphism and Java collections I have an Interface Fruit and classes that implement the Interface as follows:
Apple implements Fruit
Banana implements Fruit

I have a legacy method that works off the Interface like
public String checkFruitColor(List<Fruit> fruit)
{
 ....
 ....
 return fruit.getColor();
}

I am trying to pass in List, List
The issue is that the method is not accepting a list of the Apple, Manago. It is asking for an object of Type Fruit.
Any suggestions will be much appreciated.

A: The actual question seems to be:
You have
interface Fruit
class Apple implements Fruit
class Banana implements Fruit

Then you have a method
public String checkFruitColor(List<Fruit> fruit)

And you have
List<Apple> apples = //something
List<Banana> bananas = //something

Now, you have made the (common) assumption and List<Apple> is a subclass of List<Fruit> because Apple is a subclass of Fruit.
But, that means we could do
List<Apple> apples = new ArrayList<Apple>();
List<Fruit> fruits = apples //all good as List<Apple> is a subclass of List<Fruit>
fruits.add(new Banana()); //we can add a Banana to a List<Fruit>
final Apple apple = apples.get(0); //a List<Apple> will always have apples.

OOPS!!
So, in fact, a List<Apple> is not related to a List<Fruit> - as far as the compiler is concerned they are completely different. Put in technical terms, List is invariant in its type.
In order to make what you have work, you need to tell the compiler that you want a List of some subtype of Fruit but you don't care what.
public String checkFruitColor(List<? extends Fruit> fruit)

This will allow you to pass your List<Apple> to checkFruitColor and access the items as instances of Fruit.
What you cannot do is add() to the list as you do not know what the type of the List is.

A: I assume that you already have a getColor()in your Fruit interface.
When a class implements an interface it agrees to the contract of the interface, meaning that it must provide an implementation for all methods in that interface.
Thus, both Apple and Banana will have their own implementation of getColor() and return a correct value. From here on you can just pass an Apple or Banana instance to your check method, since they are both classed as Fruit-instances since they implement Fruit.

A: You can pass an instance of Apple or Banana to your method checkFruitColor(Fruit fruit).
Apple apple = new Apple();
apple.setColor("Red");
List<Fruit> fruits = new ArrayList<Fruit>();
fruits.add(apple);
checkFruitColor(fruits);

Here you cannot directly call fruit.getColor(). You need to iterate through the list and invoke getter for each object.

A: Whats the problem in this, you have implemented it corrrectly:-
public String checkFruitColor(Fruit fruit)
{
 return fruit.getColor();
}

Fruit type in parameter restricts the accepted parameter type in the checkFruitColor() function to fruits. Which is implemented by Apple and Banana class, Hence you can pass both Apple and Banana object to it.
You can also pass mango if
Mango implements Fruit

If you want to get explicitly the apple object again in the method you can do this by
public String checkFruitColor(Fruit fruit)
    {
      Apple apple=(Apple)fruit; //casting the fruit to apple, make sure the object passed is apple only
      return apple.getColor();
    }

But if all fruits have getColor() method, then why do this, your approach is perfect.

A: This is a guess, but it could have to do with the fact that a variable of type List<Apple> is not valid when passed to a function expecting List<Fruit>.  This is due to the way Java handles generics.  The method would have to have been defined as expecting a variable of type List<? extends Fruit> and then it would work.  See this question: Is List<Dog> a subclass of List<Animal>? Why aren't Java's generics implicitly polymorphic?


text:
Q: Doxygen Java comment attributes in same type declaration I have lots of attributes of the same type, so I declare them sepparated by commas.
I'm trying to do something like this
private Label percentLbl,       //!< @brief percent desc.
              versionLbl;       //!< @brief version desc.

percentLbl is documented as it should, but versionLbl is added as Package attribute insead of Private attribute.


text:
Q: How can I determine whether a point is inside the path after the clipping path has been applied? I'm currently drawing an angular gradient using a method similar to the one shown by Rob's answer here. I have added an extension to CGContext to draw an angular gradient and would like it to handle the clipping path, so that callers can treat it similar to a method like fillPath(using:).
I have tried using func pathContains(CGPoint, mode: CGPathDrawingMode) on CGContext and func contains(CGPoint, using: CGPathFillRule, transform: CGAffineTransform) on the CGPath returned from the context.
Both of these appear to not use the clipping path, so my drawing goes outside the clipping area.
Is there a way to get either the path clipped already or a copy of the current clipping path so I can also check whether the pixel is contained inside that path also?

A: You should be able to check if the point is inside your unclipped path and check if the point is inside the clipping path.  The clipped path is the intersection fo the clipping path and your path, so a point is inside the clipped path only it its inside both your unclipped path and inside the clipping path.


text:
Q: how to add all arguments which are present in function? Could you please tell me how to add all arguments which are present in function ?I tried like that but not getting success
here is my code
function a(arrugemt){
sum=0;
    for(var i=0;i<arrugemt.length;i++){
       sum+=arrugemt[i]
    }
    console.log("sum:"+sum)
}

a(1,2)
a(1,3,5)
a(1,3,5,4,2,1)

Expected output :
3
9
16

A: All functions have a built in arguments object that contains all the arguments passed to the function
function a() {

    var sum = 0;

    for(var i=0; i<arguments.length; i++){
       sum += arguments[i] ;
    }

    console.log("sum:" + sum);
}

A: Here's a function (and you could even prototype it, if you wanted to)
function Sum() {
    var s = 0;
    for(var i=0;i<arguments.length;i++) {
        s += arguments[i];
    }
    return s;
}

Usage:
var total = Sum(31,12,46,78,19);

This is based on the arguments object that is built-in to JavaScript for methods. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments


text:
Q: Omitting chapter numbers in section headers using memoir I'm trying to find a way to remove the chapter number from the section headers when using memoir. Right now I'm using parts, but no chapters and zeroes appear in front of all section numbers. I tried reseting the chapter command like that:
\renewcommand\thesection{\arabic{section}}

or like that
\renewcommand\thesubsection{\arabic{section}.\arabic{subsection}}

and it didn't work as I expected. They both removed the chapter number, but also removed the subsection numbers. I'm sure there is a more clever way to do it.

A: Use the \counterwithout command:
\counterwithout{section}{chapter}

See §18.8 of the memoir manual.

A: Maybe you can use the option article and \chapter as the sectioning heading. An MWE:
\documentclass[article,a4paper]{memoir}

\begin{document}

\part{Test}

\chapter{Old Test}

\part{Next Test}

\chapter{New test}

\end{document}


text:
Q: How to correlate data from two separate tables I am a beginner at SQL. I am trying to write the following statement, but where user is in group (so where group_members.user_id = $_SESSION['user_id']).
SELECT `group_name`, `group_description` FROM `groups`

How do I write this sort of query that relates values from two different tables? Sorry if I haven't explained this well.
EDIT: When I use the query provided by Matthew Haugen, I seem to have the following difficulty: only one set of results is returned in an array.
This is my code for the function that does the query:
function group_summary(){
$sql = secure_mysqli("SELECT `group_name`,`group_description` FROM `groups` WHERE `group_id` IN (SELECT `group_id` FROM `group_members` WHERE `user_id` = ?)", array($_SESSION['user_id']), "i");
$groups = $sql;
return $groups;
}

And this is secure_mysqli:
function secure_mysqli($query, $values, $datatypes) {
    global $link;
    $stmt = mysqli_prepare($link, $query);
    if($stmt !== false){
    if(is_array($values)){ foreach ($values as &$value) $ref_values[] = &$value;
    call_user_func_array("mysqli_stmt_bind_param", array_merge(array($stmt, $datatypes), $ref_values));
    mysqli_stmt_execute($stmt);
    return @mysqli_fetch_assoc(mysqli_stmt_get_result($stmt));
}}}

A: It sounds like you want either this
SELECT * FROM Groups
WHERE Groups.Id IN (SELECT GroupId FROM Group_Members WHERE User_Id = @userid)

Or this
SELECT * FROM Groups
INNER JOIN Group_Members ON Groups.Id = Group_Members.GroupId
WHERE Group_Members = @userid

A: You will have to perform what is called a JOIN, it depends on what type you want, see here.
So you can do something like the following
SELECT A.GROUP_NAME
, B.GROUP_DESCRIPTION

FROM TABLE1 A
JOIN TABLE2 B
ON A.UNIQUE_KEY = B.UNIQUE_KEY

WHERE GROUP_MEMBERS.USER_ID = $_SESSION['USER_ID']


text:
Q: Preventing browser cache issues in ASP.NET, and testing Some users who are using IE8 are getting cached content, I added the below snippet to my global.asax.cs to force their browsers to get new content:
  HttpContext.Current.Response.Cache.SetAllowResponseInBrowserHistory(false);
  HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
  HttpContext.Current.Response.Cache.SetNoStore();
  Response.Cache.SetExpires(DateTime.Now);
  Response.Cache.SetValidUntilExpires(true);

Assuming the average user who doesn't know anything about modifying the cache settings in IE, how can I test if my changes will work?
I'm not really sure why they would be experiencing caching issues (getting stale content) when I am running the same browser on my computer? (being the naive programmer I am hehe)
Also, I want to make sure I am not wiping out their cookies or preventing their cookies from being stored etc.

A: The safest, most reliable way to force the re-download of a file (prevent caching) is to append a unique identifier, timestamp, or version number to the URL.
In fact, for my projects, I generally instruct clients to cache most resources (with exception for certain async/data requests and/or content with sensitive information) unless "instructed" to re-download, which is done by incrementing version numbers.


text:
Q: Characteristic function of the Dirac delta? What is the characteristic function of the Dirac delta function?
Is it $e^{i*0}=1$?

A: So the Dirac delta function has pmf:
$f(x;k_0) = \delta(x-k_0)\,,\quad -\infty<x<\infty,\: -\infty<k_0<\infty$
and cdf
$F(x;k_0)=\left\{\begin{matrix} 1, & \mbox{if }x\ge k_0 \\ 0, & \mbox{if }x<k_0 \end{matrix}\right.$
It is a discrete distribution with all probability at a single point.
Consider the definition of characteristic functions:
$\varphi_X(t) = \operatorname{E}\left[e^{itX}\right] = \int_{\mathbf{R}} e^{itx}\,dF_X(x)$
where the integral may be taken to be a Reimann-Stieltjes integral.
Now $F$ has a jump at $k_0$, so the integral is simply $e^{ik_0t}$.
[Alternatively, if you need a simpler argument, we could just use the definition of expectation for a discrete distribution and arrive at the same result.]
See also here.
You can also investigate the Fourier transform of the Dirac delta function from which the characteristic function immediately follows.


text:
Q: Map linetype to data in plotly figure with multiple subplots in python I'm trying to map linetype to a categorical data column in a pandas dataframe in a plotly figure with multiple subplots.
I have a dataframe df equivalent to:
from datetime import datetime
import numpy as np
df = pd.DataFrame({'date':pd.date_range(start='01/01/2020',periods=100),
                   'y_one':np.linspace(1,100,100),
                   'y_two':np.linspace(100,1,100)})
df['today'] = df.date.apply(lambda date: 'the_future' if date > datetime.today() else 'the_past')

I need to plot multiple lines (y_one, y_two) over date_range. I'd like to have the lines solid for the past and dashed for the future, i.e. have linetype mapped to df['today'].
The plotly code I've implemented so far is:
import plotly.graph_objects as go
from plotly.offline import plot
fig = go.Figure()
fig.add_trace(
    go.Scatter(
        x=df["date"],
        y=df["y_one"],
        mode="lines",
        line=dict(color='black',
                    )
        )
    )
fig.add_trace(
    go.Scatter(
        x=df["date"],
        y=df["y_two"],
        mode="lines",
        line=dict(color='red'),
        )
    )
plot(fig)

Is there a way to implement this use case in plotly with multiple subplots?

A: Possibly not the most elegant solution but you can eventually work with loops if you have a large number of columns to plot you can consider to use a loop.
import plotly.graph_objects as go
import pandas as pd
import numpy as np
df = pd.DataFrame({'date':pd.date_range(start='01/01/2020',periods=100),
                   'y_one':np.linspace(1,100,100),
                   'y_two':np.linspace(100,1,100)})

df["is_future"] = df["date"]>pd.datetime.today()

fig = go.Figure()
fig.add_trace(
    go.Scatter(
        x=df[df["is_future"]==False]["date"],
        y=df[df["is_future"]==False]["y_one"],
        mode="lines",
        legendgroup="y_one",
        name = "y_one",
        line=dict(color='black',)))

fig.add_trace(
    go.Scatter(
        x=df[df["is_future"]==True]["date"],
        y=df[df["is_future"]==True]["y_one"],
        mode="lines",
        legendgroup="y_one",
        name = "y_one",
        showlegend=False,
        line=dict(color='black',dash='dash')))

fig.add_trace(
    go.Scatter(
        x=df[df["is_future"]==False]["date"],
        y=df[df["is_future"]==False]["y_two"],
        mode="lines",
        legendgroup="y_two",
        name = "y_two",
        line=dict(color='red'),))

fig.add_trace(
    go.Scatter(
        x=df[df["is_future"]==True]["date"],
        y=df[df["is_future"]==True]["y_two"],
        mode="lines",
        legendgroup="y_two",
        name = "y_two",
        showlegend=False,
        line=dict(color='red', dash='dash'),))

fig.show()


text:
Q: Having a problem integrating this google calendar keep getting null setting src (Netsuite) this is my code, and I am trying to be able to switch between different calendars. But it wont let me
function googleCalendars(portlet, column) {
    var calendarSelect;
     portlet.setTitle("Sportex Calendars");
     calendarSelect = portlet.addField("calendar_select", "select", "Select Calendar");
     calendarSelect.setHelpText("Select a calendar");
     calendarSelect.addSelectOption("humanresources", "Human Resources");
     calendarSelect.addSelectOption("vacation", "Vacations");
     calendarSelect.addSelectOption("appointments", "Appointments");
     portlet.addField("calendar", "inlinehtml", "Some HTML").setLayoutType("outsidebelow", "startrow").setDefaultValue("" + "
" + '<<iframe src="https://calendar.google.com/calendar/embed?height=600&wkst=1&bgcolor=%23ffffff&ctz=America%2FPhoenix&showCalendars=0&src=c3BvcnRleGNhbGVuZGFyQGdtYWlsLmNvbQ&src=YWRkcmVzc2Jvb2sjY29udGFjdHNAZ3JvdXAudi5jYWxlbmRhci5nb29nbGUuY29t&src=ZW4udXNhI2hvbGlkYXlAZ3JvdXAudi5jYWxlbmRhci5nb29nbGUuY29t&src=aHQzamxmYWFjNWxmZDYyNjN1bGZoNHRxbDhAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ&color=%23039BE5&color=%2333B679&color=%230B8043&color=%23B39DDB" style="border:solid 1px #777" width="1200px" height="600px" frameborder="1" scrolling="no">' + "
");
     portlet.addField("resizer", "inlinehtml", "CSS Overrides for Portlet Content Resizing").setDefaultValue("" + "");
     portlet.setScript("customscript_googlecalendar_client")}
function fieldChange(type, name) {
if(name == "calendar_select") {
if(nlapiGetFieldValue("calendar_select") == "humanresources") {
  document.getElementById("cal_frame").src = "https://calendar.google.com/calendar/embed?src=833451c59dcb80fff2263f6cfb17fa5ae246b70d97588f1ef46ffbc04658433b%40group.calendar.google.com&ctz=America/Phoenix"
}else {
  if(nlapiGetFieldValue("calendar_select") == "vacation") {
    document.getElementById("cal_frame").src = "https://calendar.google.com/calendar/embed?src=f61df42873f6d090babb273c46cd295f12795c08647b8c18088d25691cb653fb%40group.calendar.google.com&ctz=America%2FPhoenix"
  }else {
    if(nlapiGetFieldValue("calendar_select") == "appointments") {
      document.getElementById("cal_frame").src = "https://calendar.google.com/calendar/embed?src=clto48tqq2vmp19sfuqra8oprc%40group.calendar.google.com&ctz=America/Phoenix"
    }
  }
}}nlapiResizePortlet()};


text:
Q: Is it possible to run adobe master collection cs6 in ubuntu I do video editing, music making, web design, and photo editing. I don't want to have to use another application to do what I can get from Adobe. I also want to switch to Ubuntu. I have windows 8 at the moment.

A: Well you have 2 options on doing that.  The first option is using Wine.  Wine allows you to run Windows applications under Ubuntu.
The second option is by using virtual machines.  A virtual machine is a separate and independent software instance that includes a full copy of an operating system and application software.  You can have more that on VM running at the same time depending on your hardware configuration.
You can use VirtualBox, which is free, or VMWare Player, which is also free.  VMWare offers a paid program called VMWare Workstation.


text:
Q: Auto identify Height in dotdotdot plugins How to set auto height from css in jquery dotdotdot plugins.
note: I use dotdotdot plugins.
For Example:

.dot{
 overflow: hidden;
 width: 150px;
 display: inline-block;
}

.paragraph-1{
 height: 100px;
 background-color: tomato
}

.paragraph-2{
 height: 50px;
 background-color: lightblue
}

.paragraph-3{
 height: 200px;
 background-color: yellow

}

Lorem ipsum dolor sit amet, munere tamquam propriae an pro, sit dicam denique an, eum nonumes electram te. Eum laudem denique fierent ne, admodum suscipit nam in. Ne pri movet saepe periculis. Sea ancillae noluisse no.

Lorem ipsum dolor sit amet, munere tamquam propriae an pro, sit dicam denique an, eum nonumes electram te. Eum laudem denique fierent ne, admodum suscipit nam in. Ne pri movet saepe periculis. Sea ancillae noluisse no.

Lorem ipsum dolor sit amet, munere tamquam propriae an pro, sit dicam denique an, eum nonumes electram te. Eum laudem denique fierent ne, admodum suscipit nam in. Ne pri movet saepe periculis. Sea ancillae noluisse no.

 Ipsum legendos concludaturque cu mel, iudico eligendi vel at, prima partem democritum et pro. Ne dolor ocurreret eos, in sea periculis aliquando. Mei ex vitae nostrum pertinacia. An utroque nominati liberavisse eos, postea constituto duo ne. Ea vide doctus quo, ceteros referrentur contentiones an sit. Eu causae feugiat pertinacia has.

 Duo possit integre petentium cu. At dicat suavitate eum, legere commune ius an. Qui in accusam ullamcorper. Labores voluptatum id eos. Ne oratio inermis volumus duo, nec ei illum impetus.

 Et qui dictas vivendum, ad ius dicit denique, partem populo apeirian cum at. Ad vix odio suscipiantur. In euismod efficiendi mei, ut impetus sapientem vulputate usu, iudico persius mandamus sed ex. Vis at velit percipit, eum ex vitae explicari pertinacia.

I want to run this code for all elements
$('.dot').dotdotdot();

A: You can use this code:
$('.dot').each(function () {
    let dot_height = $(this).height();
    $(this).dotdotdot({
        height: dot_height,
    });
});


text:
Q: How to customize spring webservice's PayloadValidatingInterceptor response message? I have a java web service application built with jaxb and spring webservice.
I have a complex type in a xsd like this:
...

<complexType name="GetRecordsRequest">
    <sequence>
        <element name="maxRecords" type="int" maxOccurs="1" minOccurs="1"/>
    </sequence>
</complexType>

...

Using xjc, I had the jaxb class generated from xsd:
public class GetRecordsRequest {
    protected int maxRecords;

    public int getMaxRecords() {
        return maxRecords;
    }

    public void setMaxRecords(int value) {
        this.maxRecords = value;
    }
}

I used PayloadValidatingInterceptor in spring context.xml to make sure user can't input anything besides integer for maxRecords:
<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping">
    <property name="interceptors">
        <list>
            <ref local="validatingInterceptor" />
        </list>
    </property>
</bean>

<bean id="validatingInterceptor" class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
    <property name="schema" value="/WEB-INF/schemas/webservice.xsd" />
    <property name="validateRequest" value="true" />
    <property name="validateResponse" value="true" />
</bean>

When I entered this soap request xml in Soap UI:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.test.com/ns1">
   <soapenv:Header/>
   <soapenv:Body>
      <ns1:GetRecordsRequest>
         <ns1:maxRecords></ns1:maxRecords>
      </ns1:GetRecordsRequest>
   </soapenv:Body>
</soapenv:Envelope>

The response message I got is:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode>SOAP-ENV:Client</faultcode>
         <faultstring xml:lang="en">Validation error</faultstring>
         <detail>
            <spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">cvc-datatype-valid.1.2.1: '' is not a valid value for 'integer'.</spring-ws:ValidationError>
            <spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">cvc-type.3.1.3: The value '' of element 'cis:maxRecords' is not valid.</spring-ws:ValidationError>
         </detail>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

You can see the result is two lines cryptic  message for just one field. Can I make the response message more prettier by making just one line? Is there a way to customize the validation error response message?

A: You can customize the validation error message by extending PayloadValidatingInterceptor and overriding handleRequestValidationErrors. We can set the custom error message in the body of messageContext.
1) Instead of the SOAP Fault for request validation errors, you can return custom xml response with validation error message.
2) SAXParseException[] errors contains the request validation errors. You can choose to return only one error in response. (or) For some predefined errors, you can return custom error message rather than the one returned in SAXParseException.
/**
* The Class CustomValidatingInterceptor.
*/
public class CustomValidatingInterceptor extends PayloadValidatingInterceptor{

/* (non-Javadoc)
 * @see org.springframework.ws.soap.server.endpoint.interceptor.AbstractFaultCreatingValidatingInterceptor#handleRequestValidationErrors(org.springframework.ws.context.MessageContext, org.xml.sax.SAXParseException[])
 */
@Override
protected boolean handleRequestValidationErrors(MessageContext messageContext, SAXParseException[] errors) throws TransformerException {
    JAXBContext jaxbContext;
    StringWriter stringWriter = new StringWriter();
    ResponseTransactionDetail transactionDetail = null;

    for (SAXParseException error : errors) {
        logger.debug("XML validation error on request: " + error.getMessage());
    }
    if (messageContext.getResponse() instanceof SoapMessage) {

        /**
         * Get SOAP response body in message context (SOAP Fault)
         */

        SaajSoapMessage soapMessage = (SaajSoapMessage)messageContext.getResponse();
        SoapBody body = soapMessage.getSoapBody();

        // marshal custom error response to stringWriter

        /**
        * Transform body
        */
        Source source = new StreamSource(new StringReader(stringWriter.toString()));
        identityTransform.transform(source, body.getPayloadResult());
        stringWriter.close();
    }
    return false;
}

A: You can customize the validation error response by using the methods of the AbstractValidatingInterceptor (PayloadValidatingInterceptor is an implementation of this abstract class) namely:

*

*setDetailElementName(QName detailElementName)

*setFaultStringOrReason(String faultStringOrReason)
partial example:
public final class MyPayloadValidatingInterceptor
extends PayloadValidatingInterceptor {

    @Override
    protected Source getValidationRequestSource(WebServiceMessage webSerMessage_) {
        _source = webSerMessage_.getPayloadSource();
        validateSchema(_source);
        return _source;
    }

    private void validateSchema(Source source_) throws Exception {
        SchemaFactory _schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        Schema _schema = _schemaFactory.newSchema(getSchemas()[0].getFile());

        Validator _validator = _schema.newValidator();
        DOMResult _result = new DOMResult();
        try {
            _validator.validate(source_, _result);
        } catch (SAXException _exception) {
            // modify your soapfault here
        }
    }
}


text:
Q: How do I update a mapping in ElasticSearch with Java? I have an existing mapping in Elastic Search and this is in live production. Currently, whenever I update the mapping someone else has to manually drop the index and insert reindex everything again. We want a way for Elastic Search to automatically handle update/changed mappings. How can we make this possible with Java?
EDIT
The procedure we have for loading the mapping during startup of the application is this:

*

*Check if there's an existing mapping

*If not load new mapping.

As you can see this is very simplistic and as such it will never pick up changed fields/updated mappings. Is it a bad idea to reload the mapping every time the application starts up? Is there some overhead to this? Is there an alternative procedure so it accounts for updated mappings? More importantly, is this the correct way of doing it?

A: There is not a way to update mapping. You can add new fields, but that is it. If you do want to change the mapping the best way is to copy everything to a new index with the changed mapping. Make sure your application uses an alias that points to the current index

*

*Create a new index with new mapping

*Use scan/scroll/bulk to copy all data to new index

*Move alias to new index

*remove old index

I have created a tool to help you with this. It currently uses a GUI, but it is not to hard to copy the right classes to embed it in your own application. You can read about it more in this blog:
http://amsterdam.luminis.eu/2015/01/13/maintain-elasticsearch-the-indexes/
Also look out for the upcoming reindex api, but here yet but I heard good things about it.

A: Not only can you add new fields and insert their values, but you can also update the values of your existing fields.
Use the UpdateRequest class to update the records that you wish (ids) and change the values of certain fields as follows:
updateRequest.doc(jsonBuilder().startObject().field("gender", "male").endObject());

On the other hand, if you need to create new fields in the existing mapping you can use again the same class as above and a new field will be automatically created:
updateRequest.doc(jsonBuilder().startObject().field("newField", "testContent").endObject()

If the field "newField" doesn't exist, then a new one will be created. Although you can create it, I doubt that you can specify the type of this new field (after reading the documentation).
Furthermore, I am not entirely sure what you mean by updating the mapping. even though you can create new fields and update the old ones, if you want to change the type of an existing field, for instance, I don't think it is possible. Have a look also here about how to use PUT to update an existing mapping.


text:
Q: DB regex issue, to provide the constraint on DB column How to make the Column in Oracle DB which contains All Numeral values except certain:
I know the solution is based on some regex like to except all values we have the regex '*'.

A: Try this:
CREATE TABLE tt (
  b NUMBER,
  CONSTRAINT special_numbers_chk CHECK (TRIM(REGEXP_REPLACE(to_char(b,'99999999999999999'), '[01254]*', '')) IS NULL)
);

INSERT INTO TT VALUES (122);
1 row(s) inserted.

INSERT INTO TT VALUES (123);
ORA-02290: check constraint (XXXX_DVLP.SPECIAL_NUMBERS_CHK) violated

select * from tt;
   b
-------
  122

I use explicit conversion to char (specified the mask) to prevent sql injection and not to be depended from the DB environment, thus I need to get rid of spaces from the the conversion result to get null value, this is why I use TRIM.
P.S.: specify your sequence of numbers in the square brackets


text:
Q: deploy mvc 3 site to azure using custom build script Every example I've seen on how to deploy an MVC application to Windows Azure is using the Visual Studio Publish tool, my problem is that my application is deployed with a custom msbuild file (.proj).
I cannot change the way it is deployed, so is there a way to deploy to azure without publishing? Something like copying the directory result of my custom build to some azure directory.

A: Thanks for letting us know that it is for Windows Azure Web Role. You can use Automated Build and Deployment with Windows Azure SDK 1.6 blog to deploy directly from ccproj file. Even if it is written with SDK 1.6, you sure can use exact details with SDK 1.7 as well.

You can also take a look at Using MSBuild to deploy to multiple Windows Azure environments blog as well.


text:
Q: Not able to assign custom viewcontroller in storyboard I am absolutely clueless what happened to Xcode. I'm not even able to assign a custom ViewController to a storyboard ViewController. I get the error:
"Unknown class vcTest in Interface Builder file...........
this class is not key value coding-compliant for the key label"
vcTest is my custom ViewController. I saw several solutions to this in other posts but my problem seems to be a lot different.
In this test app, I have 1 ViewController:
import Foundation
import UIKit

class vcTest: UIViewController {

    @IBOutlet weak var label: UILabel!

}

The only ViewController in the storyboard is assigned to this ViewController, having 1 label outlet. vcTest does show up under: Build Phases -> Compile Sources. I must be totally missing something here or Xcode is absolutely broken. I even tried to uninstall and reinstall Xcode which did not help.... I have an other ungoing project were I discovered this issue and now it even comes up in this simple test app. What is going on here?
Note: this happened after upgranding from Yosmite 10.10 to 10.10.1.
edit:
so this is what i found out til now:
i somehow created one project where this does not happen, on all other projects it does. it did not specify anything special in the working project. what i noticed between the working and "codewise similar" non working is the module listed in storyboard. the working one shows : Current - projectname and the none working one shows None. i attached a screenshot.
how can i change the model to current model?
(can not post images here is a link):
http://s14.directupload.net/images/141119/xn8jb7cw.jpg


text:
Q: How to deliver information to webworker when it requests it I have a piece of code that needs to execute on a webworker which needs to get feedback from something in the main thread (basically a get operation from a KVS). Unfortunately, I cannot use local storage because it is not accessible from a webworker. Is there any other way I can convey information from the main thread to the webworker such that when the webworker wants this piece of information, it can have it?
Another note is that I am using brython for everything, and I'm not sure if that prevents me from using traditional JavaScript solutions like IndexedDB. Guidance would be much appreciated.

A: SharedArrayBuffer is a way to share memory between the main thread and webworker.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer