Let $H\le G,G$ finite. If $M_H$ is a maximal subgroup of $H$, is it the case that $M_H = H \cap M$ for some $M$, a maximal subgroup of $G$?

Question: I have a question regarding finite groups and their subgroups. Specifically, let $G$ be a finite group, and let $H$ be a subgroup of $G$. I am interested in understanding whether the following statement holds true:

"If $M_H$ is a maximal subgroup of $H$, is it necessarily the case that $M_H = H \cap M$ for some $M$, a maximal subgroup of $G$?"

I believe that this statement is indeed true, and I have attempted to provide a proof for it. Here is my approach:
Let $h \in H \setminus M_H$. In order to establish the existence of $M$, a maximal subgroup of $G$, such that $M \cap H = M_H$, I propose considering $M$ as the maximal subgroup of $G$ that does not contain the subgroup $\langle h \rangle$ generated by $h$.
I would greatly appreciate any feedback, or hint. Thank you in advance for your time and assistance.
Comment: The statement is false. Let $G=\mathbb Z_8$, $H=2\mathbb Z_8$ and $M_H=4\mathbb Z_8$. For a noncommutative example, ket $G=D_4$, the 8-element dihedral group, let $H$ be any maximal subgroup of $D_4$ other than the rotation subgroup, and let $M_H$ be any 2-element subgroup of $H$ generated by a reflection.
Comment: More generally, if the Frattini subgroup of $G$ (the intersection of all maximal subgroups) is nontrivial, then any nontrivial subgroup of it will give a counterexample.
Answer: The answer to your question is no.
Let $G$ be cyclic of order $p^3$ for any prime $p$.  Let $H$ be the unique maximal subgroup of order $p^2$ and let $M_H$ be the unique subgroup of order $p$.  Then $G$ is a counterexample to your conjecture.
Comment: I want to thank  Keith Kearnes, and Robert Shore for their insightful answers. I was wondering if the statement will be true for non $p$-groups.
Comment: No, why should it be? Just take a direct product with a non $p$-group.
Comment: I see, Thank you.
Answer: As noted, the answer in general is no. In a cyclic group of prime power order, for example, the subgroups form a chain, so that given any two subgroups $H$ and $K$, either $H\leq K$ or $K\leq H$. In particular, there is a unique maximal subgroup $M$, and hence you will necessarily have $H\cap M=H$ for any proper subgroup $H$. This covers the examples given above by Mathfail and by Robert Shore.
More generally, if $G$ is a finite group, then $\Phi(G)$, the Frattini subgroup of $G$ is defined to be the intersection of all maximal subgroups of $G$. If $H\leq\Phi(G)$, then for every maximal subgroup we have $H\leq M$, hence $H\cap M = H$, so again you will not be able to reach your conclusion. (In the case of a nonabelian $p$-group $G$, we know that $\Phi(G)=G^p[G,G]$, which is nontrivial, so taking $H=\Phi(G)$ will give you counterexamples.) And if $M_H\cap \Phi(G)\neq H\cap \Phi(G)$, then you cannot find a maximal subgroup $M$ such that $M\cap H=M_H$: because if $h\in H\cap\Phi(G)$ with $h\notin M_H\cap\Phi(G)$, then $h\notin M_H$, but $h\in H\cap \Phi(G)\leq H\cap M$.
I did want to point out a few problems with your approach, for your future reference. First, note that it is incorrect to talk about "the maximal subgroup of $G$ that does not contain $h$": first, using the singular definite article the implies that such an object is unique; not only do you not know it is unique, you do not even know if it exists at all! You can certainly, in a finite group, find subgroups that are maximal with respect to not containing an element $h\neq e$, but these subgroups may (i) not be unique, so the use of "the" is unwarranted; and (ii) may fail to be maximal subgroups of $G$. Note that "maximal among subgroups of $G$ not containing $h$" does not imply "maximal among all proper subgroups of $G$.
Comment: I just wanted to observe that your point (a subgroup maximal with respect to not containing $h \in G$ may not be a maximal subgroup) plays out differently in the context of ideals of rings with identity.  There, of course, an ideal that is maximal with respect to not containing $1$ *is* a maximal ideal, so this method of proof can have more legs in that context.
Comment: @RobertShore I have no idea what I was thinking there and will delete. I will note that if you take $r$ in a ring which is neither a unit nor $0$, then you can construct ideals maximal with respect to not containing $r$, and these ideals need not be maximal ideals of the ring.
Answer: Let $G=Z_4$, and $H=\{0,2\}$. So $M_H=\{0\}$.
Now, $M=H$ is the non-trivial maximal subgroup of $G$, but $H\cap M=H\neq M_H$


Brew install libpcap does not provide binaries

Question: Stupid question: I'm trying to install libpcap on my macOS (Big Sur) using brew. I've executed "brew install libpcap". Now, I would imagine that I could now run libpcap out of the box, but it tell me that libpcap: command not found. brew tells me this:

If you need to have libpcap first in your PATH, run:
echo 'export PATH="/usr/local/opt/libpcap/bin:$PATH"' >> /Users/michal/.bash_profile

Now I've checkd that it's in the bash_profile, and it doesn't work. So I check the actual package, and in it, there is no binary file. The binary is also not in usr/local/bin.
brew furthermore tells me that

libpcap is keg-only, which means it was not symlinked into /usr/local
because macOS already provides this software and installing another
version in parallel can cause all kinds of trouble.

but I don't really know what this means, seeing that I cannot find it anywhere.
What is going on here? Where is it installed, and how do I run that program?
Answer: From TCPDUMP:

... libpcap, a portable C/C++ library for network traffic capture.

libpcap is a library, not a program.


How to test a loop inside an AngularJS service

Question: I'm trying to testing service but i don't know how to test loop inside. Is it possible to test case with host.lenght===1  in different way than mock url that return host.length=1. Do I have to callFake all my code inside service to test it? Also how to test isNaN?
Here's my code:
if (host.length === 1 || !isNaN(host[host.length - 1])) {

     name = a.hostname;

} else {

     if (host[0] === "www") {
          slice = 1;
     }
     name = host.slice(slice, host.length - 1).reverse().join(" ");
}

jsfiddle Demo
Comment: Hey man, you say you want to test `loop` but I don't see one, are you sure you have posted correct code?
Answer: In this case, it looks simplest to just use a URL that will give you this behaviour. In my opinion, this will also be a better test as it will actually test the intent of the code, rather than just ensuring that certain methods are called. After all, this code was written to cope with different types of URL, why not test them with exactly that?
You already have a test for this url: 'http://angular.com/about'. For the case you are talking about, you could use 'http://angular/about' and then 'http://www.angular.com/about' to test the code that strips out the www. part.


Matlab Parse Error with a simple parenthesis?

Question: I'm trying to finish a program and for some reason, the matrix I loaded into Matlab is messing with the ability to select the rows inside it. I'm trying to select all the rows in the matrix and see which values match the criteria for a Live setting.  However I can select specific values/sections of the matrix in the command window without issue.  Why is this happening?  Any ideas?
It appears to only happen when in a for loop, I can do it just fine when it's on its own.
Answer: The syntax is: for x = start:stop. I think you are trying to do a for to the whole "A" matrix. You can split "A", according to its format (e.g. if is a table split in two variables).
bye
Answer: Richardd is right on; you're trying to iterate on a matrix, no good.
If I read you right, you're trying to run through your A matrix one column at a time, and see all the rows in that column?  Assuming that is correct...
Your A matrix is 14x3, so you should go through your for loop 3 times, which is the size of your column dimension.  Luckily, there is a function that MATLAB gives you to do just that.  Try:
for iColumn = 1:size(A,2)
...
end

The size function returns the size of your array in a vector of [rows, columns, depth...]  - it will go as many dimensions as your array.  Calling size(A,2) returns only the size of your array in the column dimension.  Now the for loop is iterating on columns.


Repeated object creation in php

Question: i have my own php structure
that have controller and model now i want to export record from db to CSV file
my question is that is php can manage garbage collection or memory resources?
because every time ajax request to a controller and controller make a object of model
every request is add limited row (as i define) e.g. 1000 rows to CSV and then again a ajax request is called for the same
i have large data so i just want to know is every time creating object of controller and model are bed practice for this job?
note : i don't create constructor in both class (model)
Answer: Every time a new request is made php creates objects, and when php has finished processing destroys them. Php does not keep anything in memory between requests, it has a "share nothing" approach. So no, you are not doing anything wrong.
If you are calling an object multiple times in your code, for example a database connection class, and you only want one instance of that object throughout that request use singletons.
<code>class Singleton {

private static $instance;

   protected function __construct()
   {
     //Do something, or don't
   }

   private function __clone() {}
   private function __wakeup() {}

   public static getInstance()
   {
       if (!static::$instance) {
           static::$instance = new Singleton();
       }
       return static::$instance;
   }

}
</code>

Repeated object creation in php


Add CSS class to view image_field in twig

Question: In my custom view fields twig file views-view-fields--search--product_result.html.twig I try to theme my view item.
{{ fields.field_images.content }}

{{ fields.title.content }}

How do I add a CSS class to my image field {{ fields.field_images.content }}?
Comment: In a Views field(s) template you can't theme field content anymore because it has already been rendered.
Comment: @4k4 Ok so what's the solution. Traditional way through Views ui and rewrite fields content?
Comment: Yes, before you rewrite the field try to add the CSS class in Style Settings of the field.
Comment: @4k4 I think it's not possible for a field which is Exclude from display? I tried but it's stripped...
Comment: OK, when you exclude from display and use field tokens you have total control over the markup and you don't need the Style Settings anymore.
Comment: Yes but then I cannot add a class to the image field... Only e.g. a wrapper element around the image field, but that's not what I need...
Answer: This is what worked for me: It's a preprocess function in the .theme file. I wish there was a way to do this directly into the template. This would apply that class everywhere the field appears.
/**
 * Implements hook_preprocess_field().
 * Adds a class to a People image.
 */
function themename_preprocess_field(&$vars) {
  if ($vars['element']['#field_name'] == 'field_machine_name') {
    foreach($vars['items'] as $key => $item){
      $vars['items'][ $key ]['content']['#item_attributes']['class'][] = 'my_class';
    }
  }
}

themename, field_machine_name, and my_class are placeholders for your values.
This produces:


Why are decision trees considered supervised learning?

Question: It seems to work similar to clustering algorithms, where data does not have to be labeled, and the algorithm creates it's own labels/groups based on feature similarities...
Comment: You are wrong, you do need labels for decision trees. There are some unsupervised decision trees available but they are far far less used.
Answer: While there aren't preexisting labels that trees use to distinguish all the different branching points—the branching structure is determined automatically—there does need to be a dependent variable, which generally has to be non-missing. In fact, the branching structure is determined according to how well cases are segregated on this variable. It's the presence of a dependent variable, which can be used to train and evaluate a learner, that distinguishes supervised learning from unsupervised learning.
Answer: Any method which uses training set with "correct answers" to train are, can be called as supervised learning method, and then when we put model into testing, its results are based on knowledge it gained during the training.
to develop model with Decision Tree, sufficient training examples with "correct answers" are used to train the model, i.e in supervised learning it is mandatory to have training set with correct answers to train model to get desired results.
so the Decision Tree is supervised learning
Answer: Most commonly used decision tree algorithms work on labeled data set for training, hence classified under the category of 'supervised learning' algorithm.
However, some of the clustering, Anomaly detection, and random forest algorithms do work in 'unsupervised setting' too.
@ShivYaragatti;
Please refer for the unservised version of decision trees.
http://web.cs.ucla.edu/~wwc/course/cs245a/CLTrees.pdf
https://arxiv.org/pdf/1611.01971v3.pdf%20(https://arxiv.org/pdf/1611.01971v3.pdf)


Visual Studio debugger questions

Question: With Visual Studio debugger is it possible to save out the information after a failed build or is there a way I can make something that will run with the debugger to catch and store this info I'm after this data for a add in that I would like to attempt but was just wondering if this is possible first before I go neck deep in this.
How would I access it if this is possible?
Answer: This may be a half answer, but you can build a project via command line.  You can gather any errors from the output there in an application etc..
<code>devenv "C:\Documents and Settings\someuser\My Documents\Visual Studio\Projects\MySolution\MySolution.sln" /build Debug /project "CSharpWinApp\CSharpWinApp.csproj" /projectconfig Debug
</code>
See: http://msdn.microsoft.com/en-us/library/b20w810z(v=vs.90).aspx

Visual Studio debugger questions


Test if observations are a constant proportion

Question: New to statistical testing, I may not be using the correct terminology in this question - I will try to explain as best I can.
I have secondary data where it is unclear if what appears to be a measured variable is actually a constant proportion of another variable. I have included a very small subset of that data below.
The variable in question is "Waste".  I would like to test:

if the annual value for "Waste" is a constant proportion of "Dom.Supply" for each Country-Item pair, or if its variance is sufficient to decide the value for "Waste" has been measured separately from "Dom.Supply", and,
if "Waste" is a constant proportion of "Dom.Supply" for individual Country-Item pairs, if it is also constant between Country-Item pairs within a Region (Europe in this case).

It seems like an ANOVA may be appropriate? If so, would it be a test of whether first differences to the Country-Item mean are equal to zero?  The number of Country-Item pairs is about 3100 (143 x 22); countries are aggregated into 7 global regions.
Does the time-series nature of this dataset complicate things?
Thanks
Country Group   Item    Year    Dom.Supply  Waste
Bulgaria    Cereals Wheat   1961    2385    274
Bulgaria    Cereals Wheat   1962    2307    262
Bulgaria    Cereals Wheat   1963    2411    277
Bulgaria    Cereals Wheat   1964    2521    286
Bulgaria    Cereals Wheat   1965    2661    341
Bulgaria    Cereals Wheat   1966    2756    385
Bulgaria    Cereals Wheat   1967    2668    357
Bulgaria    Cereals Wheat   1968    2752    349
Bulgaria    Cereals Wheat   1969    2836    343
Bulgaria    Cereals Wheat   1970    2870    344
Bulgaria    Cereals Barley  1961    676 15
Bulgaria    Cereals Barley  1962    640 16
Bulgaria    Cereals Barley  1963    713 16
Bulgaria    Cereals Barley  1964    927 21
Bulgaria    Cereals Barley  1965    1008    22
Bulgaria    Cereals Barley  1966    1063    24
Bulgaria    Cereals Barley  1967    983 23
Bulgaria    Cereals Barley  1968    846 19
Bulgaria    Cereals Barley  1969    933 20
Bulgaria    Cereals Barley  1970    1278    27
Czechoslovakia  Cereals Wheat   1961    2768    100
Czechoslovakia  Cereals Wheat   1962    2816    100
Czechoslovakia  Cereals Wheat   1963    2864    100
Czechoslovakia  Cereals Wheat   1964    3042    110
Czechoslovakia  Cereals Wheat   1965    3548    110
Czechoslovakia  Cereals Wheat   1966    3620    150
Czechoslovakia  Cereals Wheat   1967    3924    180
Czechoslovakia  Cereals Wheat   1968    4495    180
Czechoslovakia  Cereals Wheat   1969    4238    200
Czechoslovakia  Cereals Wheat   1970    4657    250
Czechoslovakia  Cereals Barley  1961    1412    98
Czechoslovakia  Cereals Barley  1962    1602    105
Czechoslovakia  Cereals Barley  1963    1532    100
Czechoslovakia  Cereals Barley  1964    1745    108
Czechoslovakia  Cereals Barley  1965    1373    110
Czechoslovakia  Cereals Barley  1966    1496    108
Czechoslovakia  Cereals Barley  1967    1743    120
Czechoslovakia  Cereals Barley  1968    2049    120
Czechoslovakia  Cereals Barley  1969    2408    123
Czechoslovakia  Cereals Barley  1970    2221    120

Answer: I'm not very good at time series analysis, but I don't see any obvious advantages with time series analysis over a mixed model regression analysis method.
It seems to me you have some sort of count data as your dependent variable, and I would try to model it using a Poisson or negative binomial distributional assumption. I would like to use Year and Dom.Supply as a quadratic or perhaps cubic function to model non-linearity, and country and Item as random effects (possibly also global region as a random effect, or as a fixed effect). Interaction terms might also be considered. A basic model might look something like this:
Waste ~ Year + I(Year^2) + Dom.Supply + I(Dom.Supply^2) + (1|Item) + (1|Country)

The package glmmADMB for R allows for these kinds of models with a negative binomial distributional assumption.


Why normalise the standard deviation of neural network input?

Question: I understand why the mean of the input to a neural network is normalized, to avoid the numerical problems with very large and very small numbers. Also, it's nice if the bias node is around the same magnitude as the other input data.
But why is the standard deviation usually normalized? Of course higher standard deviation means that the variations have larger effect, but won't the weights adapt to that anyway?
Thanks!
Comment: why isn't log normalization used more often? https://stats.stackexchange.com/questions/452551/what-is-an-explanation-for-what-the-normalization-for-trainable-optimizers-do
Answer: It's usually to assist with the gradient descent solver.  As I understand it, the Hessian matrix becomes much more stable and easier to traverse if all the inputs are scaled.
Another important time to scale the inputs is if you are using a "weight decay".  This is the same thing as a ridge parameter if you're familiar with that.  Just because a feature has higher variance than another doesn't necessarily mean it has more explanatory power.  By scaling all the features the ridge penalty uni-formally shrinks all the coefficients.
A much more comprehensive answer is located here:
ftp://ftp.sas.com/pub/neural/FAQ2.html#A_std_in
Comment: that is a fabulous link! Thanks for sharing I was wondering if you've ever seen the type of scaling that is non-linear and takes logs e.g. $$ log( |x| )/p$$. I asked about it here (https://stats.stackexchange.com/questions/452551/what-is-an-explanation-for-what-the-normalization-for-trainable-optimizers-do) but it seems like a really random normalization to me. Have you seen something like that before?
Answer: I'd like to emphasize a paragraph given by the link (ftp://ftp.sas.com/pub/neural/FAQ2.html#A_std_in) by Shea Parkes:

But standardizing input variables can have far more important effects on initialization of the weights than simply avoiding saturation. Assume we have an MLP with one hidden layer applied to a classification problem and are therefore interested in the hyperplanes defined by each hidden unit. Each hyperplane is the locus of points where the net-input to the hidden unit is zero and is thus the classification boundary generated by that hidden unit considered in isolation. The connection weights from the inputs to a hidden unit determine the orientation of the hyperplane. The bias determines the distance of the hyperplane from the origin. If the bias terms are all small random numbers, then all the hyperplanes will pass close to the origin. Hence, if the data are not centered at the origin, the hyperplane may fail to pass through the data cloud. If all the inputs have a small coefficient of variation, it is quite possible that all the initial hyperplanes will miss the data entirely. With such a poor initialization, local minima are very likely to occur. It is therefore important to center the inputs to get good random initializations. In particular, scaling the inputs to [-1,1] will work better than [0,1], although any scaling that sets to zero the mean or median or other measure of central tendency is likely to be as good, and robust estimators of location and scale (Iglewicz, 1983) will be even better for input variables with extreme outliers.

So the way I understand it is if the data cloud is far away from the separating hyperplane, then things might not work well. In the exaggerated example, say all points have large negative value and small variance in the data. Then everything would be in the area were the relu outputs zero. Which means that gradients are all zero. If this happens for all units then should be no training (I've not ran the experiment).
Similarly, if all the weights are on the positive side, then the hidden layer is just a linear layer...but having the hyperplanes dissect the data makes sure your NN/MLP is a non-linear learning regime at training.


Is there a strongly typed RedirectToAction in ASP.NET MVC 2?

Question: I wish to do something like this:
return RedirectToAction<SomeController>(c => Index(someparameter));

How to do this ?
Thanks,
D.
Answer: That is a feature of the MvcContrib project.
Just download MvcContrib from here, add a reference to MvcContrib.dll in your project and then you should be able to do exactly what you want.
Answer: is there something wrong with?
return RedirectToAction("Action", "Controller", new { parameter1 = value, param2 = value2 });


Reading Information From a Dynamic Website

Question: I have been reading up on this since morning, and I can't find a whole lot information regarding my question.
So, I want to make a java application that reads information (Strings) from a website every time the website updates. Is it possible to do this using Java?
Can I use Scanner? I have seen some recommend using Jsoup, but I haven't found any tutorials. Actually, most of my searches results in SO posts that have not been very useful.
So, can anybody give a "tutorial-like" answer for future reference?
Answer: Generally, what your browser shows you when you access a website (dynamic or not) is the markup received from the webserver, which is parsed and rendered by the browser to display the website.
To receive that markup, your browser makes one (or multiple) HTTP requests to the webserver.
When you type the URL www.stackoverflow.com into your browsers address bar, you browser generates an HTTP request to the server. The response is the site's markup.
So, whether the site's content is dynamic or not, is irrelevant at that point, because the request to a URL (at a given time) will result in the same markup whether that request was sent from the browser or your programm.
So, what you need to do is:

make your programm request the sites markup
parse the markup
Do, what needs to be done with it

There are various frameworks and APIs for that job. One is, as you have mentioned, jSoup.
Check this out for a tutorial.
Some websites also allow passing parameters in the URL like www.somesite.com?foo=bar, which is called GET-request. There are also POST-requests and others, but you would need to read on about this yourself.
Hope this helps.


Magento category order on frontend

Question: I want to change the default order of categories in Magento frontend navigation to order by name. Running Magento 1.5.
Does anyone have a clue?
Answer: You can manually order the categories in admin by dragging them up and down in the left pane of "Manage Categories" page.
Answer: You would need to build the collection first, then sort the attribute
Mage::getModel('catalog/category')->getCollection()->addFieldToFilter('parent_id', '319')->addAttributeToSort('name', 'ASC');

Answer: We have been searching on a way to do this also, and ended up doing this:
<?php
...
$categories = array(1,3,5); // this holds the category ids you want to show, in the correct order
foreach($categories as $cat){
  Mage::getModel("catazlog/category")->load($cat);
  // Do whatever you want here
}
?>

It definitely isn't the cleanest way to achieve what you are trying to do, but just offering you a quick (dirty?) solution.
-Kenny
Comment: This answer is old but for everyone else coming here: Using `load()` is generally slow since it loads all information of the thing you're trying to load (Category, Customer, etc.). It's better to use `Mage::getModel('catalog/category')->getCollection()` and then `->addFieldToFilter()` to only load what you need, just es Vern Burton said above.
Answer: In Admin Panel go to Catalog—>Manage Categories.
From there you can change categories order by just drag-and-dropping categories right in category tree at the left-hand side of the page.
Good luck!!!

Magento category order on frontend


Why is the third vertex of my first triangle always at the origin and the rest of my triangles not being drawn?

Question: I've checked the results of everything and I've tidied up multiple bugs in my draw function already, but I still can't find the reason for the behavior described in the question title.  I'm using OpenGL 1.4, 3D textures, vertex arrays, texture coordinate arrays, and glDrawArrays to draw models (from my model API) with textures (from my texture API) to the screen.  Through looking at the results of everything (printfs), I've concluded the problem has to be in the block of code that actually draws everything, and not my code that fills these arrays with post animating vertex data (so I'm only posting the former to save on bloating this post).
The current color is used to achieve a per current window brightness effect.  The variable msindex is already set to the number of model draw specifications before the loop featured begins.  Vertex data and texture coordinate data for every model being drawn are actually all stuffed into one segment, and as you can see below there are glVertexPointer and glTexCoordPointer calls on different parts of the start of it to register this data.  The contents of this segment are tightly packed, with three floats for the position of a vertex first and then three floats following for its texture coordinates.  There is multitexturing (up to two textures specified much earlier in the model), but both textures share the same texture coordinates (which is why both calls to glTexCoordPointer specify the same location in memory).  The while loop is meant to draw each individual specified model according to information for the model draw specification in the miaptr segment.  Start is, in my code, the starting 6 float wide index into the overall vertex data segment for the first vertex of the model to be drawn, and count is the number of vertices.  In my example case these are just 0 for start and 6 for count (attempted to draw one model with two triangles).  Type can be multiple things depending on the model, but in this case it is GL_TRIANGLES.  I've tried this with other primitive types, but they all suffer from the same problem.  Additionally, the texture being drawn is entirely opaque (and green), the brightness of the target window is always 1, and all the primitives are front facing.
The following is my broken source code:
    /* Enable/set global things. */
    jgl.Viewport(
    (GLint) x, (GLint) y, (GLsizei) width, (GLsizei) height
    );
    fvals[0] = (jWindowsptr + jGetCurrentWindow())->brightness;
    jgl.Color4f(
    (GLfloat) fvals[0],
    (GLfloat) fvals[0],
    (GLfloat) fvals[0],
    1
    );
    jgl.Enable(GL_ALPHA_TEST);
    jgl.Enable(GL_CULL_FACE);
    jgl.CullFace(GL_BACK);
    jgl.Enable(GL_DEPTH_TEST);
    jgl.Enable(GL_POINT_SPRITE_ARB);
    jgl.EnableClientState(GL_VERTEX_ARRAY);
    const GLvoid *vaptrc = vaptr;
    jgl.VertexPointer(3, GL_FLOAT, 12, vaptrc);
    /* Color clearing is in here so I could see better while testing. */
    jgl.Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    /* Enable/set per texture unit things. */
    jgl.ActiveTexture(GL_TEXTURE0 + 1);
    jgl.TexEnvi(
    GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE
    );
    jgl.ClientActiveTexture(GL_TEXTURE0 + 1);
    jgl.EnableClientState(GL_TEXTURE_COORD_ARRAY);
    jgl.TexCoordPointer(3, GL_FLOAT, 12, (vaptrc + 3));
    jgl.Enable(GL_TEXTURE_3D);
    jgl.ActiveTexture(GL_TEXTURE0);
    jgl.TexEnvi(
    GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE
    );
    jgl.ClientActiveTexture(GL_TEXTURE0);
    jgl.EnableClientState(GL_TEXTURE_COORD_ARRAY);
    jgl.TexCoordPointer(3, GL_FLOAT, 12, (vaptrc + 3));
    jgl.Enable(GL_TEXTURE_3D);

    /* Pass #1. */
    jgl.MatrixMode(GL_TEXTURE);
    jgl.DepthFunc(GL_LESS);
    jgl.AlphaFunc(GL_EQUAL, 1);
    const GLfloat *tctm;
    while (msindex > 0) {
        msindex = msindex - 1;
        jgl.ActiveTexture(GL_TEXTURE0);
        jgl.BindTexture(
        GL_TEXTURE_3D, (miaptr + msindex)->textureids[0]
        );
        if ((miaptr + msindex)->textureids[0] != 0) {
            tctm
            = (miaptr
            + msindex)->transformationmatrices[0];
            jgl.LoadMatrixf(tctm);
        }
        jgl.ActiveTexture(GL_TEXTURE0 + 1);
        jgl.BindTexture(
        GL_TEXTURE_3D, (miaptr + msindex)->textureids[1]
        );
        if ((miaptr + msindex)->textureids[1] != 0) {
            tctm
            = (miaptr
            + msindex)->transformationmatrices[1];
            jgl.LoadMatrixf(tctm);
        }
        jgl.DrawArrays(
        (miaptr + msindex)->type,
        (GLint) (miaptr + msindex)->start,
        (GLsizei) (miaptr + msindex)->count
        );
    }

    /* WIP */

    /* Disable per texture unit things. */
    jgl.ActiveTexture(GL_TEXTURE0 + 1);
    jgl.ClientActiveTexture(GL_TEXTURE0 + 1);
    jgl.DisableClientState(GL_TEXTURE_COORD_ARRAY);
    jgl.Disable(GL_TEXTURE_3D);
    jgl.ActiveTexture(GL_TEXTURE0);
    jgl.ClientActiveTexture(GL_TEXTURE0);
    jgl.DisableClientState(GL_TEXTURE_COORD_ARRAY);
    jgl.Disable(GL_TEXTURE_3D);

    /* WIP */

    /* Disable global things. */
    jgl.DisableClientState(GL_VERTEX_ARRAY);
    jgl.Disable(GL_POINT_SPRITE_ARB);
    jgl.Disable(GL_DEPTH_TEST);
    jgl.Disable(GL_CULL_FACE);
    jgl.Disable(GL_ALPHA_TEST);

Answer: Your description says that you have interleaved vertex attributes, with 3 floats for the position and 3 floats for the texture coordinates per vertex. This also matches the code you posted.
The values you pass as stride to the glVertexPointer() and glTexCoordPointer() does not match this, though. With 6 floats (3 for position + 3 for texture coordinate) per vertex, and a float being 4 bytes large, the stride should be 6 * 4 = 24. So all these calls need to use 24 for the stride:
jgl.VertexPointer(3, GL_FLOAT, 24, vaptrc);
jgl.TexCoordPointer(3, GL_FLOAT, 24, ...);

Comment: Works perfectly now.  My mistake was that I thought the stride started after a vertex position or texture coordinate ended.


How do you plot the graph of the function $y^2 = \frac{(1+e^{-y})}{ x}$ .I have the graph for the problem but need to know how to obtain it manually.

Question: The problem here is not to show the graph but if  or how (i.e if it can be plotted) can I obtain it roughly without the use of a graph generator . Any help will be appreciated .
Comment: Welcome to MathSE. Normally we need to know what you have tried before anyone gives you the answer. In other words, we want to see where specifically you are stuck. As @GEdgar said, try solving for one variable in terms of another, and then try plugging in points.
Comment: For easy graphing, you will want an equation either of the form $y= $ function of $x$, or else $x = $ function of $y$.  Which one will be easier in this case?
Answer: a good start is to graph the function:
$x = \frac{(1+e^{-y})}{y^2}$. Note that the $y^2$ in the denominator creates an asymptote at $y=0$ and more importantly, since it's an even power, the function will wrap towards the asymptote on both sides (odd powers have opposing wraps).
As for the other asymptote, you find it by taking the limit going to positive and negative infinity. Recall that
$$\lim_{y \to \infty} e^{-y} = 0$$ and
$$\lim_{y \to -\infty} e^{-y} = \infty $$
Therefore, taking the positive and negative limits of the function will allow you to see the asymptotic behavior of the function analytically:
$$\lim_{y \to \infty} \frac{1+e^{-y}}{y^2}=0$$
$$\lim_{y \to -\infty} \frac{1+e^{-y}}{y^2} = \infty$$
You can check both of those via calculus.
This implies we have a vertical asymptote at $x=0$ since that's the value y approaches.
To summarize, forcing your functions to be represented as either $f(x)$ or $f(y)$ can be very useful and from there checking various properties from rational functions or whatever parent functions are present is a good start. Normally, we would also look for holes, x/y intercepts as well (or slant asymptotes in some cases) but I have omitted those since this function doesn't have them.
Good Luck!
Comment: Thanks a lot for the insight . Putting in different values of y  and the asymptotic behaviour at 0  with +- infinity i was able to plot the graph roughly myself .


Maclaurin polynomial estimating $\sin 15°$

Question: I would like to know how I would determine the Maclaurin polynomial which will estimate $\sin15°$ with an error less than $10^{-4}$.
Maybe we have to use the formula $$R_n(x) = f^{(n+1)}(c) \, {(x-x_0)^{n+1}\over(n+1)!}$$ where $R_n(x)$ is the remainder of Taylor's formula.
I have no idea how to solve this question. Any help would be appreciated. Thanks!
Comment: First of all, transfer the angle into radians, so that you can apply the Mac-Laurin-series of $\sin(x)$
Comment: @Peter Okay, and how would I estimate it with the error less than $10^{-4}$ ? :)
Comment: I hope you approve of the edits I suggested. I feel that it makes the post a bit more legible and overall easier on the eyes.
Answer: The Maclaurin series is $$\sin(x)=\sum_{n=0}^\infty \frac{(-1)^n\cdot x^{2n+1}}{(2n+1)!}$$
$15°$ corresponds to $x=\frac{15\pi}{180}$. Calculate $n$ such that the remainder $R_n(x)$ has absolute value smaller than $10^{-4}$. This is the point where you can truncate the Maclaurin series. Plug in $x$ into the remaining polynomial.
Comment: I forgot the factorial-sign "!", now fixed.


My remote repos throw no errors, but also have no content

Question: Basically what it says on the tin. I have two instances of Artifactory running and I want to set up a local repo on Artifactory instance A to be a remote repo on Artifactory instance B. I type in the correct path (and every plausible variation of it) and when I click "Test" it says everything is good to go. I set up the correct password authentication, too, and clicking "Test" also says everything is good. I made sure that no repo was blacked out or anything and I checked the system logs to ensure that nothing went wrong silently.
And yet, I can't actually query any data from that repo. Artifactory says the remote repo contains zero Artifacts. If I try to download a specific file from that repo, I get a 404.
I tried messing about randomly with the settings, which I suppose unsurprisingly didn't work. But I get no error message, no warnings, no odd behaviors. I don't know what else to try.
Answer: So my mistake turned out to be that the repository key it asks for isn't the repository key of the remote repo, but the repository key of the local repo you want to create. I suppose this is there to let you have a remote repo with a different public-facing name than the actual repo it pulls from. Otherwise you have to type in myartifactory.com/my-repo-local and then my-repo-local again in the repository key.
Comment: Hi, so, if you are already on the naming repositories state of mind, I would recommend this white-paper on Repository Naming Conventions:
https://jfrog.com/whitepaper/best-practices-structuring-naming-artifactory-repositories/
. Hope it will assist :)
Comment: Also, it is considered best practice to place repositories under a virtual one (regardless if it is a single local repo or several repositories. In your case, you should have probably placed both the local and remote repositories under a single virtual one since according to your update they share similar context.
 Hope it will assist and not confuse.


Correct approach to extend webform submission purge conditions?

Question: I'd like to extend the behavior of WebformSubmissionStorage's purge method (e.g. to prevent locked submissions from being purged), and add the corresponding elements in the "basic" configuration form for purge options.
The configuration form can probably be enriched by implementing hook_form_alter.
But what is the correct approach to extend the purge method ? I don't see how overriding the class could help, so there has to be another way.
Antoine
Answer: Try following the buildForm override approach described here: Override buildForm() in another module
This would include overriding the route entity.webform_submission.collection_purge defined in webform.routing.yml
Comment: Thanks for your suggestion. However submission purging is mostly done by cron, and webform_cron() will call WebformSubmissionStorage->purge so overriding the route won't help.
Maybe the correct approach is to create another module with its own cron, its own set of parameters and its own, independant purge function called by cron.


Instantiating class with NO constructor results in 'does not contain constructor which takes 0 arguments' error

Question: I'm trying to instantiate a FacetResult from the Azure.Search.Documents library:
var facetResult = new Azure.Search.Documents.Models.FacetResult();

VS is telling me the class does not contain a constructor with zero arguments. When I check the metadata for the class - no constructor.
Looking at the docs for the class seems to confirm that there is no constructor - so what's the issue?
I'm having the same issue with other library classes with no constructors such as Azure.Storage.Blobs.Models.BlobItem, while classes which appear to explicitly declare a parameterless constructor seem fine, such as System.Exception
Any help with this would be much appreciated, it's blocking my unit tests!
Comment: The github docs show the constructor is `internal` [github repo docs](https://github.com/Azure/azure-sdk-for-net/blob/0ebd32c0359bcd7a20b1708683c323a0b26b618a/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs#L2286).
Comment: What does Intellisense do when you type the opening parenthesis in `new FacetResult(`?  Does it suggest you can close it without parameters, does it give you any hints?  Have you looked at the class metadata?  Maybe there's something like an `internal` constructor, only allowing instances of objects defined in the same assembly to create one of these (it is a `Result` of something afterall)
Comment: The base class ctor requires at least one argument
Comment: Your title says "inheriting from a class that...".  I don't see any inheritance in the code you show
Comment: There's always a constructor. If it's not there in the source code, a parameterless constructor is automatically created by the compiler.
Comment: @Flydog57 brain fart, sorry. Changed 'inheriting' to 'instantiating', cheers.
Comment: At @MarkBenningfield which base class exactly? Azure.Search.Documents.Models.FacetResult has no base class, or am I mistaken?
https://learn.microsoft.com/en-us/dotnet/api/azure.search.documents.models.facetresult?view=azure-dotnet
Comment: Thanks all. Seems the ctor is internal so @quaabaam you were correct. Couldn't see this in the metadata or the docs, next time I'll check github.
Comment: SO won't let me tag more than one user in a single comment, thanks to @Flydog57 too for the right answer.
Answer: Constructors for this class are internal.
Instances are likely created and returned by factories.
//src code @ https://github.com/Azure/azure-sdk-for-net/
namespace Azure.Search.Documents.Models
{
    ///  A single bucket of a facet query result. Reports the number of documents with a field value falling within a particular range or having a particular value or interval.
    public partial class FacetResult
    {
        ///  Initializes a new instance of FacetResult.
        internal FacetResult()
        {
            AdditionalProperties = new ChangeTrackingDictionary<string, object>();
        }

        ///  Initializes a new instance of FacetResult.
        /// <param name="count"> The approximate count of documents falling within the bucket described by this facet. </param>
        /// <param name="additionalProperties"> Additional Properties. </param>
        internal FacetResult(long? count, IReadOnlyDictionary<string, object> additionalProperties)
        {
            Count = count;
            AdditionalProperties = additionalProperties;
        }

https://github.com/Azure/azure-sdk-for-net/blob/4162f6fa2445b2127468b9cfd080f01c9da88eba/sdk/search/Azure.Search.Documents/src/Generated/Models/FacetResult.cs
Comment: In case anyone gets here for exactly the same reason I asked the question, instantiating or mocking a FacetResult for testing purposes, check out the SearchModelFactory, which is designed for exactly that: https://azuresdkdocs.blob.core.windows.net/$web/dotnet/Azure.Search.Documents/1.0.0-preview.4/api/Azure.Search.Documents.Models/Azure.Search.Documents.Models.SearchModelFactory.html
Comment: That'll be it then, thank you. I couldn't glean this from the metadata in VS or from the MSDN docs - in future I'll be sure to check github. Cheers @lidqy.
Comment: You could still create it using reflection. Just seems to carry  2-3 properties as sort of a poco, no logic hidden.


Can Polyak-Lojasiewicz (PL) condition imply local strong convexity?

Question: If a function $f$ satisfies the Polyak-Lojasiewicz (PL) condition, that is,
$$\Vert \nabla f \Vert^2 \ge 2\mu(f(x)-f^*),$$
is the function strongly convex in a certain neighborhood of the optimal solution $x^*$? Or equivalently, for a stationary point of $f$ (PL condition implies that all stationary points are global optimum), is there a neighborhood such that the function is strongly convex?
Answer: Every constant function satisfies (PL).
Comment: Even for nonconstant functions, you can have a region of the domain where every element is a solution so the function is locally constant around some points there and still verifies the PL condition (e.g., absolute value of the soft thresholding function).
Comment: Thanks a lot. Indeed, it is not possible to obtain local strong convexity at each point under the given PL conditions. This question actually stems from my initial question: Why can PL conditions achieve linear convergence? For a constant function, any point is already optimal (converging in a finite number of steps), even stronger than linear convergence.
Comment: For a non-constant function, is there a stationary point $x$ such that it is strongly convex in some neighborhood? As mentioned by @Kwame Gonzales, consider, for example,
$$
f(x)= \begin{cases}x^2 & , x \ge 0; \\ 0, & x<0 .\end{cases}
$$
When $x<0$, the function is already optimal, and for $x \ge 0$, it exhibits a certain strong convexity. In this case, for the stationary point $x=0$, $f(x)$ is strongly convex in $[0,+\infty)$.
Comment: Also not: take $f(x, y) = x^2$ on $\mathbb{R}^2$. To your question though (~why can PL lead to linear convergence): with that $f$, you can check that the gradient is orthogonal to the direction along which $f$ fails to be strongly convex; so these directions have limited effect on algorithms.


Variance of a sample and normal distribution

Question: I'm a bit confused about the concept of estimating population variance through a sample. An exercise about theoretical vs empirical distribution of data asks to graphically represent the data of a row vector (they were the temperatures recorded daily for a month, with n=30) and to compare it with the theoretical distribution: I've run the Shapiro test in R to be sure that the date came from a normal population and I've got evidence of that. I plotted the data with the command "hist" in R and got an almost bell-shaped curve.
The problem occurs now: am I supposed to refer to the CLT? The exercise doesn't make any reference to the population mean, I do not have to study sample mean distribution (I know that it it normally distributed with mean the mean of the single random variable and variance the variance of the single random variable divided by n=30).
I also know that the sample deviance divided by (n-1) instead of n estimates the population variance without bias.
What I am supposed to do is to plot a curve in R on the histogram, and it should be a Gaussian curve (because of Shapiro test outcome): but what are its parameters? Or, what is the variance parameter? Is it the unbiased sample variance or the variance divided by n=30?
Thank you!
Answer: Are you trying to plot the sample distribution or the estimated population distribution from the data? In the first case, this can be done by plotting the histogram along with a kernel density estimate for the distribution:
<code>df = # dataset

# Histogram of sample distribution
hist(df)

# Add Kernel Density to the plot
lines(density(df))
</code>
To estimate the population distribution would require making certain assumptions about the sampling process. For instance, temperature datasets may have spatial-temporal dependency so you would need more robust standard errors for estimates of the population moments.
Comment: I am probably misunderstanding the exercise, but It asks to compare the empirical distribution (through the histogram of the data) with the theoretical distribution on the same plot: so I need to plot a curve (a normal one, I guess) onto the histogram but I don't know what parameters I am supposed to use.
Comment: If you are willing to assume that the sampling process is i.i.d. (ignoring potential spatial-temporal bias in the process), then you can find the _sample_ statistics $\bar{x}, \bar{\sigma}^2$ and simply apply Bessel's Correction for the unbiased _population_ estimates - yielding the population distribution $\mathcal{N}(\bar{x}, \frac{N}{N-1}\bar{\sigma}^2)$.
Comment: Yes, we are dealing with casual samples (iid and independence) without any further assumptions. Just one more question: does the coefficient of the variance N/N-1 refer to the sample length (30/29 in my case)?
Comment: Yes $N$ is the sample size.


Samba: non-deletable directory in public share

Question: I have this in smb.conf
[global]
security = user
guest account = nobody
map to guest = Bad User

[myshare]
path = /var/myshare
available = yes
browsable = yes
guest ok = yes
read only = no
force create mode = 0775

This allows anonymous access for users to myshare. I'd like to create a directory /var/myshare/permanent that users can't delete. Users should be able to create/modify/delete files and directories in /var/myshare and /var/myshare/permanent. Is this possible with anonymous access shares?
Answer: The easiest way is to set the append attribute in linux.
# chattr +a permanent

In this case you can write into the directory but cannot delete it until you remove the attribute.
Answer: If you are ready to disable unix-extension support(unix extension=no in [global field]), you can achieve it by enabling follow symlinks(follow symlinks=true) and use a symlink instead of a dir.
Answer: In a directory with the sticky bit enabled, only the creator of a sub-directory can delete this sub-directory.
# chmod +t /var/myshare
# mkdir /var/myshare/permanent
# chown root:root /var/myshare/permanent

Only user root can delete permanent.


Clarification about $0^0$

Question: One of the seven indeterminate forms in mathematics is $0^0$ (Refer :) but as a convention its value is taken as $1$ (Refer).
How to resolve this ambiguity ? Any help is much appreciated.
Comment: No, it makes it defined. As a form, it is indeterminate. As an expression. It is defined. That's because the "form" is about limits. So a limit is of **the form** $0^0$ if it can be written as $\lim f(x)^{g(x)}$ where $\lim f(x)=\lim g(x)=0.$ In many cases, we can determine a limit based on its form. A limit of the form $4/2$ will be  $2.$ A limit of the form $0^0$ is unknown, base on form alone,  hence the form is indeterminate. That says nothing about whether we define a value for $0^0.$ We could define a value for $\frac00,$ too, and the *form* $\frac00$ would still be indeterminate.
Comment: in calculus, it's indeterminate; but in algebra and combinatorics, it's *sometimes* taken to be $1$. The contexts are different. It's like $1 + 2 + 3 ... $ is typically $\infty$ but under analytic continuation it's instead $-\frac{1}{12}$. But it doesn't mean that infinity is equal to a negative fraction, instead the way we interpret the expression changed.
Comment: "Indeterminate" and "undefined" are not the same thing.
Comment: @ThomasAndrews, but knowing that $0^0 = 1$ makes it "determinate" right ?
Comment: (Of course, the reason we don't define a value for $\frac00$ is there isn't a value which is generally useful.)
Answer: "Indeterminate form" refers primarily to the limiting behaviour of functions $f(x), g(x)$. So $0^0$ is an "indeterminate form" in the sense that the limit of $f(x)^{g(x)}$ cannot be determined by simply knowing that $f(x), g(x) \to 0$.
The debate regarding the value of $0^0$ as its own mathematical expression —
not an indeterminate form or limiting value, as described above, but rather unambiguously the number zero raised to the zero-th power — is a different matter. The standard convention is that $0^0=1$, essentially since this makes combinatorics and power series work like they are supposed to.

Clarification about $0^0$


Why is my equilibrium distribution wrong?

Question: I have a matrix of probability coefficients that I have been using to answer some questions about an airline mode. A link to the specifics of the question here. I have been asked to find the equilibrium distribution and prove that it equals the limiting distribution. I have found the limiting distribution by:
$$\lim_{n\to\infty} A^n\pi_0 = (PB^nP^{-1})\pi_0$$
where $\pi_0$ is the initial distribution. This worked out really well and my vector had elements that added up to 1, which gave me peace of mind.
Now I am trying to find the equilibrium distribution.
As I understand it, I should think about the equilibrium distribution as one that does not change from iteration to iteration: $A\pi = \pi$:
So $(A-I)\pi = 0$. No big deal! This is just like solving for the eigenvector for the eiganvalue $\lambda =1$, which I already did in order to find the limiting distribution by way of $P^{-1}AP$!
So the limiting distribution should be equal to the eigenvector corresponding to the eigenvalue of one... Except that it's not. Where is my thinking wrong here?
Comment: To keep the question from hanging around unanswered, you could either write up your answer and accept it (which would be preferable if you feel that others might benefit from the insight you gained) or delete the question (if you feel that this was just a specific mistake whose resolution is unlikely to be of benefit to anyone else).
Comment: I found my error. My answer was correct but I needed to multiply my eigenvector by a scalar of 1/4 to get the elements to add to one. Sorry for the silly question.
Answer: I simply had to multiply the eigenvector by a scalar in order to get a valid probability distribution, such that the elements of the distribution added to 1.


Copy whole field from one entity to another

Question: i want to copy a field from one entity to another while processing a rule.
my current code looks like this:
<?php
    $entity_created->field_ort = $entity_fetched->field_ort;
?>

but instead i get an error message:
Notice: Trying to get property of non-object in eval() (Zeile 3 von /www/www/sites/all/modules/rules/modules/php.eval.inc(125) : eval()'d code).

so i found this site http://drupal.org/node/1000200 which tells me that i need to do this more like this:
<?php
    $entity_created->field_ort['und'][0]['value'] = $entity_fetched->field_ort['und'][0]['value'];
?>

but what about lists and other fields? is there a more generic approach? i need to copy about 5 or more fields.
Answer: That issue and the following code seems to have no bearing on the opening problem. Trying to get property of non-object, it literally means that $entity_fetched is not an object. Dump it into a file to see what it is.
Comment: yes, you are right... `$entity_fetched` is a List of Entities... right below it i used `$entity_fetched[0]->field...` and totaly oversaw that


Current search block: edit (-) link

Question: I'm using search api and solr, with facet api.
If I display a "current search block", if I click on a facet the system add to the block a "(-) facet name", and if I click to "(-)" it removes the facet from the search.
Is there a way to theme this behaviour? I want to display it as an image.
Answer: Look at theme_facetapi_deactivate_widget function in facetapi.theme.inc. Of course, you can override it in your theme.
Answer: try like this
function hook_facetapi_deactivate_widget(&$variables) {
  return '';// fill with your required data
}

Current search block: edit (-) link


Continuous distribution, continuity questions

Question: A distribution function is by definition a right continuous function. For a continuous random variable however, this distinction is not really necessary because the distribution function of the continuous random variable is itself continuous and thus for all points $[0,1]$ the left limit equals the right limit.
My question is then as follows... For a continuous random variable $X$, is the following true?
$$ P[X<x] ?= P[X \leq x] $$
My reasoning is that the above equation is true because for a continuous random variable, $P[X=x] =0$.
Thanks!
Answer: Yes, for a continuous random variable the equality $P(X\leq x)=P(X<x)$ is true exactly for the reason you mentioned: $P(X=x)=0$.
It is useful to keep in mind that if the cumulative distribution functions is defined with the non-strict inequality (which is how it is down in most modern textbooks), then the CDF is right-continuous. However, you could also define the CDF with the strict inequality in which case it would have been left-continuous.


Como gerar um qrCode a partir de uma url


Run multiple .dtsx files together

Question: I have three different .dtsx packages under a single ssis package. How to execute all three together with a single click without having to open each dtsx file and execute them separately
Comment: I respect that the OP is free to accept a solution. But i can't understand why unaccepting a solution to accept the same one from another user. Sequence container doesn't make any difference. Anyway, good luck
Answer: Steps to execute three different .dtsx packages under a single ssis package.

Create a package and drag a sequence container into the package.
Inside sequence container Drag and drop three Execute Package Task.
Map all three Execute Package Task with respected .dtsx package.
Execute the sequence container.

Execution process:
Comment: why sequence container? it changes nothing in this case
Comment: To Group the two packages into single unit of work i used Sequence container.When you execute the container both the packages would be executed  parallely.
Comment: Without it they would be executed parallely too
Comment: Yes they would execute but it should be recommendation that every task should define inside the container. it depends us how we define tasks inside the control flow.
Comment: It is not necessary to put in a container but is more organized. Things have to be understandable by everyone and a container facilitates it in this scenario.
Answer: Suggested Solution
Create a new SSIS package, and in the Control Flow add three Execute Package Task, and configure each one for a package.
Additional informations
"The Execute Package task extends the enterprise capabilities of Integration Services by letting packages run other packages as part of a workflow." Read more
Helpful Links

SQL SERVER – The Basics of the Execute Package Task
Execute Package Task in SSIS

Run multiple .dtsx files together


Data gap finding (not filling) in pandas?

Question: I have a gappy timeseries stored in a pandas dataframe with a datetimeindex. I now want to identify gaps in the timeseries in order to identify the continuous segments in order to process them individually (and in some cases glue together segments with short enough gaps between them).
There's two main ways I can see to do this. The first is to re-index using various approaches to get a regular timeseries and observe the filled NA values in the gap regions. In my case that leads to lots of additional rows (i.e. some lengthy gaps). You then still need to make an additional step to identify the continuous segments.
The other approach, and what I'm currently using, is to use np.diff to difference the index and find the gaps using np.where. But is there a more native pandas approach to this? This seems like a fairly common task. I note there are issues with np.diff and pandas with some combinations of numpy and pandas versions so a pandas only solution would be preferable.
What would be perfect would be something like
for segment in data.continuous_segments():
    # Process each segment

for the dataframe data.
Comment: I think this might be a good place to start: http://stackoverflow.com/questions/22290793/fill-na-values-in-pandas-series-with-a-stop
Answer: This might work for you:
df = pd.DataFrame([["2015-01-01",1],["2015-01-02",1],[np.nan,1],[np.nan,1],["2015-01-10",1],["2015-01-11",1]], columns = ['timestamp','value'])

continuous_segments = df[df.timestamp.notnull()].groupby(df.timestamp.isnull().cumsum())

for segment in continuous_segments:
     print (segment[1])

    timestamp  value
0  2015-01-01      1
1  2015-01-02      1
    timestamp  value
4  2015-01-10      1
5  2015-01-11      1


WSOD while sending headers, probably Cache-related

Question: I have a very strange problem with a fresh Drupal install: On some pages, I receive a WSOD with ERR_EMPTY_RESPONSE:

It happens for instance when on admin/config/development/performance I click Clear all caches. (But also other pages are affected – for instance the Layout Builder page of a Node type.)
Interestingly, I could isolate the bug down here: If in vendor/symfony/http-foundation/Response.php::sendHeaders() I tweak the code so that it unsets a lot of the headers to be sent (actually, all of them but X-Generator and X-Frame-Options), the error disappears.
...
$headers = $this->headers->allPreserveCaseWithoutCookies();
unset($headers['Cache-Control']);
unset($headers['Content-language']);
unset($headers['Date']);
unset($headers['X-Drupal-Dynamic-Cache']);
unset($headers['X-UA-Compatible']);
unset($headers['X-Content-Type-Options']);
unset($headers['Expires']);
unset($headers['Vary']);
foreach ($headers as $name => $values) {
  ...

Based on the headers I unset, it seems that it is a caching-related problem. (However, Caching is switched off, Browser and proxy cache maximum age is set to <no caching>.)
My setup:

installed Drupal 8.7.5 via composer
on my local machine, a MacBook Pro with macOS High Sierra
installed via Homebrew

PHP 7.3
Apache 2.4
MySQL 5.7.24

Any idea what the problem might be?
Edit: Regarding Apache error logs: I first had no entries there but now I debugged again and saw such one:
[core:notice] [pid 92592] AH00052: child pid 98466 exit signal Bus error (10)

Googling gave the suggestion to apc_clear_cache(); but it's not available in PHP7. So I ran opcache-reset().
Result: Problem is still there, now already when opening the page admin/config/development/performance.
Now the error logs say:
 [core:notice] [pid 7428] AH00052: child pid 7446 exit signal Segmentation fault

Google suggests this is likely  caused by a syntax error in php.ini or some included extension there. Thus I have taken out all extensions, including
zend_extension=/usr/local/opt/php/lib/php/20180731/opcache.so

but the problem remains.
Edit 2: Here's the output of my php -i (It uses the same php.ini file as phpinfo() in localhost). https://pastebin.com/ppvCpPA6
Comment: This might be easier to debug if you find the error log of the Apache instance you've installed via Homebrew and post the error message.
Comment: Wouldn't it be better to have OPcache disabled completely when developing locally?
Comment: Thanks, just disabled it with `opcache.enable=0` in `php.ini`, problem remains.
Comment: Be sure that your `/usr/local/etc/php/7.3/conf.d/ext-opcache.ini` doesn't override your `php.ini`, see https://stackoverflow.com/q/27640772/2199525.
Comment: Yes, I'm sure, it only contains this commented out line: `;zend_extension=/usr/local/opt/php/lib/php/20180731/opcache.so`
Comment: Thanks for the suggestion. I first had no error_log entries, now I debugged again and got some – find them in my Edit above.
Comment: Here's the output of my `php -i` (It uses the same `php.ini` file as `phpinfo()` in localhost). https://pastebin.com/ppvCpPA6
Answer: Now I could solve it myself. My Apache error logs did show
AH00052: child pid 7363 exit signal Segmentation fault (11)

so it must have been a problem with the Apache config.
I took the opportunity to reinstall Apache and configure it with FCGI/FPM according to this and now the problem is gone.
Comment: Hurray!!!!!! :)
Answer: I have same issue with set debug mode when run
drupal smo dev

Problem will gone If I set to prod mode
 drupal smo prod

After sometime debug I found problem because cache tag header. And I change
http.response.debug_cacheability_headers: true

to
http.response.debug_cacheability_headers: false

It's working again.
Comment: Didn't know what [`smo`](https://hechoendrupal.gitbooks.io/drupal-console/en/commands/site-mode.html) meant. Where exactly did you change these tags?
Comment: @leymannx Grepping gave me `core/core.services.yml` – but my value is already `false` there.
Comment: @Jonh: Thanks, `drupal smo prod` gave me `PHP Fatal error:  Declaration of Drupal\Component\DependencyInjection\Container::set($id, $service) must be compatible with Symfony\Component\DependencyInjection\ContainerInterface::set($id, $service, $scope = self::SCOPE_CONTAINER) in /Users/jorge/data/my/code/test/d8/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 49`
Comment: @GeorgJähnig, the initial value in core.service.yml can be overwritten in /sites/default/services.yml or /sites/development.services.yml, the 2nd one only when enabled in settings.php, which is usually the case for dev modes, see https://drupal.stackexchange.com/questions/251768/error-500-premature-end-of-script-headers-index-php/283535#283535
Comment: @4k4 OK, thanks! I have no `sites/default/services.yml` file (nor `development.services.yml`), and even the `default.services.yml` (which I guess has no effect) has only a `http.response.debug_cacheability_headers: false` line.
Comment: @GeorgJähnig, OK, then you don't have an issue with too many tags in `X-Drupal-Cache-Tags`, which probably you had found already while debugging sendHeaders().


Unramification of Ideals in Pure Cubic fields

Question: I need some explanation for this .Let $K=\mathbb  Q{\sqrt[3]{m}} $ be a pure cubic field with non square element $\alpha $ in $K$ such that ideal $(\alpha) $ is an ideal square in K. Let $ L=K(\sqrt{\alpha})$ be a quadratic extension of K then why only primes above  2 and $\infty $  will ramify.
Thank you in advance.
Comment: An ideal square in $\mathcal{O}_K$?
Comment: I think this is true when $K$ is any number field.
Comment: @Slade What is wrong with an ideal square? Perhaps you want to change the terminology to: $(\alpha)$ is a square in the group of ideals of $K?$
Comment: @awllower $K$ only has two ideals.
Comment: @Slade Well, it is a convenient way to say *the group of ideals in the ring of integers of $K.$* In any case, you haven't explained what your doubt was.
Comment: @awllower I didn't have a doubt.  I understand the notation, I just think it's worth specifying whether these are fractional ideals of $K$, or actual ideals of $\mathcal{O}_K$.  It doesn't change the problem much, but in my opinion it's a distinction worth clarifying.
Answer: Let $\alpha$ be such an element.
$(\alpha) = \mathfrak p^2$, and the hypothesis on $\alpha$ says that $\mathfrak p$ represents a nontrivial element of order $2$ in the ideal class group of $K$.
The extension $L/K$ may be ramified at the primes above $2,\infty$, and at the primes present in the factorisation of $\mathfrak p$.
Now, in the ideal class group, each ideal class is represented by infinitely many prime ideals.
So we can find an ideal $\mathfrak q$ coprime with $\mathfrak p$ such that $\mathfrak {pq} = (a)$ for some $a \in K$
Now, we have $ (\alpha)\mathfrak q^2 = (a^2)$, so setting $\beta = a^2/\alpha$, we have $\mathfrak q^2 = (\beta)$, $L = K(\sqrt{\alpha}) = K(\sqrt{\beta})$, but $K(\sqrt{\beta})$ can only be ramified above the primes at $2$ and $\infty$, and at $\mathfrak q$.
Since $\mathfrak p$ and $\mathfrak q$ are coprime, $L$ can only be ramified at the primes above $2$ and $\infty$.
Comment: Notice that, when $K$ is a number field containing a unit $u$ which is not a square, then perhaps $\mathfrak p$ is principal: e.g. In $K=\mathbb Q(\sqrt{7}),$ the element $\alpha=-8-2\sqrt 7$ is not a square, but $-\alpha=(1+\sqrt 7)^2.$ In fact, consider $K=\mathbb Q(\sqrt[3]{7}):$ the element $\alpha=-1-2\sqrt[3]7-\sqrt[3]{49}$ cannot be a square (expand out $(a+b\sqrt[3]7+c\sqrt[3]{49})^2$), while $-\alpha=(1+\sqrt[3]7)^2,$ so that your proof needs to be modified.
Comment: hmm if $(\alpha) = (\beta^2)$ then $\alpha/\beta^2$ is a unit $u$ and $K(\sqrt \alpha) = K(\sqrt u)$ which can only be ramified at $2,\infty$, and the primes dividing $u$ (and there isn't any) ? I kinda felt at the time those pesky units would come and bite me *somewhere* but I couldn't find anything wrong with my proof so I wrote it like that lol
Comment: Well, it seems that you just finished the proof. +1 :)


Mostrar resultado de um array aleatório!

Question: Boa noite! Sou novato em Javascript. Fiz um estudo tipo memorização de palavras onde pego um determinado número de palavras dentro de um Array. As palavras são aleatórias e mostradas uma a uma. Mas gostaria de implementar um botão pra mostrar todas as palavras que foram escolhidas em uma lista, como uma resposta pra conferir depois. Alguém pode me dar um caminho? Obrigado.
o index:

Random

    <select  id="palavras">
        <option value="10"  selected>10 palavras</option>
        <option value="20" >20 palavras</option>
        <option value="30">30 palavras</option>
    </select>

    <button id="iniciar" >Iniciar</button>
    <button id="resposta" style=" display: none;">Resposta</button>

    <select  id="tempo">
        <option value="1000"  selected>1 segundo</option>
        <option value="2000" >2 segundos</option>
        <option value="5000">5 segundos</option>
    </select>

O script.js

 let random = document.getElementById('random');
 let resposta = document.getElementById('resposta');
 let tempo = document.getElementById('tempo');
 let palavras = document.getElementById('palavras');
 let inicar= document.getElementById('iniciar');

function randomWords(min, max){
   let step1 = max - min +1;
   let step2 = Math.random() * step1;
   let result = Math.floor(step2) + min;
   return result;
}

let words =  [

  'Barriga',
  'Bicicleta',
  'Formiga',
  'Garrafa',
  'Teclado',
  'Mouse',
  'Caneca',
  'Cerveja',
  'Barata',
  'Cigarro',
  'Café',
  'Copo',
  'Poste',
  'Bola',
  'Balão',
  'Igreja',
  'Padre',
  'Carro',
  'Caminhão',
  'Monitor',

];

function verificaDez(){
  if(words.length == 20){
    random.innerText = "Clique em resposta par ver o resultado";
    document.getElementById('resposta').style.display = "block";
     return;
 }
 let randomIndex = randomWords (0,words.length-1) ;
 let randomWord = words[randomIndex];
 words.splice(randomIndex,1);
 random.innerText = randomWord;

}

function verificaVinte(){
  if(words.length == 10){
    random.innerText = "Clique no botão resposta para ver o resultado";
    document.getElementById('resposta').style.display = "block";
     return;
 }
 let randomIndex = randomWords (0,words.length-1) ;
 let randomWord = words[randomIndex];
 words.splice(randomIndex,1);
 random.innerText = randomWord;

}

function verificaTrinta(){
  if(words.length == 0){
    random.innerText = "Clique em resposta par ver o resultado";
    document.getElementById('resposta').style.display = "block";
     return;
 }
 let randomIndex = randomWords (0,words.length-1) ;
 let randomWord = words[randomIndex];
 words.splice(randomIndex,1);
 random.innerText = randomWord;

}

iniciar.addEventListener("click", function( ) {
  if(palavras.value == 10){
    setInterval(verificaDez, tempo.value);
  }else if ( palavras.value == 20){
    setInterval(verificaVinte, tempo.value);
  }else if( palavras.value == 30){
    setInterval(verificaTrinta, tempo.value);
  }
}
);

resposta.addEventListener("click", function( ) {

}
);

https://jsfiddle.net/wnobre/epzLm05r/  " Exemplo de como ficou"
Comment: Isto responde à sua pergunta? [Gerar vários números aleatórios sem repetição](https://pt.stackoverflow.com/questions/10282/gerar-v%c3%a1rios-n%c3%bameros-aleat%c3%b3rios-sem-repeti%c3%a7%c3%a3o)
Comment: @RafaelTavares Na verdade eu já consegui gerar as palavras aleatórias! O que eu não consegui foi depois de mostrar as palavras aleatórias , recuperar e mostrar todas de uma vez numa lista. Não sei se deu pra entender, rs
Comment: Você diz na resposta? Seu evento click de resposta a função está vazia...
Comment: @MagicHat Sim! Tá vazia, pq não sei como retornar essas palavras que foram mostradas aleatoriamente. É justamente essa a minha dúvida.
Comment: Hum, entendi... E nem tentou nada?
Comment: @MagicHat Tentei tudo que sabia, rs! Mas, sou iniciante e nada deu certo.
Comment: Então, o ideal é colocar o código que tentou...
Answer: Siga os seguintes passos:

Crie uma variável dentro do escopo global contendo um array vazio.

const displayedWords = [];

Substitua words.splice(randomIndex,1)) dentro de suas funções "verifica" pelo seguinte código, que adicionará cada palavra sorteada ao array criado anteriormente:

displayedWords.push(words.splice(randomIndex,1)[0]);

Preencha a função chamada ao clicar em "Resposta" com este código, que irá adicionar uma lista contendo as palavras sorteadas ao seu HTML:

  const list = document.createElement('ul');
  list.style.paddingLeft = '0';
  displayedWords.forEach((word) => {
    list.insertAdjacentHTML('beforeend', `<li>${word}</li>`);
  });
  document.querySelector('#container').insertBefore(list, random);
  displayedWords.length = 0;

O código complete ficaria assim:

let random = document.getElementById('random');
 let resposta = document.getElementById('resposta');
 let tempo = document.getElementById('tempo');
 let palavras = document.getElementById('palavras');
 let lista = document.getElementById('lista');
 let inicar= document.getElementById('iniciar');

function randomWords(min, max){
   let step1 = max - min +1;
   let step2 = Math.random() * step1;
   let result = Math.floor(step2) + min;
   return result;
}

let words =  [

  'Barriga',
  'Bicicleta',
  'Formiga',
  'Garrafa',
  'Teclado',
  'Mouse',
  'Caneca',
  'Cerveja',
  'Barata',
  'Cigarro',
  'Café',
  'Copo',
  'Poste',
  'Bola',
  'Balão',
  'Igreja',
  'Padre',
  'Carro',
  'Caminhão',
  'Monitor',
  '1',
  '2',
  '3',
  '4',
  '5',
  '6',
  '7',
  '8',
  '9',
  '10',

];

const displayedWords = [];

function verificaDez(){
  if(words.length == 20){
    random.innerText = "Clique em resposta par ver o resultado";
    document.getElementById('resposta').style.display = "block";
     return;
 }
 let randomIndex = randomWords (0,words.length-1) ;
 let randomWord = words[randomIndex];
 displayedWords.push(words.splice(randomIndex,1)[0]);
 random.innerText = randomWord;

}

function verificaVinte(){
  if(words.length == 10){
    random.innerText = "Clique no botão resposta para ver o resultado";
    document.getElementById('resposta').style.display = "block";
     return;
 }
 let randomIndex = randomWords (0,words.length-1) ;
 let randomWord = words[randomIndex];
 displayedWords.push(words.splice(randomIndex,1)[0]);
 random.innerText = randomWord;

}

function verificaTrinta(){
  if(words.length == 0){
    random.innerText = "Clique em resposta par ver o resultado";
    document.getElementById('resposta').style.display = "block";
     return;
 }
 let randomIndex = randomWords (0,words.length-1) ;
 let randomWord = words[randomIndex];
 displayedWords.push(words.splice(randomIndex,1)[0]);
 random.innerText = randomWord;

}

iniciar.addEventListener("click", function( ) {
  if(palavras.value == 10){
    setInterval(verificaDez, tempo.value);
  }else if ( palavras.value == 20){
    setInterval(verificaVinte, tempo.value);
  }else if( palavras.value == 30){
    setInterval(verificaTrinta, tempo.value);
  }
}
);

resposta.addEventListener("click", function( ) {
  const list = document.createElement('ul');
  list.style.paddingLeft = '0';
  displayedWords.forEach((word) => {
    list.insertAdjacentHTML('beforeend', `<li>${word}</li>`);
    });
  document.querySelector('#container').insertBefore(list, random);
  displayedWords.length = 0;
});
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Random</title>

Random

    <select  id="palavras">
        <option value="10"  selected>10 palavras</option>
        <option value="20" >20 palavras</option>
        <option value="30">30 palavras</option>
    </select>

    <button id="iniciar" >Iniciar</button>
    <button id="resposta" style=" display: none;">Resposta</button>

    <select  id="tempo">
        <option value="1000"  selected>1 segundo</option>
        <option value="2000" >2 segundos</option>
        <option value="5000">5 segundos</option>
    </select>

Dica: junte suas funções "verifica" em uma só, passando dados variáveis por parâmetro.
Comment: Cara! Exatamente isso que eu precisava. Valeu mesmo. Sobre a sua dica, vou dar uma estudada. Obrigado!


How to insert using greatest value of a column?

Question: I have two types of inserts, one for new comments in a post and one is for response to another comment.
The response to comment is
INSERT INTO event_comments(e_id, thread_id, date_posted, is_root, created_by, body, num_likes)

For a new comment how can I insert using the highest value of thread_id?

But for a new comment how can I use thread_id's value of 1 to insert?
I would be inserting the value 2 since the current highest thread_id value is 1
INSERT INTO event_comments(e_id, thread_id, date_posted, is_root, created_by, body, num_likes)
VALUES(
   ..., 2, ..., ..., ..., ..., ...
)

Comment: You should have a separate `threads` table and take the `id` value from there as a foreign key in your `event_comments` table
Comment: what do you mean? so I just have a single threads table that have 1,2,3.. with no duplicates?
Comment: Yes a threads table with ID and all the info that defines a thread like a name.
Comment: can you explain a little on why I need to do that? that means when I insert a new comment into event_comments I need to insert a new one in threads_table. Whats wrong with using the INSERT INTO ... SELECT?
Comment: You should read up on databse normalization and database design. It it very odd having only an ID without a table for it. Smells like a design flaw. But that is way to much to explain here.
Answer: You could use an INSERT INTO ... SELECT.  For example, for doing an insert with e_id = 1, you may try:
INSERT INTO event_comments(e_id, thread_id, date_posted, is_root, created_by, body, num_likes)
SELECT e_id, thread_id + 1, date_posted, is_root, created_by, body, num_likes
FROM event_comments
WHERE e_id = 1;

Note the above insert is still a single statement, and so should be atomic.  That is, even if other threads are also reading and trying to do inserts, they should not interfere.
Comment: You can use the `max` function, if there are several threads

```INSERT INTO event_comments(e_id, thread_id, date_posted, is_root, created_by, body, num_likes)
SELECT e_id, max(thread_id) + 1, .....
FROM event_comments
WHERE e_id = 1;
```
Answer: You can get the latest threadID using ORDER BY and limit result to 1.
INSERT INTO event_comments(e_id, thread_id, date_posted, is_root, created_by, body, num_likes)
SELECT e_id, thread_id + 1, date_posted, is_root, created_by, body, num_likes
FROM event_comments
ORDER BY thread_id DESC LIMIT 1;

Answer: I would make a nullable thread_id field that contains the id of the parent. A new thread is a comment with an empty thread_id. This also allows for nested threads. This also removes the need for an is_root field. I would also add a page_id with a foreign key to the pages table (or with the page url in it, if you do not have that table).


What possible effects to include when running a Mixed Model, time variable and or lags for DV's and IV's?

Question: I'm doing analyses in R on 5 repeated observations over a period of 5 years (repeated/random dv: 'amount of professional health care', repeated/random IV's: 'amount of social support' with several other random and fixed variables/covariates) Multilevel Analysis seems one of the (most) correct analysis to me.
1: My main research question is whether or not there is a relation between 'Health Care' and 'Social Support' how should i decide whether i should include lagged variables for DV and IV's or is this resolved when we control for Covariance Structure like AR1?
2: When using lags, don't we always loose the first row of data for each case/id? This means we loose 20% of the data when dealing with 5 rows of data for each id?
3: Do we call these kind of analysis always growth modelling when we include a 'time' variable when doing regressions?
4: Should I include (higher order) interactions  of the time variable to allow nonlinearity, since I expect no linear association between time and DV. Actually, I'm not interested in the effect of time at all, only about my main research question. Does anyone have any guidance, good article or book for figuring out what the best approach is for these kind of data when dealing with bivariate relations within persons? Maybe I should include time as a factor?
Thanks!
Answer: You ask important questions, which I address below in turn.

1: My main research question is whether or not there is a relation between 'Health Care' and 'Social Support' how should i decide whether i should include lagged variables for DV and IV's or is this resolved when we control for Covariance Structure like AR1?

See this recent Q&A on a very similar question about lagged DVs vs. alternative covariance structures.

2: When using lags, don't we always loose the first row of data for each case/id? This means we loose 20% of the data when dealing with 5 rows of data for each id?

Yes, you lose all the observations from the first time point. Assuming the same number of observations at each time point, that would be 20% of your observations.

3: Do we call these kind of analysis always growth modelling when we include a 'time' variable when doing regressions?

Typically, we call them growth models when we also include the continuous time variable as a varying (or random) slope such that each individual has their own starting point (intercept) and rate of change (slope through their data points).

4: Should I include (higher order) interactions of the time variable to allow nonlinearity, since I expect no linear association between time and DV. Actually, I'm not interested in the effect of time at all, only about my main research question.

If you are not interested in time, then you might consider including time as a categorical predictor, as you suggested in your very last sentence. This ensures no improper assumption about the shape of change in the DV over time and has the effect of estimating the association of interest as a within-time point estimate.
The issue you deal with when estimating bivariate change is that there is some sort of systematic change in both the key IV and the DV. If that is the case, then you need to account for it. This is easiest to do using structural equation modeling, but can also be accomplished in R with nlme. The same book by Lesa Hoffman that I referenced in the linked Q&A devotes chapters 8 and 9 to this topic. I highly recommend it.


Real structure on complex vector bundle

Question: In Chapter 19 of Homotopical Topology by Fomenko and Fuchs, there is an exercise asserting that a complex vector bundle $\xi$ is the complexification of a real vector bundle if and only if there is an isomorphism $\xi\cong\bar\xi$. I have been trying to do this exercise, but getting caught up on some of the details.
I know that if $V$ is a complex vector space, then specifying a real structure on $V$ (i.e. a subspace $W\subset V$ with $V=W\oplus iW$) is equivalent to specifying a conjugate-linear involution on $V$. However, I have been unable to go from a general conjugate-linear isomorphism $\xi\rightarrow\xi$ to one that equals its own inverse.
Any suggestions?
Answer: It turns out that the exercise is wrong. The following answer is based on a homework problem assigned by Alexander Givental and multiple conversations with Tong Zhou.
For the quaternionic projective plane $\mathbb H\mathbb P^1$, we take the set of right-lines in $\mathbb H^2$ (i.e. let $\mathbb H^\times$ act on $\mathbb H^2$ by right-multiplication and define $\mathbb H\mathbb P^1$ to be the quotient of $\mathbb H^2-\{0\}$ under this action). Every $\ell\in \mathbb H\mathbb P^1$ is a quaternionic line under right-multiplication. This makes the tautological bundle $\xi=\{(\ell,v)\in \mathbb H\mathbb P^1\times \mathbb H^2\mid v\in \ell\}$ into a quaternionic line bundle. We can forget the quaternionic structure and consider the complex vector bundle $\xi|\mathbb C$ over $\mathbb H\mathbb P^1$. Right-multiplication by $j$ preserves each fiber and anti-commutes with $i$, so we get a conjugate-linear automorphism of $\xi|\mathbb C$.
However, the quaternionic line bundle $\xi$ is non-trivial, so it has no non-vanishing sections. But if $\eta$ is any real vector bundle over $S^4$ of dimension 2, then the Euler class $e(\eta)\in H^2(S^4)=0$ vanishes, so $\eta$ admits a non-vanishing section. Therefore, the complexified bundle $\eta\otimes \mathbb C$ admits a section as well. Since $\mathbb H\mathbb P^1\cong S^4$, no real bundle $\eta$ over $\mathbb H\mathbb P^1$ can satisfy $\eta\otimes \mathbb C\cong \xi|\mathbb C$.
Comment: "left-multiplication by $j$ is [...] obviously $\mathbb H$-linear." How so? $j$ is not central in $\mathbb H$. Or are you viewing $\mathbb H$ as an $\mathbb H$-vector space from the right but as $\mathbb C$- vector space from the left? Possible, and I don't doubt your ultimate conclusion, but this feels fishy.
Comment: More generally, any complex rank 2 bundle over $S^4$ with non-zero $c_2$ provides a counterexample, see [here](https://math.stackexchange.com/a/3989398/39599).
Comment: The $\eta$ in my last paragraph has rank 2, because then the complexification $\eta\otimes \mathbb C$ has rank 4. I was using the notation $\mathbb C\eta=\eta\otimes \mathbb C$ for the complexification and $\mathbb C\xi=\xi|\mathbb C$ for the restriction of structure. This isn't the best choice of notation, so I've tried to modify it for clarity. Hopefully, that helps.
Comment: @TorstenSchoeneberg Good point! I was a little careless with my justification (and even my definition of the tautological bundle over $\mathbb H\mathbb P^1$). Does the new fix help?
Comment: I guess so, although to be honest I don't feel competent enough to "get" what is happening here. It does make sense to me though.

Real structure on complex vector bundle


How to plot file sizes

Question: I have data about ~18.000 files, mostly name, and size. I would like to plot it with Mathplotlib. Not sure what would be the best option.
df_final.head(2)
                       file_sizes_clean                    number_of_files
folder1/               [36829.0, 38711.0, 0, 349159, ...]   9
folder2/               [71318.0, 46944.0,... ]              6

Collecting all the file sizes into a single np.array:
from scipy import stats
x = np.array(sizes_flat)
stats.describe(x)

DescribeResult(nobs=18664, minmax=(3336.0, 8876007.0),
mean=280316.77716459497, variance=445060834502.10297,
skewness=4.744572944478072, kurtosis=29.465744857449934)

Trying to plot it:
f, axes = plt.subplots(1, 1, sharey=True, figsize=(20, 8))
axes.set_yscale('log')
sns.distplot(x, hist=True, kde=False, bins=100, color = 'blue', hist_kws={'edgecolor':'black'})

Different plot:
f, axes = plt.subplots(1, 1, sharey=True, figsize=(20, 8))
axes.set_yscale('log')
plt.plot(x,x)

I was wondering if there is a better way of plotting these or it would make sense to try to take a different approach, maybe go by subfolders. I would like to display the extreme skewness in the data that we have many very small files and some medium-sized. Ideally, we would have roughly equal-sized files.
Comment: A [treemap](https://python-graph-gallery.com/200-basic-treemap-with-python/) also seems to be an interesting option. The filesize determines the surface area. Color could e.g. depend on subfolder (or filetype).
Comment: This is an excellent recommendation. Thanks!
Answer: Choice of plots depends on what you want to communicate to the reader, so it is always a contextual issue.  Assuming that your goal is simply to give the reader a sense of the distribution of the file sizes, a histogram of the data is perfectly reasonable.  Once you add clear axis titles and a plot title, the histogram you have constructed ought to be sufficient to give the reader a clear idea of the distribution of the data.
Comment: This is what I thought. I might just split the data into smaller chunks and display histograms for those chunks as well. Thank you!

How to plot file sizes


Why do we look at multiple thresholds in AUC

Question: For AUC ROC, why do we have a graph of multiple thresholds when in the end, we will only use one of those thresholds (so why not just choose the threshold and compare that one value across models)?
Comment: How would you choose a threshold if you only evaluate your models at a single threshold? Additionally, it's not generally true in professional settings that "we will only use one of those thresholds". Sometimes we care about risk/profit estimation, or ranking, or we want to let some other team manage threshold setting while we focus on the machine learning/analysis bit. The single pre-set threshold thing mostly only shows up in toy problems and beginner educational material.
Comment: You're (probably) not doing a classification but a probability prediction. Please refer to Frank Harrell's blog.  https://www.fharrell.com/post/class-damage/ https://www.fharrell.com/post/classification/
Answer: ROC AUC is defined as the area under the ROC curve. The reason that ROC AUC considers multiple thresholds is that the ROC curve does. The reason the ROC curve compares multiple thresholds is to show the tradeoffs for true positive rate and false positive rate as the threshold is varied. Indeed, this is the original application of ROC curves.
Another reason that comparing multiple thresholds is useful is that it proportional to the Mann-Whitney $U$ statistic, which expresses the probability that a random element of one class is ranked higher than a random element from a second class. This second interpretation gives us some intuition about how to understand ROC AUC.

How to derive the probabilistic interpretation of the AUC?

Alternatively, if you don't need a threshold to solve your problem, then you might consider a different statistic such as the Brier score for comparing models.


Local changes not reflected in docker container

Question: I have a simple react application (default created using create-react-app). I am trying to run the container with -v tag so that changes to the local files get reflected in docker. But for some reason the changes are not being reflected in the app. Only when I rebuild the image, the app gets updated.
Version Info:
OS: Windows Home x64
Docker Toolbox
Oracle Virtual Box v 6.1
React project file structure:
simple-react-app
│   README.md
│   Dockerfile.dev
│   package.json
└───public
│   │   ...
└───src
    │   App.css
    │   App.js
    │   ...

Here are the contents of the Dockerfile:
FROM node:alpine
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
CMD ["npm", "run", "start"]

Build Command: docker build -t my:simple-react-app -f Dockerfile.dev .
Run Command: docker run -it -p 3000:3000 -v /app/node_modules -v pwd:/app my:simple-react-app
Here pwd is a sub-directory of C:\Users
Comment: Does this answer your question? [Docker toolbox volumes on windows doesn't refresh changes on container](https://stackoverflow.com/questions/33352104/docker-toolbox-volumes-on-windows-doesnt-refresh-changes-on-container)
Answer: could you please try replace the pwd with exact path of the directory.  I suspect pwd is being taken as literal and not being translated to correct path.
i.e.  docker run -v d:/data:/data alpine ls /data
Comment: @NotABot  Can u provide information please? like what u typed and current directory names etc., where you running the command.


Integral with exponential Brownian motion

Question: I was working through the pricing of some binary option and after changing measure and doing some clean up, I have arrived at the following quantity:
$$\mathbb{E}_\mathbb{P}\left[ \exp(cW_T) \cdot 1\{\sup_{t \leq T} W_t \geq a\}\right]$$
Where above $W_t$ is $\mathbb{P}$-brownian motion, and $a, c$ and $T$ are fixed constants.
I was attempting it as follows: Let $\tau_a$ denote the first time $W_t$ reaches $a$. Then, we know the density for $f_{\tau_a}(t)$:
$$f_{\tau_a}(t) = \frac{a \exp\left( -\frac{a^2}{2t}\right)}{\sqrt{2\pi t^3}}$$
Then:
$$\mathbb{E}_\mathbb{P}\left[ \exp(cW_T) \cdot 1\{\sup_{t \leq T} W_t \geq a\}\right] = \int_0^T \mathbb{E}_\mathbb{P}\left[\exp(cW_T)|W_t = a\right] f_{\tau_a}(t) dt $$
we also have:
$$\mathbb{E}_\mathbb{P}\left[\exp(cW_T)|W_t = a\right] = \exp(ca + c^2(T-t) / 2)$$
to get the above we can use the strong markov property and the reflection property.
Putting everything together:
$$I:=\int_0^T \frac{\exp\left(ca + \frac{c^2 (T-t)}{2} - \frac{a^2}{2t} \right)}{\sqrt{2\pi t^3}}dt $$
At this point I started reading some material and I saw that my desired quantity was equal to
\begin{align} J:=e^{ca} \int_0^\infty \left( e^{cx} + e^{-cx}\right) e^{-(x+a)^2 /(2T)} \cdot \frac{1}{\sqrt{2\pi T}}dx
\end{align}
This integral is much easier to do by hand and we get:
$$ J = e^{ca} \left( \exp\left(\frac{c^2 T - 2ac}{2}\right) \Phi\left(\frac{cT - a}{\sqrt{T}}\right) + \exp\left(\frac{c^2 T + 2ac}{2}\right) \Phi\left(\frac{-cT - a}{\sqrt{T}}\right) \right)$$
where $\Phi(\cdot)$ is the CDF for the standard normal distribution.
I have checked (doing numeric integration with a few different set of values) that the integrals in $J$ and $I$ do indeed match and that my closed formula for $J$ is correct. My question is:

How can one go from the first equation to the integral set up in $J$? The notes I found say Use the reflection principle and the Strong Markov property to justify the identity
Is there a way to solve the integral $I$ directly? If so, how?

References:

First hitting time density can be viewed here: Density of first hitting time of Brownian motion with drift

Expected value of an exponential brownian motion here: Mean of exponential Brownian motion

Notes that I was reading, bottom of page 8(Careful -- lots of typos!): https://galton.uchicago.edu/~lalley/Courses/390/Lecture8.pdf Note that their $\theta$ is equal to $-c$ in my notation.

Numerical integration:
numerical integrations
Answer: For the general case, I have not been able to establish the antiderivative required for computing $I$ which I rewrite
$$I=\frac 1 {\sqrt{2 \pi}}\exp\Bigg[c \left(a+\frac{c T}{2}\right)\Bigg]\int_0^T t^{-\frac 32}\exp\Big[-\frac{a^2}{2 t}-\frac{c^2 t}{2}\Big]\,dt$$ For $J$
$$J=\frac 12 e^{a c}\exp\Big[\frac{c^2 T^2}{2}\Big]\Bigg[e^{-a c} \text{erfc}\left(\frac{a-c T}{\sqrt{2} \sqrt{T}}\right)+e^{a c}
   \text{erfc}\left(\frac{a+c T}{\sqrt{2} \sqrt{T}}\right) \Bigg]$$
Suppose $c=0$; for such a case, we have
$$I=\frac 1 a \text{erfc}\left(\frac{a}{\sqrt{2T} }\right)  \qquad \text{while} \qquad J=\text{erfc}\left(\frac{a}{\sqrt{2T} }\right) $$ Computing for various general cases, what it seems is that
$$I =\frac J a $$ I supect (please confirm or negate) that your calculations have been done for $a=1$.


Robust regularized regression

Question: I've been using elastic net implemented in R (via glmnet) for some modeling, but I was wondering, due to the number of outliers in my data, if there was some sort of modeling approach for regularized robust regression? e.g. something like elastic net applied to robust regression. if there's something already in R, even better. Just curious to know what's out there.
Comment: Have a look at the answers to [this](http://stats.stackexchange.com/q/214617/603) similar questions.
Comment: On the basis of this article https://towardsdatascience.com/penalized-regressions-with-jmp-e10628799aef (A "Towards Data Science Article", mind you, not a journal article), there seems to be an implementation of Lasso-penalized Cauchy regression in JMP. I don't have access to that software to confirm this.
Answer: There seem to be some relevant papers. You can start with:
Robust regression through the Huber's criterion and adaptive lasso penalty, Sophie Lambert-Lacroix, Laurent Zwald
Robust Regression and Lasso: Huan Xu, Constantine Caramanis, Shie Mannor (arXiv)
Sparse least trimmed squares regression for analyzing high-dimensional large data sets: Andreas Alfons, Christophe Croux, Sarah Gelper
... but I don't know about implementations.
Answer: Suppose we are using L1 norm on error term, the objective is still convex.
The objective is
$$\|Ax-b\|_1+\lambda_2\|x\|^2_2+\lambda_1\|x\|_1$$
Gradient is
$$A^T \text{sign}(Ax-b)+2\lambda_2x+\lambda_1 \text{sign}(x)$$
Here is a R implementation
<code>f<-function(x,A,b,l1,l2){
  e=A %*% x - b
  # v=crossprod(e)+l2*crossprod(x)+l1*sum(abs(x))
  v=sum(abs(e))+l2*crossprod(x)+l1*sum(abs(x))
  return(c(v))
}

gr<-function(x,A,b,l1,l2){
  v=t(A) %*% sign(A %*% x -b)
  return(c(v)+2*l2*x+l1*sign(x))
}

set.seed(0)
par(cex=1.3)
n_data=20
n_feature=2

A=matrix(runif(n_data*n_feature),ncol=n_feature)
b=matrix(runif(n_data),ncol=1)

l1=0.01
l2=0.01

opt=optimx::optimx(runif(n_feature),f, gr,A=A,b=b,l1=l1,l2=l2, method="BFGS")
opt
</code>
Here is the results and visualization
<code>> opt
            p1        p2    value fevals gevals niter convcode  kkt1 kkt2 xtimes
BFGS 0.2600659 0.7781711 4.995662    179     29    NA        0 FALSE   NA      0
</code>

Robust regularized regression


How can I check if the user input is a string

Question: I'm trying to check if the user inputs a string. If the user inputs a string, my program should output an error message. If the user enters an integer my program should proceed with the program
Here's my code so far, I need to add another condition to check if the user inputs string, I tried some methods but they don't work
public int UserInput() {
    boolean Continueasking = true;
    int Input = 0;
    while (Continueasking) {
        Input = io.nextInt();
        if (Input == 1 || Input==2 || Input==3) {
            Continueasking = !Continueasking;
        } else {
            System.out.println("try again");
        }
    }
    return Input;

Answer: nextInt() parses user input as an integer. If the user input can't be parsed as an integer, it throws InputMismatchException. You can catch this exception and handle it as you see fit.
while (continueAsking) {
    try {
       input = io.nextInt();
    } catch (InputMismatchException ex) {
       // invalid input - handle exception
    }
}