text:
Q: What is main difference between hyperledge Fabric 0.6、1.0 and 1.1 version? What is the main goal to modify fabric source code from 0.6 version to 1.1?
what is the most important change logs ? Architecture? Please describe or provide some important reference!

A: Each release is accompanied by changelog entries linking to the JIRA issues closed (representing every commit), and we also publish release notes in two places: on the GitHub repositories (fabric, fabric-ca, fabric-sdk-node, fabric-sdk-java, fabric-chaincode-node) and in the documentation that uplevel to a more human accessible description of the major new features or changes.
tl;dr: v0.6 -> v1.0.0 was a major re-architecture of the consensus model and added support for channels. v1.1.0 -> v1.1.0 is a series of performance and scale improvements, added support for Javascript (Node.js) chaincode, added support for CouchDB and attribute based access control and a few other features, but is forward compatible with v1.0.x releases and can be upgraded in place.


text:
Q: Trouble in adding data using set method in C# Hello I am trying to work on a project where the application opens .csv file and read data from it and shows different point in a static map. I also would like to add an option for users to add latitude, longitude etc in the data list. Listview in the application appears only when a .csv file is opened. But I am having difficulty adding new gps point to the .csv file. my codes are given here
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace CourseworkExample
{
    public partial class Form1 : Form
    {
        public GPSDataPoint gpsdp;
        List<GPSDataPoint> data;
        List<PictureBox> pictures;
        List<TabPage> tabs;
        public static int pn = 0;
        private TabPage currentComponent;
        private Bitmap bmp1;
        string[] symbols = {  "hospital", "university" };
        Image[] symbolImages;
        ListBox lb = new ListBox();

        public Form1()
        {
            InitializeComponent();
            data = new List<GPSDataPoint>();
            pictures = new List<PictureBox>();
            tabs = new List<TabPage>();
            symbolImages = new Image[symbols.Length];
            for (int i = 0; i < 2; i++)
            {
                string location = "data/" + symbols[i] + ".png";
                symbolImages[i] = Image.FromFile(location);

            }
        }

        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FileDialog ofd = new OpenFileDialog();
            string filter = "CSV File (*.csv)|*.csv";
            ofd.Filter = filter;
            DialogResult dr = ofd.ShowDialog();
            if (dr.Equals(DialogResult.OK))
            {
                int i = ofd.FileName.LastIndexOf("\\");

                string name = ofd.FileName;
                string path = ofd.FileName;
                if (i > 0)
                {
                    name = ofd.FileName.Substring(i + 1);
                    path = ofd.FileName.Substring(0, i + 1);
                }
                TextReader input = new StreamReader(ofd.FileName);
                string mapName = input.ReadLine();
                GPSDataPoint gpsD = new GPSDataPoint();
                gpsD.setBounds(input.ReadLine());
                string s;
                while ((s = input.ReadLine()) != null)
                {
                    gpsD.addWaypoint(s);
                }
                input.Close();
                TabPage tabPage = new TabPage();
                tabPage.Location = new System.Drawing.Point(4, 22);
                tabPage.Name = "tabPage" + pn;
                ListBox lb = new ListBox();
                lb.Width = 300;
                int selectedindex = lb.SelectedIndex;

                lb.Items.Add(mapName);
                lb.Items.Add("Bounds");
                lb.Items.Add(gpsD.Bounds[0] + " " + gpsD.Bounds[1] + " " + gpsD.Bounds[2] + " " + gpsD.Bounds[3]);
                lb.Items.Add("Waypoint");
                foreach (WayPoint wp in gpsD.DataList)
                {
                    lb.Items.Add(wp.Name + " " + wp.Latitude + " " + wp.Longitude + " " + wp.Ele + " " + wp.Sym);
                }
                tabPage.Controls.Add(lb);
                pn++;
                tabPage.Padding = new System.Windows.Forms.Padding(3);
                tabPage.Size = new System.Drawing.Size(192, 74);
                tabPage.TabIndex = 0;
                tabPage.Text = name;
                tabPage.UseVisualStyleBackColor = true;
                tabs.Add(tabPage);
                tabControl1.Controls.Add(tabPage);
                tabPage = new TabPage();
                tabPage.Location = new System.Drawing.Point(4, 22);
                tabPage.Name = "tabPage" + pn;
                pn++;
                tabPage.Padding = new System.Windows.Forms.Padding(3);
                tabPage.Size = new System.Drawing.Size(192, 74);
                tabPage.TabIndex = 0;
                tabPage.Text = mapName;
                string location = path + mapName;
                tabPage.UseVisualStyleBackColor = true;
                tabs.Add(tabPage);
                PictureBox pb = new PictureBox();
                pb.Name = "pictureBox" + pn;
                pb.Image = Image.FromFile(location);
                tabControl2.Controls.Add(tabPage);
                pb.Width = pb.Image.Width;
                pb.Height = pb.Image.Height;
                tabPage.Controls.Add(pb);
                currentComponent = tabPage;
                tabPage.Width = pb.Width;
                tabPage.Height = pb.Height;
                pn++;
                tabControl2.Width = pb.Width;
                tabControl2.Height = pb.Height;
                bmp1 = (Bitmap)pb.Image;
                int lx, ly;
                float realWidth = gpsD.Bounds[1] - gpsD.Bounds[3];
                float imageW = pb.Image.Width;
                float dx = imageW * (gpsD.Bounds[1] - gpsD.getWayPoint(0).Longitude) / realWidth;
                float realHeight = gpsD.Bounds[0] - gpsD.Bounds[2];
                float imageH = pb.Image.Height;
                float dy = imageH * (gpsD.Bounds[0] - gpsD.getWayPoint(0).Latitude) / realHeight;
                lx = (int)dx;
                ly = (int)dy;

                using (Graphics g = Graphics.FromImage(bmp1))
                {
                    Rectangle rect = new Rectangle(lx, ly, 20, 20);
                    if (gpsD.getWayPoint(0).Sym.Equals(""))
                    {
                        g.DrawRectangle(new Pen(Color.Red), rect);
                    }
                    else
                    {
                        if (gpsD.getWayPoint(0).Sym.Equals("hospital"))
                        {
                            g.DrawImage(symbolImages[0], rect);
                        }
                        else
                        {
                            if (gpsD.getWayPoint(0).Sym.Equals("university"))
                            {
                                g.DrawImage(symbolImages[1], rect);
                            }
                        }
                    }
                }
                pb.Image = bmp1;
                pb.Invalidate();

            }
        }

        private void openToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            FileDialog ofd = new OpenFileDialog();
            string filter = "CSV File (*.csv)|*.csv";
            ofd.Filter = filter;
            DialogResult dr = ofd.ShowDialog();
            if (dr.Equals(DialogResult.OK))
            {
                int i = ofd.FileName.LastIndexOf("\\");

                string name = ofd.FileName;
                string path = ofd.FileName;
                if (i > 0)
                {
                    name = ofd.FileName.Substring(i + 1);
                    path = ofd.FileName.Substring(0, i + 1);
                }
                TextReader input = new StreamReader(ofd.FileName);
                string mapName = input.ReadLine();
                GPSDataPoint gpsD = new GPSDataPoint();
                gpsD.setBounds(input.ReadLine());
                string s;
                while ((s = input.ReadLine()) != null)
                {
                    gpsD.addWaypoint(s);
                }
                input.Close();
                TabPage tabPage = new TabPage();
                tabPage.Location = new System.Drawing.Point(4, 22);
                tabPage.Name = "tabPage" + pn;
                ListBox lb = new ListBox();
                lb.Width = 300;
                lb.Items.Add(mapName);
                lb.Items.Add("Bounds");
                lb.Items.Add(gpsD.Bounds[0] + " " + gpsD.Bounds[1] + " " + gpsD.Bounds[2] + " " + gpsD.Bounds[3]);
                lb.Items.Add("Waypoint");
                foreach (WayPoint wp in gpsD.DataList)
                {
                    lb.Items.Add(wp.Name + " " + wp.Latitude + " " + wp.Longitude + " " + wp.Ele + " " + wp.Sym);
                }
                tabPage.Controls.Add(lb);
                pn++;
                tabPage.Padding = new System.Windows.Forms.Padding(3);
                tabPage.Size = new System.Drawing.Size(192, 74);
                tabPage.TabIndex = 0;
                tabPage.Text = name;
                tabPage.UseVisualStyleBackColor = true;
                tabs.Add(tabPage);
                tabControl1.Controls.Add(tabPage);
                tabPage = new TabPage();
                tabPage.Location = new System.Drawing.Point(4, 22);
                tabPage.Name = "tabPage" + pn;
                pn++;
                tabPage.Padding = new System.Windows.Forms.Padding(3);
                tabPage.Size = new System.Drawing.Size(192, 74);
                tabPage.TabIndex = 0;
                tabPage.Text = mapName;
                string location = path + mapName;
                tabPage.UseVisualStyleBackColor = true;
                tabs.Add(tabPage);
                PictureBox pb = new PictureBox();
                pb.Name = "pictureBox" + pn;
                pb.Image = Image.FromFile(location);
                tabControl2.Controls.Add(tabPage);
                pb.Width = pb.Image.Width;
                pb.Height = pb.Image.Height;
                tabPage.Controls.Add(pb);
                currentComponent = tabPage;
                tabPage.Width = pb.Width;
                tabPage.Height = pb.Height;
                pn++;
                tabControl2.Width = pb.Width;
                tabControl2.Height = pb.Height;
                bmp1 = (Bitmap)pb.Image;
                int lx, ly;
                float realWidth = gpsD.Bounds[1] - gpsD.Bounds[3];
                float imageW = pb.Image.Width;
                float dx = imageW * (gpsD.Bounds[1] - gpsD.getWayPoint(0).Longitude) / realWidth;
                float realHeight = gpsD.Bounds[0] - gpsD.Bounds[2];
                float imageH = pb.Image.Height;
                float dy = imageH * (gpsD.Bounds[0] - gpsD.getWayPoint(0).Latitude) / realHeight;
                lx = (int)dx;
                ly = (int)dy;

                using (Graphics g = Graphics.FromImage(bmp1))
                {
                    Rectangle rect = new Rectangle(lx, ly, 20, 20);
                    if (gpsD.getWayPoint(0).Sym.Equals(""))
                    {
                        g.DrawRectangle(new Pen(Color.Red), rect);
                    }
                    else
                    {
                        if (gpsD.getWayPoint(0).Sym.Equals("hospital"))
                        {
                            g.DrawImage(symbolImages[0], rect);
                        }
                        else
                        {
                            if (gpsD.getWayPoint(0).Sym.Equals("university"))
                            {
                                g.DrawImage(symbolImages[1], rect);
                            }
                        }
                    }
                }
                pb.Image = bmp1;
                pb.Invalidate();

            }

        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void addBtn_Click(object sender, EventArgs e)
        {

            string wayName = nameTxtBox.Text;

            double lat = Convert.ToDouble( latTxtBox.Text);
            float wayLat = (float)lat;

            double lon = Convert.ToDouble( longTxtBox.Text);
            float wayLong = (float)lon;

            double ele = Convert.ToDouble(elevTxtBox.Text);
            float wayEle = (float)ele;

            WayPoint wp = new WayPoint(wayName, wayLat, wayLong, wayEle);

            GPSDataPoint.Add(wp);
         }

        private void lb_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            MessageBox.Show(lb.SelectedIndex.ToString());
        }
    }
}

GPSDataPoint.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CourseworkExample
{
    public class GPSDataPoint
    {
        private float[] bounds;
        private List<WayPoint> dataList;
        public GPSDataPoint()
        {
            dataList = new List<WayPoint>();
        }
        internal void setBounds(string p)
        {
            string[] b = p.Split(',');
            bounds = new float[b.Length];
            for (int i = 0; i < b.Length; i++)
            {
                bounds[i] = Convert.ToSingle(b[i]);
            }
        }
        public float[] Bounds { get { return bounds; } }
        internal void addWaypoint(string s)
        {
            WayPoint wp = new WayPoint(s);
            dataList.Add(wp);
        }
        public WayPoint getWayPoint(int i)
        {
            if (i < dataList.Count)
            {
                return dataList[i];
            }
            else
                return null;
        }
        public List<WayPoint> DataList { get { return dataList; } }

        internal void Add(WayPoint wp)
        {
          //  dataList.Add(wp);
        }
    }
}

WayPoint.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CourseworkExample
{
    public class WayPoint
    {
        private string name;
        private float ele;
        private float latitude;
        private float longitude;
        private string sym;

        public WayPoint(string name, float latitude, float longitude, float elevation)
        {
            this.name = name;
            this.latitude = latitude;
            this.longitude = longitude;
            this.ele = elevation;
        }

        public WayPoint()
        {
            name = "no name";
            ele = 3.5F;
            latitude = 3.5F;
            longitude = 0.0F;
            sym = "no symbol";

        }

        public WayPoint(string s)
        {
            string[] bits = s.Split(',');
            name = bits[0];
            longitude = Convert.ToSingle(bits[2]);
            latitude = Convert.ToSingle(bits[1]);
            if (bits.Length > 4)
                sym = bits[4];
            else
                sym = "";
            try
            {
                ele = Convert.ToSingle(bits[3]);
            }
            catch (Exception e)
            {
                ele = 0.0f;
            }
        }

        public float Longitude
        {
            get { return longitude; }

            set { longitude = value; }
        }

        public float Latitude
        {
            get { return latitude; }
            set { latitude = value; }

        }

        public float Ele
        {
            get { return ele; }
            set { ele = value; }
        }
        public string Name
        {

            get { return name; }
            set { name = value; }

        }

        public string Sym
        {
            get { return sym; }
            set { sym = value; }
        }
    }
}

Besides, .csv file looks like
birthplace.png
51.483788,-0.351906,51.460745,-0.302982
Born Here,51.473805,-0.32532,-,hospital
Born Here,51.473805,-0.32532,-,hospital
I am getting an error whenever I want to use GPSDataPoint.Add(wp); I must be doing very silly mistakes but I cant see it. Please help me. Thank you.

A: You need to change the following function:
private void addBtn_Click(object sender, EventArgs e)
    {

        string wayName = nameTxtBox.Text;

        double lat = Convert.ToDouble( latTxtBox.Text);
        float wayLat = (float)lat;

        double lon = Convert.ToDouble( longTxtBox.Text);
        float wayLong = (float)lon;

        double ele = Convert.ToDouble(elevTxtBox.Text);
        float wayEle = (float)ele;

        WayPoint wp = new WayPoint(wayName, wayLat, wayLong, wayEle);

        GPSDataPoint gdp = new GPSDataPoint();
        gdp.Add(wp);

        //Do something with your gdp variable or use the public on you have declared instead
        //gpsdp.Add(wp);
     }

redpajama_set_name: RedPajamaStackExchange


text:
Q: Are the Sierpiński cardinal $\acute{\mathfrak n}$ and its measure modification $\acute{\mathfrak m}$ equal to some known small uncountable cardinals? This question was motivated by an answer to this question of Dominic van der Zypen.
It relates to the following classical theorem of Sierpiński.
Theorem (Sierpiński, 1921). For any countable partition of the unit interval $[0,1]$ into closed subsets exactly one set of the partition is non-empty.
Motivated by this Sierpiński Theorem we can ask about the smallest infinite cardinality $\acute{\mathfrak n}$ of a partition of the unit interval into closed non-empty subsets. It is clear that $\acute{\mathfrak n}\le\mathfrak c$. The Sierpinski Theorem guarantees that $\omega_1\le\acute{\mathfrak n}$. So, $\acute{\mathfrak n}$ is a typical small uncountable cardinal living in the segment $[\omega_1,\mathfrak c]$.
Problem 1. Is $\acute{\mathfrak n}$ equal to some other known small uncountable cardinal?
Problem 2. Is $\acute{\mathfrak n}$ equal to $\mathfrak c$ under Martin's Axiom?

We can also can consider the measure modification of the cardinal $\acute{\mathfrak n}$.
Namely, let $\acute{\mathfrak m}$ be the smallest cardinality of a cover of $[0,1]$ by pairwise disjoint closed subsets of Lebesgue measure zero.
The definitions imply that $\acute{\mathfrak n}\cdot\mathrm{cov}({\mathcal N})\le\acute{\mathfrak m}\le\mathfrak c$.
According to Theorem 4 of Miller, the strict inequality $\acute{\mathfrak m}<\mathfrak c$ is consistent. So, $\acute{\mathfrak m}$ is a non-trivial small uncountable cardinal.
Problem 3. Is it consistent that $\acute{\mathfrak n}<\acute{\mathfrak m}$?
Problem 4. Is $\acute{\mathfrak m}$ equal to some known small uncountable cardinal?

Added after analyzing comments to these problems: As was observed by @Ashutosh, the answer to Problem 2 is affirmative. In his paper Miller writes that this was done by Both (1968, unpublished) and Weiss (1972, unpublished). The MA equality $\acute{\mathfrak n}=\mathfrak c$ can be also derived from the ZFC inequality $$\mathfrak d\le\acute{\mathfrak n},$$ which can be proved as follows: given a partition $\mathcal P$ of $[0,1]$ into pairwise disjoint closed sets with $|\mathcal P|=\acute{\mathfrak n}$, we can choose a countable subfamily $\mathcal P'\subset\mathcal P$ such that the space $X=[0,1]\setminus\bigcup\mathcal P'$ is nowhere locally compact and hence is homeomorphic to $\omega^\omega$. Then $\mathcal P\setminus\mathcal P'$ is a cover of $X\cong\omega^\omega$ by compact subsets, which implies that $\acute{\mathfrak n}=|\mathcal P\setminus\mathcal P|'\ge\mathfrak d$ by the definition of the cardinal $\mathfrak d$.
Miller proved the consistency of the strict inequality $\acute{n}<\mathfrak c$. Looking at the diagram of small uncountable cardinals in Vaughan, I found only three small uncountable cardinals above $\mathfrak d$: $\mathfrak i$, $cof(\mathcal M)$ and $cof(\mathcal L)$.
Problem 5. Is $\acute{\mathfrak n}$ equal to one of the cardinals $\mathfrak d$, $\mathfrak i$, $cof(\mathcal M)$ or $cof(\mathcal L)$ in ZFC?

Summing up the progress made sofar. The cardinals $\acute{\mathfrak n}$ and $\acute{\mathfrak m}$ satisfy the following ZFC-inequalities:
$$\mathfrak d\le \acute{\mathfrak n}\le\acute{\mathfrak m}=\acute{\mathfrak n}\cdot\mathrm{cov}_{\sqcup}(\mathcal N)\le\mathfrak c.$$
Here by $\mathrm{cov}_{\sqcup}(\mathcal N)$ we denote the smallest cardinality of a disjoint cover of $[0,1]$ by Borel Lebesgue null sets.
It is clear  that $\mathrm{cov}(\mathcal N)\le\mathrm{cov}_\sqcup(\mathcal N)$ and $\mathrm{cov}(\mathcal N)=\aleph_1$ implies $\mathrm{cov}_\sqcup(\mathcal N)=\aleph_1$.
So, $\mathrm{cov}(\mathcal N)=\aleph_1$ implies the equality $\acute{\mathfrak n}=\acute{\mathfrak m}$.
Below I collect two consistency results observed by
Will Brian: $\acute{\mathfrak m}<\mathrm{non}(\mathcal N)$ is consistent;
Ashutosh: $\acute{\mathfrak n}=\aleph_1$ in the random real model (in this model $\acute{\mathfrak m}=\mathrm{cov}(\mathcal N)=\mathrm{non}(\mathcal M)=\mathfrak i=\mathfrak r=\mathfrak c$), so $\acute{\mathfrak n}<\acute{\mathfrak m}$ is consistent.
The above results suggest the following questions:
Problem 6. Is $\mathfrak d<\acute{\mathfrak n}$ consistent?
Problem 7. Is $\acute{\mathfrak n}$ upper bounded by some known small uncountable cardinal different from $\mathfrak c$? For example, is $\acute{\mathfrak n}\le \mathrm{cof}(\mathcal N)$ true in ZFC?
Problem 8. Is $\acute{\mathfrak m}=\acute{\mathfrak n}\cdot\mathrm{cov}(\mathcal N)$?
Problem 9. Is $\mathrm{cov}_\sqcup(\mathcal N)=\mathrm{cov}(\mathcal N)$?

A: A lot of very good observations have already been put into the comments. I'll add one more observation that's too long for a comment:

It is consistent that $\acute{\mathfrak{m}} < \mathrm{non}(\mathcal L)$.

The basic idea is to start with a model of MA + $\neg$CH (where $\mathrm{non}(\mathcal L)$ is already big), and then to force over this model to make $\acute{\mathfrak{m}}$ smaller while leaving $\mathrm{non}(\mathcal L)$ large. The proof uses two facts:
Fact 1: There is a $\sigma$-centered notion of forcing $P$ that does not change the value of $\mathfrak{c}$ and that forces $\acute{\mathfrak{m}} = \aleph_1$.
Fact 2: Suppose $V$ is a model of MA, and $P$ is a $\sigma$-centered notion of forcing (in $V$). Then $P$ does not lower the value of $\mathrm{non}(\mathcal L)$. In particular, if $V \not\models$ CH and if $P$ does not change the value of $\mathfrak{c}$, then $\mathrm{non}(\mathcal L) = \mathfrak{c} > \aleph_1$ in the extension.
My claim follows easily from these two facts. To get a model of $\acute{\mathfrak{m}} < \mathrm{non}(\mathcal L)$, begin with a model of MA + $\mathfrak{c} > \aleph_1$ and force with the notion of forcing $P$ described in Fact 1. The resulting model has $\acute{\mathfrak{m}} = \aleph_1$ (because $P$ makes this true) and $\mathrm{non}(\mathcal L) = \mathfrak{c} > \aleph_1$ (by the "in particular" part of Fact 2). QED
Fact 2 is possibly "well known" but I don't know the standard reference. It was first explained to me by Andreas Blass, who exposits it nicely in the proof of Corollary 49 in this paper.
For Fact 1, the notion of forcing from Theorem 4 in this paper of Arnie Miller does the job. This forcing -- let us call it $P$ -- is $\sigma$-centered and does not change the value of $\mathfrak c$.$^{(*)}$ $P$ is designed to add a partition of $2^\omega$ into $\aleph_1$ closed sets, and it is easy to show (using a genericity argument) that each set in this partition has measure $0$; Miller even points this out in a comment after the proof of his Theorem 4.
There may be a small issue here about partitioning $2^\omega$ instead of $[0,1]$, but we can get around it. Given our partition of $2^\omega$ into $\aleph_1$ closed measure-zero sets, first observe that none of them has interior in $2^\omega$ (because then it would fail to have measure $0$). Thus there is a countable, dense $D \subset 2^\omega$ that contains no more than one point of any member of our partition. Recall that if $C$ is a closed measure-zero subset of $2^\omega$, then $C$ minus one point is homeomorphic to a countable disjoint union of Cantor sets, so it can be partitioned into countably many closed measure-zero sets. Thus, we may modify our partition by adding in the sets of the form $\{d\}$ with $d \in D$, and then dividing some other sets into countably many pieces. In this way we obtain a partition of $2^\omega$ into $\aleph_1$ closed measure-zero sets, including all sets of the form $\{d\}$ for $d \in D$. Once we have done this, we observe that there is a measure-preserving homeomorphism from $2^\omega \setminus D$ onto $[0,1] \setminus \mathbb Q$. When we push our partition through this homeomorphism, we obtain a partition of $[0,1]$ into $\aleph_1$ closed measure-zero sets.
$(*)$ Neither of these facts is stated explicitly in the linked paper, but neither is difficult to prove either. (Using Miller's notation from the linked paper:) Each forcing of the form $P(X)$ is $\sigma$-centered, because if two conditions agree on the part that asserts sentences of the form "$[s] \cap C_n = \emptyset$'' then they are compatible (take the union of the other part). It is clear that no $P(X)$ increases $\mathfrak c$, because it is too small ($|P(X)| \leq \mathfrak c$ and it has the c.c.c., so there are only $\mathfrak c$ nice names for reals). Thus $P$, which is a length-$\omega_1$, finite support iteration of forcings of the form $P(X)$, also is $\sigma$-centered and does not increase $\mathfrak c$.

A: None of the cardinals in Cichoń's diagram is an upper bound for $\acute{\mathfrak{n}}$ (or $\acute{\mathfrak{m}}$). This follows from a theorem of Spinas:

Theorem: there is a proper forcing $P$ with the Sacks property such that forcing with $P$ over a model of $\mathsf{CH}$ makes $\acute{\mathfrak{n}} = \aleph_2 = \mathfrak{c}$. Hence $\mathrm{cof}(\mathcal L) < \acute{\mathfrak{n}},\acute{\mathfrak{m}}$ is consistent.

Of course, $\mathrm{cof}(\mathcal L) = \aleph_1$ in the extension implies that all the cardinals in Cichoń's diagram are $\aleph_1$ in the extension.
It has already been pointed out that $\mathfrak{d} \leq \acute{\mathfrak{n}}$, that $\acute{\mathfrak{n}} < \mathrm{non}(\mathcal L)$ is consistent, and that $\acute{\mathfrak{n}}$ is $\aleph_1$ in the random model. Putting all these facts together, we see

$\mathfrak{d} \leq \acute{\mathfrak{n}}$, but if $\kappa$ is any of the cardinals in Cichoń's diagram not bounded above by $\mathfrak{d}$, then $\acute{\mathfrak{n}}$ is independent of $\kappa$, in the sense that both $\kappa < \acute{\mathfrak{n}}$ and $\acute{\mathfrak{n}} < \kappa$ are consistent.

Spinas proves the above theorem in

O. Spinas, "Partition numbers,'' Annals of Pure and Applied Logic 90 (1997), pp. 243-262. (link)

See Theorem 2.8. The notion of forcing $P$ used in Spinas' proof was actually introduced earlier, in this paper of Arnie Miller (the one Ashutosh links to in the comments). Miller proves that $P$ has the Laver property (in modern terminology -- he doesn't phrase it that way in the paper) and concludes that $\mathrm{cov}(\mathcal M) < \acute{\mathfrak{n}}$ is consistent. Spinas shows that $P$ is $\omega^\omega$-bounding which, combined with Miller's result, means it has the Sacks property, which implies $\mathrm{cof}(\mathcal L) < \acute{\mathfrak{n}}$ is consistent. The forcing $P$ is an iteration of tree-like forcings, each of which kills an $\aleph_1$-sized partition in the ground model. The forcing used to kill a partition $\mathcal X$ is the set of all perfect trees $T \subseteq 2^{<\omega}$ having the property that every member of $\mathcal X$ is relatively meager in $[T]$ (the set of branches through $T$).
Finally, let me note that $P$ having the Sacks property does not suffice to conclude that $\mathfrak{i} = \aleph_1$ in the extension. For example, a countable support iteration of Silver forcings has the Sacks property, but $\mathfrak{r} = \mathfrak{i} = \aleph_2$ in the Silver model. (This is proved in Halbeisen's book.) So we cannot conclude that forcing with $P$ makes $\mathfrak{i} = \aleph_1$, and in fact I don't know what is the value of $\mathfrak{i}$ after forcing with $P$. So your question about whether $\mathfrak{i}$ could be an upper bound for $\acute{\mathfrak{n}}$ or $\acute{\mathfrak{m}}$ remains open, although I suspect the answer is negative.


text:
Q: How to submit biometric authentication data via GetSerialization function in V2 Credential Provider? I'm implementing a V2 Credential Provider which invoke Windows Biometric Framework API to verify user fingerprint.
Now V2 CP is built and could be load by LogonUI, but i don't know how to organize the serialized data for GetSerialization after a fingerprint verification, or maybe the biometric auth data is not submit by GetSerialization ?
Please help, thanks very much.


text:
Q: How to connect CSS files to my JSP pages stored in Web-Content (Dynamic Web Project) I'm quite new to the Spring|Hibernate|Eclipse setup. For some reason, My index.jsp files are not picking on the css files (css & css01).
Any clue why?

<link rel="stylesheet" href="css/theme_switcher.css" type="text/css">
<link rel="stylesheet" href="css01/job_blue.responsive.css" title="job_blue" type="text/css">

A: You have not provided the end tag of the link tag. Provide it like this.
<link rel="stylesheet" href="css/theme_switcher.css" type="text/css" />
<link rel="stylesheet" href="css01/job_blue.responsive.css" title="job_blue" type="text/css" />

OR
<link rel="stylesheet" href="css/theme_switcher.css" type="text/css"></link>
<link rel="stylesheet" href="css01/job_blue.responsive.css" title="job_blue" type="text/css"></link>


text:
Q: Python RE: check if word is only before or after another word I'm trying to map a variable to a specific column in excel. Let say I want to catch:
2.4 string
string 2.4

but not:
2.4 string 2.4
string

I used this expression, but that expression matches "2.4 string 2.4" which I do not want:
 r"([2]\.[4])?\s*(\"|'|inch)?\s*String\s*([2]\.[4])?\s*(\"|'|inch)?"

When used on a string "2.4 string", the group() function returns only "string" instead of "2.4 string"
Anyone might know a solution?

A: You can use this regex:
^(?:2\.4 string|string 2\.4)$

Sample VBScript:
Dim myRegExp
Set myRegExp = New RegExp
myRegExp.Pattern = "^(?:2\.4 string|string 2\.4)$"
If myRegExp.Test(SubjectString) Then
    ' Successful match
Else
    ' Match attempt failed
End If

Explanation

*

*The ^ anchor asserts that we are at the beginning of the string

*`(?: ... ) is a non-capture Group that matches...

*2.4 string

*OR |

*string 2.4

*The $ anchor asserts that we are at the end of the string

A: You can use
(^string\s*(?:2\.4)$|^(?:2\.4)\s*string$)

with m, g and i flags (multiline,case insensitive and global)
This is basic regex though: it will search for
^string\s*(?:2\.4)$

OR
^(?:2\.4)\s*string$

The results in matches are "string 2.4" or "2.4 string".
Based on your provided regex I reckon you already know what each regex code inside means.
If you need further info, let me know.
Tested it on http://regex101.com/#python
EDIT: I see @zx81 already has pretty much the same answer, which is also correct


text:
Q: How to calculate the dimensions of representations of SO(6) and SO(10)? The representation of SO(6) is $[i,j,k]$;
The representation of SO(10) is $[i,j,k,m,n]$.
Is there any analytical formula to calculate the dimensions of those representations?
For example,
for SO(6):
dim([1,0,0],D3)=6
dim([0,0,1],D3)=4
dim([0,1,0],D3)=4
dim([0,1,1],D3)=15
dim([0,0,2],D3)=10
dim([i,j,k],D3)=?
for SO(10):
dim([1,0,0,0,0],D5)=10
dim([0,0,0,0,1],D5)=16
dim([0,0,0,1,0],D5)=16
dim([0,0,1,0,0],D5)=120
dim([0,1,0,0,0],D5)=45
dim([i,j,k,m,n],D5)=?

A: Let $[x_1,\ldots,x_\ell]$ denote the vector corresponding to the highest weight of
$D_\ell$. Then the dimension of the representation is given by
$\prod_{1\leq i < j \leq \ell} ( 1+ \frac{x_i+\cdots +x_{j-1}}{j-i} )
\times$
$\prod_{1\leq i \leq \ell-1} ( 1+ \frac{x_i+\cdots + x_{\ell-2}+x_{\ell}}{\ell-i} )$
$\times
\prod_{1\leq i < j\leq \ell-1} ( 1+ \frac{x_i+\cdots +x_{j-1}+2(x_j+\cdots + x_{\ell-2})+x_{\ell-1}+x_{\ell}}{2\ell-i-j} )
$


text:
Q: Create Class or Function for Use proxy I want to use proxy settings for specific request not for all my script.
I have actually :
import whois
from pymongo import MongoClient
import socks
import socket

socks.setdefaultproxy(socks.PROXY_TYPE_HTTP, "IP", 13012)
socket.socket = socks.socksocket

client = MongoClient()
db = client.pro
collection = db.domain
find_document = collection.find({"Field":"ERROR"},{'domain': 1, '_id':0})

domaine = d['domain']
print(domaine)
w = whois.whois(domaine) # I want to use proxy for this request
date = w.expiration_date
print date
collection.update({"domain": domaine}, {"$set": {"expire": date}})

But after that, impossible to connect into my mongodb on localhost.
My question is how can i use proxy for only specific request ?
Thank you in advance for your answers.

A: I find the answer by myself, and i share it for you:
import socks

socks.setdefaultproxy(socks.PROXY_TYPE_HTTP, 'YOUR_IP', 8080)
socks.wrapmodule(whois) # Here is Whois Module force to use proxy


text:
Q: phpunit - how to populate database with geometry type As in topic.
How to init database testcase with geometry type?
If as a source I give:
array('id' => 1, 'point' => 'GeomFromText(\'POINT(1 1)\')'),
it generates error: Numeric value out of range: 1416 Cannot get geometry object from data you send to the GEOMETRY field]
I'm using those classes: PHPUnit_Extensions_Database_DataSet_AbstractDataSet, PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData, PHPUnit_Extensions_Database_DataSet_DefaultTable

A: DbUnit does not support MySQL's geometry types.


text:
Q: Unable to force Eclipse to use the Project instead of the jar I'm facing a problem with Eclipse and Maven.
I have 2 Maven projects in my Eclipse's workspace :

*

*Project A : uses Maven but is not declared as Maven project in Eclipse

*Project B : declared as Maven project in Eclipse and has a dependency with Project A

=> Project B has the jar of Project A in the "Maven Dependencies" of Maven plugin for Eclipse.
My problem is that when I build Project B in Eclipse, it uses the jar of Project A (which is in M2_REPO) instead of the Eclipse project directly, although I have the property "Resolve dependencies from workspace projects" enabled in the Maven plugin settings.
Does anyone have an idea for my problem ?
Thanks in advance :)


text:
Q: Order a List by inner field of object Consider the code below
class Pin
{
   string Name; //can be either Numerical or AlphaNum
}

enum Place
{
    Left,
    Right
}

class Map
{
   Pin pin;
   Place Place;
   Rectangle Rect;
}

The Pin's Name field can be only numerical or alphanumerical, so I went by string to support both.
Now My quesion is if I have a List<Map> how can I sort this list by Pin's Name field? I tried the code below but it can't compile:
map.Sort((x, y) => x.Pin.Name.CompareTo(y.Pin.Name));
//Cannot implicitly convert type 'void' to 'System.Collections.Generic.List<DataModels.PinMap>

A: The code you showed doesn't produce that compiler error. I assume that you are trying to assign the result to a new variable or to itself. Something like this:
map = map.Sort(...);

That's not possible or necessary as List<T>.Sort is doing an in-place sort, i.e. it changes the original list and therefore doesn't return anything. So, simply removing the assignment should make the compiler error go away.
If you don't want an in-place sort, simply use Enumerable.OrderBy in combination with ToList to produce a new list:
var result = map.OrderBy(x => x.pin.Name).ToList();

A: LINQ to the rescue:
var ordered = map.OrderBy(x => x.pin.Name);

Assuming, of course, that none of the pins in the map is null. If it can be null, then:
var ordered = map.Where(x => x.pin != null).OrderBy(x => x.pin.Name);

A: Use Linq.
map = (from a in allAgents
      orderby a.AgentId
      select a).ToList<Map>();


text:
Q: Multi conditional assigment in pandas How can i vectorize something like
if col > 1:
    col = 5
elif col < -1:
    col = 10
else:
    col = 15

I want to do this in pandas
df['col'] = ...?

A: You can use np.select for this. Example below :
conditions = [
    (df['col'] > 1),
    (df['col'] < -1)]
choices = [5, 10]
df['col'] = np.select(conditions, choices, default=15)


text:
Q: A mapping is "independent of the representation of the set $A$" means...? Note that the definition of a measure here is different than in most contexts.

Let $\mathcal{C}$ be a semialgebra. A function $\mu: \mathcal{C} \to
 [0, \infty]$ is a measure if:

*

*$\mu(\emptyset) = 0$

*For any sequence of pairwise disjoint sets $\{A_n\}_{n=1}^{\infty}\subset\mathcal{C}$ with
  $\bigcup_{n=1}^{\infty}A_n \in \mathcal{C}$,
  $\mu(\bigcup_{n=1}^{\infty}A_n)=\sum_{n=1}^{\infty}\mu(A_n)$.

I don't understand the following proposition:

Let $\mu$ be a measure on a semialgebra $\mathcal{C}$ and let
  $\mathcal{A}$ be the smallest algebra generated by $\mathcal{C}$. For
  each $A \in \mathcal{A}$, set $$\bar{\mu}(A) =
 \sum_{i=1}^{k}\mu(B_i)$$ if the set $A$ has the representation $A =
 \bigcup_{i=1}^{k}B_i$ for some pairwise disjoint $B_1, \dots, B_k \in
 \mathcal{C}$, $k < \infty$. Then $\bar{\mu}$ is independent of the
  representation of $A$ as $A = \bigcup_{i=1}^{k}B_i$.

Can someone explain "$\bar{\mu}$ is independent of the
representation of $A$ as $A = \bigcup_{i=1}^{k}B_i$" to me?

A: $A\in\mathcal{A}$ means that there exists $B_1,\dots,B_k\in\mathcal{C}$ such that
$$A=\bigcup_{i=1}^kB_i$$
This is a representation of $A$. But it's not necessarily unique. You could also have an other representation
$$A=\bigcup_{i=1}^lC_i$$
What is said here is that the result that you get for $\bar{\mu}(A)$ does not depend on the representation that you choose for $A$ but only on $A$, that is:
$$\sum_{i=1}^k\mu(A_i)=\sum_{i=1}^l\mu(C_i)$$
This is necessary in order for $\bar{\mu}$ to be well defined.


text:
Q: table background clear - objective c - cocoa Hi I want to display my table view without any background color so I used the following code to clear it
[uiTableView setBackgroundColor:[UIColor clearColor]];

This worked fine in the new iPad and also other generation iPads except it failed to work in iPad version one. The table shows with the background gray color. Is this something to do with iOS 5 ? Can anyone let me know if we can clear the background color in first version iPads.

A: I have noticed the same thing under iOS 5+. Try this:
[uiTableView setBackgroundColor:[UIColor clearColor]];
[uiTableView setBackgroundView:nil];

Should work as intended.
EDIT: If you're using the default cells, they cover the UITableView, so changing the UITableView's background color and view doesn't do anything. Try this in your tableView:cellForRowAtIndexPath: method:
cellName.backgroundColor = [UIColor clearColor];
cellName.backgroundView = nil;

A: As tableview has one more view as its background. You can set the backgroundColor in two ways.
i) Set the background color for the tableview and set the backgroundView to nil.
[uiTableView setBackgroundColor:[UIColor clearColor]];
[uiTableView setBackgroundView:nil];

ii)  Set the backgroundColor for the tableView backgroundView.
UIColor *backgroundColor = [UIColor clearColor];
uiTableView.backgroundView = [[UIView alloc] initWithFrame:self.tableView.bounds];
uiTableView.backgroundView.backgroundColor = backgroundColor;


text:
Q: SUN IMQ topic messages preview Is there any way to view the messages that reside inside a JMS Topic destiantion?
I've got a problem with messages not being released from Topic destination. The Topic has got 1 producer and 7 consumers and none of them is durable.
Thanks in advance for any suggestions.

A: After some digging finally found out the answer.
I need to use the following command:
imqcmd list msg -t t -n my_topic -nocheck

where my_topic is the name of my topic destination.
After receiving a response like:
Listing messages for the destination
------------------------------------
Destination Name    Destination Type
------------------------------------
my_queue            Topic

On the broker specified by:

-------------------------
Host         Primary Port
-------------------------
localhost    7676

--------------------------------------------------------------------------------------------------
Message #   Message IDs                                                     Priority   Body Type
--------------------------------------------------------------------------------------------------
0           ID:9-AAA.BBB.CCC.DDD(e9:3b:c8:51:8b:75)-58798-1217457169630     4          TextMessage
1           ID:10-AAA.BBB.CCC.DDD(e9:3b:c8:51:8b:75)-58798-1217457169709    4          TextMessage
2           ID:11-AAA.BBB.CCC.DDD(e9:3b:c8:51:8b:75)-58798-1217457169717    4          TextMessage
3           ID:12-AAA.BBB.CCC.DDD(e9:3b:c8:51:8b:75)-58798-1217457169720    4          TextMessage
4           ID:13-AAA.BBB.CCC.DDD(e9:3b:c8:51:8b:75)-58798-1217457169723    4          TextMessage
5           ID:14-AAA.BBB.CCC.DDD(e9:3b:c8:51:8b:75)-58798-1217457169727    4          TextMessage

I can view Message details with this command:
imqcmd query msg -t t -n my_topic -msgID "ID:9-AAA.BBB.CCC.DDD(e9:3b:c8:51:8b:75)-58798-1217457169630" -nocheck

which willl print something like:
Querying message:
------------------------------------------------------------
Message ID
------------------------------------------------------------
ID:9-AAA.BBB.CCC.DDD(e9:3b:c8:51:8b:75)-58798-1217457169630

In the destination
------------------------------------
Destination Name    Destination Type
------------------------------------
my_topic            Topic

On the broker specified by:

-------------------------
Host         Primary Port
-------------------------
localhost    7676

--------------------------
Message Header Information
--------------------------
Message ID                  ID:9-AAA.BBB.CCC.DDD(e9:3b:c8:51:8b:75)-58798-1217457169630
Correlation ID              TestCorrID
Destination Name            my_topic
Destination Type            Topic
Delivery Mode               PERSISTENT (2)
Priority                    4
Redelivered                 false
Timestamp                   7/30/08 3:32:49 PM
Type
Expiration                  12/31/69 4:00:00 PM
ReplyTo Destination Name    temporary_destination://topic/AAA.BBB.CCC.DDD/58798/1
ReplyTo Destination Type

------------------------------
Message Properties Information
------------------------------
LongProp      6534
IntProp       3
StringProp    TestStringValue
DoubleProp    7.4687643E7

------------------------
Message Body Information
------------------------
Body Type    TextMessage (1)

Afterwards the message can be deleted with command:
imqcmd destroy msg -t t -n my_topic-msgID "ID:9-AAA.BBB.CCC.DDD(e9:3b:c8:51:8b:75)-58798-1217457169630" -nocheck

Hope this helps someone, someday...


text:
Q: How to schedule specific test in jenkins? I've been looking for an answer to this question for a long time.
I have a big project with a lot of tests in jenkins.
I want that some of the tests run every time someone does "push".
and all the tests run every night.
How can I do this?
with the "Build periodically" I build all the tests with schedule and I dont found thet I can build specific tests.
Thank!
EDIT:
I run the tests with gradle, this is the configuratuin:

A: you can use the BUILD_CAUSE variable
on nightly trigger TIMERTRIGGER=true  , after every push the value will be SCMTRIGGER
after that you can set a parameter and run the tests using it.


text:
Q: Using luigi.LocalTarget with PdfPages in python3 The below code snippet worked fine for python2, but does not work for python3. This code snippet is intended to allow for a luigi workflow to write to a multipage PDF, while still using the LocalTarget context manager that allows for atomicity.
import luigi
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt

test = luigi.LocalTarget('test.pdf')
with test.open('wb') as fh, PdfPages(fh) as outf:
    plt = plt.plot([1, 2, 3], [4, 5, 6])

This works in python2, but in python3 leads to the error:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-6-ba62e5b716d2> in <module>
----> 1 with test.open('wb') as fh, PdfPages(fh) as outf:
      2     plt = plt.plot([1, 2, 3], [4, 5, 6])

~/miniconda3/envs/cat3.7/lib/python3.7/site-packages/matplotlib/backends/backend_pdf.py in __init__(self, filename, keep_empty, metadata)
   2386
   2387         """
-> 2388         self._file = PdfFile(filename, metadata=metadata)
   2389         self.keep_empty = keep_empty
   2390

~/miniconda3/envs/cat3.7/lib/python3.7/site-packages/matplotlib/backends/backend_pdf.py in __init__(self, filename, metadata)
    445         self.fh = fh
    446         self.currentstream = None  # stream object to write to, if any
--> 447         fh.write(b"%PDF-1.4\n")    # 1.4 is the first version to have alpha
    448         # Output some eight-bit chars as a comment so various utilities
    449         # recognize the file as binary by looking at the first few

TypeError: write() argument must be str, not bytes

How can I retain this atomic functionality in python3?

A: Sorry, I know this isn't the answer you're looking for, but I found this line in the Luigi repository in the definition of LocalTarget:
def open(self, mode='r'):
    rwmode = mode.replace('b', '').replace('t', '')
    ...

https://github.com/spotify/luigi/blob/master/luigi/local_target.py#L159
It seems that they are not doing byte writing whatsoever (at least in the current version). I would definitely bring this up with them in the Github Issues.

A: I am no expert in the working of LocalTarget, so i do not know if there is a reason for the removal of the b-flag, or if this is a bug.
A way to work around this is to wrap the code using the temporary_path function:
import luigi

class BinaryFileExample(luigi.Task):
    def output(self):
        return luigi.LocalTarget("simple_binary_file.extension")

    def run(self):
        with self.output().temporary_path() as my_binary_file_path:
            with open(my_binary_file_path, 'wb') as inner_file:
                newFileBytes = [123, 3, 255, 0, 100]
                for byte in newFileBytes:
                    inner_file.write(byte.to_bytes(1, byteorder='big'))


text:
Q: Windows 8.1 no longer recognize disk with a NTFS AND a ext4 ubuntu install So, as I do every 6 month, I installed a Ubuntu partition on my computer. I have a main SSD (C:) with Win8.1 on it and I had a secondary HDD (D:) with a single huge NTFS partition on it for my data. So, I used the Windows partition utility to free about 60GB for the Ubuntu install, keeping a 940GB NTFS partition with my data. Then, I used a boot drive to install Ubuntu and used the partition utility offered by the installer to separate he 60GB between a boot, a swap and a data partition. Ubuntu was finally installed.
I can boot ubuntu with grub, then access the HDD and see all the "windows" data on it (my music, files, etc.).
But when I boot on Windows, it no longer mounts the D: drive. Using the partition tool, I see that it lists the disk as "invalid". Again, I stress that the data is supposed to be in the NTFS format, as it was before, and that I am NOT trying to access Ubuntu (ext4) data in Windows.
Now, I had backups of my disk (hell, I can even access the data from Ubuntu), but if there is some ways to recover without having to erase everything...

A: Ok, after having done another backup of my data, I went back to Windows. In the built in partition utility, the HDD was marked as an invalid drive. I right-clicked on it and choose... well I don't remember the exact wording, but it kind of re-mounted the drive. And instead of just formatting the drive, now I can see the three Ubuntu partition (boot, swap and home) and the ~900 GB unallocated space. So I just wiped out everything so I can put the data back on the disk.
So, unfortunately I didn't solve the issue the way I wanted, but at least I haven't lost anything but some time! ;)


text:
Q: Browser cancel http requests from angular app Up until recently I had no problems with my frontend app and backend app communicating.
For some reason, now every-time my angular app send http requests to my rails api app (Chrome or Firefox), I get this error:

I tried to change my Cors configurations in my rails app but it didn't work. I upgraded recently to angular 7, so I don't know if that's what causing it.
I have ruby-on-rails 5 api app and angular 7 app.
This is my cors.rb:
# application.rb
    config.middleware.insert_before 0, Rack::Cors do
      allow do
        origins '*'

        resource '*',
          headers: :any,
          #expose:  ['access-token', 'expiry', 'token-type', 'uid', 'client'],
          methods: [:get, :post, :put, :patch, :delete, :options, :head]
      end
    end

headers configurations in angular's services:
const httpOptions = {
  headers: new HttpHeaders({ 'Content-Type': 'application/json' })
};

I'd like to know how to fix this and to know if it's a backend problem or frontend problem.
Thanks beforehand.
EDIT
because it may be a problem with my angular app, here is relevant code:

// app-routing.module

// Routing array - set routes to each html page
const appRoutes: Routes = [
  { path: 'login/:id', canActivate: [AuthGuard], children: [] },
  { path: '', canActivateChild: [AuthGuard], children: [
    { path: '', redirectTo: '/courses', pathMatch: 'full' },
    { path: 'courses', component: CourseListComponent,  pathMatch: 'full'},
    { path: 'courses/:courseId', component: CourseDetailComponent, pathMatch: 'full' },
    { path: 'courses/:courseId/unit/:unitId', component: CoursePlayComponent,
      children: [
        { path: '', component: CourseListComponent },
        { path: 'lesson/:lessonId', component: CourseLessonComponent, data:{ type: 'lesson'} },
        { path: 'quiz/:quizId', component: CourseQuizComponent, data: {type: 'quiz'} }
      ]}
    ]},
  { path: 'welcome', component: LandingPageComponent, pathMatch: 'full' },
  { path: '**', component: PageNotFoundComponent, pathMatch: 'full' }];

// auth.guard.ts

canActivate(route: ActivatedRouteSnapshot, state:
       RouterStateSnapshot): boolean |
       Observable<boolean> | Promise<boolean> {
         // save the id from route snapshot
         const id = +route.params.id;
         const course_id = +route.params.courseId;

         // if you try to logging with id
         if (id) {
           this.router.navigate(["/courses"]);
           return this.authUserService.login(id);
         }
         // if you're already logged in and navigate between pages
         else if (this.authUserService.isLoggedIn()){
           if (course_id){
             // check if someone try to access a locked course
             if (this.authUserService.isCourseNotPartOfTheSubscription(course_id)){
               this.router.navigate(["/welcome"]);
               return false;
             }
             else
               return true;
           }
           else
             return true;
         }
         else {
           this.router.navigate(["/welcome"]);
           return false;
         }
        }

      canActivateChild(route: ActivatedRouteSnapshot,state: RouterStateSnapshot): boolean |
      Observable<boolean> | Promise<boolean> {
         return this.canActivate(route, state);
       }

// auth-user.service.ts

@Injectable()
export class AuthUserService implements OnDestroy {
  private user: IUser;
  private errorMessage: string;

  constructor(private userService: UserService,
              private userProgressService: UserProgressService) {
                userProgressService.connectUser();
                userProgressService.setFlagLanName();
              }

  login(id: number) {
    return this.userService.getUser(id).pipe(
      map((user) => {
        this.user = user;
        localStorage.setItem('user', JSON.stringify(this.user));
        localStorage.setItem('token', 'JWT');

        // this service used for user-progress requests so connectUser
        // just get items from localStorage
        this.userProgressService.connectUser();
        return true;
      }),
      catchError((error) => {
        this.errorMessage = <any>error;
        return of(false);
      })
    );
  }

  // @returns {Observable<T>}
  isLoggedIn() {
   return !!localStorage.getItem('token');
  }

  // check if a user try to access a locked course
  isCourseNotPartOfTheSubscription(course_id){
    return this.userProgressService.isLocked(course_id);
  }
}

// user.service.ts

const httpOptions = {
  headers: new HttpHeaders({ 'Content-Type': 'application/json' })
};

@Injectable()
export class UserService {
  private url = 'http://localhost:3000/users';
  private diploma_url = 'http://localhost:3000/diplomas';

  constructor(private http: HttpClient) {  }

  // Get Single user by id. will 404 if id not found
  getUser(id: number): Observable<IUser> {
    const detailUrl = `${this.url}/${id}` + '.json';

    return this.http.get<IUser>(detailUrl)
        .pipe(catchError(this.handleError));
  }

  // call mark_lesson_as_completed in backend
  updateCompletedLessons(user_id: number, course_id: number, param: any): Observable<any> {
    const userUrl = `${this.url}/${user_id}` + '.json';
    let body = JSON.stringify({
      course_id: course_id,
      completed_lesson: param
    });

    return this.http.patch(userUrl, body, httpOptions)
      .pipe(
        tap(_ => console.log(`updated user ${user_id} with this entry: ${param}`)),
        catchError(this.handleError)
      );
  }

  // call mark_quiz_as_completed in backend
  updateCompletedQuizzes(user_id: number, course_id: number, param: any): Observable <any> {
    const userUrl = `${this.url}/${user_id}` + '.json';
    let body = JSON.stringify({
      course_id: course_id,
      completed_quiz: param
    });

    return this.http.patch(userUrl, body, httpOptions)
      .pipe(
        tap(_ => console.log(`updated user ${user_id} with this entry: ${param}`)),
        catchError(this.handleError)
      );
  }

  // call mark_course_as_completed in backend
  updateCourseStatus(user_id: number, course_id: number, param: any): Observable <any> {
    const userUrl = `${this.url}/${user_id}` + '.json';
    let body = JSON.stringify({
      course_id: course_id,
      completed: param
    });

    return this.http.patch(userUrl, body, httpOptions)
      .pipe(
        tap(_ => console.log(`updated user ${user_id} with this entry: ${param}`)),
        catchError(this.handleError)
      );
  }

  // call serve_diploma in users
  getDiploma(user_id: number) {
    const diplomaUrl = `${this.diploma_url}/${user_id}`;
    return diplomaUrl;
  }

  // // Handle Any Kind of Errors
  private handleError(error: HttpErrorResponse) {
    // A client-side or network error occured. Handle it accordingly.
    if (error.error instanceof ErrorEvent) {
      console.error('An error occured:', error.error.message);
    }

    // The backend returned an unsuccessful response code.
    // The response body may contain clues as to what went wrong.
    else {
      console.error(
        'Backend returned code ${error.status}, ' +
        'body was ${error.error}');
    }

    // return an Observable with a user-facing error error message
    return throwError(
      'Something bad happend; please try again later.');
  }
}


text:
Q: How to generate crypto wallet addresses for one time payment that are connected to a centralized wallet I've been trying to build something like coinbase-commerce that could generate a new wallet address for every transaction that could be connected to a centralised wallet using python

A: I tried using pywallet since I'm using python. Still, I faced some errors which I thought it was due to my machine then tried it on another machine but had to move on due to I have limited time to fix bugs, then tried using bitcoinlib but later resolve to use py_crypto_hd_wallet which had all I need.


text:
Q: how to get values from selected item spinner (Android Studio to Firebase) First of all, thankyou for clicking my question, hope you can help me to resolve my problem here :(
So, my problem is, i already success to get data from spinner "productname" and after that i want to get "productprice" references from selected item listener.. how to get "product price" ? because when i run the apps, its force closed. hope you can understand what i mean :(
Click here to see my firebase db
package com.example.chocolatte;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;

import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

import org.w3c.dom.Text;

import java.util.ArrayList;
import java.util.List;

public class transaction_page extends AppCompatActivity {

    private DatabaseReference mDatabase;

    Button bt_min, bt_plus, btOvo, btGopay, btCash, btCheckout;
    TextView txtSumProduct, txtProductSelected;
    String selectedproductprice, selectedproduct;
    Spinner productSpinner;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_transaction_page);

        txtProductSelected = findViewById(R.id.txtProductSelected);

        mDatabase = FirebaseDatabase.getInstance().getReference();

        mDatabase.getRoot().child("PRODUCTS").addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull final DataSnapshot dataSnapshot) {
                final List<String> products = new ArrayList<String>();

                for(DataSnapshot productsSnapshot: dataSnapshot.getChildren()) {
                    String productname = productsSnapshot.child("productname").getValue(String.class);
                    products.add(productname);
                }

                Spinner productSpinner = (Spinner) findViewById(R.id.spinner);
                final ArrayAdapter<String> productadapter = new ArrayAdapter<String>(transaction_page.this, android.R.layout.simple_spinner_dropdown_item, products);
                productadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                productSpinner.setAdapter(productadapter);

                productSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                    @Override
                    public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

                        selectedproduct = productadapter.getItem(position);

                        mDatabase.equalTo(selectedproduct).addValueEventListener(new ValueEventListener() {
                            @Override
                            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                               selectedproductprice = dataSnapshot.child("productprice").getValue().toString();
                            }

                            @Override
                            public void onCancelled(@NonNull DatabaseError databaseError) {

                            }
                        });

                        txtProductSelected.setText(selectedproduct + " (@" + selectedproductprice + ")");

                    }

                    @Override
                    public void onNothingSelected(AdapterView<?> parent) {

                    }

                });
            }

            @Override
            public void onCancelled(@NonNull DatabaseError databaseError) {

            }

        });

    }
}

and this is for the report

2019-11-25 19:55:44.720 26470-26470/com.example.chocolatte E/AndroidRuntime: FATAL EXCEPTION: main
      Process: com.example.chocolatte, PID: 26470
      java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference
          at com.example.chocolatte.transaction_page$1$1$1.onDataChange(transaction_page.java:69)
          at com.google.firebase.database.core.ValueEventRegistration.fireEvent(com.google.firebase:firebase-database@@16.0.4:75)
          at com.google.firebase.database.core.view.DataEvent.fire(com.google.firebase:firebase-database@@16.0.4:63)
          at com.google.firebase.database.core.view.EventRaiser$1.run(com.google.firebase:firebase-database@@16.0.4:55)
          at android.os.Handler.handleCallback(Handler.java:789)
          at android.os.Handler.dispatchMessage(Handler.java:98)
          at android.os.Looper.loop(Looper.java:164)
          at android.app.ActivityThread.main(ActivityThread.java:6541)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

the output i expected is
example :
CREAMY CHOCOLATE (@10000)

A: Your reference is at the root node:
mDatabase = FirebaseDatabase.getInstance().getReference();

If you want to retrieve productprice, you need to do the following:
 mDatabase.child("PRODUCTS").child("PROD1").addValueEventListener(new ValueEventListener() {
    @Override
 public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
       selectedproductprice = dataSnapshot.child("productprice").getValue().toString();
       }

   @Override
 public void onCancelled(@NonNull DatabaseError databaseError) {
   }
  });

Here you add a reference to child PROD1 then you will be able to retrieve the child productprice.


text:
Q: CKeditor, passing a label name to addcommand in a plugin I am trying to build a small plugin for CKeditor. I want to add a function that when I press one the the generated buttons that in the addcommand function the Lable for that button gets printed to the editor
example : if List array contains "Name", "State", "country" so this plugin code below will add 3 button to the menu called "Name", "State" and "country" if I click anyone of these buttons they will activate insertMM command , I want that command to do a inserthtml with the string "you pressed [Label]" so if I pressed "Name" button it would print "you pressed Name" in the Editor window
CKEDITOR.plugins.add( 'MM', {
    init: function( editor ) {
        editor.addCommand( 'insertMM', {
            exec: function( editor) {
                editor.insertHtml( "you pressed "+ {{ADD LABEL STRING HERE}} );
            }
        });
        for (i = 0; i < List.length; i++) {
            editor.ui.addButton( List[i], {
                label: List[i],
                command: 'insertMM',
                toolbar: 'insert'
            });
        }
    }
});

so the question is,  is there some way of knowing which button is pressed and getting its details when running the addcommand or is there a way of passing a know value to the addcommmand when the button is pushed

A: Yo got to create a separate command for each button, i.e.
function genCommand( name ) {
    return {
        exec: function( editor ) {
            editor.insertHtml( "you pressed " + name );
        }
    };
}

editor.addCommand( 'insertMMfoo', genCommand( 'foo' ) );
editor.addCommand( 'insertMMbar', genCommand( 'bar' ) );

editor.ui.addButton( List[i], {
    label: List[i],
    command: 'insertMMfoo',
    toolbar: 'insert'
});

I'm not quite sure what is in List array, but it could (actually, should) look like this:
function genCommand( name ) {
    return {
        exec: function( editor ) {
            editor.insertHtml( "you pressed " + name );
        }
    };
}

for (i = 0; i < List.length; i++) {
    var commandName = 'insertMM' + i;

    editor.addCommand( commandName, genCommand( i ) );

    editor.ui.addButton( List[i], {
        label: List[i],
        command: commandName,
        toolbar: 'insert'
    });
}


text:
Q: Parsing XML using XElement I'm quite new to parsing XML using VB.NET. I have some XML in this format (simplified view)
<Range>
<from>1</from>
<to>5</to>
</Range>

<Range>
<from>10</from>
<to>20</to>
</Range>

<Range>
<from>100</from>
<to>200</to>
</Range>

There can be any amount of <Range> tags, but each Range tag will always have a <from> and <to> tag under it.
What I need to produce is a string, using the example above it will look something like this
1:1-5;2:10-20;3:100-200

I'm trying to use XElement to parse this, however not sure how to proceed. I tried iterating over using .Descendants("Range") which does give me the numbers but I can't separate out a from and to.
Any help will be much appreciated.
Thanks

A: Based on the data select all  Range's and format.  I used System.Text.StringBuilder in the example below.
    'your test data
    smpl = <root>
               <Range>
                   <from>1</from>
                   <to>5</to>
               </Range>
               <Range>
                   <from>10</from>
                   <to>20</to>
               </Range>
               <Range>
                   <from>100</from>
                   <to>200</to>
               </Range>
           </root>

    Dim sb As New System.Text.StringBuilder
    Dim ct As Integer = 1
    For Each r As XElement In smpl...<Range>
        sb.AppendFormat("{0}:{1}-{2};", ct, r.<from>.Value, r.<to>.Value)
        ct += 1
    Next
    sb.Remove(sb.Length - 1, 1)

    Dim s As String = sb.ToString

After running s =
 1:1-5;2:10-20;3:100-200

A: Ok, think I got a method although it is not clean!
I create 2 enumerators, one for Descendants("from") and another for Descentants("to")
Then, in a loop I can easily construct my string
Something like this (typing off memory, syntax might not be complete, txt is the XElement object for the entire XML)
Dim p as IEnumerable(of Xelement) = txt.Descendants("from")
Dim q as IEnumerable(of Xelement) = txt.Descendants("to")
Dim i as Integer = 0

While i < p.Count
String.Format("{0}:{1}-{2}", i.ToString,p(i),q(i))
End While


text:
Q: Geodesics on the product of manifolds Given two Riemannian manifolds $(M, g_1)$ and $(N, g_2)$, and geodesic curves $\gamma(t)$ in $M$ and $\chi(t)$ in $N$.
Is the curve $\Gamma(t) = (\gamma(t),\chi(t))$ a geodesic in the product manifold $(M \times N, g_1 + g_2)$ ? Is it a geodesic if we now consider the product manifold $(M \times N, \alpha g_1 + \beta g_2)$ where $\alpha$ and $\beta$ are two positive (or zero) scalar constants ?
$$ $$
EDIT: Although I feel it should be the case (geodesic), could you tell me if my counter-example is right:
Let's say $g_1$ is euclidean, and $g_2$ is not. I am interested in whether $\nabla_{\dot\Gamma}\dot\Gamma$ has only components along $\dot\Gamma$  (ie., $\Gamma$ is autoparallel). Let's call the Levi-Civita connections on $M$ and $N$, respectively $\nabla^1$ and $\nabla^2$. Since $g_1$ is euclidean, $\nabla^1_{\dot\gamma}\dot\gamma=0$. Projecting $\nabla_{\dot\Gamma}\dot\Gamma$ on $\dot\Gamma^\perp$ (to check whether its perp component is $0$), I get $\nabla^{(\pi)}_{\dot \Gamma}\dot\Gamma = (0, \nabla^2_{\dot\chi}\dot\chi - \frac{g_2(\nabla^2_{\dot\chi}\dot\chi,\dot\chi)}{g_1(\dot\gamma,\dot\gamma)+g_2(\dot\chi,\dot\chi)}\dot\chi)$. This second term isn't expected to be zero, right? Since $\chi$ is geodesic, only $\nabla^2_{\dot\chi}\dot\chi - \frac{g_2(\nabla^2_{\dot\chi}\dot\chi,\dot\chi)}{g_2(\dot\chi,\dot\chi)}\dot\chi)$ is zero...
Thanks!

A: The Levi–Civita connection $\widetilde{\nabla}$ of a product $M\times N$ is given by $\widetilde{\nabla}=\nabla^1+\nabla^2$ where $\nabla^1$ is the connection of Levi Civita of $M$ and $\nabla^2$ is the connection of Levi Civita of $N$. It means that if $X=(X_1,X_2)$ and $Y=(Y_1,Y_2)$ are tangent vector fields on $M\times N$, then $\widetilde{\nabla}_XY=\nabla^1_{X_1}Y_1+\nabla^2_{X_2}Y_2$.
It follows that, if $\gamma_1$ and $\gamma_2$ are geodesics of $M$ and $N$ respectively, then $\nabla_{\gamma_1^{\prime}}^1\gamma_1^{\prime}=0$ and $\nabla_{\gamma_2^{\prime}}^2\gamma_2^{\prime}=0$. Hence, if $\gamma=(\gamma_1,\gamma_2)$, we obtain
$$\widetilde{\nabla}_{\gamma^{\prime}}\gamma^{\prime}=\nabla_{\gamma_1^{\prime}}^1\gamma_1^{\prime}+\nabla_{\gamma_2^{\prime}}^2\gamma_2^{\prime}=0.$$
Therefore $\gamma$ is a geodesic of $M\times N$.

A: The key fact is the condition that $\gamma$ is a geodesic is strictly stronger than the condition that the image of $\gamma$ is totally geodesic.
This is clear from the equations - saying $\gamma$ is a geodesic means $\nabla_{\dot{\gamma}} \dot{\gamma} = 0$ while the image of $\gamma$ being totally geodesic means $$\nabla_{\dot{\gamma}} \dot{\gamma} - \frac{g(\nabla_{\dot{\gamma}}\dot{\gamma}, \dot{\gamma} )}{g(\dot{\gamma}, \dot{\gamma})}\dot{\gamma} = 0.$$
If the image of $\gamma$ is totally geodesic it does follow that by reparamaterizing $\gamma$, it does become a geodesic.
Now, suppose $\Gamma = (\gamma_1(t), \gamma_2(t))$.  If $\gamma_1$ and $\gamma_2$ are both geodesics (meaning $\nabla_{\dot{\gamma}_i} \dot{\gamma}_i = 0$ for $i = 1,2$), then by your above equations, $\Gamma$ is a geodesic.
On the other hand, if $\gamma_1$ is a geodesic and $\gamma_2$ merely has totally geodesic image, then $\Gamma = (\gamma_1(t), \gamma_2(t))$ need not be totally geodesic.  Your equations show exactly why you shouldn't expect it to be, but here's a concrete counterexample.
Consider $M_1 = M_2 = \mathbb{R}$.  Let $\gamma_1(t) = t$ and let $\gamma_2 = t^3$.  Then $\gamma_1$ is a geodesic and the image of $\gamma_2$ is totally geodesic because there is no normal direction at all.  (If this is too trivial, take $M_1 = M_2 = \mathbb{R}^2$, $\gamma_1(t) = (t,0)$ and $\gamma_2(t) = (t^3, 0)$ - the rest of the argument will work in either case).  Then in $M_1\times M_2$, the image of $\Gamma(t) = (\gamma_1(t), \gamma_2(t))$ is the graph of a cubic polynomial, so is NOT a straight line, so is not a geodesic at all.  Nor is the subset totally geodesic.


text:
Q: Finding the Largest Digit in C++
*

*Input a 3-digit integer.

*Print the largest digit in the integer (Tip: use % 10 to get the rightmost digit, and / 10 to remove the rightmost digit).

Input: 173
Expected Output: 7

We were given this activity 2 days old and still couldn't solve this mystery. Here's my own code which doesn't match the given expected output above:
#include<iostream>
using namespace std;

int main() {

   int num, result;

   cin >> num;
    if(num > 0) {
        result = num % 10;
        num / 10;
        cout << result;
    }

   return 0;
}

A: You separate only the last digit, but need to check all - just add a loop. Also num / 10 does nothing.
 maxdigit = 0;
 while (num > 0) {
      maxdigit = max(maxdigit, num % 10);
      num /= 10;
  }
 cout << maxdigit;

A: Different way to solve the problem. Take the input as a string. You can handle much larger numbers and the string is already decomposed into digits. You barely have to think. Just work through the string character-by-character, make sure the character is a digit, and keep track of the biggest digit seen so far.
#include<iostream>
#include <cctype> // needed for isdigit
//using namespace std; Not recommended. Causes problems

int main()
{
    std::string num;
    char max = 0;
    std::cin >> num; // read number as a string.
    for (char ch: num)
    { //iterate string character by character
        if (!isdigit(static_cast<unsigned char>(ch)))
        { // if we didn't get a digit, the user screwed up (or is a jerk)
          // Let's not assume malice and let them know they've made a mistake.
            std::cerr << "Must input a valid number";
            return -1;
        }
        if (ch > max)
        { // this is the biggest character seen so far.
            max = ch; // update biggest
        }
    }
    std::cout << max; // print biggest
    return 0;
}

A: The answer of MBo is the best and should be accepted.
You are obviously not allowed to use C++ algorithms yet. And, maybe you are learing now about interger and modulo divisions.
If you would be allowed to use more advanced C++, you would probably write something like:
#include <iostream>
#include <algorithm>

int main()
{
    if (std::string number{}; (std::cin >> number) and std::all_of(number.begin(), number.end(), ::isdigit))
        std::cout << *max_element(number.begin(), number.end()) << '\n';
}

A: Below is the working example without using loops and without using std::max. Note this(without loop) is just one among many possible ways of doing it.
#include <iostream>
int findDigit(int passed_num, int current_num)
{

    int lastDigit;

    if (passed_num == 0) {

        return current_num;
    }

    // find the last didit
    lastDigit = passed_num % 10;

    if(lastDigit > current_num)
    {

         current_num = lastDigit;
    }

         //call findDigit() repeatedly
        current_num = findDigit(passed_num / 10, current_num);

        std::cout<<lastDigit<<" ";

    return current_num;
}

int main()
{
    std::cout << "Enter a number: ";
    int input_num, greatest_num;
    std::cin>>input_num;

    greatest_num = findDigit(input_num, 0);

    std::cout<<"greatest is: "<<greatest_num<<std::endl;

    std::cout<<"Enter another number: ";
    std::cin>>input_num;

    greatest_num = findDigit(input_num, 0);

    std::cout<<"greatest is: "<<greatest_num<<std::endl;

    return 0;
}

The output of the above is as follows:
Enter a number: 24344357
2 4 3 4 4 3 5 7 greatest is: 7
Enter another number: 2353639
2 3 5 3 6 3 9 greatest is: 9

A: #include <iostream>
using namespace std;

int main() {
   int a = 11;
   int b = 5;
   int c = 23;

   int max = (a>b) ? ((a>c) ? a : c) : ((b>c) ? b : c) ;

   cout << max << endl;
}//using Ternary Operator


text:
Q: Boost.Test - Undefined symbol when overriding main I want to provide my own main function while using Boost.Test. So I have included the following macros:
#define BOOST_TEST_ALTERNATIVE_INIT_API
#define BOOST_TEST_NO_MAIN

My main function looks like this:
int main(int argc, char* argv[])
{
    int exitCode = ::boost::unit_test::unit_test_main(&initialise, argc, argv);

    return exitCode;
}

I have also created the function initialise.
When built on OS X using Xcode 6 the following error is reported:
Undefined symbols for architecture x86_64:
  "boost::unit_test::unit_test_main(bool (*)(), int, char**)", referenced from:
      _main in main.o

I am linking-in the unit test framework library.
Can someone please help resolve the error?

A: There are two possible solutions:
1) Include <boost/test/included/unit_test.hpp> in the test module. This has the effect of building both the test framework and the test module simultaneously.
2) Rebuild the test framework library withBOOST_TEST_NO_MAINand BOOST_TEST_ALTERNATIVE_INIT_API.
According to the documentation the 2nd option is preferred.


text:
Q: yii export tables into excel sheet in CSV Format Hello Sir I want to ask how to export my few tables data in excel sheet format in list manner

A: I'm not exactly sure what you mean by "list manner" but you could create a link that uses CListView and use the template attributes to only use your view 'template'=>'{items}', and turn off paging. Then set the header of your file with php for the appropriate file type, etc. If you need something more sophisticated than CSV, see here.

A: You can use this https://github.com/kartik-v/yii2-export or something like this:
public function actionDownloadExcel() {
    $data = <here some query>;
    $data = unserialize( $data);
    header( 'Content-Type: text/csv; charset=windows-1251' );
    header( 'Content-Disposition: attachment; filename=data.csv' );
    $output = fopen( 'php://output', 'w' );
    fwrite( $output, "\xEF\xBB\xBF" );
    fputcsv( $output, [ 'field1', 'field2', 'field3' ], ';' );
    foreach ( $data as $key => $value ) {
        fputcsv( $output, $value, ';' );
    }
}

in you Controller. More documentation at http://php.net/manual/ru/function.fputcsv.php


text:
Q: Codeigniter Session deletes itself after 5 minutes I have tried using every hack and every slightly changed Session.php I have done various different config changes and still it deletes itself after 5 minutes, and its always 5 minutes no matter what. I am using the latest codeigniter and using java scripts for amazon banners.
I am testing in Localhost.
All the session needs to do is check if the user is logged into facebook and store the session just like my other apps that work great due to no javascript.

A: I am full of cold so the last couple of days have seemed like the end of the world haha but it seems to be fixed this morning fingers crossed.
Changes in config
$config['sess_table_name']= '';
and also I rewrote model to only get  $this->session->set_userdata('fb_data', $fb_data); and rewrote controller to just access this data so now excludes $is_logged_in which has been added to fb_data.
It has a slightly altered $Session.php but I forget which one and a MY_Session fixed by sirderno 2013.
It has passed the 5 minute mark about ten times this morning without destroying data so fingers crossed one of things above has fixed it. Thanks to everyone who has commented and tried to assist me I appreciate your kindness.

A: You can create a page with:
<?php
phpinfo();

That will print out a page with information about your installation.
Check the session section to see what the expire time is set to. I bet it is set to 5 minutes.

A: You have sess_expire_on_close set to TRUE. This means your session expires when the browser window is closed, and seems like the most likely candidate for the root cause of this problem.
If you set it to FALSE, then the user will remain logged in until the session is destroyed, unless you change the expiration time.


text:
Q: difference between * function() and function() everyone,
one thing is made my mind busy is pointers for function
what is the difference between these two codes?
#include<iostream>

class test
{
    private:
        // some data members

    public:
        void *print() **OR** void Print()
        {
            // print something
        }

}

why we have the pointer function?
what's the difference between them?
BEST REGARDS

A: the answer is:
when you wanna return a pointer you have two ways to do that
1: in this way you don't need * to return the value of your pointer
int* (int* a , int* b)
{
    if(*a < *b)
       return a;
}

2: in this way you need to use * to return the value of your pointer
int (int* a , int* b)
    {
        if(*a < *b)
           return *a;
    }


text:
Q: how to set -3years from current date and +9months from the current date in JQUERY in datepicker
Hey Iam using html5 date attribute and it needs some Restriction from past Year And Future Dates Dynamically by having todays current date / year.
DEMO

*

*-3 years from current date

*+9 months from the current month
Example :
current year is 2015-3 = 2012 + 9 months
JS :
var checkUserAgent = navigator.userAgent;
      // if (checkUserAgent.match(/iPad/i) || checkUserAgent.match(/iPhone/i)) {
            $('meta[name=viewport]').attr('content', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no');
            var checkBabyId1 = $('#babys_due_date_id').length > 0;
            if (checkBabyId1 == true) {

                // logic for 9 months
                var myMonths = 9;
                var CurrentDate = new Date();
                CurrentDate.setMonth(CurrentDate.getMonth() + myMonths);

                console.log(CurrentDate) // adding 9 months

                // logic for - 3 years
                var myPastYears = 3;
                var CurrentYear = new Date();
                CurrentYear.setYear(CurrentYear.getYear() - myPastYears )
                console.log(CurrentYear) // - 3years

                $('#ui-datepicker-div').hide();
                $('#babys_due_date_id.date-padding label').hide();
                $('#babys_due_date_id')
                .find('input')
                .prop({
                    /*'readonly':'true', */
                    'type':'date'/*,
                    'min' : '2012-01-01',
                    'max' : '2016-12-01'*/
                })
                .css({
                    'border':'1px solid #f00 !important',
                    'width':'200px','margin-top':'10px'
                });

                $('#babys_due_date_id label').on('click', function(e){
                    e.preventDefault();
                    $('#ui-datepicker-div').hide();
                });

                $('#babys_due_date_id-datepicker-popup-0').on('click', function(){
                    $('#ui-datepicker-div').remove();
                    $('#ui-datepicker-div').datepicker( "option", "disabled", true );
                });
            }
      // }

A: use the minDate option:
$('#ui-datepicker-div').datepicker( "option", "minDate", "-3y +9m");

http://api.jqueryui.com/datepicker/#option-minDate
or:
<script>
  var now = new Date();
    var year = now.getFullYear() - 3;
    var month = now.getMonth() - 8; // jan = 0
    if (month < 0) {
      month = 11 + month;
      year++;
    }

  $('#datepicker').attr("min", year+'/'+month+'/'+now.getDate());
</script>

for simple <input type="date">


text:
Q: How to remove write protection from OEM recovery drive? I have a recovery USB drive from the Computer Manufacturer that I used to reinstall windows. I am done using the windows files on it. It is 16GB and has relatively fast read/write speeds so I would like to reuse it. However, when I try to write anything to the drive, windows explorer says that it is read-only. I tried dozens of suggestions and even tried to format it on my linux machine. Nothing has worked, and every method returns and error that the media is write-protected. Here are the methods I have tried:

*

*Using hdparm, gparted on linux

*Using diskpart on windows

*Using three different third party software tools

Does anybody know how I can brute force wipe and remove write protection from this USB? Preferably the solution will work on linux or windows. I hope it is possible as this is a really good USB drive.

A: Flash memory chips are divided into 528-byte pages which may only be written if blank, which are grouped into chunks of 64 to 1024 (or possibly more); erasing any page requires erasing all of the pages in the same chunk.
Flash drives that are intended to allow 512-byte sectors to be written and rewritten in arbitrary sequence need to use rather complicated mapping and wear-leveling algorithms to accommodate this.  Writing a sector won't immediately erase the old data, but will instead write the new data in some other location that is known to be blank, and cause the old data to be marked as obsolete.  If the supply of blank pages gets too low, the system will look for blocks whose contents are mostly obsolete, copy any live pages from that block into some of the remaining blank space (marking each copied block as obsolete), and then erase the block once all of the pages in it are obsolete.
All of this extra mapping logic increases the complexity of the controller, and further reduces the fraction of the flash that is usable for storing useful data.  By contrast, if a drive is designed for read-only access to a volume that will be written once during mastering and will never be written again, it can use a simpler controller and won't need to dedicate a substantial chunk of the flash (often 10% or so) to a relocation tables and slack space.
I don't know that any particular vendors ship software on purpose-designed "read-only" USB drives, but it would certainly make sense for them to do so.  While doing so would eliminate the possibility that the drive associated with a particular machine might be repurposed once the machine is no longer needed, it would make the drive more suitable for its intended purposes as a "known good" recovery medium.

A: Let's see how good I'm at guessing...
I'm guessing without having seen it that it has some fancy metal casing (which made you like it in the first place..) but under that good looking cover there's usually a tiny physical switch - much like most SD cards have - which enables/disables read/write protection and unless you turn that switch off (for which you will most likely need to break the casing and ruin the entire thing in the process) you're much better off buying a new one for 5-10 bucks. So how did I do?


text:
Q: How to loop through array and visually show single elements in vue I have a application where I have a small form where the user can add one date with multiple start and end times and then it is put inside an array. This process can be repeated as many times as needed.
this is how that array looks:
datesFinal: {meetingName: "", meetingPw:"", meetingUrl: "",
      meetingTime: []} ,

In meetingTime date,start,endtime will be saved. one value form could be like this:
 "meetingTime":[
      {
         "date":"2021-06-21",
         "startTime":"15:30",
         "endTime":"16:30"
      },
      {
         "date":"2021-06-21",
         "startTime":"15:30",
         "endTime":"17:30"
      },

What I want to achieve now is that my app loops through this array and looks if the date is same for the two objects in this case two times 2021.06.21 it should be displayed like this:
2021.06.21
15:30-17:30  15:30-16:30
THe times belonging to the same date should be collected under it.I tried looping though the array to first of show the complete object without any filtering as starters. But I am getting the error that it is undefined (times undefined).
Could someone look at my code and give me a pointer:
 <v-col cols="12" v-for="(timesForDate, i) in datesFinal" key="i">

{{ datesFinal.meetingTime}}

        <v-chip-group v-if="time.length">
          <v-chip v-for="(time, j) in datesFinal.meetingTime" :key="j">{{
              time.startTime + ":" + time.endTime
            }}</v-chip>
        </v-chip-group>
      </v-col>

A: My advice would be: don't try to solve it by tweaking the UI. Transform your data to the desired structure and let the template iterate over the simplest data structure that you can come up with.

new Vue({
  el: "#app",
  data() {
    return {
      datesFinal: {
        meetingName: "This is the meeting name",
        meetingTime: [{
            "date": "2021-06-21",
            "startTime": "15:30",
            "endTime": "16:30"
          },
          {
            "date": "2021-06-21",
            "startTime": "15:30",
            "endTime": "17:30"
          },
          {
            "date": "2021-06-23",
            "startTime": "15:30",
            "endTime": "16:30"
          },
          {
            "date": "2021-06-22",
            "startTime": "15:30",
            "endTime": "17:30"
          },
          {
            "date": "2021-06-20",
            "startTime": "15:30",
            "endTime": "16:30"
          },
          {
            "date": "2021-06-22",
            "startTime": "15:30",
            "endTime": "17:30"
          },
        ],
      },
    }
  },
  methods: {
    // grouping the meeting times by date
    // the function expects an array of objects
    // with a structure:
    // [{ date: "foo", startTime: "bar", endTime: "baz" },
    // { date: "foo", startTime: "bar3", endTime: "baz3" },
    // { date: "foo2", startTime: "bar2", endTime: "baz2" }]
    // it creates an Object with a structure:
    // { foo: ["bar-baz", "bar3-baz3"], foo2: ["bar2-baz2"] }
    processMeetingTimes(meetingTimeArray) {
      const ret = meetingTimeArray
        .reduce((a, c) => {
          if (!(c.date in a)) a[c.date] = []
          a[c.date] = [...a[c.date], `${c.startTime}-${c.endTime}`]
          return a
        }, {})
      console.log("processMeetingTimes", ret)
      return ret
    },
    // creating the array of strings that the v-for
    // can iterate over easily
    // it expects an Object with a structure:
    // { foo: ["bar-baz", "bar3-baz3"], foo2: ["bar2-baz2"] }
    // and creates an Array with a structure:
    // ["foo bar-baz bar3-baz3", "foo2 bar2-baz2"]
    createMeetingTimeArray(processedMeetingTimes) {
      const ret = Object.entries(processedMeetingTimes).map(([key, val]) => `${key} ${val.join(" ")}`)
      console.log("createMeetingTimeArray", ret)
      return ret
    },
  },
  template: `

      {{ datesFinal.meetingName }}

        {{ time }}

  `
})


text:
Q: Why is a primary key index an additional structure? I am reading that RDMS stores table data on disk in some form of B-tree, and also that table indexes are stored in the B-tree form.
I read that primary key index is created automatically for a primary key defined, but that it could also be dropped anytime. So, it implies that primary-key index is an additional structure next to the B-tree used for just storing table data.
Isn't that wasting of resources - why wouldn't all table table be kept through primary-key index?
If it isn't like that, which order is then used for the B-tree used to store table data?
Thanks for clarifying

A: The primary key index is an optimization for finding the place on disk where the row is held. As a structure, it contains simply the PK data, not the whole row.
On a database, performance is often gated by how many pages are read from disk vs. cache. Since the PK index is smaller than the whole table, it is more likely to be in cache, it causes fewer blocks to be read from disk, and less blocks of other tables are removed from cache. It therefore is a major performance optimization.
Further, while modifying the table data, rows are locked. If the primary key were being scanned from the table data on disk, locked rows would slow access for all the other queries. By separating the index as a separate structure, the index can be used even while the row being pointed to is locked.
So overall, the separate PK structure is a classic space-for-time optimization.
EDIT What is the order of the rows in the table? The following answer is for Oracle, but is applicable to many databases.
Short answer: rows are not ordered on disk which is why the PK index (and other indexes) are so important.
Long answer:
While the primary-key b-tree structure is necessarily sorted (the b-tree) the rows of the table are scattered across the table-space. To understand this we need to drill down the various data structures.
First, the database is structured into logical entities called a tablespaces. A tablespace is the space in one or more files on one or more disks. The files start empty. When the tablespace become full  (technically when the data in it reaches a threshold) the tablespace can be automatically grown. It can also be grown manually by enlarging the file (adding an 'extent', or adding new files). Tablespaces can be clustered across multiple machines as well as disks.
Second: A tablespace is divided segments, each segment for the use of a single table or index.
Third: The segment is divided into blocks, each block has space for one or more rows. These blocks are not the same as disk or OS blocks; Oracle blocks are one or more OS blocks. (This is for transportability, and for managing media with different block sizes).
On insert, a database will select a space in a block from anywhere in the tablespace. The row can be inserted sequentially (especially bulk inserting into an empty table), but normally the database will also reuse space where rows have been deleted or moved due to some types of update. While the placement is theoretically kind-a predictable, in practice you should never rely on or expect the row to be placed in any specific block.
One interesting thing in Oracle is the ROWID. This is the reference stored in the index that allows the DB to look up the row:

*

*An extended rowid has a four-piece format, OOOOOOFFFBBBBBBRRR:

*The first 6 characters OOOOOO represent data object number, using 32bits

*The next 3 characters FFF represent tablespace-relative datafile number, using 10bits.

*The next 6 characters BBBBB represent block number, using 22bits.

*The last 3 character RRR represent row number, using 16bit

For much more detail, see http://docs.oracle.com/cd/E11882_01/server.112/e25789/logical.htm#autoId0
One other thought: There is a concept in the DB world called partitions, where a dataset is divided across different tablespaces (frequently different disks or nodes in a cluster) depending on some expression logic. For example, on a table of customers, a vertical partition could be defined by the country of the person. That way you can ensure that the US customers are physically on one disk while the Australians are on another.


text:
Q: Javascript document.getElementById().value not matching textbox value I am trying to make a simple password confirm script with Javascript. I am a novice at Javascript and web development, so any help would be helpful.
I would like to compare two text inputs (eventually password inputs), if both are equal, then the submit button is enabled. Using StackOverflow and W3 tutorials, I cam up wit the following:

Password	<input id="pass1" type=text onkeypress="checkpass()"></input>

Confirm	<input id="pass2" type=text onkeypress="checkpass()"></input>

	<button type="button" id="subbutton" onclick="displayPass()" disabled>Submit</button>

&nbsp

What I have noticed is that the values that are found in the text boxes in the checkpass() function does not match the actual value in the text box. It seems like it is one character behind.
When the button is enabled and I click submit, the values in displayPass() are correct and match the vaules in the text boxes.
I don't know if I am missing something simple, of if I goes deeper in Javascript usage. I've seen similar post where they recommend using jQuery, but I have not gotten that far to use jQuery yet.

A: You can get required output using following code:

Password	<input id="pass1" type=text onkeyup="checkpass()"></input>

Confirm	<input id="pass2" type=text onkeyup="checkpass()"></input>

	<button type="button" id="subbutton" onclick="displayPass()" disabled>Submit</button>

&nbsp

User "onkeyup" instead of "keypress"


text:
Q: Drag & Drop modyfiing polygon shape by moving vertices in C#
I have to do application for tilling in C#. The tiles will have some shape and my app should be able to modify the shape. I will have a some shape - polygon, made from vertices. I will have for example field of 16 vertices, then I draw the polygon.
What I need to know how can I move with the the vertice using drag and drop. I will also have to recount other vertices in order to fit one tile to next tile, but it's just some math.
To conclude:
I have polygon defined 16 vertices in field of Vertices, I move (with mouse) with one vertice, recount the coordinates of ohter vertices and draw new polygon. My problem is moving (probably using drag & drop) with one vertice from filed of vertices.
This is what part of my previous code without drag & drop - just for idea what tools I'm using for drawing one tile:
 private Bitmap canvasBitmap; //canvas for drawing
 private Graphics g; // enter to graphics tool

            Bitmap b = (Bitmap)Bitmap.FromFile("obr.bmp");
            TextureBrush brush = new TextureBrush(b);
            Pen pen = new Pen(Color.Black, 1);

            hexaVertices[0] = new PointF(-40 + 40, 0 + 30);
            hexaVertices[1] = new PointF(-20 + 40, 30 + 30);
            hexaVertices[2] = new PointF(20 + 40, 30 + 30);
            hexaVertices[3] = new PointF(40 + 40, 0 + 30);
            hexaVertices[4] = new PointF(20 + 40, -30 + 30);
            hexaVertices[5] = new PointF(-20 + 40, -30 + 30);

 g.FillPolygon(brush, hexaVertices);
 g.DrawPolygon(pen, hexaVertices);

Thx for advices.

A: I can only give you a rough outline for Windows Forms here. In WPF you could use Adorners  and there are tutorials out there for how to do it. Here we go for a manual process in Windows Forms:
First, the array of vertices should be a member variable of the class and should be initialized only once at the start of the program.
Then, draw the polygon with the current set of vertices as you're doing right now. Also, draw some "handles" if you want, so you know that the vertices can be grabbed (this could be rectangles around the actual PointF).
Now for the magic :-) Assign the MouseDown, MouseMove and MouseUp events to the control you're using for displaying the image. Also, create a new member variable bool m_draggingVertex and another that contains the index to the vertex array of the vertex you're currently dragging.
In MouseDown:
Check whether the current mouse position is within the range of a vertext (I would assume a 5x5 rectangle around a vertex, so that is is easier to hit with the cursor). If you pressed the button on a vertex, set m_draggingVertex to true and store the index of the vertex in the other variable.
In MouseMove:
If m_draggingVertex is true, change the vertext at the index stored above to the new coordinates, recalc your positions and repaint so that the current position of the vertex is shown.
In MouseUp:
If m_draggingVertex is true, set it to false and do final work.
This is how I'd do it ...