text:
Q: Area of a circle as it changes to an ellipse when viewing at different angles Sorry for the long paragraph, I'm not too good at describing things:
Firstly, to explain the situation, I need to know how the area of a circle can change as you view it from different angles. For example, if you were viewing a circle at a 0 degree angle, it would look like a circle and it's area would be $\pi r^2$. However, as the angle of observation increases or decreases, one side of the circle will "collapse" inwards, and become smaller. It would create an ellipse, where the variable 'a' (longest distance from centre to side) stays the same, and where variable 'b' (the smallest distance from centre to side) decreases. I want to know the best way to find the area, based on the angle theta. For clarification, theta refers to the angle from a line perpendicular to the circle. The best way to approach the issue seemed to be the diagram in the link.

In the diagram, the 2 cm long line, is the circle. Therefore, the radius is 1 cm. The best approach I could find, was by using a cos ratio in the triangle highlighted in red as whenever I try any trig rules, it always gets too complicated with multiple variables. The angle closest to the centre of the circle would have to be 90-theta and, if the triangle is right angle (which it was made to be this way), the opposite angle must be theta. Hence by using $\cos \theta = a/h$, where h is the 1cm line, 'a' (which refers to adjacent not the other longer 'a') must be cos theta. This only works if the entire line is 2a. But if it's not and either side is different, then I have a problem. So, I wanted to know, am I right with the above working, or am I wrong. And if I'm wrong, how should I approach this problem differently. Thanks.

A: As you've observed, the projected line segment is not symmetric about the view line to the circle's center—the center shifts. Another reason that you might be having some trouble working this out is that the apparent width of the ellipse also depends on the visual angle subtended by the circle, which varies with both the distance of the viewpoint from the center of the circle and the circle's radius.

(Diagram provided by the OP.)
This problem can be reduced to finding the intersection of pairs of lines, which is easily done using homogeneous coordinates. We place the circle on the $x$-$y$ plane, centered at the origin, and Let the viewpoint be $V=(0,d\cos\theta,d\sin\theta)$, ($d>0$). We'll first look at what's going on in the $y$-$z$ plane. In the above diagram, the horizontal direction represents $z$ and the vertical $y$. To reduce clutter, the $x$-coordinate will be suppressed and, at the risk of introducing some confusion, the others will be designated $x'$ and $y'$, respectively.
The line perpendicular to $\overline{OV}$ that passes through the upper point $A(0,r)$ is $y'=r-x'\cot\theta$, which we can rewrite in normal form as $x'\cos\theta+y'\sin\theta-r\sin\theta=0$. The homogeneous vector that represents this line consists of the coefficients of the latter equation: $$\mathbf l=(\cos\theta,\sin\theta,-r\sin\theta).$$ The line through $V$ and the lower point $B(0,-r)$ is represented by the cross product of the homogeneous coordinates of these points: $$\mathbf m=(d\cos\theta,d\sin\theta,1)\times(0,-r,1)=(r+d\sin\theta,-d\cos\theta,-dr\cos\theta).$$ Their intersection is $$\mathbf l\times\mathbf m=(-dr\sin2\theta,dr\cos2\theta-r^2\sin\theta,-(d+r\sin\theta))$$ which in Cartesian coordinates is $$C=\left({dr\sin2\theta\over d+r\sin\theta},{r^2\sin\theta-dr\cos2\theta\over d+r\sin\theta}\right).$$ The minor axis length of the circle's image is $AC$, which you can compute using the standard formula for the distance between two points as $${2dr\cos\theta\over d+r\sin\theta}.$$ Compared to your initial guess, there's an extra factor of ${d\over d+r\sin\theta}$ that accounts for the asymmetry of the view and the "angular size correction" factor. As $d\to\infty$, so that the projection becomes closer and closer to parallel, this correction factor approaches unity.

This isn't the whole story, though. Rays from the viewpoint through points on the circle converge as they get closer to the viewpoint, so the other semi-axis of the circle's projection isn't going to be equal to $r$, either. To work out what this is, first project the center of the ellipse back to the $x$-$y$ plane. This center is the midpoint of $A$ and $C$ and its pre-image can be found by intersecting lines again: $$\begin{align}D &= \frac12\left((0,r)+\left({dr\sin2\theta\over d+r\sin\theta},{r^2\sin\theta-dr\cos2\theta\over d+r\sin\theta}\right)\right) \\ &=\left(\frac{d r \sin (\theta ) \cos (\theta )}{d+r \sin (\theta )},\frac{r \sin (\theta ) (d \sin (\theta )+r)}{d+r \sin (\theta )}\right)\end{align}$$ and its back-projection is $$\overline{VD}\times\overline{OA}=(V\times D)\times(-1,0,0)=\left(0,\frac{d r^2 \sin (\theta ) \cos (\theta )}{d+r \sin (\theta )},\frac{d^2 \cos (\theta )}{d+r \sin (\theta )}\right)$$ which becomes $\left(0,\frac{r^2}d\sin\theta\right)$ in Cartesian coordinates.
Going back to 3-D coordinates, this is the point $\left(0,\frac{r^2}d\sin\theta,0\right)$. The $x$-coordinates of the points on the circle with this $y$-coordinate are $\pm\sqrt{r^2-y^2}=\pm r\sqrt{1-\left(\frac rd\sin\theta\right)^2}$. I'll leave finding the projections of these points and the resulting semi-axis length to you (hint: you can use similar triangles).

A: An elipse has a horizontal radius $R $ and a vertical radius $r$.
The area of the elipse is $\pi*R*r$.  For a circle $r=R $ and thus we get our familiar circle area formula.
You correctly figured out that if the tilting angle is $\theta$ then the vertical radius is $r*\cos \theta $.  (Just look at the image... it's clear that the vertices radius is the side opposite the angle $90 - \theta $ on a right triangle with hypotenuse of $r $.  I.e. $r*\sin (90 -\theta)=r*\cos (\theta) $)
So the area of the elipse is $\pi *r^2*\cos \theta $.

A: I'm currently responding to fleablood's answer, however I couldn't seem to attach a picture when only commenting, so I'm responding to my own question. What you have said is exactly how I initially believed when I viewed the problem; however, after observing a change in angle using a graphing program, I noticed that the found value for R may not be right. This is because the total length of the line doesn't seem to necessarily be 2R. This can be seen visually by the link. It can be seen that the red line, which is the R, as found above, is much longer than the other side of the line. The above equation works but only when assuming the red line is equal to the blue line. Obviously I have no mathematical proof of this claim, but from moving around the view point using GeoGebra, a graphing software, the lines seem dramatically different at big angles. Any idea on how to approach this given the new diagram. Thanks.

A: I'm responding to amd's response without commenting for the same reason as with fleablood, I'm going to attach a photo:
Thanks for the answer! In the diagram, I've labelled a bunch of points for easier questioning. I believe I have assigned all the variables discussed to the image so if any are in the wrong place please tell me. For the line which you state is perpendicular to OV, and is written as "y=r−xcotθ", are you referring to AC or the line from A to the 'd' line? Not sure if my uncertainty about that is the reason, but how did you obtain the equation "y=r−xcotθ"? Why is there a z direction when the diagram is only dealing with changes on a 2d plane? Also, on a diagram what does this 'l' value represent?
Also, I hadn't learnt what homogeneous meant so I did some research and found this website: http://www.tomdalling.com/blog/modern-opengl/explaining-homogenous-coordinates-and-projective-geometry/
It talks about letting w=1 which is where I'm assuming you got the z coordinate for the next part of your answer. However I have a similar problem with 'm' as I did with 'l' where I don't understand how/why you chose the value. If we're talking vectors, m would give a vector coming out/into the screen at a slight angle (to account for the +1 in the z) perpendicular to the vector OV and OB.
For the next part of your explanation I understand how you reduced the z direction back down to 1, then turned it into a 2d vector/point. However, I haven't had time to go through the "algebraic manipulation", which I'm assuming at the moment is the difference between this vector, and viewpoint V vector. Finally, for the equation d/d+rsinθ I can't get this far as I haven't understood l and m.
Sorry for so many questions, I'm in year 12, Math C and B so my knowledge only goes so far. If you're wondering what I mean by C and B, go to the following link which briefly showcases what kind of information is learnt in each class:
https://en.wikipedia.org/wiki/Mathematics_education_in_Australia#Mathematics_C


text:
Q: how to make slidetoggle with jquery? I am trying to use slide-toggle effect of j-query but getting issue with HTML i have . Please take a look -:

Pork Ham

> Double Smoked Ham

> Prime Ham

> Smoked Ham

Pork Lyoner

> Pork Olive Lyoner

> Pork Paprica Lyoner

> Pork Pepper Lyoner

> Pork Pista Lyoner

Pepperoni

> Pork Pepperoni

I want to show the toggle effect on Pork Ham , Pork Lyoner , Pepperoni.
Advise me how to do without changing the html and classes.

A: This is how I did it:
$('.Sub-Tag').click(function(){
    var current = $(this);

    while(current.next().hasClass('active-in') != false){
        current = current.next();
        current.slideToggle();
    }
});

JSFiddle demo here

A: You can try slideToggle better than toggle:
$('.active.Sub-Tag').slideToggle(timeout);

You also need to edit html, because slidetoggle works maximizing height of an element. For example:

A long content here....

<button id="button">Click</button>

You can see this code working on this fiddle:
https://jsfiddle.net/y8sqm7ww/

redpajama_set_name: RedPajamaStackExchange


text:
Q: Smooch chat has elements on top of it, how can I fix this? I am using this library:
 !function(e,n,t,r){
        function o(){try{var e;if((e="string"==typeof this.response?JSON.parse(this.response):this.response).url){var t=n.getElementsByTagName("script")[0],r=n.createElement("script");r.async=!0,r.src=e.url,t.parentNode.insertBefore(r,t)}}catch(e){}}var s,p,a,i=[],c=[];e[t]={init:function(){s=arguments;var e={then:function(n){return c.push({type:"t",next:n}),e},catch:function(n){return c.push({type:"c",next:n}),e}};return e},on:function(){i.push(arguments)},render:function(){p=arguments},destroy:function(){a=arguments}},e.__onWebMessengerHostReady__=function(n){if(delete e.__onWebMessengerHostReady__,e[t]=n,s)for(var r=n.init.apply(n,s),o=0;o<c.length;o++){var u=c[o];r="t"===u.type?r.then(u.next):r.catch(u.next)}p&&n.render.apply(n,p),a&&n.destroy.apply(n,a);for(o=0;o<i.length;o++)n.on.apply(n,i[o])};var u=new XMLHttpRequest;u.addEventListener("load",o),u.open("GET","https://"+r+".webloader.smooch.io/",!0),u.responseType="json",u.send()
    }(window,document,"Smooch",smooch_key);

And this is how I init:
    function initSmooch() {
    if (!$rootScope.smooch_inited) {
        try {
            var window_focus = true;
            $(window).focus(function() {
                window_focus = true;
            }).blur(function() {
                window_focus = false;
            });

            Smooch.on('message:received', function() {
                if (!window_focus || !Smooch.isOpened()) {
                    //Play sound
                    var audio = new Audio('assets/audio/ding.wav');
                    audio.play();
                }
                Smooch.open();
            });
            var promise = Smooch.init({
                appId: smooch_key,
            });
            promise.then(function() {
                $('#sk-holder').addClass('no-print');
                $rootScope.smooch_inited = true;
                Smooch.updateUser({
                    givenName: $rootScope.data.user.first_name,
                    surname: $rootScope.data.user.last_name,
                    properties: {
                        email: $rootScope.data.user.email,
                        uid: $rootScope.data.user.id,
                        language: $rootScope.data.user.language,
                        country: $rootScope.data.user.country
                    }
                });
            });
        } catch(e) {
            console.log("error trying to init smooch: " + e);
            $timeout(function() {
                initSmooch();
            }, 1000);
        }
    }
}

Looked but I have nothing where I add the view, so I don't know how to modify, force it to be on top. Any ideeas?

A: This looks like there is a conflict between the Z index of the Web Messenger and the elements beneath it. The Web Messenger already has a very high z-index of 9998, but to fix this issue you'll either need to increase that value more, or decrease the z-index of the elements that appear on top.
For the former, you can insert this CSS rule on your page and tweak the value to something suitable:
#web-messenger-container {
    z-index: 9998;
}

Or write a similar rule targeting the problematic elements and giving them a lower number


text:
Q: How do I get the attributes of a particular polygon in qgis I downloaded a shapefile that has demographic data for census tracts for a city -- each represented by a polygon in the vector layer. I can click the attribute table icon to see the whole sheet of attributes for each polygon -- but is there any way to click a particular polygon and see it's attributes. I tried right clicking and double clicking.

A: After choosing the identify tool, you can click any of the individual features (polygons) in your vector layer, to see the whole sheet of attributes for each polygon:


text:
Q: Closing One Form From Another Form? I have a little application that creates alerts whenever a change to a database is made.
I have a few options in the alert form that pops up.
One of the options opens another form (a child form) asking the user for further information.
When the child form gets the necessary information from the user, I want it to close as well as the parent form. So far, I only know how to close the child form, but not the parent form.
Parent form > Opens child form
Child gathers information > User clicks ok in child > child closes, parent closes

^this is what I want
I just don't have the brain power to think about how to communicate across forms to accomplish closing the parent form.
Any help would be much appreciated.  Actually, it would be super appreciated.  If I could learn how to make my forms communicate with each other, I could really do a lot of damage (in a good way 8D ).

A: In the parent form, you can do something like this:
ChildForm f = new ChildForm();
f.FormClosed += (o,e) => this.Close();
f.Show();

A: Try this in the parent form:
using (var childForm = new ChildForm())
{
    if (childForm.ShowDialog() == DialogResult.OK)
    {
        Close();
    }
}

Your child form should return a DialogResult by clicking buttons (OK or Cancel) and/or setting the AcceptButton and CancelButton properties in the designer.


text:
Q: Java: calendar.setTimeInMillis() returns wrong HOUR_OF_DAY value I am trying to convert my time in minutes to HH:MM. For example 418minutes = 6:58. I am using following code:
 long milli = PriemCas*60000;
 Calendar calendar1 = Calendar.getInstance();
 calendar1.setTimeInMillis(milli);
 int hours3 = calendar1.get(Calendar.HOUR_OF_DAY);
 int minutes3 = calendar1.get(Calendar.MINUTE);

 System.out.println(hours3+":"+minutes3);

I get 7:58 when my variable PriemCas = 418 instead of 6:58. What could be wrong here? Thank you very much.

A: Create your Calendar with correct time zone:
Calendar calendar1 = Calendar.getInstance(TimeZone.getTimeZone("UTC"));


text:
Q: Magento 2: Message queue not getting value from params I have created a message queue. In PHP file I want to get param value but its giving null. But on other model classes its working
$this->getRequest()->getParam('file');

Even I tried using Registry, but same issue with the registry, working on other model classes but not on message queue class.
Is there any other way to get value from param in message queue class.


text:
Q: COPY FROM skips column erroneously I have a file called data.txt with the following content:
1#1#658#debug#v3##h1#

I want to import in the following table:
CREATE TABLE fields (a int8,
                    b int2,
                    c int8,
                    d text,
                    e text,
                    f int,
                    g text
);

I tried to use the COPY command as follows:
COPY fields(a,b,c,d,e,f,g) FROM 'data.txt' WITH (FORMAT CSV, DELIMITER '#', NULL '')
COPY fields(a,b,c,d,e,f,g) FROM 'data.txt' WITH (FORMAT CSV, DELIMITER '#')

In both the DBMS tries to insert 'h1' (which is for column g) into column f, ignoring the NULL value for f and producing errors of type:
column "f" is of type int but expression is of type text

Am I missing any option in the COPY command? Do you have any idea about it?
I am using PostgreSQL version 13.2.
Thanks!

A: I cannot reproduce this here, also on v13.2
richard=> \copy fields from data1.txt with (format csv, delimiter '#')
ERROR:  extra data after last expected column
CONTEXT:  COPY fields, line 1: "1#1#658#debug#v3##h1#"
richard=> \copy fields from data1.txt with (format csv, delimiter '#', null '')
ERROR:  extra data after last expected column
CONTEXT:  COPY fields, line 1: "1#1#658#debug#v3##h1#"

That is what I would expect, since you have more "#" delimiters than columns.
richard=> ALTER TABLE fields ADD COLUMN h text;
ALTER TABLE
richard=> \copy fields from data1.txt with (format csv, delimiter '#', null '')
richard=> SELECT * FROM fields;
 a | b |  c  |   d   | e  | f | g  | h
---+---+-----+-------+----+---+----+---
 1 | 1 | 658 | debug | v3 |   | h1 |
(1 row)

I've spent hours struggling with strange behaviour like this myself and it has always turned out to be one of two things:

*

*The file's contents weren't what I thought they were.

*I wasn't loading the file I thought I was.


text:
Q: Group objects in List by id and order the List by duplicateCount for each object I have multiple List with objects. But some of the items in one list, also exists in other lists.
My question is how can I merge all the items of all the lists into one final list. So there are no duplicates in that list and the items are sorted on the number of duplicates each item had in the different lists.
Example
List1: [users1, user2, user3, user4]
List2: [user2, user4, user5]
List3: [user4,user6]
result: [user4, user2, user1, user3, user5, user6]
(the order of users with the same count doesn't matter)
I tried something like this:
List<User> finalResults = list1.Concat(list2).ToList<User>();

        var q = finalResults.GroupBy(x => x.id)
                    .Select(g => new User { name = g.First().name, count = g.Count() })
                    .OrderByDescending(usr => usr.count);

        finalResults = q.ToList<User>();

but the result is an empty list.
Thanks in advance!

A: This will work like you requested:
var list1 = new[] { "u1", "u2", "u3", "u4" };
var list2 = new[] { "u2", "u4", "u5" };
var list3 = new[] { "u4", "u6" };

var allLists = list1.Concat(list2).Concat(list3);

var result = from u in allLists
             group u by u into g
             orderby g.Count() descending
             select g.Key;

And a version with an object instead of string
var list1 = new[] { new User("u1"), new User("u2"), new User("u3"), new User("u4") };
var list2 = new[] { new User("u2"), new User("u4"), new User("u5") };
var list3 = new[] { new User("u4"), new User("u6") };

var allLists = list1.Concat(list2).Concat(list3);

var result = from u in allLists
                group u by u.Name into g
                orderby g.Count() descending
                select g.Key;

Edit: Updated code samples projecting g.Key instead of only g.
And here is the Method Chain equivalent of the query above:
var result = allLists
    .GroupBy(u => u.Name)
    .OrderByDescending(g => g.Count())
    .Select(g => g.Key);

A: Done with strings, but should also work with objects:
var l = new string[] { "user1", "user2", "user3", "user4",
    "user2", "user4", "user5" ,
    "user4", "user6" };

var result = l.Aggregate(new Dictionary<string, int>(),
    (res, user) =>
    { // create a dictionary of all users and their occurence
        if (!res.ContainsKey(user)) res[user] = 0;
        res[user]++;
        return res;
    }).OrderByDescending(kvp => kvp.Value) // order by incidence
    .Select(kvp => kvp.Key); // select user names only

foreach (var user in result) Console.WriteLine(user);

A: Try This
var result = list1.Union(list2).Union(list3).ToList();


text:
Q: Машинное обучение. Что делают методы fit() и predict() Знакомлюсь с машинным обучением с помощью Python и библиотеки sklearn.
Там есть 2 метода fit() и predict()
Честно после некоторых сайтов понимаю,что они делают очень размыто.
lin_reg.fit(x_train[num_features], y_train)

fit(x,y) обучение (тренировка) модели на обучающей выборке X, y-цитата с форума
А что это значит?
1)модель смотрит на x_train, выдает рандомное число и сранивает его с y_train?
2)модель смотрит на x_train и y_train и пытается найти какие-то взаимосвязи или настроить коэффициенты?
Тут у меня и ступор.
predict(X) предсказание на данных X -тоже цитата.
То есть модель настроена и мы можем подавать ей входные данные?
y_pred=lin_reg.predict(x_train[num_features])

но меня тут смущает,почему для тренировки и предсказания мы испульзуем одни и те же данные?
Разве не будет сбоя или модель не запомнит все ответы и выдаст 100% результат?

A:
fit(x,y) обучение (тренировка) модели на обучающей выборке X, y-цитата
с форума
А что это значит?
2)модель смотрит на x_train и y_train и пытается найти какие-то
взаимосвязи или настроить коэффициенты?

Именно так. Модель пытается найти такие коэффициенты (ну, если примитивно говорить, реальные модели могут быть сильно сложнее, чем простой набор коэффициентов), чтобы минимизировать различие между предсказанием модели по данным x_train и реальным значением y_train.

predict(X) предсказание на данных X -тоже цитата.
То есть модель настроена и мы можем подавать ей входные данные?

Да, так.

y_pred=lin_reg.predict(x_train[num_features]) но меня тут
смущает,почему для тренировки и предсказания мы испульзуем одни и те
же данные? Разве не будет сбоя или модель не запомнит все ответы и
выдаст 100% результат?

Достаточно сложная модель может запомнить все данные и давать на данных для обучения 100% точность, но цель же машинного обучения не в этом, а в том, чтобы модель хорошо предсказывала на тех данных, которых она ещё не видела.
В данном случае просто проверяют, выучилась ли чему-то вообще модель, а то случаи бывают разные. Бывает, учишь модель, а она ничему не научилась вообще. Так что это просто примитивный "sanity check", а не реальная "боевая" ситуация. В реальной жизни, конечно, предсказывают уже на тестовых данных x_test.
А вообще тема машинного обучения довольно сложна, изучать её можно много лет. У вас вопросы совсем начинающего, постарайтесь почитать ещё какие-то статьи и литературу, там на все эти вопросы есть ответы. Лучше начать "от печки" - с теории, а не сразу применять библиотеки, не понимая, что они вообще делают.
P.S.

1)модель смотрит на x_train, выдает рандомное число и сранивает его с
y_train?

В некоторых моделях машинного обучения внутри действительно происходит что-то подобное, но далеко не во всех. Модель может искать нужные коэффициенты довольно разными способами. Важно понимать, что тренировка модели - это обычно сложный итеративный процесс. Модель подбирает каким-то образом коэффициенты (бывает, что и случайным), смотрит расхождение с целью, если оно большое - "думает" куда двигаться, пробует немного другие коэффициенты и т.д., пока не достигнет подходящего результата, либо не выйдет за отведённое ей на обучение число итераций.


text:
Q: How to troubleshoot high latency when running on GCP Cloud Run + Cloud SQL I have a web application written in ASP. NET 6.x. I'm currently just finishing up migrating the project from AWS to Google Cloud, but I'm noticing that latency is overall higher and some more complex operations are taking drastically longer to process on my server compared to running on AWS t2-small instance.
My application api server runs in docker, deployed to Google Cloud Run, 4 vCPU and 2GB of memory (gen2 instances).
It connects to a CloudSQL mysql 8.0 database which is running on db-g1-small 1.7 GB memory, 1 vCPU.
I also have a load balancer in front of the Cloud Run application to support my custom HTTPS domain.
However almost all requests to my server take 500ms TTFB in chrome (time to first byte response) even for trivial 1ms database queries.
For reference, copying the entire production database to my local machine and running the serer locally, the exact same request TTFB is around 50ms.
I understand being hosted non locally would add some latency, to/from the load balancer, but I don't see how it would add ~500ms.
Here is the things I have tried to rule out some causes:

*

*I have tried bypassing the
load balancer and connecting to Cloud run instance directly. Had no
effect.

*I have bumped up Cloud run to max CPU settings and drastically more RAM than my app requires, but it had no effect. I also tried making the CPU "always on".

*I have tried bumping up the instance type on Cloud SQL to have more vCPU and RAM, but it also had no effect.

*I tried running the application locally, but connecting to the Cloud SQL database. Requests processed in around 600ms.

*Calling an endpoint that does not query Cloud SQL also has at least 300ms of latency. For reference, this takes about 19ms when running locally.

*According to speed tests, my Internet ping is 23ms.

*The Cloud Run metrics don't show significant CPU or Memory usage, so it seems like a network problem

Based on the above information, it seems like most of the latency "300ms" is just getting to / processing on Cloud run itself. 200ms more if a query is involved. Given that more complex requests seem to have disproportionately more latency, it seems like the cause is just weak single thread CPU power on Google cloud run.
Is it normal that a trivial HTTP request takes a minimum of 300ms on Cloud Run? How can I troubleshoot this and/or resolve it?


text:
Q: Velocity from acceleration equation I've been working with an accelerometer, and was assigned the job of trying to find the velocity from the accelerometer, I take acceleration data every 10 ms (sampling rate 100KHz) and  I used the equation : Vf = V0 + a*t, where t is 10 ms
V0 is 0 at first, and then it takes the old Vf value
I tried moving the accelerometer in Y+ and then Y- direction, using only the y-axis.
And it works okay, see the figure below :

but I recently saw that this equation is designed to be used in an application with a constant acceleration, how come it works for me? Or am I wrong here?

A: Let's look at where that equation comes from:
$$ a_\mathrm{ave} = \frac{\Delta v}{\Delta t} $$
The average acceleration during a time interval is how much the velocity changed, $\Delta v = v_f - v_i$ divided by the length of the time interval $\Delta t$.  If $a$ is constant than $a_\mathrm{ave}$ is just $a$.
We can solve that equation for $v_f$ and get your equation:
$$ a_\mathrm{ave} = \frac{v_f - v_i}{\Delta t} \implies v_f = v_i + a_\mathrm{ave} \Delta t$$
The key here is that for $a$ to equal $a_\mathrm{ave}$, it doesn't need to be constant over the whole time of the experiment. It only needs to be constant over each $10$ ms interval.  If the time interval is short enough, then $a$ will be approximately constant, and the equation is a good model for what's going on.
In practice your accelerometer likely determines $a$ by averaging over the $10$ ms time interval between outputs. So it's probably telling you the average acceleration in each interval anyway.


text:
Q: Convergence in $H^1(\mathbb{R})$ implies convergence in $L^\infty(\mathbb{R})$ I encountered the following, seemingly simple question: let $H^1(\mathbb{R})=W^{1,2}(\mathbb{R})$ be one of the Sobolev spaces. Suppose we have a sequence $(f_n)_{n\in\mathbb{N}}$ of functions in $H^1(\mathbb{R})$ which converge to some $f\in H^1(\mathbb{R})$ with respect to the standard $H^1(\mathbb{R})$-norm. Does this imply that $(f_n)_{n\in\mathbb{N}}$ also converges to $f$ in $L^\infty(\mathbb{R})$.
I already found the answer for this question for finite intervals and I also found that at least pointwise convergence holds. However, I really need uniform convergence on the unbounded interval. Thanks in advance!

A: Morrey's inequality states that $W^{1,p}(\mathbb{R}^n)$ is embedded into the Hölder space $C^{0,1-n/p}(\mathbb{R}^n)$.
In your case $n=1$ and $p=2$ so this shows that $H^1(\mathbb{R})$ is continuously embedded into $C^{0,1/2}(\mathbb{R})$, which is turn continuously embedded into $L^{\infty}(\mathbb{R})$ since the topology on the Hölder space is stronger than that of uniform convergence. In particular there exists a constant $C>0$ such that
$$\|u\|_{\infty}\leq C\|u\|_{H^1}$$
for every $u\in H^1$, which shows that converging sequences w.r.t. to the $H^1$ norm also converge uniformly.
Note: This also works in higher dimensions and on more complicated domains than the whole of $\mathbb{R}^n$.


text:
Q: SimpleXML not loading GML Data I have the following sample XML data which I'd like to parse into SimpleXML with PHP:
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://ogr.maptools.org/ fire_districts.xsd"
     xmlns:ogr="http://ogr.maptools.org/"
     xmlns:gml="http://www.opengis.net/gml">
  <gml:boundedBy>
    <gml:Box>
      <gml:coord><gml:X>112.921100000165</gml:X><gml:Y>-43.65832660868602</gml:Y></gml:coord>
      <gml:coord><gml:X>153.6407999999201</gml:X><gml:Y>-10.05939999961026</gml:Y></gml:coord>
    </gml:Box>
  </gml:boundedBy>

  <gml:featureMember>
    <ogr:IDM00007 fid="IDM00007.0">
      <ogr:geometryProperty><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>153.551804332204,-28.1645084912738 153.586699999805,-28.2582999997451 153.573299999695,-28.3133 153.582500000375</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
      <ogr:AAC>NSW_FW001</ogr:AAC>
      <ogr:DIST_NO>1</ogr:DIST_NO>
      <ogr:DIST_NAME>Far North Coast</ogr:DIST_NAME>
      <ogr:STATE_CODE>NSW</ogr:STATE_CODE>
      <ogr:SOURCE>RFS</ogr:SOURCE>
      <ogr:GROUP_NAME xsi:nil="true"/>
    </ogr:IDM00007>
  </gml:featureMember>
  <gml:featureMember>
    <ogr:IDM00007 fid="IDM00007.1">
      <ogr:geometryProperty><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>153.261225211474,-29.9401032948311 153.19820000033,-30.038899999935 153.20060000039,-30.1036999997551 153.214099999715</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
      <ogr:AAC>NSW_FW002</ogr:AAC>
      <ogr:DIST_NO>2</ogr:DIST_NO>
      <ogr:DIST_NAME>North Coast</ogr:DIST_NAME>
      <ogr:STATE_CODE>NSW</ogr:STATE_CODE>
      <ogr:SOURCE>RFS</ogr:SOURCE>
      <ogr:GROUP_NAME xsi:nil="true"/>
    </ogr:IDM00007>
  </gml:featureMember>
</ogr:FeatureCollection>

I've tried a few different methods of loading this XML using SimpleXML however whenever I do a print_r of the data it's just blank:
<?php
$data = file_get_contents("fire_districts.gml");
$xml = new SimpleXMLElement($data);
$xml->registerXPathNamespace('f', 'http://ogr.maptools.org/');
$xml->registerXPathNamespace('g', 'http://www.opengis.net/gml');
$gml = $xml->xpath('/f:FeatureCollection/g:featureMember');
print_r($gml);
?>

The output is as follows:
Array
(
    [0] => SimpleXMLElement Object
        (
        )

    [1] => SimpleXMLElement Object
        (
        )

    [2] => SimpleXMLElement Object
        (
        )

    [3] => SimpleXMLElement Object
        (
        )
....

What do I need to change to successfully load this GML data into an array?
Cheers, Mike

A: You can try by printing out the contents of the '$data' variable using 'var_dump' or
'echo' to see if it contains the expected data.
else
Try simplexml_load_string() instead of file_get_contents().


text:
Q: Running a notebook which imports and exports files repeatedly I am trying to automate the process of running a Mathematica notebook that takes as an input a .txt file and exports another .txt file. This notebook was not written by me, and I don't fully understand its inner workings, but I think all I need to know is the following parts of the code:
The input statement is:
my_input_file = Import["my_file_name.txt", "Table"];

The export statement is:
Export["exported_file_name.txt", my_input_file_transformed, "Table"]

I would like to run notebook for many (100) different my_file_name.txt files which I could name however I want to facilitate the import process, e.g. my_file_name_1.txt, my_file_name_2.txt, etc., and put them in the same folder as the my_mathematica_notebook.nb.
Similarly, I would like to save the 100 different exported .txt files, in the same form I input them in order to be able to reconcile each imported-exported pair of files, e.g. something like exported_file_name_1.txt, exported_file_name_2.txt
I guess my question is how to run the notebook many times for similarly named files and how to export the files as described above. I have read answers on related questions that call a notebook from another notebook, but none that automates the import of .txt files.
My knowledge of Mathematica is very basic, especially that related to file management, so I am unable to translate the answers I found into a solution for my problem. If it helps, I am working on a Linux machine and could use the command line to automate the process if needed.
Any help with this would be very appreciated. Many thanks.

A: Not knowing all of the details, I suggest using an additional Notebook to automate the operation of "my_mathematica_notebook.nb"
In the new Notebook
    names = FileNames["*.txt", {".", "*"}, 1]
    num = Dimensions[names][[1]]
    (* finds all txt files *)

    process[index_]:=Module[{}
    CopyFile[names[[index]],"my_file_name.txt"];
    (* copy the file to the placeholder filename *)
    NotebookEvaluate["my_mathematica_notebook.nb", InsertResults -> False];
    (* Run the Notebook *)
    CopyFile["exported_file_name.txt",StringJoin["exported",names[[index]]]];
    (* Copy the default export to the desired filename *)
    ]

    (* "loop over" all txt files located *)
    Table[process[indx],{indx,1,num,1}]

A: Pure functions will be helpful here.  Start by using Table to automatically create the 100 files names you plan on entering.
importnames=Table[StringJoin["my_file_name_", ToString[i], ".txt"], {i, 1, 100}]

Since this will all be text, you can Import them all at once and keep them in a single variable to alter later.
imported=Import[#]&/@importnames

Now you can manipulate your text.  Let's pretend you want it all upper case.
manipulated=ToUpperCase/@imported

Next create all your export names in the same manner as above.
exportnames=Table[StringJoin["exported_file_name_", ToString[i], ".txt"], {i, 1, 100}]

An easy way to automate the export process is create a list of lists where each entry contains the export name and the file contents.  You can do that with Transpose.
exportdata=Transpose[{exportnames,manipulated}]

Then run all the exports at the same time.
Export[#[[1]],#[[2]]]&/@exportdata

If you aren't familiar with slots and mapping, you can read up on Pure Functions.


text:
Q: is inner product only valid for euclid space? is inner product only valid for euclidean space $\mathbb R^n$?
I mean, basic idea of inner product is that product of two elements in vector is real or complex.
So, if it is valid for other vector spaces such as polynomials, it does not seem like it works

A: Inner product is a bilinear funtion defined as here.
One interesting example as you mentioned is when $V=C^{0}([a,b])$, the vector space whose elements are continuous functions $g,f:[a,b] \rightarrow \mathbb{R}$. As an exercise you could show that
$$ \langle f,g \rangle = \int_{a}^{b} \ f(x)g(x)\ dx$$
is an inner product. In this case, the norm of the function $f$ is given by
$$|f| = \sqrt{\int_{a}^{b} \ f(x)^{2}\ dx}$$
This inner product is used in Fourier Series.

A: Actually, the inner product works fine for polynomials! Think of a polynomial $\sum a_i x^i$ as the vector of its coefficients, $(a_0...a_n)$. Then just take the ordinary inner product of two such vectors, adding enough zeroes on the end of the shorter one to make this make sense. You might think about whether this still works for the vector space of power series.


text:
Q: ORA-16000 when trying to perform select on read only Oracle database My application's SQL encounters an ORA-16000 error when trying to access a read only Oracle database.
ORA-16000: database open for read-only access ORA-06512: at "SYS.XMLTYPE",
line 272 ORA-06512: at line 1 ### The error may exist in com/xyz/report/dao/Transaction001Mapper.xml

This is the query that involves the XMLTYPE, the INTERFACE_CONTENT is a CLOB column:
SELECT CONTENTS FROM ERRCODES WHERE
       CODE=(SELECT xmltype(INTERFACE_CONTENT).extract('/Message/PaymentStatus/ps:FIToFIPmtStsRpt/ps:TxInfAndSts/ps:StsRsnInf/ps:Rsn/ps:Prtry/text()','xmlns="urn:abcde" xmlns:head="urn:iso:std:iso:20022:tech:xsd:head.001.001.01" xmlns:ps="urn:iso:std:iso:20022:tech:xsd:pacs.002.001.03"').getstringval() APP_CODE
FROM MESSAGE_EXTERNAL_INTERACTION MEI WHERE MEI.MSG_TYPE='Pacs_002'
    AND MEI.MID='MY_ID')

I also did a lot of EXTRACTVALUE() method on an XML field type.
The SQL is working perfectly if the database is not read only (read write).
What is the issue here? Is this related to some missing privileges/grants?

A: I am not aware of any specific privileges related to XMLType. There will be execute privs related to PL/SQL that works with it but your message is clear and sadly definitive. If you had a privs issue you wouldn't be getting this message...
XMLType can be funny to work with. Have you thought about retrieving it as a CLOB and then doing the XML parsing and extraction at the client end?


text:
Q: scrcpy won't run when the flutter app is opened in the IDE hi guys so i'm using a physical device during development and i also have scrcpy screen share installed. the problem is every-time i open a flutter project in the IDE the scrcpy stops and i don't quite understand what's causing this problem.
i'm using Ubuntu 20.04

A: Your IDE opens another version of adb. Check the output of scrcpy (run scrcpy-console.bat on Windows).
See https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#conflicts-between-adb-versions


text:
Q: How mongoDB aggregation query can be convert in to Java DBObject? I have problem find "and","or" logical operation (agrregation framework) in java
This code works fine with single variable
DBObject match=new BasicDBObject("$match",new BasicDBObject("item","a"));
but i want match more than one variable
Please somebody expalin how i can write "and" /"or" in this query .

A: When you query for multiple values of the same field, it's simpler to use $in instead of $or.  Here's your example translated into Java using $in:
new BasicDBObject("ITEMTYPE", new BasicDBObject("$in", Arrays.asList("like", "post")))

Or using the QueryBuilder:
QueryBuilder.start("ITEMTYPE").in(Arrays.asList("like", "post")).get()


text:
Q: Ising model for dummies I am looking for some literature on the Ising model, but I'm having a hard time doing so. All the documentation I seem to find is way over my knowledge.
Can you direct me to some documentation on it that can be parsed by my puny undergrad brain? If the answer is negative, can you explain it right there, on the answer form?

A: Probably the best book in the field of spin models is the classic book by Baxter "Exactly Solved Models in Statistical Mechanics", it is very well written and contains both the basics and some more advanced topics.

A: The Ising model is a model, originally developed to describe ferromagnetism, but subsequently extended to more problems.
Basically, it is an interaction model for spins. Imagine you have a system which is a collection of $N$ spins. Each spin $S_i$ has two possible states $+1$ or $-1$. Here you can imagine already a possible extension to more states. You can also imagine a different interpretation to the spins: $-1$ is a box containing no gas particle, $+1$ is a box containing a gas particle.
But I'm getting ahead of myself. Let's stick to spins for now.
The next step is to define the energy of the system.
$$E= - \sum_i h_i S_i - \sum_{i \neq j} J_{ij} S_i S_j$$
The first term can be interpreted as the contribution to the energy of the interaction of a spin with a local magnetic field. If the magnetic field is the same for all spins, then $h_i=h$ for all $i$. You see that aligning with the field will means a lower energy than going against the field.
The second term represents interactions between spins within the system. If $J_{ij}>0$ spins which align will contribute negatively to the energy of the system, thus lowering the total energy. If $J_{ij}<0$ then anti-alignment will contribute.
What I still haven't specified is how the spins are structured. By choosing the coefficients $J_{ij}$ appropriately, I can introduce this structure. Suppose I want a 1-dimensional system, which is the one Ising originally solved. Then, you have a countable infinity of spins arranged along the real line with equal spacing. Ising imposed an interaction only allong neighboring spins. So spin $S_n$ can interact with spin $S_{n-1}$ and spin $S_{n+1}$. The energy formula I gave above becomes:
$$E= - J \sum_{n} S_n S_{n+1} \; ,$$
if all spins can interact equally strongly.
Now, to each configuration of the system corresponds a certain energy. In statistical mechanics, we know that the probability of a certain configuration is
$$P(\{S\}) \sim e^{-E(\{S\})/kT}$$
where $T$ is the temperature. Or, if we compute the partition sum
$$Z=\sum_{\{S\}} e^{-E(\{S\})/kT}$$
we can deduce the complete equilibrium thermodynamic properties of the system. In particular, we can see if there are phase transitions for certain values of the parameters. (There is none in the 1D case, which at the time, combined with the lack of attention his model was getting, made Ising abandon physics.)
Of course, there are many more generalizations of this model. You can also make dynamical versions of the model where you are not just interested in the equilibrium configurations.
Here's the wikipedia page for Ising models.
Some references:

*

*H.E. Stanley 'Introduction to Phase Transitions and Critical Phenomena' Clarendon Press Oxford

*J.M. Yeomans 'Statistical Mechanics of Phase Transitions' Clarendon
Press Oxford

*R.J. Baxter 'Exactly Solved Models in Statistical Mechanics' Academic New York


text:
Q: Force LaTeX image to appear in the section in which it's declared
Possible Duplicates:
How do I ensure that figures appear in the section they're associated with?
Keeping tables/figures close to where they are mentioned

How can I force an image in a LaTeX documents to appear in the section in which I declared it?
I don't want that an image about "Section A" to appear in "Section F". :(
I actually include an image with
\begin{figure}[ht]
\begin{center}
\includegraphics[scale=0.7]{./img/RobotManipulator3D_WorkSpace.png}
\end{center}
\caption{3D View of the robotic workspace (in red).}
\label{Img:3DRobotWorkspace}
\end{figure}

A: You don't mention how tall the float is. This leaves open several reasons, related to LaTeX's float placement parameters, for why the figure is showing up "too late" relative to where you'd like to occur.
Assuming that the figure's total height is no more than 0.5\textheight, you may have a good experience with the following setup, which uses the afterpage package and its command \afterpage:
[code up to the figure of interest]
\afterpage{\clearpage
\begin{figure}[t] % note the use of the "t" placement specifier
\centering % don't use \begin{center} ... \end{center}: it wastes too much space
\includegraphics[scale=0.7]{./img/RobotManipulator3D_WorkSpace.png}
\caption{3D View of the robotic workspace (in red).}
\label{Img:3DRobotWorkspace}
\end{figure}}
[remaining code of your document]

The reason I mention the 0.5\textheight consideration is that one of LaTeX's key parameters for placing floats on a page is \floatpagefraction, a fractional number between 0 and 1; by default, it is equal to 0.5 (unless set to a different value by some class or package command). Thus, if your figure is taller than 0.5*\textheight, LaTeX will refuse to place it on a page along with other, i.e., text, material, causing the float to drift all the way back until some forced page break (caused possibly by a \clearpage command) occurs. In such a case, you should probably issue the commands
\renewcommand\floatpagefraction{0.8} %% default value: 0.5
\renewcommand\topfraction{0.8}       %% default value: 0.7

and recompile the document. Of course, if your float's height is, say 85% or 95% of \textheight, you should really be willing to place it on a page of its own (most easily accomplished by choosing the [p] placement specifier).
A comment on the use of the [H] placement specifier that's provided by the float package: While it's true that it sometimes helps with placing an otherwise difficult-to-place-correctly float, using it is really tantamount to treating a symptom rather than finding a cure for the underlying cause of the problems related to placing the float satisfactorily. Before you resort to using it, you should really consider modifying LaTeX's float-placement parameters. That said, I too have experienced cases, with my own papers, where I've resorted to using the [H] specifier after I struck out having tried all other remedies...

A: As Werner commented: the section Moving tables and figures in LaTeX in the TeX FAQ states:

Even if you use the placement specifier [h] (for 'here'), the figure or table will not be printed 'here' if doing so would break the rules; the rules themselves are pretty simple, and are given on page 198, section C.9 of the LaTeX manual.

Use the float package with the [H] specifier. If you comment out the \usepackage{float}, the following MWE results in the figure on the second page, but as is the figure appears between the two paragraphs.
\documentclass{article}
\usepackage{float}% If comment this, figure moves to Page 2
\usepackage{lipsum}
\usepackage[demo]{graphicx}

\begin{document}
\lipsum[1]
\begin{figure}[H]
  \centering
  \includegraphics{foo}
  \caption{caption text}
  \label{fig:nonfloat}
\end{figure}
\lipsum[2]
\end{document}

You should also be using \centering instead of \begin{center}...\end{center} as per should i use center or centering for figures for more details.

A: If you don't want your figure to float, don't use a floating environment; you can use, for example, a center environment and (if a caption is needed) the \captionof command provided by the capt-of (or caption) package:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{capt-of}
\usepackage{lipsum}% just to generate text for the example

\begin{document}
\lipsum[1]
\begin{center}
  \includegraphics{foo}
  \captionof{figure}{A non floating figure}
  \label{fig:test}
\end{center}

\lipsum[2]
\end{document}

If you want the figure to float, but not passing a \section command. you can use  the placeins package and its \FloatBarrier command beyond which floats may not pass. A package option allows you to declare that floats may not pass a \section command, but you can place \FloatBarriers wherever you choose.

A: Try \begin{figure}[!htb]. In nearly all cases it helps.
Explanation of the figure placement parameters:

*

*h - Place figure here, if possible

*t - Place figure at the top of a page

*b - Place figure at the bottom of a page and

*! - Over-ride default LaTeX figure placement (do not use the parameter values).

If that doesn't work then use:
\usepackage[section]{placeins}

This prevents placing floats before a section.


text:
Q: ephemeral disk noted listed on created ami Amazon EC2 Why ephemeral disk isn't listed on (fdisk -l) when i create a instance on amazon ec2 from my previously created (AMI)?

A: You have two options to enable ephemeral storage on an instance.

*

*Enable it at launch. Can be done in the console or command line tools.

*Enable it with you register a snapshot as an AMI. By default it will not map ephemeral storage, this is something you have to explicitly enable.

A: In my case, I confused the ephemeral disk instance ID with the disk quantity, and added ephemeral disk instance 1, rather than ephemeral disk instance 0. m1.medium instances only support 1 ephemeral disk, and it MUST be ephemeral disk instance 0.


text:
Q: Create a Final Group of items if at least one Intermediate Group in common exists between two items After to have group the item based on first criteria we obtain this result.
My_table (reference in the SQL script below)

item
group

1,6
1

2
2

3,5
3

4,5
4

6
5

7,10,11
6

8,10,11,13
7

9
8

12,15,18
9

14
10

14,15,18,20
11

21
2

This group is an intermediate group.
So, to find the final group, we explode the intermediate group to see what are all the groups to which an element belongs.
And the output intermediate is

item
group

1
1

2
2

3
3

4
4

5
3

5
4

...
...

10
6

10
7

11
6

11
7

12
9

13
7

...
...

18
11

20
11

21
2

we have as many lines for an item as it has groups
Below, we must aggregate the item 1 and 6 because they have at least one group in common, the group 1. Then we aggregate item 3, 4, 5 because there have at least one group in common. Same for item 7,8,10,11 and 13. The same again for 14,15,16 and 20. Only item 9 has not common group with each other.
So the second output intermediate expected is to put for each item all its groups like this.

item
group

1
1

2
2

3
3

4
4

5
3,4

6
1

6
5

7
6

8
7

9
8

10
6,7

11
6,7

12
9

13
7

14
10,11

15
9,11

18
9,11

20
11

21
2

this will allow us to create a new group in which we will have the items that have similar intermediate groups. This is the expected result

item
inter_group
final_group

1
1
1

2
2
2

3
3
3

4
3,4
3

5
3,4
3

6
1,5
1

7
6,7
7

8
6,7
7

9
8
9

10
6,7
7

11
6,7
7

12
9,10,11
8

13
6,7
7

14
9,10,11
8

15
9,10,11
8

18
9,10,11
8

20
9,10,11
8

21
2
2

Actually, the final group is correct when each item has unique group and that there is no more possible crossing with other groups.
So i've try a recursive function in SQL but it stop at the first step (inter group) :
WITH RECURSIVE
T1 AS (
  SELECT
  item,
  intermediate_group,
  FROM my_table, unnest(split(group)) AS item)

,
  T2 as (
  SELECT item,
  STRING_AGG(CAST(intermediate_group as STRING)) AS intermediate_group
  from T1
  GROUP BY item)

SELECT DISTINCT item, intermediate_group as final_group
FROM T2

Thanks for your help

A: Consider below
select *, dense_rank() over(order by inter_group) as final_group
from (
  select item,
    string_agg('' || `group`) as inter_group
  from your_table, unnest(split(item)) item
  group by item
)
# order by final_group

if applied to sample data in your question - output is


text:
Q: Argparse: mutually exclusive groups with defaults Maybe there was an answer to one of the similar questions, but I couldn't find it.
What I need.
I have a table to read from: table with most recent data (fast), table with data for one day (day).
I want to read from day-table by default and from fast-table if I provide an argument -f in the command line.
Then I have defaults for each argument.
So if I don't provide any arguments ("-s" or "-f"), I want to use "day" with the default value.
If I use something like "-s 20161001" or "-f 1452557323", I want to use that value.
If use "-f", I want to use "-f" default value.
All I have right now is:
table_choice = parser.add_mutually_exclusive_group(required=True)

table_choice.add_argument(
    '-s', '--day-table',
    dest='day',
    help='day table data',
    default="path/" + day(),
)

table_choice.add_argument(
    '-f', '--fast-table',
    dest='fast',
    help='fast table data',
    default=fast(),
)

But sadly it doesn't work like I want.
"script -f" returns:
Script: error: argument -f/--fast-table: expected one argument

Only works if I have provided a value.

A: If nargs='?', then you get a 3 way action - the default, a constant, or the value.
table_choice.add_argument(
    '-f', '--fast-table',
    dest='fast',
    help='fast table data',
    default=fast(),
    nargs='?',
    const='value_if_noarg'
)

This nargs plays nicely with mutually exclusive groups (including the 'required' one).
By making the group required, you will have to use either -s or -f.  Omit the required=True is you want the option of using neither.
The namespace will have values for both day and fast regardless of what is in the commandline.  If you want the day value to have priority of the fast one, choose the defaults so you can distinguish between the default and a given value.  The default default None is handy for that.
You could use default=argparse.SUPPRESS to keep a default out of the namespace, but that's harder to test than args.fast is None.
As discussed in Python argparse --toggle --no-toggle flag your arguments could even share the dest.  Whether that makes the following logic easier or not is questionable.


text:
Q: How can write text in OPENGL window at c# I want to know , how can i write texts in opengl window using C#? I use opentk tools for drawing, I would pleased for anyone to tell me what code I must use in C#.

A: when you want to render a text using opentk you should consider many thing. you can go to OpenTK Docs to find out. but I recommend you to use QuickFont instead, without going into the complicated details.
good luck


text:
Q: HTTPS for a Github pages custom domain with AWS I have decided to switch to HTTPS for my Github pages custom domain, to do so I have followed this tutorial step by step. Namely:

*

*Requested for an SSL in AWS Certificate Manager

*Created a CloudFront distribution

*Changed my DNS A Record to an alias to that distribution

But for some reason, when accessing christopherkade.com the URL follows the default root object I have set in the distribution (christopherkade.com/index.html) and Firefox gives me the following error The page isn't redirecting properly and Chrome christopherkade.com redirected you too many times..
Here are my DNS records:

My page is hosted on this repository.
Did I forget something?

A: I have found a solution, but it required a change in the service used to deliver HTTPS. I sum it up here, but in short:
I now use Cloudflare as my DNS and changed my nameservers on AWS Route 53 to the ones given by Cloudflare after setting up my website.
As you can see christopherkade.com is now served in HTTPS.


text:
Q: Is this a generalised path induction in COQ? I am learning Homotopic Type Theory (HoTT) and its relation to COQ.
Especially the path induction concept of the identity type is still mysterious to me.
Therefore I made some experiments with COQ.
Let's start with a simple Lemma for the standard equality type using path induction:
Lemma eq_sym: forall (x y:nat), x = y -> y = x.
intros.
apply (match H in (_ = y0) return y0 = x with eq_refl => eq_refl end).
Defined.

Now let's see if that is a special handling of the COQ "eq" type.   Therefore let's define a new equality type (only for nat)  with an analogous symmetry lemma:
Inductive est  (x : nat) : nat -> Prop :=
    est_refl:  est x x.

Lemma est_sym: forall (x y:nat), est x y -> est y x.
intros.
apply (match H in (est _ y0) return est y0 x with est_refl => est_refl x end).
Defined.

Ok, this works in the same way like the standard "=" type.
Now let's generalise it:
Inductive tri  (x : nat) : nat->nat->Prop :=
    tri_refl:  tri x x x.

Lemma tri_sym: forall (x y z:nat), tri x y z -> tri z x y.
intros.
apply (match H in (tri _ y0 z0) return tri z0 x y0  with tri_refl => tri_refl x end).
Defined.

My question is:
How does this relate to the theory of HoTT?
Is this a generalised path induction which is not part of HoTT?

A: Your "three-ended equality" is equivalent to a pair of equality proofs, in the sense that we can write Coq functions that convert back and forth between the two forms. (These are the eq_of_teq and teq_of_eq terms in the excerpt below.)
Section Teq.

Variable T : Type.

Inductive teq (x : T) : T -> T -> Prop :=
| teq_refl : teq x x x.

Definition teq_of_eq {x y z} (e1 : x = y) (e2 : x = z) : teq x y z :=
  match e1 in _ = y' return x = z -> teq x y' z with
  | eq_refl => fun e2 =>
    match e2 in _ = z' return teq x x z' with
    | eq_refl => teq_refl x
    end
  end e2.

Definition eq_of_teq1 {x y z} (te : teq x y z) : x = y :=
  match te in teq _ y' z' return x = y' with
  | teq_refl => eq_refl
  end.

Definition eq_of_teq2 {x y z} (te : teq x y z) : x = z :=
  match te in teq _ y' z' return x = z' with
  | teq_refl => eq_refl
  end.

Definition teq_eq_teq x y z (te : teq x y z) :
  teq_of_eq (eq_of_teq1 te) (eq_of_teq2 te) = te :=
  match te as te' in teq _ y' z' return teq_of_eq (eq_of_teq1 te') (eq_of_teq2 te') = te' with
  | teq_refl => eq_refl
  end.

Definition eq_teq_eq1 x y z (e1 : x = y) (e2 : x = z) :
  eq_of_teq1 (teq_of_eq e1 e2) = e1 :=
  match e1 as e1' in _ = y' return eq_of_teq1 (teq_of_eq e1' e2) = e1' with
  | eq_refl =>
    match e2 as e2' in _ = z' return eq_of_teq1 (teq_of_eq eq_refl e2') = eq_refl with
    | eq_refl => eq_refl
    end
  end.

Definition eq_teq_eq2 x y z (e1 : x = y) (e2 : x = z) :
  eq_of_teq2 (teq_of_eq e1 e2) = e2 :=
  match e1 as e1' in _ = y' return eq_of_teq2 (teq_of_eq e1' e2) = e2 with
  | eq_refl =>
    match e2 as e2' in _ = z' return eq_of_teq2 (teq_of_eq eq_refl e2') = e2' with
    | eq_refl => eq_refl
    end
  end.

End Teq.

The teq_eq_teq, eq_teq_eq1 and eq_teq_eq2 lemmas show that the converting back and forth does not change the terms we start with; hence, both representations are equivalent. In this sense, Coq does not have more expressive power than HoTT just because we can define a teq.
In basic Martin-Löf type theory (the formal system upon which HoTT is based), you don't gain much by carrying a pair of equalities between the same terms, since the only thing you can do with such equalities is to perform casts on the types of the terms you manipulate. Thus, it doesn't really matter usually whether you have only one or two equality proofs between terms.
The situation changes a little bit in HoTT because of the addition of the univalence axiom, which allows us to use equality proofs between types in a computationally interesting way. This is because a proof of A = B in HoTT can be any bijection between the types A = B. In that setting, a proof of teq A B C would be equivalent to two bijections: one between A and B, and the other one between A and C.


text:
Q: Retrieving records from an ABPerson object I'm trying to get the Country from a ABPerson object in Cocoa.
What I do is:
NSString *country = [person valueForProperty:kABAddressCountryKey];

I get this in the console:

-[ABPerson valueForProperty:Country] - unknown property. This warning will be displayed only once per unknown property, per session.

Getting the persons' organizationName(kABOrganizationProperty), firstName (kABFirstNameProperty) and lastName (kABLastNameProperty) works.
Any ideas?

A: As the key kABAddressCountryKey implies it represents a value of an address. As person can have multiple addresses (represented as dictionaries) you have to loop the addresses to get the country:
ABMultiValueRef addressesRef = ABRecordCopyValue(personRef, kABPersonAddressProperty);

for (int i = 0; i < ABMultiValueGetCount(addressesRef); i++)
{
    CFDictionaryRef oneAddressRef = ABMultiValueCopyValueAtIndex(addressesRef, i);
    NSString *country = CFRetain(CFDictionaryGetValue(oneAddressRef, kABPersonAddressCountryCodeKey));
    // Do fancy things with country...
    CFRelease(country);
    CFRelease(oneAddressRef);
}

CFRelease(addressesRef);

Haven't finally tested it, but it should work that way. Also consider the Core Foundation Memory Management.


text:
Q: How do I clear up this ByRef argument type mismatch error when inserting formula into cell? I am trying to punch a formula into a cell, referencing a function ConvertToLetter to do so (seen in my code). However, running ConvertToLetter doesn't seem to work, returning the titular error when I try to run it with a highlight on "firstVideoRow". My thought is that this program is not returning a string, but that's just a guess.
I've already tried to initialize the ConvertToLetter variables elsewhere, but that doesn't work either.
Function ConvertToLetter(iCol As Long) As String
   Dim iAlpha As Long
   Dim iRemainder As Long
   iAlpha = Int(iCol / 27)
   iRemainder = iCol - (iAlpha * 26)
   If iAlpha > 0 Then
      ConvertToLetter = Chr(iAlpha + 64)
   End If
   If iRemainder > 0 Then
      ConvertToLetter = ConvertToLetter & Chr(iRemainder + 64)
   End If
End Function

...
Range(Cells(lastRow + 3, 4)).Formula = "=AVG(" & ConvertToLetter(firstVideoRow) & CStr(4) & ":" & ConvertToLetter(lastRow) & CStr(4) & ")"

A: ConvertToLetter wants a Long by reference. Apparently you did not declare firstVideoRow and/or lastRow as Long, so you get the error.
You could ask for a Long by value so that it is implicitly converted for you:
Function ConvertToLetter(ByVal iCol As Long) As String

But actually what you want to do is switch to the R1C1 notation:
Cells(lastRow + 3, 4).FormulaR1C1 = "=AVG(R4C" & firstVideoRow & ":R4C" & lastRow &")"


text:
Q: Declaring global variable inside a function What I want to do is following. Inside a function, I need to assign a value to a variable, whose name is taken from another variable. In other words:
func() {
  #
  # Here happens something that ultimately makes $arg="var_name"
  #
  declare -g ${arg}=5
}

func

echo ${var_name}; # Prints out "5"

The code snippet above works great in bash 4.2. However, in bash before 4.2, declare doesn't have the -g option. Everything I found at google says that to define the global variable inside a function, I should just use the var=value syntax, but unfortunately var itself depends on another variable. ${arg}=5 doesn't work, either. (It says -bash: var_name=5: command not found.
For the curious, the reason for all this is that this function actually creates global variables from the script parameters, i.e. running script --arg1=val automatically creates variable named arg1 with value val. Saves tons of a boilerplate code.

A: Since this is tagged shell, it is important to note that declare is a valid keyword only in a limited set of shells, so whether it supports -g is moot.  To do this sort of thing in a generic Bourne shell, you can just use eval:
eval ${arg}=5

A: I think you need the printf builtin with its -v switch:
func() {
    printf -v "$var" '5'
}
var=var_name
func
echo "$var_name"

will output 5.

A: Using "eval" (or any direct assignment) can give you headaches with special characters (or issues with value injection etc).
I've had great success just using "read"
$ function assign_global() {
>   local arg="$1"
>   IFS="" read -d "" $arg <<<"$2"
>}
$ assign_global MYVAR 23
echo $MYVAR
23
$ assign_global MYVAR "\"'"
"'

A: You could construct your var=value as a string and evaluate it using the bash builtin command eval.

A: If you want something a little less hackish, try using export in place of declare -g. It has the added benefit of being an environment variable now.
func() {
#
# Here happens something that ultimately makes $arg="var_name"
#
export ${arg}=5
}

func

echo ${var_name}; # Prints out "5"

Unfortunately, this still does not work for arrays.

A: In Bash for declaring array variables inside a function definition you can use the local command in combination with the eval command like in the following example:
#!/bin/bash
function test
{
    local -g $1
    local array=( AA BB 'C C' DD)
    eval ${1}='("${array[@]}")'
}
test VAR
echo VAR=${VAR[@]:1:2}

the output will be:
$./test.sh
VAR=BB C C

works with: GNU bash, Version 4.4.18

A: The existence of the local and declare builtin commands may render it counter-intuitive that the wanted functionality is actually available from the export builtin, at least on Bash.
According to the Bash manual, the export command has an -n option, which "causes the export property to be removed from each name". This also applies while declaring variables with values right ahead.
The following snippet demonstrates the usage:
VAR=old-value
function func () {
    export -n "$1=$2"
}
func VAR new-value
echo "VAR=$VAR"     # prints VAR=new-value

One may create one own's global function, and use it inside other functions:
VAR=old-value
function global () {
    export -n "$1=$2"
}
function main () {
    global VAR "$1"
}
main main-value
echo "VAR=$VAR"            # prints VAR=main-value

This is verified working on

*

*an old Bash 2.03.0(1) running on a (modern) OS/390 z/OS

*on a Bash 3.2.57(1) on macOS 10.15

*on a Bash 4.1.2(2) on CentOS 6

I used this to inspect the various possibilities:
#!env bash

export LANG=C LC_ALL=C

A=a0
B=b0
C=c0
D=d0
E=e0
export F=f0

function testfunc () {
    local "$1=$2"       ; shift 2
    declare "$1=$2"     ; shift 2
    declare -g "$1=$2"  ; shift 2
    export -n "$1=$2"   ; shift 2
    export "$1=$2"
}

echo "$A/$B/$C/$D/$E"
testfunc A a1 B b1 C c1 D d1 E e1
echo "$A/$B/$C/$D/$E"

export -p | grep -E '^declare -x [ABCDEF]='

In case of macOS 10.15 this shows an output similar to this:
$ bash test.sh
a0/b0/c0/d0/e0
test.sh: line 15: declare: -g: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
a0/b0/c0/d1/e1
declare -x E="e1"
declare -x F="f0"

The output shows that the local and declare commands used in the testfunc function effectively do not apply the variables in the global context (as documented) and that the declare -g option is not widely supported yet. It also shows that the variables D and E have been changed in the global context from inside the testfunc function (as hoped for), while only the E variable has been marked for export as a side effect by the export command, showing that the export -n option is effective. The variable F is there just to verify the grep command worked as expected.

A: declare inside a function doesn't work as expected.
I needed read-only global variables declared in a function.
I tried this inside a function but it didn't work:
declare -r MY_VAR=1

But this didn't work. Using the readonly command did:
func() {
    readonly MY_VAR=1
}
func
echo $MY_VAR
MY_VAR=2

This will print 1 and give the error "MY_VAR: readonly variable" for the second assignment.

A: Eval will work with Array variables...I just had to single quote the local Array variable inside the eval statement.
The below reads in a file (1st arg) a line at a time and then copies it to the variable name passed to the 2nd arg of the get_file.

get_file () {
  declare -a Array=();
  while read line; do
    Array=("${Array[@]}" "($line)")
  done < ${1}
  eval ${2}='("${Array[@]}")'
  unset Array
}

declare -a my_array=();
get_file /etc/myfile.conf my_array
echo ${#my_array[@]}

A: Maybe your could use the following functions to dynamically assign your global variable in bash(< 4.2). If > 2 args passed, then the value will be array type.
E.G
_set2globals variable_name arg1 [arg2] [arg3] [...]

Source:
# dynamically set $variable_name($1)=$values($2...) to globals scope
function _set2globals()
{
    if (( $# < 2 )); then
        printf "$FUNCNAME: expect at least 2 argument, but %d you given.\n" $# >&2
        exit 1
    fi
    local ___pattern_='^[_a-zA-Z][_0-9a-zA-Z]*$'
    if [[ ! $1 =~ $___pattern_ ]]; then
        printf "$FUNCNAME: invalid variable name: %s.\n" "$1" >&2
        exit 1
    fi
    local __variable__name__=$1
    shift
    local ___v_
    local ___values_=()
    while (($# > 0)); do
        ___v_=\'${1//"'"/"'\''"}\'
        ___values_=("${___values_[@]}" "$___v_") # push to array
        shift
    done

    eval $__variable__name__=\("${___values_[@]}"\)
}

A: -g -r does the job. My bash version is: 5.1.16. Here is an example:
function setup() {
    declare -g -r VERSION="${1:-2.0}"
}

function main() {
    setup "$@"
    VERSION="2.3" # error
}

main "$@"


text:
Q: How to uninstall GNUStep? In a fit of command line joy, I went about installing some programs. I tried to install the 'say' command (like Darwin has), and installed whatever program Ubuntu recommended -- unfortunately, without writing it down.
It ended up not being the right one, and I'm pretty sure I downloaded GNUStep -- there's not a folder in my home directory, and if I delete it and run 'say' again, it recreates and  creates an 'installed-software.txt' file.
How do I uninstall GNUstep, and stop this from happening?

A: After run say Ubuntu recommends installation of gnustep-gui-runtime. Uninstall it by running:
sudo apt-get remove gnustep-gui-runtime

You can also run sudo apt-get autoremove to remove the automatically installed dependencies of gnustep-gui-runtime.

A: If you just installed it via apt-get install <packagename> (or, as it would be, sudo apt-get install <packagename>), you can uninstall it via apt-get remove <packagename> (or, if you need root permissions (which you probably do) sudo apt-get remove <packagename>.
In your case this would (probably) be sudo apt-get remove gnustep.


text:
Q: Commands out of sync I have nginx as server ( php & mysql). In nginx.conf i place limit_req_zone ( 5r/s ) and from time to time i recive "Commands out of sync error". Some body can tell me why this happenig?

A: This is not related to nginx at all. You have a problem in your php scripts.
See:
http://dev.mysql.com/doc/refman/5.0/en/commands-out-of-sync.html


text:
Q: Advantages of SQL Server Enterprise vs. Standard (2008) I'm looking into running a single instance web application on SQL Server 2008.  What are the specific advantages that the Enterprise version has over the Standard version in terms of speed.  I'm not looking at the management and reporting side of things, which I understand Enterprise is much better at, but just at raw speed point of view.  Based on the information found here, I've only been able to find a few differences.

*

*Parallel index operations - Only matters when you're creating or altering indexes.  Does nothing to effect day to day speed.

*Table and Index Partitioning - Does this really make a difference if everything is on the same disk/raid array?

*Limited to 4 CPUs - I understand this is number of physical processor sockets, not cores, and I don't plan on needing a server ever that has more than 4 sockets.  If I do, the extra cost of SQL Server Enterprise is going to be negligible.  Or I could just use replication with multiple machines, which Standard edition also supports.
Basically, what it comes down to, is Enterprise really worth the extra cash ($8487 + CAL vs. $885 + CAL), for a single instance web application?

A: I don't believe the CAL license permits you to sit SQL Server behind a web server application. You must purchase a per-processor license to do that. Even if not, if you have more than 25 users/devices, the per-processor model is less costly (you need a CAL for each user or each device connected).
Per-processor pricing for Enterprise is $24,999 and for Standard it's $5,999. You might also look into Web edition, which is $15/mo. per processor.
In answer to your question, there is some stuff like indexed views, but if you have less than 10,000 users total, your schema and query design will have way more of an impact on performance than any features not included in standard or web edition.

A: In short - given you're worrying about performances I don't think the extra-cash is worth it unless you need extensive use of full mirroring and the other extras you mention.
Following links might be helpful:
SQLServer2008 Standard VS Workgroup
Differences between SQLServer2008 editions - similar to the one you have there

A: Unless you're going to have huge databases, no, it's not worth it, spend the extra money on tuning the database design.

A: You really need to use the Processor licensing. There are more complicated issues regarding the licensing than you might think.


text:
Q: Unable to start . System.err: Calling js method onCreate failed I use this command: tns run android --device Pixel_2_API_29 to run my NativeScript project on android emulator, but I get this result:
Skipping node_modules folder! Use the syncAllFiles option to sync files from this folder.
Searching for devices...
Starting Android emulator with image Pixel_2_API_29
Waiting for emulator device initialization...
Your application will be deployed only on the device specified by the provided index or identifier.
Running webpack for Android...
clean-webpack-plugin: C:\Users\m\Desktop\JS\NativeScript\new\conFusion\platforms\android\app\src\main\assets\app\**\* has been removed.
File change detected. Starting incremental webpack compilation...

webpack is watching the files…

Hash: 74cf71392c2a31059459
Version: webpack 4.27.1
Time: 8985ms
Built at: 06/13/2019 10:46:07 AM
                                                              Asset       Size   Chunks             Chunk Names
                                   App_Resources/Android/app.gradle  556 bytes           [emitted]
                 App_Resources/Android/src/main/AndroidManifest.xml   1.33 KiB           [emitted]
    App_Resources/Android/src/main/res/drawable-hdpi/background.png   3.42 KiB           [emitted]
          App_Resources/Android/src/main/res/drawable-hdpi/icon.png    6.8 KiB           [emitted]
          App_Resources/Android/src/main/res/drawable-hdpi/logo.png   32.4 KiB           [emitted]
    App_Resources/Android/src/main/res/drawable-ldpi/background.png   1.31 KiB           [emitted]
          App_Resources/Android/src/main/res/drawable-ldpi/icon.png   3.23 KiB           [emitted]
          App_Resources/Android/src/main/res/drawable-ldpi/logo.png   9.95 KiB           [emitted]
    App_Resources/Android/src/main/res/drawable-mdpi/background.png   1.89 KiB           [emitted]
          App_Resources/Android/src/main/res/drawable-mdpi/icon.png   3.42 KiB           [emitted]
          App_Resources/Android/src/main/res/drawable-mdpi/logo.png   15.8 KiB           [emitted]
App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml  304 bytes           [emitted]
   App_Resources/Android/src/main/res/drawable-xhdpi/background.png   5.26 KiB           [emitted]
         App_Resources/Android/src/main/res/drawable-xhdpi/icon.png   10.4 KiB           [emitted]
         App_Resources/Android/src/main/res/drawable-xhdpi/logo.png     54 KiB           [emitted]
  App_Resources/Android/src/main/res/drawable-xxhdpi/background.png   10.3 KiB           [emitted]
        App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png   20.3 KiB           [emitted]
        App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png    116 KiB           [emitted]
 App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png   3.87 KiB           [emitted]
       App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png   73.8 KiB           [emitted]
       App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png    193 KiB           [emitted]
           App_Resources/Android/src/main/res/values-v21/colors.xml  104 bytes           [emitted]
           App_Resources/Android/src/main/res/values-v21/styles.xml  902 bytes           [emitted]
               App_Resources/Android/src/main/res/values/colors.xml  237 bytes           [emitted]
               App_Resources/Android/src/main/res/values/styles.xml   1.68 KiB           [emitted]
                                                          bundle.js     17 KiB   bundle  [emitted]  bundle
                                                       package.json   82 bytes           [emitted]
                                                         runtime.js   29.8 KiB  runtime  [emitted]  runtime
                                                         starter.js   60 bytes           [emitted]
                                                tns-java-classes.js    0 bytes           [emitted]
                                                          vendor.js   5.02 MiB   vendor  [emitted]  vendor
Entrypoint bundle = runtime.js vendor.js bundle.js
[../$$_lazy_route_resource lazy recursive] ../$$_lazy_route_resource lazy namespace object 160 bytes {bundle} [built]
[./app.css] 1.01 KiB {bundle} [built]
[./app/app.component.html] 167 bytes {bundle} [built]
[./app/app.component.ts] 354 bytes {bundle} [built]
[./app/app.module.ts] 1.71 KiB {bundle} [built]
[./app/menu/menu.component.css] 19 bytes {bundle} [built]
[./app/menu/menu.component.html] 1.11 KiB {bundle} [built]
[./app/menu/menu.component.ts] 933 bytes {bundle} [built]
[./app/services/dish.service.ts] 1.29 KiB {bundle} [built]
[./app/services/process-httpmsg.service.ts] 784 bytes {bundle} [built]
[./app/shared/baseurl.ts] 49 bytes {bundle} [built]
[./main.ts] 2.36 KiB {bundle} [built]
[./package.json] 73 bytes {bundle} [optional] [built]
    + 386 hidden modules
Webpack compilation complete. Watching for file changes.
Webpack build done!
Skipping prepare.
Successfully transferred runtime.js on device emulator-5554.
Restarting application on device emulator-5554...
Successfully synced application org.nativescript.conFusion on device emulator-5554.
JS: HMR: Hot Module Replacement Enabled. Waiting for signal.
System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.conFusion/com.tns.NativeScriptActivity}: com.tns.NativeScriptException:
System.err: Calling js method onCreate failed
System.err:
System.err: Error: Template parse errors:
System.err: Property binding ngIf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
System.err: </ActionBar>
System.err: <StackLayout class="page">
System.err:     [ERROR ->]<ListView [items]="dishes" class="list-group" *ngIf="dishes">
System.err:         <ng-template let-dish="item">
System.err: Property binding ngIf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
System.err:         </ng-template>
System.err:     </ListView>
System.err:     [ERROR ->]<ActivityIndicator busy="true"  *ngIf="!(dishes || errMess)" width="50" height="50" class="activity-i"): ng:///AppModule/MenuComponent.html@14:4
System.err: Property binding ngIf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("="!(dishes || errMess)" width="50" height="50" class="activity-indicator"></ActivityIndicator>
System.err:     [ERROR ->]
System.err: </StackLayout>"): ng:///AppModule/MenuComponent.html@15:4
System.err: File: "file:///data/data/org.nativescript.conFusion/files/app/vendor.js, line: 21142, column: 12
System.err:
System.err: StackTrace:
System.err:     Frame: function:'ZoneAwareError', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 73853, column: 33
System.err:     Frame: function:'syntaxError', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 11620, column: 17
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.TemplateParser.parse', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 21142, column: 19
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._parseTemplate', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 36218, column: 37
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileTemplate', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 36205, column: 23
System.err:     Frame: function:'', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 36148, column: 62
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileComponents', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 36148, column: 19
System.err:     Frame: function:'', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 36058, column: 19
System.err:     Frame: function:'then', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 11611, column: 77
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 36057, column: 26
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler.compileModuleAsync', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 36017, column: 37
System.err:     Frame: function:'push.../node_modules/@angular/platform-browser-dynamic/fesm5/platform-browser-dynamic.js.CompilerImpl.compileModuleAsync', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 68387, column: 31
System.err:     Frame: function:'compileNgModuleFactory__PRE_R3__', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 62226, column: 21
System.err:     Frame: function:'push.../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModule', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 62435, column: 16
System.err:     Frame: function:'_bootstrapper', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 71945, column: 35
System.err:     Frame: function:'', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 72008, column: 19
System.err:     Frame: function:'push.../node_modules/tns-core-modules/data/observable/observable.js.Observable.notify', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 90899, column: 23
System.err:     Frame: function:'notifyLaunch', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 109265, column: 17
System.err:     Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.setActivityContent', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 109187, column: 28
System.err:     Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 109036, column: 14
System.err:     Frame: function:'push.../node_modules/tns-core-modules/ui/frame/activity.js.NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 106850, column: 25
System.err:
System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3260)
System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3396)
System.err:     at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
System.err:     at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
System.err:     at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2009)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:107)
System.err:     at android.os.Looper.loop(Looper.java:214)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:7319)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:934)
System.err: Caused by: com.tns.NativeScriptException:
System.err: Calling js method onCreate failed
System.err:
System.err: Error: Template parse errors:
System.err: Property binding ngIf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
System.err: </ActionBar>
System.err: <StackLayout class="page">
System.err:     [ERROR ->]<ListView [items]="dishes" class="list-group" *ngIf="dishes">
System.err:         <ng-template let-dish="item">
System.err: Property binding ngIf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
System.err:         </ng-template>
System.err:     </ListView>
System.err:     [ERROR ->]<ActivityIndicator busy="true"  *ngIf="!(dishes || errMess)" width="50" height="50" class="activity-i"): ng:///AppModule/MenuComponent.html@14:4
System.err: Property binding ngIf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("="!(dishes || errMess)" width="50" height="50" class="activity-indicator"></ActivityIndicator>
System.err:     [ERROR ->]
System.err: </StackLayout>"): ng:///AppModule/MenuComponent.html@15:4
System.err: File: "file:///data/data/org.nativescript.conFusion/files/app/vendor.js, line: 21142, column: 12
System.err:
System.err: StackTrace:
System.err:     Frame: function:'ZoneAwareError', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 73853, column: 33
System.err:     Frame: function:'syntaxError', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 11620, column: 17
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.TemplateParser.parse', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 21142, column: 19
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._parseTemplate', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 36218, column: 37
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileTemplate', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 36205, column: 23
System.err:     Frame: function:'', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 36148, column: 62
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileComponents', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 36148, column: 19
System.err:     Frame: function:'', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 36058, column: 19
System.err:     Frame: function:'then', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 11611, column: 77
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 36057, column: 26
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler.compileModuleAsync', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 36017, column: 37
System.err:     Frame: function:'push.../node_modules/@angular/platform-browser-dynamic/fesm5/platform-browser-dynamic.js.CompilerImpl.compileModuleAsync', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 68387, column: 31
System.err:     Frame: function:'compileNgModuleFactory__PRE_R3__', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 62226, column: 21
System.err:     Frame: function:'push.../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModule', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 62435, column: 16
System.err:     Frame: function:'_bootstrapper', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 71945, column: 35
System.err:     Frame: function:'', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 72008, column: 19
System.err:     Frame: function:'push.../node_modules/tns-core-modules/data/observable/observable.js.Observable.notify', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 90899, column: 23
System.err:     Frame: function:'notifyLaunch', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 109265, column: 17
System.err:     Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.setActivityContent', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 109187, column: 28
System.err:     Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 109036, column: 14
System.err:     Frame: function:'push.../node_modules/tns-core-modules/ui/frame/activity.js.NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.conFusion/files/app/vendor.js', line: 106850, column: 25
System.err:
System.err:     at com.tns.Runtime.callJSMethodNative(Native Method)
System.err:     at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1203)
System.err:     at com.tns.Runtime.callJSMethodImpl(Runtime.java:1083)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1070)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1050)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1042)
System.err:     at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:19)
System.err:     at android.app.Activity.performCreate(Activity.java:7783)
System.err:     at android.app.Activity.performCreate(Activity.java:7772)
System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3235)
System.err:     ... 11 more

I know the emulator is exist in my computer and it will launch after I run the above command but shows many errors in the screen. As I am new in NativeScript and just following a video tutorial can't understand what is the problem? How can I fix it?
EDIT:
This is the content of menu.component.html file:
<ActionBar title="Menu" class="action-bar">
</ActionBar>
<StackLayout class="page">
    <ListView [items]="dishes" class="list-group" *ngIf="dishes">
        <ng-template let-dish="item">
            <StackLayout orientation="horizontal" class="list-group-item">
                <Image row="0" col="0" rowSpan="2" height="108" width="108"  [src]="BaseURL + dish.image" class="thumb p-16"></Image>
                <GridLayout class="list-group-item" rows="auto *" columns="*">

                </GridLayout>
            </StackLayout>
        </ng-template>
    </ListView>
    <ActivityIndicator busy="true"  *ngIf="!(dishes || errMess)" width="50" height="50" class="activity-indicator"></ActivityIndicator>

</StackLayout>

EDIT2:
I solved the previous problem with the guides in comments but I see this new error in the emulator screen:
No ErrorHandler. Is platform module (BrowserModule) included?

Error: No ErrorHandler. Is platform module (BrowserModule) included?
    at file:///data/data/org.nativescript.conFusion/files/app/vendor.js:62401:23 [angular]
    at Object.onInvoke (file:///data/data/org.nativescript.conFusion/files/app/vendor.js:61906:33) [angular]
    at NgZone.push.../node_modules/@angular/core/fesm5/core.js.NgZone.run (file:///data/data/org.nativescript.conFusion/files/app/vendor.js:61820:28) [<root>]
    at PlatformRef.push.../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModuleFactory (file:///data/data/org.nativescript.conFusion/files/app/vendor.js:62396:23) [<root>]
    at file:///data/data/org.nativescript.conFusion/files/app/vendor.js:62436:59 [<root>]
    at file:///data/data/org.nativescript.conFusion/files/app/vendor.js:73438:34 [<root>]
    at Function.drainMicroTaskQueue (file:///data/data/org.nativescript.conFusion/files/app/vendor.js:73150:35) [<root>]

A: You must include CommonModule in your NgModule which actually enable support for common directives like ngIf.
Also it's obvious you can not import BrowserModule, you are not running your app in Browser here but the equivalent would be NativeScriptModule.


text:
Q: Setting the style of the output in a text file My problem is related to FormatType of the Output of Print[].
Look at this example code
i = 4;
Print["Try", "\tPippo : ", i, "\nPluto"]

The output is

If instead I send the output to another stream through
$Output = OpenWrite["demo.txt"]

and then I evaluate again the Print command, the output in the file "demo.txt" looks like the following

How can I save the text in the same style it appears in Mathematica?
For example, I want my text file to look like

A: Using
$Output = OpenWrite["demo2.txt", FormatType -> OutputForm]

gives the desired result.


text:
Q: UIViewController have no parentViewController with UIModalPresentationFormSheet? I use UIStoryboardSegue
- (void)perform
{
    [(UIViewController *)self.destinationViewController setModalPresentationStyle:UIModalPresentationFormSheet];
    [(UIViewController *)self.destinationViewController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
    [(UIViewController *)self.sourceViewController presentViewController:self.destinationViewController animated:YES completion:nil];
}

Then in destinationViewController value for parentViewController is nil. How it possible, and how to get sourceViewController in destinationViewController using UIModalPresentationFormSheet?

A: See the documentation. Going from your code sniplet, parentViewController should be nil because it is not imbedded in a containter view of its parentView.
Did you mean presentingViewController?
Ahh... It changed with iOS 5. In earler versions parentViewController did return the presenting view controller if it did not have a parent. Now it returns nil. You should use preseningViewController instead.