text:
Q: Heuristic expressions for the inductance of a finite-length solenoid The expression for the inductance of a very long solenoid is
$$L = \frac{\mu_0 N^2(\pi r^2)}{l}$$
where $l$, $r$ and $N$ are the length, radius and number of turns respectively. Things get much trickier if we don't make the approximation that the solenoid is very long. Computing the on-axis field is still tractable. However computing the inductance requires knowledge of the off-axis field, and while expressions for that exist (see this post), they're quite ugly. So you're probably stuck doing numerical calculations if you want to use them to compute the inductance.
But what if all we want is a very rough estimate for the inductance? An approximate but human-readable formula that shows how inductance scales with length would probably be more useful than a crazy analytic expression involving elliptic integrals anyway. Such a formula would be perfectly useful if it were extracted empirically by fitting numerical data, and it would only need to depend nontrivially on the coil's aspect ratio $l/r$. Does such a formula exist? Given how common solenoids are and how rare infinitely long solenoids are, it seems reasonably likely that this formula is in common use somewhere.

A: Let's assume that the coil is tightly wound and wire thickness is negligible, so that we can think of the solenoid as a sheet of current rotating about the solenoid's axis. The most common estimate is probably Wheeler's formula. Let's define $L_0 = \mu_0 N^2(\pi r^2)/l$, which is the usual expression for a solenoid's inductance when $l \gg r$. As noted in the question, we should be able to write a correction to this formula that only depends on the ratio $r/l$. This correction factor is called the Nagaoka coefficient $k_L$
$$L_\text{actual} = L_0 k_L$$
which asymptotes to $k_L = 1$ in the limit of large $l$, and takes a value of $0.688423...$ for a 'square' solenoid ($r=l/2$). If $l \geq 0.8 r$, Wheeler's expression for $k_L$ is accurate to within 0.32%.
$$k_L \approx \frac{1}{1+0.9004 (r/l)}, ~~~~~~~ l\geq 0.8 r$$
Lots of online calculators use this formula, though its fractional error increases above 20% for $l/r < 0.2$ and grows from there. People have worked out many expressions to increase the accuracy, tons of which can be found in this document. Here's one that maintains a fractional error below 1.63% for all $l$ and $r$
$$k_L \approx \frac{l}{\pi r}\left[ k \ln\left(1+\frac{\pi r}{l}\right) + (1-k)\text{asinh}\left(\frac{\pi r}{l}\right) \right]$$
where $k = 0.482$.
Remarkably, the short-solenoid problem also admits an exact solution
$$k_L = \frac{8r}{3\pi l}\left[ \frac{2\kappa^2-1}{\kappa^3}E(\kappa^2) + \frac{1-\kappa^2}{\kappa^3}K(\kappa^2) - 1\right], ~~~~~~ \kappa = \frac{1}{\sqrt{1+(l/2r)^2}}$$
where $K$ and $E$ are the first and second complete elliptic functions. I've written these expressions using the same convention for the elliptic functions that Mathematica and Matlab use, but note that many sources would replace $E(\kappa^2) \rightarrow E(\kappa)$ and $K(\kappa^2) \rightarrow K(\kappa)$.
It's possible to go way way beyond the approximations used here, to include the effect of wire thickness, finite wire spacing and lots of high frequency effects. The document linked above is well-written and has basically everything.


text:
Q: Iterating to create new data frames based on column value of an exisiting data frame Currently, I have a data frame that has census data for cities over time. The columns are:

["Name","Metric", "2000Q1", "2000Q2", ...,"2020Q1"]

I am hoping to create seperate data frames for each city. The cities are named in the "Name" column. So, there are 13 rows that include the city Omaha for example that I want to pull into a separate data frame. I want to be able to iterate over the data frame to create new data frames selecting only the city's metrics. Right now, I only have 6 city's data in so I can do it manually as seen below, but how would I do this without manually inputting the city names?
Charleston = df.loc[df.Name=="Charleston"]
Denver = df.loc[df.Name=="Denver"]
Houston = df.loc[df.Name=="Houston"]
Nashville = df.loc[df.Name=="Nashville"]
Omaha = df.loc[df.Name=="Omaha"]
Portland = df.loc[df.Name=="Portland"]
Washington = df.loc[df.Name=="Washington"]

redpajama_set_name: RedPajamaStackExchange


text:
Q: NHibernate Linq Startwith generates outer join I have two entities that are connected through one to many relationship.
like this example:
public class Category
{
    public int Id {get; set; }
    public string Name {get; set;}
}

public class Product
{
    public int Id {get; set;}
    public string Name {get; set;}
    public Category ProductCategory {get; set;}
}

and the mapping using fluent nhibernate
public class CategoryMap : ClassMap<Category>
{
....
}

public Class ProductMap: ClassMap<Product>
{
...
References(x => x.ProductCategory).Column("CategoryId");
}

When I do search using linq to NHibernate with where clause and equal, it generates inner join between product and category
so this
var query = session.Query<Product>()
     .Where (x => x.ProductCategory.Name == "abc");

this will generate inner join
but when I do search with startwith like this
var query = session.Query<Product>()
     .Where (x => x.ProductCategory.Name.StartWith("abc"));

this will generate outer join between the two.
Why, and how can I force to generate inner join?

A: You can do it using QueryOver, which is another method to create query in NHibernate. In that case, you specify the join type as you want.
Category category = null;

var result = session.QueryOver<Product>()
                    .JoinAlias(x => x.ProductCategory, () => category, JoinType.InnerJoin)
                    .Where(Restrictions.Like(Projections.Property(() => category.Name), "abc%", MatchMode.Start))
                    .List();

On the other hand, query over is more verbose code, you have to specify a lot of things you avoid using linq.


text:
Q: Emails sent with MimeKit / Outlook are falling to gmail's spam folder for the first time We are using MimeKit as SMTP client for sending emails to our users. Typically, the first time it arrives to their gmail accounts, it falls into the spam box. Then if removed the 'spam' flag, subsequent emails stay in the inbox.
Is there something necessary to do at C# level? or maybe at Outlook/Azure-DNS level?
The C# code snippet is as follows:
            var message = new MimeMessage();
            message.From.Add(new MailboxAddress("Notifier", smtpUser));
            message.To.Add(new MailboxAddress("User", recipient));
            message.Subject = subject;

            var bodyBuilder = new BodyBuilder() { HtmlBody = html, TextBody = text };
            message.Body = bodyBuilder.ToMessageBody();

                using (var client = new SmtpClient())
                {
                    client.ServerCertificateValidationCallback = (s, c, h, e) => true;
                    client.Connect(current.SmtpUrl, current.SmtpPort, SecureSocketOptions.StartTls);
                    client.AuthenticationMechanisms.Remove("XOAUTH2");
                    client.Authenticate(current.SmtpUser, current.SmtpPass);
                    client.Send(message);
                    client.Disconnect(true);
                }

For the first time, gmail is showing it flagged as 'spam':

Pressing 'Looks safe' will make subsequent emails valid, but we need the first one to look safe.
I am attaching also the entire mail content received at gmail:
Delivered-To: jaimeolivaresfalcon@gmail.com
Received: by 2002:a0c:f08c:0:0:0:0:0 with SMTP id g12csp672696qvk;
        Wed, 4 Sep 2019 07:16:38 -0700 (PDT)
X-Received: by 2002:a9d:3b77:: with SMTP id z110mr8444689otb.93.1567606358405;
        Wed, 04 Sep 2019 07:12:38 -0700 (PDT)
X-Google-Smtp-Source: APXvYqw3m+1ZsX0fhLp8SuYRXSxfxUtUaYyLo4BZjxq+nVuni9VUHkVmOBnhBg/vThsIaIoA3chE
X-Received: by 2002:a9d:3b77:: with SMTP id z110mr8444615otb.93.1567606357487;
        Wed, 04 Sep 2019 07:12:37 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1567606357; cv=pass;
        d=google.com; s=arc-20160816;
        b=MvKIcQqivTBGk3GqNz9MiIMtzUt4gJc0hJMoVHp7LMJyHO+AAiPfDGAdQYy7MwF0YF
         QRm1vkQL5f2DMC3ukgYsZldfk6A4xwbFqkqSQOtZCqQ7zHk3rusUoTIaO6a2fDn6nIKZ
         cUY+92Y0+hOpu0MF/bGYCfy+3+ncJxuOVLcgnWuafrlvyQioviQ0LEsiQT4MsoOCu1gd
         iuCDLz6u+rQ65Rti/FoyHePAaxvQzzjiTFRqXimu4z141Khpbd6x/kzrac5ko7M01DcT
         jffxtMeD0h+OPBmATBAS9uAo7RCjD5LQXSUrtbYy7PJTbYmakc82O2Xk3r1qSwIGWcpi
         aOkw==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=mime-version:content-language:accept-language:message-id:date
         :thread-index:thread-topic:subject:to:from:dkim-signature;
        bh=LjkQ2fZg1ziyuIJx9jwPMT7LT3T4ABbJmFUMJxavtNY=;
        b=NHWmx+VtSxm9xrCGtEHdQPhCs7cF8qepGyU/uZ2MDF+dLBQygpghVzD4zwondLS0En
         CpV/xfSbzx5aRLTnEq3468awqMnPRTmxjT3X/m3VLcq8sSg43ZtJLr5dxlUX2Eyt5Chu
         v4bnC+0wQM05OCMQkTayCWEE/LL8aqKcJYDuK6wd4vU2cSBUZzieDXczf/ysnodrhWgx
         vgvlaa4To4rWwbBe6N2C9lSa3xOO8jU+6f4yS1ttThDPljvd/wR7VTHAU5oF4EH/UQ3e
         wKWdfWv9PPR/Espq66dONAgaqAcauPO35YYhMMu4ND2TCbDqmF7nPoZkf/iitGvYgL78
         1Xvw==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@efferenthealthllc.onmicrosoft.com header.s=selector2-efferenthealthllc-onmicrosoft-com header.b=ETAIKEtN;
       arc=pass (i=1 spf=pass spfdomain=efferenthealth.com dkim=pass dkdomain=efferenthealth.com dmarc=pass fromdomain=efferenthealth.com);
       spf=pass (google.com: domain of notifier@efferenthealth.com designates 2a01:111:f400:fe44::629 as permitted sender) smtp.mailfrom=notifier@efferenthealth.com
Return-Path: <notifier@efferenthealth.com>
Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0629.outbound.protection.outlook.com. [2a01:111:f400:fe44::629])
        by mx.google.com with ESMTPS id k12si10006003oiw.30.2019.09.04.07.12.37
        for <jaimeolivaresfalcon@gmail.com>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
        Wed, 04 Sep 2019 07:12:37 -0700 (PDT)
Received-SPF: pass (google.com: domain of notifier@efferenthealth.com designates 2a01:111:f400:fe44::629 as permitted sender) client-ip=2a01:111:f400:fe44::629;
Authentication-Results: mx.google.com;
       dkim=pass header.i=@efferenthealthllc.onmicrosoft.com header.s=selector2-efferenthealthllc-onmicrosoft-com header.b=ETAIKEtN;
       arc=pass (i=1 spf=pass spfdomain=efferenthealth.com dkim=pass dkdomain=efferenthealth.com dmarc=pass fromdomain=efferenthealth.com);
       spf=pass (google.com: domain of notifier@efferenthealth.com designates 2a01:111:f400:fe44::629 as permitted sender) smtp.mailfrom=notifier@efferenthealth.com
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NNjokEVhuXR5/dOYj6NjeePpEmQbWt5XFctGf5IRGJuGMHAuAd9cXjCTkqduSGP3bTLRqIYjwDRthcj10zcZVudxgjhe6OB50s8KJAMpXVdh+HvGD1JoqUq2BW9M0qyOQ0YDl6Fq6F3DAWMpWNIZRPlrlaOkNaO8ifHj1okiSrThxzIxuGkzGx5iUt8/S7LOBuvzgkVWoT0NendRzvl/mB1ZQgYWcpBa+PulPlYgCTtktO1rbYZgKr5qFvJGbgBvQ1bnyZtHmZRQrA7mNegfeXrK544dGEcXs1DcFo+vNeNR53dvBWFyPCkmPpdl4+rKGRkfo/PY3B1M+D003HXuqQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LjkQ2fZg1ziyuIJx9jwPMT7LT3T4ABbJmFUMJxavtNY=; b=G0nSGcuGCOFD8gcKNWVcBAZ2EIGwicBs0yITe0iyVc+3BIm2/QUfSzcPk0+FRIKtklfUru/c/sTaag3j/6RwPp98uj+2I8k/hdLY0+72qvx595t+E+CMXSGyLmBxHYEcgIzWuckwnRdnUaeU0LwLsqKiCLV1QakRniWXnlzdKjvAXozRlHfnx/AOmyGGYUc5u1zTM5VJWmxprCL+bqEOZi1agY4A94MJK5UyW+YEOEgNEJuyx1+pgdpeQkYVqeYVAk5AcFKLgYNBLpxvW0oVqRMECOV6zlI8xJU8qiFaW64qrBQVYQF8nRfQZd8oI3nmIIoPrstNWqgEOH/UEajoNA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=efferenthealth.com; dmarc=pass action=none header.from=efferenthealth.com; dkim=pass header.d=efferenthealth.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efferenthealthllc.onmicrosoft.com; s=selector2-efferenthealthllc-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LjkQ2fZg1ziyuIJx9jwPMT7LT3T4ABbJmFUMJxavtNY=; b=ETAIKEtNCHLfnl7Fzp8XUI+NlLP/HVTzkmlFS6XwZsLZP5vOj0hJ+1KASa6mjEAvPJbmM2iDTvCMRW8UfigfVSC6hT04OyaiGjNzOjTkR8gN1TCvzNr7esQzyXR94vmz2MjLiycuhNJJMdGGRUoYZUxGhvj6F0muEBoZZ034GLQ=
Received: from BN6PR1401MB2004.namprd14.prod.outlook.com (10.174.116.149) by BN6PR1401MB1907.namprd14.prod.outlook.com (10.174.115.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2220.18; Wed, 4 Sep 2019 14:12:35 +0000
Received: from BN6PR1401MB2004.namprd14.prod.outlook.com ([fe80::1de9:93da:5da7:4415]) by BN6PR1401MB2004.namprd14.prod.outlook.com ([fe80::1de9:93da:5da7:4415%11]) with mapi id 15.20.2220.022; Wed, 4 Sep 2019 14:12:35 +0000
From: Notifier <notifier@efferenthealth.com>
To: User <jaimeolivaresfalcon@gmail.com>
Subject: Notification
Thread-Topic: Notification
Thread-Index: AQHVYyrMLhjkfFeVAkmoUM8Y198VPw==
Date: Wed, 4 Sep 2019 14:12:34 +0000
Message-ID: <98UUW7B0H8U4.EB3P8CQCSUEN2@localhost.localdomain>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-clientproxiedby: SN4PR0401CA0034.namprd04.prod.outlook.com (2603:10b6:803:2a::20) To BN6PR1401MB2004.namprd14.prod.outlook.com (2603:10b6:405:59::21)
authentication-results: spf=none (sender IP is ) smtp.mailfrom=notifier@efferenthealth.com;
x-ms-exchange-messagesentrepresentingtype: 1
x-originating-ip: [13.84.163.72]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 6291f624-e9b1-484f-f114-08d73141eea5
x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600166)(711020)(4605104)(1401327)(2017052603328)(7193020);SRVR:BN6PR1401MB1907;
x-ms-traffictypediagnostic: BN6PR1401MB1907:
x-ms-exchange-purlcount: 1
x-microsoft-antispam-prvs: <BN6PR1401MB1907D7529E3B99DE63CB070DA0B80@BN6PR1401MB1907.namprd14.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:660;
x-forefront-prvs: 0150F3F97D
x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(136003)(39830400003)(396003)(42606007)(346002)(376002)(199004)(189003)(66946007)(2906002)(3480700005)(558084003)(476003)(316002)(25786009)(486006)(256004)(508600001)(52116002)(99286004)(66556008)(7116003)(66476007)(33656002)(305945005)(71200400001)(71190400001)(66446008)(64756008)(8936002)(6486002)(7736002)(81156014)(81166006)(8676002)(6306002)(51815007)(10126004)(386003)(6506007)(53936002)(66066001)(86362001)(221733001)(9686003)(236005)(6512007)(606006)(14454004)(6916009)(6436002)(186003)(54896002)(26005)(6116002)(102836004)(3846002)(1411001)(5660300002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR1401MB1907;H:BN6PR1401MB2004.namprd14.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:3;MX:1;
received-spf: None (protection.outlook.com: efferenthealth.com does not designate permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: bHkvE3Co8At1/X9BzBqbqZFNCIBAppNhqQqCJDoMByjqBv9VGO25sOpCKS8OSh1obZBR1t5nvkdn0CFuuFoGjhwNaXt7MakSQfeS8auVa0d/GUpLb7Y3oJ8Xm2az23Z4+l3YP4ITa5Fhd8DxliNV8JO4ZYDxC6uG3Gh8my4MewFPQScRgUgx49un88gu8zK3MDyUhxIlYB1WjdqPPG3xtQMIBHbA4EuPFa5Is2Jk7D4PsMjrpTvL8GyZVYhgVWC71OrwG7C575IB1XIanF7woc0VZxBlAjh1xY8gaUDYuT7Lc1b/cSKcyUjOG7J0XR8ilS4fp86IaGeKdivi4h2MJ8oqW+A9obH2+GW5NTpBMgvYE7zFNBQhxuuC/jxny7F2zs4z5vacC0HOXeUwgfOLWZsUdZC2SDW6HjXkw0TejIA=
x-ms-exchange-transport-forked: True
Content-Type: multipart/alternative; boundary="_000_98UUW7B0H8U4EB3P8CQCSUEN2localhostlocaldomain_"
MIME-Version: 1.0
X-OriginatorOrg: efferenthealth.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 6291f624-e9b1-484f-f114-08d73141eea5
X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Sep 2019 14:12:34.9389 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 02ecab7f-85de-4d13-9c86-db5eefd90ee2
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: zj/y6ItrIybuyjEREqOxS6sBThdrcjGbcWxxKICSNnb1h2GZnVz0UsJO0Kcp51LYMrFzeRKKgbFFnJPNgXa2GoLY5CBVrkaMzJbHf0oywnA=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1401MB1907

--_000_98UUW7B0H8U4EB3P8CQCSUEN2localhostlocaldomain_
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64

VGhlIHVzZXIgQSBib3N0b25tZWRpY2FsZ3JvdXAgZnJvbSBCb3N0b24gTWVkaWNhbCBHcm91cCBo
YXMgc2hhcmVkIHdpdGggeW91IGEgSW1hZ2luZ1N0dWR5IHJlY29yZC4gWW91IGNhbiByZXZpZXcg
c3dvcmQ9YTM4YWEyMWQtMTJhMy04YTQ1LTZjNTEtMzUwZDNjMzY5ZDcwPg0K
--_000_98UUW7B0H8U4EB3P8CQCSUEN2localhostlocaldomain_
Content-Type: text/html; charset="utf-8"
Content-ID: <28HFX7B0H8U4.5CY7IBFO17VC@localhost.localdomain>
Content-Transfer-Encoding: base64

PGh0bWw+DQo8aGVhZD4NCjxtZXRhIGh0dHAtZXF1aXY9IkNvbnRlbnQtVHlwZSIgY29udGVudD0i
dGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04Ij4NCjwvaGVhZD4NCjxib2R5Pg0KVGhlIHVzZXIgQSBi
b3N0b25tZWRpY2FsZ3JvdXAgZnJvbSBCb3N0b24gTWVkaWNhbCBHcm91cCBoYXMgc2hhcmVkIHdp
dGggeW91IGEgSW1hZ2luZ1N0dWR5IHJlY29yZC4gWW91IGNhbiByZXZpZXcgaXQgYnkgY2xpY2tp
bmcgb24gdGhpcyBsaW5rDQo8YSBocmVmPSJodHRwczovL2VmZmVyZW50ZGV2LmF6dXJld2Vic2l0
cmU8L2E+DQo8L2JvZHk+DQo8L2h0bWw+DQo=
--_000_98UUW7B0H8U4EB3P8CQCSUEN2localhostlocaldomain_--

A: I have a few thoughts but no definitive answers for you because I don't have inside knowledge of how Google does their spam categorizing.

*

*Avoid using names like "User" and "Notifier" in email addresses. That screams "automated message" to me and Google likely has semantics that weigh that type of naming convention as having a "spam" and/or "fishing" bias.

*Try setting the Content-Transfer-Encoding of the text/plain and text/html parts to something other than base64; I might suggest quoted-printable:
foreach (var part in message.BodyParts.OfType<TextPart> ())
    part.ContentTransferEncoding = ContentEncoding.QuotedPrintable;

*This likely isn't an issue, but it's possible, so I'll mention it. Avoid using "@localhost.localdomain" in the Message-Id header. If MimeKit is generating those, it's because it doesn't know what your hostname is and couldn't figure it out, but you can override this behavior by doing this:
message.MessageId = MimeUtils.GenerateMessageId ("efferenthealthllc.onmicrosoft.com");

*Maybe try removing the Content-Id header from the text/html part? Again, I don't see this is likely to be an issue, but it's worth a shot of none of the above changes fix things.
foreach (var part in message.BodyParts.OfType<TextPart> ())
    part.ContentId = null;


text:
Q: Riemannian covering map of $\mathbb{C}P^n$ We know that there is a Riemannian covering map $p:S^n \rightarrow \mathbb{R}P^n$  and I'm working with some foliation problem, which ended up in  trying to find a Riemannian covering map of $\mathbb{C}P^n$, but I don't know any Riemannian cover of this space.
I would like to find some references to this subject, thanks in advance.

A: Since $\mathbb{C}P^n$ is simply connected, it has no nontrivial covers (that is, any covering space if $\mathbb{C}P^n$ is just a disjoint union of copies of $\mathbb{C}P^n$).  In general, if $X$ is a connected space that is reasonably nice (e.g., a manifold), then connected covering spaces of $X$ are classified by subgroups of the fundamental group $\pi_1(X)$.  You can find details in any introductory text on algebraic topology.
(Note that if $X$ has some additional local structure, such as that of a Riemannian manifold, then for any covering space $p:Y\to X$ you can uniquely lift that local structure to $Y$ such that $p$ preserves it, since $p$ is locally a homeomorphism.  So, for instance, classifying Riemannian covering spaces of $\mathbb{C}P^n$ is the same as just classifying ordinary topological covering spaces of $\mathbb{C}P^n$.)


text:
Q: Handle signals and process writing my own shell I'm trying to make a shell that prompt a command and wait for user input.
I want my shell to print another prompt when the user press ctrl-c and exit when he presses ctrl-d.
Here's the main loop:
int my_shell(char **env)
{
    char    *cmd_line;

    while (true)
    {
            print_prompt();
            cmd_line = get_cmd();
            process(cmd_line);
    }
    return (0);
}

I'm able to catch ctrl-c and ctrl-d signals but I don't know how to structure the main loop to exit at the good places. I tried using several fork(), wait(), getpid() but I'm doing it wrong.
Here's one of my try:

int extern_pid;
int intern_pid;

int my_shell(char **env)
{
    char    *cmd_line;

    extern_pid = getpid();
    while (true)
    {
        if (fork() == 0)
        {
            intern_pid = getpid();
            print_prompt();
            cmd_line = get_cmd();
            process(cmd_line);
            exit(0);
        }
        else
        {
            wait(0);
        }
    }
    return (0);
}

And with those signals handlers:
void ctrlc_handler(int signal)
{
    if (getpid() == intern_pid)
        exit(0);
}

void ctrld_handler(int signal)
{
    if (getpid() == extern_pid)
        exit(0);
}

note: the ctrl-d signal is handled in the get_cmd() function.

A: One doesn't have to create a child process with fork to process the Ctrl-C signal in a custom shell. One possibility would be to use a signal handler together with sigsetjmp/siglongjmp.
The procedure would be as follows:

*

*the signal handler is installed

*before the main loop is started, the call environment is stored in env using sigsetjmp

*in the signal handler, the call siglongjmp() restores the environment saved by sigsetjmp() and performs a non-local jump to the location where sigsetjmp was called

Since signal handlers can always be called, possibly even before calling sigsetjmp(), it must be ensured that siglongjmp() can be already called. This is done by setting a volatile variable sig_atomic_t called jmp_set.
The function process knows only one internal command called exit. As already noted in the comments to the question, if the user enters Ctrl-D as the first character at the beginning of a line, this automatically results in an EOF in the getchar call.  The function get_cmd then returns the command exit here. Alternatively, the user can enter the command exit to end the program.
In the function process the position is marked with a comment where you probably want to call external programs with fork/exec. It returns a bool whether the program should be quit or not. Possibly one could evaluate here also a status code from the calls of the external programs accordingly.
Here is a small, self-contained example program with your ctrlc_handler, get_cmd and process function layout, extended with sigsetjmp()/siglongjmp(), not complete of course, but maybe a starting point:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <setjmp.h>

#define MAX_CMD_LENGTH 1024

static const char *const EXIT_CMD = "exit";
static sigjmp_buf env;
static volatile sig_atomic_t jmp_set;

static void ctrlc_handler(int signal) {
    if (jmp_set == 0)
        return;
    if (signal == SIGINT) {
        siglongjmp(env, 1);
    }
}

static char *get_cmd(void) {
    char *cmd_buf = calloc(MAX_CMD_LENGTH, sizeof(char));
    if (!cmd_buf) {
        perror("malloc failed\n");
        exit(1);
    }

    char *ptr = cmd_buf;
    int ch = getchar();
    while (ch != EOF && ch != '\n' && ptr < cmd_buf + MAX_CMD_LENGTH - 1) {
        *ptr++ = (char) ch;
        ch = getchar();
    }
    if (ch == EOF) {
        strcpy(cmd_buf, EXIT_CMD);
    }
    return cmd_buf;

}

static bool process(char *cmd) {
    if (strcmp(cmd, EXIT_CMD) == 0) {
        return true;
    }
    // a call to fork together with a function from the
    // exec family could be used to call external programs
    printf("process '%s'\n", cmd);
    return false;
}

static int cnt = 0;

int main(void) {
    if (signal(SIGINT, ctrlc_handler) == SIG_ERR) {
        perror("signal error");
        exit(1);
    }
    if (sigsetjmp(env, 1)) {
        printf("\n");
        cnt++;
    }
    jmp_set = 1;
    bool exit;
    do {
        printf("%d> ", cnt);
        char *cmd = get_cmd();
        exit = process(cmd);
        free(cmd);
    } while (!exit);
    return 0;
}


text:
Q: Unable to get id from the URL using params I'm new to Express JS  and MongoDB so please go easy on me.
I'm following a tutorial of web development by colt steele. here is my code
app.get("/:id",async(req,res)=>
{
    const id= req.params['id'];
     console.log(id);
    const students= await Student.findById(id);
    console.log(students);
    res.render("studentdata/show",{students});
})

I'm trying to get the id using req.params but it is returning favicon.ico  .
This is the error I got
error screenshot
I tried using params['name'] (name field refers to student name in DB) which worked without any error. I  also tried using _id which gave me another error. I'm expecting params['id'] to return the id of the entry.

A: I am Assuming that you are developing your application in localhost.
Its always a best practice to keep your backend stuffs seperate.
Instead of giving the route path as app.get('/:id') you could have used
app.get('/api/:id',async(req,res) =>{
    const id= req.params['id'];
     console.log(id);
    const students= await Student.findById(id);
    console.log(students);
    res.render("studentdata/show",{students});
})

And the url for this should be like this :

http://localhost:port_number/api/student_id
Here port number should be replaced with the port number on which your server is running . For example - 5000
And student_id should be replaced with student id
For example - 12345
And the url shoud be like following:
http://localhost:5000/api/12345


text:
Q: how to put an 'if' statement in front of a change function This question is for using javascript in Caspio Cloud's platform, so a few things might look different than normal. But basically, I need to put an 'if' statement that references a variable 'above' a change function that runs some other code and I can't figure it out.
The problem is that in Caspio's form the Virtual9 field will 'change' on the form's load, and so it runs the change js. I need to not run the change js onload and also only if the variable 'item' is null.

<script>
var item = document.getElementsByName("InsertRecordItemID")[0].value;

<!-- right here I need an if (item !== null) to then run the change function but that if it's not null to not run the change function{ -->

$("[name='cbParamVirtual9']").change(function(){

var itid = document.getElementsByName("cbParamVirtual9")[0].value;
document.getElementsByName("InsertRecordItemID")[0].value = itid;

}
);

</script>

I've tested the variables using alert windows and they are gotten correctly. I just need to make sure the change function doesn't run if the variable 'item' is null.
EDIT: To clarify, when the form loads the ItemID field may or may not be null (based on parameters that pass over).
If it is not null then the Virtual9 field (where the user makes a selection) will be hidden- because the ItemID already had a value and needs to not change.
However, if ItemID is null then Virtual9 will be visible and the user can make a change, thereby updating the ItemID field. The user may update Virtual9 multiple times (looking for the right record) so it needs to keep updating ItemID (even after it is no longer null in this case).
That's why I think the best solution is to disable the code ONLY for onload, if possible. So that the code runs on change of Virtual9 but not onload.


text:
Q: How to close a div on click of anywhere but the div? I'm in the process of creating a 'drawer' that opens on click of any link in a bar and changes the content within the drawer based on the link that's clicked.
Despite researching I've got this far and now I'm stuck. I'm finding it difficult to figure out a solution that works with my current setup. I'd like to set it so that on click of anywhere else the 'drawer' fades out. Can anyone shed some light on how I might achieve this with my current setup?
Thanks in advance!

$('.filters-toolbar__drop-down:gt(0)').hide();
$('.filters-toolbar__drop-down-wrapper').hide();

$('.filters-toolbar').on('click', 'a', function() {
  $('.current').not($(this).closest('li').addClass('current')).removeClass('current');
  var $this = $(this);
  $('.filters-toolbar__drop-down-wrapper').fadeIn('slow');
  $('body').addClass('filter-open');

  // fade out all open subcontents
  var visibleElements = $('.filters-toolbar__drop-down:visible');
  if (visibleElements.length <= 0) {
    $('.filters-toolbar__drop-down[id=' + $this.data('id') + ']').fadeIn('slow');
  } else {
    visibleElements.fadeOut('slow', function() {
      $('.filters-toolbar__drop-down[id=' + $this.data('id') + ']').fadeIn('slow');
    });
  }
});
.filters-toolbar-wrapper {
  margin-bottom: 0;
  width: 100%;
}

.filters-toolbar__item {
  padding: 0 50px;
   display: inline-block;
}

.filters-toolbar__drop-down-wrapper {
  background-color: grey;
  border-bottom: 1px solid #000;
  position: relative;
  top: 0;
  left: 0;
  width: 100%;
  height: 200px;
}

.filters-toolbar__drop-down {
  display: none;
}

      Type

      Color

      Sorty by

    Type Dropdown

    Color Dropdown

    Sort Dropdown

A: You can listen for click on the document or window and inside the listener function you can compare the id or any other attribute that you have on drawer.
If it doesn't match with the drawer attribute simply close the drawer.
document.addEventListener('click', function(event) {
// You can choose any attribute available on drawer
// Instead of id
if (event.target.id != 'drawer') {

  `$("#drawer").fadeOut();`
}
});

You should add this listener inside your link click function and you can remove it later after fadeOut


text:
Q: Screenshot in Unity/Ubuntu within VirtualBox I'm trying to take a screenshot of Firefox running on Unity/Ubuntu 16.04 inside VirtualBox 5.1.2. Pressing Prt Scrn pops open a little app called Screenshot but the screenshot shown is only ever the desktop, with no application windows visible.
My host operating system is Windows 10 Pro.
Does anyone know how to resolve this and get screenshot functionality working inside VirtualBox?

A: You may take a screenshot with VirtualBox's built-in screenshot capability, either through pressing RightCtrl+E (or LeftCmd+E on Mac), which will open up a save file window on the host), or with
$ VBoxManage controlvm vmname screenshotpng screenshot.png

from the command line of the host, where vmname is the name of the virtual machine and screenshot.png is the name of the PNG image you'd like to create.

A: The VirtualBox has its own buit-in screenshot utility, which you can use via Host+E (Host is right Ctrl) keyboard shortcut. Alternatively, you could use gnome-screenshot which comes with Unity by default, and export the file later to imgur or other service. Shared folder is also an option, but you will need to have guest additions installed in order for that to work
On a side note, Ubuntu has Alt+Print_Screen shortcut for taking screenshot of currently focused window, which you can use as an alternative.


text:
Q: Mutex when writing to queue held in map for thread safety I have a map<int, queue<int>> with one thread writing into it i.e. pushing messages into the queues. They key refers to a client_id, and the queue holds messages for the client. I am looking to make this read-write thread safe.
Currently, the thread that writes into it does something like this
map<int, queue<int>> msg_map;
if (msg_map.find(client_id) != msg_map.end())
{
    queue<int> dummy_queue;
    dummy_queue.push(msg); //msg is an int
    msg_map.insert(make_pair(client_id, dummy_queue);
}
else
{
    msg_map[client_id].push(msg);
}

There are many clients reading - and removing - from this map.
if (msg_map.find(client_id) != msg_map.end())
{
    if (!msg_map.find(client_id)->second.empty())
    {
        int msg_rxed = msg_map[client_id].front();

        //processing message

        msg_map[client_id].pop();
    }
}

I am reading this on mutexes (haven't used them before) and I was wondering when and where I ought to lock the mutex. My confusion lies in the fact that they are accessing individual queues (held within the same map). Do I lock the queues, or the map?
Is there a standard/accepted way to do this - and is using a mutex the best way to do this? There are '0s of client threads, and just that 1 single writing thread.

A: Simplifying and optimizing your code
For now we'll not concern ourselves with mutexes, we'll handle that later when the code is cleaned up a bit (it will be easier then).
First, from the code you showed there seems to be no reason to use an ordered std::map (logarithmic complexity), you could use the much more efficient std::unordered_map (average constant-time complexity). The choice is entirely up to you, if you don't need the container to be ordered you just have to change its declaration:
std::map<int, std::queue<int>> msg_map;
// or
std::unordered_map<int, std::queue<int>> msg_map; // C++11 only though

Now, maps are quite efficient by design but if you insist on doing lookups for each and every operation then you lose all the advantage of maps.
Concerning the writer thread, all your block of code (for the writer) can be efficiently replaced by just this line:
msg_map[client_id].push(msg);

Note that operator[] for both std::map and std::unordered_map is defined as:

Inserts a new element to the container using key as the key and a default constructed mapped value and returns a reference to the newly constructed mapped value. If an element with key key already exists, no insertion is performed and a reference to its mapped value is returned.

Concerning your reader threads, you can't directly use operator[] because it would create a new entry if none currently exists for a specific client_id so instead, you need to cache the iterator returned by find in order to reuse it and thus avoid useless lookups:
auto iter = msg_map.find(client_id);
// iter will be either std::map<int, std::queue<int>>::iterator
//                  or std::unordered_map<int, std::queue<int>>::iterator
if (iter != msg_map.end()) {
    std::queue<int>& q = iter->second;
    if (!q.empty()) {
        int msg = q.front();
        q.pop();
        // process msg
    }
}

The reason why I pop the message immediately, before processing it, is because it will improve concurrency when we add mutexes (we can unlock the mutex sooner, which is always good).
Making the code thread-safe
@hmjd's idea about multiple locks (one for the map, and one per queue) is interesting, but based on the code you showed us I disagree: any benefit you'll get from the additional concurrency will quite probably be negated by the additional time it takes to lock the queue mutexes (indeed, locking mutexes is a very expensive operation), not to mention the additional code complexity you'll have to handle. I'll bet my money on a single mutex (protecting the map and all the queues at once) being more efficient.
Incidentally, a single mutex solves the iterator invalidation problem if you want to use the more efficient std::unordered_map (std::map doesn't suffer from that problem though).
Assuming C++11, just declare a std::mutex along with your map:
std::mutex msg_map_mutex;
std::map<int, std::queue<int>> msg_map; // or std::unordered_map

Protecting the writer thread is quite straightforward, just lock the mutex before accessing the map:
std::lock_guard<std::mutex> lock(msg_map_mutex);
// the lock is held while the lock_guard object stays in scope
msg_map[client_id].push(msg);

Protecting the reader threads is barely any harder, the only trick is that you'll probably want to unlock the mutex ASAP in order to improve concurrency so you'll have to use std::unique_lock (which can be unlocked early) instead of std::lock_guard (which can only unlock when it goes out of scope):
std::unique_lock<std::mutex> lock(msg_map_mutex);
auto iter = msg_map.find(client_id);
if (iter != msg_map.end()) {
    std::queue<int>& q = iter->second;
    if (!q.empty()) {
        int msg = q.front();
        q.pop();
        // assuming you don't need to access the map from now on, let's unlock
        lock.unlock();
        // process msg, other threads can access the map concurrently
    }
}

If you can't use C++11, you'll have to replace std::mutex et al. with whatever your platform provides (pthreads, Win32, ...) or with the boost equivalent (which has the advantage of being as portable and as easy to use as the new C++11 classes, unlike the platform-specific primitives).

A: Read and write access to both the map and the queue need synchronized as both structures are being modified, including the map:
map<int, queue<int>> msg_map;
if (msg_map.find(client_id) != msg_map.end())
{
    queue<int> dummy_queue;
    dummy_queue.push(msg); //msg is an int
    msg_map.insert(make_pair(client_id, dummy_queue);
}
else
{
    msg_map[client_id].push(msg); // Modified here.
}

Two options are a mutex that locks both the map and queue or have a mutex for the map and a mutex per queue. The second approach is preferable as it reduces the length of time a single lock is held and means multiple threads can be updating several queues concurrently.


text:
Q: How to reproduce this pseudocode? I am trying to replicate the style of the following pseudocode.

The following minimal working example almost produces what I want except the extra vertical space between lines 7 and 8. How can I resolve this issue? Is there an easier way to format pseudocodes this way?
\documentclass[12pt]{article}

\usepackage[noend]{algpseudocode}

\setlength\parindent{0pt}
\newcommand{\Def}[3]{\textbf{#1}\ \textsc{#2}\ifthenelse{\equal{#3}{}}{}{(#3)}}
\algrenewcommand{\alglinenumber}[1]{\footnotesize#1\hspace{1em}}% <- This line

\begin{document}

    \Def{procedure}{Euclidian}{$a,b$}
    \begin{algorithmic}[1]
        \State $x \gets a$
        \State $y \gets b$
        \While{$x \not= y$}
            \If{$x < y$}
                \State $x \gets x - y$
            \Else
                \State $y \gets y - x$
            \EndIf
        \EndWhile
        \State \textbf{return} $x$
    \end{algorithmic}

\end{document}

Edit
I have tried clrscode3e this time. It worked, but required me to hack the package code. I still wonder if there is an easier solution.
\documentclass[12pt]{article}

\usepackage{clrscode3e}

\setlength\parindent{0pt}

% Restore \gets
\let\gets=\leftarrow

% Print 'do' and 'then'
\renewcommand{\Do}{\textbf{do}\addtocounter{indent}{1}}
\renewcommand{\Then}{\textbf{then}\addtocounter{indent}{1}}

% Indent recursively (\hspace is used instead of \>)
\renewcommand{\putindents}{\ifnum\value{thisindent}>0%
    \hspace{1.5em}\addtocounter{thisindent}{-1}\putindents%
\fi}

% Line number separation (hspace is added)
\makeatletter
\renewcommand{\liprint}{\protected@xdef\@lilabel{\thecodelinenumber}%
    \ifnumberedline\thecodelinenumber\fi\'\hspace{0.25em}\Indent%
}
\makeatother

\begin{document}

    \begin{codebox}
    \Procname{\textbf{procedure} $\proc{Euclidian}(a,b)$}
    \li $x \gets a$
    \li $y \gets b$
    \li \While $x \not= y$ \Do
    \li     \If $x < y$ \Then
    \li         $x \gets x - y$
    \li     \Else
    \li         $y \gets y - x$
            \End
        \End
    \li \Return $x$
    \end{codebox}

\end{document}

Edit 2
The patch proposed by @egreg fixes vertical alignment, but I have one more issue. In the first MWE, the marked line left-aligns the line numbers by increasing the separation. However, it cannot handle multidigit line numbers. What are your suggestions?

A: While Spurious whitespace with algpseudocode and noend corrects the vertical alignment, the horizontal alignment of the line numbering can be changed using a fixed-width box:

\documentclass{article}

\usepackage[noend]{algpseudocode}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\ALG@doentity}{\item[]\nointerlineskip}{}{}{}
\makeatother

\setlength{\parindent}{0pt}
\newcommand{\Def}[3]{\textbf{#1}\ \textsc{#2}\ifthenelse{\equal{#3}{}}{}{(#3)}}
\algrenewcommand{\alglinenumber}[1]{\makebox[1.5em][l]{\footnotesize#1}}
\algrenewcommand{\Return}[1]{\State \textbf{return} #1}

\makeatletter
\newcommand{\@procedure}[1][\relax]{%
  \def\procedurearg{#1}%
  \textbf{procedure}
  \textsc{\procedurename}%
  \ifx\procedurearg\relax\else
    (#1)%
  \fi
  \par
  \begin{algorithmic}[1]
}
\newenvironment{procedure}[1]
  {\par
   \setlength{\parindent}{0pt}% Remove paragraph indent
   \def\procedurename{#1}%
   \@procedure
  }
  {\end{algorithmic}}
\makeatother

\begin{document}

\begin{procedure}{Euclidian}[$a,b$]
  \State $x \gets a$
  \State $y \gets b$
  \While{$x \not= y$}
    \If{$x < y$}
      \State $x \gets x - y$
    \Else
      \State $y \gets y - x$
    \EndIf
  \EndWhile
  \Return{$x$}
\end{procedure}

\end{document}

For convenience, I've wrapped the procedure-algorithmic mix into a single procedure environment.


text:
Q: Availability Strategies in MS SQL Server 2008 I need some assistance in developing a backup strategy for my SQL Server deployments. Currently I have two classes of customer: Hosted customers, whose data is housed in our datacenter, and On Premises customers who host their own data locally.
We are currently exploring whether to use Log Shipping or Database Mirroring for our Hosted customers as data loss of up to 15 minutes is acceptable (Log shipping interval would be 15 minutes, Mirroring would be in High Performance Mode), but we are still conducting testing on that.
My question is, if we choose a Mirroring strategy for our hosted customers, I doubt we would be able to do that with our our OnPrem customers - they will likely be using log shipping. Is it possible to have multiple recovery strategies database-by-database, or would I need a new instance of SQL Server for the OnPrem customers?
EDIT - Changed title to "Availability Strategies" because, well, this is more about availability than recovery.

A: Database Mirroring isn't a database recovery strategy.  It's a high availability strategy.  If you can afford to loose up to 15 minutes worth of data then you take transaction log backups every 15 minutes.
If you need to look into high availability that's a totally different conversation, but it doesn't remove the need to be taking transaction log backups.
As for your self-hosted customers, they are responsible for setting up their own backup solution unless your contract states that you'll work with them to set one up for them.


text:
Q: Is $V_\alpha \cap H_{\omega_1}$, for $\omega < \alpha < \omega_1$, absolute for models of ZF? Let $\alpha$ be an ordinal such that $\omega < \alpha < \omega_1$. Is $V_\alpha \cap H_{\omega_1}$ absolute for models of ZF?
Note: $H_{\omega_1}$ denotes the set of hereditarily countable sets.

A: No, of course not. Just adding reals will increase $V_{\omega+1}\cap H_{\omega_1}$. And therefore any other $V_\alpha\cap H_{\omega_1}$.
Also, note that if $V=L$, then $V_\alpha\cap H_{\omega_1}=L_\alpha$, and if $H_{\omega_1}\neq L_{\omega_1}$, then at some $\alpha$ the intersection is no longer $L_\alpha$. (Recall that $(H_{\omega_1})^L=L_{\omega_1}$.)


text:
Q: Rendering same component twice in different pages in React import React from "react";
import ReactDOM from "react-dom";

import Pagination from "./components/pagination.js";
import Header from "./components/header.js";
import DataBox from "./components/stats.js"

const imageHeaderIndex = document.getElementById("imageHeaderIndex");
const navBarIndex = document.getElementById("navBarIndex");

const imageHeader = document.getElementById("imageHeader");
const navBar = document.getElementById("navBar");
const dataDiv = document.getElementById("textualContent");

ReactDOM.render(<Header/>, imageHeaderIndex)
ReactDOM.render(<Pagination/>, navBarIndex)

ReactDOM.render(<Header/>, imageHeader)
ReactDOM.render(<Pagination/>, navBar)
ReactDOM.render(<DataBox url="http://localhost:8081/stats/pageInfo" pollInterval={2000}/>, dataDiv);

Hello all, I am very new to javascript and react. I have the code above and I was trying to render the same react component twice, but on different pages.
ids = imageHeaderIndex and navBarIndex belong to index.html, while the rest belong to another page (stats.html)
However, the components are not reflected on stats.html. And I faced the error: Uncaught Invariant Violation: _registerComponent(...): Target container is not a DOM element. Anybody knows why?

A: This isn't the right approach when working with React. While you are "thinking in components", the actual app needs structure. One recommendation is Container components, which if need be, can manage state and pass it down. Anyways, why not have one component that you pass into ReactDOM.render, something like so
(note: I do not know the structure of the app, this is an example)
// one HTML element with id="main", one React Container called <App />:
import React from "react";
import ReactDOM from "react-dom";

import Pagination from "./components/pagination.js";
import Header from "./components/header.js";
import DataBox from "./components/stats.js"

const main = document.getElementById("main");

const App = React.createClass({
  render: function() {
    return (
      <div id="main">
        <Header>
          <Pagination></Pagination>
          <Header>
            <Pagination></Pagination>
          </Header>
        </Header>
      </div>
    )
  }
})

ReactDOM.render(<App url="http://localhost:8081/stats/pageInfo" pollInterval={2000}/>, main);

Ideally, you only have one `ReactDOM.render' function per file.


text:
Q: Microsoft Access View - modified date / time I've noticed that you can view the last modified date / time for a View inside of Microsoft Access, is there a way of getting this data out using standard SQL?

A: OK, I've managed to find the hidden table MSysObjects, this holds the Name of the object, along with DateCreated, DateUpdated and other useful information!


text:
Q: Eclipse Reading File From Resource NullPointerException I am a newb so please don't hit me too hard.  I have been trying to figure this out for like 2 days now reading posts and blogs and I keep getting a NullPointerException error and I cannot figure out why it will not reach the files.  Below I am showing the layout of my folders, I have tried this multiple ways putting resource folder inside the src folder or outside and I still get the same error.

Here is my code I am using.
package com;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;

public class ClasspathFileReader
{
    public static void main(String[] args) throws IOException
        {
        String fileName = "resource/SrcPath.txt";
        ClassLoader classLoader = ClassLoader.getSystemClassLoader();

        File file = new File(classLoader.getResource(fileName).getFile());

        //Read File Content
        String content = new String(Files.readAllBytes(file.toPath()));
        System.out.println(content);
    }
}

Stack Trace:
Exception in thread "main" java.lang.NullPointerException
    at com.ClasspathFileReader.main(ClasspathFileReader.java:14)

A: Your file (SrcPath) doesn't end up with .txt extension according to screenshot. Give it a try.

A: I have two comments on your code:

*

*As pointed out by @yilmaz, rename your file as SrcPath.txt. Just use the rename option in eclipse.

*The getResource() searches for the file relative to your .class file. Thus, create a package resource inside your src folder and save your SrcPath.txt file here.

A: Using  classloader your file should be in your class folder i.e src. Put your SrcPath.txt in src folder and it will work just fine.


text:
Q: convert Text area into pdf file how I can get a field (text area) from my database and read it as a pdf

A: What do you mean, to retrieve a text value and read it as pdf?
If you read values from a database at the most you can use these values to generate a pdf through a library like PDFBox, IText or GlobalReports


text:
Q: Expand document.getSelection() to entire paragraph With IE, this js code only works when the selection has a non-zero length:
document.execCommand("FormatBlock",false,tag);

Getting the containing node is trivial:
var node = document.getSelection().anchorNode;

but I don't really understand how to set the selection to encompass all the text of this node.
The single biggest source of confusion for me is ranges, selections, the relationship between the two and how you use them together in the context of a contenteditable div which seems to have different rules from input controls. I tried searching for a tutorial but "selection" and "range" are broad terms and I haven't found anything good yet.
I found this in msdn but due to my incomprehension of ranges and selections I couldn't see how to apply it. Here's a code snippet and prefatory text from that page.

When applied to a TextRange object, the select method causes the
  current object to be highlighted. The following function uses the
  findText method to set the current object to the text in the TextRange
  object. The function assumes an element that contains the text string
  "text here".

function TextRangeSelect() {
  var r = document.body.createTextRange();
  r.findText("text here");
  r.select();
}

From that I wrote the following, but it causes the whole document to be selected.
var sel = document.getSelection();
var r = document.body.createTextRange();
r.findText(sel.anchorNode);
r.select();

A: This will expand the selection to the whole paragraph.
sel.selectAllChildren(sel.anchorNode.parentNode);

Since you only need to do this for internet explorer, this is your all-browsers version
if (document.getSelection) {
  var sel = document.getSelection();
  var node = typeof sel.anchorNode.data == "string" ?
    sel.anchorNode.parentNode :
    sel.anchorNode;
  sel.selectAllChildren(node);
}


text:
Q: Prove the sum of binormal and tangent vector of curve is constant Given $\gamma:(-1,1)\to\mathbb{R}^3$  a curve parametrized by arc length with $\vec T'(t)\neq(0,0,0)$ , curvature $\kappa(t)$ and torsion $\tau(t)$ such that :
$$\kappa(t)=\tau(t)=\frac{1}{\sqrt{8(1-t^2)}}$$
I want to prove that $\vec T(t)+\vec B(t)$ is a constant vector.
I've found a simple solution to this without using the expression given for the curvature and the torsion, something which puzzles me. Since the curve is parametrized by arc length, we can use Frenet-Serret formulas :
$$T'(t)=\kappa(t)N(t)\\ B'(t)=-\tau(t)N(t)$$
Adding the two equations, we easily prove what is asked:
$$T'+B'=0\\\Rightarrow(T+B)'=0$$
Is it really that simple? Have I used something I should not? Others solutions to the problem are welcome as well.


text:
Q: IHostBufferPolicySelector based on custom attribute I am trying to implement IHostBufferPolicySelector (C# and Web API) based on a custom attribute. I.e. I want to determine whether a request should be buffered or not based on an attribute at the controller's method. Like this:
[NoBuffer]
[HttpPost]
public void UploadData()
{
  // Read from the stream here...
}

How do I achieve this? I need some way for my IHostBufferPolicySelector implementation to determine whether the NoBuffer attribute is present or not.

A: It's safe to say that with the current architecture of Web API it's a no-go.
In fact, controller level is far too late in the stack to make decisions about buffering requests.
IHostBufferPolicySelector is a global service, ingrained as low into the stack as possible - into HttpControllerHandler, which is the heart of Web API (it's just an HTTP handler). So it's really not possible to have it applied to a specific request like you would like.
What Web API does on every request in an internal method inside HttpControllerHandler is this:
// Choose a buffered or bufferless input stream based on user's policy
    IHostBufferPolicySelector policySelector = _bufferPolicySelector.Value;
    bool isInputBuffered = policySelector == null ? true : policySelector.UseBufferedInputStream(httpContextBase);
    Stream inputStream = isInputBuffered
                            ? requestBase.InputStream
                            : httpContextBase.ApplicationInstance.Request.GetBufferlessInputStream();

where _bufferPolicySelector is a global configuration value; so it selects the buffer approach based on that global value.
I reckon you could log this on ASP.NET Web stack's Codeplex issue list as a proposed featured, but for now you have to use one global IHostBufferPolicySelector setting.
The way I imagine it could be implemented, is that the assembly would have to be scanned for the [NoBuffer] attributes at startup, and some static config would have to be created with a map of urls for which buffering should not happen. Then, at the lowest level, in the HttpControllerHandler this map would have to be compared against the incoming request url to determine the buffering policy.


text:
Q: Custom admin grid filter - error when searching joined column I have a custom grid with columns created by joining a flat table to the customer collection.
Everything works fine except when i try to filter the list using any of the column added from the flat table.
In _prepareCollection()
    $collection = Mage::getModel('customer/customer')->getCollection()
            ->addNameToSelect()
            ->addAttributeToSelect('email')
            ->addAttributeToSelect('created_at')
            ->addAttributeToSelect('group_id')
            ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left');

    $collection->joinTable(array('up' => 'mymodule/userprofile'), 'mageuserid=entity_id', array('*'), null, 'left');
    $collection->addAttributeToFilter('entity_id', array('in' => $record));
    $collection->addFilterToMap("shoptitle", "up.shoptitle");
    $collection->addFilterToMap("contactnumber", "up.contactnumber");
    $this->setCollection($collection);
    parent::_prepareCollection();

Added columns in _prepareColumns()
    $this->addColumn('shoptitle', array(
        'header' => Mage::helper('mymodule')->__('Shop Title'),
        'index' => 'shoptitle',
        'type' => 'text',
    ));
    $this->addColumn('contactnumber', array(
        'header' => Mage::helper('mymodule')->__('Telephone'),
        'width' => '100',
        'index' => 'contactnumber',
    ));

Here is my error log
    exception 'Exception' with message 'Non Object found for attribute shoptitle' in C:\xampp\htdocs\mage_test\app\code\core\Mage\Eav\Model\Entity\Abstract.php:785
    Stack trace:
    #0 C:\xampp\htdocs\mage_test\app\code\core\Mage\Eav\Model\Entity\Collection\Abstract.php(1377): Mage_Eav_Model_Entity_Abstract->isAttributeStatic('shoptitle')
    #1 C:\xampp\htdocs\mage_test\app\code\core\Mage\Eav\Model\Entity\Collection\Abstract.php(321): Mage_Eav_Model_Entity_Collection_Abstract->_getAttributeConditionSql('shoptitle', Array, 'inner')
    #2 C:\xampp\htdocs\mage_test\app\code\core\Mage\Eav\Model\Entity\Collection\Abstract.php(341): Mage_Eav_Model_Entity_Collection_Abstract->addAttributeToFilter('shoptitle', Array)
    #3 C:\xampp\htdocs\mage_test\app\code\core\Mage\Adminhtml\Block\Widget\Grid.php(472): Mage_Eav_Model_Entity_Collection_Abstract->addFieldToFilter('shoptitle', Array)
    #4 C:\xampp\htdocs\mage_test\app\code\core\Mage\Adminhtml\Block\Widget\Grid.php(457): Mage_Adminhtml_Block_Widget_Grid->_addColumnFilterToCollection(Object(Mage_Adminhtml_Block_Widget_Grid_Column))
    #5 C:\xampp\htdocs\mage_test\app\code\core\Mage\Adminhtml\Block\Widget\Grid.php(517): Mage_Adminhtml_Block_Widget_Grid->_setFilterValues(Array)
    #6 C:\xampp\htdocs\mage_test\app\code\local\Test\Mymodule\Block\Adminhtml\Partners\Grid.php(52): Mage_Adminhtml_Block_Widget_Grid->_prepareCollection()
    #7 C:\xampp\htdocs\mage_test\app\code\core\Mage\Adminhtml\Block\Widget\Grid.php(626): Test_Mymodule_Block_Adminhtml_Partners_Grid->_prepareCollection()
    #8 C:\xampp\htdocs\mage_test\app\code\core\Mage\Adminhtml\Block\Widget\Grid.php(632): Mage_Adminhtml_Block_Widget_Grid->_prepareGrid()
    #9 C:\xampp\htdocs\mage_test\app\code\core\Mage\Core\Block\Abstract.php(918): Mage_Adminhtml_Block_Widget_Grid->_beforeToHtml()
    #10 C:\xampp\htdocs\mage_test\app\code\local\Test\Mymodule\controllers\Adminhtml\Mymodule\PartnersController.php(56): Mage_Core_Block_Abstract->toHtml()
    #11 C:\xampp\htdocs\mage_test\app\code\core\Mage\Core\Controller\Varien\Action.php(418): Test_Mymodule_Adminhtml_Mymodule_PartnersController->gridAction()
    #12 C:\xampp\htdocs\mage_test\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('grid')
    #13 C:\xampp\htdocs\mage_test\app\code\core\Mage\Core\Controller\Varien\Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
    #14 C:\xampp\htdocs\mage_test\app\code\core\Mage\Core\Model\App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
    #15 C:\xampp\htdocs\mage_test\app\Mage.php(684): Mage_Core_Model_App->run(Array)
    #16 C:\xampp\htdocs\mage_test\index.php(83): Mage::run('', 'store')
    #17 {main}

A: Why not use something like that :
$collection->joinTable(array('mup' => 'marketplace/userprofile'), 'mageuserid=entity_id', array('*'), null, 'left');

and then add filter callback on specific columns :
$this->addColumn('shoptitle', array(
            'header'    => Mage::helper('customer')->__('Shop Title'),
            'index'     => 'shoptitle',
            'filter_condition_callback' => array($this, '_filterShopTitle'),
            'order_callback'            => array($this, '_sortShopTitle')
        ));

_filterShopTitle function body
    /**
     * Function that handle filter on custom table
     *
     * @param $collection
     * @param $column
     */
    protected function _filterShopTitle($collection, $column)
    {
        if ($column->getFilter()->getValue() === null) {
            return;
        }

        $collection->getSelect()->where('mup.shoptitle like ?', '%' . $column->getFilter()->getValue() . '%');
    }

and for sorting :
    /**
     * Function that handle sorting on custom table
     *
     * @param Mage_Customer_Model_Resource_Customer_Collection $collection
     * @param Mage_Adminhtml_Block_Widget_Grid_Column          $column
     */
    function _sortShopTitle($collection, $column)
    {
        $collection->getSelect()->order($column->getIndex() . ' ' . strtoupper($column->getDir()));
    }


text:
Q: Why does a minor faction attack me once I assimilate it? I pacified my first minor faction, Bos, by completing their quest. A few turns later I assimilated them. They immediately responded by besieging my city in their native region. What's going on and how am I supposed to respond?

A: Pacifying a minor faction does not affect roaming armies of that faction currently on the map; it only stops new armies from being spawned in that region. You still have to kill off any roaming armies that were spawned before you pacified the faction.
I think it was only coincidence that one of the armies started besieging your city after you assimilated the minor faction.


text:
Q: Mean Value Theorem gives Lipschitz? Let $f:D\subset_{open} \mathbb{R^2} \rightarrow \mathbb{R}$ continuous, $\frac{ \partial f}{\partial x}=f_x$ exists and is continuous on $D$ and let $K\subset D$ a closed rectangle. Then, by the Mean Value Theorem $f$ is Lipschitz continuous on $K$ w.r.t. the second variable $x$, i.e.: $|f(t,x_1)-f(t,x_2)| \leq L_K|x_1-x_2| \quad \forall (t,x_1),(t,x_2)\in K$, where $L_K=max_{(t,x)\in K}|f_x(t,x)|$.
I'm not sure how we came to this conclusions since the Mean Value Theorem for real valued functions of two variables assumes the function is differentiable. Do the above assumptions give us differentiability or is there a version of the Mean Value Theorem for some partial derivatives?

A: I think the point here is that you are working on a compact set(rectangle) and can keep  $t$ fixed. I.e., you are considering a function $f_t(x)$ for a fixed $t$ on this rectangle and can then get Lipschitz of this function by mean-value-theorem.
You will get that $|f_t(x_1)-f_t(x_2)| \leq L_{t,K}|x_1-x_2|$. Now your Lipschitz-constant (by the mean-value theorem for 1-dimension) is the partial-derivative w.r.t. x of your original function at some $(t,c), c \in [x_1,x_2]$.
Now you can take the supremum on both sides of the inequality over $t$, i.e.
$ \underset{t}{sup}|f_t(x_1)-f_t(x_2)| \leq \|x_1-x_2|  \underset{t}{sup} L_{t,K} = |x_1-x_2|\underset{t,x}{sup} |\frac{\partial f}{\partial x}(t,x)| $.
Where the equality will follow from continuity (but thats only important if you really want to determine the Lipschitz-constant, if not, you can also assume there is a second lesser/equal sign). As your partial derivative is continuos and your set is compact, the supremum on the right side will be finite.


text:
Q: Comparing a list with a list of tuples I have a list of tuples, e.g.
journeylist = [("uk_Frank_3734823","342-2432-242-2342",2,3434-3434),("uk_joe_3734823","342-2432-242-2342",2,3434-3434)]

and a list, e.g.
exclusion = ["joe","jack","alice"]

I would like to compare the exclusion list with the 0 index of each tuple. the value can be in any case, e.g. 73473_Jack_uk and the list has jack. They should match. If there is a match the whole tuple must be removed or non matches added to another list.

A: I would do this by lower casing the first value and checking the exclusion list against it:
lowered_exclusion = [excl.lower() for excl in exclusion]
filtered_journeylist = []
for journey in journeylist:
    first = journey[0].lower()
    if not any(excl in first for excl in lowered_exclusion):
        filtered_journeylist.append(journey)

A: I had wrote the code with explanation to make things clearer. :)
journeylist = [("uk_Frank_3734823","342-2432-242-2342",2,3434-3434),("uk_joe_3734823","342-2432-242-2342",2,3434-3434)] # Your provided journey list;

exclusion = ["joe","jack","alice"] # Your provided exclusion list;

JourneyList_lowercase = [i[0].lower() for i in journeylist] # Dublicate journey list array in lowercase;

ExclusionList_lowercase = [i.lower() for i in exclusion] # Dublicate exclusion list in lowercase;

Filtered_List = [] # Prepare new list;

for JL in JourneyList_lowercase: # Go trough journey list in lowercase array;
    if not any(EXC in JL for EXC in ExclusionList_lowercase): # Check if we have not any exclusion in our journey list;
        Filtered_List.append(JL) # If we have not any exclusion in our journey list -> add value to our new prepared list;

print(Filtered_List)


text:
Q: Gallery container not stretching/expanding to fit unique content but staying fixed at one size (of the largest child element in the gallery)? Gallery containers are not automatically stretching/shrinking to accommodate unique content? Remaining a fixed height (largest child) for every gallery element.
First, I created several containers ('thumbnail2') inside a larger container ('two') and arranged them in CSS using flexbox. Then I added one image (all different sizes) and some text (different content) to six different 'thumbnail2' divs in HTML.
The containers ('thumbnail2') holding the image+text aren't dynamically adjusting to accommodate the content inside. Everything is displayed, but the height of the containers seems to be fixed to the size of the largest child elements, so there is quite a lot of empty space around the containers with less content inside. I want each container to stretch and contract automatically to fit what is inside it. I thought if I left out 'height' in the CSS, then it would do this automatically?
I'm left with an unevenly spaced gallery. Will the container stay fixed at one size if it is filled with divs of different sizes?
How do I get the spacing between each element spaced evenly down each column?
HTML:

Glossy, shiny leaves

        Set your past on fire and leave.

CSS:

.two {
  width: 750px;
  margin:10px;
display:flex;
justify-content: center;
  flex-flow:row wrap;
  border-bottom: 1px solid black;
}

.thumbnail2 {
  width:220px;
background-color: violet;
  margin:10px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-flow:column;
}

.photo {
  width:220px;
line-height: 0;
  background-color: skyblue;
}

.photo img {
  width:100%;
  height:100%;
  object-fit: cover;
  object-position: top;
}

.phototext {
  width:220px;
height:auto;
  background-color: red;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-flow:column;
}


text:
Q: Test works on local Windows machine but fails on Linux server I have this test:
@Test
void testHeader() {

    String inputFile = ".\\src\\main\\resources\\binaryFile";
    MDHeader addHeader = new MDHeader();

    try (
                InputStream inputStream = new FileInputStream(inputFile);
    ) {

        long fileSize = new File(inputFile).length();
        byte[] allBytes = new byte[(int) fileSize];
        inputStream.read(allBytes);
        ProducerRecord<String, byte[]> record = new ProducerRecord<String, byte[]>("foo", allBytes);
        ProducerRecord<String, byte[]> hdr = addHeader.addMDHeader(record);

        for (Header header : hdr.headers()) {
            assertEquals("mdpHeader", header.key());
        }
    }
    catch(Exception e) {
        assert (false);
    }
}

The test succeeds when run locally through Eclipse on my Windows desktop but it fails at com.me.be.HeaderTests.testMDHeader(HeaderTests.java:81) when trying to build the jar on a Linux server. That's the line assert (false). I haven't got any more information on the issue yet but was wondering if it could be the backslashes in inputFile in a Linux environment?

A: Java on Windows and Linux will both accept / as path separator, whereas Linux does not like \\ as a path separator - so treats the whole string as ONE path component, not 4 parts as you'd expect:
String inputFile = "./src/main/resources/binaryFile";

However for file handling it is better to use java.nio.Path or java.io.File in place of String.
WINDOWS
jshell> Path.of("./src/main/resources/binaryFile")
$2 ==> .\src\main\resources\binaryFile

Linux
jshell> Path.of("./src/main/resources/binaryFile")
$1 ==> ./src/main/resources/binaryFile

You can also use Path.of without any file separator for any OS:
Path p = Path.of("src","main","resources","binaryFile");

A: The File.separator string is handy to concat into the path string in order to produce an OS independent file path.
String inputFile = "." + File.separator + "src" + File.separator + "main" + File.separator + "resources" + File.separator + "binaryFile";

Should give you a cross platform compliant file path.


text:
Q: Angular ssr, page rerender issue I am new to Angular ssr, you can see code below
Issue
If I enter to client route directly, first it shows

Rendered by server

but quickly after that it rerenders page and shows:

Rendered by browser

I think I know why this happens, but to be sure can someone provide a good explanation? also, Can I somehow avoid this behavior and force browser to render html that comes from server? should I worry about this?
client.component.ts
@Component({
  selector: "client",
  template: "
Rendered by {{ renderer }}
",
  styleUrls: ["./dumco.component.css"]
})
export class ClientComponent implements OnInit {

  renderer: string;
  bla: any = [];

  constructor(private http: HttpClient, @Inject(PLATFORM_ID) platformId: any) {
    this.renderer = isPlatformBrowser(platformId) ? "Browser" : "Server";
  }
}

app-routing.module.ts
import { NgModule } from "@angular/core";
import { RouterModule, PreloadAllModules } from "@angular/router";
import { AppComponent } from "./app.component";
import { CompfComponent } from "./compf/compf.component"
import { HomeComponent } from "./home/home.component"

export const appRoutes = [
  {
    path: "",
    component: HomeComponent
  },
  {
    path: "comp",
    component: CompfComponent
  },
  {
    path: "client",
    loadChildren: () => import("./client/client.module").then(m => m.ClientModule),
    data: { title: "Static Data - Clients" }
  },
];

// preloadingStrategy: PreloadAllModules,
@NgModule({
  imports: [RouterModule.forRoot(appRoutes, { onSameUrlNavigation: "reload", initialNavigation: 'enabled' })],
  exports: [RouterModule]
})
export class AppRoutingModule { }

app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule } from "@angular/common/http";

import { AppRoutingModule } from "./app-routing.module"

import { AppComponent } from './app.component';
import { CompfComponent } from './compf/compf.component';
import { HomeComponent } from './home/home.component';

import { TransferHttpCacheModule } from "@nguniversal/common"

@NgModule({
  declarations: [
    AppComponent,
    CompfComponent,
    HomeComponent
  ],
  imports: [
    HttpClientModule,
    TransferHttpCacheModule,
    BrowserModule.withServerTransition({ appId: 'serverApp' }),
    AppRoutingModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {}

app.server.module.ts
import { NgModule } from '@angular/core';
import { ServerModule, ServerTransferStateModule } from '@angular/platform-server';

import { AppModule } from './app.module';
import { AppComponent } from './app.component';

@NgModule({
  imports: [
    AppModule,
    ServerModule,
    ServerTransferStateModule
  ],
  bootstrap: [AppComponent],
})
export class AppServerModule {}

A: This is normal behaviour for angular universal. Here is the normal flow:

*

*You make a request to the server

*Angular universal creates and renders the components (including API calls) server side to generate the HTML content. The content is sent back to the client browser. (In your example, the HTML will contain "rendered by server")

*The browser renders the HTML.

*Once the page is rendered and the dom document loaded, the client side angular application is boostrapped.

*The client side angular app creates and render components (and makes API calls).  It will render "rendered by browser" in your case.

You do not really have to worry about this. In a real situation, you'd have your components make API calls. To prevent the client side making the same calls that have already been made server side, you can use angular TransferState to serialise the API data in the HTML generated server side, so that the client side can use that data straight away instead of making API calls again.
That way, the HTML generated by the client should be the same as the one that came from the server. (Unless of course you specifically display different data server and client side, like in your example)


text:
Q: Big Bang Theory Reference to Formal Logic In the second episode "The Junior Professor Solution" of the 8th season of the Big Bang Theory, there exists a brief moment where Sheldon Cooper references one of his boards with what for a brief moment looked like a bunch of statements in some formal system which has modal operators and quantification.  But there also exists an "ess" phrase in one of the strings of symbols.  I also couldn't tell what the rules of the system they would have referenced or what the axioms were.
Did the Big Bang Theory reference a formal system or just write symbols that looked like a formal system to an untrained eye (my guess is the later)?

A: This is Gödel's ontological proof, which is fully explained on Wikipedia (see the link).
I find this to be an incredible easter egg, since the proof is something which Sheldon says he doesn't understand. And Sheldon has expressed more than once that he doesn't believe in the existence of god.
(Originally I thought this would be something pertaining to the many-worlds interpretation of quantum mechanics, which was brought up a couple of scenes before this showed up. But upon re-examination of the screenshot, it didn't seem that way anymore.)


text:
Q: Actualizar tabla desde un select añadiendo la fecha en que se ejecuto la consulta Tengo una consulta select que me inserta los resultados en otra tabla necesito poder realizar la misma consulta periódicamente pero que me agregue un campo fecha con la fecha de ejecución de la consulta en cada registro para poder saber cuales son los registros más viejos y cuales más nuevos, poderlos organizar por fecha.
Esta es la consulta
INSERT INTO Resultadotb

SELECT     gen_unidadcontable.nombre AS 'Unidad Contable', inv_categoria.nombre AS Categoría, gen_producto.codigo, gen_producto.descripcion, SUM(inv_existencia.cantidad) AS Cantidad,
                      gen_medida.descripcion AS UM, ROUND(AVG(inv_existencia.preciomn), 2) AS PrecioCostoMN, SUM(inv_existencia.importemn) AS ImporteMN, ROUND(AVG(inv_existencia.preciomlc), 2)
                      AS PrecioCostoCUC, SUM(inv_existencia.importemlc) AS ImporteCUC, con_cuenta.clave AS Cuenta, con_cuentanat.descripcion AS Descrip_Cuenta

FROM         inv_existencia INNER JOIN
                      gen_producto ON inv_existencia.idproducto = gen_producto.idproducto INNER JOIN
                      inv_categoria ON inv_existencia.idcategoria = inv_categoria.idcategoria INNER JOIN
                      inv_existenciaalm ON inv_existencia.idexistencia = inv_existenciaalm.idexistencia INNER JOIN
                      gen_almacen ON inv_existenciaalm.idalmacen = gen_almacen.idalmacen INNER JOIN
                      gen_unidadcontable ON gen_almacen.idunidad = gen_unidadcontable.idunidad INNER JOIN
                      gen_medida ON gen_producto.idmedida = gen_medida.idmedida INNER JOIN
                      con_cuenta ON inv_existencia.idcuentamn = con_cuenta.idcuenta INNER JOIN
                      con_cuentanat ON con_cuenta.idcuenta = con_cuentanat.idcuenta

WHERE     (inv_existencia.cantidad > 0) AND (inv_categoria.nombre != 'Insumo' )

GROUP BY gen_unidadcontable.nombre, inv_categoria.nombre, gen_producto.codigo, gen_producto.descripcion, gen_medida.descripcion, con_cuenta.clave, con_cuentanat.descripcion

ORDER BY inv_categoria.nombre, con_cuenta.clave

A: seria bueno saber las estructuras de las tablas pero bueno,
inserto into tabla2(
select * , getdate()
from tabla1
)


text:
Q: Language translation issue in GitHub project I'm having problems with the translated language of my project on GitHub, my project is all in C# but when I go up with git to GitHub it says it's in JavaScript, I found other people trying to solve it with the .gitattributes file but I didn't I achieved

A: Você está utilizando o https://github.com/anuraghazra/github-readme-stats? Se for, eu fiz uma alteração na minha pagina principal da seguinte forma:
<img height="160em" src="https://github-readme-stats.vercel.app/api/top-langs/?username=leandropaixao&layout=compact&langs_count=20&theme=tokyonight&hide=javascript,html,css,scss,mako,less" />

Na url tem a opcao HIDE na qual você informa as extensões das linguagens ou arquivos que não quer que contabilize e apareça no gráfico.
Para o segundo item não tem muito o que fazer no caso.


text:
Q: Map JSON to php object I have a JSON which has the following structure, but I am only interested in the data inside entries node, therefore my DTO class's fields mirrors the tags inside the said node. But as expected I get an error when deserializing the JSON since JMSserializer expects an object which contains fields for all the tags in the JSON. Is there a way I can ignore the other tags? What is the proper way to accomplish this?
 {
"result": {
    "data": {
        "provider": "facebook",
        "pages": {
            "pagination": {
                "current_page": 1,
                "total_pages": 1,
                "entries_per_page": 250,
                "total_entries": 2,
                "order": {
                    "field": "date_creation",
                    "direction": "desc"
                }
            },
            "count": 2,
            "entries": [
                {
                    "user_token": "48d6b4a9-afd7-4ee7-b359-45bbf618ebe9",
                    "identity_token": "f5148587-3925-4fec-a214-3a339a023d2b",
                    "page_token": "c66c2d03-c9de-485b-9aea-445c405d44ab",
                    "date_creation": "Tue, 07 Apr 2015 10:37:52  0200",
                    "name": "Test Page",
                    "description": "This is the description of the page.",
                    "category": "Community",
                    "num_likes": 27,
                    "link": "https://www.facebook.com/test-page",
                    "thumbnailUrl": "https://graph.facebook.com/1234567890/picture?type=square",
                    "pictureUrl": "https://graph.facebook.com/1234567890/picture?type=large",
                    "source": {
                        "identifier": 1234567890,
                        "access_token": {
                            "key": "E797C0013811A1D1E35AD7EDD10FB99986DB664B0996C76ED9AE5E0A5151BBF9E797C0013811A1D1E35AD7EDD10FB99986DB664B0996C76ED9AE5E0A5151BBF9"
                        }
                    }
                },
                {
                    "user_token": "1f178827-c746-43e0-84d0-75cfd0513b1e",
                    "identity_token": "462fae22-f46b-4343-838c-1fc35113e92c",
                    "page_token": "886a4c73-fa1a-4261-839f-42672f42b842",
                    "date_creation": "Tue, 07 Apr 2015 10:37:52  0200",
                    "name": "Another Test Page",
                    "description": "This is the description of the page.",
                    "category": "Computers/internet website",
                    "num_likes": 2119,
                    "link": "https://www.facebook.com/another-test-page",
                    "thumbnailUrl": "https://graph.facebook.com/987654321/picture?type=square",
                    "pictureUrl": "https://graph.facebook.com/987654321/picture?type=large",
                    "source": {
                        "identifier": 987654321,
                        "access_token": {
                            "key": "A21C619251FB098250A15A69B20BEE6ED6835149CE1496D78A674F11B0920F9FA21C619251FB098250A15A69B20BEE6ED6835149CE1496D78A674F11B0920F9F"
                        }
                    }
                }
            ]
        }
    }
}
}

A: Use json_decode() for that:
$arr = json_decode($json_string, true);
$entries = $arr['result']['data']['pages']['entries'];
print_r($entries);

Output:
Array
(
    [0] => Array
        (
            [user_token] => 48d6b4a9-afd7-4ee7-b359-45bbf618ebe9
            [identity_token] => f5148587-3925-4fec-a214-3a339a023d2b
            [page_token] => c66c2d03-c9de-485b-9aea-445c405d44ab
            [date_creation] => Tue, 07 Apr 2015 10:37:52  0200
            [name] => Test Page
            [description] => This is the description of the page.
            [category] => Community
            [num_likes] => 27
            [link] => https://www.facebook.com/test-page
            [thumbnailUrl] => https://graph.facebook.com/1234567890/picture?type=square
            [pictureUrl] => https://graph.facebook.com/1234567890/picture?type=large
            [source] => Array
                (
                    [identifier] => 1234567890
                    [access_token] => Array
                        (
                            [key] => E797C0013811A1D1E35AD7EDD10FB99986DB664B0996C76ED9AE5E0A5151BBF9E797C0013811A1D1E35AD7EDD10FB99986DB664B0996C76ED9AE5E0A5151BBF9
                        )

                )

        )

    [1] => Array
        (
            [user_token] => 1f178827-c746-43e0-84d0-75cfd0513b1e
            [identity_token] => 462fae22-f46b-4343-838c-1fc35113e92c
            [page_token] => 886a4c73-fa1a-4261-839f-42672f42b842
            [date_creation] => Tue, 07 Apr 2015 10:37:52  0200
            [name] => Another Test Page
            [description] => This is the description of the page.
            [category] => Computers/internet website
            [num_likes] => 2119
            [link] => https://www.facebook.com/another-test-page
            [thumbnailUrl] => https://graph.facebook.com/987654321/picture?type=square
            [pictureUrl] => https://graph.facebook.com/987654321/picture?type=large
            [source] => Array
                (
                    [identifier] => 987654321
                    [access_token] => Array
                        (
                            [key] => A21C619251FB098250A15A69B20BEE6ED6835149CE1496D78A674F11B0920F9FA21C619251FB098250A15A69B20BEE6ED6835149CE1496D78A674F11B0920F9F
                        )

                )

        )

)


text:
Q: Split array in three equal sum subarrays Write a solution for the input array
which elements of the array are sorted into three
groups.
The sum of the elements of each group would
should be approximately equal.
Example 1: [7,5,3,1,2,3]
Result: [7] // 7, [5,2] //7, [3,3,1] // 7
I managed to do it when there is sum which can be divided in three equal parts. My question is how to upgrade code so it works in cases when sum is not equal or when some element of array is lager than divided sum?
Here is my code so far:
    var input=document.getElementById('niz').value;
    var arr=[];
    for (var i = 0; i < input.length; i++) {
        if(input[i]!=" " && !isNaN(input[i])){
            arr.push(input[i]);
        }

    }
    console.log(arr);
    var n=arr.length;
    var status=true;
    if(n<3){
        status=false;
    }
    else{
        var sum = 0;
        var auxiliary = 0;
        var i=0;
        var j=0;
        //calculate sum of elements
        for(i=0;i<n;i++){
            sum+=arr[i];
        }
        var point = Array(2).fill(0);
        if (sum % 3 == 0)
        {
            // Find that three equal subarray exists in given array
            for (i = 0; i < n && j < 2; ++i)
            {
                // Add current element into auxiliary variable
                auxiliary += arr[i];
                if (auxiliary == parseInt(sum / 3))
                {
                    point[j] = i + 1;
                    // Set zero sum
                    auxiliary = 0;
                    j++;
                }
            }
            if (j == 2)
            {
                // When equal three subarray exist
                j = 0;
                // Print the elements of subarray
                for (i = 0; i < n; ++i)
                {
                    if (j < 2 && point[j] == i)
                    {

                        j++;
                    }

                    console.log(arr[i]);
                }
            }
            else
            {
                status=false;
            }
        }
        else
        {
            status=false;
        }

    }if(status!=true){
        console.log("\n is is not possible")
    }

}


text: Q: Detach Ubuntu Pro Personal from Broken Device I have a Ubuntu Pro Personal Subscription. However the device attached to the subscription had to be reset. The issue I am having is the Ubuntu Pro dashboard still reports ( https://ubuntu.com/pro/dashboard ) that the 1 device is still attached to the subscription. I can't remove it via sudo pro detach cause it had to be reset and the device itself isn't attached to my Ubuntu Pro Personal Subscription. If I attach the reset device via sudo apt attach <token> I will have 2 devices the phantom device and the resetted device which is one and the same. How do i remove that resetted device manually from my Ubuntu Pro Personal subscription?


text:
Q: Strange behavior with nested arrays Suppose I have a nested array, foo:
>>> foo = [[" ", " "], [" ", " "]]

Say I want to change element 0 of array 0. I would do it like this:
>>> foo[0][0] = "a"
>>> print foo
[["a", " "], [" ", " "]]

Suppose instead foo is equal to this:
>>> foo2 = [[" "] * 2] * 2

If I print foo2, I'll still get the same result as the original foo:
>>> print foo2
[[" ", " "], [" ", " "]]

If I try to change an element in foo2 though, I'll get this result:
>>> foo2[0][0] = "a"
>>> print foo2
[["a", " "], ["a", " "]]

As you can see, instead of replacing just element 0 of array 0, it replaced element 0 in all of the arrays. What causes this strange behavior?


text:
Q: Is this "decomposition" just the Taylor expansion? Suppose $a=a(\vec{x},t)$ is a function of coordinates $\vec{x}$ and time $t$. Moreoever, let the time derivative be of the form $\dot{a}=w(a,\nabla a,\Delta a)$, where $w$ is some function. Additionally, it is assumed that spatial interactions are local and the spatial variation of $a$ is slow
Then, it is said that one can

"decompose the right-hand side in terms of $\nabla a$ and $\Delta a$, keeping only the first terms:
$$
\dot{a}=g(a)+A\nabla a+B (\nabla a)^2 + D\Delta a,
$$
where $A, B, D$ represent certain functions of $a$."

I am not sure if I do get the point: Where does this decomposition come from, isn't it just the Taylor expansion of $w$ around the point $(a,0,0)$ so that
\begin{align*}
g(a)&=w(a,0,0),\\
A&=\partial_y w(a,\nabla a,\Delta a),\\
B&=\frac{1}{2!}\partial_{yy}w(a,\nabla a,\Delta a),\\
D&=\partial_z w(a,\nabla a,\Delta a)?
\end{align*}
At least, it seems to me that the assumption that the spatial variation is slow means that both $\nabla a$ and $\Delta a$ are assumed to be close to $0$, respectively, and that the expression "in terms of $\nabla a$ and $\Delta a$" suggests to keep $a$ fix and to Taylor expand in $(a,0,0)$.

A: You're right. Here's some explanation for where the constants come from:

Let x = $[a,\nabla a, \Delta a]$. Let us do the Taylor expansion around $\hat{a} = [a,0,0]$
\begin{align}
\dot{a}&=w(x) = w(a,\nabla a,\Delta a)\\
w(x)&=w(\hat a) + D(w)^\top(x-\hat a) + o((x-\hat a)^\top H(w)(x-\hat a))\\
\end{align}
where $D(w)$ is the jacobian of w (at \hat a), and $H(w)$ is the hessian. $o(\cdot)$ indicates higher order terms that we will ignore.
\begin{align}
w(x)&\simeq w(\hat a) + \begin{bmatrix}\frac{\partial w}{\partial a}\\\frac{\partial w}{\partial \nabla a}\\\frac{\partial w}{\partial\Delta a}\end{bmatrix}^\top(x-\hat a)\\
w(x)&\simeq w(a,0,0) + \begin{bmatrix}\frac{\partial w}{\partial a}\\\frac{\partial w}{\partial \nabla a}\\\frac{\partial w}{\partial\Delta a}\end{bmatrix}^\top\begin{bmatrix}0\\\nabla a\\\Delta a\end{bmatrix}\\
&= w(a,0,0) + \frac{\partial w}{\partial \nabla a} \nabla a + \frac{\partial w}{\partial \Delta a} \Delta a\\
&= g(a)+A\nabla a+ D\Delta a
\end{align}
where $A = \frac{\partial w}{\partial \nabla a}$ and $D = \frac{\partial w}{\partial \Delta a}$. There is one term missing - coefficient B of $[\nabla a]^2$, but I only get that if I consider higher order terms, and the question only asks us to keep "the first terms".


text:
Q: Issues Configuring CLion, Cmake, and SFML I am currently trying to configure my Cmake file to include the SFML libraries.
My CMakeLists.txt. I'm using OS X Yosemite if that matter at all.
cmake_minimum_required(VERSION 2.8.4)
project(SFMLTest)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=lib++")

set(SOURCE_FILES main.cpp)
add_executable(SFMLTest ${SOURCE_FILES})

#Detect and add SFML
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Users/Home/SFML-2.2-osx-clang-universal/cmake/Modules" ${CMAKE_MODULE_PATH})
find_package(SFML 2.2 REQUIRED system window graphics network audio)
if (SFML_FOUND)
    include_directories(${SFML_INCLUDE_DIR})
    target_link_libraries(${main.cpp} ${SFML_Libraries})
endif()

and the error I am currently getting is
Error:By not providing "FindSFML.cmake" in CMAKE_MODULE_PATH this project has asked
CMake to find a package configuration file provided by "SFML", but CMake did notfind one.
Could not find a package configuration file provided by "SFML" (requested version 2.2)
with any of the following names:
 SFMLConfig.cmake   sfml-config.cmake
Add the installation prefix of "SFML" to CMAKE_PREFIX_PATH or
set "SFML_DIR"to a directory containing one of the above files.
If "SFML" provides a separate development package or SDK, be sure it has been installed.

my FindSFML.cmake is located at
/Users/Home/SFML-2.2-osx-clang-universal/cmake/Modules

A: Your question says the full path to the find module is
/Users/Home/SFML-2.2-osx-clang-universal/cmake/Modules/FindSFML.cmake

But you're adding ${CMAKE_SOURCE_DIR}/Users/Home/SFML-2.2-osx-clang-universal/cmake/Modules to your CMAKE_MODULE_PATH. ${CMAKE_SOURCE_DIR} is the absolute path to the directory containing the top-level CMakeLists.txt file. If you know the absolute path to the module file you want to include, you should most certainly not prefix it with the source tree path. Just change the line to this:
set(CMAKE_MODULE_PATH "/Users/Home/SFML-2.2-osx-clang-universal/cmake/Modules" ${CMAKE_MODULE_PATH})

Also note that since you have REQUIRED specified among the arguments to find_package(), CMake will terminate with an error if the package cannot be found. Having if(SFML_FOUND) is therefore pointless.

A: This solution is perfect: https://oxymeos.shost.ca/article.php?about=work_with_the_SFML_in_CLion. I recommend it! It worked for me
You create a folder named "cmake_modules" at the root of the project and you place in this folder the "FindSFML.cmake" file (on Windows and Mac OS X: "[Your_SFML Location]/cmake/Modules/FindSFML.cmake", and on Linux: "[Your_SFML_location]/share/SFML/cmake/Modules/FindSFML.cmake".
The CMake configuration file (CMakeLists.txt) is then presented in this form:
cmake_minimum_required(VERSION 3.7)
project([your_project])

# Define the source and the executable
set(EXECUTABLE_NAME "[name_executable]")
add_executable(${EXECUTABLE_NAME} [project_files])

# Detect and add SFML
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}" ${CMAKE_MODULE_PATH})
find_package(SFML 2 REQUIRED system window graphics network audio)
if(SFML_FOUND)
    include_directories(${SFML_INCLUDE_DIR})
    target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES})
endif()


text:
Q: turning a list into a table with presence/absence in bash I have the following list:
gene1 file1
gene2 file2
gene3 file3

to turn into the following presence/absence table
       gene1    gene2    gene3
file1  +        -        -
file2  -        +        -
file3  -        -        +

is there some way in bash to do that?

A: Assuming that there exists a character or string that can't exist in a genre name (below, I use __ -- a double underscore), you can use an associative array to store and perform amortized O(1) lookups.
#!/bin/bash

input='gene1 file1
gene2 file2
gene3 file3'

declare -A known_files=( )
declare -A known_genres=( )
declare -A known_pairs=( )

while read -r genre file; do
  known_files[$file]=1
  known_genres[$genre]=1
  known_pairs[${genre}__${file}]=1
done <<<"$input"

# write header containing all known genres
printf '%s\t' '' "${!known_genres[@]}"; printf '\n'

# iterate through files, writing columns for each
for file in "${!known_files[@]}"; do
  printf '%s\t' "$file"
  for genre in "${!known_genres[@]}"; do
    if [[ ${known_pairs["${genre}__${file}"]} ]]; then
      printf '%s\t' "+"
    else
      printf '%s\t' "-"
    fi
  done
  printf '\n'
done

Note that this requires bash 4.0 or newer -- if you're on OS X (which ships an ancient release for licensing reasons), consider installing a modern release with MacPorts or Homebrew.


text:
Q: Retain rows in a dataframe based on 2 columns satisfying different criteria ranges; there are 27 rows of ranges in the dataframe Edited for better clarity:
I have a dataframe dat which I need to extract the entire row based on 2 columns ut and ctz which must satisfy their respective rows of ranges in data.frame range_criteria simultaneously; the ranges are different for ut and ctz and they must satisfy their respective ranges. If either the ut or ctz is out of the range, the entire row will be discarded.
In another words when checking to each row of criteria, dat$ut must be equal OR within range_criteria$ut_min to range_criteria$ut_max AND dat$ctz must be equal OR within range_criteria$ctz_min to range_criteria$ctz_max
I have been cracking my brain over this for for 12 hours, I must make sure each row of ut and dat is checked by every row of the respective range_criteria. I know I have to loop, but I am not sure how... please help!
dat <- data.frame(name = c("Asics", 'Tom', "Harry", "David", "Daniel", "Harri", "Davidi", "Daniely", "May", "Kelly"),
             ut = c(33, 2.4, 3.2, 3.5,9.5,5.2,6.0,45, 46, 51),
             ctz = c(7.3, 1, 6.0, 3.5, 5.1, 51.5, 6.6, 7, 9.1, 10.1))

range_criteria <- data.frame(ut_min = c(0.0, 0.5, 1.0, 2.0, 7.2, 9.0, 21.0),
    ut_max = c(5, 10, 15, 25, 30, 35, 50),
    ctz_min = c(0, 1, 2, 3.2, 4.3, 6.3, 6.9),
    ctz_max = c(5, 5.5, 6.1, 6.2, 6.4 ,6.5, 7.8))

The expected outcome should be:
interest <- data.frame(name = c('Asics', 'Tom', "David", "Daniely" , "May"),
                 ut = c(33, 2.4, 3.5,45, 46),
                 ctz = c(7.3, 1, 3.5, 7, 9.1))

Thank you so much !!

A: Based on your description it sounds like you want the ith row of dat to satisfy both ranges specified in the ith row of range_criteria, is that correct?
If so, there's no need to loop (explicitly). R's vectorized approach makes this work pretty easily:
dat <- data.frame(name = c('Tom', "Harry", "David", "Daniel", "Harri", "Davidi", "Daniely"),
                  ut = c(2.4, 3.2, 3.5,9.5,5.2,6.0,45),
                  ctz = c(1, 6.0, 3.5, 5.1, 51.5, 6.6, 7))

rc <- data.frame(ut_min = c(0.0, 0.5, 1.0, 2.0, 7.2, 9.0, 21.0),
                             ut_max = c(5, 10, 15, 25, 30, 35, 50),
                             ctz_min = c(0, 1, 2, 3.2, 4.3, 6.3, 6.9),
                             ctz_max = c(5, 5.5, 6.1, 6.2, 6.4 ,6.5, 7.8))

dat[dat$ut >= rc$ut_min & dat$ut <= rc$ut_max & dat$ctz >= rc$ctz_min & dat$ctz <= rc$ctz_max,]

This also returns "Daniel" in addition to the other three names you mentioned, but looking at the data I think that's correct.
Alternately you could use a package designed for data manipulation like dplyr or data.table to do the same thing a bit more smoothly.
library(data.table)

both <- cbind(dat, rc)
setDT(both)
interest <- both[between(ut, ut_min, ut_max) & between(ctz, ctz_min, ctz_max)]

or
library(dplyr)

both <- bind_cols(dat, rc)

interest <- both %>%
  filter(ut >= ut_min & ut <= ut_max & ctz >= ctz_min & ctz <= ctz_max)


text:
Q: Does git use symlinks internally? (FUSE related) I'm considering implementing a very basic FUSE-based daemon. The problem is that I don't think I will be able to implement symlink support (so then when some app requires this feature to the filesystem I will simply return the errno ENOSYS at runtime).
Then the question is about git internals: when you commit and push things to git, are symlinks a fundamental thing that git uses internally inside the .git folder? Will I be able to use git with my FUSE-based mountpoint?

A: No, git doesn't use symbolic links internally. However, by default, it does use hardlinks for files under .git/objects while cloning from local repository. You can bypass that with --no-hardlinks.


text:
Q: Cache Organisation Whats's the difference between Direct Mapping and Four-way Set Associative? They both mean that certain blocks of the cache are associated with certain parts of the main memory.
The only difference I see is that the Four-way mapping limits it to only four cache blocks while Direct Mapping may be more or less than four. Am I right to say this?

A: Definitive textbook treatment IMO is Patterson-Hennessy. Online see wikipedia CPU_cache#Associativity.
Not right regarding Direct Mapping: "each entry in main memory can go in just one place in the cache".


text:
Q: T-SQL left join not returning null columns I have 2 tables in T-SQL one with 10 records and one with 11.
select tbl.unit, tbl2.unid
from tbl1
left join tbl2 on tbl2.UNID = tbl1.UNIT
where tbl2.Status = 'Main'
group by unit, UNID

This only returns 10 records when tbl1 has 11 records. I was expecting the missing record to show a value if UNIT but null for UNID but is just is not there.
I cannot figure out why this is the case

A: So why would a LEFT JOIN not show all the records from a left side of the join.
Is a bug?
Most likely not.
Lets look at a simplified example.
TableA has 3 records.
ID    ColA
1     Foo
2     Bar
3     Buzz

TableB has 2 records
ID    ColB
4     Foo
5     Bar

An INNER JOIN on ColA & ColB would return 2 records.
Only those where a match  is found.
SELECT ColA, ColB
FROM TableA a
JOIN TableB b ON b.ColB = a.ColA

Returns:
ColA    ColB
Foo     Foo
Bar     Bar

A LEFT JOIN would return 3 records.
With a NULL on the right side for the unmatched.
SELECT ColA, ColB
FROM TableA a
LEFT JOIN TableB b ON b.ColB = a.ColA

Returns:
ColA    ColB
Foo     Foo
Bar     Bar
Buzz    null

But what happens if a criteria is used in the WHERE clause for the right side?
SELECT ColA, ColB
FROM TableA a
LEFT JOIN TableB b ON b.ColB = a.ColA
WHERE b.ColB IN ('Foo', 'Bar', 'Buzz')

Returns:
ColA    ColB
Foo     Foo
Bar     Bar

What? Where's the 'Buzz'?
Can you guess why that LEFT JOIN seems to behave like an INNER JOIN?
The solution is to put such criteria in the ON clause.
SELECT ColA, ColB
FROM TableA a
LEFT JOIN TableB b
   ON b.ColB = a.ColA AND b.ColB IN ('Foo', 'Bar', 'Buzz')

Or do put the criteria in the WHERE, but also allow NULL.
SELECT ColA, ColB
FROM TableA a
LEFT JOIN TableB b
   ON b.ColB = a.ColA
WHERE (b.ColB IN ('Foo', 'Bar', 'Buzz')
       OR b.ColB IS NULL)

Returns:
ColA    ColB
Foo     Foo
Bar     Bar
Buzz    null

Now the Buzz is back.


text:
Q: OS X 10 Excel for Mac 2016 Startup Folder How does one set a Startup Folder for Excel for Mac 2016?  I have looked everywhere and, unlike the previous version of Excel for the Mac, can't find any documentation for the 2016 version.

A: I'm pretty sure what you want is in
Excel → Preferences → General → At startup open all files in ...