How do I properly setup PHP in my Linux Fedora 19 server?

Question: The Problem:
This has been going on for quite some time. I only got the installation right once, and after that, it either:

PHP pages show the PHP codes (not the current error, but I've experienced this)
PHP pages return "Internal Error in Server"

All I really want is to get PHP to connect to Oracle 11g XE via oci8. I had no idea it would be this difficult.
Additionally, looking into the error logs (I'm assuming this is PHP's error logs) located in /var/log/httpd/error_log, reveals the following error:

PHP Fatal Error: Unknown: Failed opening required
  '/var/www/html/info.php' (include path =
  '.:/usr/share/pear:/usr/share/php').

I've never encountered this before.
The System:

Fedora 19 x86_64
Oracle 11g XE
Apache 2.4.6
PHP 5.5.4

Additional Info:
info.php contains merely the following:
<?php
phpinfo();
?>

php -i works, although I'm not sure what to look for there.
What I tried:
Plenty. But since I've reformatted the PC, and started over, so here's a break down of what I did:

Installed Oracle 11g XE
Properly backed up my database into said Oracle
Modify .bashrc by adding the following

TMP=/tmp; export TMP
      TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=localhost.localdomain; export ORACLE_HOSTNAME
ORACLE_UNQNAME=DB11G; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/xe; export ORACLE_HOME
ORACLE_SID=XE; export ORACLE_SID
NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`; export NLS_LANG
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

export CLASSPATH
if [ $USER = "oracle" ]; then
  if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
  else
    ulimit -u 16384 -n 65536
  fi
fi

yum groupinstall "Development Libraries"
yum install httpd
yum install php

I started apache, configured it to start at boot, was able to get to the Fedora test page, and put a test PHP page in /var/www/html/ directory.
localhost works fine.
localhost/info.php returns "Internal Error in Server".
I have no idea what I'm doing wrong. I haven't even gotten PHP up and running yet, so I'm pretty worried about my ability to get it to connect to Oracle. Any ideas / suggestions? Thanks.
Comment: Check `/var/error/httpd/*` for a cause to the Internal Error
Comment: I didn't find any directory under `var` named `error`. `empty` is the closest. If you perhaps meant `/var/log/httpd/error_log`, the file says: `PHP Fatal Error: Unknown: Failed opening required '/var/www/html/info.php' (include path = '.:/usr/share/pear:/usr/share/php')`. This did not happen before.
Answer: Sounds like there's a number of things going on here.
The pages that showed the php code instead of the result of it is probably because the php handler wasn't properly defined in the apache configuration. Redhat installs usually take care of this sort of thing. However something like this is needed somehwhere in your apache configuration to process php files
LoadModule php5_module    modules/libphp5.so
AddHandler application/x-httpd-php .php .php5 .phtml
AddHandler application/x-httpd-php-source .phps

The fatal error you're getting is probably down to the error you are seeing in /var/log/httpd/error_log.
It looks like /var/www/html/info.php doesn't exist and your php program really wants it. Im sure I dont need to tell you what to do with that! :)
Comment: The pages that show up as PHP code only happened during my last two attempts to get this working - when I tried to compile PHP as a script (to try and get OCI8 working). Downloading apache and PHP / PHP-devel seems to do the trick, but leaves me lost on how to implement OCI8.
Answer: Check permissions on:
/var/www/html/info.php

I recall having a similar error when the user that was running the apache process didn't have the right permissions for this file.
It's not a good thing to to but you could note down the current permissions of info.php, chmod 777 /var/www/html/info.php and see if it works. If so then that's the problem and try and sort out the issue.
Also check as per @GeoSword instructions of you are getting the php code displayed instead of html as this means that the php configuration in apache is not correct.
Comment: This did the trick, though for some reason after doing `chmod 777 info.php`, said file won't turn up anymore in `ls -l`. The properties are there, but the filename isn't. It is visible in Dolphin, however. It's listed as `-rwxrwxrwx- 1 root root  `.
Comment: This is another issue. In any case remember that `chmod 777 info.php` is not a good thing! This was just to test and assess that permissions on the file were wrong. What you have to do now is check under what user and group the webserver is running and make info.php rwx for that user/group.


How to configure rudder-agent?

Question: When configuring rudder-agent, the doc says to fill policy_server.dat with the rudder-server hostname:
<code>echo 'rudder-server' > /var/rudder/cfengine-community/policy_server.dat
</code>
Should i use preferably the fully qualified domain name (fqdn), or the short hostname of the rudder server ?
Answer: Rudder agents will use the address you enter here to communicate with the server.
So you have to enter one that the agent can resolve.
The fqdn should work in any case.
Comment: If your DNS configuration is not fully working (can not reverse name), you might need to add the FQDN in yout /etc/hosts file, or even use IP addresses
Answer: Rudder is flexible as to the hostname (or IP) you provide - it will simply run it through your machine's standard name resolution. Therefore, you can use whichever form is most convenient for you.
However, if you want to err on the side of safety, and you can trust your DNS system, prefer to use the FQDN. This will make sure Rudder can still contact it's server in case your local DNS configuration becomes broken (by, for example, a change in the default domain in /etc/resolv.conf).
If you can't trust your DNS system, prefer to use a hardcoded IP address here.

How to configure rudder-agent?


How can I display author name, picture and signature when viewing a full node in D6?

Question: I'd like to display the name, picture and signature of a node's author at the bottom of each node. The node.tpl.php file that I'm using (supplied by the zen theme) includes variables for the author's name and picture, but not the signature. How can I make that accessible in the template file?
Answer: Figured it out. To add a $user_signature variable to your node.tpl.php file, add this function to your template.php file:
<code>function YOURTHEME_preprocess_node(&$vars, $hook) {

  $account = user_load($vars['uid']);
  $vars['user_signature'] = check_markup($account->signature, $account->signature_format);
}
</code>


Motivation behind this eccentric Ramanujan Identity

Question: I just visited the MathJaX page due to the Math.SE website showing some problems while loading the page. I saw some demo math equations samples at this page, when this identity actually caught my attention:
$$ \dfrac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\dfrac{e^{-2\pi}} {1+\dfrac{e^{-4\pi}} {1+\dfrac{e^{-6\pi}} {1+\dfrac{e^{-8\pi}} {1+\ldots} } } } $$
My question is how does one come up with such an identity. Could there be any motivation behind this or is this just brute force calculations and then discovering it as an identity.
Comment: That kind of identities can be found when one studies $q$-difference equations. Andrews, in his delightful book on partitions, does this for a couple, if I recall correctly. I have no idea if Ramanujan found them in this way, but they do become pretty less magical.
Comment: I would be extremely impressed if you could find any route to this identity using brute-force calculation.
Answer: As with Mariano, I too have no idea what sort of mathematical sorcery Ramanujan used, but what you have there is a special case of the Rogers-Ramanujan continued fraction (sans the $\sqrt[5]{q}$ factor).
Letting
$$R(q)=\cfrac{\sqrt[5]{q}}{1+\cfrac{q}{1+\cfrac{q^2}{1+\cdots}}}$$
the question amounts to how one might arrive at
$$R(\exp(-2\pi))=\sqrt{\phi\sqrt{5}}-\phi$$
As noted in this paper, Ramanujan had derived an explicit formula for $R(q)$ for certain special values of $q$ in his "lost notebook":
$$\begin{align*}R\left(\exp(-2\pi\sqrt{n})\right)&=\frac1{4t_n^2}\left((1-\phi t_n)\sqrt{1-t_n}-\sqrt{(1-t_n)(1+\phi t_n)^2-4\phi t_n}\right)\times \\&\left(\sqrt{(1-t_n)\left(1-\frac{t_n}{\phi}\right)^2+\frac{4 t_n}{\phi}}-\left(1+\frac{t_n}{\phi}\right)\sqrt{1-t_n}\right)\end{align*}$$
where $t_n=-\dfrac{G_{n/25}}{G_{25n}}$ and $G_n$ is the Ramanujan $G$-function (a.k.a. Ramanujan(-Weber) class invariant),
$$G_n=2^{-\frac14}q^{-\frac1{24}}\prod_{k=0}^\infty (1+q^{2k+1})=2^{-\frac14}q^{-\frac1{24}}(-q;q^2)_\infty$$
and $q=\exp(-\pi\sqrt n)$. (the details for proving it are a bit involved, but they can be seen in the linked paper, or here.)
Your case corresponds to $n=1$. Since $G_{1/n}=G_{n}$ (proven in this paper), $t_n=-1$, and making this substitution into the special formula for $R\left(\exp(-2\pi\sqrt{n})\right)$ yields the desired identity.
Comment: @J.M: Me too! I am at home enjoying my vacations. If I was at my University then I could have had the access.
Comment: As I recall, [this paper](http://dx.doi.org/10.4064/aa97-2-2) has a bit more detail than the one I linked to in my answer, but unfortunately I currently have no access to it for checking.
Comment: Alternatively, $R(q)$ being a modular function (as Matt notes in his answer) allows it to be related to things like the Klein invariant or $q$-Pochhammer symbols, from which you can also motivate the identity. The details are a bit involved, but maybe somebody can write an answer summarizing this intricate web.
Answer: There is a lot of motivation behind this identity (although I don't know how it relates to Ramanujan's motivation, if at all).  The function $R(q)$ described in
J.M.'s answer is an example of a modular function (see the wikipedia entry), and the general theory of complex multiplication says that if $\tau$ is a quadratic irrational algebraic number
(e.g. $i$) then the value of any modular function at $q = e^{2\pi i\tau}$ lies in an abelian extension of $\mathbb Q(\tau).$
In the particular case of your identity, $\tau = i$ (so $q = e^{-2\pi}$), and the abelian extension
is $\mathbb Q(i,\sqrt{5})$.   The reason that $5$ appears here is related to the fact that the level of the modular function $R(q)$ equals $5$.
For more details from this point of view, you can look at this nice article
of William Duke.
Comment: Matt, thanks for the link to the Duke article! I never realized that the icosahedron and the RRCF have a nice connection.
Answer: Unfortunately Ramanujan never told how he arrived at his most beautiful formulas and hence we can only guess at his motivation behind such formulas. From whatever I have studied about Ramanujan, I find that he had a great love for algebraic manipulations of all sorts especially manipulating expressions containing radicals. If there were two mathematical entities having any algebraic relation between them, then Ramanujan would find the relation without much effort.
Thus while Legendre and Jacobi derived modular equations upto 3 and 5th degree, Ramanujan went on to derive a huge number of modular equation of higher degrees and presented them in such convenient form as no one else had done. Having found modular equations he did not stop there, but rather based on these modular equations he calculated a host of various algebraic numbers like singular moduli and class invariants. He used these algebraic numbers for finding algebraic approximations to $\pi$. Naturally when he encountered Rogers-Ramanujan continued fraction he tried to figure out if it had algebraic values at certain points and when convinced so he started finding such values.
And it was because of this particular formula in his letter to G. H. Hardy that he became famous. Hardy said that these formulas must be true because if they were not true then nobody would have had the imagination to invent them. A proof based on Ramanujan's theories is presented in one of my blog posts.
Also when we pick one formula of Ramanujan and put it out of context, it looks much more strange and mystical. Ramanujan extensively studied various functions related to elliptic and theta functions and found algebraic relationships between them and when we study his formulas in context (as presented by Bruce C Berndt in Ramanujan's Notebooks) they start to look less strange and it looks as if each formula fits nicely in the grand scheme of theories created by Ramanujan.


Pass data through call stack without method modification

Question: I've got some crazy task, that sounds like mission impossible. I need to pass some data through stack of methods, which I can't modify (can modify only the last one). Example:
SomeData someData; //not passed in method1
obj1.method1(...);

here is obj1 class code
obj1 {
    someReturnClass method1(...) {
        ...
        obj2.method2(...);
        ...
    }
}

obj2 and method2 call some more methods, before they get to objN.methodM(). It can even be run in separate thread (so, ThreadLocal won't help). I need to access someData inside methodM, which is not passed through this stack as parameter.
I've got some concepts to get it through exception and double running methodM, but it looks ugly.
Do you have any ideas, how to pass someData to methodM()?
Comment: To be clear: do you mean that you need to access a local variable inside a method activation, of a method which you can't change, but which you know exists lower on the stack?
Comment: Basically, you need some sort of (relatively) static data.  This could be a "singleton", an instance field in some commonly addressable object, a thread-local variable, or a handful of other things.
Comment: Yes, I thought about some singleton. But several such stacks ending on my methods may be ran simultaneously.
Comment: Can you, or can you not, alter the code at the site where `someData` is created?  (This is in effect what @Marcin is asking above.)  If you cannot, you are stuck.  If you can, you can simply tuck a reference to it into a global variable.
Answer: If you can't smuggle access any other way -- e.g. by adding a reference to SomeData into some other object that is passed through the call stack -- then you will eventually have to use a global variable.  This is of course a poor design, but nothing else is possible given your constraints.
You mentioned in a comment that you may have several calls to your method "active" (is it recursive, or do you have multiple threads?)  In that case, you will need to have a global collection instead, and have some way of inferring which element of the collection to select from the data that is passed through the call stack.
Comment: In my weird case this method fits best. Thanks for this simple idea, I didn't even think about it.
Answer: I understand that you need to access a local variable inside a method activation, of a method which you can't change, but which you know exists lower on the stack.
The obvious thing here is to work with the Java Debugging Architecture: http://docs.oracle.com/javase/7/docs/technotes/guides/jpda/index.html
This will allow you to examine the stacks of all threads.
Comment: @Oroboros102 So, you can't modify the code, and you can't run it in debug mode? In that case, you can't do it.
Comment: @j_random_hacker How does he get data into the variable? He can't modify the code which currently has the data.
Comment: @Oroboros102: Not if you use a global *collection* of objects, and can uniquely infer which element in the collection to work with using other information that is passed through the call stack.  See my answer.
Comment: For JPDA jvm needs to be ran in debug mode. That's a big problem for my case.
Comment: What about a global variable?  They aren't illegal, just immoral :)
Comment: So he can't even modify the site where `someData` is created? In that case he is indeed stuck. But I see he (unhelpfully) hasn't actually confirmed or denied your question about this yet.
Comment: @j_random_hacker global variable may be overwritten, if another method...N stack is ran in parallel.
Answer: Finally, I found solution:
Create JAAS Subject
Subject subject = new Subject();

Put data somewhere in subject's principals or credentials:
subject.getPublicCredentials().add(new String("Trololo"));

Get this subject and it's data anywhere you need (works even in another thread):
Subject subject = Subject.getSubject(AccessController.getContext());
System.out.println(subject.getPublicCredentials());

It won't work only in one case: thread started before subject was created.


Grothendieck's axiom for abelian categories: AB5 and AB4, understanding a proof from Popescu's book

Question: The question is regarding the following axioms

AB$4$. If $(f_i\colon A_i\to B_i)_{i \in I}$ is a family of monomorphisms in an abelian category, then the induced $\bigoplus_{i \in I} f_i\colon \bigoplus_{i \in I} A_i\to \bigoplus_{i \in I} B_i$ is also a monomorphism.

AB$5$. In an abelian category, for a directed family $(A_i)_{i \in I}$ of subobjects of $A$ and a subobject $B$ of $A$, we have $(\sum_{i \in I} A_i)\cap B = \sum_{i \in I} (A_i\cap B)$.

I'm trying to follow the following proof from N.Popescu's book Abelian categories with applications to rings and modules:

However, I get stuck at the end, not seeing why $v_F$ is a monomorphism. The way I understand it, if $(l_F)_i\colon X_i \to \coprod_{i \in F} X_i$ and $l_i\colon X_i\to \coprod_{i \in I} X_i$ are canonical injections, then $v_F$ is the unique morphism such that $v_F\circ (l_F)_i = l_i$ for all $i \in F$. Why would it be monic?
I understand, however, why $f_F$ is monic. It is because direct sums of finite families of monomorphisms coincides their products, hence they are monomorphisms as limits commute with limits. But this logic doesn't apply to $v_F$ since it has possibly infinite set $I$ and the colimit of the constant discrete category is not the same as the limit of the constant connected category, so we can't use the trick of reducing the universal property morphism to the morphism induced by colimits, as in connected case.
Comment: Maybe you can see it better if you think of $v_F$ as $A\to A\coprod B$ where $A=\coprod_{i\in F}X_i$ and $B=\coprod_{i\not\in F} X_i$.
Comment: @CaptainLama Yeah, I've just went for a walk and had a similar idea: to use associativity of a coproduct. Thank you!
Answer: Special thanks to Captain Lama in the comment section!
Let $(l_{I\setminus F})_i\colon X_i\to \coprod_{i \in I\setminus F} X_i$. Form a coproduct $(\coprod_{i \in F} X_i)\sqcup (\coprod_{i \in F\setminus I} X_i)$ together with canonical injections $q_1\colon \coprod_{i \in F} X_i \to (\coprod_{i \in F} X_i)\sqcup (\coprod_{i \in F\setminus I} X_i)$ and $q_2 \colon \coprod_{i \in F} X_i \to (\coprod_{i \in F} X_i)\sqcup (\coprod_{i \in F\setminus I} X_i)$. Then, by the associativity theorem for coproducts, $(\coprod_{i \in F} X_i)\sqcup (\coprod_{i \in F\setminus I} X_i)$ is a coproduct of the family $(X_i)_{i \in I}$ together with the canonical injections $q_i\colon X_i \to (\coprod_{i \in F} X_i)\sqcup (\coprod_{i \in F\setminus I} X_i)$ where $q_i = q_1\circ (l_F)_i$ if $i \in F$ and $q_i = q_2\circ (l_{F\setminus I})_i$ otherwise. By uniqueness of coproduct, there is a unique isomorphism $u$ such that $l_i = u\circ q_i = u\circ q_1\circ (l_F)_i$ for all $i \in F$ and $l_i = u\circ q_2 \circ (l_{F\setminus I})_i$ for all $i \in F\setminus I$. In particular, $v_F\circ (l_F)_i = l_i = u\circ q_1 \circ (l_F)_i$ for all $i \in F$, so $v_F = u\circ q_1$ is a monomorphism as coproduct injections are monomorphisms in abelian categories.


CentOS qt-creator when executing step qmake

Question: I'm new at qt, and that's my first day with qt-creator, I just built a blank project try to compile, then wrong message came up.
Here is my config file :
Comment: Are you using the Qt and Qt Creator provided by CentOS?
Answer: The make step says: "No compiler set in kit". Please install a compiler (gcc or clang both work on Linux) and restart Qt Creator.
If the restart does not help: Go to Tools>Options>Build & Run>Toolchains and check that your compilers are detected. Then hit the "Apply" button and switch to the "Kits" tab of the options window.
Make sure the expected compiler is listed in the kit (after selecting the "Desktop" kit. Make sure no warnings/errors are shown in front of the kit. If there are any: Hover the kit with your mouse and check the tooltip for details.
Hope this helps:-)
Answer: For me the problem was elsewhere. I did have GCC installed (in Ubuntu), but I didn't have G++ (which is the GCC component for building C++ code). I installed G++, restarted Qt Creator and that fixed it.


predicted values in Cox model where there is interaction

Question: I am confused regarding the connection between coefficients and the predicted values of the linear predictor in Cox model with two factors and their interaction
I ran the code below.
I believe that with an interaction  the main effects for 4 levels celltype are those at the reference level of 2 level trt and as I show the effects of celltype at the non-reference level of trt can be found by adding the main effects (of celltype at the reference of trt) to the interaction effects.
I created a new data set with all combinations of trt and cell type and thought the estimated values of lp (linear predictor) would have a relation to the main and interaction effect estimates. But I can't see it.
I've pulled out the "terms" of "lp" to see what terms contribute to lp and am still confused eg why are the terms for trt +/- 0.37 when the trt main effect is 0.74 ?
Also I would expect the predicted "lp" term to be zero for trt=1 and celltype=squamous (ie the patient with reference levels of both factors"
Sorry to ask such a basic (and lengthy) question - many thanks in advance
library(survival)

veteran$trt<-as.factor(veteran$trt)
class(veteran$trt)
class(veteran$celltype)

vetcox1<-coxph(Surv(time,status) ~         trt+celltype+trt:celltype,data=veteran)
coef(vetcox1)
coef(vetcox1)[2:4]+coef(vetcox1)[5:7]

veteran$trt<-relevel(veteran$trt,ref=2)
vetcox2<-coxph(Surv(time,status) ~ trt+celltype+trt:celltype,data=veteran)
coef(vetcox2)

       allpred<-expand.grid(celltype=c("smallcell","adeno","large","squamous"), trt=as.factor(1:2))
allpred
predict(vetcox1,type="lp",newdata=allpred)
coef(vetcox1)[2:4]+coef(vetcox1)[5:7]
coef(vetcox1)
coef(vetcox2)
predict(vetcox1,type="terms",newdata=allpred)
predict(vetcox2,type="terms",newdata=allpred)

Comment: It is somewhat difficult to test the problem without having data to reproduce it, or at least some output of `summary()` on your models. But notice that 0.74 = 2*0.37 - maybe the `predict` function uses the mean as a reference, instead of the correct level?
Comment: @juod thanks for your thoughts, juod, I should have said that "veteran" is a builtin data set available within the "survival" package so the code is "runnable". I did wonder if 0.74=2*0.37 but it isn't exactly true - the exact numbers are 0.7490629 and 0.3717977 - is this too much to be some rounding error - thanks again for your thoughts
Answer: The output of predict() indeed seems weird, but in the end works as expected. We can test the behavior on a simpler model at first:
relevel(veteran$trt, ref=2)
lmod = lm(time ~ trt, data=veteran)
mean(veteran$time[veteran$trt==1]) # 115.1449

Even here, predict ignores the factor levels - the "constant" attribute is the mean, and it just adds +/- coefficients for each level, so the predictions are correct.
>predict(lmod, type="terms", newdata = allpred)
        trt
1 -6.482810
2 -6.482810
3 -6.482810
4 -6.482810
5  6.578145
6  6.578145
7  6.578145
8  6.578145
attr(,"constant")
[1] 121.6277

>predict(lmod, newdata = allpred)
 1        2        3        4        5        6        7        8
115.1449 115.1449 115.1449 115.1449 128.2059 128.2059 128.2059 128.2059

I believe that is also what's happening in the survival setup: the +/- coefficients aren't exactly equal (0.3717977 and -0.3772653), but I wouldn't be surprised by a rounding error of that size, given that there's a lot of exp()s going on behind scenes.
(You can explore more by analyzing body(predict.lm), although I haven't gone there in more detail.)
Comment: that looks v useful  - I'll look at this more 2moro - many thanks


How to get the last execution in a PHP for loop

Question: I am trying to get the last code execution in a basic PHP forloop. Currently I have been able to execute n-1 times and statically written the code for n=n outside the loop. This concept will fail if n = 1 unless I use an if-statement outside the loop. Is there a way I can get the last execution inside the loop?
<?php

$total_time_months = 6;

$time_now = date('Y-m-d H:i:s');

for ($x = 1; $x <= $total_time_months-1; $x++) {
       $offset = strtotime('+'. $x .' months');
       echo $next_date = date('Y-m-d H:i:s', $offset)."
"; // this is the n-1 time
}

//do something statically knowing that there is suposed to be one more left
echo date('Y-m-d H:i:s', strtotime('+'. $total_time_months. ' months'))."
";

?>

For this question, n = $total_time_months
Answer: You are already using the variable $x for your iterations. Just check the value of $x inside your loop:
if ($x === $total_time_months-1) {
    // ... do something
}

Comment: Sorry, you are correct, it should be `$total_time_months-1`.
Comment: Since the loop begins with 1 and ends with 5, it would suggest using $x === $total_time_months-1
Comment: please why `$total_time_months-2`?
Answer: First of all. Instead of using x <= y - 1 you can always simplify this to `x < y' when using a for loop.
Inside the loop you can check your current $x. For the last item it would be the maximum of your loop counter - 1.


Unable to mount a volume into a pod in kubernetes

Question: I have a pod, which is querying an AWS service using Boto. This pod runs in kubernetes cluster in EKS.
When running on a real cluster, we use ServiceAccount/Role/RoleBinding to give the Pod permission to acquire an IAM role.
But when I run it locally, using kind, I want it to use credentials that are in my ~/.aws directory.
So I mount the volumes as follows:
    volumes:
    - hostPath:
        path: /var/run/datadog
        type: ""
      name: dsdsocket
    - hostPath:
        path: /Users/me/.aws
        type: DirectoryOrCreate
      name: aws

And use them in the pod as follows:
      volumeMounts:
      - mountPath: /var/run/datadog
        name: dsdsocket
        readOnly: true
      - mountPath: /root/.aws
        name: aws
        readOnly: true

I have checked that there are credentials in ~/.aws/credentials
But the directory just shows up as empty inside the pod:
root@the_pod:/app# ls -al /root/.aws
total 8
drwxr-xr-x 2 root root 4096 Apr 12 19:33 .
drwx------ 1 root root 4096 May  9 17:22 ..

NOTE: I have tried mounting the actual credentials file in ~/.aws/credentials too, but it doesnt mount either.
Any ideas what i am doing wrong?
Comment: I haven't worked with kind, but it's very possible that the filesystem visible to kubernetes is not your host filesystem but is instead a container filesystem, which doesn't have your home directory in it. It might be easier to provide your AWS credentials as environment variables (possibly via a `Secret`).
Comment: your pod is getting schedule on that specific node on which file exist ? it could work as in kind you might be running single node server or have same backend file system
Answer: I guess you need to use extra mounts while creating the kind cluster, it is used to pass through storage on the host to a kind node for persisting data, mounting through code, etc.
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  # add a mount from /path/to/my/files on the host to /files on the node
  extraMounts:
  - hostPath: /path/to/my/files/
    containerPath: /files
    # optional: if set, the mount is read-only.
    # default false
    readOnly: true
    propagation: HostToContainer

Creating a kind cluster with a custom config file:
$ kind create cluster --config=kind-config.yaml

Comment: Thanks for that link. Just below the section you pasted I see this:

NOTE: If you are using Docker for Mac or Windows check that the hostPath is included in the Preferences -> Resources -> File Sharing.

For more information see the Docker file sharing guide.

--

So i should try that and see.


Como retornar que um recurso "não foi encontrado" no Spring?

Question: Estou fazendo uns testes no Spring para retornar erro 404 caso ele não encontre um id ao buscar no repository, mas está dando 200 OK.
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public ResponseEntity<?> buscar(@PathVariable("id") Long id) {
    Optional<Livro> livro = livrosRepository.findById(id);

    if(livro == null) {
        return ResponseEntity.notFound().build();
    }

    return ResponseEntity.status(HttpStatus.OK).body(livro);
}`

Alguém sabe o que pode estar acontecendo?
Comment: Que tal trocar o if pra if(!livro.isPresent())? Seu atributo livro é um Optional, e bem provável que ele não seja null.
Answer: Vejo dois jeitos de fazer o que você quer:
1 - Igual ao que o @Tom Melo comentou
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public ResponseEntity<?> buscar(@PathVariable("id") Long id) {
    Optional<Livro> livro = livrosRepository.findById(id);

    if(!livro.isPresent()) { // Mudança aqui
        return ResponseEntity.notFound().build();
    }

    return ResponseEntity.status(HttpStatus.OK).body(livro);
}

Deste modo você usa o método isPresent do Optional
2 - Ou deste outro modo
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public ResponseEntity<?> buscar(@PathVariable("id") Long id) {
    Livro livro = livrosRepository.findById(id).orElse(null);//Mudança aqui

    if(livro == null) {
        return ResponseEntity.notFound().build();
    }

    return ResponseEntity.status(HttpStatus.OK).body(livro);
}

Deste modo você espera retornar um Livro e se não achar ele vai ser null, pela sua linha de pensamento este me parece mais apropriado mas os dois métodos vão fazer a mesma coisa no fim
Comment: Que bom, lembre de aceitar a resposta
Comment: Deu certo! Era isso mesmo o objeto não é nulo. Obrigado a todos pelo auxílio!
Answer: Seu código pode ficar mais declarativo usando os métodos do Optional, sem a necessidade de um if:
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public ResponseEntity<?> buscar(@PathVariable("id") Long id){
    return livrosRepository.findById(id)
      .map(ResponseEntity::ok)
      .orElseGet(() -> ResponseEntity.notFound().build());
}


CentOS 6 on 32bit or 64bit? Ample RAM, Java Stack

Question: I have an ESXi (v4.1 U2) box with 16GB RAM and 8 CPU cores available.
The full stack will incorporate 2 CentOS 6 instances:
<code>1) DB Server
MySQL

2) Web server
Apache httpd load balancer
2X Jetty App. Servers (Scalatra + Scalate + ScalaQuery)
Jedis cache
</code>
Resource-wise I should be fine, but am wondering what impact/benefit there is in going 64-bit with this setup? Apache will utilize Google mod_pagespeed with in-memory cache; Jedis is obviously in-memory as well.
I'm looking for max performance.
Answer: There's no good reason to use a 32-bit OS for new deployments on modern hardware. You want to be able to address and utilize the resources available to you. Even if you deem that 32-bit is sufficient, 64-bit will be more future-proof. Finally, there's no easy move from 32-bit to 64-bit without a system reinstallation. From an administrative perspective, that's the biggest reason to use 64-bit.
Comment: right centos 6 has no upgrade path from 4 or 5. Had read some horror shows re: significant increase in memory usage with 64-bit, so just trying to cover the bases.
Comment: agreed. there are only a couple of good cases for 32 bit such as when your app has a small heap size and all that extra addressing space is unneccesary.
Comment: @TomH, and even then when you realize you need to scale your application you'd have been better off to start with 64-bit :-)


How do I prove that these propositions are equivalent by proving that these conditional statements are true?

Question: Propositions: p1, p2, p3, p4, and p5
Conditional Statements: p1 $\rightarrow$ p4, p3 $\rightarrow$ p1, p4 $\rightarrow$ p2, p2 $\rightarrow$ p5, and p5 $\rightarrow$ p3
Comment: Check that from any proposition comes out an arrow and arrive another one.
Comment: Check that you via the arrows can go from any proposition to any other.
Answer: $p_1\implies p_4\implies p_2\implies p_5\implies p_3\implies p_1$
So the "circle is round": for every $i,j\in\{1,2,3,4,5\}$ we have $p_i\implies p_j$ (hence also $p_j\implies p_i$).


df.apply() works on part of my df but returns "TypeError: float object is not iterable" on whole df

Question: GOAL: I have one DataFrame, root_df, with where one column is some words separated by a comma (e.g. "door, panther, salute") named words.  Then I have another DataFrame, freq_df,  where I have two columns, WORD (string ) and SCORE(float).   What I want to do is create an aggregate column with the score from the second DataFrame, freq_df, that total based on the column in the first DataFrame, root_df.  Let me give you an example.  In freq_df the row with "door" has the score 342388, the word "panther" isn't in the DataFrame at all, and "salute" has the score 9238.07.  So the column in root_df would be 342388 + 9238.07 which is 351626.07.
ISSUE: I have been able to do this using .apply() on a subset of my data, but when I try to get this on the whole data set it returns "TypeError: 'float' object is not iterable".  I thought maybe this was due to their being a NaN in the "Split words" column so I replaced all the NaN with " " to see if that helped and I returned a new error, "TypeError: ("unhashable type: 'list'", 'occurred at index Split words')".   I am confused why this would work on a subset of my data but not on the whole thing, I thought all Series had the same data type.  Can someone explain what is going on?  Is there a way to return the row that is returning the error?  Any help would be appreciated.
This is the entire code including the DataFrame which come from Wikipedia tables to replicate the issue.  Let me know if their are any questions or issue with my code.
import numpy as np
import pandas as pd
import urllib.request

def get_score(field):
    words_list = []
    for word in field:
        words_list.append(word)

    mask = freq_df['Word'].isin(words_list)

    return freq_df.loc[mask, 'Count (per billion)'].sum()

#Root DataFrame
root_urls = [r"https://en.wikipedia.org/wiki/List_of_Greek_and_Latin_roots_in_English/A%E2%80%93G",
        r"https://en.wikipedia.org/wiki/List_of_Greek_and_Latin_roots_in_English/H%E2%80%93O",
        r"https://en.wikipedia.org/wiki/List_of_Greek_and_Latin_roots_in_English/P%E2%80%93Z"]

root_dfs = []

for url in root_urls:
    dfs = pd.read_html(url, header=0)
    for i, df in enumerate(dfs):
        if df.shape[1] != 5:
            print('Deleted below DataFrame(s):\n', dfs[i].head())
            del dfs[i]
    root_dfs.extend(dfs)

root_df = pd.concat(root_dfs, ignore_index=True)
root_df.replace(to_replace="\[.*?]", value="", regex=True, inplace=True)

#Frequency DataFrame
url = r"https://en.wiktionary.org/wiki/Wiktionary:Frequency_lists/PG/2006/04/1-10000"

freq_dfs = pd.read_html(url, header=0)

freq_df = pd.concat(freq_dfs)

#Succesful use of apply
test = root_df.head().copy()
a = pd.DataFrame(columns=test.columns)
a.loc[0] = ['Test', 'Test', 'Test', 'Test', 'door, panther, salute'] # Adding the exact example I gave above
test = pd.concat([test, a], ignore_index=True)
test['Split words'] = test['English examples'].str.split(', ')

test_score = test['Split words'].apply(get_score) # LINE IN QUESTION : SUCCESS
print("\nSuccesful test:\n\n", test_score)

#Unsuccesful use of apply
root_df['Split words'] = root_df['English examples'].str.split(', ')
score = root_df['Split words'].apply(get_score) # LINE IN QUESTION : FAIL
print(score)

Answer: I don't think you need to use apply. You can get all the words in English Examples in one long series and then use map to map the value from freq_df and then sum up each original list of English Examples
# First get the score mapping series
score = freq_df.set_index('Word')['Count (per billion)']

# use stack to make one long series of words from
# english examples
stacked_words = root_df['English examples'].str.split(',\s*', expand=True).stack()

# map all the english example words to their score
# and then sum up each group(original row)
stacked_words.map(score).groupby(level=0).sum().fillna(0)

0        56157.78
1            0.00
2            0.00
3            0.00
4            0.00
5            0.00
6            0.00
7            0.00
8            0.00
9            0.00
10           0.00
11           0.00
12       11422.40
13      190547.67
....

Comment: Thanks!  My original train of thought was to try to use something like replace but I couldn't figure it out so I had to use .apply().  Just to make sure that I understand .map() correctly basically what it does it takes two Series.  It takes the values from the first Series and replaces them with the values of the second Series where Series1 value = Series2 index.  Is that right?

df.apply() works on part of my df but returns “TypeError: float object is not iterable” on whole df


GetFolderPath(SpecialFolder.ApplicationData) returns empty string

Question: I saw many old questions like this but it is not my case.
Asp.net application is running in AppPool (iis in win10) with 'load user profile' enabled.
And nevertheless Environment.GetFolderPath(ApplicationData or LocalApplicationData) returns an empty string. CommonApplicationData returns correct folder.
I ensure that {user}\AppData is exist on disk.
So, question: how can I get not empty string for AppData?
Answer: It is not enough to enable 'loadUserProfile' option in IIS!
You have to enable another one option. This is 'setProfileEnvironment'. I didn't find IIS UI to change it.
Open file in %windir%\system32\inetsrv\config\applicationHost.config and add or change attributes for your application pool.
<configuration>
    <system.applicationHost>
        <applicationPools>
            <add name="YourPool" >
                <processModel
                 loadUserProfile="true"
                 setProfileEnvironment="true"/>

And after that you can get ApplicationData or LocalApplicationData path!
Comment: What's funny is that in the documentation, they're lying saying that by default that setting is set to true.
https://learn.microsoft.com/en-us/iis/configuration/system.applicationhost/applicationpools/add/processmodel


Adform - Render process (25539) kill (OOM or update) wasn't handed by all associated webviews, killing application

Question: When I try to loading ads from AdformSDK, my app close
<code>09-19 09:52:12.799 25613-25613/com.trondheim.android.dev E/AdformSDK: onErrorLoading! A parser-blocking, cross site (i.e. different eTLD+1) script, https://s1.adform.net/stoat/611/s1.adform.net/bootstrap.js, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
09-19 09:52:12.802 25613-25613/com.trondheim.android.dev E/AdformSDK: onErrorLoading! A parser-blocking, cross site (i.e. different eTLD+1) script, https://s1.adform.net/stoat/611/s1.adform.net/bootstrap.js, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
09-19 09:52:12.808 25613-25613/com.trondheim.android.dev E/AdformSDK: onErrorLoading! A parser-blocking, cross site (i.e. different eTLD+1) script, https://s1.adform.net/stoat/611/s1.adform.net/bootstrap.js, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
09-19 09:52:12.813 25613-25613/com.trondheim.android.dev E/AdformSDK: onErrorLoading! A parser-blocking, cross site (i.e. different eTLD+1) script, https://s1.adform.net/stoat/611/s1.adform.net/bootstrap.js, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
09-19 09:52:12.816 25613-25837/com.trondheim.android.dev E/AdformSDK: AdWebView.wrapStreamAsResource():Loading as application/javascript
09-19 09:52:12.843 25613-25613/com.trondheim.android.dev E/AdformSDK: onErrorLoading! A parser-blocking, cross site (i.e. different eTLD+1) script, https://s1.adform.net/stoat/611/s1.adform.net/bootstrap.js, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
09-19 09:52:12.856 25613-25613/com.trondheim.android.dev E/AdformSDK: onErrorLoading! A parser-blocking, cross site (i.e. different eTLD+1) script, https://s1.adform.net/stoat/611/s1.adform.net/bootstrap.js, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
09-19 09:52:13.516 25613-25613/com.trondheim.android.dev E/AdformSDK: onErrorLoading! A parser-blocking, cross site (i.e. different eTLD+1) script, https://track.adform.net/adfserve/?bn=23124500;rtbwp=17nOlXG9bA41;rtbdata=-bFurvqWJlTnbdvYhoBnrnpwTRAi_OpVsE3t8x3rCbawAX0xWr8DCEqN-oAMgBOTqV4sUZf3iLrIMqaemZMW7RHnb-Yca8N87hqF2jOO2BYp8s_A1slaoxO9PsrecUbL1cmikFCvBkM2MTj14anNsA2;csid=5983;adid=d76e91d1-c388-43e0-80d4-e5d2d2d88433;adxvars=HS6yK-sOqv-1fPyr11dm_6BGslur9fzrg_hrkrEE0ZYrJFpR1MQf7iLpjmHovAXLOxbbHv_Bnku7Ol7vVZlRfr556N2T5UMYiwkr38QOE3QXw1MKZdoRQA0ImxWZ0HYhDPdUAWNlw3MePyTmLy3yBSujcucQWKPqnAfYJ8rOv72wHGz6B6dJ1w2;adxcmd=QTwuOIuaMWxxWXp_eBE_5w2;msrc=1;;js=1;adfxid=1x;10848;set=en-GB|en-GB|360X740|0|0|0|24|8|3|7|0;fd=2|15&CREFURL=file%3A%2F%2Fandroid_assets%2F, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
09-19 09:52:13.522 25613-25613/com.trondheim.android.dev E/AdformSDK: onErrorLoading! A parser-blocking, cross site (i.e. different eTLD+1) script, https://track.adform.net/adfserve/?bn=23124500;rtbwp=17nOlXG9bA41;rtbdata=-bFurvqWJlTnbdvYhoBnrnpwTRAi_OpVsE3t8x3rCbawAX0xWr8DCEqN-oAMgBOTqV4sUZf3iLrIMqaemZMW7RHnb-Yca8N87hqF2jOO2BYp8s_A1slaoxO9PsrecUbL1cmikFCvBkM2MTj14anNsA2;csid=5983;adid=d76e91d1-c388-43e0-80d4-e5d2d2d88433;adxvars=HS6yK-sOqv-1fPyr11dm_6BGslur9fzrg_hrkrEE0ZYrJFpR1MQf7iLpjmHovAXLOxbbHv_Bnku7Ol7vVZlRfr556N2T5UMYiwkr38QOE3QXw1MKZdoRQA0ImxWZ0HYhDPdUAWNlw3MePyTmLy3yBSujcucQWKPqnAfYJ8rOv72wHGz6B6dJ1w2;adxcmd=QTwuOIuaMWxxWXp_eBE_5w2;msrc=1;;js=1;adfxid=1x;10848;set=en-GB|en-GB|360X740|0|0|0|24|8|3|7|0;fd=2|15&CREFURL=file%3A%2F%2Fandroid_assets%2F, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
09-19 09:52:13.537 25613-25613/com.trondheim.android.dev E/AdformSDK: onErrorLoading! A parser-blocking, cross site (i.e. different eTLD+1) script, https://track.adform.net/adfserve/?bn=23124500;rtbwp=17nOlXG9bA41;rtbdata=TLuJtLWio-VYmx2bOOzjpPnIoJxbx9QEJU8QxKLM3POfzzOsvKg9o4-lZvAqejyE-r36bPjMxf_IMqaemZMW7RHnb-Yca8N87hqF2jOO2BYp8s_A1slaoxO9PsrecUbL1cmikFCvBkM2MTj14anNsA2;csid=5983;adid=d76e91d1-c388-43e0-80d4-e5d2d2d88433;adxvars=PM8dDg51Feu1fPyr11dm_6BGslur9fzrMVIi6Rr9QUQrllr0PNkbsFD0l5QBSVoJK83IHH3P4GJp1vO9jMVIMIpPetz-FYyGajjaLwmQ_pPojAo_jkNAlBUFEDH0iLGbHsY4P4Fig1YePyTmLy3yBSujcucQWKPqaReKE4J-UOSwHGz6B6dJ1w2;adxcmd=QTwuOIuaMWxxWXp_eBE_5w2;msrc=1;;js=1;adfxid=1x;9297;set=en-GB|en-GB|360X740|0|0|0|24|8|3|7|0;fd=2|15&CREFURL=file%3A%2F%2Fandroid_assets%2F, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
09-19 09:52:13.542 25613-25613/com.trondheim.android.dev E/AdformSDK: onErrorLoading! A parser-blocking, cross site (i.e. different eTLD+1) script, https://track.adform.net/adfserve/?bn=23124500;rtbwp=17nOlXG9bA41;rtbdata=TLuJtLWio-VYmx2bOOzjpPnIoJxbx9QEJU8QxKLM3POfzzOsvKg9o4-lZvAqejyE-r36bPjMxf_IMqaemZMW7RHnb-Yca8N87hqF2jOO2BYp8s_A1slaoxO9PsrecUbL1cmikFCvBkM2MTj14anNsA2;csid=5983;adid=d76e91d1-c388-43e0-80d4-e5d2d2d88433;adxvars=PM8dDg51Feu1fPyr11dm_6BGslur9fzrMVIi6Rr9QUQrllr0PNkbsFD0l5QBSVoJK83IHH3P4GJp1vO9jMVIMIpPetz-FYyGajjaLwmQ_pPojAo_jkNAlBUFEDH0iLGbHsY4P4Fig1YePyTmLy3yBSujcucQWKPqaReKE4J-UOSwHGz6B6dJ1w2;adxcmd=QTwuOIuaMWxxWXp_eBE_5w2;msrc=1;;js=1;adfxid=1x;9297;set=en-GB|en-GB|360X740|0|0|0|24|8|3|7|0;fd=2|15&CREFURL=file%3A%2F%2Fandroid_assets%2F, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
09-19 09:52:13.554 25613-25613/com.trondheim.android.dev E/AdformSDK: onErrorLoading! A parser-blocking, cross site (i.e. different eTLD+1) script, https://track.adform.net/adfserve/?bn=23124500;rtbwp=17nOlXG9bA41;rtbdata=y-qlpM7IQDV4Am83ERhoFr0OApOxgjMCWU2bLsu1RhfXLNUzYef-ZRF2sw1v5y_aJvD5GhdjIFXIMqaemZMW7RHnb-Yca8N87hqF2jOO2BYp8s_A1slaoxO9PsrecUbL1cmikFCvBkM2MTj14anNsA2;csid=5983;adid=d76e91d1-c388-43e0-80d4-e5d2d2d88433;adxvars=yjKiCVjVp6K1fPyr11dm_6BGslur9fzrqhsMKZuXjFLo-k8hf855II9wC1NjsljYi8YaUWQ0Sz8CABgeMIpCojRysxqgOONqmlHoY_UZhBsPtIDG1NM8Q-xkdmoqRYaSNvmNxVfvlqUePyTmLy3yBSujcucQWKPquWfRQ0TIn-qwHGz6B6dJ1w2;adxcmd=QTwuOIuaMWxxWXp_eBE_5w2;msrc=1;;js=1;adfxid=1x;783;set=en-GB|en-GB|360X740|0|0|0|24|8|3|7|0;fd=2|15&CREFURL=file%3A%2F%2Fandroid_assets%2F, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
09-19 09:52:13.567 25613-25613/com.trondheim.android.dev E/AdformSDK: onErrorLoading! A parser-blocking, cross site (i.e. different eTLD+1) script, https://track.adform.net/adfserve/?bn=23124500;rtbwp=17nOlXG9bA41;rtbdata=y-qlpM7IQDV4Am83ERhoFr0OApOxgjMCWU2bLsu1RhfXLNUzYef-ZRF2sw1v5y_aJvD5GhdjIFXIMqaemZMW7RHnb-Yca8N87hqF2jOO2BYp8s_A1slaoxO9PsrecUbL1cmikFCvBkM2MTj14anNsA2;csid=5983;adid=d76e91d1-c388-43e0-80d4-e5d2d2d88433;adxvars=yjKiCVjVp6K1fPyr11dm_6BGslur9fzrqhsMKZuXjFLo-k8hf855II9wC1NjsljYi8YaUWQ0Sz8CABgeMIpCojRysxqgOONqmlHoY_UZhBsPtIDG1NM8Q-xkdmoqRYaSNvmNxVfvlqUePyTmLy3yBSujcucQWKPquWfRQ0TIn-qwHGz6B6dJ1w2;adxcmd=QTwuOIuaMWxxWXp_eBE_5w2;msrc=1;;js=1;adfxid=1x;783;set=en-GB|en-GB|360X740|0|0|0|24|8|3|7|0;fd=2|15&CREFURL=file%3A%2F%2Fandroid_assets%2F, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
09-19 09:52:13.883 25613-25613/com.trondheim.android.dev E/AdformSDK: onErrorLoading! A parser-blocking, cross site (i.e. different eTLD+1) script, https://track.adform.net/adfscript/?bn=23123188;OOBClickTrack=https://track.adform.net/C/?bn=23124500;crtbwp=17nOlXG9bA41;crtbdata=-bFurvqWJlTnbdvYhoBnrnpwTRAi_OpVsE3t8x3rCbawAX0xWr8DCEqN-oAMgBOTqV4sUZf3iLrIMqaemZMW7RHnb-Yca8N87hqF2jOO2BYp8s_A1slaoxO9PsrecUbL1cmikFCvBkM2MTj14anNsA2;ccsid=5983;adfibeg=0;cdata=FC5JA-eRVOrYRJ3Q6FqMPZQCcqEvmJI6T1MvCtPjuBryIP4jCQMdExifjMTJorF9jYaYK4xnqc7elMJhVIq2DdT87SCWwdjsQ5BYOZytQFpXvjBaPj_fG9VRm2KXWgJZ_g7vHhwFPybpri0sRiYrH74FNd4gg6cwrTYyRXl9mT5DM-prYtmpVcDOuGNFWReT-E3Ve2RKuWJvwJ3OyDDxCiMYJEuMZofYcuKvG_4eqJpTXe0IxqSkAin9oMIRQcZzdTwomsFaIjIp3-HcdHOt-mT0lQkXAT8x0;;CREFURL=file%3a%2f%2fandroid_assets%2f;C=1, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
09-19 09:52:13.891 25613-25821/com.trondheim.android.dev E/chromium: [ERROR:bad_message.cc(25)] Terminating renderer for bad IPC message, reason 95
09-19 09:52:13.892 25613-25613/com.trondheim.android.dev E/AdformSDK: onErrorLoading! A parser-blocking, cross site (i.e. different eTLD+1) script, https://track.adform.net/adfscript/?bn=23123188;OOBClickTrack=https://track.adform.net/C/?bn=23124500;crtbwp=17nOlXG9bA41;crtbdata=-bFurvqWJlTnbdvYhoBnrnpwTRAi_OpVsE3t8x3rCbawAX0xWr8DCEqN-oAMgBOTqV4sUZf3iLrIMqaemZMW7RHnb-Yca8N87hqF2jOO2BYp8s_A1slaoxO9PsrecUbL1cmikFCvBkM2MTj14anNsA2;ccsid=5983;adfibeg=0;cdata=FC5JA-eRVOrYRJ3Q6FqMPZQCcqEvmJI6T1MvCtPjuBryIP4jCQMdExifjMTJorF9jYaYK4xnqc7elMJhVIq2DdT87SCWwdjsQ5BYOZytQFpXvjBaPj_fG9VRm2KXWgJZ_g7vHhwFPybpri0sRiYrH74FNd4gg6cwrTYyRXl9mT5DM-prYtmpVcDOuGNFWReT-E3Ve2RKuWJvwJ3OyDDxCiMYJEuMZofYcuKvG_4eqJpTXe0IxqSkAin9oMIRQcZzdTwomsFaIjIp3-HcdHOt-mT0lQkXAT8x0;;CREFURL=file%3a%2f%2fandroid_assets%2f;C=1, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
09-19 09:52:13.896 25613-25613/com.trondheim.android.dev E/AdformSDK: onErrorLoading! A parser-blocking, cross site (i.e. different eTLD+1) script, https://track.adform.net/adfscript/?bn=23123188;OOBClickTrack=https://track.adform.net/C/?bn=23124500;crtbwp=17nOlXG9bA41;crtbdata=y-qlpM7IQDV4Am83ERhoFr0OApOxgjMCWU2bLsu1RhfXLNUzYef-ZRF2sw1v5y_aJvD5GhdjIFXIMqaemZMW7RHnb-Yca8N87hqF2jOO2BYp8s_A1slaoxO9PsrecUbL1cmikFCvBkM2MTj14anNsA2;ccsid=5983;adfibeg=0;cdata=FC5JA-eRVOrYRJ3Q6FqMPZQCcqEvmJI6CfZabOvMJjpA530GmQkwhOprGqlap3PAjYaYK4xnqc59-ZzwOxU_Hm7JHsWnJwN8Q5BYOZytQFrXk3HNasS_Ija4lw2YUElxeObzDfVdVNuJpufeuCsG6IsCMxgN67iXrOOAoYpDYKVisj2vNZp1eYGKz40W3GcGx0KQqEIEhnzcA7Rkqp9GXErpjFFXpgLkcuKvG_4eqJoQ12WaX5nXyL_bi8f2rtI7dTwomsFaIjIp3-HcdHOt-mT0lQkXAT8x0;;CREFURL=file%3a%2f%2fandroid_assets%2f;C=1, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
09-19 09:52:13.914 25613-25613/com.trondheim.android.dev E/AdformSDK: onErrorLoading! A parser-blocking, cross site (i.e. different eTLD+1) script, https://track.adform.net/adfscript/?bn=23123188;OOBClickTrack=https://track.adform.net/C/?bn=23124500;crtbwp=17nOlXG9bA41;crtbdata=y-qlpM7IQDV4Am83ERhoFr0OApOxgjMCWU2bLsu1RhfXLNUzYef-ZRF2sw1v5y_aJvD5GhdjIFXIMqaemZMW7RHnb-Yca8N87hqF2jOO2BYp8s_A1slaoxO9PsrecUbL1cmikFCvBkM2MTj14anNsA2;ccsid=5983;adfibeg=0;cdata=FC5JA-eRVOrYRJ3Q6FqMPZQCcqEvmJI6CfZabOvMJjpA530GmQkwhOprGqlap3PAjYaYK4xnqc59-ZzwOxU_Hm7JHsWnJwN8Q5BYOZytQFrXk3HNasS_Ija4lw2YUElxeObzDfVdVNuJpufeuCsG6IsCMxgN67iXrOOAoYpDYKVisj2vNZp1eYGKz40W3GcGx0KQqEIEhnzcA7Rkqp9GXErpjFFXpgLkcuKvG_4eqJoQ12WaX5nXyL_bi8f2rtI7dTwomsFaIjIp3-HcdHOt-mT0lQkXAT8x0;;CREFURL=file%3a%2f%2fandroid_assets%2f;C=1, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
 09-19 09:52:14.009 25613-25613/com.trondheim.android.dev E/chromium: [ERROR:aw_browser_terminator.cc(86)] Render process (25816) kill (OOM or update) wasn't handed by all associated webviews, killing application.
</code>
Help me fix this bug
It may be due to "Google Chrome started implementing Blocking the load of cross-origin, parser-blocking scripts inserted via document.write in the main frame"
Answer: This issue should be fixed in newest sdk version. https://github.com/adform/adform-android-sdk/releases/tag/2.13.2
Comment: Ads returns onAdLoadSuccess(), but doesn't load ads with master tag id = 322482 ?


Inline fields on node edit form

Question: I managed to get fields inline on node display, but cant find a module to help me do it on node input. I am mostly using DS, field collection and field group (field gruop has this option but only for display, not for edit.)
Answer: Display processors are not used when rendering the node form. It's a completely different process. I'm not aware of any contrib modules that will help you accomplish this. However you can write your own.
You need to start by creating a very simple custom module with just a .info, a .module and a .css file. You can find lots of tutorials online.
Then you want to write that CSS to make your particular form fields inline and attach the css to the form using hook_form_alter. If you named your module "hook" the code would look like this (This code goes in your hook.module file):
// Replace hook with name of module and yourcontenttype
// with machine name of your content type
hook_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'yourcontenttype_node_form') {
    $form['#attached']['css'][] = drupal_get_path('module', 'hook') . '/hook.css';
  }
}

After that enable the module, clear all caches and it should be including the new CSS in the admin form.
Comment: Isn't a '/' missing at the beginning of the .css filename: `'/hook.ccs';`?
Comment: Thanks. If you could please point of few tutorials how to start on this would be great. I dont know much about coding (css i understand a bit), but with mentioned modules above i was able to do whatever i want for displaying nodes, even for editing node forms there are many nice options that made edit forms look exaclly as i want, but this specific feature is missing in all of them.
Comment: This would be a good place to start: https://www.drupal.org/node/1419390

Inline fields on node edit form


Oscillating Volume of partials of a single note on piano

Question: This question may be better suited to the physics stack exchange but I figure I'll ask here as well. So a month or two ago after trying to learn to overtone sing for a couple days I finally managed to produce perceptible overtones over a fundamental. In the following week I practiced my new skill pretty obsessively. A side effect I've found is that now, with some effort, I am able to hear the overtones in other instruments. For example, if I sustain a middle C on my upright piano, with conscious effort I can hear the first six partials (fundamental (C4), C5, G5, C6, E6, G6). I can barely hear the sixth partial and cannot hear any trace of the seventh or above. However, the partials do not sound like sustained pitches that slowly attenuate like I would expect. Instead there is a distinct pulsating effect where, for any partial save the first, the volume oscillates between between audible and inaudible at a frequency somewhere in the range of .1Hz–10Hz. What causes this effect? It seems similar to the dissonant beating produced by two sine waves that are slightly out of tune with each other. Is this what is happening i.e. the different C-partials, E-partials etc. are slightly out of tune with each other?
Here is a recording I took: https://drive.google.com/file/d/1ulnHyYwEmGaxgT-hB5XxpaeFVwTkTWDF/view?usp=drivesdk
The oscillations appear to be around 0.5 Hz
Comment: "cannot hear any trace of the seventh or above": this is by design.  The hammer is positioned to minimize the seventh harmonic.
Comment: Is your piano in tune? That is, are all three middle-C strings in tune with each other?
Comment: @phoog That's fascinating! Can you source it, so that if I post it as a question, it can have a documented answer?
Comment: @Aaron It hasn't been tuned since 2018. I forgot that most keys strike multiple strings but this is likely what is is causing the effect i.e. the different strings and therefore partials are all very slightly out of tune with each other and thus produce a slow beating effect.
Comment: @phoog, ah, thanks for your reminder about the hammer position and avoiding the 7th harmonic! :)
Answer: Based on discussion in the comments, the issue is probably that the piano is out of tune ("It hasn't been tuned since 2018"). Most keys have multiple strings tuned to the same pitch. Middle C, for example, has 3 strings. Given the description "similar to ... dissonant beating", it seems the likely culprit that the three are not in tune with each other.


The splitting field of $x^{20}-1$ over $\mathbb Q$

Question: I am trying to find the splitting field of $x^{20}-1$ over $\mathbb Q$. I know that it has degree $8$ over $\mathbb Q$, and that $i$ and $\sqrt5$ are in the splitting field. I am also suspecting that $\sqrt[4]5$ is in the splitting field, which would mean that the splitting field is $\mathbb Q(i, \sqrt[4]5)$, but am uncertain about how to prove this. Could anyone help me on those regards?
EDIT: After consideration, the splitting field is most likely $\mathbb Q(i, \sqrt{10+2\sqrt5})$, but how does one show this without the exact trigonometric value?
Comment: What @Apass.Jack said is correct. A simple way to see that is to observe that the Galois group of this splitting field is Abelian. Hence every subgroup of the Galois group is normal, implying that every intermediate field is a normal extension of $\Bbb{Q}$. but $\Bbb{Q}(\root4\of5)$  is not normal.
Comment: It can be proved that $\sqrt[4]5$ is not in the splitting field of $x^{20}-1$.
Comment: https://en.wikipedia.org/wiki/Cyclotomic_field et https://en.wikipedia.org/wiki/Exact_trigonometric_values I doubt $\sqrt[4]5$ is in the splitting field $\Bbb Q(i,\sqrt{10+2\sqrt{5}}).$
Comment: Thanks! I know that this is the splitting field, but how does one prove it without knowing the exact trigonometric value?
Comment: I edited the tags a bit. There are infinitely many elements in $\Bbb{Q}$ already, so [tag:finite-fields] was inappropriate. I would use [tag:field-theory] instead.
Answer: Let $S$ be the splitting field of $x^{20}-1$ over $\Bbb Q$.
Let $i\not=\pm1$ be a root of $x^4-1=0$, i.e., $i$ is the imaginary unit.
Let $\alpha\not=1$ be a root of $x^5-1=0$.
Consider $i^j\alpha^k$, where $0\le j<4$ and $0\le k<5$.

$(i^j\alpha^k)^{20}=(i^{20})^j(\alpha^{20})^k=1\cdot1=1.$

Suppose $i^{j_1}\alpha^{k_1}=i^{j_2}\alpha^{k_2}$, where $0\le j_1,j_2<4$, $0\le k_1,k_2<5$. Then $i^{j_2-j_1}\alpha^{k_2-k_1}=1$.

$1=(i^{j_2-j_1}\alpha^{k_2-k_1})^4=\alpha^{4(k_2-k_1)}=\frac1{\alpha^{k_2-k_1}}$. Hence $k_2=k_1$.
$1=(i^{j_2-j_1}\alpha^{k_2-k_1})^5=i^{5(j_2-j_1)}=i^{j_2-j_1}$. Hence $j_2=j_1$.

Hence, all roots of $x^{20}-1$ are $i^j\alpha^k$. The splitting field is $Q(i,\alpha)$.
(More generally, the splitting field of $x^{ab}-1$ is the product field of the splitting field of $x^a-1$ and that of $x^b-1$ when $\gcd(a,b)=1$).

What are the roots of $x^5-1=0$?
Since $x^5-1=(x-1)(x^2+\frac{1+\sqrt5}2x+1)(x^2+\frac{1-\sqrt5}2x+1)$,
the roots are
$(1, \frac{-1- \sqrt 5\pm i\sqrt{10 - 2\sqrt 5}}4, \frac{-1+ \sqrt 5\pm i\sqrt{10 + 2\sqrt 5}}4).$
Consider root $\alpha = \frac{-1+ \sqrt 5+ i\sqrt{10 + 2\sqrt 5}}4\not=1$.
We know $$S=\Bbb Q(i,\alpha),$$
which can be the sought solution.

$\frac1\alpha=\frac{-1+ \sqrt 5- i\sqrt{10 + 2\sqrt 5}}4$.
$\sqrt 5=4(\alpha +\frac1\alpha)+\frac12$.
Hence $\sqrt5\in S$. So is $\sqrt{10+2\sqrt5}=(4\alpha+1-\sqrt5)/i$. Hence, $\Bbb Q(i, \sqrt{10+2\sqrt5})\subseteq S$.
One the other hand, since $\sqrt5=\frac{\left(\sqrt{10+2\sqrt5}\right)^2-10}2$, we have $\alpha\in \Bbb Q(i, \sqrt{10+2\sqrt5})$. Hence $S\subseteq \Bbb Q(i, \sqrt{10+2\sqrt5})$.
So we know $$ S=\Bbb Q(i, \sqrt{10+2\sqrt5}),$$ which can be the sought solution, too, as you suspected.

Similarly, we can obtain $$S=\Bbb Q(i, \beta)=\Bbb Q(i, \sqrt{10-2\sqrt 5})$$ using $\beta=\frac{-1- \sqrt 5+ i\sqrt{10 - 2\sqrt 5}}4$, another root of $x^5=1$.
It must be true that $\sqrt{10 - 2\sqrt 5}\in Q(i, \sqrt{10+2\sqrt 5})$. Here is how we can see this containment directly. Note that $(10-2\sqrt5)(10+2\sqrt5)=80$, we have
$$\sqrt{10-2\sqrt5}=\frac{4\sqrt5}{\sqrt{10 + 2\sqrt 5}}\in Q(\sqrt{10 + 2\sqrt 5}).$$
Answer: Hint
Take a primitive $20$th root of unity $\zeta$.  Its minimal polynomial is $\Phi_{20}$, the twentieth cyclotomic polynomial over $\Bbb Q.$  It's irreducible by a result of Gauss's.
Then you want $\Bbb Q(\zeta).$
Since $\cos(\pi /{10})=1/4(\sqrt{2\sqrt5 +10}),$ we should have $\Bbb Q(\zeta) =\Bbb Q(i,\sqrt{2\sqrt5 +10}).$
Comment: The field $\mathbb{Q}(i, \sqrt{5})$ only has degree $4$ over $\mathbb{Q}$, but the field we are looking for has degree $8$ over $\mathbb{Q}$.
Comment: Oh yeah,  you're right.   @BrianShin


CCK E-mail field, display e-mail form in js dialog

Question: I set display cck field to 'e-mail contact form'. It lead to page like email/15/field_email.
Is this possible to display that form in modal dialog? Which modules I should use?
Answer: You can do this with a few lines of JavaScript.
All you need to do is to create a iframe that links the the clicked link and then open it in a dialog. jQuery UI has support for dialogs. There is modules for integrating jQuery UI and upgrading your jQuery version (if needed).
Once that is done, you can add the JavaScript to your theme to create the wanted effect.


Limit of ratio of coefficients is radius of convergence

Question: Consider a power series $\sum\limits_{n=0}^\infty c_n z^n$, for which the limit $\lim\limits_{n\to\infty}\left| \frac{c_n}{c_{n+1}} \right|=R$ holds. I want to prove that this limit implies that the radius of convergence of the series is also $R$. But I'm struggling with this, because I do not understand the relationship between the ratio of the coefficients of a sequence and the radius of convergence of the respective infinite series. Namely, we are dealing with a radius of convergence, which implies that $\exists$ an open ball $B(0, R)$ such that the series converges whenever $z\in B(0, R)$. But how does this relate to the coefficients? I also understand that the limit above looks like the ratio test, but I'm having difficulty extracting anything useful from this fact for my proof.
So, how do I formalize what exactly I need to show, in such a way that would allow me to understand how to build the proof around that? I also need to understand the relationship between $c_n$'s and the set $B(0, R)$. Would appreciate your help!
Comment: If the limit of the ratio test is finite, then that means at large n the $c_n$s behave like a geometric series. What's the condition on a geometric series converging?
Comment: Consider $\sum \left| \frac{c_n}{c_{n+1}} \right|=\sum x^n=\frac{1}{1-x}$ for some $x\in \mathbb{R}$. But then, shouldn't it be true that $\{x^n\}$ must converge to $0$ in order for the preceding expression to hold true? How do I arrive at $\frac{1}{1-R}$? Also, how do we ascertain that such an $x$ exists?
Answer: Here's the key, if you were to apply the ratio test to $c_nz^n$, you would get the following:
$$
\lim_{n\rightarrow\infty}\left|\frac{c_nz^n}{c_{n+1}z^{n+1}}\right|=\frac{1}{|z|}\lim_{n\rightarrow\infty}\left|\frac{c_n}{c_{n+1}}\right|=\frac{1}{|z|}R.
$$
By the ratio test (in the way you set it up), we know that this converges absolutely if
$$
\frac{1}{|z|}R>1
$$
In other words, if
$$
R>|z|.
$$
Comment: @sequence You don't. $R \le |z|$ is a closed ball, not an open one.
Comment: I've already arrived at this, but then how do I prove that $R\le|z|$ to arrive at the equality?
Comment: @eyeballfrog Oh, I see. Just the fact that $R>|z|$ is sufficient for the proof. Thank you very much. I was over-complicating this.


Criar uma imagem com efeito de blur no Xamarin.Android

Question: Como posso criar uma imagem com efeito de blur no Xamarin.Android?
Apenas achei soluções em Java e nada realmente funcional e ágil para Xamarin.Android.
O que tentei usar sem sucesso foi o apresentado nessa pergunta: Link
Alguma ideia?
Answer: Apenas converti o código Java para Xamarin.Android. É ágil e perfeitamente funcional.
Testei outros métodos, os quais se diziam mais ágeis em Java e, pelo menos para mim, foram mais lentos que esse apresentado abaixo.
<code>private const float BITMAP_SCALE = 0.4f;
private const float BLUR_RADIUS = 7.5f;

/// <summary>
/// Cria uma imagem com efeito de blur
/// </summary>
/// <param name="context">Contexto</param>
/// <param name="image">Objeto 'Bitmap' com a imagem</param>
/// <returns></returns>
private Android.Graphics.Bitmap CreateBlurredImage(Context context, Android.Graphics.Bitmap image)
{
      int width = (int)Math.Round(image.Width * BITMAP_SCALE);
      int height = (int)Math.Round(image.Height * BITMAP_SCALE);

      Android.Graphics.Bitmap inputBitmap = Android.Graphics.Bitmap.CreateScaledBitmap(image, width, height, false);
      Android.Graphics.Bitmap outputBitmap = Android.Graphics.Bitmap.CreateBitmap(inputBitmap);

      RenderScript rs = RenderScript.Create(context);
      ScriptIntrinsicBlur theIntrinsic = ScriptIntrinsicBlur.Create(rs, Element.U8_4(rs));
      Allocation tmpIn = Allocation.CreateFromBitmap(rs, inputBitmap);
      Allocation tmpOut = Allocation.CreateFromBitmap(rs, outputBitmap);
      theIntrinsic.SetRadius(BLUR_RADIUS);
      theIntrinsic.SetInput(tmpIn);
      theIntrinsic.ForEach(tmpOut);
      tmpOut.CopyTo(outputBitmap);

      return outputBitmap;
}
</code>
Caso queira mudar a forma que o blur se comporta, apenas altere a constante BLUR_RADIUS.


Bash script to rename all files in a directory

Question: I have a directory with a bunch of files names like this:
DetailedFeatureNameIntegrationTest.java

and I want to rename all the files to
DetailedFeatureNameIntegTest.java.

I just want to replace 'Integration' with 'Integ'
is there a quick way to do this?
Comment: What exactly is your criterion, just replacing `Integration` with `Integ`?
Comment: Yes it is, I will edit the question to clarify
Answer: Using pure bash,
for f in *.java; do
    mv -- "$f" "${f//ration/}"
done

assuming you don't have a situation like both DetailedFeatureNameIntegrationTest.java and DetailedFeatureNameIntegTest.java already in the same directory.
Answer: With the perl rename utility:
rename 's/Integration/Integ/' *.java


How to gzip stats endpoint in Istio?

Question: We are scraping the metrics of many istio-proxy sidecars with Prometheus. As these are many metrics, we would like to compress the payload to save us some bandwidth.
Out of the box the stats endpoint does not seem to be compressed with Istio 1.8.2:
$ kubectl exec -it my-pod-0 -c server -- curl -o /dev/null -vsS --compressed http://127.0.0.1:15090/stats/prometheus
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 15090 (#0)
> GET /stats/prometheus HTTP/1.1
> Host: 127.0.0.1:15090
> User-Agent: curl/7.61.1
> Accept: */*
> Accept-Encoding: deflate, gzip
>
< HTTP/1.1 200 OK
< content-type: text/plain; charset=UTF-8
< cache-control: no-cache, max-age=0
< x-content-type-options: nosniff
< date: Fri, 19 Feb 2021 10:42:25 GMT
< server: envoy
< x-envoy-upstream-service-time: 2
< transfer-encoding: chunked
<
{ [26267 bytes data]
* Connection #0 to host 127.0.0.1 left intact

How do I get the sidecar to compress the stats traffic?

So far I tried adding an EnvoyFilter, but I honestly have no idea about the Envoy internals and I failed to find docs that help me understanding it.
My understanding is that I have to add the compress filter to this:
$ istioctl proxy-config listeners maintenance-0 --port 15090 -o json | gron
json = [];
json[0] = {};
json[0].address = {};
json[0].address.socketAddress = {};
json[0].address.socketAddress.address = "0.0.0.0";
json[0].address.socketAddress.portValue = 15090;
json[0].filterChains = [];
json[0].filterChains[0] = {};
json[0].filterChains[0].filters = [];
json[0].filterChains[0].filters[0] = {};
json[0].filterChains[0].filters[0].name = "envoy.filters.network.http_connection_manager";
json[0].filterChains[0].filters[0].typedConfig = {};
json[0].filterChains[0].filters[0].typedConfig.httpFilters = [];
json[0].filterChains[0].filters[0].typedConfig.httpFilters[0] = {};
json[0].filterChains[0].filters[0].typedConfig.httpFilters[0].name = "envoy.filters.http.router";
json[0].filterChains[0].filters[0].typedConfig.httpFilters[0].typedConfig = {};
json[0].filterChains[0].filters[0].typedConfig.httpFilters[0].typedConfig["@type"] = "type.googleapis.com/envoy.extensions.filters.http.router.v3.Router";
json[0].filterChains[0].filters[0].typedConfig.routeConfig = {};
json[0].filterChains[0].filters[0].typedConfig.routeConfig.virtualHosts = [];
json[0].filterChains[0].filters[0].typedConfig.routeConfig.virtualHosts[0] = {};
json[0].filterChains[0].filters[0].typedConfig.routeConfig.virtualHosts[0].domains = [];
json[0].filterChains[0].filters[0].typedConfig.routeConfig.virtualHosts[0].domains[0] = "*";
json[0].filterChains[0].filters[0].typedConfig.routeConfig.virtualHosts[0].name = "backend";
json[0].filterChains[0].filters[0].typedConfig.routeConfig.virtualHosts[0].routes = [];
json[0].filterChains[0].filters[0].typedConfig.routeConfig.virtualHosts[0].routes[0] = {};
json[0].filterChains[0].filters[0].typedConfig.routeConfig.virtualHosts[0].routes[0].match = {};
json[0].filterChains[0].filters[0].typedConfig.routeConfig.virtualHosts[0].routes[0].match.prefix = "/stats/prometheus";
json[0].filterChains[0].filters[0].typedConfig.routeConfig.virtualHosts[0].routes[0].route = {};
json[0].filterChains[0].filters[0].typedConfig.routeConfig.virtualHosts[0].routes[0].route.cluster = "prometheus_stats";
json[0].filterChains[0].filters[0].typedConfig.statPrefix = "stats";
json[0].filterChains[0].filters[0].typedConfig["@type"] = "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager";

So far I tried creating the filter a few times and this is my latest try:
---
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: gzip
spec:
  workloadSelector:
    labels:
      app: my-pod
  configPatches:
    - applyTo: HTTP_FILTER
      match:
        context: SIDECAR_INBOUND
        listener:
          filterChain:
            filter:
              name: envoy.http_connection_manager
              subFilter:
                name: envoy.router
      patch:
        operation: INSERT_BEFORE
        value:
          name: envoy.filters.http.compressor
          typed_config:
            '@type': type.googleapis.com/envoy.extensions.filters.http.compressor.v3.Compressor
            compressor_library:
              name: text_optimized
              typed_config:
                '@type': type.googleapis.com/envoy.extensions.compression.gzip.compressor.v3.Gzip
            remove_accept_encoding_header: true

I do not really know what to put into the .spec.configPatches.match section. The patch and applyTo section probably are wrong too.
Comment: I would also suggest to open a feature request on istio side, so that it's more easily configurable. That would benefit to anyone running in prod
Comment: Config looks good. Try using v2 filters, I had problem getting some v3 filter to work. Eg: https://www.envoyproxy.io/docs/envoy/latest/api-v2/config/filter/http/gzip/v2/gzip.proto#config-filter-http-gzip-v2-gzip
Comment: I created a feature request here: https://github.com/istio/istio/issues/30987. I am still looking for a workaround, because this might take a while and I want to understand the filters.
Answer: With help in an Istio issue, we made it work. I am copying my original response from: https://github.com/istio/istio/issues/30987#issuecomment-822517456
I got a working example and our network usage went down from ~20MBytes/s to ~30KBytes/s (yes, from Mega to Kilo ). First I thought there was any error, but the data was complete and I did a short check with my CLI:
$ kubectl exec elasticsearch-0 -c istio-proxy -- timeout 1 curl -Ss --fail --compressed -w '%{size_download}' -i http://localhost:14090/stats/prometheus | tail -n 1
7763

$ kubectl exec elasticsearch-0 -c istio-proxy -- timeout 1 curl -Ss --fail -w '%{size_download}' -i http://localhost:14090/stats/prometheus | tail -n 1
330315

It is only 2.35% of its original size and both have the same mount of lines!
Here is the custom bootstrap, that need to be added to each pod with the sidecar.istio.io/bootstrapOverride: "istio-custom-bootstrap-config"
annotation.
apiVersion: v1
kind: ConfigMap

metadata:
  annotations:
  name: istio-custom-bootstrap-config
  namespace: default

data:
  custom_bootstrap.json: |-
    {
        "staticResources": {
            "listeners": [
                {
                    "address": {
                        "socketAddress": {
                            "address": "0.0.0.0",
                            "portValue": 14090
                        }
                    },
                    "filterChains": [
                        {
                            "filters": [
                                {
                                    "name": "envoy.filters.network.http_connection_manager",
                                    "typedConfig": {
                                        "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
                                        "httpFilters": [
                                            {
                                                "name": "envoy.filters.http.compressor",
                                                "typed_config": {
                                                    "@type": "type.googleapis.com/envoy.extensions.filters.http.compressor.v3.Compressor",
                                                    "compressor_library": {
                                                        "name": "text_optimized",
                                                        "typed_config": {
                                                            "@type": "type.googleapis.com/envoy.extensions.compression.gzip.compressor.v3.Gzip"
                                                        }
                                                    },
                                                    "remove_accept_encoding_header": true
                                                }
                                            },
                                            {
                                                "name": "envoy.filters.http.router",
                                                "typedConfig": {
                                                    "@type": "type.googleapis.com/envoy.extensions.filters.http.router.v3.Router"
                                                }
                                            }
                                        ],
                                        "routeConfig": {
                                            "virtualHosts": [
                                                {
                                                    "domains": [
                                                        "*"
                                                    ],
                                                    "name": "backend",
                                                    "routes": [
                                                        {
                                                            "match": {
                                                                "prefix": "/stats/prometheus"
                                                            },
                                                            "route": {
                                                                "cluster": "prometheus_stats"
                                                            }
                                                        }
                                                    ]
                                                }
                                            ]
                                        },
                                        "statPrefix": "stats"
                                    }
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    }

I had to change the port, because it is easy to maintain when there gets anything added to staticResources.listeners in future updates.

How to gzip stats endpoint in Istio?


How to test whether or not students are capable of long division?

Question: I have a randomly selected group of 25 children from an unknown population size, and I am trying to determine if the student population as a whole are capable of long division. Each student is represented by an ID number S1 through to S25 and they are given a long division problem to solve and the result is stored as a 1 for success and 0 for failure (example and link to full sized example table below).
Student ID   Pass/Fail
S1           1
S2           1
S3           1
S4           1
S5           1
S6           0
S7           0

Google Drive Link to Example Data
The data looks like most students are capable and long division will not have to be re-taught but how can I statistically test that the skew towards pass (1) is greater than if pass and fail results were generated randomly?
I know it appears simple but I am new to statistics.
Comment: In my opinion, the problem with this is you need to (quantitatively speaking) define what "capable" means (usually in a quantitative sense). Maybe I'm wrong, though, and someone else will know something that I don't.
Comment: In order to have a testable hypothesis, you need to provide a quantitative criterion for "as a whole" or "most." Does that mean more than half?  If not, exactly what does it mean?
Comment: If your hypothesis is that *all* students know long division, then a single zero in your dataset disproves it.  It's difficult to justify the meaningfulness of a model in which students would be correct with 50% probability: getting a long division answer right isn't a guessing game.  Arguably, correct answers are unlikely to be accidentally correct.
Comment: Let $p$ = the true proportion of students who can do long division. You want to test the hypothesis $p = .50$ versus the alternative that $p > .50$. However, it seems that if for example $.55$ proportion of students are capable of long division, this seems like a rather small number when the goal is to teach this concept. So you might want to figure out a higher number that is satisfying to you, and then test that hypothesis.
Comment: Although what @Greenparker says is valid, be very careful not to misinterpret it!  If you develop your hypothesis by examining these data, *then you cannot turn around and test that hypothesis with the same data.*  Normally, your hypothesis is related to a meaningful, quantitative question.  You should be able to construct one before you ever see the data.
Comment: OK assuming that passing the long division test means, in the eyes of those concerned, the student is capable. Because that is where the problem lies for me. I can say the data looks like most are capable but I need to test it more rigorously than simply looking at the data.
Comment: Well my hypothesis is that all students know long division and my null is that they all do not know long division. in other words the results are skewed to pass greater than they would be if 1s and 0s were randomly generated.
Answer:
How can I statistically test that the skew towards pass (1) is greater than if pass and fail results were generated randomly?

Testing this hypothesis would lend itself to a binominal test comparing the number of students passing, out of total students tested, with the default proportion 0.5.
But is this really what you want to know? It is probably not a relevant question whether the proportion of students getting the correct answer is different than 50%.  And as @whuber pointed out, there is no reason to suspect that for this kind of task that incapable students would get the correct answer 50% of the time.  (This would be the case if it were a multiple choice question with two options.)
My suggestion would be to calculate the proportion of students passing, and calculate a confidence interval about this proportion. This result would probably be meaningful for what you are trying to determine.
When calculating the confidence interval, be sure to use a method appropriate for proportions.
The following is the R code to find the confidence interval for the Example Data in the question. There are other methods for confidence intervals for proportions.
Pass.Fail = c(1,1,1,1,1,0,0,1,0,0,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1)
Pass = sum(Pass.Fail)
Total = length(Pass.Fail)
binom.test(Pass, Total, 0.5)

This gives the results: 19 pass out of 25, for a proportion of 0.76, and a confidence interval of about 0.55 to 0.91.
This still allows you to compare to proportions of interest, based on whether the confidence interval overlaps a given proportion.  So in this case you can say statistically that the proportion of students capable of getting the correct answer is likely greater than 0.50, but you cannot say it is likely greater than 0.75.  Likewise, the proportion of students is likely less than 1.00.


Plugin para upload de arquivos grandes no wordpress

Question: Estou desenvolvendo um blog com wordpress para um cliente (que tem pouca experiência com computador e internet). Neste blog, serão disponibilizados vídeos e arquivos zips para download.
Pensando que estes arquivos podem variar bastante de tamanho (até 350MB) fui procurar um meio de realizar este upload (pelo wp-admin) sem precisar aumentar o max_upload_size no servidor e nem o timeout porque acredito não ser a melhor opção.
Pesquisando em diversos lugares vejo que a maioria das pessoas realiza o upload via FTP e utiliza um plugin que pega os arquivos que estão na máquina e coloca no blog, porém acredito que isto seja algo muito difícil para alguém sem experiência.
Achei um único plugin (http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/) que apenas em sua versão paga faz este upload de maneira satisfatória mas devido a encontrar apenas um plugin e não encontrar muita gente utilizando fiquei com um pé atrás.
Este plugin é confiável? Existem algum outro plugins que faça isso e é mais utilizado? Esta (subir arquivos grandes para disponibilizar no wordpress) é uma abordagem ruim por isso existe pouco a respeito?
Answer: É uma situação bastante atípica, então não vai ter muita garantia mesmo.
Eu criaria uma regra para aumentar o max_upload_size só na sessão logada do usuário com ini_set  no processo de login.
Comment: pode colocar um plugin de feedback com barra de status do upload, a sessão vai ficar presa.. mas com 350 Mb de upload não tem muito jeito.. precisa desse feedback.. se não o cliente fecha a janela achando que já fez o upload e depois vai reclamar com você que o arquivo não sobe... experiencia própria...
Comment: @BrenoZan, parece que a sua resposta estava certa...(+1) Dá para editar para ficar mais composta?
Comment: Não gostaria de fazer apenas isso porque acredito que o feedback pro usuário é ruim. O tempo de espera é muito grande e possívelmente ele vá achar que não deu certo.
Comment: Só pra complementar a resposta: eu tenho um cliente que sobe todo dia imagens e arquivos de 400 a 500mb no WordPress pelo uploader comum, implementado no Front End, sem nenhum problema - com upload múltiplo e a barra de status funcionando normalmente. Tendo um servidor com memória suficiente pra fazer as operações após o upload não é necessário nenhum plugin pra isso, só aumentar o max_upload_size mesmo.
Answer: Você pode utilizar a aba de Mídia do seu painel do Wordpress para uploads de arquivos. Para aumentar esse limite você pode alterar o php.ini o campo max_upload_size para 350MB. :)


Drupal 7: notify user module recommendation

Question: I'm trying to figure out what the best solution to a project requirement is. The basic premise is that a site needs to have a notify user feature - similar to how Facebook works.
A listing in the site will appear showing the number of notifications (similar to this site actually, on the top left).  A sample notification would be: another user commented on your node.
Another possible notification would be "a node was created in a subscribed taxonomy term".
I've been looking at the Notifications  module,  but I'm not convinced it can do what I need it to do.
Has anyone ever built a solution to this problem?  Or am I looking at a lot of custom work?
Comment: Message is probably the leading contender for Drupal 7, but yes, you're looking at a lot of custom work. http://drupal.org/project/message
Comment: Message module looks like a good start - I'll get it a try.  Thanks!
Comment: I think the question title is a bit misleading, as it makes me think of email notifications. I don't think these things are called notifications in facebook, are they? Isn't it like "activity stream" or similar?
Comment: @donquixote referencing facebook might be confusing. What I was looking for is more in line with how StackOverflow handles it's notifications in the top left.
Comment: ok you were the one to mention facebook :) but yes, stackoverflow is a nice example too. and yes, here it is called notifications. that disproves my previous point.
Answer: For the record: The Notifications module will not do what you want.  But worse, the D7 port is in alpha and hasn't progressed since 2011-Dec-04, there are 217 bugs in the issue queue and no maintainer in sight. Its maintenance status is listed as "Seeking new maintainer".  In other words, this yet another abandoned Drupal module. Unless you're prepared to adapt and maintain this yourself - stay away.
There is a survey page for notifications modules, but it only confirms that what is called a "Notification" module by Drupal developers provides email notification, which is not what you want.  The type of notofication you want tend to be referred to as "flags" by Drupal developers, so you want to search for "flags" in addition to "notifications".
To get on-screen Javascript notifications (similar to Facebook and Stack Exchange), my suggestion for a starting point is to see whether you can combine the Flag module, the Message module and the Rules module to do what you want.  But to get these three modules combined to produce the desired effect will not be trivial.
An alternative solution (first mentioned in a comment by Nigel Waters), you could use the Message module to create the activity stream. Then use Views to generate the stream applicable to the currenly logged in user. And finally use the Menu Badges module to display the number of notifications.
You may also want to read: How to create a basic message - notifications system displaying a real time message counter badge?
Comment: No custom coding needed. I would use the message module to create the activity stream, then use views to generate the stream applicable to the currenly logged in user. Then use the Menu badges module to display the number of notifications. http://drupal.org/project/menu_badges
Comment: I'm looking into the message module that everyone has suggested.  I think that combined with some custom behaviours will achieve what I need.
Comment: @Nigel Waters, +1. Thanks for adding this.  I wasn't aware of this module.  You'll get an upvote from me if you add this as an answer.
Comment: This stackexchange discussion is having more info on how to create realtime notifications on the menu / taskbar: http://drupal.stackexchange.com/questions/68867/how-to-create-a-basic-message-notifications-system-displaying-a-real-time-mess


Como formatar a Data na GridView Asp.net C#

Question: Em asp.net c#,
Como faço para converter uma data na gridview vinda do banco para o formato dd/mm/yyyy ?
Atualmente ela fica como 18/05/2015 00:00:00.
O tipo da coluna é BoundField.
Já tentei com string.Format e DataFormatString="{0:d} e não funcionou.
Desde já agradeço.
Att.
Comment: Veja esse post em inglês que trata do mesmo assunto.
http://stackoverflow.com/questions/832691/asp-net-formatting-datetime-in-gridview
Comment: Já consegui @PedroLaini, desse jeito em baixo funcionou, eu estava passando a data como string, ai mudei pra datetime e funcionou. Valeu
Answer: Tente usar:
<asp:BoundField HeaderText="Date" DataField="MyDate"
 DataFormatString="{0:dd/MM/yy}">

Comment: Paulo, tentei e não pegou também DataFormatString="{0:dd/MM/yy}". Não teria algum jeito no código ?
Obrigado.


Xcode 15 beta 3 - Could not instantiate class named _UIRecessedMaterialView

Question: I have an app that loads a xib with a segmented control. If I build it with Xcode 15 beta 3 and launch on a iPad with iPadOS 17 (or on iOS 17 simulator), it crashes with an error:

Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named _UIRecessedMaterialView because no class named _UIRecessedMaterialView was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)'
First throw call stack:
(
0   CoreFoundation                      0x00007ff80048c88a __exceptionPreprocess + 242
1   libobjc.A.dylib                     0x00007ff800057894 objc_exception_throw + 48
2   CoreFoundation                      0x00007ff80048c768 -[NSException initWithCoder:] + 0
3   UIFoundation                        0x00007ff804a1eb4d UINibDecoderDecodeObjectForValue + 352
4   UIFoundation                        0x00007ff804a1eebe UINibDecoderDecodeObjectForValue + 1233
5   UIFoundation                        0x00007ff804a1e9e2 -[UINibDecoder decodeObjectForKey:] + 257
6   UIKitCore                           0x0000000108c04a9f -[UIView initWithCoder:] + 1327
7   UIKitCore                           0x0000000107c32c81 -[UIControl initWithCoder:] + 65
8   UIKitCore                           0x0000000107c5a7b3 -[UISegmentedControl initWithCoder:] + 65
9   UIFoundation                        0x00007ff804a1ecb4 UINibDecoderDecodeObjectForValue + 711
10  UIFoundation                        0x00007ff804a1e9e2 -[UINibDecoder decodeObjectForKey:] + 257
11  UIKitCore                           0x000000010801c7cd -[UIRuntimeConnection initWithCoder:] + 125
12  UIKitCore                           0x000000010801cbef -[UIRuntimeEventConnection initWithCoder:] + 59
13  UIFoundation                        0x00007ff804a1ecb4 UINibDecoderDecodeObjectForValue + 711
14  UIFoundation                        0x00007ff804a1eebe UINibDecoderDecodeObjectForValue + 1233
15  UIFoundation                        0x00007ff804a1e9e2 -[UINibDecoder decodeObjectForKey:] + 257
16  UIKitCore                           0x0000000108015a79 -[NSCoder(UIIBDependencyInjectionInternal) _decodeObjectsWithSourceSegueTemplate:creator:sender:forKey:] + 447
17  UIKitCore                           0x000000010801877e -[UINib instantiateWithOwner:options:] + 1118
18  UIKitCore                           0x000000010801a112 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 139
19  CustomSearchBarBug                  0x000000010671830e $s18CustomSearchBarBug11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0m6LaunchL3KeyaypGSgtF + 462
20  CustomSearchBarBug                  0x0000000106718687 $s18CustomSearchBarBug11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0m6LaunchL3KeyaypGSgtFTo + 183
21  UIKitCore                           0x000000010857a092 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 297
22  UIKitCore                           0x000000010857be6b -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 4253
23  UIKitCore                           0x000000010858196b -[UIApplication _runWithMainScene:transitionContext:completion:] + 1241
24  UIKitCore                           0x00000001078e6780 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 181
25  UIKitCore                           0x000000010857e1dc -[UIApplication _compellApplicationLaunchToCompleteUnconditionally] + 59
26  UIKitCore                           0x000000010857e591 -[UIApplication _run] + 936
27  UIKitCore                           0x000000010858301a UIApplicationMain + 123
28  UIKitCore                           0x000000010764e103 __swift_destroy_boxed_opaque_existential_1Tm + 10851
29  CustomSearchBarBug                  0x0000000106718b1b $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 123
30  CustomSearchBarBug                  0x0000000106718a97 $s18CustomSearchBarBug11AppDelegateC5$mainyyFZ + 39
31  CustomSearchBarBug                  0x0000000106718b88 main + 24
32  dyld                                0x00000001068a23ee start_sim + 10
33  ???                                 0x000000010dfd041f 0x0 + 4529652767
)
libc++abi: terminating due to uncaught exception of type NSException

The simplest xib to reproduce the crash is:
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="22138.1" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
    <device id="ipad7_9" orientation="portrait" layout="fullscreen" appearance="light"/>
    <dependencies>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22113"/>
        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    </dependencies>
    <objects>
        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
        <view clipsSubviews="YES" contentMode="scaleToFill" id="63">
            <rect key="frame" x="0.0" y="0.0" width="744" height="1133"/>
            <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
            <subviews>
                <segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="bar" selectedSegmentIndex="0" id="10">
                    <rect key="frame" x="218.5" y="5.5" width="331" height="33"/>
                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                    <segments>
                        <segment title="Item"/>
                        <segment title="Brand"/>
                    </segments>
                    <connections>
                        <action selector="segmentedControlChanged:" destination="-1" eventType="valueChanged" id="25"/>
                    </connections>
                </segmentedControl>
            </subviews>
            <nil key="simulatedStatusBarMetrics"/>
            <point key="canvasLocation" x="467.96875" y="146.484375"/>
        </view>
    </objects>
</document>

The xib is loaded like this:
let nibs = Bundle.main.loadNibNamed("SegmentedControl", owner: nil, options: nil)
No crash occurs on iOS 16.3.1.
Is there any fix?
Answer: In my case, the issue was due to incorrect Command Line Tools selected for xcodebuild. It was switched to the stable Xcode 14.3, which I've installed on the same machine.
I switched it to Xcode 15 Beta 3 Command Line Tools and the error went away.
Make sure that you've the correct tools selected in the Xcode Settings:
Comment: I also had wrong command line tools, but selecting correct ones didn't resolve the crash.
Answer: In my case,
After completely uninstalling the installed XCode15β3 and installing XCdode15β4 again, the problem was resolved.
Answer: The crash is resolved in Xcode 15 beta 6


Pyxero filtering using the __in

Question: I have a filtering on status using pyxero, but I want filtering on two type of status: AUTHORISED and SUBMITTED.
The actual call is:
xero_conn.invoices.filter(Type='ACCPAY', Status='SUBMITTED')
But checking the code there is not Status__in available. Is there a __in available as in the django orm or I must make 2 calls?
Answer: The raw option let to do what pyxero is not able to do. I moved the Status in raw and works. Use the preview to check the raw.
xero_conn.invoices.filter(Type='ACCPAY', raw="Status='SUBMITTED' OR Status='AUTHORISED'")

Pyxero filtering using the __in


Is there a way to upload file in database instead of in filesystem via webform?

Question: When files are uploaded via webform, the attachment is stored in filesystem. Is there a way to store the attachment in database blob field?
Answer: You could read the field and write the contents in the database. This could be done in a custom submit handler to the webform form.
Comment: Any pointer about "custom submit handler"?
Comment: `$from['#submit']` see form reference at api.drupal.org and `hook_form_alter`