text:
Q: Adding users via powershell script gives error I am trying to ad users from a csv file to an OU with a powershell script but getting some error?
I'll post the line that I am using for adding the users. And I have checked that the retrieval path for the csv file is correct..
New-ADUser -SamAccountName $login -Name $namn -GivenName $Fname -Surname $Enamn -Department $user.Department -Division $user.Division -Title $user.role -Description $user.Extension -Office $user.Office -UserPrincipalName $login"@hqad.local" -path "OU=Carb_users,DC=HQAD,DC=Local" -EmailAddress $mail -AccountPassword (ConvertTo-SecureString -AsPlainText "Syp9393" -Force) -Enable $True

Error output:
New-ADUser : The server is unwilling to process the request
At C:\Users\Administrator\Desktop\Userscript.ps1:37 char:1
+ New-ADUser -SamAccountName $login -Name $namn -GivenName $Fname -Surn ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (CN=Carl Malm,OU...C=HQAD,DC=Local:String) [New-ADUser], ADException
    + FullyQualifiedErrorId : ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.NewADUser

Happy for any help!


text:
Q: contentResolver() openInputStream() - FileNotFoundException (permission denied) When I try to process uri ("file" scheme) I get a FileNotFoundException (Permission denied). It works ok for "content" scheme but not for "file" scheme.
    protected void onNewIntent (Intent intent) {
    // new ProcessIncomingDataTask().execute(intent);

    try {
        Uri uri = intent.getData();
        if ( uri != null ) {
            InputStream in = null;
            if ( uri.getScheme().equals("file") ) {
                in = getContentResolver().openInputStream(uri);
            }
        }
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    super.onNewIntent(intent);
}

What's wrong?
UPD.
Intent filter:
<intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:mimeType="*/*" android:scheme="content" android:host="*" android:pathPattern=".*\.pgn" />
            <data android:mimeType="*/*" android:scheme="content" android:host="*" android:pathPattern=".*\.PGN" />
            <data android:mimeType="*/*" android:scheme="file" android:host="*" android:pathPattern=".*\.pgn" />
            <data android:mimeType="*/*" android:scheme="file" android:host="*" android:pathPattern=".*\.PGN" />
        </intent-filter>

"tell how you obtained that path"
Uri URI = intent.getData()

"Also use File.exists() and File.canRead()"
File.exists(); // gives "true"
File.canRead(); // gives "false"

redpajama_set_name: RedPajamaStackExchange


text:
Q: Algebra of matrix coefficients in the dual of a hopf algebra, confusing verification Let $H$ be a Hopf-algebra, and let $V$ be a finite dimensional $H$-module (a module for the algebra structure of $H$).
For $f \in V^*$ and $v \in V$, we get $c^V_{f,v} \in H^*$ via $c^V_{f,v}(u) = f(u.v)$.
These are apparently called matrix coefficients, a keyword that google doesn't know much about.
The text I am reading claims:
$c^V_{f,v} c^W_{g,w} = c^{V \otimes W}_{f \otimes g, v \otimes w}$
But this is not what I get:
$c^V_{f,v} c^W_{g,w}(u) = f(u.v) g(u.w)$
while
$c^{V \otimes W}_{f \otimes g, v \otimes w}(u) = f \otimes g( \Delta(u) . v \otimes w)$, where $\Delta : H \to H \otimes H$ is the comultiplication, and $f \otimes g (v \otimes w) = f(v) g(w)$.
It's not necessarily the case that the comultiplication has $\Delta(u) = u \otimes u$, so I don't see how to conclude. Maybe I am misunderstanding something?
I would appreciate it very much if someone familiar with this material could clarify this.

A: For $x \in H$ with $x = \sum_{i=1}^n x^{(1)}_i \otimes x^{(2)}_i$ we have
\begin{align*}
 c^{V \otimes W}_{f \otimes g, v \otimes w}(x)
&= m_k\left((f \otimes g)(x.(v \otimes w))\right)
 = m_k\left((f \otimes g)\left(
    \sum_{i=1}^n (x^{(1)}_i.v) \otimes (x_2^{(2)}.w)
   \right)\right) \\
&= \sum_{i=1}^n f(x^{(1)}_i.v) g(x^{(1)}_2.w)
 = \sum_{i=1}^n c^V_{f,v}(x^{(1)}_i) c_{g,w}(x^{(2)}_i)
 = (c^V_{f,v} c^W_{g,w})(x)
\end{align*}
where $m_k \colon k \otimes k \to k$ denotes the multiplication of the ground field.
You have to be careful with the product $c^V_{f,v} c^W_{g,w}$, as this is not taken pointwise: Because $H$ is in particular a coalgebra the dual $H^*$ naturally carries an algebra structure with the multiplication
$$
 H^* \otimes H^*
 \hookrightarrow (H \otimes H)^*
 \xrightarrow{\Delta^*} H^*,
$$
which gives us for all $f,g \in H^*$ and $x \in H$ with $\Delta(x) = \sum_{i=1}^n x^{(1)}_i \otimes x^{(2)}_i$ that
$$
 (fg)(x) = \sum_{i=1}^n f(x^{(1)}_i) g(x^{(2)}_i).
$$
(As already pointed out this product on $H^*$ also coincides with the convolution product of $\mathrm{Hom}(H,k)$ where we take $H$ as a coalgebra and $k$ as an algebra.)


text:
Q: Prove that if $p(A)=0$ where A is a matrix of a linear operator ($A \in L(V)$), $p(\lambda)=0$ if $\lambda \in \sigma(A)$ I think it's all in the title. $p$ is some random polynomial.
I don't know how to approach this one. I've tried taking the roots of $p$, placing them on the diagonal of a new matrix and reasoning that the linear operator of the new matrix has a common specific value (if it's called that in English) with A, but I have no idea how to prove that that specific value is also a root of $p$.

A: Considering $\sigma(A)$ denotes the set of characteristic(eigen) values of A
As $\lambda$ is an eigen value, $\exists 0\ne v\in V$ such that $Av=\lambda v$
Note that $A^kv=\lambda^k v,\forall k\in N$(easy to prove using Induction)
Let $p(x)=\sum_{i=0}^{n}a_ix^i,a_i\in R$
Then we have ,
$p(A)=\sum_{i=0}^{n}a_iA^i$
So we have ,
$p(A)v=\sum_{i=0}^{n}a_iA^iv=\sum_{i=0}^{n}a_i\lambda^iv=p(\lambda)v$
Given $p(A)=0$
$\Rightarrow 0=p(A)v=p(\lambda)v$
As $v\ne 0\Rightarrow p(\lambda)=0$

A: Hint: if $v$ is an eigenvector for eigenvalue $\lambda$, what is $p(A) v$ for polynomials $p$?

A: Another way to look at this problem is noticing that $p$ has to be a (polynomial) multiple of the minimal polynomial of $A$. Now what happens to the minimal polynomial if you apply it on an Eigenvalue of $A$? What happens consequently to $p$ ?

A: I'll give you an example ($p(x)=x^2+x+1$) and leave the general case to you.
Suppose that $\lambda\in\sigma(A)$ with corresponding eigenvector $u\neq0$. Then
$$
0=p(A)u=A^2u+Au+u=A(\lambda u)+\lambda u+u=
\\
\lambda Au+\lambda u+u=\lambda^2u+\lambda u+u=(\lambda^2+\lambda+1)u=p(\lambda)u.
$$
Since $u\neq0\Rightarrow p(\lambda)=0$.


text:
Q: Mp3 streaming/downloading website - apache server memory issue I have a website, in which users can upload mp3 files (uploadify), stream them using an html5 player (jplayer) and download them using a php script (www.zubrag.com/scripts/).
When a user uploads a song, the path to the audio file is saved in the database and i'm using that data in order to play and show a download link for the song.
The problem that i'm experiencing is that, according to my host, this method is using a lot of memory on the server, which is dedicated.
Link to script: http://pastebin.com/Vus8SRa7
How should I handle the script properly? And what would be the best way to track down the problem? Any ideas on cleaning up the code?
Any help much appreciated.

A: I would recommend storing your files on disk (named something random [check for collisions!] or sequential, without file extension, and outside of the doc root), and only store information in your DB.  It's much easier to stream a file from disk this way than it is out of a database result.
When you retrieve an entire file's contents out of a database result, that data has to be in memory.  readfile() doesn't have this issue.  Use headers to return the original file name when sending the file back to the client, if you wish.

A: I would suggest you not to buffer the content when you are writing binary data of the MP3 onto your HTTP output. That way you'd be saving a lot on physical and virtual memory usage.


text:
Q: php Encoding: Violation of encoding rules I have a PHP script that is doing a SOAP request to the server. PHP errors out with
SOAP-ERROR: Encoding: Violation of encoding rules

Initial instinct is there is an issue with my request. I took a network capture of the request and sent it to the web server via curl and it seems to have come back OK. The request that is sent by PHP soap and curl is the same which is:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.example.com/Integrics/Enswitch/API" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:download_music_file><username xsi:type="xsd:string">dovid</username><password xsi:type="xsd:string">passsowrd</password><music xsi:type="xsd:int">45</music><file xsi:type="xsd:int">1</file><checking xsi:type="xsd:int">0</checking></ns1:download_music_file></SOAP-ENV:Body></SOAP-ENV:Envelope>

The response is:
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><download_music_fileResponse xmlns="http://www.example.com/Integrics/Enswitch/API"><gensym><name xsi:type="xsd:string">music_45_1.wav</name><data xsi:type="xsd:base64Binary">BASE 64 REMOVED</data><mimetype xsi:type="xsd:string">audio/x-wav</mimetype></gensym></download_music_fileResponse></soap:Body></soap:Envelope>

The php code that does the quest is:
<?PHP

ini_set("soap.wsdl_cache_enabled", "0");

$uid = 'dovid';
$pass = 'password';
$func = 'download_music_file';
$soap = new SoapClient("enswitch_3.9.wsdl", array('trace' => true, 'exceptions' => false, 'keep_alive' => false, 'connection_timeout' => 15));
$result1 = $soap->$func($uid, $pass, 45, 1,0);

if(isset($soap->__soap_fault)){
echo 'There was an error connecting via SOAP. Below is the error:';
    print_r($soap->__soap_fault->faultstring);
    }
?>


text:
Q: can you use castle dynamic proxies on web services references? Is it possible to create a dynamic proxy on the a web service reference that has been added to a visual studio project?
I've added the web service reference in the normal way and tried to create a dynamic proxy using castle to wrap the method invocation in a try/catch to translate any SoapExceptions, but on running it I'm getting a lot of errors around non serializable classes?
has anyone done anything like this?
thanks

A: yes, this should be possible.
What errors are you getting? Which classes you're trying to serialize that won't serialize?
It's probably better to discuss it on Castle users group


text:
Q: Ship to different address check box not showing up in woocommerce I need to enable and show ship to different address check box in WordPress woo-commerce. I have tried this code but did't worked:
add_filter( 'woocommerce_ship_to_different_address_checked', '__return_true' );

A: The add_filter function can accept 4 arguments, however you are only using 2, see here for the functional documentation. If you have been told to add that code into your functions.php file but it is not working then it may just be that the 3rd argument has not been set like so:
add_filter('woocommerce_ship_to_different_address_checked', '__return_true', 999);

Seeing as 999 is likely higher than the others, this should do the trick. However I also reccommend that you check to make sure that "Force shipping to the customer billing address" has not been enabled in WooCommerce -> Shipping -> Shipping Options.


text:
Q: Finding a reliable P-value and pseudo $R^2$ for beta regression in R (betareg model) I'm having trouble with finding a reliable P-value for my beta regression in R. I thought it was as easy as reading it from the summary table, but as it turns out it is not. This website https://rcompanion.org/handbook/J_02.html tells me that the appropriate test to find the p-value for a betareg model is the lrtest from the lmtest package. According to other forums and websites the p_value (sjstats package), joint_tests (emmeans package), and nagelkerke (rcompanion package) could also be used.
Let me first introduce you to my model. I am investigating the influence of percentage overhead cover on the proportion of birds foraging. For this question I have made up three data sets, 1) realistic data, 2) random data, and 3) extreme data. I made these data sets because I wanted to check the P-values (for which I assume only the realistic data must have a significant P-value, if any). These data + their betareg models look like this.

My R script + output looks like this.
df <- data.frame(ProportionBirdsScavenging = c(0.666666666666667, 0.40343347639485, 0.7, 0, 0, 0.0454545454545455, 0.25, 0.707070707070707, 0.629213483146067, 0.882352941176471, 0.942857142857143, 0.451612903225806, 0.0350877192982456, 0.5, 0.484375, 0, 0.0208333333333333, 0.240740740740741, 0.804568527918782, 0.666666666666667, 1, 1, 1, 0.552238805970149, 0.2, 0, 0, 0, 0, 0, 0.12972972972973, 0.0894117647058824, 0.576158940397351, 0, 0),
                 pointWeight = c(3,233,10,89,4,22,44,99,89,17,35,341,57,36,128,39,144,54,394,12,46,229,55,67,5,28,2,160,124,294,555,425,302,116,48),
                 OverheadCover = c(0.7, 0.671, 0.6795, 0.79, 0.62, 0.62, 0.6413, 0.089, 0.4603, 0.04, 0.0418, 0.46, 0.5995, 0.532, 0.65, 0.6545, 0.74, 0.74, 0.02, 0.02, 0, 0, 0, 0.45, 0.8975, 0.92, 0.898, 0.89, 0.86, 0.69, 0.755, 0.775, 0.585, 0.585, 0.55),
                 Random_OverheadCover = c(0.3021, 0.6397, 0.7437, 0.9408, 0.9532, 0.4218, 0.8518, 0.2117, 0.5945, 0.531, 0.7656, 0.8952, 0.3127, 0.5513, 0.5619, 0.6332, 0.0051, 0.0388, 0.1877, 0.964, 0.2192, 0.4307, 0.5684, 0.062, 0.071, 0.0733, 0.6637, 0.5746, 0.4933, 0.4182, 0.8617, 0.7269, 0.7009, 0.655, 0.7696),
                 Extreme_OverheadCover = c(1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1))

# REALISTIC DATA
df_realistic <- df
df_realistic$ProportionBirdsScavenging <- (((df_realistic$ProportionBirdsScavenging*(length(df_realistic$ProportionBirdsScavenging)-1))+0.5)/length(df_realistic$ProportionBirdsScavenging)) # Transform the data so all data is (0,1).
mybetareg_realistic <- betareg(ProportionBirdsScavenging ~ OverheadCover, data = df_realistic, weights = pointWeight, link = "logit")
summary(mybetareg_realistic)
# Call:
#   betareg(formula = ProportionBirdsScavenging ~ OverheadCover, data = df_realistic, weights = pointWeight,
#           link = "logit")
#
# Standardized weighted residuals 2:
#   Min       1Q   Median       3Q      Max
# -27.4104  -6.9053   1.5775   5.3971  27.4439
#
# Coefficients (mean model with logit link):
#   Estimate Std. Error z value Pr(>|z|)
# (Intercept)    1.69853    0.02563   66.26   <2e-16 ***
#   OverheadCover -4.28684    0.04365  -98.22   <2e-16 ***
#
#   Phi coefficients (precision model with identity link):
#   Estimate Std. Error z value Pr(>|z|)
# (phi)   8.7909     0.1861   47.23   <2e-16 ***
#   ---
#   Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#
# Type of estimator: ML (maximum likelihood)
# Log-likelihood:  3294 on 3 Df
# Pseudo R-squared: 0.6607
# Number of iterations: 12 (BFGS) + 1 (Fisher scoring)

parameters::p_value(mybetareg_realistic)
# Parameter p
# 1   (Intercept) 0
# 2 OverheadCover 0
# 3         (phi) 0

nagelkerke(mybetareg_realistic)
# $Models
#
# Model: "betareg, ProportionBirdsScavenging ~ OverheadCover, df_realistic, pointWeight, logit"
# Null:  "betareg, ProportionBirdsScavenging ~ 1, df_realistic, pointWeight, logit"
#
# $Pseudo.R.squared.for.model.vs.null
# Pseudo.R.squared
# McFadden                         -2.69615e+00
# Cox and Snell (ML)                1.00000e+00
# Nagelkerke (Cragg and Uhler)     -1.53209e-24
#
# $Likelihood.ratio.test
# Df.diff LogLik.diff  Chisq p.value
# -1     -2587.3 5174.6       0
#
# $Number.of.observations
#
# Model: 35
# Null:  35
#
# $Messages
# [1] "Note: For models fit with REML, these statistics are based on refitting with ML"
#
# $Warnings
# [1] "None"
#
# Warning message:
#   In betareg.fit(X, Y, Z, weights, offset, link, link.phi, type, control) :
#   no valid starting value for precision parameter found, using 1 instead

lrtest(mybetareg_realistic)
# Likelihood ratio test
#
# Model 1: ProportionBirdsScavenging ~ OverheadCover
# Model 2: ProportionBirdsScavenging ~ 1
# #Df LogLik Df  Chisq Pr(>Chisq)
# 1   3 3546.9
# 2   2  959.6 -1 5174.6  < 2.2e-16 ***
#   ---
#   Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Warning message:
#   In betareg.fit(X, Y, Z, weights, offset, link, link.phi, type, control) :
#   no valid starting value for precision parameter found, using 1 instead

joint_tests(mybetareg_realistic)
# The output is just 3 white lines.

# RANDOM DATA
df_random <- df
df_random$ProportionBirdsScavenging <- (((df_random$ProportionBirdsScavenging*(length(df_random$ProportionBirdsScavenging)-1))+0.5)/length(df_random$ProportionBirdsScavenging))
mybetareg_random <- betareg(ProportionBirdsScavenging ~ Random_OverheadCover, data = df_random, weights = pointWeight, link = "logit")
# Warning message:
#   In betareg.fit(X, Y, Z, weights, offset, link, link.phi, type, control) :
#   no valid starting value for precision parameter found, using 1 instead

summary(mybetareg_random)
# Call:
#   betareg(formula = ProportionBirdsScavenging ~ Random_OverheadCover, data = df_random, weights = pointWeight,
#           link = "logit")
#
# Standardized weighted residuals 2:
#   Min       1Q   Median       3Q      Max
# -24.6579  -7.4615   0.8881   5.0596  31.2095
#
# Coefficients (mean model with logit link):
#   Estimate Std. Error z value Pr(>|z|)
# (Intercept)          -0.07481    0.04363  -1.715   0.0864 .
# Random_OverheadCover -0.73184    0.06930 -10.561   <2e-16 ***
#
#   Phi coefficients (precision model with identity link):
#   Estimate Std. Error z value Pr(>|z|)
# (phi)  1.37018    0.02466   55.57   <2e-16 ***
#   ---
#   Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#
# Type of estimator: ML (maximum likelihood)
# Log-likelihood:  1015 on 3 Df
# Pseudo R-squared: 0.01213
# Number of iterations: 8 (BFGS) + 2 (Fisher scoring)

parameters::p_value(mybetareg_random)
# Parameter            p
# 1          (Intercept) 8.638446e-02
# 2 Random_OverheadCover 4.509897e-26
# 3                (phi) 0.000000e+00

nagelkerke(mybetareg_random)
# $Models
#
# Model: "betareg, ProportionBirdsScavenging ~ Random_OverheadCover, df_random, pointWeight, logit"
# Null:  "betareg, ProportionBirdsScavenging ~ 1, df_random, pointWeight, logit"
#
# $Pseudo.R.squared.for.model.vs.null
# Pseudo.R.squared
# McFadden                         -5.73902e-02
# Cox and Snell (ML)                9.57020e-01
# Nagelkerke (Cragg and Uhler)     -1.46624e-24
#
# $Likelihood.ratio.test
# Df.diff LogLik.diff  Chisq    p.value
# -1     -55.073 110.15 9.1055e-26
#
# $Number.of.observations
#
# Model: 35
# Null:  35
#
# $Messages
# [1] "Note: For models fit with REML, these statistics are based on refitting with ML"
#
# $Warnings
# [1] "None"
#
# Warning message:
#   In betareg.fit(X, Y, Z, weights, offset, link, link.phi, type, control) :
#   no valid starting value for precision parameter found, using 1 instead

lrtest(mybetareg_random)
# Likelihood ratio test
#
# Model 1: ProportionBirdsScavenging ~ Random_OverheadCover
# Model 2: ProportionBirdsScavenging ~ 1
# #Df  LogLik Df  Chisq Pr(>Chisq)
# 1   3 1014.69
# 2   2  959.62 -1 110.15  < 2.2e-16 ***
#   ---
#   Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Warning message:
#   In betareg.fit(X, Y, Z, weights, offset, link, link.phi, type, control) :
#   no valid starting value for precision parameter found, using 1 instead

joint_tests(mybetareg_random)
# Again, just 3 white lines as output.

# EXTREME DATA
df_extreme <- df
df_extreme$ProportionBirdsScavenging <- (((df_extreme$ProportionBirdsScavenging*(length(df_extreme$ProportionBirdsScavenging)-1))+0.5)/length(df_extreme$ProportionBirdsScavenging))
mybetareg_extreme <- betareg(ProportionBirdsScavenging ~ Extreme_OverheadCover, data = df_extreme, weights = pointWeight, link = "logit")
# Warning message:
#   In betareg.fit(X, Y, Z, weights, offset, link, link.phi, type, control) :
#   no valid starting value for precision parameter found, using 1 instead

summary(mybetareg_extreme)
# Call:
#   betareg(formula = ProportionBirdsScavenging ~ Extreme_OverheadCover, data = df_extreme, weights = pointWeight,
#           link = "logit")
#
# Standardized weighted residuals 2:
#   Min       1Q   Median       3Q      Max
# -21.1256  -8.0601   0.2244   5.1278  31.6603
#
# Coefficients (mean model with logit link):
#   Estimate Std. Error z value Pr(>|z|)
# (Intercept)           -0.43280    0.02689  -16.09  < 2e-16 ***
#   Extreme_OverheadCover -0.11404    0.03667   -3.11  0.00187 **
#
#   Phi coefficients (precision model with identity link):
#   Estimate Std. Error z value Pr(>|z|)
# (phi)  1.33763    0.02393   55.91   <2e-16 ***
#   ---
#   Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#
# Type of estimator: ML (maximum likelihood)
# Log-likelihood: 964.5 on 3 Df
# Pseudo R-squared: 0.01569
# Number of iterations: 8 (BFGS) + 2 (Fisher scoring)

parameters::p_value(mybetareg_extreme)
# Parameter            p
# 1           (Intercept) 2.868274e-58
# 2 Extreme_OverheadCover 1.871710e-03
# 3                 (phi) 0.000000e+00

nagelkerke(mybetareg_extreme)
# $Models
#
# Model: "betareg, ProportionBirdsScavenging ~ Extreme_OverheadCover, df_extreme, pointWeight, logit"
# Null:  "betareg, ProportionBirdsScavenging ~ 1, df_extreme, pointWeight, logit"
#
# $Pseudo.R.squared.for.model.vs.null
# Pseudo.R.squared
# McFadden                         -5.03454e-03
# Cox and Snell (ML)                2.41241e-01
# Nagelkerke (Cragg and Uhler)     -3.69602e-25
#
# $Likelihood.ratio.test
# Df.diff LogLik.diff  Chisq   p.value
# -1     -4.8312 9.6625 0.0018807
#
# $Number.of.observations
#
# Model: 35
# Null:  35
#
# $Messages
# [1] "Note: For models fit with REML, these statistics are based on refitting with ML"
#
# $Warnings
# [1] "None"
#
# Warning message:
#   In betareg.fit(X, Y, Z, weights, offset, link, link.phi, type, control) :
#   no valid starting value for precision parameter found, using 1 instead

lrtest(mybetareg_extreme)
# Likelihood ratio test
#
# Model 1: ProportionBirdsScavenging ~ Extreme_OverheadCover
# Model 2: ProportionBirdsScavenging ~ 1
# #Df LogLik Df  Chisq Pr(>Chisq)
# 1   3 964.45
# 2   2 959.62 -1 9.6625   0.001881 **
#   ---
#   Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Warning message:
#   In betareg.fit(X, Y, Z, weights, offset, link, link.phi, type, control) :
#   no valid starting value for precision parameter found, using 1 instead

joint_tests(mybetareg_extreme)
# model term            df1 df2 F.ratio p.value
# Extreme_OverheadCover   1 Inf   9.668 0.0019

As far I can get from these outcomes we have the following P-values.
Realistic data

summary <2e-16
p_value 0
nagelkerke 0
lrtest < 2.2e-16
joint_tests no output

Random data

summary <2e-16
p_value 4.509897e-26
nagelkerke 9.1055e-26
lrtest < 2.2e-16
joint_tests No output

Extreme data

summary 0.00187
p_value 1.871710e-03
nagelkerke 0.0018807
lrtest 0.001881
joint_tests 0.0019

According to these outcomes, all P-values are significant (<.05). I think this is quite curious, given the fact that I've deliberately made up data sets which either do or do not show a relation. Hence, the following questions.
1) Which test is appropriate to find the p-value for my model? Is the pseudo R2 from the summary table reliable, or should I take that from an other test as well?
2) Should I look for a P-value, or is there a better coefficient which tells me the goodness of the model? Which coefficients should I report when writing up this research?
3) What does the following warning mean? Why does it only sometimes pop up? For example, if I run my entire script first and then do the tests again without removing the objects from the environment, the warning does not pop up.
Warning message:
   In betareg.fit(X, Y, Z, weights, offset, link, link.phi, type, control) :
   no valid starting value for precision parameter found, using 1 instead

4) Why is there only an output for the joint_tests for the extreme data?
Sorry for the many questions, but I am in the deep here. Can somebody shed some light on this and help me?

A: Extracting the p-values via summary() or via parameters::p_value() seems to compute the same p-values, they might just get formatted slightly differently. These are the p-values from the asymptotic Wald tests for each individual regression coefficient, using the covariance matrix estimate based on the Hessian.
The lrtest() gives very similar p-values to the marginal Wald test of the overhead cover coefficient but somewhat different. The reason is that lrtest() computes the asymptotic likelihood ratio test rather than the Wald test. Asymptotically, these will agree but in finite samples they differ somewhat.
The reason that the p-values are spuriously significant in the random case seems to be due to a poorly fitting model with a relatively low sample size. Hence, the asymptotics that the tests rely on do not work. Simply using a sandwich or bootstrap covariance (via sandwich() or vcovBS() from the sandwich package) or bootstrap inference (via Boot() from the car package) shows that the effect is actually not significant. As an example:
coeftest(mybetareg_random, vcov = sandwich)
## z test of coefficients:
##
##                       Estimate Std. Error z value  Pr(>|z|)
## (Intercept)          -0.074812   0.616474 -0.1214    0.9034
## Random_OverheadCover -0.731838   0.790655 -0.9256    0.3546
## (phi)                 1.370185   0.326463  4.1971 2.704e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Similarly:
set.seed(1)
coeftest(mybetareg_random, vcov = vcovBS)
## z test of coefficients:
##
##                       Estimate Std. Error z value Pr(>|z|)
## (Intercept)          -0.074812   0.707324 -0.1058  0.91577
## Random_OverheadCover -0.731838   0.903038 -0.8104  0.41770
## (phi)                 1.370185   0.515240  2.6593  0.00783 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

A final alternative would be to completely switch to the bootstrap (and not just bootstrap covariance) via Boot(mybetareg_random) which also leads to similar insights
The warning message simply states that the usual strategy for finding starting values in the numerical optimization of the log-likelihood did not work. Another strategy is used in that case which may lead to convergence problems more often. However, in this case the optimization still converges successfully. Despite converging this may still indicate that the model fits the data rather poorly which is the case here.
As for the remaining questions, I feel they are too broad (how to best report regression results, using pseudo R-squared vs. p-values, etc.) to be answered together with the questions above. Similarly, joint_tests() is a function from a different package and not betareg, hence I feel these shouldn't be mixed together here.


text:
Q: tkinter window stops responding I have this code:
#python 2.7.15

import pyautogui
import time
import msvcrt
from threading import Thread
import win32api
import battle
import Tkinter
from Tkinter import *

#launcher pos x:868 y:975
#rocket pos x:829 y:936

def click():
        left = win32api.GetKeyState(0x01)
        while True:
                click = win32api.GetKeyState(0x01)
                if click != left:
                        left = click
                        #print(a)
                        if click < 0:
                                pyautogui.hotkey("ctrlleft")
                                time.sleep(1)

def rocket():
        rocket = True
        while rocket:
            pyautogui.hotkey("2")
            time.sleep(0.5)
            pyautogui.hotkey("7")
            time.sleep(20)

root = Tk()
root.geometry("300x200")
root.title("Bot options")
root = Tkinter.Button(root, text = "Click me", command = rocket)
root.pack()
root.mainloop()

"""key = msvcrt.getche()
if key == 'z':
        click()
elif key == 'x':
    if __name__ == '__main__':
            Thread(target = click).start()
            Thread(target = battle.battle).start()
            Thread(target = rocket).start()"""

The problem is that when running and I click the Click me button inside the window that is created, the window stops responding. I have tried changing command = rocket to command = rocket() but no window pops up and function starts working

A: You can't do a while True: loop that just runs forever—or anything at all that runs for a long time—in an event handler.
If you do, you never return control to the tkinter event loop. But the event loop is how your program processes things like mouse moves and key presses and important messages from the OS. So, if you don't let it run, your GUI hangs, and eventually you get a beachball or hourglass or pocket watch or whatever Windows uses to mean "unresponsive".

So, you need to do something like this:
def rocket():
    pyautogui.hotkey("2")
    root.after(500, rocket2)

def rocket2():
    pyautogui.hotkey("7")
    root.after(20000, rocket)

Now, instead of looping forever, blocking the whole program while it waits half a second and then again while it waits 20 seconds, it just does something quick, asks tkinter to run the rest of the code in 0.5 seconds, then returns.
And you need to do something similar in click, of course.

A different option, that doesn't require turning your loops inside-out like this, is to use threads. (You've already imported threading, but you're not doing anything with it.)
Threads aren't always a good solution. For example, you're not allowed to access any tkinter widgets from a background thread, and in most programs, you need to do things like get the value from an Entry and update the text in a Label and so on. But here, you're not doing that. pyautogui seems like the kind of library that also might not be usable from a background thread, but I haven't checked; if it's thread-safe, your function can be changed easily.
Instead of calling rocket directly, you want to call a function that starts rocket in a background thread:
def rocket():
    rocket = True
    while rocket:
        pyautogui.hotkey("2")
        time.sleep(0.5)
        pyautogui.hotkey("7")
        time.sleep(20)

def start_rocket():
    th = threading.Thread(target=rocket)
    th.start()

# …

root = Tkinter.Button(root, text = "Click me", command = start_rocket)


text:
Q: Subscribe to change to template html inside "with" I have a bootstrap modal with
data-bind="showModal:selectedItem, with: selectedItem"

making in visible only when selectedItem is selected and it all works well.
For modal body I have the following code, and it chooses for different templates loaded in the page based on a computed value of templateToUse that checks selectedItem for a specific property, and also this works well.

The problem comes when i try to run some jquery DOM manipulation on my templates, since they are accualy not "html" until they are loaded, based on the above code I figured I could subscribe to selectedItem and do the manipulation after load, but
self.selectedItem.subscribe(function (newitem) {
    alert($(".modal").html());
});

alerts an empty string, meaning the template is not yet loaded, and I cannot make any manupilation yet. Is there any way i can subscribe to the data binding of the template instead, that fires when the template is changed?


text:
Q: How to compare the value in JSON based on the key C++ web::json::value obj;

obj[JSONKeyRequest] = web::json::value::string(JSONValueRequest);

I create a JSON value, and insert some key and values to it.
Then I get this obj in another function, trying to check that whether obj[JSONKeyRequest] equals to "abc", but it doesn't work:
web::json::value getObj = this->GetSendObj();
if (getObj[JSONKeyRequest] == web::json::value::string(L"abc"))
{
}

However, VC keeps shows:"Errors:No operators [] matches this operands , operand types are const web::json::value[std::wstring]
So, how could I get the value based on the key and compare the value with a string ?

A: First of all, the error tells you what exactly the arguments should be.
json requires wstring arguments, or if not wstring, you can input literals.
obj[L"JSONKeyRequest"] = web::json::value(L"JSONValueRequest");

should work.
Secondly, for comparison try declaring a wstring first and then comparing like
wstring temp = "abc";
if (getObj["JSONKeyRequest"] == temp)
{
}

This should work.

A: if (getObj.at(key) == web::json::value::string(L"abc"))

This one works for me.


text:
Q: How to use string parameters inside Groovy script in Jenkins freestyle project? I have created a Jenkins freestyle project executing Groovy script, inside which I need to call a REST api to validate username and password. How to pass these parameters and use the entered credentials inside the Groovy script.
This is the code I am using to get the REST api called :
def post = new URL("http://xxxx/xxxxx/xxxxx/xxxx?userName=$Username&password=$Password").openConnection()
post.setRequestMethod("POST")
post.setDoOutput(true)
post.setRequestProperty("Content-Type", "application/json")

def message = '{"message":"this is a message"}'
post.getOutputStream().write(message.getBytes("UTF-8"))

def postRC = post.getResponseCode()

println(postRC)

But the username and password in the above URL is the one I want from the user building the job. How do I get that?

A: Finally after a lost of research i got an answer to my query.
Actually,if your job type is of a freestyle job,accessing build parameters  through "Execute Groovy Script" only is not possible.
For accessing build parameters, you need to use "Execute System Groovy Script" build steps and write your groovy scripts.
Reference : Access to build environment variables from a groovy script in a Jenkins build step (Windows)
Thanks!


text:
Q: quotes in onclick event I had an onclick event as below.
<div onclick="display_function('<?php echo $user_id;?>','<?php echo $student_id;?>','<?php echo $student_name;?>')">

function display_function(user_id,student_id,student_name)
{
   alert(user_id+'-'+student_id+'-'+student_name); //<-- testing only. I have my own code here
}

the function works fine with the name like Mary, Chris and etc.
However, if the student name contains a ', e.g. Cheng'li, the function won't work.
I need help to fix this. How can I make the function works by 'escaping' the quote mark in name?
Thanks.

A: You need to add a call to htmlentities around the data you wish to echo.
Not doing so exposes your code to XSS attacks.

A: use PHP function addslashes
<?php
$str = "Is your name O'reilly?";

// Outputs: Is your name O\'reilly?
echo addslashes($str);
?>

IN your case
<?php echo addslashes($student_name);?>

REFERENCE
http://www.php.net/addslashes
Note: If your code contain html tag than use htmlentities (Entoarox Answer)

A: you can either use escape()
<div onclick="display_function(escape('<?php echo $user_id;?>'),escape('<?php echo $student_id;?>'),escape('<?php echo $student_name;?>'))">

function display_function(user_id,student_id,student_name)
{
   alert(user_id+'-'+student_id+'-'+student_name); //<-- testing only. I have my own code here
}

A: That is because you are passing the values in function in single quotes. When name will have a single quote, this will cause error.
try double quotes like
<div onclick="display_function(\"<?php echo $user_id;?>\",\"<?php echo $student_id;?>\",\"<?php echo $student_name;?>\")">

A: Just add \ before ' to tell your script that it is a string. I hope it helps
<?php
    $user_id = 1;
    $student_id = 1;
    $student_name = "Cheng\'li";
?>

<div onclick="display_function('<?php echo $user_id;?>','<?php echo $student_id;?>','<?php echo $student_name;?>')">Click

If you cannot put \ directly in String, you need to use [addslashes][1]


text:
Q: Parse xml with python getting x,y values i need to get x,y localisation from xml file
-<TwoDimensionSpatialCoordinate>

<coordinateIndex value="0"/>

<x value="302.6215607602997"/>

<y value="166.6285651861381"/>

</TwoDimensionSpatialCoordinate>

from xml.dom import minidom
doc = minidom.parse("1.631791322.58809740.14.834982.40440.3641459051.955.6373933.1920.xml")

"""doc.getElementsByTagName returns NodeList
coordinate = doc.getElementsByTagName("coordinateIndex")[0]
print(coordinate.firstChild.data)
"""

coordinate = doc.getElementsByTagName("coordinateIndex")
for coordinateIndex in coordinate:
        value = coordinateIndex.getAttribute("value")
coordinatex = doc.getElementsByTagName("x")
for x in coordinatex:
        valuex = x.getAttribute("value")
coordinatey = doc.getElementsByTagName("y")
for y in coordinatey:
            valuey = y.getAttribute("value")
            print("value:%s, x:%s,y:%s" % (value, x , y))

so when i execute i get this result
value:22, x:,y:
can Anyone help me please ?:(

A: As your example xml file
<?xml version="1.0" ?>
<TwoDimensionSpatialCoordinate>
    <coordinateIndex value="0"/>
        <x value="302.6215607602997"/>
        <y value="166.6285651861381"/>
    <coordinateIndex value="1"/>
        <x value="3.6215607602997"/>
        <y value="1.6285651861381"/>
</TwoDimensionSpatialCoordinate>

import xml.dom.minidom

def main(file):
    doc = xml.dom.minidom.parse(file)
    values = doc.getElementsByTagName("coordinateIndex")
    coordX = doc.getElementsByTagName("x")
    coordY = doc.getElementsByTagName("y")
    d = {}
    for atr_value, atr_x, atr_y in zip(values, coordX, coordY):
        value = atr_value.getAttribute('value')
        x = atr_x.getAttribute('value')
        y = atr_y.getAttribute('value')
        d[value] = [x, y]
    return d

result = main('/path/file.xml')
print(result)

# {'0': ['302.621', '166.628'], '1': ['3.621', '1.628']}

A: Using the ElementTree API (use ET.parse(filename).getroot() instead of ET.XML() to load from a file):
from xml.etree import ElementTree as ET

xml = ET.XML("""
<?xml version="1.0" ?>
<Things>
    <TwoDimensionSpatialCoordinate>
        <coordinateIndex value="0"/>
        <x value="302.6215607602997"/>
        <y value="166.6285651861381"/>
    </TwoDimensionSpatialCoordinate>
    <TwoDimensionSpatialCoordinate>
        <coordinateIndex value="1"/>
        <x value="3.6215607602997"/>
        <y value="1.6285651861381"/>
    </TwoDimensionSpatialCoordinate>
</Things>
""".strip())

coords_by_index = {}
for coord in xml.findall(".//TwoDimensionSpatialCoordinate"):
    coords_by_index[coord.find("coordinateIndex").get("value")] = (
        coord.find("x").get("value"),
        coord.find("y").get("value"),
    )
print(coords_by_index)

outputs
{
  '0': ('302.6215607602997', '166.6285651861381'),
  '1': ('3.6215607602997', '1.6285651861381'),
}


text:
Q: Understanding how JSP populates the JSF UIViewRoot JSF can use JSP as the view definition language.
From my understanding of what JSP does is: it generates a java class that implements the servlet interface. When this servlet is called it writes to the response object (that is send to the servlet client).
If it just writes to the response object then how is the UIViewRoot populated?
How about the render phase, what is left for it to do if the JSP had already write to the response?

A: It are the <f:xxx> and <h:xxx> tags which do the magic. The <f:view> tag represents the UIViewRoot. Everthing inside this tag is handled by JSF renderers, not by JSP. JSP just executes the body of the tag which in turn delegates to all the JSF works. JSP doesn't print the tag plain vanilla to the response (rightclick page in browser and do View Source, there should be no single JSF tag in there, but only its HTML output).
To learn more about "custom" JSP tags, check the Java EE 5 tutorial.
Note that in JSP's successor Facelets the <f:view> is not mandatory, it's already implicitly used.
See also:

*

*What is the difference between JSF, Servlet and JSP?


text:
Q: $7i(2-5i)$ Opposite sign, why? $7i(2-5i)$ Doing it on my own I got $14i - 35i$. But the answer key says it should be + not - like in the original unsolved part. Why does the sign switch?

A: 7i(2-5i) = 7i*2+7i*(-5i)
7i(2) = 14i
7i * (-5i) = -35*i^2
           = -35*(-1) = 35
So, the solution is 14i+35


text:
Q: RewriteRule to rewrite /folder/subfolder/file to /?f=folder/subfolder/file? Pretty straightforward - just wondering how do I rewrite this:
/folder/subfolder/file
/?f=folder/subfolder/file
And the number of folders/subfolders might vary, so what I really want is anything after the / in that path (that does not already have ?f= in it) redirected to the path with ?f= added in front of it.
If I add this
RewriteRule ^(.*)$ ?f=$1 [L]
it works just fine but doesn't recognize the existence of ?f= in the URL already, and breaks that existing link with ?f= in there.
Any ideas?

A: You can use:
RewriteCond %{QUERY_STRING} !(?:^|&)f= [NC]
RewriteRule ^(.*)$ ?f=$1 [L,QSA]

Which does not do the rewriting if the f querystring is already there.
With [QSA] you keep the other possible querystring values.

A: Try this :
RewriteEngine On
RewriteRule ^(.[^\?]*)$ /?f=$1 [L]


text:
Q: Selecting three rows after the one that meets the condition We've got 7 guys travelling in Poland ( ;) ). The problem is to find up to three next cities they visited from the time they visited Warsaw. If one guy visits Warsaw twice, it is also counted as a starting point for the next journey.
For example guy 1 have had not only a journey - Warsaw, Cracow, Warsaw, Gdansk, but also Warsaw, Gdansk.
Table A
+------+-----------+-----+
| date |   city    | guy |
+------+-----------+-----+
|    2 | Warsaw    |   1 |
|    4 | Cracow    |   1 |
|    5 | Cracow    |   2 |
|    6 | Bialystok |   3 |
|    7 | Warsaw    |   1 |
|    8 | Gdansk    |   1 |
|   10 | Warsaw    |   5 |
|   12 | Cracow    |   5 |
|   14 | Bialystok |   6 |
|   15 | Warsaw    |   7 |
|   20 | Warsaw    |   7 |
+------+-----------+-----+

So the final table for this would look like this:
+-----------+-----------+-----------+-----------+
| Starting | 2nd dest. | 3th dest. | 4th dest. |
+-----------+-----------+-----------+-----------+
| Warsaw    | Cracow    | Warsaw    | Gdansk    |
| Warsaw    | Gdansk    |           |           |
| Warsaw    | Cracow    |           |           |
| Warsaw    | Warsaw    |           |           |
| Warsaw    |           |           |           |
+-----------+-----------+-----------+-----------+

The problem is to create a query that will automatically create the final table from the table A.
There is no problem with finding every starting point, but I have no idea how to find every second destination. It seems too me that there has to be a loop of some kind - the guy has to be the same as in the starting point and the date of the second destination has to greater than the date of THIS EXACT starting point.
Any help with solving this would be appreciated.  ;)
SQLFiddle with some more example entry data - http://sqlfiddle.com/#!2/de0f1
The data above is just a sample, the solution needs to deal with a lot bigger set.

A: Solution using Row_Number() and Pivot:
select guy,[1] as First, IsNULL([2], '') as Second, IsNUll([3], '') as Third, IsNull([4], '') as Forth
from (
    select row_number() over (partition by guy order by guy, date) as number, city, guy
     from voyage
     ) x
pivot
(
  max(city)
  for number in ([1], [2], [3], [4])
) as p

Demo here
My example assumes that the dates are of type int but this could be easily reworked to use proper dates....
EDIT:
This will give the desired output (not sure that this will be a generic approach...):
select *
from
(
select guy,[1] as First,  IsNULL([2], '')  as Second, IsNUll([3], '') as Third, IsNull([4], '') as Forth
from (
select row_number() over (partition by guy order by guy, date) as number, city, guy
from voyage ) x
pivot
(
max(city)
  for number in ([1], [2], [3], [4])
) as p
where  [1] = 'Warsaw'

union All

select guy,[3] as First, case when [4] = 'Warsaw' then '' else IsNULL([4], '') end as Second, '' as Third, '' as Forth
from (
select row_number() over (partition by guy order by guy, date) as number, city, guy
from voyage ) x
pivot
(
max(city)
  for number in ([1], [2], [3], [4])
) as p
where  [3] = 'Warsaw'

Union all

select guy,[2] as First, '' as Second, '' as Third, '' as Forth
from (
select row_number() over (partition by guy order by guy, date) as number, city, guy
from voyage ) x
pivot
(
max(city)
  for number in ([1], [2], [3], [4])
) as p
where  [2] = 'Warsaw'
  ) bigdata
order by guy

Second Demo Here

A: If you are using SQL Server 2012 or later version, you can fairly easily solve the problem with the help of the LEAD() analytic function:
WITH ThreeDestinations AS (
  SELECT
    *,
    Destination2 = LEAD(city, 1) OVER (PARTITION BY guy ORDER BY date),
    Destination3 = LEAD(city, 2) OVER (PARTITION BY guy ORDER BY date),
    Destination4 = LEAD(city, 3) OVER (PARTITION BY guy ORDER BY date)
  FROM
    dbo.voyage
)
SELECT
  StartingPoint = city,
  Destination2,
  Destination3,
  Destination4
FROM
  ThreeDestinations
WHERE
  city = 'Warsaw'
ORDER BY
  date
;

The three calls to LEAD give you the first three (or fewer) destinations after every city in the original set. The next, and final, step is just to filter out the rows where the starting point is not Warsaw.

A: This should work. I have used Cte's to query out first travel of a person from Warsaw and second travel of a person from Warsaw. Finally used Pivot to union and display the result sets in the requested format. Hope this is useful.
;WITH cte_Itinerary([Date], City, Guy)
    AS (SELECT '2', 'Warsaw', '1'
        UNION ALL
        SELECT '4', 'Cracow', '1'
        UNION ALL
        SELECT '5', 'Cracow', '2'
        UNION ALL
        SELECT '6', 'Bialystok', '3'
        UNION ALL
        SELECT '7', 'Warsaw', '1'
        UNION ALL
        SELECT '8', 'Gdansk', '1'
        UNION ALL
        SELECT '10', 'Warsaw', '5'
        UNION ALL
        SELECT '12', 'Cracow', '5'
        UNION ALL
        SELECT '14', 'Bialystok ', '6'
        UNION ALL
        SELECT '15', 'Warsaw', '7'
        UNION ALL
        SELECT '20', 'Warsaw', '7'
    )
, cte_AddRowNumber
    AS (
    SELECT
           ROW_NUMBER() OVER (PARTITION BY Guy ORDER BY Guy, [Date]) AS number,
           City,
           Guy
    FROM cte_Itinerary
    )
, cte_FilterByWarsaw
    AS (
    SELECT
           ROW_NUMBER() OVER (PARTITION BY Guy ORDER BY Guy, [Date]) AS number,
           City,
           Guy
    FROM cte_Itinerary
    WHERE City = 'Warsaw'
    )
, cte_Result_AllDestinations
    AS (
    SELECT DISTINCT
           'One' AS ResultType,
           o.Number,
           o.City,
           o.Guy
    FROM cte_AddRowNumber AS o
         JOIN cte_FilterByWarsaw AS t
             ON o.Guy = t.Guy
            AND t.number <= o.number
    )
, cte_Result_SecondDestinations
    AS (
    SELECT 'Two' AS ResultType,
           ROW_NUMBER() OVER (PARTITION BY r1.Guy ORDER BY r1.Guy) AS number,
           r1.City,
           r1.Guy
    FROM cte_Result_AllDestinations AS r1
         JOIN cte_Result_AllDestinations AS r2
             ON r1.Guy = r2.Guy
            AND r1.number >= r2.number
    WHERE r2.City = 'Warsaw'
      AND r2.number <> 1
    )
    SELECT Guy,
           [1] AS Starting,
           ISNULL([2], '') AS [2nd Dest.],
           ISNULL([3], '') AS [3th Dest.],
           ISNULL([4], '') AS [4th Dest.]
    FROM(SELECT ResultType,Number,City,Guy
         FROM cte_Result_AllDestinations
         UNION ALL
         SELECT ResultType,Number,City,Guy
         FROM cte_Result_SecondDestinations)AS X
         PIVOT(MAX(City)FOR NUMBER IN([1], [2], [3], [4]))AS P;


text:
Q: Android Orange outline does not move on autoTab I am using Javascript to autoTab between input elements when max length is reached
        obj.focus();
        obj.select();
The cursor moves to the next element and user can enter text but the orange highlight outline does not move, it stays on the previous input element.
This seems to be an issue only on Android 2.1, works fine, on other versions of Android and on iPhone.
How do I make the orange focus outline move as well ?


text:
Q: Error after delete permanently a file from my git repository I'm new with Git so I'm not sure if I'm working well.
I have delete a file from my git repository with this command:
git filter-branch --tree-filter 'rm -f application.log' HEAD

Everything went OK but when I'm trying to push my branch, I received this message:
$ git filter-branch --tree-filter 'rm -f application.log' HEAD
Rewrite a700a3de38f804b875a4dafabf01eaa90260e573 (1313/1313)
Ref 'refs/heads/master' was rewritten

$ git push origin master
To git@github.com:myuser/myrepo.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:myuser/myrepo.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

How can I solve this problem?
Thanks!

A: The reason this error occurs is because you have changed history destructively. Use git push -f origin master to "force-push" your newly rewritten history.


text:
Q: Trying to figure out to equate values in two arrays in ruby I am trying to get the output at the end when you enter the number for the word that would match already stored in the array. It currently just spits out the number twice.
puts "Welcome to the number-word machine app."

word = []

4.times do
  puts "Enter a word:"
  word << gets.chomp
end

x = [1, 2, 3, 4]
x = word

puts "enter a number:"
number = word
word = gets.chomp
puts word

A: You are over-writing your word variable. You should pay careful attention to how you name your variables.
puts "Welcome to the number-word machine app."

words = []

4.times do
  puts "Enter a word:"
  words << gets.chomp
end

puts "Enter a number:"
number = gets.chomp

puts "You entered #{number}, which corresponds to:"
puts words[number.to_i]

A: Try to use one descriptive name for each variable. This makes it more clear what you're trying to do.
Before you were naming the number your user entered word, which is confusing. Instead, consider naming it number.
Finally, to return the word in your array referenced by the index of the entered number, do puts words[number].
Try this:
puts "Welcome to the number-word machine app."

words = []

4.times do
  puts "Enter a word:"
  words << gets.chomp
end

puts "Enter a number:"
number = gets.to_i
puts words[number]


text:
Q: JSON parser for Talend I need some help devising a strategy to parse JSON docs within a Talend job (Java job, not Perl). I am using Talend Version: 5.0.2 and developing on a Mac, planning to run on a Linux box.
Unfortunately, I cannot use the tFileInputJSON component because of the format of my files -- each file contains several hundred JSON docs, with a complete JSON doc taking up one line in the file. I think the right solution is to read the file line by line then pass it into a JSON parser and from there send the results to the rest of the job.
As I see it my options are:
a) send the line input to some sort of Java JSON parser. If that's the strategy I need to take, I'd like some advice on how to deal with the output and getting
b) find a Talend component that parses JSON docs, but within a flow as opposed to on a single file in valid JSON format.
I've searched around for this component but can't seem to find it. From my search, it seems even the tFileInputJSON component is relatively new.
I definitely know this is something Java can do pretty easily. My problem is getting the whole thing synced up within the Talend framework.
Anyone have some advice on where I should turn next?
Thanks in advance.

A: Have you tried creating a custom routine? You can do so under Code (in the repository window on the left), right click on Routines and create your custom routine.
This lets you write a Java function which can then be called from somewhere in your job (tMap, tJava, whatever).
You could read your input file and call a function on each line/element or whatever that does something you want.
Like any Java function, the routine can then write to file, print to screen or return some list object that you can further work on in another tJava, tJavaFlex, tJavaRow or whatever Talend components in your job.
It may feel a little hacky, but you can do a lot just using custom routines.
If you want to go all the way and create your own component, this may be a good way to start: http://www.talendforge.org/forum/viewtopic.php?id=17650
Of course, creating components is much more time-consuming, but may be useful if you think you'll be reusing this code in multiple projects/cases.

A: Read the file line by line, and construct a JSON Object for each line.
final BufferedReader br = new BufferedReader(new FileReader(file));
String line;

while ((line = br.readLine()) != null)         // read until EOF
{
  final JSONObject json = new JSONObject(line);
  ...
}

br.close();


text:
Q: Substitute text in excel I have an excel worksheet and some of the cells contain an abbreviation such as SC, FEW, ... followed by a number. for example SC058 or FEW01, and some of the cells contain a combination of two or three of these, i.e. FEW004 SC044.
I would like to substitute each of the abbreviations regardless of the number that is attached to them by a value. For examples I want all the "FEW004, FEW056,..." to be replaced by number "5" and etc.
Since the database is huge, any suggestion on how to do this?
Thank you

A: I've made a quick sample that would do one type of substitution (your example of changing anything with "FEW" to "5"), hopefully it is of some use:
Sub substitute_abb()

theData = ActiveCell.Value
theNewData = ""

theDataArray = Split(theData, " ")

For Each x In theDataArray
    If InStr(x, "FEW") Then
        newSegment = "5"
        Else
        newSegment = x
    End If
    If theNewData = "" Then
        theNewData = newSegment
        Else
        theNewData = theNewData & " " & newSegment
    End If
Next

ActiveCell.Value = theNewData

End Sub

I realise for the split delimiter you might want ", " rather than just " " and then on the theNewData composition again maybe you'd want ", ". And of course, this would need expanding to other substitutions. Is this a good start?


text:
Q: Gradle task to run Nashorn JavaScript Can there be gradle/groovy code analog for launch of java -Djava.library.path=lib -jar lib/avatar-js.jar helloWorld.js, that is lanching .js file with Java 8 and passing some libs
or using defined dependencies
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'

repositories {
    maven {
        url "https://maven.java.net/content/repositories/public/"
    }
}

dependencies {
    compile "com.oracle:avatar-js:0.10.25-SNAPSHOT"
    compile "com.oracle:libavatar-js-win-x64:0.10.25-SNAPSHOT"
}

task copyLibs(type: Copy) {
    from configurations.compile
    into 'lib'
}

sourceSets {
    main {
        java {
            srcDir 'src'
        }
        resources {
            srcDir 'src '
        }
    }
}

The only related docs I found (Build and run a jar inside of a Gradle task) is line from Chapter 45. The Application Plugin
 startScripts   jar     CreateStartScripts  Creates OS specific scripts to run the project as a JVM application.

Application plugins is Java dependent, no way to define task for JavaScript or C/C++
CreateStartScripts requires String mainClassName (not file to run)
Sources at https://github.com/PaulVI/NashornSandbox

A: Here You have 2 gradle tasks that will run the server:
task runHelloWorld(type: Exec) {
    commandLine 'java', '-Djava.library.path=lib', '-jar', 'lib/avatar-js.jar', 'helloWorld.js'
}

task runHelloWorld2(type: JavaExec) {
    args 'helloWorld.js'
    main 'com.oracle.avatar.js.Server'
    systemProperties 'java.library.path':'lib'
    classpath 'lib/avatar-js.jar'
}


text:
Q: CF queries using form variables entered by a user I am trying to do a query matching my trans_location column with the form data the user enters. I have a dropdown that lets the user choose multiple locations. When they choose multiple it places commas in between each location. When I choose only one location the results come back correct with the correct location. But when I choose more than one location it does not find any of the locations. Do the commas make it only one name and it will not search each location?

<cfset result = {} />
<cftry>
    <cfset date1 = #CREATEODBCDATETIME(form.StartDate & '00:00:00')#>
    <cfset date2 = #CREATEODBCDATETIME(form.EndDate & '23:59:59')#>

    <cfquery datasource="#application.dsn#" name="GetLocationInfo">
        SELECT *
        FROM cl_checklists
        WHERE date >= #date1# AND date <= #date2#
        AND trans_location = '#form.Location#'
    </cfquery>

<cfoutput>#date1#</cfoutput>
<cfoutput>#date2#</cfoutput>

<cfdump var="#GetLocationInfo#">

    <cfcatch type="any">
        <cfset result.error = CFCATCH.message >
        <cfset result.detail = CFCATCH.detail >
    </cfcatch>
</cftry>

I also tried doing something like this:
AND trans_location =  <cfqueryparam value='#form.Location#' />

A: You need to use the IN operator in conjunction with cfqueryparam with the list="true" attribute. (Here is a quick helpful tutorial for cfqueryparam: https://www.petefreitag.com/item/677.cfm)
Lastly: always, always, always use cfqueryparam when sending parameters to the database.
<cfset result = {} />
<cftry>
    <cfset date1 = CREATEODBCDATETIME(form.StartDate & '00:00:00')>
    <cfset date2 = CREATEODBCDATETIME(form.EndDate & '23:59:59')>

    <cfquery datasource="#application.dsn#" name="GetLocationInfo">
        SELECT  *
        FROM    cl_checklists
        WHERE   date >=  <cfqueryparam value="#date1#" cfsqltype="cf_sql_timestamp" />
                AND date <= <cfqueryparam value="#date2#" cfsqltype="cf_sql_timestamp" />
                AND trans_location IN ( <cfqueryparam value="#FORM.location#" cfsqltype="cf_sql_varchar" list="true" />  )
    </cfquery>

<cfoutput>#date1#</cfoutput>
<cfoutput>#date2#</cfoutput>

<cfdump var="#GetLocationInfo#">

    <cfcatch type="any">
        <cfset result.error = CFCATCH.message >
        <cfset result.detail = CFCATCH.detail >
    </cfcatch>
</cftry>


text:
Q: Can we have multiple repositories inside a project in Github I am developing an application with fronend and backend separated and communicated using REST API (say, backend is JAVA/.NET/NodeJS and frontend is React/Angular).
In BitBucket we can have a project and inside that project we can have multiple repository so that code base for backend and frontend can be in same container,

But in Github, if I am not wrong, concept of project is entirely different (Project vs Repository in GitHub).
Is there any way to have this feature in Github. Because I have lot of projects which all have separate frontend and backend and it will be helpful if I can organize repositories for a single application in one place instead of keeping it with long list of other applications repositories.
Thanks in advance!

A: The closest would be to combine:

*

*GitHub Organization in order to declare in it all your repositories

*an Organization-wide project board in order to manage all your issues and pull requests across those repositories within that organization.

A: There is a new GitHub feature called Lists that will help get you there. (it's actually still in beta)
It sounds like you're close to having this setup with what you're looking for.  At least you've started by using the Organization feature correctly.  Since GitHub uses the term Project for something other than what you want let's use Application instead.
In your case an Application has a front-end repository and a back-end repository.  In my case I have an Application with two client repositories (mobile app and web app) and an ecosystem of micro-services for the back-end.  So, about a dozen repositories for this one Application.
You can group these in three ways. (The second will answer your question)
First, if you're working with multiple clients/companies/groups you can associate a repository with an Organization.  This allows you to manage who has access and ownership of your repositories.
Second, you may have multiple Applications with multiple repositories each.  Your list of repositories will show them all.  If you want an easy way to group repositories together so you can filter to see just the related ones you use Lists.  It isn't the most obvious solution because you have to star a repository to be able to add it to a list.  Create a list from the stars page and name it after your Application, like "My Super Cool Auto-Dealership App."  Then add any of your repositories to that list.  The nice thing here is you can add any repository to the list even if you don't own it as long as it is starred.  Now you can view all the repositories that are used to build a single Application.
Third, you'll want to use Projects to organize the work that needs to be done for an Application.  So if you create a project and add your front-end and back-end repositories to it then you can see, organize, prioritize, and work issues for both repositories in one place.
So, we use the following GitHub features:

*

*Organizations to manage who owns/accesses repositories

*Lists to group/filter multiple repositories by Application

*Projects to organize the work for multiple repositories


text:
Q: Google Scripts Move An Image Salutations!
So I mainly programmed in Python and are relatively new to javascript. I'm currently trying to make a basic game to start to understand javascript. I only just stumbled across google scripts a few hours ago and I think it's really neat idea that allows for an easier time to develop web applications (which is seems Google is all about) having a GUI creation tool right along side is also a very nice feature.
But onto my problem. How do I actually move an image in javascript? I've found
  var obj = document.getElementById('IMG_Yellow_SW');
  obj.style.top = 50;
  obj.style.left = 50;

however I get a '"document" is not defined' error.

A: First, you need to understand that Google Script and JavaScript are very different in their capabilities but share the same syntax and many 'basic' objects such as String, Date, Array etc.
Google Script, unlike Javascript, cannot work with the DOM. Google Script generally resides in its own container and cannot influence objects outside it.
I suggest you begin with trying out some of the tutorials from https://developers.google.com/apps-script/articles


text:
Q: plotly multiple axes that change dynamically with plot So consider the following plot with multiple y-axes (taken from here link)
import plotly.graph_objects as go
from plotly.subplots import make_subplots

# Create figure with secondary y-axis
fig = make_subplots(specs=[[{"secondary_y": True}]])

# Add traces
fig.add_trace(
    go.Scatter(x=[1, 2, 3], y=[40, 50, 60], name="yaxis data"),
    secondary_y=False,
)

fig.add_trace(
    go.Scatter(x=[2, 3, 4], y=[4, 5, 6], name="yaxis2 data"),
    secondary_y=True,
)

# Add figure title
fig.update_layout(
    title_text="Double Y Axis Example"
)

# Set x-axis title
fig.update_xaxes(title_text="xaxis title")

# Set y-axes titles
fig.update_yaxes(title_text="primary yaxis title", secondary_y=False)
fig.update_yaxes(title_text="secondary yaxis title", secondary_y=True)

fig.show()

Is there anyway to get the axes to 'hide' and 'un-hide' as we click and unclick 'yaxis data' and 'yaxis2 data'? I need to construct a plot with more than 2 y-axes, and I would like the axes to 'hide' and 'unhide' as the user clicks the respective curve. Thanks for any help/guidance.

A: *

*using this technique https://community.plotly.com/t/dash-callback-on-legend-item-clicked/36672/3

*the following dash app makes y-axes visible/invisible on legend click events

*have generated a figure that creates as many y-axes as traces.  This demonstrates that this isn't a limited solution

import dash
from dash.dependencies import Input, Output, State
from jupyter_dash import JupyterDash
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import numpy as np

# build a figure with defined number of traces, each trace using it's own yaxis
TRACES = 9
fig = go.Figure(
    [
        go.Scatter(
            x=np.linspace(0, 10, 10),
            y=np.random.uniform(1 * 10 ** y, 5 * 10 ** y, 10),
            name=str(y),
            yaxis=f"y{'' if y==0 else y+1}",
        )
        for y in range(TRACES)
    ]
).update_layout(
    {
        f"yaxis{'' if ax==0 else ax+1}": {
            "position": 1 - (ax / 20),
            "overlaying":None if ax==0 else "y",
        }
        for ax in range(TRACES)
    }
)
# some space for all the y-axes
fig = fig.update_layout(xaxis={"domain": [0, 0.4]})

# Build App
app = JupyterDash(__name__)
app.layout = dash.html.Div(
    [
        dash.dcc.Graph(id="fig", figure=fig),
    ],
)

@app.callback(
    Output("fig", "figure"), Input("fig", "restyleData"), State("fig", "figure")
)
def graphClick(clickData, fig):
    if not clickData:
        raise dash.exceptions.PreventUpdate
    yax = {
        f"yaxis{'' if tn==0 else tn+1}": {
            "visible": clickData[0]["visible"][i] != "legendonly"
        }
        for i, tn in enumerate(clickData[1])
    }
    return go.Figure(fig).update_layout(**yax)

# Run app and display result inline in the notebook
app.run_server(mode="inline")


text:
Q: How to save the value of a textbox to a .txt file using php in html without reloading or redirecting the page? I want to make a textbox on an webpage which will take a number from user and that number will be saved in a .txt file. Firstly I have made the textbox in the html and made a form. I have created a submit button to run the php and made it as the action of the form. This php file contains the code for saving the data. But whenever I am trying to submit, the html is get refreshed or it is redirecting to the php file. But I need to save the value of textbox by submit button, not to refresh whole page. How to do? The following is the 'form' part of html:
<form action="write2file.php" method="GET"/>
Iteration number:

<input type="number" name="iteration_no"/>
<input type="submit" id="save_run" value="Run"/>
</form>

And the php is:
<?php
$filename ="noi_RS.txt";
$file = fopen( $filename, "w" );
fwrite( $file, $_GET['iteration_no']);
fclose( $file );
?>

A: Modified Answer,Fix an error of value stored as null,

<form action="" method="GET" onsubmit="callSubmit()">
Iteration number:

<input type="number" name="iteration_no" id="itnumber"/>
<input type="submit" id="save_run" value="Run" />
</form>

PHP file like this,
<?php
$text1 = $_POST['value1'];
$filename ="noi_RS.txt";
$file = fopen( $filename, "w" );
//$map = $_POST['iteration_no'];
fwrite( $file, $text1);
fclose( $file );
?>

A: Try using onsubmit event , event.preventDefault() to prevent form submission , create script element with src set to expected query string at php as parameter to encodeURIComponent() , append script element to head element, at script onload , onerror events remove script element

<!DOCTYPE html>

    <form>
Iteration number:

<input type="number" name="iteration_no"/>
<input type="submit" id="save_run" value="Run"/>
</form>

A: You'll need to use javascript if you want to do something like dynamic form submission.
The essence of it is that you want the user to do something, and then behind the scenes respond to that action. To the user, you might just inform them "Hey, I got it".
So you'll need javascript - specifically you need to send an AJAX request. Here's some information to get you started.
You're about to start on a journey of wild endeavours - cuz javascript ain't easy.


text:
Q: Unexpected EOF errors while parsing ; error shows empty non existent line i wrote a script in python to calculate basic quadratic equations . this was my first time making a complex script for me . But when i run it , it shows unexpected eof error while parsing with reason shown as an empty line at line 60 . i have lines till 59 only .
the script i used was  :-
a=input("write a\n")
b=input("write b\n")
c=input("write c\n")

import cmath
import math
import time

D=b**2 - 4*a*c

def a_set(a,b,c):
    D=b**2 - 4*a*c
    T=cmath.sqrt(D)
    x1=(-b + T)/(2*a)
    x2=(-b - T)/(2*a)
    return x1,x2#,D

def b_set(a,b,c):
    D=b**2 - 4*a*c
    G=math.sqrt(D)
    x1=(-b + G)/(2*a)
    x2=(-b - G)/(2*a)
    return x1,x2#,D

sol1=a_set(a,b,c)[0]
sol2=a_set(a,b,c)[1]
# sol3=a_set(a,b,c)[2]

ans1=b_set(a,b,c)[0]
ans2=b_set(a,b,c)[1]
# ans3=b_set(a,b,c)[2]

try:
     a=int(a)
     try:
         D== -D
         print("Imaginary roots found:-\n%e and %e" %(sol1,sol2))

     except ValueError:
         try:
             ans1==str("0")
             print("Roots are equal")

         except ValueError:
             print("answer is %r,%r" %(ans1,ans2))

except ValueError:
     try:
         a=float(a)
         try:
             D== -D
             print("Imaginary roots found:-\n%e and %e" %(sol1,sol2))
         except ValueError:
             try:
                 sol1==str("0")
                 print("Roots are equal")

             except ValueError:
                 print("answer is %r,%r" %(sol1,sol2))

the error i get is:-
$ python maths.py
  File "maths.py", line 60

                                                                 ^
SyntaxError: unexpected EOF while parsing

A: This is because you forgot to add an except clause after one of your tries. Try this:

except ValueError:
     try:
         a=float(a)
         try:
             D== -D
             print("Imaginary roots found:-\n%e and %e" %(sol1,sol2))
         except ValueError:
             try:
                 sol1==str("0")
                 print("Roots are equal")

             except ValueError:
                 print("answer is %r,%r" %(sol1,sol2))

     except:
         pass

For the last part of your code.


text:
Q: Connecting SharePoint to PowerShell and unlisting users I'm working on a script to automatically create AD accounts. The script downloads list of users from SharePonit and searches for new one and creates in AD. I have a few questions:

*

*How can I list users from SP in PowerShell?

*how to retrieve value data from SP e.g. Name, Surname

I must admit that I would like to start by listing the users.
The Get-SPUser command does not work. I found a solution to this problem, but it did not help. In PS I'm a beginner, in programming I have experience.

A: The command Get-SPUser would the user accounts: https://learn.microsoft.com/en-us/powershell/module/sharepoint-server/get-spuser?view=sharepoint-ps
In which server did you run the command? You need to run the Get-SPUser command in your sharepoint server.


text:
Q: How can I override tabBarOptions and change the color of the navigation icons? How can I change the colors of the icons that are active by removing the 'tabBarOptions' part and everything still works?
Going through an app I made some time ago in a tutorial, I came across this warning in the console:
Bottom Tab Navigator: 'tabBarOptions' is deprecated. Migrate the options to 'screenOptions' instead.
Place the following in 'screenOptions' in your code to keep current behavior:
Reading the information that React Navigation offers about Bottom Tabs Navigation, I have managed to solve the error in the following way.
<Tab.Screen
          name="restaurants"
          component={RestaurantsStack}
          options={{
            title: "Restaurants",
            headerShown: false,
            tabBarIcon: ({ color, size }) => (
              <MaterialCommunityIcons
                name="magnify"
                color={color}
                size={size}
              />
            ),
          }}
        />

However, in my application, I want to change the color of the buttons when we navigate through the screens, the icon of the screen we are on is shown in a different color, and at the time the code was the one shown below, and it is That's why it shows me the warning.
The problem is that I don't know how I can correct this
This is the full code of my file
const Tab = createBottomTabNavigator()

export default function Navigation() {
  const screenOptions = (route, color) => {
    let iconName
    switch (route.name) {
      case "tiendas":
        iconName = "compass-outline"
        break;
      case "favorites":
        iconName = "heart-outline"
        break;
      case "top-tiendas":
        iconName = "star-outline"
        break;
      case "search":
        iconName = "magnify"
        break;
      case "account":
        iconName = "home-outline"
        break;
    }

    return (
      <Icon
        type="material-community"
        name={iconName}
        size={22}
        color={color}
      />
    )
  }

  return (
    <NavigationContainer>
      <Tab.Navigator
        initialRouteName="tiendas"
        tabBarOptions={{
          inactiveTintColor: "#f48b28",
          activeTintColor: "#633204"
        }}
        screenOptions={({ route }) => ({
          tabBarIcon: ({ color }) => screenOptions(route, color)
        })}
      >
        <Tab.Screen
          name="tiendas"
          component={tiendasStack}
          options={{
            title: "Tiendas",
            headerShown: false
          }}
        />
        <Tab.Screen
          name="favorites"
          component={FavoritesStack}
          options={{
            title: "Favoritos",
            headerShown: false
          }}
        />
        <Tab.Screen
          name="top-tiendas"
          component={ToptiendasStack}
          options={{
            title: "Top 10",
            headerShown: false,
          }}
        />
        <Tab.Screen
          name="search"
          component={SearchStack}
          options={{
            title: "Buscar",
            headerShown: false,
          }}
        />
        <Tab.Screen
          name="account"
          component={AccountStack}
          options={{
            title: "Cuenta",
            headerShown: false,
          }}
        />
      </Tab.Navigator>
    </NavigationContainer>
  )
}

As I already said, I could solve it in the following way, but I don't know how to add the desired color and how to make it change when the icon is active:
This removes the warning, but I can't change the colors:
How can I change the colors of the icons that are active by removing the 'tabBarOptions' part and everything still works?
const Tab = createBottomTabNavigator()

export default function Navigation() {

  // Navigation buttons
  return (
    <NavigationContainer>
      <Tab.Navigator >
        <Tab.Screen
          name="tiendas"
          component={TiendasStack}
          options={{
            title: "Tiendas",
            headerShown: false,
            tabBarIcon: ({ color, size }) => (
              <MaterialCommunityIcons
                name="magnify"
                color={color}
                size={size}
              />
            ),
          }}
        />
        <Tab.Screen
          name="favorites"
          component={FavoritesStack}
          options={{
            title: "Favoritos",
            headerShown: false,
            tabBarIcon: ({ color, size }) => (
              <MaterialCommunityIcons
                name="heart-outline"
                color={color}
                size={size}
              />
            ),
          }}

        />
        <Tab.Screen
          name="top-tiendas"
          component={TopTiendasStack}
          options={{
            title: "Top 5",
            headerShown: false,
            tabBarIcon: ({ color, size }) => (
              <MaterialCommunityIcons
                name="star-outline"
                color={color}
                size={size}
              />
            ),
          }}
        />
        <Tab.Screen
          name="search"
          component={SearchStack}
          options={{
            title: "Buscar",
            headerShown: false,
            tabBarIcon: ({ color, size }) => (
               <MaterialCommunityIcons
                 name="magnify"
                 color={color}
                 size={size}
               />
             ),
          }}
        />
        <Tab.Screen
          name="account"
          component={AccountStack}
          options={{
            title: "Cuenta",
            headerShown: false,
            tabBarIcon: ({ color, size }) => (
              <MaterialCommunityIcons
                name="home-outline"
                color={color}
                size={size}
              />
            ),
          }}
        />
      </Tab.Navigator>
    </NavigationContainer>
  )
}

A: if you want to change only Icons color, not text color, then you can use 'focused' in tabBarIcon.
tabBarIcon: ({focused, color, size }) => (
              <MaterialCommunityIcons
                name="magnify"
                color={focused ? focusedColor : color}
                size={size}
              />
            )

A: Add tabBarInactiveTintColor and tabBarActiveTintColor options to screenOptions like that:
<Tab.Navigator
        initialRouteName="tiendas"
        screenOptions={({ route }) => ({
          tabBarInactiveTintColor: "#f48b28",
          tabBarActiveTintColor: "#633204"
        })}
 >...</Tab.Navigator>


text:
Q: C# Property Grid with Dynamic Drop Down Values from ASMX Web Service I've run into a conundrum with something that can be developed in a standard client application that I cannot seem to replicated when using a web service to pull down the information. Essentially, the idea is that I want to pull down a custom object from a Web Service (For Example, a Customer Object) and have the web service define what fields will be available. Once the client received the object, it will attach it to a PropertyGrid so that the user can visually see the properties of that object.
The first part of my problem works. I can grab a custom object and pass it to the client through the web service and it will show them as text fields that I can edit. My problem lies in that I would like to be able to have drop down lists of available values for the field. This list can be dynamic (The available values will be dependant on external factors).
The proof-of-concept I've been using and trying to get to work over a web service can be found below.
public class TestPropertyGrid
{
    private string _text_string= "";
    private string _some_String = null;
    private string _meds = null;

    public TestPropertyGrid()
    {
        string[] ss_arr = new string[3];
        ss_arr[0] = "Zero";
        ss_arr[1] = "One";
        ss_arr[2] = "Two";

        string[] meds_arr = new string[3];
        meds_arr[0] = "Heart";
        meds_arr[1] = "Blood";
        meds_arr[2] = "Cholesterol";

        GLobalVars.Add("Meds", meds_arr);
        GLobalVars.Add("SomeString", ss_arr);
    }
    [CategoryAttribute("Basic Category")]
    public string TextString
    {
        get { return _text_string; }
        set { _text_string = value; }
    }
    [TypeConverter(typeof(DynamicStringConverter))]
    public string SomeString
    {
        get
        {
            string S = "";
            if (_some_String != null)
            {
                S = _some_String;
            }
            else
            {
                string[] arr = (string[])GLobalVars.Get("SomeString");
                if (arr.Length > 0)
                {
                    S = arr[0];
                }
            }
            return S;
        }
        set { _some_String = value; }
    }
    [TypeConverter(typeof(DynamicStringConverter))]
    public string Meds
    {
        get
        {
            string S = "";
            if (_meds != null)
            {
                S = _meds;
            }
            else
            {
                string[] arr = (string[])GLobalVars.Get("Meds");
                if(arr.Length > 0){
                    S = arr[0];
                }
            }
            return S;
        }

        set {_meds = value;}
    }

    }

    static class GLobalVars
    {
        internal static Dictionary<string, object[]> dictionary = new Dictionary<string, object[]>();

        public static object[] Get(string key)
        {
            return dictionary[key];
        }

        public static void Add(string key, object[] value)
        {
            dictionary.Add(key, value);
        }

        public static void Set(Dictionary<string, object[]> dict)
        {
            dictionary = dict;
        }

    }

    public class DynamicStringConverter : StringConverter
    {
        public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
        {
            //true means show a combobox

            return true;
        }

        public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
        {
            //true will limit to list. false will show the list,

            //but allow free-form entry

            return true;
        }

        public override System.ComponentModel.TypeConverter.StandardValuesCollection
               GetStandardValues(ITypeDescriptorContext context)
        {
            Console.WriteLine("Property Desc.name: " + context.PropertyDescriptor.Name);
            return new StandardValuesCollection(GLobalVars.Get(context.PropertyDescriptor.Name));

        }
    }

A quick summary of what is happening. I have some private properties that are controlled through their Get/Set methods. Some of which get values from an array when needed.
The Dynamic string converter is called when the PropertyGrid looks up array values and returns the correct set based upon the property name from the dictionary.
How can I either
a) replicate this to work from a web service?
or if I simply cannot do this,
b) What sort of approaches are available to tackle this issue?


text:
Q: Why the form moving effect is not happening the first time? I'm using this code to show a form with a messenger-like popup:
  TimeSleep := 5;

  for i := 1 to FormHeight do
  begin
    Form.Top := Form.Top - 1;

    Sleep(TimeSleep);
  end

It's working smoothly but only from the second time. I mean I have a button on my form that invokes the loop and the first time I click the form shows suddenly without the sliding effect. If I click again, the effect works.
How can I have it working from the first time?
Thanks.

A: Try adding "Application.ProcessMessages;" before sleep.

A: You are not posting enough code to be sure about it, but I assume that your form isn't visible or doesn't even have a window handle before you click the button the first time, so the moving of the form isn't visible. If you insert
Form.Show;
Form.Update;

before the loop things should work the first time too.  Note the call to Update(), it is needed to really show the form that has been made visible in the previous line.
Similarly you should insert a call to Update() after the change to the Top property inside your loop - it does what the call to Application.ProcessMessages() does too, without being such a sledgehammer.  Try to make do without Application.ProcessMessages() whenever there is a better way, search Stack Overflow for discussions regarding this.
Two more pieces of advice regarding your loop:

*

*Movement will not be smooth if anything causes your Sleep() to be longer than the 5 milliseconds you request - it's much better to calculate the amount to decrement the top coordinate of the form from the elapsed time since the last movement.

*There is no way anybody will see your form move in 1 pixel increments - the human eye and brain aren't fast enough to gather and process information at that speed, and even cats and insects in your room will only see the 60 or so updates your monitor does in each second.  So a parameter to Sleep() of 20 or even 50 is much more sensible than 5. Adjust the form movement accordingly.
Edit:
Here is some sample code that creates constant movement of the form even with differing delays:
uses
  MMSystem;

procedure TForm1.Button1Click(Sender: TObject);
var
  Frm: TForm;
  TicksStart, TicksNow: Longword;
  Progress: Single;
begin
  Frm := TForm.CreateNew(Self);
  try
    // slide a form of 600 by 500 pixel into view over a period of 100 millis
    Frm.SetBounds((Screen.Width - 600) div 2, -500, 600, 500);
    Frm.Show;

    TicksStart := timeGetTime;
    while True do begin
      Sleep(15);
      TicksNow := timeGetTime;
      if TicksNow - TicksStart >= 1000 then
        break;
      Progress := (TicksNow - TicksStart) / 1000;
      Frm.Top := - Round((1.0 - Progress) * 500);
    end;
    Frm.Top := 0;

    Sleep(500);
  finally
    Frm.Free;
  end;
end;


text:
Q: Help plotting Geographic Data in R using PBSMapping and Shapefiles Using O'Reilly's Data Mashups in R as inspiration, I'm trying to plot a handful of addresses on a shapefile of Salt Lake County, Utah found here.
I have data frame geoTable:
> geoTable
         address        Y         X EID
1    130 E 300 S 40.76271 -111.8872   1
2    875 E 900 S 40.74992 -111.8660   2
3   2200 S 700 E 40.72298 -111.8714   3
4    702 E 100 S 40.76705 -111.8707   4
5 177 East 200 S 40.76518 -111.8859   5
6    702 3rd ave 40.77264 -111.8683   6
7   2175 S 900 E 40.72372 -111.8652   7
8   803 E 2100 S 40.72556 -111.8680   8

And I've coerced it into an eventData object:
> addressEvents<-as.EventData(geoTable,projection=NA)
> addressEvents
         address        Y         X EID
1    130 E 300 S 40.76271 -111.8872   1
2    875 E 900 S 40.74992 -111.8660   2
3   2200 S 700 E 40.72298 -111.8714   3
4    702 E 100 S 40.76705 -111.8707   4
5 177 East 200 S 40.76518 -111.8859   5
6    702 3rd ave 40.77264 -111.8683   6
7   2175 S 900 E 40.72372 -111.8652   7
8   803 E 2100 S 40.72556 -111.8680   8

So it looks like I've got everything I need to plot-but its not working.  When I load the shapefile and plot using
addPoints(addressEvents,col="red",cex=.5)

I'm left looking at an empty shapefile.  Additionally, when I try and run findPolys against my eventData object, it returns NULL.
> findPolys(addressEvents,myShapeFile)
NULL

How can I make this work?  I was able to complete the O'Reilly tutorial without any problems and am having difficulty figuring out where I'm going wrong here.  I dont know if its the shapefile, my data frame, or whateverelse.
Here are the commands I use to import my data and shapefile
slc<-read.table('~/utah.txt',sep=',',header=TRUE,strip.white=TRUE,stringsAsFactors=FALSE)

myShapeFile<-importShapefile("/Users/neil/Downloads/SGID93_DEMOGRAPHIC_CensusTracts2000/SGID93_DEMOGRAPHIC_CensusTracts2000",readDBF=TRUE)

A: You may also want to look at these related questions, especially at Eduardo's responses:

*

*plotting-color-map-with-zip-codes-in-r-or-python

*developing-geographic-thematic-maps-with-r

A: Seems like PBSmapping uses some crude heuristics to work out the projection from the .prj file.  (see help(importShapefile)). I personally don't understand all the stuff inside a prj file but using this website www.spatialreference.org I reckon your map matches
http://www.spatialreference.org/ref/epsg/26912/
Whenever I get a new shape file I find it's projection system on this website and then look for the proj4 string, which in this case is
"+proj=utm +zone=12 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"
(Like I said I don't know PBSmapping, but you can read this in using maptools as follows)
library(maptools)
sf=readShapeSpatial("SGID93_DEMOGRAPHIC_CensusTracts2000.shp",proj4string=CRS("+proj=utm +zone=12 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"))

and then convert to latlong using
library(rgdal)

sftransformed=spTransform(sf,CRS("+proj=longlat"))

and
plot(sftransformed,axes=T)
gives a plot with the right units on the axes.
Not sure if PBSmapping understands a proj4 string? Looks like it doesn't to be honest.


text:
Q: Getting a torrent title from metadata or torrent file Is it possible to extract the torrent title from the meta data loaded from DHT or the file downloaded from some server like TPB? any api,lib  any language would do

A: Using python you can easily read/edit a torrent file using bencode.py module
Example:

>>> import bencode
>>> rawdata = open('foo.torrent').read()
>>> bencode.bdecode(rawdata)
{'announce': 'http://cbbatracker.appspot.com/announce',
 'comment': 'HOTD for testing purposes',
 'created by': 'Transmission/2.04 (11151)',
 'creation date': 1292094068,
 'encoding': 'UTF-8',
 'info': {'length': 262212441,
          'name': '[SnF] Highschool of the Dead 02 [285FB2DA].mp4',
          'piece length': 131072,
          'pieces': '...lot of binary data...',
          'private': 0}}

A: yes it's possible. Lot of open source torrent softwares use the libtorrent library.
It's available in C++ langage
libtorrent

A: You have to be more specific what you actually mean. If you meant "info.name" from the metafile, then any bencode module for any language makes that rather easy.


text:
Q: How to get ps to print group? ps aux will print out something formatted according to the below. It shows the user that the process runs under. But is there a way to display the group that the process runs under?
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND

A: You can specify the desired format:
   o format
          Specify user-defined format.  Identical to -o and --format.

For example, saying:
ps o pid,group

would print pid and group.
Saying:
ps o pid,group,gid

would print pid, group and group ID.

As per your comment, the following might work for you:
ps o user,pid,%cpu,%mem,vsz,rss,tty,stat,start,time,comm,group,gid

To see all processes:
ps ax o user,pid,%cpu,%mem,vsz,rss,tty,stat,start,time,comm,group,gid

A: ps ax o user,pid,group,gid,%cpu,%mem,vsz,rss,tty,stat,start,time,comm,args=ARGS

To print the full command e.g python script.py --env LOCAL

A: This gives similar output to ps -ef but adds the effective group name.
ps -eO user,group,ppid,c,start_time

(That flag is a capital O.)


text:
Q: How to retrieve image IDs from shortcode content? I like my clients to simply throw their images into the WordPress editor while the script of my custom theme handles everything else. Be it a gallery, a carousel or whatever. So instead of using plugins I usually let them wrap the images into a shortcode. Like this: [images] Image 1, Image 2, ... [/images]
On the code side this means that I have to get rid of the standard WordPress output (which isn't a problem) and to retrieve the IDs of the images instead. Once I retrieved the IDs I can generate any other output easily. This is how I retrieve the desired IDs:
function register_shortcodes() {
  add_shortcode( 'images', 'get_image_data' );
}

function get_image_data( $atts, $image_data_input = null ) {

  /*
  * Find CSS classes generated by WordPress (like 'wp-image-36')
  * and store them into array $image_classes
  */
  preg_match_all( '/wp-image-[0123456789]*/', $image_data_input, $image_classes );

  /* Loop through array $image_classes */
  $n = 0;
  foreach ( $image_classes[0] as $image_class ) {

    /* Crop class names to ID only */
    $image_id = substr( $image_class, 9 );

    /*  Retrieve image metadata by ID, store ID into array $images */
    $images[$n]['id'] = $image_id;

    $n++;
  }

  /*
  * Loop through array $images and generate $image_data_output
  * by adding the desired values
  */
  $image_data_output = '';

  foreach ( $images as $single_image ) {
    $image_data_output .= $single_image['id'] . ', ';
  }

  return ( $image_data_output );
}

So here's my question: My code works fine, but is there a better way to retrieve the IDs only for my shortcode content (instead of all media attached to the post)? I consider searching for CSS classes to crop them into their IDs the very definition of a workaround but I'm unable to find a smarter way.

A: I created a function to retrieve attachment id from it's src, might work in your case scenario as well
function get_attachment_id_from_src ($image_src) {
    global $wpdb;
    $id = $wpdb->get_var('SELECT ID FROM '.$wpdb->posts.' WHERE guid="'.$image_src.'"');
    return $id;
}


text:
Q: Matrix multiplication with non-commuting objects (Quantum) Given a matrix A = {{0,a,a,0},{b,0,0,a},{b,0,0,a},{0,b,b,0}}, where $a$ and $b$ do not commute, how do I calculate $A^2$ in Mathematica?
(Later on, I would like to generalise to calculate objects of the type $e^A$.)

A: Unprotect[NonCommutativeMultiply];
NonCommutativeMultiply[0, a_] := 0;
NonCommutativeMultiply[a_, 0] := 0;

A = {{0, a, a, 0}, {b, 0, 0, a}, {b, 0, 0, a}, {0, b, b, 0}};
Table[
 Sum[A[[i, k]] ** A[[k, j]], {k, 1, 4}]
 , {i, 1, 4}, {j, 1, 4}]

{{2 a ** b, 0, 0, 2 a ** a}, {0, a ** b + b ** a, a ** b + b ** a, 0}, {0, a ** b + b ** a, a ** b + b ** a, 0}, {2 b ** b, 0, 0, 2 b ** a}}


text:
Q: How to do Multiple Biddings on Multiple Items in Jmeter? I am trying to do Multiple Biddings on Multiple Items for different suppliers in Jmeter... Can any one help me...

A: If I understand correctly, you have an auction site and want to place multiple bids on multiple items for different suppliers.
Start by recording ONE bid on ONE item for ONE supplier.  There are lots of tutorials for helping with recording.
After you've recorded this scenario, you want to add parametrization to the script.  I would recommend by starting with multiple items for a single supplier.  There are lots of ways you can do this.  You can give Jmeter a CSV data file to read, or scrape the page. Personally, I would do the following:
- Load Page that shows all items for a specific supplier
-- Do a regular expression extractor to get ALL items on the page
- FOR EACH item (loop)
-- Bid on item

Then I would make the supplier dynamic. Again, you can give Jmeter a CSV data file, or scrape the page. I would do this:
- Load page that shows all suppliers
-- Do a regular expression extractor to get ALL suppliers
- FOR EACH supplier (loop)
-- Load Page that shows all items for the supplier
--- Do a regular expression extractor to get ALL items on the page
-- FOR EACH item (loop)
--- Bid on item

For the multiple bid part, it would depend on how many bids you want, and which users make the bid.  Is it the same user making the bids? Or do different users need to make the bids?
If it's the same user, you could add a loop to "Bid on the item" and od it as many times as needed.
If it's different users, create a data file with all the users you need, then loop through the entire scenario multiple times with different users.
The user manual has some examples and lots of use tips and tricks:
http://jmeter.apache.org/usermanual/intro.html

A: Could you elaborate some more? When you say "Multiple Biddings" I think you're referring to something domain-specific you want to do. Perhaps if you describe first what JMeter components you are using now, an HTTP Request? SOAP/XML request, the nature of the system in question, we could help you.


text:
Q: Strange behaviour of custom schema for Sygic on iOS In phonegap application for iOS I'm trying to open Sygic navigation app in javascript by it's custom schema URL. Everything works for native iOS navigation, Google Maps, Waze.... but not for Sygic! It's very strange because direct link tapped by user works:
<a href="com.sygic.aura://coordinate|16.6784149|48.8759607|drive">

In Javascript all these doesn't works:
window.location = 'com.sygic.aura://coordinate|16.6784149|48.8759607|drive';

window.open('com.sygic.aura://coordinate|16.6784149|48.8759607|drive', '_system');

window.open('com.sygic.aura://coordinate|16.6784149|48.8759607|drive', '_blank', 'location=yes');

var t = escape('com.sygic.aura://coordinate|16.6784149|48.8759607|drive');
window.location.href = t;

One of suspect was pipe "|" in url. After escaping url still not working... WHY IT WORKS FOR FOR EVERYTHING ELSE BUT NOT FOR "com.sygic.aura" ?

A: This is official answer from Sygic:
Thank you for your feedback, we already know about this issue and are working on the fix. However, this can be only fixed in one of the future updates of the application. I would like to ask for your patience, as it will be solved as fast as possible. Make sure you have automatic updates enabled for our application to receive the update instantly when it is released.
Feel free to contact me back in case of any questions or issues, I will be glad to help.
Thank you for your patience and understanding.