text:
Q: F# .NET Core 2.1 simple crud app: controllers don't get registered I am trying to use F# with .NET Core 2.1 to create a simple CRUD application but none of the controllers don't get registered. I see none of the controllers in Swagger and the controller themselves don't start.
I appreciate any help or hint.
Startup.fs
namespace SimpleCms

type Startup private () =
    let mutable configuration : IConfigurationRoot = null

    member this.Configuration
        with get () = configuration
        and private set (value) = configuration <- value

    new(env : IHostingEnvironment) as this =
        Startup()
        then
            let builder =
                ConfigurationBuilder()
                    .SetBasePath(env.ContentRootPath)
                    .AddJsonFile("appsettings.json", optional = false, reloadOnChange = true)
                    .AddJsonFile(sprintf "appsettings.%s.json" env.EnvironmentName, optional = true)
                    .AddEnvironmentVariables()

            this.Configuration <- builder.Build()

    // This method gets called by the runtime. Use this method to add services to the container.
    member this.ConfigureServices(services : IServiceCollection) =

        services.AddLogging() |> ignore

        services.AddSwaggerGen(fun x ->
            x.SwaggerDoc("v1", new Info(Title = "SimpleCms", Version = "v1")) |> ignore)
            |> ignore

        services.AddMvcCore() |> ignore

        services.AddMvc() |> ignore

        let container =
            new Container(fun opt ->

            opt.Scan(fun x ->
                x.AssemblyContainingType(typeof<Startup>)
                x.Assembly("Dal")
                x.Assembly("Logic")
                x.WithDefaultConventions() |> ignore)

            opt.For<LiteDatabase>().Use(new LiteDatabase("Filename=database.db")) |> ignore

            opt.Populate(services) |> ignore)

        container.GetInstance<IServiceProvider>()

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    member this.Configure(app : IApplicationBuilder, env : IHostingEnvironment) =
        app.UseSwagger() |> ignore

        app.UseSwaggerUI(fun x ->
            x.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1") |> ignore) |> ignore

        app.UseMvc(fun x ->
            x.MapRoute("default", "{controller=Home}/{action=Index}") |> ignore) |> ignore

HomeController.fs
namespace SimpleCms.Controllers

open Microsoft.AspNetCore.Mvc

[<Route("")>]
type HomeController() =
    inherit Controller()

    [<Route("")>]
    [<HttpGet>]
    member this.Index() =
        Ok("Hello World!")

The complete code
Repo URL

A: Your problem is the IPostController interface. Remove that and Swagger will pick up the PostController.
For example:
[<Route("api/[controller]")>]
[<ApiController>]
type PostController(logic : IPostLogic) =
    inherit Controller()
    member this.logic = logic

        [<Route("")>]
        [<HttpGet>]
        member this.GetAll() =
            this.logic.GetAll()

//etc

Which makes Swagger show this:

Side Note: For ASP.NET Core 2.1 and above, you shouldn't be specifying the version of the Microsoft.AspNetCore.All package, your fsproj file should contain this instead:
<PackageReference Include="Microsoft.AspNetCore.All" />

Which in turn means you should be using version 2.1.1 of Microsoft.Extensions.Logging.Debug.
Finally, you are using a really old version of Swashbuckle.AspNetCore. I suggest you upgrade that too.


text:
Q: A line divides a plane into two half-planes I am trying to learn axioms of geometry, and I can not seem to find any proof to the following theorem that doesn't use circular reasoning:
If π is a plane and l is a line on that plane, then all the points in π\l can be divided into two sets S1 and S2 such that if two points A and B are members of the same set, then then, the line segment defined by the two points doesn't intersect l, while if A and B are members of different sets, then the line segment will intersect l.
Here's how far I've come:
We can define an equivalence relation ~:
$$A \sim B\Leftrightarrow \overleftrightarrow{AB} \cap l = \emptyset$$
It's easily proven that such relation is an equivalence relation.
We know that there exists at least one point C on the plane π that is not on the line l, therefor ~ has at least one equivalence class. We can also show that there is more than one class by taking a point D on the line l and constructing the line  CD, then  according to 2nd axiom of order there exists a point E on the line CE such that D is between C and E, and clearly the line segment CE intersects the line l and E is not in the same class as C.
The problem begins when I try to prove that only two such sets exists. I've seen the following done:
Let's assume there are three classes. Then we can take points A,B and C such that they are not related. We have a contradiction due to Pasch's theorem because l intersects all three line segments AB, BC and AC.
This would be fine, but wherever I see the proof of Pasch's theorem it uses the fact that there are exactly two half planes.
Thanks in advance :)

A: TABLE OF CONTENTS
I.   PRELIMINARIES
II.  AUXILIARY RESULTS
III. THE MAIN RESULTS

I. PRELIMINARIES
I will answer the question within the framework of Hilbert's axioms, as described in Wikipedia.
We will assume implicitly the existence of a constant set, the set of points, and the following additional two axioms.

*

*A line consists of points.

*A plane consists of points.

For every pair of points $x$ and $y$, denote by $(xy)$ the set of points lying between $x$ and $y$, and denote by $[xy]$ the line segment between $x$ and $y$, i.e. $[xy]:=\{x,y\}\cup(xy)$.
For every pair of distinct points $x$ and $y$, denote by $\overline{xy}$ the line through $x$ and $y$, whose existence and uniqueness are guaranteed by axioms I1 and I2, respectively.
The following book (written in German) will be cited as [Grund].

Hilbert, David. Grundlagen der Geometrie, Mit Supplementen von Prof. Dr. Paul Bernays, 13th edition, Teubner, 1987

I use the German book as a reference, rather than the English translation by Edgar Jerome Townsend, which is readily available online, since Hilbert's axioms underwent refinements over the years (even after his death), which Townsend's translation, published 1950, does not reflect, as exemplified here.

II. AUXILIARY RESULTS
Lemma 1
Let $P$ be a plane.

*

*There exists some non-collinear $C\subseteq P$.

*Let $L\subseteq P$ be a line. Then $P\setminus L\neq\emptyset$.

Proof

*

*See here.

*By part 1.

$\square$
Lemma 2
Let $x$ be a point.

*

*$(xx)=\emptyset$.

*$[xx]=\{x\}$.

Proof

*

*Suppose the opposite. Choose some $y\in(xx)$. Then $x$, $x$, and $y$ are pairwise distinct by axiom O1.

*$[xx]=\{x,x\}\cup(xx)$ by the definition of $[xx]$, and $(xx)=\emptyset$ by part 1.
$\square$
Lemma 3
Let $x$, $y$, and $z$ be pairwise distinct and collinear points. Then exactly one of the following three conditions holds.

*

*$x\in(yz)$.

*$y\in(xz)$.

*$z\in(xy)$.

Proof
This post proves that at least one of the three conditions holds, while axiom O3 guarantees that at most one of them does.
$\square$
Lemma 4
Let $a$, $c$, and $d$ be points, let $b\in(ac)$, and suppose that $c\in(bd)$. Then $b,c\in(ad)$.
Proof
This is proved in [Grund] as the first part of Theorem 5's proof (on p. 7).
$\square$
Lemma 5
Let $a$ and $d$ be points, and let $c\in(ad)$.

*

*Let $b\in(ac)$. Then

*

*$c\in(bd)$.

*$b\in(ad)$.

*Let $b\in(cd)$. Then

*

*$c\in(ab)$.

*$b\in(ad)$.

Proof

*

*This is proved in [Grund] as the second part of Theorem 5's proof (on p. 7).

*This can be shown by an argument analogous to the one used to prove part 1.
$\square$
Lemma 6
Let $x$ and $z$ be points, let $y\in(xz)$, and let $p\in\overline{xz}\setminus\{x,y,z\}$. Then exactly one of the following conditions holds.

*

*$x\in(py)$, and $x,y\in(pz)$.

*$p\in(xy)$, $y\in(pz)$, and $p\in(xz)$.

*$p\in(yz)$, $y\in(xp)$, and $p\in(xz)$.

*$z\in(yp)$, and $y,z\in(xp)$.

Proof
For starters we note that $x$, $y$, $z$, and $p$ are pairwise distinct and collinear points. In fact, since $y\in(xz)$ it follows from axiom O1 that $x$, $y$, and $z$ are pairwise distinct and collinear points, in particular $x,y,z\in\overline{xz}$; and $p\in\overline{xz}\setminus\{x,y,z\}$ by the initial assumptions.
Now, firstly we show that at least one of the four conditions holds. The proof idea can be found in [Grund] in the final part of the Theorem 5's proof (on p. 8). By Lemma 3 either $x\in(zp)$ or $z\in(xp)$ or $p\in(xz)$, and likewise $x\in(yp)$ or $y\in(xp)$ or $p\in(xy)$. Hence one of the following five cases applies.

*

*Suppose that $x\in(zp)$. In this case the first condition holds. In fact, $x\in(pz)$ by assumption; and since $x\in(pz)$ and $y\in(xz)$ (by the initial assumptions), part 2.1 of Lemma 5 implies that $x\in(py)$, whereas part 2.2 of Lemma 5 implies that $y\in(pz)$.

*Suppose that $z\in(xp)$. In this case the fourth condition holds. In fact, $z\in(xp)$ by assumption; and since $z\in(xp)$ and $y\in(xz)$ (by the initial assumptions), part 1.1 of Lemma 5 implies that $z\in(yp)$, whereas part 1.2 of Lemma 5 implies that $y\in(xp)$.

*Suppose that $p\in(xz)$ and $y\in(xp)$. In this case the third condition holds. In fact, $p\in(xz)$ and $y\in(xp)$ by assumption; and from this follows by part 1.1 of Lemma 5 that $p\in(yz)$.

*Suppose that $p\in(xz)$ and $p\in(xy)$. In this case the second condition holds. In fact, $p\in(xy)$ and $p\in(xz)$ by assumption; and since $y\in(xz)$ (by the initial assumptions) and $p\in(xy)$, part 1.1 of Lemma 5 implies that $y\in(pz)$.

*Suppose that $p\in(xz)$ and that $x\in(yp)$. This case cannot occur, a fact we will prove by deriving a contradiction. On the one hand $x\in(yz)$ by Lemma 4, since $x\in(yp)$ and $p\in(xz)$; but on the other hand $x\notin(yz)$ by Lemma 3, since $y\in(xz)$ by the initial assumptions.
Secondly we show that no two distinct conditions of the four listed in the statement of our lemma hold simultaneously. We consider each of the six possible combinations, and in each case derive a contradiction by Lemma 3.

*

*Suppose that conditions 1 and 2 hold simultaneously. Then $x\in(py)$ by condition 1, and $p\in(xy)$ by condition 2.

*Suppose that conditions 1 and 3 hold simultaneously. Then $x\in(py)$ by condition 1, and $y\in(xp)$ by condition 3.

*Suppose that conditions 1 and 4 hold simultaneously. Then $x\in(py)$ by condition 1, and $y\in(xp)$ by condition 4.

*Suppose that conditions 2 and 3 hold simultaneously. Then $p\in(xy)$ by condition 2, and $y\in(xp)$ by condition 3.

*Suppose that conditions 2 and 4 hold simultaneously. Then $p\in(xy)$ by condition 2, and $y\in(xp)$ by condition 4.

*Suppose that conditions 3 and 4 hold simultaneously. Then $p\in(yz)$ by condition 3, and $z\in(yp)$ by condition 4.
$\square$
Lemma 7
Let $x,z$ be points, and let $y\in(xz)$.

*

*$(xz)=\coprod\big\{(xy),\{y\},(yz)\big\}$, i.e. $(xz)$ is the disjoint union of $(xy)$, $\{y\}$, and $(yz)$. In particular, $(xy),(yz)\subseteq(xz)$.

*Let $p\in(xz)\setminus\{y\}$. Then exactly one of the following conditions holds: $p\in(xy)$ or $p\in(yz)$.

Proof

*

*For starters we note that $x$, $y$, and $z$ are pairwise distinct and collinear points by axiom O1, since $y\in(xz)$.
Now, firstly we show that $(xy)$, $\{y\}$, and $(yz)$ are pairwise disjoint. In fact, $(xy)\cap\{y\}=\emptyset$, since otherwise we would have $y\in(yz)$, which would yield by axiom O1 the contradiction that $y$, $z$, and $y$ were pairwise distinct. Similarly, $(yz)\cap\{y\}=\emptyset$. As for $(xy)\cap(yz)$, suppose to the contrary that this intersection is non-empty. Choose $p\in(xy)\cap(yz)$. Since $y\in(xz)$ and $p\in(yz)$, part 2.1 of Lemma 5 implies that $y\in(xp)$. Since $y\in(xp)$ and $p\in(xy)$, part 1.1 of Lemma 5 implies that $y\in(pp)$. But $(pp)=\emptyset$ by part 1 of Lemma 2.
Secondly we show that $(xz)=(xy)\cup\{y\}\cup(yz)$.
Let $p\in(xz)$. If $p=y$, then $p\in\{y\}$. So assume that $p\neq y$. Since $p\in(xz)$, axiom O1 implies that $x$, $z$, and $p$ are pairwise distinct and collinear. So $p\in\overline{xz}\setminus\{x,y,z\}$. It follows from Lemma 6 that one of the following four conditions holds:

*

*$x\in(py)$, and $x,y\in(pz)$.

*$p\in(xy)$, $y\in(pz)$, and $p\in(xz)$.

*$p\in(yz)$, $y\in(xp)$, and $p\in(xz)$.

*$z\in(yp)$, and $y,z\in(xp)$.

The first of these conditions must be ruled out, since otherwise we would have $x\in(pz)$ and $p\in(xz)$ (by the selection of $p$), in contradiction to %Absurd. Likewise, the fourth of these conditions must be ruled out, since otherwise we would have $z\in(xp)$ and $p\in(xz)$. It follows from the remaining two conditions that $p\in(xy)$ or $p\in(yz)$.
Conversely, let $q\in(xy)\cup\{y\}\cup(yz)$. If $q\in\{y\}$, we have $q\in(xz)$ by the initial assumptions. If $q\in(xy)$, we have $y\in(xz)$ (by the initial assumptions) and $q\in(xy)$, which together imply that $q\in(xz)$, by part 1.2 of Lemma 5. Finally, if $q\in(yz)$, we have $y\in(xz)$ and $q\in(yz)$, which together imply that $q\in(xz)$, by part 2.2 of Lemma 5.

*By part 1.
$\square$
We will strengthen Pasch's axiom (axiom O4) in two ways: by weakening the premises to allow the three points to be collinear, and by strengthening the conclusion to deduce that a line that intersects one side of a triangle intersect exactly one of the other two sides. We encapsulate these modifications in the following lemma.
Lemma 8 (Pasch)
Let $L$ be a line, and let $x$, $y$, and $z$ be such that there is a plane containing both $L$ and $\{x,y,z\}$, such that $L\cap\{x,y,z\}=\emptyset$, and such that $(xy)\cap L\neq\emptyset$. Then exactly one of the following conditions holds: $(zx)\cap L\neq\emptyset$, or $(zy)\cap L\neq\emptyset$.
Proof

*

*Suppose that $x=y$. This case cannot occur, since on the one hand $(xy)\cap L\neq\emptyset$ by the initial assumptions, while on the other hand $(xy)\cap L=\emptyset$, since $(xy)=\emptyset$ by part 1 of Lemma 2.

*Suppose that $x\neq y$, and that $z\in\{x,y\}$. Assume w.l.g. that $z=x$. Then $(zx)\cap L=\emptyset$ by part 1 of Lemma 2, whereas $(zy)\cap L\neq\emptyset$ by the initial assumptions.

*Suppose that $x$, $y$, and $z$ are pairwise distinct and collinear. By Lemma 3 we need consider three possibilities.

*

*Suppose that $y\in(xz)$. We will show that $(zx)\cap L\neq\emptyset$ and $(zy)\cap L=\emptyset$.
To see that $(zx)\cap L\neq\emptyset$, choose some $p\in(xy)\cap L$, a choice possible since $(xy)\cap L\neq\emptyset$ by the initial assumptions. Then since $y\in(xz)$ (by the original assumption of this case) and $p\in(xy)$, part 1.2 of Lemma 5 implies that $p\in(xz)$, hence $p\in(zx)\cap L$.
To see that $(zy)\cap L=\emptyset$, suppose the opposite. On the one hand $z\notin L$, since $L\cap\{x,y,z\}=\emptyset$ by the initial assumptions. On the other hand, choose $q\in(yz)\cap L$, a choice possible by the contradictory hypothesis. Since $y\in(xz)$ (by the original assumption of this case) and $p\in(xy)$, it follows from part 1.1 of Lemma 5 that $y\in(pz)$. This fact together with the fact that $q\in(yz)$ imply by part 2.1 of Lemma 5 that $y\in(pq)$. Therefore by axiom O1 $p$, $q$, and $y$ are pairwise distinct and collinear; in particular $y\in\overline{pq}$. Since $p,q\in L$, axiom I2 implies that $\overline{pq}=L$. Hence $y\in L$, contradicting the initial assumption that $L\cap\{x,y,z\}=\emptyset$.

*Suppose that $x\in(yz)$. Then, by an argument analogous to the one used in the preceding bullet point, $(zx)\cap L=\emptyset$ and $(zy)\cap L\neq\emptyset$.

*Suppose that $z\in(xy)$. Choose some $p\in(xy)\cap L$, a choice possible since $(xy)\cap L\neq\emptyset$ by the initial assumptions. Since $L\cap\{x,y,z\}=\emptyset$, $p\neq z$. Hence by part 2 of Lemma 7 exactly one of the following conditions holds: $p\in(xz)$ or $p\in(zy)$.
We show that $p\in(xz)$ iff $(zx)\cap L\neq\emptyset$. If $p\in(xz)$, then $p\in(xz)\cap L$, hence $(zx)\cap L\neq\emptyset$. Conversely, suppose that $(zx)\cap L\neq\emptyset$. Choose $q\in(zx)\cap L$. It suffices to show that $q=p$, or equivalently that $q\in\{p\}$. Observing that $L$ and $\overline{xy}$ are distinct lines (since $L\cap\{x,y,z\}=\emptyset$ but $x,y\in\overline{xy}$), and that $p\in L\cap\overline{xy}$ (since $p\in L$; and since $x$, $y$, and $p$ are collinear by axiom O1 because $p\in(xy)$), we conclude by axiom I2 that $L\cap\overline{xy}=\{p\}$. Now, $q\in L$, so it remains to show that $q\in\overline{xy}$. In fact, since $q\in(xz)$, axiom O1 guarantees that $x$, $z$, and $q$ are collinear; in particular $q\in\overline{xz}$. But $x$, $y$, and $z$ are collinear by assumption, hence by axiom I2 $\overline{xz}=\overline{xy}$.
To see that $p\in(zy)$ iff $(zy)\cap L\neq\emptyset$ use an argument analogous to the one used in the previous paragraph.

*Suppose that $x$, $y$, and $z$ are pairwise distinct and not collinear. Then since $(xy)\cap L\neq\emptyset$ by the initial assumptions, Pasch's axiom implies that either $(zx)\cap L\neq\emptyset$ or $(zy)\cap L\neq\emptyset$. This post rules out the possibility that these two inequalities hold simultaneously.
$\square$

III. THE MAIN RESULTS
Lemma 9
Let $P$ be a plane, let $L$ be a line contained in $P$, and let $x_1,x_2\in P\setminus L$ be such that $(x_1x_2)\cap L\neq\emptyset$. Define
$$
\begin{align*}
H_1&:=\big\{x\in P:[xx_1]\cap L=\emptyset\big\},\\
H_2&:=\big\{x\in P:[xx_2]\cap L=\emptyset\big\}.
\end{align*}
$$
Then

*

*$x_1\in H_1$, and $x_2\in H_2$. In particular, $H_1,H_2\neq\emptyset$.

*$P=\coprod\{L,H_1,H_2\}$.

*Let $x$ and $y$ be such that either $x,y\in H_1$ or $x,y\in H_2$. Then $[xy]\cap L=\emptyset$.

*$H_1$ and $H_2$ are convex.

Proof

*

*To show that, say, $x_1\in H_1$, we need to show that $[x_1x_1]\cap L=\emptyset$, i.e. that $\{x_1\}\cap L=\emptyset$ by part 2 of Lemma 2. This follows from the initial assumptions.

*Firstly we show that $H_1\cap L=\emptyset$. Suppose the opposite. Choose $x\in H_1\cap L$. Then on the one hand $x\in[xx_1]\cap L$ since $x\in[xx_1]=\{x,x_1\}\cup(xx_1)$ and $x\in L$, but on the other hand $[xx_1]\cap L=\emptyset$ by the definition of $H_1$ and the fact that $x\in H_1$. The proposition $H_2\cap L=\emptyset$ can be proved analogously.
Secondly we show that $H_1\cap H_2=\emptyset$. Suppose the opposite. Choose some $z\in H_1\cap H_2$. Since $(x_1x_2)\cap L\neq\emptyset$ by the initial assumptions, Pasch's Lemma yields that either $(zx_1)\cap L\neq\emptyset$ or $(zx_2)\cap L\neq\emptyset$. However, $(zx_1)\cap L=\emptyset$ by the definition of $H_1$ and the fact that $z\in H_1$, and similarly $(zx_2)\cap L=\emptyset$.
Thirdly we show that $P=L\cup H_1\cup H_2$. Since $L,H_1,H_2\subseteq P$ by the initial assumptions, it suffices to show that $P\setminus(L\cup H_1)\subseteq H_2$. Let $z\in P\setminus(L\cup H_1)$. We need to show that $[zx_2]\cap L=\emptyset$. Since $z,x_2\notin L$, it suffices to show that $(zx_2)\cap L=\emptyset$. Since $(x_1x_2)\cap L\neq\emptyset$ by the initial assumptions, Pasch's Lemma implies that exactly one of $(zx_1)\cap L\neq\emptyset$ and $(zx_2)\cap L\neq\emptyset$ holds. It must be the first of these inequalities, since otherwise we would have $[zx_1]\cap L=\emptyset$, which would imply that $z\in H_1$, contradicting the selection of $z$.

*Assume w.l.g. that $x,y\in H_1$. It suffices to show that $(xy)\cap L=\emptyset$, since by part 1 $\{x,y\}\cap L\subseteq H_1\cap L=\emptyset$. Suppose the opposite. Then on the one hand by Pasch's Lemma either $(x_1x)\cap L\neq\emptyset$, or $(x_1y)\cap L\neq\emptyset$. But on the other hand both $(xx_1)\cap L=\emptyset$, and $(yx_1)\cap L=\emptyset$ by the definition of $H_1$ and the fact that $x,y\in H_1$.

*We show only that $H_1$ is convex; an analogous argument will show that $H_2$ is convex. Let $x,y\in H_1$. If $x=y$, then $[xy]=\{x\}\subseteq H_1$ by part 2 of Lemma 2. So suppose that $x\neq y$, and let $z\in[xy]$. By the definition of $H_1$ we need to show that $z\in P$, and that $[zx_1]\cap L=\emptyset$. If $z\in\{x,y\}$, this follows from the definition of $H_1$ and the fact that $x,y\in H_1$. So assume that $z\notin\{x,y\}$, which is to say $z\in(xy)$. It suffices to show that $z\in P\setminus L$, and that $(zx_1)\cap L=\emptyset$.
We show that $z\in P$. Since $z\in(xy)$, axiom O1 implies that $x$, $y$, and $z$ are pairwise distinct and collinear; in particular $z\in\overline{xy}$. Since $x,y\in H_1$, part 2 implies that $x,y\in P$. Hence by axiom I6 $\overline{xy}\subseteq P$.
To see that $z\notin L$, suppose the opposite. Then $z\in(xy)\cap L$, hence in particular $(xy)\cap L\neq\emptyset$. Then on the one hand Pasch's Lemma implies that $(x_1x)\cap L\neq\emptyset$ or $(x_1y)\cap L\neq\emptyset$. But on the other hand both $(xx_1)\cap L=\emptyset$ and $(yx_1)\cap L=\emptyset$ by the definition of $H_1$ and the fact that $x,y\in H_1$.
To see that $(zx_1)\cap L=\emptyset$, suppose the opposite. Then on the on hand Pasch's Lemma implies that $(xz)\cap L\neq\emptyset$ or $(xx_1)\cap L\neq\emptyset$. But on the other hand both $(xz)\cap L=\emptyset$ and $(xx_1)\cap L=\emptyset$: in fact, $(xz)\cap L\subseteq(xy)\cap L\subseteq[xy]\cap L=\emptyset$, where the first equality is by part 1 of Lemma 7, and the last one is by part 3 of our lemma since $x,y\in H_1$; and $(xx_1)\cap L=\emptyset$ by the definition of $H_1$ and the fact that $x\in H_1$.
$\square$
Lemma 10
Let $P$ be a plane, let $L$ be a line contained in $P$, let $H_1$ and $H_2$ be convex sets of points, and assume that $P=\coprod\{L,H_1,H_2\}$. Let $x_1\in H_1$. Then $H_1=\big\{x\in P:[xx_1]\cap L=\emptyset\big\}$.
Proof
Let $x\in H_1$. We need to show that $[xx_1]\cap L=\emptyset$. In fact, $[xx_1]\subseteq H_1$ since $x,x_1\in H_1$ and $H_1$ is convex; and $H_1\cap L=\emptyset$ by the initial assumptions.
Conversely, define $G_1:=\big\{x\in P:[xx_1]\cap L=\emptyset\big\}$, and let $x\in G_1$. Suppose to the contrary that $x\notin H_1$. Choose $x_0\in L$ (possible by axiom I3), and choose a point $x_2$ such that $x_0\in(x_1x_2)$ (possible by axiom O2).
$x_1$, $x_2$, and $x_0$ are pairwise distinct and collinear by axiom O1. Then by axiom I2 $x_1,x_2\in\overline{x_0x_1}=\overline{x_0x_2}$. This implies that $x_2\in P\setminus L$: in fact, $x_2\in\overline{x_0x_1}\subseteq P$ by axiom I6 since $x_0,x_1\in L\cup H_1\cup H_2=P$; and $x_2\notin L$, since otherwise we would have $x_1\in\overline{x_0x_2}=L$ by axiom I2, in contradiction to the fact, shown above, that $H_1\cap L=\emptyset$.
Define $G_2:=\big\{x\in P:[xx_2]\cap L=\emptyset\big\}$. Then $G_1\cap G_2=\emptyset$ by part 2 of @Adamant. Since also $x\in G_1$ (by assumption), to obtain a contradiction it suffices to show that $x\in G_2$. Since $H_2\subseteq G_2$ by an argument analogous to the one used in the opening paragraph of this proof, it suffices to show that $x\in H_2$. This is a consequence of the following observations:

*

*$x\in G_1\subseteq P=L\cup H_1\cup H_1$.

*$x\notin L$, since on the one hand $x\in[xx_1]$, and on the other hand $[xx_1]\cap L=\emptyset$ by the definition of $G_1$ and the fact that $x\in G_1$.

*$x\notin H_1$ by the contradictory hypothesis.

$\square$
Theorem 11
Let $P$ be a plane, and let $L$ be a line contained in $P$. Define $\mathcal{H}$ to consist of all $\mathbf{H}$ satisfying that there exist sets of points $H_1$ and $H_2$ such that the following four conditions hold:

*

*$H_1,H_2\neq\emptyset$.

*$P=\coprod\{L,H_1,H_2\}$.

*$H_1$ and $H_2$ are convex.

*$\mathbf{H}=\{H_1,H_2\}$.

Then $\mathcal{H}$ is a singleton. We call $\mathcal{H}$'s single member the set of open half planes of $P$ determined by $L$.
Proof
Choose $x_1\in P\setminus L$ (possible by part 2 of Lemma 1). As in the proof of Lemma 10, choose $x_0$ and $x_2$, such that

*

*$x_1,x_2\in P\setminus L$, and

*$x_0\in(x_1x_2)\cap L$,

and define
$$
\begin{align*}
   G_1&:=\big\{x\in P:[xx_1]\cap L=\emptyset\big\},\\
   G_2&:=\big\{x\in P:[xx_2]\cap L=\emptyset\big\},\\
   \mathbf{G}&:=\{G_1,G_2\}.
\end{align*}
$$
Then $\mathbf{G}\in\mathcal{H}$ by parts 1, 2, and 4 of Lemma 9. Now, let $\mathbf{H}\in\mathcal{H}$. Choose $H_1$ and $H_2$ that satisfy the four conditions of our theorem. We need to show that $\{H_1,H_2\}=\{G_1,G_2\}$.
Firstly suppose that $x_1\in H_1$. Then $H_1=G_1$ by Lemma 10. By the same token $H_2=G_2$ provided $x_2\in H_2$. Suppose to the contrary that $x_2\notin H_2$. Since also $x_2\in P\setminus L$ and since $P=L\cup H_1\cup H_2$, we conclude that $x_2\in H_1$. But then $[x_2x_1]\cap L=\emptyset$ by Lemma 10, in contradiction to the fact that $x_0\in(x_1x_2)\cap L$.
Secondly suppose that $x_1\notin H_1$. Since also $x_1\in P\setminus L$ and $P=L\cup H_1\cup H_2$, we conclude that $x_1\in H_2$. Then by an argument analogous to the one used in the previous paragraph, $H_2=G_1$ and $H_1=G_2$.
$\square$
Theorem 12
Let $P$ be a plane, let $L$ be a line contained in $P$, let $H$ be an open half plane of $P$ determined by $L$, and let $y\in H$. Then $H=\{x\in P:[xy]\cap L=\emptyset\}$.
Proof
Define $\mathbf{H}$ to be the set of open half planes of $P$ determined by $L$. Choose $H'$ to be such that $\mathbf{H}=\{H,H'\}$. Then by parts 3 and 2 of Theorem 11, respectively, $H$ and $H'$ are convex, and $P=\coprod\{L,H,H'\}$. The desired conclusion now follows from Lemma 10.
$\square$
Lemma 13
Let $P$ be a plane, let $L$ be a line contained in $P$, let $H_1$ and $H_2$ be such that $\{H_1,H_2\}$ is the set of open half planes of $P$ determined by $L$, let $x_1\in H_1$, and let $x_2\in H_2$. Then $(x_1x_2)\cap L\neq\emptyset$.
Proof
Suppose the opposite. Then $[x_1x_2]\cap L\neq\emptyset$. Then $x_1\in H_1$ by assumption, and $x_1\in H_2$ by Theorem 12, in contradiction to the fact that $H_1\cap H_2=\emptyset$ by the second condition of Theorem 11.
$\square$
Theorem 14
Let $P$ be a plane, let $L$ be a line contained in $P$, let $H_1$ and $H_2$ be such that $\{H_1,H_2\}$ is the set of open half planes of $P$ determined by $L$, and let $x_2\in H_2$.

*

*$H_1=\big\{x\in P\setminus L:[xx_2]\cap L\neq\emptyset\big\}$.

*$H_1=\big\{x\in P:(xx_2)\cap L\neq\emptyset\big\}$.

Proof

*

*Let $x_1\in H_1$. Then by Lemma 13 $[x_1x_2]\cap L\neq\emptyset$.
Conversely, let $x\in\{x\in P\setminus L:[xx_2]\cap L\neq\emptyset\big\}$. Suppose to the contrary that $x\notin H_1$. Then on the one hand $x\in H_2$, since $x\in P\setminus(L\cup H_1)$ and $P=L\cup H_1\cup H_2$ by part 2 of Theorem 11. But on the other hand $x\notin H_2$, for suppose the opposite. Then $[xx_2]\cap L=\emptyset$ by Theorem 12, in contradiction to the original selection of $x$.

*Let $x\in H_1$. Then by Lemma 13 $(xx_2)\cap L\neq\emptyset$.
Conversely, let $x\in\big\{x\in P:(xx_2)\cap L\neq\emptyset\big\}$. Then $[xx_2]\cap L\neq\emptyset$. Then $x\in H_1$ by part 1 provided $x\notin L$. Suppose to the contrary that $x\in L$. Choose $y\in(xx_2)\cap L$, a choice possible since $(xx_2)\cap L\neq\emptyset$ by the original selection of $x$. By axiom O1 $x$, $x_2$, and $y$ are pairwise distinct and collinear; in particular, $x_2\in\overline{xy}$. By axiom I2 $\overline{xy}=L$, since $x\in L$ by the contradictory hypothesis, and $y\in L$ by the choice of $y$. Then $x_2\in L$. But $x_2\in H_2$ by the initial assumptions, and $H_2\cap L=\emptyset$ by part 2 of Theorem 11.
$\square$

redpajama_set_name: RedPajamaStackExchange


text:
Q: MySQL 5.6 Innodb running out single-table tablespace id's I am looking for general information regarding this message:
InnoDB: Warning: you are running out of new single-table tablespace id's.
InnoDB: Current counter is 2152000000 and it must not exceed 4294967280!
InnoDB: To reset the counter to zero you have to dump all your tables and
InnoDB: recreate the whole InnoDB installation.
Which counter? How do you query it? Does an entire restore fix this problem?

A: From Percona Support:

When you create one table in innodb, that counter will be increased by 1.
  This table id seems to be a 32bit value.

In my case, we created lots of temporary tables. On MySQL 5.6 default engine for temporary tables is innodb hence the problem. Once I changed it to MYISAM the warnings disappeared.


text:
Q: How to move file from one repository to another git repository I have a RepoA and RepoB, I want to move file from RepoA to RepoB. For example
Like this RepoA/Bundle/fileToMove.txt to RepoB/Bundle/fileToMove.txt
But I would like to achieve this with git commands automatically not with manually adding the file

A: The easiest way to to checkout both repos, copy the file from RepoA/Bundle/fileToMove.txt to RepoB/Bundle/fileToMove.text manually, and create a new commit on RepoB where you are adding the file.


text:
Q: Android sdk in vs 2013 for apache cordova I try to install this
It runs perfect until the middle which is in the phase of Android SDK. It applies it for more than one hour but it seems like it stacked.
What can I do?


text:
Q: cannot modify the design of table it is in a read-only database I am trying to export data into excel sheet i have written code but getting error i dont know where i am wrong please help
It is showing error "cannot modify the design of table it is in a read-only database "
      public override void ExportToExcel()
       {
        MModule objModule = new MModule();
        objModule.LoadModule(this.Data.MID);

        DatabaseObject objData = new DatabaseObject();

        string file = DateTime.Now.Ticks + "_" + objModule.Title + ".xlsx";
        System.IO.File.Copy(Server.MapPath("/Excel/Export/template.xlsx"),
        Server.MapPath("/Excel/Export/" + file));
        string filename = Server.MapPath("/Excel/Export/" + file);
        objData.Query = "SELECT * FROM " + objModule.TableName + "";
        DataTable dtReport = objData.GetTable();
        System.Data.OleDb.OleDbConnection con = new
        System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
        Source=" + filename + ";Mode=ReadWrite;Extended Properties=\"Excel 12.0
        Xml;HDR=YES\"");

        con.Open();
        System.Data.OleDb.OleDbCommand cmd = con.CreateCommand();
        string tableString = "";
        string ColString = "";
        for (int i = 0; i < dtReport.Columns.Count; i++)
        {
            tableString += "[" + dtReport.Columns[i].Caption + "] varchar(255),";
            ColString += "[" + dtReport.Columns[i].Caption + "],";
        }
        tableString = tableString.Substring(0, tableString.Length - 1);
        try
        {
            ColString = ColString.Substring(0, ColString.Length - 1);

            cmd.CommandText = "CREATE TABLE MySheet (ID char(255), Field1 char(255))";
            cmd.ExecuteNonQuery();

            string ValString = "";
            for (int j = 0; j < dtReport.Rows.Count; j++)
            {
                ValString = "";
                for (int i = 0; i < dtReport.Columns.Count; i++)
                {
                    ValString += "'" + dtReport.Rows[j][i] + "',";
                }
                ValString = ValString.Substring(0, ValString.Length - 1);
                cmd.CommandText = "Insert Into " + objModule.Title + "(" + ColString +
                ") Values (" + ValString + ");";
                cmd.ExecuteNonQuery();
            }

            cmd.Dispose();
            con.Dispose();
            con.Close();

            Microsoft.Office.Interop.Excel.Application excelApplication = new
            Microsoft.Office.Interop.Excel.Application();
            Microsoft.Office.Interop.Excel.Workbook workbook =
            excelApplication.Workbooks.Open(filename,
            Type.Missing, Type.Missing, Type.Missing, Type.Missing,
            Type.Missing, Type.Missing, Type.Missing, Type.Missing,
            Type.Missing, Type.Missing, Type.Missing, Type.Missing,
            Type.Missing, Type.Missing);

            excelApplication.DisplayAlerts = false;
            ((Microsoft.Office.Interop.Excel.Worksheet)workbook.Worksheets[1]).Delete();
            workbook.Close(true, filename, null);
            excelApplication.DisplayAlerts = true;
        }
        catch (Exception ex)
        {

        }
    }


text:
Q: Create def in ruby to convert unix timestamp to datetime in rails console I am new to ruby and would like to create a simple method to convert a series of unix timestamps into datetime format. Currently, what I am doing (in console on my terminal is)
def foo(x)
Time.at(:x)
end

Then I would pass in foo(1315922016). But I get an error

Can't convert Symbol into an exact number

How can I revise my ruby code to allow it to accept an integer which then is put into Time.at method for conversion?

A: This should be simple call as:
def foo(x)
  Time.at(x)
end

Hope that helps!


text:
Q: Connect Redshift and AWS Lambda located in different regions I am trying to connect to my Redshift database (located in N. Virginia region) from Lambda function (located in Ireland region). But on trying to establish a connection, I am getting timeout error stating:
"errorMessage": "2019-10-20T13:34:04.938Z 5ca40421-08a8-4c97-b730-7babde3278af Task timed out after 60.05 seconds"

I have closely followed the solution provided to the AWS Lambda times out connecting to RedShift but the main issue is that the solution provided is valid for services located in same VPC (and hence, same region).
On researching further, I came across Inter-region VPC Peering and followed the guidelines provided in AWS Docs. But after configuring VPC Peering also, I am unable to connect to Redshift
Here are some of the details that I think can be useful for understanding the situation:

*

*Redshift cluster is publicly accessible, running port 8192 and has a VPC configured (say VPC1)

*Lambda function is located in another VPC (say VPC2)

*There is a VPC Peering connection between VPC1 and VPC2

*CIDR IPv4 blocks of both VPCs are different and have been added to each other's Route tables (VPC1 has 172.31.0.0/16 range and VPC2 has 10.0.0.0/16 range)

*IAM Execution role for Lambda function has Full Access of Redshift service

*In VPC1, I have a security group (SG1) which has an inbound rule of type: Redshift, protocol: TCP, port: 5439 and source: 10.0.0.0/16

*In VPC2, I am using default security group which has outbound rule of 0.0.0.0/0

*In Lambda, I am providing private IP of Redshift (172.31.x.x) as hostname and 5439 as port (not 8192!)

*Lambda function is in NodeJS 8.10 and I am using node-redshift package for connecting to Redshift

*After all this, I have tried accessing Redshift with both public IP as well as through its DNS name (with port 8192)
Kindly help me out in establishing connection between these services.


text:
Q: git precommit-hook: check whether line content has changed Szenario: On file commit with git I want to check within pre-commit hook whether a certain line has been modified. Therefore I want to compare parts of a line from the modified file with the corresponding linepart from the repository.
Background: I want to ensure that the file to commit has another version number than the file already in the repository. The user should be enforced to give the file an appropriate version number. Automatically increasing the version number on commit is not an option here, as we use multipart version (1.0.0.0), and the user has to modify the correct part of the version string ...
Question: Is it possible to access the file contents of the modified as well as the repository file within pre-commit hook?

A: The answer is yes.
But - pre commit hook is a client side hook which can be removed o deleted, this is why its better to do it with server side hook
Here is a sample hook to check if the desired file was modified.
Once you know if the file was committed use this:
# you have the commit id so you can checkout the given file
git show <commit id>:<full path to file>

Full sample code:
pre-receive hook
#!/bin/sh

# Check to see if this is the first commit in the repository or not
if git rev-parse --verify HEAD >/dev/null 2>&1
then
    # We compare our changes against the previous commit
    against=HEAD^
else
    # Initial commit: diff against an empty tree object
    against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi

# Redirect output to screen.
exec 1>&2

# Check to see if we have updated the given file
if [ $(git diff-tree -r --name-only $against | grep <ANY FILE YOU WANT TO FIND OUT HERE> ) ];
then

    # you have the commit id so you can checkout the given file
    # the commit is: git rev-parse HEAD
    git show <commit id>:<full path to file>

    # personal touch :-)
    echo "                                         "
    echo "                   |ZZzzz                "
    echo "                   |                     "
    echo "                   |                     "
    echo "      |ZZzzz      /^\            |ZZzzz  "
    echo "      |          |~~~|           |       "
    echo "      |        |-     -|        / \      "
    echo "     /^\       |[]+    |       |^^^|     "
    echo "  |^^^^^^^|    |    +[]|       |   |     "
    echo "  |    +[]|/\/\/\/\^/\/\/\/\/|^^^^^^^|   "
    echo "  |+[]+   |~~~~~~~~~~~~~~~~~~|    +[]|   "
    echo "  |       |  []   /^\   []   |+[]+   |   "
    echo "  |   +[]+|  []  || ||  []   |   +[]+|   "
    echo "  |[]+    |      || ||       |[]+    |   "
    echo "  |_______|------------------|_______|   "
    echo "                                         "
    echo "                                         "
    echo "      You have just committed code       "
    echo "      Your code is bad.!!!               "
    echo "      Do not ever commit again           "
    echo "                                         "
fi;

# set the exit code to 0 or 1 based upon your needs
# 0 = good to push
# 1 = exit without pushing.
exit 0;


text:
Q: Java Code for the next button Hi this is my java code for next button.
but it goes onto only 1 record i.e after the last record it moves to the 1st one only.
how to move it through the entire database entries.
plz provide me some suggestions.
public void Next() {
    Connection con = null;
    ResultSet rs = null;
    try {
        con = DBConnection();
        PreparedStatement pstmt = con.prepareStatement("select * from data", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
        rs = pstmt.executeQuery();
        if (rs.next()) {
            field1.setText(rs.getString("Name"));
            field2.setText(String.valueOf(rs.getInt("Age")));
        } else {
            rs.previous();
            JOptionPane.showMessageDialog(nxtbtn, "end of file");
        }
    } catch (Exception e) {
        // TODO: handle exception
    } finally {
        try {
            rs.close();
        } catch (SQLException err) {
            JOptionPane.showMessageDialog(nxtbtn, err.getMessage());
            // TODO: handle exception
        }
    }
}

A: When you call next, it reloads all the results from the database and moves the cursor to just before the first row, calling rs.next will move to the first row.
Do you're query once, presumably when you need to display the next record.
In your next method, simply call rs.next() to move the cursor to the next available row in the result set.
Of course, you'll need continue to manage the error states ;)

A: you need to get the resultset out side of the next() method. calling next() every-time resets the resultset, and cursor moves to start again.

A: if understand it correctly you want to use the next button to click throup the resultset?
then you shoul read the database an have it stored in your resultset outside the next button method.
at the moment it seems that your making a new resultset with every click and only reading the first set of data.
private Connection con = DBConnection();
private ResultSet rs = null;
private Statement stmt = null;
public void onLoad()
{
stmt = con.createStatement();
rs = stmt.executeQuery("YOUR-CODE-HERE");
}

and now in the next method go through the rs with each click

A: rs.next() move the cursor to the next available row.thats why it show one record. use while(rs.next())

A: Move one record forward like below
rs.next()

Move through all the 'next' records like below
while(rs.next())

Move back like below
rs.previous()


text:
Q: Delete in HasManyToMany I have three table -
1. Anomaly
2. Markup
3. Anomaly_Markup
Mapping -
    public AnomalyMap()
    {
        Table("anomaly");

        Id(x => x.Id).Column("ID").CustomType("decimal");

        HasManyToMany<DMMarkupData>(x => x.DMMarkupData)
            .Table("anomaly_markup")
            .ParentKeyColumn("ANOMALY_ID")
            .ChildKeyColumn("MARK_UP_ID")
            .Cascade.All()
            .LazyLoad();
    }

    public MarkupDataMap()
    {
        Table("markup");
        Id(x => x.Id).Column("ID");
    }

Condition :

*

*Save data by Anomaly - Anomaly contains MarkupData. It saves data. It is working functionality with me.

*Delete markup - which should delete relationship from map table and markup data. I am facing this issue.

Anyone help me to find out solution, how to delete markup data ?

A: From what you've posted it looks like you haven't defined a relationship on DMMarkupData -> Anomaly, so NHibernate won't know to delete it the MarkupData entries from the anomaly_markup table (despite the reverse relationship being there).  You can either solve it with a database level cascade which removes entries in anomaly_markup when deleting MarkupData, or you can map the relationship in code & NHibernate and then NHibernate will do the cascade for you.

A: I see no relationship of MarkUpData with Anomaly. There must be same relationship and you should specify the control of cascade operation by using Inverse attribute in your mapping.
You can refer : How to set "cascade delete" option to "Set Null" in Fluent NHibernate?
To delete DMMarkupData just remove the object from collection and call for Save Anomaly.

A: NHibernate does not manage the object graph, it only persists it. Removing the item from the list when it gets deleted is responsibility of the business logic!
(All the tricks with triggers and stuff that workaround it lead to inconsistencies and side effects within the transaction which does the change. From point of view of persistence ignorance it is not recommended. I would only do it when facing performance issues that can't be solved in another way.)
You can simplify it by using components. Provided that

*

*you don't reference the same markup from somewhere else

*you don't need to query for markup unrelated to Anomality

*markups do never live outside of an Anomality

given all that, it is much easier to work with components. (I don't know how it is called in fluent, but in xml mapping it is called a "composite-element").
When using components, you don't need to delete the markup from the database. You just remove it from the list where it lives in.


text:
Q: KDB: set difference How can one find set (data structure) difference in KDB?
Example:
a: 1 2 3 4
b: 2 3

expected result: 1 4. Simple guesses like a-b or a _ b do not work.
Thank you very much for your help!

A: You're after the keyword except
q)a:1 2 3 4;b:2 3
q)a except b
1 4

A: Keyword you are looking for is except
except[b;a],except[a;b]
https://code.kx.com/q/ref/except/
Edit: fyi 1 except will not cover all differences if b has values not in a:
q)b,:10
q)except[a;b]
1 4
q)except[a;b],except[b;a]
1 4 10


text:
Q: Assign realm role to service account keycloak I have a service account in master realm. from admin-cli I want to assign the service account master-realm-client admin role. how can I do that.
kcadm.sh add-roles -r master --rolename admin --uusername master-realm-client

OR
kcadm.sh add-roles -r master --rolename admin --cclientid master-realm-client

is not working. kindly help

A: Please use below kcadm command for this
/opt/keycloak/bin/kcadm.sh add-roles --uusername service-account-<CLIENT-ID> --rolename <ROLE-NAME> -r <REALM-NAME>

So it will be look like this
/opt/keycloak/bin/kcadm.sh add-roles --uusername service-account-client --rolename adminRole -r master


text:
Q: Access denied on MessageQueue.GetPrivateQueuesByMachine I'm trying to get the list of available queues on the remote machine. The machine is a Win2003R2 in Workgroup mode, and the client machine that runs the code is a Windows 8 machine both using the same Workgroup name. I get an exception when running the following code:
var messages = MessageQueue.GetPrivateQueuesByMachine("Win2003SRV");

And the error message is:
base {System.Runtime.InteropServices.ExternalException}: {"Access to Message Queuing system is denied."}
Message: "Access to Message Queuing system is denied."
MessageQueueErrorCode: AccessDenied

I'm pretty sure it has something to do with permissions on Windows 2003 but couldn't find  much. The code works fine with another Win Server 2008 (but in workgroup mode) and works with local MSMQ as well. According to the MSDN page, this function is supported on Workgroup mode, so what's the catch?
SOLVED:
My issue turned out to be that I didn't have MSMQ installed on my Client machine! The help on the link pointed me to the right direction, so all I had to do was to install MSMQ on client machine as well. If you look at the implementation of GetPrivateQueuesByMachine, the native call can throw a DllNotFoundException and it is that exception that translates into that specific message, so it should give you a hint on what is wrong

A: John Breakwell who is/was a msmq MVP has a few posts which may help. The problem seems to be caused because the GetPrivateQueuesByMachine() method uses RPC under the hood to communicate between queue managers on different machines.
http://blogs.msdn.com/b/johnbreakwell/archive/2010/03/24/understanding-how-msmq-security-blocks-rpc-traffic.aspx


text:
Q: Swap file problem in partition not working I'm not able to increase my swap file size, I watch a lot of article over internet & I tried as bellow but end of the day it shwoing 2GB only. Here the things that I tried. PLease give me a soluions for this or did I do anything wrong.
 mds@sefat:/$ sudo dd if=/dev/zero of=/swapfile bs=1M count=8192 status=progress
    8282701824 bytes (8.3 GB, 7.7 GiB) copied, 5 s, 1.7 GB/s
    8192+0 records in
    8192+0 records out
    8589934592 bytes (8.6 GB, 8.0 GiB) copied, 5.14598 s, 1.7 GB/s
    mds@sefat:/$ ls
    bin    etc    lib64   opt      run   studio-3t-linux-x64.sh  usr
    boot   home   libx32  Postman  sbin  swapfile                var
    cdrom  lib    media   proc     snap  sys
    dev    lib32  mnt     root     srv   tmp
    mds@sefat:/$ sudo chmod 600 /swapfile
    mds@sefat:/$ sudo mkswap /swapfile
    Setting up swapspace version 1, size = 8 GiB (8589930496 bytes)
    no label, UUID=dbd5b35c-c016-488c-aa09-ff90708bc1ed
    mds@sefat:/$ swapon
    NAME           TYPE      SIZE USED PRIO
    /dev/nvme0n1p2 partition   2G   2G   -2
    mds@sefat:/$ sudo dd if=/dev/nvme0n1p2 of=/swapfile bs=1M count=8192 status=progress
    1863319552 bytes (1.9 GB, 1.7 GiB) copied, 4 s, 466 MB/s
    2048+0 records in
    2048+0 records out
    2147483648 bytes (2.1 GB, 2.0 GiB) copied, 4.7347 s, 454 MB/s
    mds@sefat:/$ swapon
    NAME           TYPE      SIZE USED PRIO
    /dev/nvme0n1p2 partition   2G   2G   -2
    mds@sefat:/$ sudo dd if=/dev/nvme0n1p2 of=/swapfile bs=1M count=8192 status=progress
    1987051520 bytes (2.0 GB, 1.9 GiB) copied, 4 s, 497 MB/s
    2048+0 records in
    2048+0 records out
    2147483648 bytes (2.1 GB, 2.0 GiB) copied, 4.335 s, 495 MB/s
    mds@sefat:/$ swapon
    NAME           TYPE      SIZE USED PRIO
    /dev/nvme0n1p2 partition   2G   2G   -2
    mds@sefat:/$


text:
Q: Normal Distribution Table I have a pretty solid understanding of what a normal variable is but I am having difficulty understanding the graph. For example, what will the normal distribution probability be for these:
z = P(1<X<2)
x = P(-3<X<4)
y = P(X<=-2)
w = P(X>=3)

My attempt:
I got z = .136 , x = .496 , y = 0.023 , and w = .001. I know I am wrong, can you clarify what I did wrong?

A: Judging by your answers, you're using a table that shows the area to the left of a given value of $z$. Your first answer is right: using a $4$-place table, I make it
$$z=0.9772-0.8413=0.1359\;.$$
You seem to have misplaced the decimal point for $y$: I get $0.023$ to three decimal places, or $0.02275$ to four significant figures.
For $w$ you seem to have taken the area to the left of the cutoff 3 instead of to the right: you want $w=1-0.999=0.001$ (actually about $0.001350$). Remember, the table is giving you everything to the left of a given cutoff; if you're interested in $X\ge \text{ some cutoff}$, you need to subtract the table value from $1$ to get the area to the right of the cutoff.
For $x$ you want the table value at $4$ minus the table value at $-3$; I don't know how many places your table gives, but that's about
$$0.99996833-0.001350=0.99861833\;;$$
it appears that you have about half the right value, so you may be using a one-sided table and not compensating properly.
Most people find it helpful to make a rough sketch of the normal curve and mark the cutoff(s) of interest. For $x$, for instance, they would be $-3$ and $4$. Then figure out how to get the area to the left of $4$ and the area to the left of $-3$, and then subtract the latter from the former.
The applet here may be helpful: you can set it to show areas to the left of a cutoff (Up to Z), to the right of a cutoff (Z onwards), or from the centre at $0$ up to some positive cutoff (0 to Z).


text:
Q: C# localdb SHRINKDATABASE command from C# code I'm trying to shrink a LocalDb with Visual Studio 2017 Community. I have a Win7 client windows form application with a small database (~10MB of data) that results into 150MB database size due to LocalDb free space allocation.
I found this answer (Executing Shrink on SQL Server database using command from linq-to-sql) that suggest to use the following code:
context.Database.ExecuteSqlCommand(
    "DBCC SHRINKDATABASE(@file)",
     new SqlParameter("@file", DatabaseTools.Instance.DatabasePathName)
);

DatabaseTools.Instance.DatabasePathName returns the filesystem location of my database from a singleton DatabaseTools class instance.
The code runs, but I keep getting this exception:

System.Data.SqlClient.SqlException: 'Cannot perform a shrinkdatabase operation inside a user transaction. Terminate the transaction and reissue the statement.'

I tried COMMIT before, but no success at all. Any idea on how to effectively shrink database from C# code?
Thanks!

A: As the docs for ExecuteSqlCommand say, "If there isn't an existing local or ambient transaction a new transaction will be used to execute the command.".
This is what's causing your problem, as you cannot call DBCC SHRINKDATABASE in a transaction. Which isn't really surprising, given what it does.
Use the overload that allows you to pass a TransactionalBehavior and specify TransactionalBehavior.DoNotEnsureTransaction:
context.Database.ExecuteSqlCommand(
    TransactionalBehavior.DoNotEnsureTransaction,
    "DBCC SHRINKDATABASE(@file)",
     new SqlParameter("@file", DatabaseTools.Instance.DatabasePathName)
);


text:
Q: how to call jquery from master page in asp.net(vb.net)

<script type="text/javascript">
    $(function () {
        $('#btnSubmit').click(function () {
            var name = $('#txtname').val();
            var subject = $('#txtsubject').val();
            var body = $('#txtbody').val();
            if (name != '' && subject != '' && body) {
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "vbcode.aspx/InsertData",
                    data: "{'username':'" + name + "','subj':'" + subject + "','desc':'" + body + "'}",
                    dataType: "json",
                    success: function (data) {
                        var obj = data.d;
                        if (obj == 'true') {
                            $('#txtname').val('');
                            $('#txtsubject').val('');
                            $('#txtbody').val('');
                            $('#lblmsg').html("Details Submitted Successfully");
                        }
                    },
                    error: function (result) {
                        alert("Error");
                    }
                });
            }
            else {
                alert('Please enter all the fields')
                return false;
            }
        })
    });
</script>
  <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>

this jquery should be called while using master page.but when i use master page it is not working.kindley
give solution for it.when i run this in ordinary web page it is working.

A: Solution 1:
If your button is an ASP.net control with runat="server" and it has the ID set to btnSubmit then you should update this line:
 $('#btnSubmit').click(function () { ... });

with this line:
 $('input[id$="btnSubmit"]').click(function () { ... });

The explanation is simple: Your HTML button will have and ID like to ctl01_btnSubmit, not btnSubmit. You could get the ID using btnSubmit.ClientID but you cannot do this from the master page. You know that will end with btnSubmit and that is what [id$="btnSubmit"] does: it will select the input element having an id that ends with btnSubmit.
Solution 2: As an alternate solution you could only declare your function in the master page and bind it from your pages/controls like this:
$(document).ready(function() {
    $('#<%=btnSubmit.ClientID%>').on("click", function () {
         FunctionFromMasterpage();
    });
});

A: Add JQuery Library Reference in Your Page. Then Add document.ready in Jquery Function Like below.
 $(document).ready(function () {
    $('#btnSubmit').click(function ().........

A: You should add reference to jquery first (ideally in head element) and write jQuery code afterwards. In your case the sequence should be like this:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$('#btnSubmit').click(function(){
//your code goes here
});
</script>


text:
Q: SQL schema optimization, how to avoid unions? Imagine that one have the following schema:

Now in this schema it will have 10000 fridges, 10000 televisions and 10000 computers. Then it will have 5000 spares for each.
To get all spares related to computers, one would query like this:
SELECT SP.name, C.name as computer
FROM spare_parts SP, computer_spare_part CSP, computers C
WHERE   CSP.spare_parts_id = SP.id
AND     CSP.computers_id = C.id

Now with a given spare ID = 1, one wants to get the details and the related object(fridge, tv, computer).
SELECT SP.name, F.name as equipment
FROM spare_parts SP, fridge_spare_part FSP, fridges F
WHERE   FSP.spare_parts_id = SP.id
AND     FSP.fridges_id = F.id
AND     SP.id = 1

UNION

SELECT SP.name, C.name as equipment
FROM spare_parts SP, computer_spare_part CSP, computers C
WHERE   CSP.spare_parts_id = SP.id
AND     CSP.computers_id = C.id
AND     SP.id = 1

UNION

SELECT SP.name, T.name as equipment
FROM spare_parts SP, television_spare_part TSP, television T
WHERE   TSP.spare_parts_id = SP.id
AND     TSP.televisions_id = C.id
AND     SP.id = 1

In this case there are 2 SELECTS that are going to fail. Imagine that spare ID = 1 is related to a computer. The fridge and television SELECT would not get any result.
This will have extra processing time.
How could one optimize this query or schema to solve this kind of problem?

A: Multiple tables for each product and their respective spare parts is bad idea

hard to code properly or with a framework, harder to maintain,
  nightmare to query as well.

So use main tables with same columns and split them accordingly because:

Divides your information into subject-based tables reduce redundant
  data. Apply the normalization rules to check it implemented correctly.

In your case, tables should be
Product (ProductId, ProductName)
ProductDes(ProductId, ProductType)
SpareParts(productid (FK), sparepart_name, brand)

You can enhance them as per requirement now and later without issue. Properly index tables have no issue to process fast.


text:
Q: I am passing anonymous function with Navigator.pushNamed in its body, but it is showing the error - setState() or markNeedsBuild() called during build This is the block of code causing error, if I remove Navigator.pushNamed from the function, no error occurs
 RoundedButton(buttonColor: Colors.lightBlueAccent,buttonText: 'Log In',
                onPress: (){Navigator.pushNamed(context, LoginScreen.id);}, <-- This line is causing error
            ),

This is the code for RoundedButton
class RoundedButton extends StatelessWidget {
  RoundedButton({required this.buttonColor, required  this.buttonText, required this.onPress});

  final Color buttonColor;
  final String buttonText;
  final Function onPress;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.symmetric(vertical: 16.0),
      child: Material(
        elevation: 5.0,
        color: buttonColor,
        borderRadius: BorderRadius.circular(30.0),
        child: MaterialButton(
          onPressed: onPress(),
          minWidth: 200.0,
          height: 42.0,
          child: Text(
            buttonText,
            style: TextStyle(color: Colors.white,),
          ),
        ),
      ),
    );
  }
}

This is the error I am getting
The following assertion was thrown building RoundedButton(dirty): setState() or markNeedsBuild() called during build.
and The widget which was currently being built when the offending call was made was: RoundedButton   dirty The relevant error-causing widget was:    RoundedButton RoundedButton:file:///D:/Flutter%20Projects/flashchat/lib/screens/welcome_screen.dart:86:13
I need to navigate to loginscreeen when the button is pressed but the Navigator is causing error inside the function. I tried putting it inside another function but that too is throwing the same error. Don't know how to navigate to the other screen.
I am following Angela Yu's course and in that it is working absolutely fine. I am runing Flutter version 3.3.10 on Windows 10

A: You are calling the onPress method instead of assigning it. Assign it like this
(the code for RoundedButton):
MaterialButton(
  onPressed: onPress, // instead of onPress()
  minWidth: 200.0,
  height: 42.0,
  child: Text(
    buttonText,
    style: TextStyle(color: Colors.white,),
  ),
)

A: Use VoidCallback instead of type Function  final Function onPress; -> final VoidCallback onPress;


text:
Q: ASP.NET MVC - How to permanently redirect "action?id=5" style url's to "action/5" I have a lot of controllers and actions in my ASP.NET MVC 4 application.
The default route config is:
routes.Add(
    new Route(
        url: "{controller}/{action}/{id}",
        defaults: new RouteValueDictionary(
            new {
                controller = "MyController",
                action = "Home",
                id = UrlParameter.Optional
            }
        ),
        routeHandler: new MvcRouteHandler()
    )
);

Based on this default routing configuration, the actions (methods of controllers) are accessed in the following way:
http://example.com/controller/action/5
However they can also be accessed in the following way:
http://example.com/controller/action?id=5
which is bad for SEO (duplicate content).
Is there any general way to redirect (301) the second request (with query string) into the first one (the one without query strings)?
There are actions having multiple parameters with variable parameter names and I couldn't come up with an easy solution to this.

A: if its for SEO optimization then you can use Canonical Url which will prevent duplicate indexing of your pages by search engine
if you add it on example.com/controller/action?id=5 pages it will serve the purpose of letting the search engines know - to not duplicate it as different content


text:
Q: Linq group by more than two 2 values in datagridviewrow Ihave the following datagridView :

I want to make a group by these three columns :
annee and mois and jour
I tried this:
bool isActiveDuplicate = dg_PanRejet.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["isActive"].Value.ToString() == "2")
                .GroupBy(u => new { u.Cells["annee"], u.Cells["jour"], u.Cells["mois"] })
                .Any(g => g.Count() > 1);

And this:
bool isActiveDuplicate = dg_PanRejet.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["isActive"].Value.ToString() == "2")
                .GroupBy(u => u.Cells["annee"].Value, u=> u.Cells["jour"].Value, u=>u.Cells["fd"].Value)
                .Any(u => u.Count() > 1);

but i am stuck with this following error:

Anonymous type projection initializer should be simple name or member
  access expression

whereas i don't want to create a specific class to match the result of the query because i will only use it once.
Can i achieve this group by without being forced to use member access to a type of a class that i will be creating?
I have to mention that it works fine when i group by one or at most 2 cells like following:
bool duplicate_ista2 = dg_PanRejet.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["annee"].Value.ToString() == "2000")
                .GroupBy(x => x.Cells["mois"].Value)
                .Any(g => g.Count() > 1);

EDIT: this is different from this suggested duplicate question :
because here also we are doing group by 2 columns not more

A:
I want to make a group by these three columns : annee and mois and jour

Let's look at your first implementation.
bool isActiveDuplicate = dg_PanRejet.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["isActive"].Value.ToString() == "2")
                .GroupBy(u => new { u.Cells["annee"], u.Cells["jour"], u.Cells["mois"] })
                .Any(g => g.Count() > 1);

Before even compiling it you should get a few errors, specifically:
 CS0746 Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.

In order to fix this problem, add some simple names for those members, for example:
  .GroupBy(u => new { annee = u.Cells["annee"], jour = u.Cells["jour"], mois = u.Cells["mois"] })

Also, I don't think you may understand, that linq statement is trying to group by DataGridViewRow.Cells object, not what you may want, you are more than likely looking for the value of the cells.
Your second implementation breakdown.
bool isActiveDuplicate = dg_PanRejet.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["isActive"].Value.ToString() == "2")
                .GroupBy(u => u.Cells["annee"].Value, u=> u.Cells["jour"].Value, u=>u.Cells["fd"].Value)
                .Any(u => u.Count() > 1);

You should get a little different error from the first one. It may be along the lines of:
 Can't convert lambda expression to type 'IEqualityComparer<object>...`

The reason is because the GroupBy expression is trying to convert the lambda expression to a IEqualityComparer<object>.
Here's one way to get your results: (comments in code)
 // Get all records that match your where clause into a IEnumerable<DataGridViewRow>.
        var records = dg_PanRejet.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["annee"].Value.ToString() == "2000");
        // Get an IEnumerable<IGrouping<a, DataGridViewRow>> of anonymous type that matches our group by.
        var ienRecords =
            from rec in records
            group rec by new
            {
                annee = rec.Cells["annee"].Value,
                jour = rec.Cells["jour"].Value,
                mois = rec.Cells["mois"].Value
            };
        // Finally do we have duplicates?
        bool dup = ienRecords.Count() > 0;

In the above code, ienRecords contains all records (IEnumerable>) that are grouped by those three fields. dup just holds the operator check of making sure there are duplicates.


text:
Q: Showing the yes-nos is bias
Possible Duplicate:
Voting on Area51 is very biased

Showing the yes-nos is bias. They should be hidden for an unbiased result. (In Area51)

A: I don't think so is just like upvotes in mSOFU

A: Showing it probably does influence subsequent voters, but that's not entirely a negative.
Sure, if those voters blindly fall in line, that's a bad thing.
On the other hand, if all 604 of the votes on a question are in favor of something you were about vote down, or flag as offensive, those votes may help you second guess yourself long enough to read further into the comments and realize that a "woodcock" is a totally legitimate thing to ask about on the Birds StackExchange.
Individuals in smart, analytical communities benefit from the additional information provided by the rest of the hive, just as long as they don't lose sight of the fact that sometimes, rarely, everyone else is wrong.


text:
Q: Find the least common parent in a binary tree? This question might have been asked by a lot of guys but, it is kinda different. We have a binary tree. And you are given two nodes p & q. We have to find the least common parent. But you dont have root node pointer which points to the root. You are provided with two inbuilt functions which are:
1) BOOL same(node *p, node *q); -> returns true if the nodes are same or else false.
2) node* parentNode(node *c); -> returns a node which is the parent of the current node.
If the node c is actually root then parentNode function will return you with aNULL value.
Using the functions we have to find the least common parent of the tree.

A: Step1: Using parentNode function find the distance d1 of the node p from root. similarly find distance d2 of node q from the root. (say, d2 comes out ot be greater than d1)
Step 2: Move the farther node(whose ever d-value was greater) pointer d2-d1 steps towards root.
Step3: Simultaneously move pointers p and q towards root till they point to same node and return that node.
Basically it will be like finding the merge point of two linked-lists.  Check the below link:
Check if two linked lists merge. If so, where?
Time complexity: O(N)
Your code would look somewhat along the lines:

node* LCP(node* p, node *q){
    int d1=0, d2=0;
    for(node* t= p; t; t = parentNode(p), ++d1);
    for(node* t= q; t; t = parentNode(q), ++d2);
    if(d1>d2){
        swap(d1, d2);
        swap(p, q);
    }
    for(int i=0; i<(d2-d1); ++i)
        q = parentNode(q);
    if( same(p, q)){
        return parentNode(p);
    }
    while( !same(p, q)){
        p = parentNode(p);
        q = parentNode(q);
    }
    return p;
}

A: Assuming C++:
node* leastCommonParent(node *p, node *q)
{
    node *pParent = parentNode(p);
    while(pParent != 0)
    {
        node *qParent = parentNode(q);
        while(qParent != 0)
        {
            if (0 == same(pParent, qParent))
                return pParent;
            qParent = parentNode(qParent);
        }
        pParent = parentNode(pParent);
    }
    return 0;
}

UPDATE: A version without explicitly declared variables using recursion follows. I'm sure it can be improved and would probably never use it in production code in the current form.
node* qParent(node *p, node *q)
{
    if (p == 0 || q == 0)
        return 0;
    if (same(p, q) == 0)
        return p;
    return qParent(p, q->parent);
}

node* pParent(node *p, node *q)
{
    return qParent(p, q) ? qParent(p, q) : pParent(p->parent, q);
}

node * result = pParent(p, q);


text:
Q: GMAP.Net Google Satellite map error in C#? Tried to use GMAP.NET in winform using C#, when I set map properties to GoogleSatelliteMapProvider it gives an error. Exception :The remote Server returned in error:(404) Not found.
I am using latest GMAP.Net version. 1.7.0.0
Below please find the code.
private void Form1_Load(object sender, EventArgs e)
    {
        gmap.MapProvider = GMap.NET.MapProviders.GoogleSatelliteMapProvider.Instance;
        GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerAndCache;
        gmap.SetPositionByKeywords("Country_Name");
        gmap.Position = new GMap.NET.PointLatLng(22.63, 71.58);
        gmap.Zoom = 5;
        gmap.MaxZoom = 18;
        gmap.MinZoom = 2;
        gmap.Bearing = 0;
        gmap.CanDragMap = true;
    }

A: you should download the lastest version of GMap.Net, it's 1.7.5. I had the same problem than you and i fixed it with that. To install GMap.NET - Great Maps for Windows Presentation, run the following command in the Package Manager Console:
PM> Install-Package GMap.NET.Presentation


text:
Q: How do I use a NSMutableArray as a DataSource for my UITableView I have an NSMutableArray in with data (hard coded).
I implemented these two TableView methods and in IB, I've set the delegate and datasource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [myArray count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"];

    if (!cell) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"UITableViewCell"] autorelease];
    }

    cell.textLabel.text = [myArray objectAtIndex:[indexPath row]];
    NSLog(@"Cell is %@", [myArray objectAtIndex:indexPath.row]);
    return cell;
}

The data won't appear in the TableView. I've ran NSLog and I can see the data is in myArray.
I added the NSLog to the code and it appears the code never executes. The question is how is my array being created?
Here's the code
- (id)init:(NSMutableArray *)theArray
{
    [super init];
    countryTable.delegate = self;
    countryTable.dataSource = self;

    UITapGestureRecognizer * tapRecognizer = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(viewTapped:)] autorelease];
    [window addGestureRecognizer:tapRecognizer];

    myArray = [[NSMutableArray alloc] init];
    myArray = theArray;
    return self;
}

A: Your basic code is correct, just need to have an array (which you haven't provided here), so this would be one example:
NSMutableArray *myArray = [NSMutableArray arrayWithObjects:@"One",@"Two",@"Three",nil];

And you can NSLog this: NSLog(@"Count: %i, Array: %@",[myArray count], myArray);
Output: Which should return as the cell.textLabel.text per your example

Count: 3, Array: (
      "One",
      "Two",
      "Three"
  )

You should also make sure that you set the UITableViewDelegate and UITableViewDataSource protocols in your header.

A: I don't know if the question is still open but I give it a try.
As I read your code I can't see where countryTable is instantiated so I assume it's connected in InterfaceBuilder? And if this is the case, countryTable is only valid after viewDidLoad.
But you could set delegate and dataSource in InterfaceBuilder as well.
By the way, every once you change the datasource (myArray), call countryTable.reloadData.

A: Try this -
cell.textLabel.text = [[myArray objectAtIndex:indexPath.row] retain];


text:
Q: How do I use a Custom Service in a Web Service Listener Source? I'd like to use a custom service in a Web Service Listener source, but I can't figure out how to do this.
Do I need to write a custom class or interface?
Does that class need to extend or implement anything specific?
After implementing the custom class does the wsdl change or does it use the same wsdl either way?
I'm using Mirth Connect 2.0.1.5164.
Thanks!

A: You need to write a custom class based off of the com.mirth.connect.connectors.ws.DefaultAcceptMessage class.
The easiest way is to download the source code, get Mirth to compile from source, and create a new class from the associated java files needed for this class, eg.
com.somecompany.mirth.connect.connectors.ws.MyAcceptMessage (or something simpler if needed)
You can then customize this class and change the parameters it accepts.
The WSDL will reflect the updated interface.
Frans


text:
Q: How to push local existing folder to remote server via git on windows? Before I install git, I have a local folder /c/kuaipan/Django/exam and a remote server whose ip is 111.11.111.11 and username is root. Now I just want push all contents of exam to server /home/mygit.
So I first create a bare repository /home/git on server then create a repository for loacal exam and push it to server. The infomation seems to be all right. I use ls hoping to see there is a exam folder or contents of it in mygit but there isn't. So what should I do? Where I am wrong.(my git username is "xiangnan" and git email is "280145668@qq.com").
Here is what I try:
# remote server
root@remoteuser:/home# cd mygit
root@remoteuser:/home/mygit# git --bare init
Initialized empty Git repository in /home/mygit/

# local
Administrator@localuser /c/kuaipan/Django/exam (master)
$ git remote add origin ssh://root@111.11.111.11/home/mygit
Administrator@localuser /c/kuaipan/Django/exam (master)
$ git push -u origin master
root@111.11.111.11's password:
Counting objects: 175, done.
Compressing objects: 100% (167/167), done.
Writing objects: 100% (175/175), 418.90 KiB | 0 bytes/s, done.
Total 175 (delta 18), reused 0 (delta 0)
To ssh://root@111.11.111.11/home/mygit
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

# remote server
root@remoteuser:/home/mygit# ls
bin       config       HEAD   include  lib      refs
branches  description  hooks  info     objects

A: By definition, bare repositories don't include a working copy. They're effectively just .git/ directories.
If you want your code to be automatically deployed when you push, you should look into setting up a deploy hook, as described in Deploy a project using Git push.


text:
Q: Is there a way to have managed processes in Perl (i.e. a threads replacement that actually works)? I have a multithreded application in perl for which I have to rely on several non-thread safe modules, so I have been using fork()ed processes with kill() signals as a message passing interface.
The problem is that the signal handlers are a bit erratic (to say the least) and often end up with processes that get killed in inapropriate states.
Is there a better way to do this?

A: Depending on exactly what your program needs to do, you might consider using POE, which is a Perl framework for multi-threaded applications with user-space threads.  It's complex, but elegant and powerful and can help you avoid non-thread-safe modules by confining activity to a single Perl interpreter thread.
Helpful resources to get started:

*

*Programming POE presentation by Matt Sergeant (start here to understand what it is and does)

*POE project page (lots of cookbook examples)

Plus there are hundreds of pre-built POE components you can use to assemble into an application.

A: You can always have a pipe between parent and child to pass messages back and forth.
pipe my $reader, my $writer;
my $pid = fork();
if ( $pid == 0 ) {
    close $reader;
    ...
}
else {
    close $writer;
    my $msg_from_child = <$reader>;
    ....
}

Not a very comfortable way of programming, but it shouldn't be 'erratic'.

A: Have a look at forks.pm, a "drop-in replacement for Perl threads using fork()" which makes for much more sensible memory usage (but don't use it on Win32).  It will allow you to declare "shared" variables and then it automatically passes changes made to such variables between the processes (similar to how threads.pm does things).

A: From perl 5.8 onwards you should be looking at the core threads module. Have a look at http://metacpan.org/pod/threads
If you want to use modules which aren't thread safe you can usually load them with a require and import inside the thread entry point.


text:
Q: WDQS - Query is malformed I started today with WDQS, so sorry if I'm missing something obvious
I'm trying to get all items that are an instance of Q9143 (programing language)
PREFIX wd: <http://www.wikidata.org/entity/>

SELECT ?item
WHERE
{
 ?item wd:Q9143
}

Error: Query is malformed: Encountered " "." ". "" at line 6, column
17.

A: The statements in your WHERE clause must be triples so include a variable for the property.
PREFIX wd: <http://www.wikidata.org/entity/>

SELECT ?item
WHERE
{
 ?item ?prop wd:Q9143 .
}

The sample query at https://www.wikidata.org/wiki/Wikidata:WikiProject_Informatics/Programming_Language/list might give you some ideas.


text:
Q: how can i stop transition to next screen in kivy I have a login page and a button when it pressed ,its go to next screen ,I use on_press
I want to print something when the username and password is false and don't go to the next screen:
<loginView>:

    status:result
    Label:
            text:"Login"
            pos : 0,250
            font_size:40

    Label:
            text:"Username"
            pos:-75,125

    Label:
            text:"Password"
            pos:-75,50

    TextInput:
            multiline:False
            pos:400,400
            size_hint:.2,.08
            font_size:20
            id:username

    TextInput:
            multiline:False
            pos:400,325
            password:True
            size_hint:.2,.08
            font_size:20
            id:password
    Button:

            text:"Login"
            size_hint:.1,.07
            pos:290,270
            color:1,0,0,1

            on_press:root.manager.current ='settings'
    Label:
            text:""
            pos:600,100
            id:result

<afterLogin>:
        ScrollView:
                GridLayout:
                        pos: 0, 0
                        size: 100, 100
                        cols: 1
                        rows: 70
                        on_parent:
                                orientation:'vertical'
                                [self.add_widget(Button(text=str(i))) for i in range(1, 70)]

                        size_hint:.5, 4
                        size:300,300

A: There are two methods for the solution i.e. check user's name and password either in Python code or kv file.
Method 1
Checking in kv file.
snippet
on_press:
    if username.text == 'user' and password.text == 'kivy': \
    result.text = ''; \
    root.manager.current = 'settings'
    else: result.text = 'Invalid username and/or password!'

Method 2
Changes to kv file and implement a new method called, authentication()
Python code
class LoginView(Screen):
    status = ObjectProperty(None)

    def authentication(self):
        if self.ids.username.text == "admin" and self.ids.password.text == "kivy":
            self.status.text = ''
            self.manager.current = 'settings'
        else:
            self.status.text = "Invalid username and/or password!"

kv file
on_press:
    root.authentication()


text:
Q: Using regex_replace on bracketed expression Gal: a small c++ program to convert maple output to valid mathematica input.
The problem: bracketed expressions as the following example:
sin(-1/(-1+x)/x) should become sin[-1/(-1+x)/x]
As you can see, the only the brackets for the sin function itself should be replaced. Is there a way to do so without touching the inner content of the brackets, using regex_replace()? I was unable to come up with it myself.
The actual input will be much longer expressions, with files up to several kb in size. Hence the need for an efficient conversion.
Thank you in advance!

A: If you have Maple output because you are generating it in Maple, then perhaps you can generate the desired output at the same time.
It's hard to make it more generally applicable to your wider goal with just the one brief example.
The use of single right-quotes and the 1-level eval calls are to prevent unwanted evaluation (eg. Maple would pull out the leading minus sign from the sin call otherwise).
ee := 'sin'(-1/(-1+x)/x):

lprint( eval(ee,1) );
  sin(-1/(-1+x)/x)

ff := subsindets(eval(ee,1),specfunc(sin),u->'Sin'[op(u)]):

lprint( eval(ff,1) );
  Sin[-1/(-1+x)/x]

sprintf("%a", eval(ff,1) );

           "Sin[-1/(-1+x)/x]"

Or, if your original is a string rather than an unevaluated function call,
restart;

s:="sin(-1/(-1+x)/x)";

        s := "sin(-1/(-1+x)/x)"

gg:=parse(s):

lprint( eval(gg,1) );
  sin(-1/(-1+x)/x)

ff := subsindets(eval(gg,1),specfunc(sin),u->'Sin'[op(u)]):

lprint( eval(ff,1) );
  Sin[-1/(-1+x)/x]

sprintf("%a", eval(ff,1) );

          "Sin[-1/(-1+x)/x]"


text:
Q: Hashing function for four unsigned integers (C++) I'm writing a program right now which produces four unsigned 32-bit integers as output from a certain function. I'm wanting to hash these four integers, so I can compare the output of this function to future outputs.
I'm having trouble writing a decent hashing function though. When I originally wrote this code, I threw in a simple addition of each of the four integers, which I knew would not suffice. I've tried several other techniques, such as shifting and adding, to no avail. I get a hash, but it's of poor quality, and the function generate a ton of collisions.
The hash output can be either a 32-bit or 64-bit integer. The function in question generates many billions of hashes, so collisions are a real problem here, and I'm willing to use a larger variable to ensure that there are as few collisions as possible.
Can anyone help me figure out how to write a quality hash function?

A: Why don't you store the four integers in a suitable data structure and compare them all? The benefit of hashing them in this case appears dubious to me, unless storage is a problem.
If storage is the issue, you can use one of the hash functions analyzed here.

A: Here's a fairly reasonable hash function from 4 integers to 1 integer:
unsigned int hash = in[0];
hash *= 37;
hash += in[1];
hash *= 37;
hash += in[2];
hash *= 37;
hash += in[3];

With uniformly-distributed input it gives uniformly-distributed output. All bits of the input participate in the output, and every input value (although not every input bit) can affect every output bit. Chances are it's faster than the function which produces the output, in which case no performance concerns.
There are other hashes with other characteristics, but accumulate-with-multiplication-by-prime is a good start until proven otherwise. You could try accumulating with xor instead of addition if you like. Either way, it's easy to generate collisions (for example {1, 0, a, b} collides with {0, 37, a, b} for all a, b), so you might want to pick a prime which you think has nothing to do with any plausible implementation bug in your function. So if your function has a lot of modulo-37 arithmetic in it, maybe use 1000003 instead.

A: Because hashing can generate collisions, you have to keep the keys in memory anyway in order to discover these collisions. Hashmaps and other standard datastructures do do this in their internal bookkeeping.
As the key is so small, just use the key directly rather than hashing.  This will be faster and will ensure no collisions.

A: I fully agree with Vinko - just compare them all. If you still want a good hashing function, you need to analyse the distribution of your 4 unsinged integers. Then you have to craft your hashing function in a way, that the result will be even distributed over the whole range of the 32 bit hashing value.
A simple example - let's just assume that most of the time, the result from each function is in the range from 0 to 255. Then you could easily blend the lower 8 bits from each function into your hash. Most of the time, you'd finde the result directly, just sometimes (when one function returns a larger result) you'd have a collision.
To sum it up - without information how the results of the 4 functions are distributed, we can't help you with a good hashing function.

A: Why a hash? It seems like a std::set or std::multi set would be better suited to store this kind of output.  All you'd need to do is wrap the four integers up in a struct and write a simple compare function.

A: Try using CRC or FNV.  FNV is nice because it is fast and has a defined method of folding bits to get "smaller" hash values (i.e. 12-bit / 24-bit / etc).
Also the benefit of generating a 64-bit hash from a 128-bit (4 X 32-bit) number is a bit questionable because as other people have suggested, you could just use the original value as a key in a set.  You really want the number of bits in the hash to represent the number of values you originally have.  For example, if your dataset has 100,000 4X32-bit values, you probably want a 17-bit or 18-bit hash value, not a 64-bit hash.

A: Might be a bit overkill, but consider Boost.Hash. Generates very simple code and good values.


text:
Q: Simple hashmap implementation in C++ I'm relatively new to C++. In Java, it's easy for me to instantiate and use a hashmap. I'd like to know how to do it in a simple way in C++, since I saw many different implementations and none of them looked simple to me.

A: Take a look at boost.unordered, and its data structure.

A: Try boost's unordered classes.

A: Most compilers should define std::hash_map for you; in the coming C++0x standard, it will be part of the standard library as std::unordered_map. The STL Page on it is fairly standard. If you use Visual Studio, Microsoft has a page on it.
If you want to use your class as the value, not as the key, then you don't need to do anything special. All primitive types (things like int, char, bool and even char *) should "just work" as keys in a hash_map. However, for anything else you will have to define your own hashing and equality functions and then write "functors" that wrap them in a class.
Assuming your class is called MyClass and you have already defined:
size_t MyClass::HashValue() const { /* something */ }
bool MyClass::Equals(const MyClass& other) const { /* something */ }

You will need to define two functors to wrap those methods in objects.
struct MyClassHash {
  size_t operator()(const MyClass& p) const {
    return p.HashValue();
  }
};

struct MyClassEqual {
  bool operator()(const MyClass& c1, const MyClass& c2) const {
    return c1.Equals(c2);
  }
};

And instantiate your hash_map/hash_set as:
hash_map<MyClass, DataType, MyClassHash, MyClassEqual> my_hash_map;
hash_set<MyClass, MyClassHash, MyClassEqual> my_hash_set;

Everything should work as expected after that.

A: Check out Simple Hash Map (Hash Table) Implementation in C++ for a basic Hash Table with generic type key-value pairs and separate chaining strategy.

A: Using hashmaps in C++ is easy! It's like using standard C++ map. You can use your's compiler/library implementation of unordered_map or use the one provided by boost, or some other vendor. Here's a quick sample. You will find more if you follow the links you were given.
#include <unordered_map>
#include <string>
#include <iostream>

int main()
{
    typedef std::tr1::unordered_map< std::string, int > hashmap;
    hashmap numbers;

    numbers["one"] = 1;
    numbers["two"] = 2;
    numbers["three"] = 3;

    std::tr1::hash< std::string > hashfunc = numbers.hash_function();
    for( hashmap::const_iterator i = numbers.begin(), e = numbers.end() ; i != e ; ++i ) {
        std::cout << i->first << " -> " << i->second << " (hash = " << hashfunc( i->first ) << ")" << std::endl;
    }
    return 0;
}


text:
Q: New GDB issues with QGIS 3.8 I just got a new MacBook Pro and installed QGIS 3.8 yesterday. I had several GDBs working on Ubuntu and QGIS 3.4 but that same GDB will not import in 3.8 on the MacBook Pro. They are vector layer databases and not raster files.
I've been converting the GDB to GeoPackages (on the Unbuntu/QGIS 3.4) which are much faster and flexible. But I can't get much to work on the MacBook in the way of the GDB files.
I used the new package installer from the QGIS download page and noticed it streamlined the installation from previous MacOS installs but I'm wondering if maybe the 3.8 package was ready for distribution yet.


text:
Q: How to compute: $\int_{0}^1\int_{-1}^{1}(u\sqrt{4v^2+1}+v)dvdu$ How would I compute this integral? I'm having trouble figuring out what to do with the radical
$$ \int_{0}^1\int_{-1}^{1}(u\sqrt{4v^2+1}+v)dvdu$$

A: Since $\int_{-1}^1vdv =0$ we have, $$\int_{0}^1\int_{-1}^{1}(u(4v^2+1)^{1/2}+v)dvdu =2\int_{0}^1u\int_{0}^{1}(4v^2+1)^{1/2}dvdu = \int_{0}^{1}(4v^2+1)^{1/2}dv$$
Now set $2v = \sinh t$ that is $\color{red}{dv=\frac12\cosh t dt}$
$$\int_{0}^{1}(4v^2+1)^{1/2}dv = \frac12\int_{0}^{\sinh^{-1}(2) }(\sinh^2+1)^{1/2}\cosh t dt \\= \frac12\int_{0}^{\sinh^{-1}(2) }\cosh^2 t dt$$
then can you take it from here?

A: Well, we have:
$$\mathscr{I}_{\space\text{n}}\left(\text{a},\text{b}\right):=\int_0^\text{a}\int_{-\text{b}}^\text{b}\left(x+\text{y}\cdot\sqrt{1+\text{n}\cdot x^2}\right)\space\text{d}x\space\text{d}\text{y}=$$
$$\int_0^\text{a}\left\{\int_{-\text{b}}^\text{b}x\space\text{d}x+\text{y}\cdot\int_{-\text{b}}^\text{b}\sqrt{1+\text{n}\cdot x^2}\space\text{d}x\right\}\space\text{d}\text{y}\tag1$$
Now, using:

*

*$$\int_{-\text{b}}^\text{b}x\space\text{d}x=\left[\frac{x^2}{2}\right]_{-\text{b}}^\text{b}=\frac{\text{b}^2}{2}-\frac{\left(-\text{b}\right)^2}{2}=\frac{\text{b}^2-\text{b}^2}{2}=\frac{0}{2}=0\tag2$$

*Substitute $\text{u}:=\arctan\left(x\cdot\sqrt{\text{n}}\right)$, so we get:
$$\int_{-\text{b}}^\text{b}\sqrt{1+\text{n}\cdot x^2}\space\text{d}x=\frac{1}{\sqrt{\text{n}}}\cdot\int_{\arctan\left(-\text{b}\cdot\sqrt{\text{n}}\right)}^{\arctan\left(\text{b}\cdot\sqrt{\text{n}}\right)}\sec^3\left(\text{u}\right)\space\text{d}\text{u}=$$
$$\frac{1}{\sqrt{\text{n}}}\cdot\int_{-\arctan\left(\text{b}\cdot\sqrt{\text{n}}\right)}^{\arctan\left(\text{b}\cdot\sqrt{\text{n}}\right)}\sec^3\left(\text{u}\right)\space\text{d}\text{u}\tag3$$

*$$\int_{-\arctan\left(\text{b}\cdot\sqrt{\text{n}}\right)}^{\arctan\left(\text{b}\cdot\sqrt{\text{n}}\right)}\sec^3\left(\text{u}\right)\space\text{d}\text{u}=$$
$$\frac{1}{2}\cdot\left\{2\cdot\text{b}\cdot\sqrt{\text{n}}\cdot\sqrt{1+\text{b}^2\cdot\text{n}}+\ln\left|\frac{\sqrt{1+\text{b}^2\cdot\text{n}}+\text{b}\cdot\sqrt{\text{n}}}{\sqrt{1+\text{b}^2\cdot\text{n}}-\text{b}\cdot\sqrt{\text{n}}}\right|\right\}\tag4$$

So, we get:
$$\mathscr{I}_{\space\text{n}}\left(\text{a},\text{b}\right)=\mathcal{I}_1+\mathcal{I}_1\tag5$$
Where:

*

*$$\mathcal{I}_1:=\int_0^\text{a}\text{y}\cdot\frac{1}{\sqrt{\text{n}}}\cdot\text{b}\cdot\sqrt{\text{n}}\cdot\sqrt{1+\text{b}^2\cdot\text{n}}\space\text{d}\text{y}=$$
$$\frac{1}{\sqrt{\text{n}}}\cdot\text{b}\cdot\sqrt{\text{n}}\cdot\sqrt{1+\text{b}^2\cdot\text{n}}\cdot\int_0^\text{a}\text{y}\space\text{d}\text{y}=$$
$$\frac{1}{\sqrt{\text{n}}}\cdot\text{b}\cdot\sqrt{\text{n}}\cdot\sqrt{1+\text{b}^2\cdot\text{n}}\cdot\frac{\text{a}^2}{2}=$$
$$\frac{\text{a}^2\cdot\text{b}}{2}\cdot\sqrt{1+\text{b}^2\cdot\text{n}}\tag6$$

*$$\mathcal{I}_2:=\int_0^\text{a}\frac{\text{y}}{2}\cdot\ln\left|\frac{\sqrt{1+\text{b}^2\cdot\text{n}}+\text{b}\cdot\sqrt{\text{n}}}{\sqrt{1+\text{b}^2\cdot\text{n}}-\text{b}\cdot\sqrt{\text{n}}}\right|\space\text{d}\text{y}=$$
$$\frac{1}{2}\cdot\ln\left|\frac{\sqrt{1+\text{b}^2\cdot\text{n}}+\text{b}\cdot\sqrt{\text{n}}}{\sqrt{1+\text{b}^2\cdot\text{n}}-\text{b}\cdot\sqrt{\text{n}}}\right|\cdot\int_0^\text{a}\text{y}\space\text{d}\text{y}=$$
$$\frac{1}{2}\cdot\ln\left|\frac{\sqrt{1+\text{b}^2\cdot\text{n}}+\text{b}\cdot\sqrt{\text{n}}}{\sqrt{1+\text{b}^2\cdot\text{n}}-\text{b}\cdot\sqrt{\text{n}}}\right|\cdot\frac{\text{a}^2}{2}=$$
$$\frac{\text{a}^2}{4}\cdot\ln\left|\frac{\sqrt{1+\text{b}^2\cdot\text{n}}+\text{b}\cdot\sqrt{\text{n}}}{\sqrt{1+\text{b}^2\cdot\text{n}}-\text{b}\cdot\sqrt{\text{n}}}\right|\tag7$$

So:
$$\mathscr{I}_{\space\text{n}}\left(\text{a},\text{b}\right)=\frac{\text{a}^2\cdot\text{b}}{2}\cdot\sqrt{1+\text{b}^2\cdot\text{n}}+\frac{\text{a}^2}{4}\cdot\ln\left|\frac{\sqrt{1+\text{b}^2\cdot\text{n}}+\text{b}\cdot\sqrt{\text{n}}}{\sqrt{1+\text{b}^2\cdot\text{n}}-\text{b}\cdot\sqrt{\text{n}}}\right|\tag8$$


text:
Q: using this in json-styled javascript Recently, I'm coding javascript with little knowledge of it.
And here's my first javascript code which written this morning.
$(window).load(function(){
    SubMenuHandler.init();
});

var SubMenuHandler = {
    init : function() {
        $("#statisticManager, #deviceManager, #policyManager").click(
            function(event) {
                var url = SubMenuHandler.getUrlFromEvent(event); // <-- These two
                SubMenuHandler.redirectPage(url);                // <-- lines
            }
        );
    },
    redirectPage : function(url) {
        $(location).attr("href", url);
    },
    getUrlFromEvent : function(event) {
        var target = event.target;
        var url = $(target).data("url");
        return url;
    }
}

As you can see, SubMenuHandler is called recursively in the class.
But, I don't see how this is done as good. From my experiences with other languages, they usually use the this keyword instead of using the full name of class, except when accessing static variables.
Is there similar or better way to do this job?

A: init : function() {
    var me = this; // <----- this is the magic
    $("#statisticManager, #deviceManager, #policyManager").click(
        function(event) {
            var url = me.getUrlFromEvent(event);

            me.redirectPage(url);
        }
    );
},

It is called "closures"
The random link from google: http://www.javascriptkit.com/javatutors/closures.shtml
And perfect answer here on SO: https://stackoverflow.com/a/111200/251311


text:
Q: Comprehensive Theming Failed - AttributeError: Namespace '__anon_0x7f3dc61e5950' has no member 'stanford_theme_enabled' I am new to OpenEdx and I have setup my system using the Bitnami stack. But I cant seem to be able to setup custom comprehensive theming. LMS throws Internal Server Error. I have below my tailed server log
Here's what I have done so far.

*

*Downloaded theme from - https://themex.io/

*Set COMPREHENSIVE_THEME_DIR = "/path-to-theme"

*Ran SERVICE_VARIANT=lms ./bin/paver.edxapp update_assets lms --settings=aws and this finished successfully

*Launch LMS, 500 Internal Server Error

What am I doing wrong?
[Mon Sep 12 05:10:14.551555 2016] [:error] [pid 31981] [remote 127.0.0.1:512]     runtime._include_file(context, (static.get_themed_template_path(relative_path='theme-header.html', default_path='navigation.html')), _template_uri)
[Mon Sep 12 05:10:14.551570 2016] [:error] [pid 31981] [remote 127.0.0.1:512]   File "/home/harrypalace/manjaro_vlp/apps/edx/edx-platform/venv/lib/python2.7/site-packages/mako/runtime.py", line 752, in _include_file
[Mon Sep 12 05:10:14.551592 2016] [:error] [pid 31981] [remote 127.0.0.1:512]     callable_(ctx, **_kwargs_for_include(callable_, context._data, **kwargs))
[Mon Sep 12 05:10:14.551607 2016] [:error] [pid 31981] [remote 127.0.0.1:512]   File "/home/harrypalace/manjaro_vlp/.tmp/mako_lms/a2ab4a911ea1f0731584a3dbc36a191f/navigation.html.py", line 48, in render_body
[Mon Sep 12 05:10:14.551630 2016] [:error] [pid 31981] [remote 127.0.0.1:512]     _mako_get_namespace(context, '__anon_0x7f3dc61e5950')._populate(_import_ns, [u'login_query', u'stanford_theme_enabled'])
[Mon Sep 12 05:10:14.551645 2016] [:error] [pid 31981] [remote 127.0.0.1:512]   File "/home/harrypalace/manjaro_vlp/apps/edx/edx-platform/venv/lib/python2.7/site-packages/mako/runtime.py", line 525, in _populate
[Mon Sep 12 05:10:14.551667 2016] [:error] [pid 31981] [remote 127.0.0.1:512]     d[ident] = getattr(self, ident)
[Mon Sep 12 05:10:14.551688 2016] [:error] [pid 31981] [remote 127.0.0.1:512]   File "/home/harrypalace/manjaro_vlp/apps/edx/edx-platform/venv/lib/python2.7/site-packages/mako/runtime.py", line 625, in __getattr__
[Mon Sep 12 05:10:14.551711 2016] [:error] [pid 31981] [remote 127.0.0.1:512]     (self.name, key))
[Mon Sep 12 05:10:14.551736 2016] [:error] [pid 31981] [remote 127.0.0.1:512] AttributeError: Namespace '__anon_0x7f3dc61e5950' has no member 'stanford_theme_enabled'

A: You should take a look at the guide below:
How to Install a Custom Theme
It describes the process to follow in order to install a custom them on Bitnami OpenEDX.


text:
Q: How to set groupindicator in android? Is there a way to set the group indicator image in expandablelistview in android?
I want to set the image of a especific item group. Is there a way?

A: If you want to put your group indicator to the left of the group item you can add the following property to your expandable listview code in xml .. "android:groupIndicator"
Otherwise if you want to get this indicator into the right side of your listview you can follow this post Put on the right the indicator of an ExpandableListView in Android


text:
Q: Automatically update comment votes Question and answer vote counts update automatically now, which is nice.
Could the comment votes do the same? It's a confusing inconsistency at the moment that I have to F5 for one and not the others.


text:
Q: Visualize multiple times series in R I'm writing a seminar paper about the topic of forecasting NO2 (h=2) data. My dataset includes 130 timeseries (balanced panel) from 2010 to 2012. At the moment I'm struggling to find a suitable way to visualize that large data set in R. My goal at this stage of my paper is to do explorative/descriptive monitoring of those series (ACF/PACF, time series plots and component plost). For example I try to examine if characteritics of the time series change over time.
Already, I read the "Forecasting: Principles and Practice" book by Rob J Hyndman and George Athanasopoulos and Roger D. Peng's paper "A Method for Visualizing Multivariate Time Series Data". Unfortunately I still need your advice on the topic.

A: Rob Hyndman's presentation on "Visualization of big time series data" might give you some ideas for how to proceed: https://robjhyndman.com/seminars/big-time-series/. In his proposed approach, Rob Hyndman constructs a vector of features for each time series, where the features measure characteristics of that series: lag correlation, strength of seasonality, spectral entropy, etc. Then he uses a principal component decomposition on the features, and plots the first few principal components so that he can explore a lower dimensional space and discover interesting structure and unusual observations. See also: https://github.com/robjhyndman/anomalous.
Roger Peng's article on A Method for Visualizing Multivariate Time Series Data might be useful too: https://www.jstatsoft.org/article/view/v025c01/v25c01.pdf.
See also: https://arxiv.org/pdf/1708.07942.pdf.


text:
Q: How to access protected operator members in C++ How to access protected operator members in C++
class A {
   char* m="ABCD";
  protected:
   const char& operator[](int i)const{ return m[i]; };
public:
A();
};

class B : Public A {
   char* D;
  Public:
B():A(){};
void display(){  ///////////what should I do here   }
};

If I have this code, and I want to use the operator [] inside the derived class, for example I need to display [0]=A inside the display from derived class. What's the solution here.

A: You can dereference this this object from within the member function and use the [] operator, i.e.:
void display(){  std::cout << (*this)[1];  }