text:
Q: What's the difference between a signal and asynchronous operation in UML? Making sequence diagrams my tool allows for communication that is either synchronous operation, asynchronous operation, and signal.
What's the difference between the last two regarding program flow?

A: Signals are meant for asynchronous event driven communication. The signals are classifiers, that describe the attributes of their occurence.  Classes themselves and indicate in the reception section which signals they are able to process, and in interaction diagrams you can then use these signals.
In a sequence diagram, the communication between two lifelines is achieved using Messages:

The signature of a Message refers to either an Operation or a Signal. The name of the Message must be the same as the name of the referenced Operation or Signal.

The graphical notation for operation and signals in sequence diagrams is the same; it's just that signals are necessarily always asynchronous. The good news is that you can start with one, and decide to switch to the other without fundamentally changing your sequence diagram.
There is no rule to use the one or the other.  You could model very similar designs using the one or the other.  Typcially, you may prefer signals over asynchronous operations:

*

*if you're designing an event-driven system,

*if you're designing a distributed system,  with many intermediaries relaying your message

*if the message is meaningful for the sender regardless of the receiver.  One symptom of this situation is that potentially unrelated classes (having different operations) could be interested in receiving and processing such message.

*if the content of the message is complex:  instead of an operation with many arguments, and instead of an operation using a class argument where the class was solely created for simplifying the call arguments, the signal could allow to model the content of the message.


text:
Q: NSPrintInfo localizedPaperName, how to get paper name in ios? On my mac I use NSPrintInfo and [NSPrintInfo localizedPaperName] to determine if the default paper size is "US Letter" or "A4".
NSPrintInfo * printInfo = [NSPrintInfo sharedPrintInfo];
[printInfo localizedPaperName]
How can I get the iOS device to tell me if the default paper size is "US Letter" or "A4"?

A: Since nobody has suggested a better way, I looked up in which countries US letter is used and started checking against this list, by getting the NSLocaleCountryCode
 [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"US"]||
        [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"CA"]||
        [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"MX"]||
        [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"CU"]||
        [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"DO"]||
        [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"GT"]||
        [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"CR"]||
        [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"SV"]||
        [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"HN"]||
        [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"BO"]||
        [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"CO"]||
        [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"VE"]||
        [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"PH"]||
        [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] isEqualToString:@"CL"]

A: I used a similar fixed list approach like @spacecash21 suggested, based on this map:
https://en.wikipedia.org/wiki/Paper_size#/media/File:Prevalent_default_paper_size.svg
+ (NSString*)defaultPaperName
{
    // as it looks mostly US and Canada and the Philippines are actually using the US Letter format, usage of the metric system is no clue
    // https://en.wikipedia.org/wiki/Paper_size#/media/File:Prevalent_default_paper_size.svg
    static NSSet* letterCountries;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        letterCountries = [NSSet setWithArray:@[@"US", @"CA", @"MX", @"CU", @"DO", @"GT", @"CR", @"SV", @"HN", @"BO", @"CO", @"VE", @"PH", @"CL"]];
    });

    NSString* countryCode = NSLocale.currentLocale.countryCode;
    if ([letterCountries containsObject:countryCode.uppercaseString])
        return @"na-letter";

    return @"iso-a4";
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to create dynamic playlist.js for theme audio player using php? This is a follow-up question, but I'll include the code from before.
I have a playlist script...
     <script type="text/javascript">
var myPlaylist = [
 <?php
 foreach ($audiofiles as $file)
 {
   echo "{
        mp3:'".$file->guid."',
        title:'".$file->post_title."',
        artist:'"."',
        rating:5,
        buy:'".$file->post_excerpt."',
        price:'"."',
        duration:'"."',
        cover:'"."'
    },"
; }
?>
];
</script>

The problem, as you can probably see, is that the php puts a comma after the final audio file in the playlist, and that distupts the syntax and the whole thing doesn't load.
I'm sure it's a simple fix, maybe create a different "echo" for the last item in the list? How would I do this?

A: $i = 0;
foreach ($audiofiles as $file) {
  echo "{
    mp3: " . json_encode($file->guid) . ",
    title: " . json_encode($file->post_title) . ",
    artist: '',
    rating: 5,
    buy: " . json_encode($file->post_excerpt) . ",
    price: '',
    duration: '',
    cover: ''
  }";
  if ($i++ !== sizeof($audiofiles)-1) echo ",";
}

Are you sure you couldn't figure this out yourself?


text:
Q: How to write Subsection 1.1 after Section 2 I am trying to create a subsection of a different section in my document but I can't achieve that, no matter what I do. Basically I want the \subsection to be a subsection of the first section in my document, for example:
\documentclass{article}

\section{Section 1}
% some lines

\newpage
\section{Section 2}
% more lines

\newpage
\subsection{Section 1.1 (subsection of Section 1)}

The \subsection is always a subsection of Section 2 and I can't get it to be of Section 1.  (that way of subsectioning sounds stupid but I want to make a comparison between Section 1 and Section 2 so I have to put them right after each other, then the subsections come later)  Any help will be appreciated :)

A: One of the answers to the linked question shows how to write section numbers manually using \section*, or in this case \subsection*.
These manually numbered sections are not added to the table of contents (ToC), but you can also add entries to the ToC yourself using the command \addtocontents. Note that there is also \addcontentsline, but that automatically adds a page number, which should also be set manually in this case.
The use of \addtocontents is as follows:
\addtocontents
{contents type} % toc (regular table of contents) or lof (list of figures), lot (list of tables) etc.
{\protect\contentsline
   {section type} % chapter, section, subsection, subsubsection etc.
   {number and name of section}
   {page number}
}

So we can use for example:
\addtocontents{toc}{\protect\contentsline{subsection}{1.1 Subsection of first section}{4}}

This line should be put at the correct position in the document, in this case below the first \section command that is automatically added to the ToC.
Full MWE:
\documentclass{article}
% next line only to make pages smaller for screenshot, can be removed
\usepackage[paperheight=5cm,totalheight=2.5cm]{geometry}
\begin{document}
\tableofcontents
\section{First section}
\addtocontents{toc}{\protect\contentsline{subsection}{1.1 Subsection of first section}{4}}
some lines
\newpage

\section{Second section}
more lines

\newpage
\subsection*{1.1 Subsection of first section}
\end{document}

Result:

Note that this structure could be confusing for the reader, because the table of contents has a different order than the document itself. Additionally you need to be very careful that all numbers stay correct also when adding or removing content or moving sections around - one of the main advantages of LaTeX is that you don't have to worry about such things because everything is automatic, but with a solution such as this you don't have that advantage anymore.
Note also that when you use the hyperref package this code will not work, you need a bit more complex code in that case.


text:
Q: django object get two fields into a list from a model this is my model
class pdUser(models.Model):
    Name = models.CharField(max_length=200)
    Mobile = models.CharField(max_length=200)
    PagerDutyID = models.CharField(max_length=200)
    PagerDutyPolicyID = models.CharField(max_length=200)
    PagerDutyPolicy = models.CharField(max_length=200)

Want i want to be able to do is group by PagerDutyPolicy & PagerDutyPolicyID and return that as an object of its own with unique values only
so for example
Name: bob
PagerDutyPolicyID: 232
PagerDutyPolicy: Team 1

Name: Bill
PagerDutyPolicyID: 232
PagerDutyPolicy: Team 1

Name: Fred
PagerDutyPolicyID: 145
PagerDutyPolicy: Team 2

what i need is an object that has only got
PolicyID: 145
Policy: Team 2

PolicyID: 232
Policy: Team 1

in it, how would i do this?
Thanks

A: something like this:
get all (ID, Team) tuples, make unique
   id_teams = pdUser.objects.values_list('id', 'team', flat=True)
   id_teams = set(id_teams)

turn into objects
   import collections
   IDTeam = collections.namedtuple('IDTeam', ['id', 'team'])
   output = [IDTeam(id=id, team=team)
             for id,team in id_teams]

A: You'll need two models, and a foreign key between them,  e.g.:
from django.contrib.auth.models import User

class PagerDutyPolicy(models.Model):
    # the model automatically gets an id field
    policy_name = models.CharField(max_length=200)

class PagerDuty(models.Model):
    # I'm assuming you wanted these to be related to users who can log in..
    user = models.ForeignKey(User)
    mobile = models.CharField(max_length=200)
    policy = models.ForeignKey(PagerDutyPolicy)

To get all policies:
PagerDutyPolicy.objects.all()

To create a new PagerDuty object for bob, butting him in Team 1:
PagerDuty.objects.create(
    user=User.objects.get(username='bob'),  # or create a new user
    mobile='...',
    # policy=PagerDutyPolicy.objects.get(policy_name='Team 1')  # or..
    policy=PagerDutyPolicy.objects.get(id=232)
)

if you're going to look up policies by policy_name that field should also have a db_index=True in the model definition.

A: You can combine values and distinct methods like this:
pdUser.objects.all().values("PagerDutyPolicyID", "PagerDutyPolicy").distinct()

However this will produce fields with PagerDutyPolicyID, PagerDutyPolicy names


text:
Q: How can I ask a specific moderator a question? I want to ask a specific moderator a question but I don't see any way to communicate directly with that person.   How can I?  My question is very specific to some internal nofollow rules this moderator mentioned, and am wondering if my website is blacklisted.   Thus I don't really think it's a general question for posting on Meta (but maybe I'm wrong).

A: I'd recommend you use chat for this. Either @ mention them in that SE site's main chat room, where they are hopefully regularly active. Alternatively, you can navigate to their chat profile and use the 'start a new room with this user' button to create a new chat room for the two of you.


text:
Q: Disable browser back button for a particular page In my web application I have a login first and then if the login is successful I redirect the user to their account page. I want to disable browser back button (shown in below image) when he/she is on the account page after login.

I don't want to let user to go back to login page.
I tried all these window.history.forward stuff from google, but I want to disable this browser back button please help me on this. I am very much stuck here.

A: Normally you can NOT disable browser back button but there is some methods that lets you to play around this limitation just this article explains it.
However I see that there is a better way to solve your problem. You can use same page for content and login, and page session to avoid change back button functionality. You can do some thing like:
if(user has valid session)
   include (account_page)
else if (login form has been submitted)
   if (valid user)
     include (account_page)
     create new session for this user
    else
       include (login_page)
else
   include (login_page)

A: Usually it's counter-productive to fight the browser behavior, instead you should simply redirect the client back to another page if they visit the account page after they have already logged in.
If you are using MVC, this is easy to do by returning a new RedirectAction object in the Index action within the AccountController (or wherever you are displaying the account page)
public ActionResult Index()
{
    if (User.Identity.IsAuthenticated)
        return RedirectToAction("index", "home");

    ... do your other code here if they are not authenticated
}


text:
Q: Initialize implicitly typed local variable to IList I understand that implicitly-typed local variables must be initialized.
I know that result will be an IList so could I somehow say that var result will be an IList?
var result; //initialize to something

if( x < 0)
{
    result = (from s in context.someEntity
              where s.somecolumn = x
              select new { c1 = s.c1,c2=s.c2}).ToList();
}

if(x >= 0)
{
    result = (from s in context.someEntity
              where s.someOtherColumn = x
              select new { c1 = s.c1,c2=s.c2}).ToList();
}

foreach(var y in result)
{
    //do something . UPDATE 1: Retrieve y.c1, y.c2

}

A: No they can't be
"var can only be used when a local variable is declared and initialized in the same statement; the variable cannot be initialized to null, or to a method group or an anonymous function."
Since you're not initializing to an interface, it won't work.
http://msdn.microsoft.com/en-us/library/bb384061.aspx

A: If you know you want it to be an IList, why not just declare it as an IList?
Using var for uninitialized variables is (IMO) pretty unreadable.

A: Do this:
var result = default(IList);

A: You might be able to do something with a ternary operation:
var list = (x < 0) ? ... : ...

but really, that would be pretty painful to read. With your code as posted I think I'd just stick with
IList result;

for readability.

A: If you are using System.Collections.Generic in your code then the only option available is
var list = (x < 0) ? ... : ...
If you try to use IList in the above scenario you will get the error
Cannot implicitly convert type 'System.Collections.Generic.IEnumerable' to 'System.Collections.IList'. An explicit conversion exists (are you missing a cast?)
But if you are using System.Collections you can use
IList result;


text:
Q: A formula in complete lattice: $\bigwedge\{ a\vee b : a\in A , b\in B\}\leq (\bigwedge_{a\in A}a)\vee(\bigwedge_{b\in B}b) $ Let $(\Gamma,\leq)$ be a complete lattice. Assume $A$ and $B$ are two subsets of $\Gamma$  with $a\wedge b=0$ for every $a\in A$ and $b\in B$.
Q. True or false:
 $$\bigwedge\{ a\vee b : a\in A , b\in B\}\leq (\bigwedge_{a\in A}a)\vee(\bigwedge_{b\in B}b) $$

A: As stated, the property is false in general: for example, let $\Gamma$ be the diamond lattice $M_3$ with top element $1$, bottom element $0$, and middle elements $x,y,z$. Put $A=\{x,y\}$ and $B=\{z\}$. Then the LHS evaluates to $1$, but the RHS to $z$. EDIT: In response to the comments, we can slightly modify this example by inserting in the lattice an extra point $w$ such that $x,y<w<1$ (thus, $w=x\lor y$). The inequality still fails, while the additional hypotheses $\bigl(\bigvee A\bigr)\land\bigl(\bigvee B\bigr)=0$ and $\bigvee(A\cup B)=1$ hold. (Notice also that like $M_3$, the resulting lattice remains modular.)
On the other hand, the inequality is true if $\Gamma$ is distributive. First, if $A$ or $B$ is empty, then both sides evaluate to $1$, hence we may assume $A\ne\varnothing\ne B$. Fix $a_0\in A$, and $b_0\in B$. Let
$$c=\bigwedge_{\substack{a\in A\\b\in B}}(a\lor b)$$
denote the left-hand side. Using distributivity and the assumptions on $A$ and $B$, we have
$$\begin{align}
a_0\land c&=\bigwedge_{\substack{a\in A\\b\in B}}(a_0\land(a\lor b))\\
&=\bigwedge_{\substack{a\in A\\b\in B}}((a_0\land a)\lor(a_0\land b))\\
&=\bigwedge_{\substack{a\in A\\b\in B}}(a_0\land a)\\
&=\bigwedge_{a\in A}a,
\end{align}$$
and symmetrically,
$$b_0\land c=\bigwedge_{b\in B}b.$$
Thus, using distributivity again, we have
$$c=c\land(a_0\lor b_0)=(c\land a_0)\lor(c\land b_0)=\bigwedge_{a\in A}a\lor\bigwedge_{b\in B}b.$$
On the third hand, the property is weaker than distributivity. For example, let $\Gamma_1$ be an arbitrary complete lattice (in particular, non-distributive), and let $\Gamma$ be $\Gamma_1$ with a new least element $0$ attached. Then $\Gamma$ satisfies the property for the simple reason that the assumption $a\land b=0$ for all $a\in A$ and $b\in B$ holds only if one of the sets $A$, $B$ is $\varnothing$ or $\{0\}$, and the inequality is easy to verify in these cases.


text:
Q: Web Camera Hangs when I try to open it to recognize the detected face using Emgu CV I am developing Teacher Attendance Management System using face recognition technique in C# using Emgu CV, first of all teachers' faces will be trained (registered) then their attendance will be marked using Face Recognition technique. But whenever I try to open camera for face recognition it freezes after some seconds and does not respond. First I thought it is because of continuously attempt oof insertion of attendance into database (primary key in Attendance table is name + date so no duplicate attendance will be marked of a teacher) but when I commented out all code related to database it freezes too. Anyone knows how can I overcome this issue ? Here is my FrameProceedure methode it will run when my form will be loaded as follows Application.Idle += new EventHandler(FrameProcedure);
FrameProceedure Method :
private void FrameProcedure(object sender, EventArgs e)
        {
            try
            {
                // Thread.Sleep(1000);
                Users.Add("");
                Frame = camera.QueryFrame().Resize(320, 240, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
                grayFace = Frame.Convert<Gray, Byte>();
                MCvAvgComp[][] facesDetectedNow = grayFace.DetectHaarCascade(faceDetected, 1.2, 10, Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING, new Size(20, 20));
                foreach (MCvAvgComp f in facesDetectedNow[0])
                {
                    result = Frame.Copy(f.rect).Convert<Gray, Byte>().Resize(100, 100, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
                    Frame.Draw(f.rect, new Bgr(Color.Green), 3);
                    if (trainingImages.ToArray().Length != 0)
                    {

                        MCvTermCriteria termCriterias = new MCvTermCriteria(Count, 0.001);
                        EigenObjectRecognizer recognizer = new EigenObjectRecognizer(trainingImages.ToArray(), labels.ToArray(), 1500, ref termCriterias);
                        name = recognizer.Recognize(result);
                        Frame.Draw(name, ref font, new Point(f.rect.X - 2, f.rect.Y - 2), new Bgr(Color.Red));

                        if (name != null)
                        {
                            try
                            {

                                MySqlConnection databaseConnection = new MySqlConnection(connString);
                                int id = 0;
                                MySqlCommand cmd;

                                //Check if the face recognized exists in the Registration Table then retrieve its ID to store in Attendance Table

                                cmd = new MySqlCommand("SELECT id FROM mydb.registration WHERE name = @n", databaseConnection);
                                cmd.Parameters.Add("@n", MySqlDbType.Text);
                                cmd.Parameters["@n"].Value = name;
                                MySqlDataReader myReader;

                                databaseConnection.Open();
                                myReader = cmd.ExecuteReader();
                                while (myReader.Read())
                                {
                                    id = (int)(myReader["id"]);

                                }
                                databaseConnection.Close();
                                //If ID is retrieved successfully (means face exists in Registration Table)
                                if (id != 0)
                                {
                                    MySqlConnection dbconn = new MySqlConnection(connString);
                                    dbconn.Open();
                                    MySqlCommand comm = dbconn.CreateCommand();
                                    comm.CommandText = "UPDATE mydb.attendance SET att_status = @status WHERE id = '" + id + "' AND att_status = '' AND name = '" + name + "' AND att_status = ''";
                                    comm.Parameters.Add("?status", MySqlDbType.VarChar).Value = "P";
                                    comm.ExecuteNonQuery();
                                    dbconn.Close();
                                   Frame.Draw(name + " Marked Present", ref font, new Point(f.rect.X - 2, f.rect.Y - 2), new Bgr(Color.Yellow));
                                    SystemSounds.Beep.Play();
                                }
                            }
                            catch (Exception ee)
                            {
                                 ```
                            }
                        }
                        Users.Add("");
                    }
                    imageBox1.Image = Frame;
                    names = "";
                    Users.Clear();
                }
            }
            catch (Exception ee)
            {
                //  MessageBox.Show(ee.ToString());
            }
        }


text:
Q: Why doesn't the entropy decrease with an increasing number of observations? I'm trying to think more about entropy.
I have the following toy example:
Consider a coin flip.
Case 1:
I think p_h = 0.5
The entropy of this is 0.5 ln(0.5) x 2 = ln(0.5)
Case 2:
I don't know what p_h is and have "no prior" so I use the maximum entropy distribution ie the uniform over p. I then compute the entropy of my p_h, p_t distribution. But since the entropy is again over the heads / tails outcomes the answer is:
$p_h = \int_0^1 p dp = 0.5$
So again the distribution is the same.
Case 3:
Let's assume I have observed 10 heads and 10 tails so I have a prior of B(11, 11) (ie beta distribution with 20 observations and a uniform prior before the 1st observation). I will again get the same p_h which will give me the same entropy for the ultimate outcome.
If I were to rank each case in terms of "certainty" based on my intuition I would say Case 2 is the most uncertain and Case 1 is the least uncertain since I at least know with certainty the probability of the coin flip.
Why is it that this doesn't show up and gets washed out when considering the entropy of the coin toss.
The motivation for this is that I'll never "know" the probability but I will know the outcome of the coin toss.

A: More observed flips $F_{\mathit{obs}}$ will reduce the uncertainty of your posterior over $P(p_h | F_{\mathit{obs}})$. The entropy of the posterior is different from the entropy of the likelihood $P(f_{\mathit{next}} | p_h^*)$ for some point estimate $p_h^*$. When you commit to a single point estimate, you lose information about your uncertainty about the point estimate and the sample size on which the point estimate was based no longer matters.
Bayes' rule
To understand the difference between the prior, likelihood, posterior, and the difference between distributions and point estimates, consider Bayes' rule:
\begin{align}
P( p_H | F_{\mathit{obs}})
= & \frac{P(F_{\mathit{obs}} | p_H) P(p_H)}{P(F_{\mathit{obs}})}
\end{align}
The $P(F_{\mathit{obs}} | p_H)$ term is the likelihood, and reflects the probability of the observed flips assuming that $p_H$ has a specific value. The $P(p_H)$ term is the prior, and is a probability density over $p_H$ itself. Because $p_H$ defines a probability distribution, $P(p_H)$ is a probability distribution over probability distributions, not a probability distribution over coin flips. The prior expresses how likely each value of $p_H$ is before observing any data.
The term on the left $P(p_H | F_{\mathit{obs}})$ is the posterior, and, like the prior, is a probability distribution over $p_H$, not coin flips. If we pick a uniform prior $P(p_H) = \text{Beta}(1, 1)$ and then observe ten heads in twenty flips, $P(p_H | F_{\mathit{obs}})$ will say that $p_H = 0.5$ has highest posterior density, $p_H = 0.51$ has a slightly lower posterior density, and $p_H = 0.9$ has a much lower posterior density.
Distributions versus point estimates
To obtain the probability of seeing heads in the next coin flip given $F_{\mathit{obs}}$, called the posterior predictive distribution, we need to use the law of total probability:
\begin{align}
P(f_{\mathit{next}} = H | F_{\mathit{obs}})
  = & \int_\Delta P(f_{\mathit{next}} = H | p_H)P( p_H | F_{\mathit{obs}})dp_H
\end{align}
where $P( p_H | F_{\mathit{obs}})$ is the posterior from Bayes' rule above.
In your example, $P(f_{\mathit{next}} = H | p_H = 0.5)$ will have the greatest influence on the probability of the next flip because $P( p_H | F_{\mathit{obs}})$ is maximized at $p_H = 0.5$, but other possible values of $p_H$ will also have some influence.
An alternative is to pick a single "best" point estimate for $p_H$, such as the maximum a-posteriori estimate:
\begin{align}
p_H^* = &~ \underset{p_H}{\arg\max}~ P( p_H | F_{\mathit{obs}})
\end{align}
and then simply use the point estimate:
\begin{align}
P(f_{\mathit{next}} = H | F_{\mathit{obs}})
  \approx &~ P(f_{\mathit{next}} = H | p_H^*)
\end{align}
This approximation can be viewed as the limit of replacing $P( p_H | F_{\mathit{obs}})$
in the posterior predictive distribution with distributions that are increasingly concentrated on $p_H^*$. Because it is an approximation, it loses information compared to the true posterior $P( p_H | F_{\mathit{obs}})$.
Concretely, you could not possibly have observed 51% heads in twenty flips but you could have in 100 flips. The full posterior appreciates this by giving lower posterior density to $p_H = 0.51$ when there are 50 heads in 100 flips than when there are ten heads in twenty flips, but taking a point estimate completely ignores the possibility that $p_H = 0.51$ in both cases.
Differential entropy of the posterior
We can consider further the uncertainty of the posterior. The (differential) entropy of this posterior is:
\begin{align}
H(P(p_H | \alpha_H, \alpha_T))
= & -\int_\Delta P(p_H | \alpha_H, \alpha_T) \ln P(p_H | \alpha_H, \alpha_T) dp_h \\
= &~\ln B(\alpha_H, \alpha_T) - (\alpha_H - 1)\psi(\alpha_H) - (\alpha_T - 1)\psi(\alpha_T) + \\
&~(\alpha_H + \alpha_T - 2)\psi(\alpha_H + \alpha_T)
\end{align}
Where $B$ is the Beta function and $\psi$ is the derivative of the log gamma function (also called the Digamma function). To understand how the differential entropy changes with observations, let's plot the entropy of a symmetric Beta distribution as the sum of the shape parameters increases. We see that entropy is maximal for a symmetric Beta distribution at the blue line, where both shape parameters are equal to one. In R:
symmetric_beta_entropy <- function(size) {
  a <- size / 2
  b <- size / 2
  log(beta(a, b)) - (a - 1) * digamma(a) - (b - 1) * digamma(b) +
    (a + b - 2) * digamma(a + b)
}

library(ggplot2)
ggplot(data.frame(N=0), aes(x=N)) +
  theme_bw() +
  stat_function(fun=symmetric_beta_entropy) +
  xlim(1, 20) +
  geom_vline(xintercept=2, color='blue') +
  ylab("H(P(p_h | N/2, N/2))")


text:
Q: Laravel Eloquent - orderBy column find in related model INFORMATIONS
Database
events        | id | to_user_id    | from_user_id |
event_details | id | event_id      | when         |

Event.php
class Event extends Eloquent {

protected $table = 'events';

public function event_detail() {
    return $this->hasOne('EventDetail');
}}

EventDetail.php
class EventDetail extends Eloquent {

protected $table = 'event_details';

public function event() {
    return $this->belongsTo('Event', 'event_id');
}}

QUESTION
I want to get all events (Event model) and order by 'when' column in related EventDetail model. I wrote a query and it works:
$event = Event::join('event_details as p', 'p.event_id', '=', 'event.id')
                    ->orderBy('p.when', 'asc')
                    ->select('events.*')
                    ->with('event_detail')
                    ->get();

but when i would like to add ->where('to_user_id', '=', 0) clause i get error. How can I fix it?
Moreover I want to know if this query is correct with good practise?
Can you write it better?

A: Ok, had to recreate your project/tables
All tests are running correctly but I have noticed a few things you may consider changing.
$events = Event::with(['event_detail'=> function($query) {
    $query->orderBy('when', 'asc');
}])
->where('to_user_id', 0)
->get();

Also your code may be better if you have an Event
public function event_detail(){
    //considering you will have multiples? or just the one event detail?
    return $this->hasMany('EventDetail');
}

As you can see, the one event I stored has 2 event details & they are all ordered by ASC.

You can use the other method that doesnt utilize 'with()' but I prefer it. Very nice for json results where you can daisychain a lot of related models.
Hope this helps

A: I solved the problem with this query. I should add ->where('events.to_user_id', '=', 0) so
$event = Event::join('event_details as p', 'p.event_id', '=', 'event.id')
                ->orderBy('p.when', 'asc')
                ->select('events.*')
                ->where('events.to_user_id', '=', 0)
                ->with('event_detail')
                ->get();

However, I would like to know if this query is correct with good practise? Can you write it better?


text:
Q: Meteor app can't find routes New to meteor. Just cloned a git repo, and upon launching the app, I get a router.js:347 There is no route for the path: / error.
This is my route for root in imports/startup/client/routes.js
FlowRouter.route('/', {
    name: 'Home',
    action() {
        BlazeLayout.render('app_body', {tabs: 'tabs', inbox: 'inbox', upload: 'upload', invite: 'invite'});
        console.log('root loaded');
    },
});

Here is the list of packages
    accounts-facebook                         1.0.10  Login service for Facebook accounts
accounts-password                         1.2.14* Password support for accounts
alanning:roles                            1.2.15  Authorization package for Meteor
aldeed:collection2                        2.9.1  Automatic validation of insert and update operations on the client and server.
aldeed:simple-schema                      1.5.3  A simple schema validation object with reactivity. Used by collection2 and autoform.
arillo:flow-router-helpers                0.5.2  Template helpers for flow-router
blaze-html-templates                      1.0.4  Compile HTML templates into reactive UI with Meteor Blaze
check                                     1.2.3  Check whether a value matches a pattern
dburles:collection-helpers                1.0.4  Transform your collections with helpers that you define
ecmascript                                0.5.7* Compiler plugin that supports ES2015+ in all .js files
email                                     1.1.16* Send email messages
es5-shim                                  4.6.13* Shims and polyfills to improve ECMAScript 5 support
hpx7:youtube-iframe-player                0.4.15  Control YouTube's embedded player using Meteor
http                                      1.2.8* Make HTTP calls to remote servers
jazeee:spiderable-longer-timeout          1.2.13  Extended spiderable package: SSL, caching, longer timeout, no stdin issues, publish flag
jchristman:tagsinput-autocomplete-edited  1.1.0+ A combination of the mizzao:autocomplete library and a tagsinput-like functionality
jquery                                    1.11.9  Manipulate the DOM using CSS selectors
kadira:blaze-layout                       2.3.0  Layout Manager for Blaze (works well with FlowRouter)
kadira:flow-router                        2.12.1  Carefully Designed Client Side Router for Meteor
keepnox:perfect-scrollbar                 0.6.8  Perfect-scrollbar packaged for meteor
manuel:reactivearray                      1.0.5  Reactive Array for Meteor
matb33:collection-hooks                   0.8.3* Extends Mongo.Collection with before/after hooks for insert/update/remove/find/findOne
meteor-base                               1.0.4  Packages that every Meteor app needs
meteorhacks:aggregate                     1.3.0  Proper MongoDB aggregations support for Meteor
mobile-experience                         1.0.4  Packages for a great mobile user experience
momentjs:moment                           2.14.4  Moment.js (official): parse, validate, manipulate, and display dates - official Meteor packaging
mongo                                     1.1.10* Adaptor for using MongoDB and Minimongo over DDP
reactive-dict                             1.1.8  Reactive dictionary
reactive-var                              1.0.10  Reactive variable
sacha:spin                                2.3.1  Simple spinner package for Meteor
saucecode:timezoned-synced-cron           1.2.11  Fork of original w/ timezone support. Define and run scheduled jobs across multiple servers.
session                                   1.1.6  Session variable
spiderable                                1.0.13  Makes the application crawlable to web spiders
standard-minifier-css                     1.1.8* Standard css minifier used with Meteor apps by default.
standard-minifier-js                      1.1.8* Standard javascript minifiers used with Meteor apps by default.
tomwasd:flow-router-seo                   0.0.3  A simple way to set the title and meta tags for sites using flow router
tracker                                   1.1.0  Dependency tracker to allow reactive callbacks
twbs:bootstrap                            3.3.6  The most popular front-end framework for developing responsive, mobile first projects on the web.

What is it that is causing the app not to find the routes file? I have looked through the following posts for some guidance, but have found none.
Meteor Routing Error : There is no route for the path: /
https://github.com/kadirahq/flow-router/issues/608
https://github.com/kadirahq/flow-router/issues/185
http://coderchronicles.org/2016/04/08/getting-started-with-meteor-1-3-react-and-flowrouter/
Any help solving the problem would be appreciated.  I feel like I'm missing something simple.
-S
**project file structure
imports/
  startup/
    client/
      index.js
      routes.js
    server/
      fixtures.js
      index.js
  api/
     server/
        publications.js

  ui/
    components/

    layouts/
    pages/
client/
  main.js
  head.js
  main.js
server/
  main.js
  fixtures.js
 server-global.js

A: Are you importing the routes file into your app's main container?
For example, if you have a /client/main.js file that gets loaded from client side at startup, then it should include the import reference to routes file as follows:
import '/imports/startup/client';
Or, import '/imports/startup/client/routes.js';

A: Put your route file in 'imports/starup/lib' (lib - for example). In fast-render package recommended use 'lib', if you wanna use it. If no - 'client';
Then make sure you imported your route file in 'root/client/main.js';
Please, read this part of docs: https://guide.meteor.com/structure.html#javascript-structure
It is very helpful article.
UPD:
Please, remove duplicate files in your client/main.js
When, in client/main.js
import '/imports/startup/client';

In your imports/startup/client/index.js
import './routes.js';

And now it will work.
Dont forget, you must import all views you wanna use in your route.

A: Problem fixed.  Instead of launching with meteor run, need to launch with meteor --settings settings.json --production


text:
Q: Error with opencv lib : AttributeError: 'NoneType' object has no attribute 'shape' I pass a reference to the image into the function as an argument. It is supposed to be possible to pass the list of references to the image, so the list is used. The code looks like this
def cleanOCR(borders):
    detectedOCR = []
    print(f'Borders = {borders}')
    for i, image in enumerate(borders):
        image = cv2.imread(image)
        assert not isinstance(image,type(None)), 'image not found'
        edges = cv2.Canny(image, 50, 150, apertureSize=3)
        lines = cv2.HoughLinesP(image=edges, rho=1, theta=np.pi / 180, threshold=100, lines=np.array([]), minLineLength=100, maxLineGap=80)
        a, b, c = lines.shape

But I get an error
  File "platesOCR.py", line 66, in cleanOCR
    a, b, c = lines.shape
AttributeError: 'NoneType' object has no attribute 'shape'

Im using cv2 version '4.1.1'
The code isn't mine, I'm just starting to deal with OpenCV.
print(f'Borders = {borders}') give me right file path

A: It essentially means that no lines are detected in the image.
To check this, simply print lines. I am guessing it will be empty.
To NOT get an empty np array, try reducing the minLineLength value. Line segments shorter than this value in your image are rejected. So I would suggest reducing this value.
And also of maxLineGap. It is the maximum allowed gap between points on the same line to link them. So your value for this seems higher.


text:
Q: BigQuery - JOIN on two tables using string and array We have two tables in BigQuery like below:
Table A
 Name | Question  | Answer
 -----+-----------+-------
 Bob  | Interest  | a
 Bob  | Interest  | b
 Sue  | Interest  | a
 Sue  | Interest  | c
 Joe  | Interest  | a
 Joe  | Interest  | b
 Joe  | Interest  | c
 Joe  | Interest  | d

Table B (Static)
           Interests                        |   Segment
--------------------------------------------+------------------
["a"]                                       |   S1
["a","b"]                                   |   S2
["a", "b", "c", "d"]                        |   S3

Expected table
 User | Question  | Answer
 -----+-----------+-------
 Bob  | Interest  | a
 Bob  | Interest  | b
 Sue  | Interest  | a
 Sue  | Interest  | c
 Joe  | Interest  | a
 Joe  | Interest  | b
 Joe  | Interest  | c
 Joe  | Interest  | d
          (+)
 Bob  | Segment   | S1
 Bob  | Segment   | S2
 Sue  | Segment   | S1
 Joe  | Segment   | S1
 Joe  | Segment   | S2
 Joe  | Segment   | S3

In the above tables, the Answer field is of string type and Interests is of array type.
Pointers:

*

*One user can have one or more interests.

*One or more interests can belong to one segment.

*A user will be assigned to a segment only when all of his interests are matched.

Any inputs/thoughts in the right direction would be greatly appreciated.

A: Below is for BigQuery Standard SQL
#standardSQL
select name, question, answer from `project.dataset.tableA`
union all
select name, 'Segment', segment
from (
  select
    name, 'Segment', segment,
    ( select countif(y is null)
      from b.interest x
      left join a.answers y
      on x = y
    ) = 0 qualified
  from (
    select name, array_agg(answer) answers
    from `project.dataset.tableA`
    group by name
  ) a, `project.dataset.tableB` b
)
where qualified

if to apply to sample data from your question - output is

A: This looks like a union all -- where the second query unnests the interests and joins:
select a.name, a.question, a.answer
from a
union all
select a.name, 'segment', min(b.segment)
from a join
     (b cross join
      unnest(interests) b_interest
     )
     on a.interest = b_interest
group by name
having min(b.segment) = max(b.segment);

You might need a left join, if some interests don't have segments.


text:
Q: Decoding array based JSON in Swift I've got a WebSocket that uses an array format of [command, data] to exchange messages.  I'm struggling with the Swift Decoder to handle the mixed formats of the data portion.  For instance Message #1:
["CFG",{"dimmerDelay":5000,"keyboardShortcuts":true}]

Message #2:
["LFM",true]

I'm using this to decode Message #1
struct Message: Decodable {
    let command: String
    let config: Config

    init(from decoder: Decoder) throws {
        var container = try decoder.unkeyedContainer()
        command = try container.decode(String.self)
        config = try container.decode(Config.self)
        }
    }

struct Config: Decodable {
    let dimmerDelay: Int
    let keyboardShortcuts: Bool
    }

What I really want is to split this into a container more like this:
struct Message: Decodable {
    let command: String
    let data: String
    }

Then if the message is of type "CFG" I would pass the data to a decoder that would create the Config object.  If the message is of type "LFM" I would check to ensure the result is true and if the message is of another type, I'd pass that data to another decoder that would create the relevant decoded objects.

A: There are several approaches, but assuming you know all the "command" strings and what they map to, you can take an enum approach:
enum Message {
    case config(Config)
    case lfm(Bool)
}

To make this Decodable, you just need a switch statement:
extension Message: Decodable {
    init(from decoder: Decoder) throws {
        var container = try decoder.unkeyedContainer()
        let command = try container.decode(String.self)

        switch command {
        case "CFG":
            self = .config(try container.decode(Config.self))

        case "LFM":
            self = .lfm(try container.decode(Bool.self))

        default:
            throw DecodingError.typeMismatch(Message.self,
                                             .init(codingPath: [],
                                                   debugDescription: "Unknown command: \(command)"))
        }
    }
}

After decoding, you'll use a switch statement to determine what you have:
let message = try JSONDecoder().decode(Message.self, from: json)

switch message {
case .config(let config): handleConfig(config)
case .lfm(let bool): handleLFM(bool)
}


text:
Q: google chrome turns down new volume on a new tab In google chrome, Whenever i'm listening to youtube on a tab and I open up a new tab it dampens the volume, but only when im searching on google. I don't have any idea whats up with it, does anyone know?

A: you may have a sound enhancer software like Dolby Enhanced Audio, this happens to me too. it only enchances the sound when a media tab/webpage is open.
Check of you have Dolby or Beats installed, open the software and monitor as you switch webpages


text:
Q: ASP.Net WebAPI Delete verb not working I'm using IIS 7.5 with asp.net webapi to do a delete for a record id.  I can get it to work in Safari, but not Firefox.  Here's an image of the request/response for the jQuery Ajax submission:
http://screencast.com/t/Ckls9nO8D
Here's my code snippet for my jQuery Delete submission:
    var deleteGame = function(gameId)
    {
        var d = $.Deferred();
        var url = Enum.RootUrl + Enum.DeleteGameUrl + gameId;
        jQuery.support.cors = true;
        $.ajax(
        {
            url: url,
            type: 'Delete',
            cache: false,
            crossDomain: true,
            processData: true,
            success: function ()
            {
                d.resolve();
            },
            error: function(XMLHttpRequest, textStatus, errorThrown)
            {
                //alert("error happened AGAIN:\n" + JSON.stringify(XMLHttpRequest) );
            }
        });

        return d.promise();
    };

here's the generated URL for jquery submission:  http://local.guessalist.com/api/game/46
I'm not sure why it works in Safari but not Firefox.  Please help.
It appears Access-Control-Request-Headers is missing from Request Headers.  I'm not sure if this is the cause of the problem.
After playing around with this in Safari and Chrome, I'm getting "Refused to set unsafe header "Access-Control-Request-Headers"
OPTIONS http://local.guessalist.com/api/game/64 405 (Method Not Allowed)" error in each browser via the browser's console, but the delete operation is allowed to continue.  Not sure what I'm doing here.  Any advice would be greatly appreciated.

A: After several hours of researching, trouble shooting, cursing, and flipping off my code, I finally got it working with the help of this approach:
http://brockallen.com/2012/06/28/cors-support-in-webapi-mvc-and-iis-with-thinktecture-identitymodel/
I initially tried just the WebAPI approach, and it didn't work.  I then removed everything I was trying and followed the IIS approach described in the link above, and everything works.  I'm not sure why.  I only added this line of code to Web.Config and nothing else:
    <modules runAllManagedModulesForAllRequests="true">
        <add name="CorsHttpModule" type="Thinktecture.IdentityModel.Http.Cors.IIS.CorsHttpModule"/>
    </modules>

That's the only configuration I did and I can do cross domain deletes.  I'm assuming other verbs will work, I've only tested with Delete.  So, I'm grateful that I can get my code to work, but am wondering why it's working given that I only did part of the configuration as cited in the link above.  If anyone stumbles upon this and can explain, I would appreciate it.  Thanks.


text:
Q: Parametric colors Is it possible to define colors as variables? for example, instead of write
\titleformat{\chapter}[display]
  {\normalfont\rmfamily\huge\bfseries\color{violet}}% <<====== TITLE COLOR
  {\chaptertitlename\ \thechapter}{20pt}{\Huge}

I want to write
\titleformat{\chapter}[display]
  {\normalfont\rmfamily\huge\bfseries\color{chapterTitleColor}}
  {\chaptertitlename\ \thechapter}{20pt}{\Huge}

where chapterTitleColor = violet (or any color I want)
I need this in order to create a config file and read colors as well as other parameters from there.

A: You can use the \colorlet command from xcolor in your preamble to give specific names to colours you want to use – like this:
\colorlet{chapterTitlecolor}{violet}


text:
Q: Возможно ли продолжение работы скрипта после переадресации? У меня следующая ситуация: есть некая страница в интернете, куда я могу внедрить свой javascript. Скрипт выполняет переадресацию на другой сайт, например, вот так:
document.location.replace("https://site.ru");

или так:
window.location.href = "https://site.ru";

Есть ли возможность продолжить выполнение этого же .js-файла, но когда откроется новая страница, после выполнения перехода по ссылке "site.ru" ? При условии, что внедрить свой скрипт на site.ru тем же способом я не могу. Про xss на site.ru мне тоже ничего не известно. Может быть есть другой способ?


text:
Q: $X=\{a,b,c\}$ and $\mathcal{T}=\{X, \emptyset, \{a\}, \{b\}, \{a,b\}\}$. Determine if $f:X \rightarrow X$ is $\mathcal{T}-\mathcal{T}$ Continuous $X=\{a,b,c\}$ and $\mathcal{T}=\{X, \emptyset, \{a\}, \{b\}, \{a,b\}\}$.
Assume $f: X \rightarrow X$ is given by $f(a)=a, f(b)=c,$ and $f(c)=b.$
Determine if $f:X \to X$ is $\mathcal{T}-\mathcal{T}$ continuous
What I got:
For $f$ to be continuous, then for each $\mathcal{T}$-open subset $V$ of $X,$ $f^{-1}(V)$ is a $\mathcal{T}$-open subset of $X$.
Since $f:(X,\mathcal{T}) \to (X,\mathcal{T})$, then $\{b\}$ is an open set but $f^{-1}(\{b\})=\{c\}$ which is not an open since $\{c\}$ $\notin \mathcal{T}$
Thus $f$ is not continuous.
Does that sound correct?

A: Yes, your proof works.
Alternatively, you could argue that $c\in\overline{\{b\}}$ but $f(c)=b\notin\overline{f[\{b\}]}=\overline{\{c\}}$.
Note that $f\circ f=1_X$, so $f$ is continuous if and only if $f^{-1}=f$ is open.


text:
Q: Sum of sawtooth function not differentiable Define $h(x)=|x|$ on $[-1,1]$ and extend it to $\mathbb R$ by defining $h(2+x) = h(x)$. This is a sawtooth function that is $0$ at even and $1$ at odd integers.
Furthermore define $h_n(x) = (1/2)^n h(2^n x)$ and
$$ g(x) = \sum_{n=0}^\infty {1\over 2^n }h(2^n x) = \sum_{n \ge 0}h_n(x)$$
I showed that $g$ is defined everywhere and not differentiable at dyadic rationals. Now I have a question about an exercise. Let $x \in \mathbb R$ be a point that is not a dyadic rational. Define $x_m = p_m/2^m$ and $y_m = (p_m+1)/2^m$ for $p_m \in \mathbb Z$ so that
$$ x_m < x < y_m$$ and $$ \lim x_m = x = \lim y_m$$
I am not sure about the following exercise:

Why in (a) is it necessary to show $|g'_m(x) - g'_{m+1}(x)|=1$ and why is the first $<$ in (b) needed? My proof is as follows:
Because $g_m'(x) = \sum_{0\le n\le m} 2^{-n}h'(2^n x) = h'(x) \sum 1 = (m+1) h'(x)$ because of the second inequality in (b):
$$ g'(x) = \lim_{m \to \infty}{g(x_m) -g(x)\over x_m -x} \ge g'_m(x) \ge (m+1) h'(x) \to \infty$$
therefore $g'(x)$ does not exist.
Please can you tell me what is wrong with my proof?

A:
what is wrong with my proof?

The inequality $g_m'(x)\ge (m+1)h'(x)$. Why do you think this is true? The definition of $g_m$ implies that at points that are not dyadic rationals,
$$g_m'(x) = \sum_{n=0}^m h'(2^nx)$$
Each  term on the right is either $1$ or $-1$, but different terms may well have different signs.

Why is ... in (a), (b) needed?

The idea suggested to you is to relate (by two-sided inequality (b)) the divided differences of $g$ to the values of $g_m'(x)$. If $g'(x)$ existed, then the divided differences on the two sides of (b) would converge to $g'(x)$ as $m\to\infty$. But then, by the squeezing lemma, the sequence $g_m'(x)$ would have a limit. Part (a) shows that it does not.

By the way, $g$ is known as Takagi function and its graph as Takagi curve or blancmange curve. Dave Richeson made   a Geogebra applet illustrating partial sums of the series.


text:
Q: Barred q symbol doesn't scale properly Using the answer to the question moving the bar on hbar (copy/paste and tweaking the parameters, and replacing mathchar'26 by the shorter mathchar'55), I was able to create a barred q. Unfortunately, this symbol behaves badly when I use \qbar as an index.

I use the font package eulervm:
\documentclass[11pt]{scrartcl}
\usepackage{eulervm}
\usepackage{mathtools}
\makeatletter
\newcommand{\raisemath}[1]{\mathpalette{\raisem@th{#1}}}
\newcommand{\raisem@th}[3]{\raisebox{#1}{$#2#3$}}
\makeatother
\newcommand{\qbar}{\ensuremath{\mathrlap{\raisemath{-3.2}{\hspace*{3.2pt}
{\mathchar'55\mkern-9mu}}}q}}

\begin{document}
{\Huge$\qbar$} \qquad $\qbar$ \qquad $U_{\qbar}$
\end{document}

What code should I use to get the same symbol in both cases? I also noticed that I had to reconfigure the paramters in the definition of \qbar for this question, presumably there was some interaction with the other packages or options... This is first time I'm attempting to create a symbol in this fashion. If you know of better ways, or can provide me with a resource that explains how to do this in general, that would be great too!

A: I'd use a different approach; the absolute measures like 3.2pt can work just for one size.
\documentclass[11pt]{scrartcl}
\usepackage{eulervm,mathtools}

\makeatletter
\newcommand{\qbar}{\text{\q@bar}}
\newcommand{\q@bar}{%
  \vphantom{$\m@th q$}%
  \ooalign{%
    $\m@th q$\cr
    \hidewidth\smash{\raisebox{-0.7ex}{$\m@th\mathchar'55$}}\hidewidth\cr}%
}
\makeatother

\begin{document}
\fbox{\Huge $q$}\,\fbox{\Huge$\qbar$} \quad $\qbar$ \quad $U_{\qbar}\ne U_{q}$
\end{document}

The two \fbox command show that the bounding box of \qbar is the same as for q.
If you want that the bar crosses the descender, then add some horizontal space, changing the definition of \q@bar into
\newcommand{\q@bar}{%
  \vphantom{$\m@th q$}%
  \ooalign{%
    $\m@th q$\cr
    \hidewidth\kern.3em\smash{\raisebox{-0.7ex}{$\m@th\mathchar'55$}}\hidewidth\cr}%
}

The above input would give

A: If you are able to use Lua- or XeLaTeX, you might want to use the unicode U+A757 for this. Just look for a font which supports this symbol and load it like in my MWE:
% arara: lualatex

\documentclass{article}
\usepackage{fontspec}
\setmainfont{EB Garamond}
\usepackage{mathtools}
\newcommand*{\qbar}{\ensuremath{\text{\symbol{"A757}}}}

\begin{document}
    A test for EB Garamond in math mode \fbox{$\qbar$} \fbox{$\mathrm{q}$} and text mode \fbox{\qbar} \fbox{q}.
\end{document}

Unluckily I can't find a slanted or italic version.
You may also define a symbol with another font as your surrounding text:
% arara: lualatex

\documentclass{article}
\usepackage{fontspec}
\usepackage{mathtools}
\newcommand*{\qbar}{\ensuremath{\text{{\setmainfont{quivira.otf}\symbol{"A757}}}}}

\begin{document}
    \[\qbar_{\qbar_\qbar}\]
\end{document}

Here are some different symbols I could find on my system:
% arara: lualatex

\documentclass{article}
\usepackage{fontspec}

\begin{document}
    \setmainfont{EB Garamond}\symbol{"A757}
    \setmainfont{dejavusans.ttf}\symbol{"A757}
    \setmainfont{freeserif.otf}\symbol{"A757}
    \setmainfont{quivira.otf}\symbol{"A757}

    %\setmainfont{EB Garamond}\symbol{"A756} % not available in upper case
    \setmainfont{dejavusans.ttf}\symbol{"A756}
    \setmainfont{freeserif.otf}\symbol{"A756}
    \setmainfont{quivira.otf}\symbol{"A756}
\end{document}


text:
Q: LiDAR dataset displaying 500 meters to the east of correct position Why does my LIDAR dataset show up ~500 meters to the east of the correct position even though a spatial reference/coordinate system is provided?
Some background:

*

*The LIDAR data were downloaded from the USGS website as .zip files

*Unzipped, the .las files have an associated .xml file with correct coordinates for tile position (UL Corner, UR Corner etc.)

*Projected coordinate system (State Plane NAD 1983 Florida East Meters) is listed in .xml

*The FL County layer in the image below is in the correct location.
How can I permanently bind the projection/spatial information to the .las file (not need the separate manually created .prj file)? I'm trying to use the LAStools (from lastools.org). When I use the LASclip, the clipping polygon is in the correct location but arcmap thinks the .las file is 500 meters east still, so nothing (or everything) gets clipped.


text:
Q: IsPointInside() for curved contours We all know how to check if a 2D point is inside a 2D polygon but what about checking precisely if a point is inside a complex contour made by lines, arcs, elliptical arcs and splines? I mean without converting it to a 2D polygon using a deviation tolerance.
Do you know any robust approach to the problem?
Thanks.

A: The winding/crossing tests will work with more than polygons. You just need the ability to intersect the contour with a particular line (and in the case of the winding number, to evaluate the tangent of the contour at that point). You also need to be a little careful about numerical accuracy, and remember that double roots count as 2 intersections.
For splines, while there are line/spline intersection methods, discretizing to a polygon (and remember that you only need the little bits of the polygon that pass through the line) is probably the simplest approach.

A: I'm not sure about the kind of data you are using, but if you can somehow draw an analogy to image processing... Ray Casting Algorithm can help you find the answer.
The point in polygon problem can be implemented in any kind of complex structure and usually works well. Check this link for a pseudo-code: Ray Casting.
However, this won't work if you do not have any well defined method for finding intersection in your complex contour.
You may try to break into sub-problems of finding intersections:

*

*The intersection point between a spline and a line

*Line Segment Circle Intersection


text:
Q: How to handle 100 000 together api request in node js i am facing some serious problem here. i am working on aws lambda with node js. my task is to insert all the athena table data into mailchimp if user already exist i am updating that user if not i am inserting the user into mailchimp,but in athena db we have 100k data. 100k rows, each row is one persons data.
the problem is here its not inserting all the user data into the mailchimp instead of its inserting some of the data but not the all i dont know why.
 const md5 = require("md5");
    var Mailchimp = require("mailchimp-api-v3");
    var mailchimp = new Mailchimp("b689f064af1165f83d7309795b64095c-us14");
    require("dotenv").config();
    const _ = require("lodash");
    const athena = require("../src/DB/athena");
    const rds = require("../src/DB/rds");

    exports.handler = async (event, context, callback) => {
      let list_id = "578a0790b0";
      try {
        const athena_Data = await athena();
        const rds_Data = await rds();

        let AudienceData = await Promise.all(
          athena_Data.Items.map(async (members) => {
            if (members.contact_email !== undefined) {
              let data1 = await rds_Data.rows.map((data) => {
                let merge_tags = data.merge_tag;
                let obj = { name: data.athena_column, value: merge_tags };
                return obj;
              });
              var object = data1.reduce(
                (obj, item) => Object.assign(obj, { [item.name]: item.value }),
                {}
              );
              let output = {};
              _.forIn(object, (value1, key1) => {
                _.forIn(members, (value, key) => {
                  if (key1 === key) {
                    return (output[value1] = value);
                  }
                });
              });
              let email_hash = md5(members.contact_email);
              await mailchimp
                .get(`/lists/${list_id}/members/${email_hash}`)
                .then(async (result) => {
                  await mailchimp
                    .put(`/lists/${list_id}/members/${email_hash}`, {
                      email_address: members.contact_email,
                      email_type: "text",
                      status: "subscribed",
                      merge_fields: {
                        ...output,
                      },
                      interests: {},
                      language: "",
                      vip: false,
                      location: {
                        latitude: 0,
                        longitude: 0,
                      },
                      marketing_permissions: [],
                      ip_signup: "",
                      timestamp_signup: "",
                      ip_opt: "",
                      timestamp_opt: "",
                      tags: [],
                    })
                    .then((response) => {
                      console.log("updated successfully", response);
                    })
                    .catch((err) => {
                      console.log("something went wrong with update", err);
                    });
                })
                .catch(async (err) => {
                  await mailchimp
                    .post(`/lists/${list_id}/members`, {
                      email_address: members.contact_email,
                      email_type: "text",
                      status: "subscribed",
                      merge_fields: {
                        ...output,
                      },
                      interests: {},
                      language: "",
                      vip: false,
                      location: {
                        latitude: 0,
                        longitude: 0,
                      },
                      marketing_permissions: [],
                      ip_signup: "",
                      timestamp_signup: "",
                      ip_opt: "",
                      timestamp_opt: "",
                      tags: [],
                    })
                    .then((res) => {
                      console.log("inserted successfully", res);
                    })
                    .catch((err) => {
                      console.log("something went wrong with post", err);
                    });
                });
            } else {
              console.log("email does not exist");
            }
          })
        );
        callback(null, "success");
      } catch (e) {
        callback(e, null);
      }
    };

example:
  For refrences or example
        let object={
          address_1: 'MERGE38',
          birth_date: 'MERGE37',
          address_2: 'MERGE39',
          address_3: 'MERGE40',
          zip: 'MERGE42',
          state: 'MERGE41',
          first_name: 'MERGE30',
          last_name: 'MERGE31',
          status: 'MERGE35',
          city: 'MERGE36',
          person_id: 'MERGE32',
          age: 'MERGE33'
        }
        let members={
          person_id: 170207,
          first_name: 'Vladislav1',
          last_name: 'Sheykhet',
          address_1: '5188 Foggy Prairie Manor',
          city: 'Coats',
          state: 'VA',
          zip: '244449454.0',
          sex: 'M',
          contact_phone: '(212) 213-4808',
          contact_email: 'vladislav@gmail.com',
          smoker_status: 'N'
        }
        let output={
          MERGE38: '5188 Foggy Prairie Manor',
          MERGE42: '244449454.0',
          MERGE41: 'VA',
          MERGE30: 'Vladislav1',
          MERGE31: 'Sheykhet',
          MERGE36: 'Coats',
          MERGE32: 170207
        }


text:
Q: Shiny Reactive Context in testthat test I am trying to execute code that requires a reactive context (but not the whole server)
library(shiny)
library(testthat)

test_that("test ", {
  withReactiveDomain(MockShinySession$new(), {
    v <- reactiveVal()
    v("abc")
    val <- v()
    expect_equal("abc", val)
  })
})

Then I get the following error:
Operation not allowed without an active reactive context. (You tried to do something that can only be done from inside a reactive expression or observer.)
Backtrace:
 1. shiny::withReactiveDomain(...) test_integration.R:45:2
 5. shiny:::v() test_integration.R:48:4
 6. rv$get()
 7. private$dependents$register()
 8. shiny:::getCurrentContext()
 9. .getReactiveEnvironment()$currentContext()

What am I missing? If I execute the inner block in an R session I get the same error.

A: A solution with the unexported function flushReact:
library(shiny)

x <- reactiveVal()
observe({
  message(x())
})
x("abc")

capture.output(shiny:::flushReact(), type = "message")
# [1] "abc"

A: Solution by @anddt
library(shiny)
library(testthat)

test_that("test ", {
  withReactiveDomain(MockShinySession$new(), {
    v <- reactiveVal()
    v("abc")
    val <- isolate(v())
    expect_equal("abc", val)
  })
})


text:
Q: Strange IP address showing up with OS X ssh I was futzing around with DTrace on Mac OS X and found the following script that prints out information about connections being established:

$ cat script.d

syscall::connect:entry
{
printf("execname: %s\n", execname);
printf("pid: %d\n", pid);
printf("sockfd: %d\n",arg0);

socks = (struct sockaddr*)copyin(arg1, arg2);

hport = (uint_t)socks->sa_data[0];
lport = (uint_t)socks->sa_data[1];
hport <<= 8;
port = hport + lport;
printf("Port number: %d\n", port); printf("IP address: %d.%d.%d.%d\n",
 socks->sa_data[2],
 socks->sa_data[3],
 socks->sa_data[4],
 socks->sa_data[5]);
printf("======\n");
}

I run it in one window:
  $ sudo dtrace -s ./script.d

Then I ssh to another machine from another window.  I get this output from my dtrace window:
CPU     ID                    FUNCTION:NAME
  0  18696                    connect:entry execname: ssh
pid: 5446
sockfd: 3
Port number: 22
IP address: 192.168.0.207
======

  0  18696                    connect:entry execname: ssh
pid: 5446
sockfd: 5
Port number: 12148
IP address: 109.112.47.108
======

^C

The first IP address I can explain (192.168.0.207), that's the machine I'm connecting to.
But what's with the 109.112.47.108 machine?  It doesn't show up in tcpdump nor netstat -an
Is there something with my dtrace code or my understanding of how the connect system call works?

A: I think I've figured it out, it's the dtrace script which I grabbed from a Solarius site, needs to be changed for BSD.

A: Try doing a traceroute to that address and see where it is. If it's only a couple of hops away it's probably a firewall or switch.

A: It's a vodaphone IP address in Italy. Are you connected to an ISP in Europe/Italy? If not, better start worrying.

A: Port 12148 looks like a virus/Trojan issue - best to clean infected system asap

A: What does grep 'sshd.*from' secure.log say? If someone besides you has logged in via SSH then you have a problem. If they haven't it's likely an unsuccessful brute force attempt. Are you running DenyHosts or Fail2Ban?
I can't find any documentation on syscall::connect, but it looks like it's printing out both ends of the socket. What happens when you run the script and ssh in from another machine?

A: For what it is worth, this IP appears to be part of the vodafone.it network.  Observe:
> host -a 109.112.47.108
Trying "108.47.112.109.in-addr.arpa"
Host 108.47.112.109.in-addr.arpa. not found: 3(NXDOMAIN)
Received 116 bytes from 68.94.156.1#53 in 180 ms
> host -a 47.112.109.in-addr.arpa
Trying "47.112.109.in-addr.arpa"
Received 112 bytes from 68.94.156.1#53 in 388 ms
Trying "47.112.109.in-addr.arpa.domain_not_set.invalid"
Host 47.112.109.in-addr.arpa not found: 3(NXDOMAIN)
Received 139 bytes from 68.94.156.1#53 in 859 ms
> host -a 112.109.in-addr.arpa
Trying "112.109.in-addr.arpa"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20054
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;112.109.in-addr.arpa.  IN ANY

;; ANSWER SECTION:
112.109.in-addr.arpa. 28800 IN SOA mivsx030.net.vodafone.it. hostmaster.vodafone.it. 9 10800 3600 2592000 900
112.109.in-addr.arpa. 28800 IN NS mivsx030.net.vodafone.it.
112.109.in-addr.arpa. 28800 IN NS gmigdns006.net.vodafone.it.

Received 148 bytes from 68.94.156.1#53 in 373 ms


text:
Q: On select change, remove readonly property and allow user type on the input I've got a little script that allow me to select an item from a select. When this item is listed as Item, it means I have rate informations about this one. When the selected item is listed an Night, it means I can inter the rate informations as I do not have any information on this item.
Here the JS controlling my form:
$('select[name="BIL_Item_Quantity"], select[name="BIL_Item_Id"], input[name="BIL_Item_Rate"]').on('change keyup', function() {
    var parent = $(this).closest('div.modal-body');
    var type = parent.find('select[name="BIL_Item_Id"]').find(":selected").data('item-type');

    if(type == 'Night') {
        parent.find('input[name="BIL_Item_Rate"]').prop("readonly", false);
    }
    if(type == 'Item') {
        parent.find('input[name="BIL_Item_Rate"]').prop("readonly", true);
    }

    // Get datas
    var quantity = parent.find('select[name="BIL_Item_Quantity"]').val();
    var rate = Number.parseFloat(parent.find('select[name="BIL_Item_Id"]').find(":selected").data('item-rate')).toFixed(2);
    var taxes_id = parent.find('select[name="BIL_Item_Id"]').find(":selected").data('item-taxes');
    var taxes_amount = Number.parseFloat(parent.find('select[name="BIL_Item_Id"]').find(":selected").data('item-taxes-sum')).toFixed(3);

    // Calculs
    var total_rate = (quantity * rate).toFixed(2);

    // Display
    parent.find('input[name="BIL_Item_Rate"]').val(rate);
    parent.find('input[name="BIL_Item_Total_Rate"]').val(total_rate);
    parent.find('input[name="BIL_Item_Taxes"]').val(taxes_id);
    parent.find('input[name="BIL_Item_Type"]').val(type);
});

What is doesn't work is when I select Night from the select. I can't enter a number into the input BIL_Item_Rate and the multiplication is not made too.
When I start typing into the input BIL_Item_Rate the content is removed at each keypress.
Do you know why please ?
https://jsfiddle.net/azq028g7/
Thanks for your help.

A: At the end of the code, you're setting the rate based on the selected item's data-item-rate - regardless of which dropdown option is selected. See my code below, where I moved it into the conditional checking for the value of the select.

$('select[name="BIL_Item_Quantity"], select[name="BIL_Item_Id"], input[name="BIL_Item_Rate"]').on('change keyup', function() {
    var parent = $(this).closest('div.modal-body');
    var type = parent.find('select[name="BIL_Item_Id"]').find(":selected").data('item-type');

    if(type == 'Night') {
     parent.find('input[name="BIL_Item_Rate"]').prop("readonly", false);
      var rate = Number.parseFloat(parent.find('input[name="BIL_Item_Rate"]').val()).toFixed(2);
    }
    if(type == 'Item') {
     parent.find('input[name="BIL_Item_Rate"]').prop("readonly", true);
      var rate = Number.parseFloat(parent.find('select[name="BIL_Item_Id"]').find(":selected").data('item-rate')).toFixed(2);
    }

    // Get datas
    var quantity = parent.find('select[name="BIL_Item_Quantity"]').val();
    /* var rate moved to conditional, above */
    var taxes_id = parent.find('select[name="BIL_Item_Id"]').find(":selected").data('item-taxes');
    var taxes_amount = Number.parseFloat(parent.find('select[name="BIL_Item_Id"]').find(":selected").data('item-taxes-sum')).toFixed(3);

    // Calculs
    var total_rate = (quantity * rate).toFixed(2);

    // Display
    parent.find('input[name="BIL_Item_Rate"]').val(rate);
    parent.find('input[name="BIL_Item_Total_Rate"]').val(total_rate);
    parent.find('input[name="BIL_Item_Taxes"]').val(taxes_id);
    parent.find('input[name="BIL_Item_Type"]').val(type);
});

        Bill an item

                <select class="form-control" name="BIL_Item_Id">
                    <option value="">Select</option>
                    <option value="" data-item-rate="" data-item-taxes="7" data-item-taxes-sum="0" data-item-type="Night">Night</option>
                    <option value="17" data-item-rate="21.00" data-item-taxes="8,7" data-item-taxes-sum="0" data-item-type="Item">Breakfast</option>
                </select>

        Quantity

                <select class="form-control" name="BIL_Item_Quantity">
                    <option value="1">1</option>
                    <option value="2">2</option>
                </select>

        Unit rate

                <input type="number" class="form-control col-xs-2" name="BIL_Item_Rate" required="" readonly="">

        Total

                <input type="number" class="form-control" name="BIL_Item_Total_Rate" required="" readonly="">

            <input type="hidden" class="form-control" name="BIL_Item_Taxes" value="">
            <input type="hidden" class="form-control" name="BIL_Item_Type" value="">


text:
Q: Control topbar with react native Im new at react native and I'm trying to do a simple aplication.
I just put a text and this is result in Nexus 5:

I understood that putting SaveAreaView this would be fixed but it dosen't.
 return (
    <SafeAreaView style={{flex: 1}}>
       <Text style={styles.principalTitle}>Just a text</Text>
    </SafeAreaView>
 );

How I can control the top bar for the text apears in a visible zone? Thank you.

A:
The purpose of SafeAreaView is to render content within the safe area
  boundaries of a device. It is currently only applicable to iOS devices
  with iOS version 11 or later. - SafeAreaView

In your case the SafeAreaView has no effect, but you can pass a marginTop to the view or directly to your text. E.g. :
 return (
    <SafeAreaView style={{flex: 1, marginTop: 20 }}>
       <Text style={styles.principalTitle}>Just a text</Text>
    </SafeAreaView>
 );

A: Following Tim reference answer I improved him code.
With React Native you can control status bar height:
import {...  , StatusBar} from 'react-native';

return (
   <SafeAreaView style={{flex: 1, paddingTop: StatusBar.currentHeight }}>
      <Text style={styles.principalTitle}>Just a text</Text>
   </SafeAreaView>
);

I prefered padding for conserve Background.
Thank you!


text:
Q: What is the difference between {"x":1} and {x:1} inside a function context This question is just to understand "How JavaScript works?" in a better way.
Tried declaring a method like below,
function wayOne() {
  {
    "x":1
  }
}
function wayTwo() {
  {
    x:1
  }
}

While function wayOne throws

Uncaught SyntaxError: Unexpected token ':'

the function wayTwo didn't throw any error.
What is the syntactical difference between these two methods

A: {} is a block.
This makes x: a label.
Labels have to be identifiers
A string literal, inside a block, is just a value. Following it by a : is meaningless, hence: Syntax error.


text:
Q: Distance problems with I2C connection for multiple devices I'm considering using the I2C bus protocol to connect up to 100 devices (worst case scenario) to a motherboard to avoid using serial-port connection with each one.
The problems I face are:

*

*I need them to be at a distance as far as 3-5 m

*The maximum voltage should be 5V

I've tried to find an answer to the problem and I've come across a couple of solutions such as setting pull-up resistors to counter the increase in capacitance, but I've found mixed opinions and articles and I can't reach a solution.
Do you think this is viable? What other options do I have?

A: IIC is fairly high impedance due to being passively pulled up and that the pulldown current must be rather small.  The pullups are usually a few kΩ minimum, which is the impedance of the lines when idle.  This is usually fine on a single board above a consistent ground plane, but extending such lines 5 meters is asking for trouble.  If you really have to do this, make the data rate low and encapsulate every packet with a checksum.
Ultimately you end up trading data rate with reliability.  You can probably get away with 100 kBit/s or so (just guessing).  That would give the lines 5 µs to settle after each edge before they should be looked at.
A probably better option would be to use CAN.  100 devices is getting near the limit but is still within spec.  The common MCP2551 is specified to support 112 devices, for example.  CAN is a differential bus with 120 Ω pull-together resistors at each end.  The differential nature and much lower impedance (60 Ω) make is suitable for going off board.  It was initially designed for use in cars, which are notorious for being electrically noisy.
5 meters is short for CAN.  If you use the right twisted pair, daisy chain topology, and properly terminate the bus at each end, you should be able to do 1 MBit/s without problems.
Another advantage of CAN is that silicon to implement the low levels of the protocol is built into many microcontrollers.  The lowest level firmware sends and receives whole packets.  The hardware takes care of encoding the data onto the wire, collision detection with backoff and retry, and checksum generation and validation.


text:
Q: Circular reveal animation with css I would create a simple circular reveal animation with css (or eventually with Angularjs since i'm using it in my webapp). What i would is the circular reveal animation like used in Android. The only example i found is in polymer samples: https://elements.polymer-project.org/elements/neon-animation?view=demo:demo/index.html&active=neon-animated-pages clicking in "Card" sample and then "Angular". But it's too complicated to include this one in my app. I hoped would possible to do the same thing only with css or ng-animation in a easier way. Anyone can help me? Thanks

A: A way I like to do that is with the Web Animations API. You should use the polyfill for support down to ie8. I understand you probably want to shy away from JS, but this is probably the best way to do it. This link should be able to help you out: https://codelabs.developers.google.com/codelabs/web-animations-transitions-playbackcontrol/index.html?index=..%2F..%2Findex#0 It's a codelab from I/O Google made and it should help you out


text:
Q: moto @mock_ec2 got error ImportError: cannot import name 'DictLoader'? I have the following test code,
from unittest.mock import Mock, patch

import boto3
import boto3.resources
import boto3.resources.base
import boto3.session
import pytest
from moto import mock_ec2

@pytest.fixture(scope="function")
def aws_credentials():
    """Mocked AWS Credentials for moto."""
    os.environ["AWS_ACCESS_KEY_ID"] = "testing"
    os.environ["AWS_SECRET_ACCESS_KEY"] = "testing"
    os.environ["AWS_SECURITY_TOKEN"] = "testing"
    os.environ["AWS_SESSION_TOKEN"] = "testing"
    os.environ["MOTO_ALLOW_NONEXISTENT_REGION"] = "True"
    os.environ["AWS_DEFAULT_REGION"] = "testing"

@pytest.fixture
def get_session(aws_credentials):
    """boto3 Session"""
    return boto3.session.Session()

# and other tests code

It runs fine. However, it got the following errors after I added the following test_method
@mock_ec2
def test_get_instances(get_session):
    """Test ...."""

The error is:
ImportError while importing test module 'C:\Users\....\test_n1.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
..\..\..\..\anaconda3\lib\importlib\__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests\unit_tests\test_node.py:85: in <module>
    @mock_ec2
..\..\..\..\anaconda3\lib\site-packages\moto\__init__.py:17: in f
    module = importlib.import_module(module_name, "moto")
..\..\..\..\anaconda3\lib\importlib\__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
..\..\..\..\anaconda3\lib\site-packages\moto\ec2\__init__.py:1: in <module>
    from .models import ec2_backends
..\..\..\..\anaconda3\lib\site-packages\moto\ec2\models.py:29: in <module>
    from moto.core import BaseBackend
..\..\..\..\anaconda3\lib\site-packages\moto\core\__init__.py:4: in <module>
    from .responses import ActionAuthenticatorMixin
..\..\..\..\anaconda3\lib\site-packages\moto\core\responses.py:11: in <module>
    from moto.core.exceptions import DryRunClientError
..\..\..\..\anaconda3\lib\site-packages\moto\core\exceptions.py:2: in <module>
    from jinja2 import DictLoader, Environment
E   ImportError: cannot import name 'DictLoader'

A: That sounds like you're missing some dependencies. Make sure you specify the services you are using when installing moto:
pip install moto[ec2]

When installing moto on it's own (pip install moto), it will only install the basics - specify which services you will use to make sure it installs the required dependencies.
See the documentation: http://docs.getmoto.org/en/latest/docs/getting_started.html#installing-moto


text:
Q: Meaning of dot after file permission in directory listing? I've decrypted and mounted an android adoptable storage. After I copied some files to the adoptable storage I notice a small difference between the file that were already on the adoptable storage and the ones I copied:
Already on the adoptable storage:
-rw-rw-r--. 1 1023 1057  9146406 Jan  8 09:24 IMG_20220108_092445.jpg

and the one I copied:
-rw-rw-r--  1 1023 1057  3554128 Jan  6  2020 IMG_20200106_182924.jpg

The difference is the dot after the file permission:
-rw-rw-r--. 1 1023 1057  9146406 Jan  8 09:24 IMG_20220108_092445.jpg
          ^

I can't find any explanation in the man page.
The stat command mentioned nothing:
$ stat IMG_20220108_092445.jpg IMG_20200106_182924.jpg
  File: IMG_20220108_092445.jpg
  Size: 9146406     Blocks: 17872      IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 12812558    Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1023/ UNKNOWN)   Gid: ( 1057/ UNKNOWN)
Access: 2022-01-08 09:24:46.932634035 +0100
Modify: 2022-01-08 09:24:46.942634035 +0100
Change: 2022-02-05 15:20:33.475347493 +0100
 Birth: -
  File: IMG_20200106_182924.jpg
  Size: 3554128     Blocks: 6944       IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 12813144    Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1023/ UNKNOWN)   Gid: ( 1057/ UNKNOWN)
Access: 2021-09-23 18:45:24.169164252 +0200
Modify: 2020-01-06 18:29:26.982414836 +0100
Change: 2022-02-05 15:20:33.475347493 +0100
 Birth: -

Does anyone knows the meaning of this little dot after the file permission?


text:
Q: When I'm using RequestDispatcher, instead of processing contents of JSP, JSP page as whole is being rendered on output When I'm calling RequestDispatcher, instead of processing request, JSP page itself is being rendered as output...JSP content is present after "Account Created" line.
//Servlet block
if(i==1){
            PrintWriter pw = response.getWriter();
            pw.println("Account Created!!");
            RequestDispatcher rd = request.getRequestDispatcher("Login.jsp");
            rd.include(request, response);
            System.out.println("Record Updated!!!");
        }

//Output rendered on browser:
Account Created!!

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"   "http://www.w3.org/TR/html4/loose.dtd">

<link rel="icon" type="image/ico" href="favicon.ico"></link>
<link rel="shortcut icon" href="favicon.ico"></link>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login Page</title>

<form action="./Authentication" method="post">

Enter username<input type="text" name="Uname">

Enter password<input type="password" name="Pword">

    <input type="submit" value="Login">
</form>

A: You should not be getting the writer in the servlet and you should not be manually writing a string to it and you should be using RequestDispatcher#forward() instead of include(). You're otherwise preventing JSP from setting the proper text/html content type and hence everything is interpreted as plain text by the webbrowser.
Rewrite that servlet block as follows to let JSP do its job properly:
if (i == 1) {
    request.getRequestDispatcher("Login.jsp").forward(request, response);
}

See also:

*

*Our servlets wiki page - contains Hello World examples of properly using servlets

A: It is because you are not setting contentType to your response before sending it to browser.
set response.setContentType("text/html"); it should work for you. :)


text:
Q: Set minimum height of table view cell? I have a UITableView,In this table i have created as custom cell with image & label.I have given label leading,trailing,top,bottom.I want to set the size of label to increase according to text which is happening.I have used UITableAutomaticDimension & EstimatedRowHeight.Now i want to set minimum height of cell equal to height of image.Now if text is very less in label then height of image is decreased.Now i want to keep height cell minimum as image height & increase it when there is more text.Please help how can i do it?

A: Looking at the view you shared i would suggest the following constraints.

*

*Top of UIImageView to top of your cell.

*Left of UIImageView top left of your cell.

*Width and Height constraints of your UIImageView.

*Bottom of UIImageView to the bottom of your cell which will be greater than or equal to.

*Right of your UIImageView to Left of your UILabel.

*Top of your UILabel to top of your cell.

*Right of your UILabel to right of your cell.

*Bottom of your UILabel to bottom of your cell.

Adding these constraints should solve your problems.


text:
Q: Cannot use sqlplus in linux I'm trying to run the sql command line "sqlplus" on my linux machine using the command "sqlplus / as sysdba". I get the following:
SQL*Plus: Release 11.2.0.1.0 Production on Tue Sep 20 12:28:29 2016
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to an idle instance.
then when I write statrup command I get :
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initSID.ora'
SQL> exit
Disconnected

I looked online for a solution and I followed whats written in https://community.oracle.com/thread/2178662
enter link description here
I tried the following commands before starting sqlplus again :
export ORACLE_SID=SID
env|grep ORA|sort  which give me the following information:
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
ORACLE_HOSTNAME= HOSENAME
ORACLE_SID=SID
ORACLE_UNQNAME=DB11G

last I wrote cat /etc/oratab ,, with the following result
# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#

At the end, I tried to check if my database is running using the following command  ps -ef|grep pmon
which showed me
oracle   18023 11347  0 12:38 pts/5    00:00:00 grep --color=auto pmon
oracle   19686     1  0 Aug23 ?        00:05:11 ora_pmon_apertureSID

So now I'm not sure whats the problem. I need to run the sqlplus
Can anyone guide me

A: Your databases SID is "apertureSID" not pure "SID".
export ORACLE_SID=apertureSID
moreover, it is recommended to have Oracle SID max. length 12 character, usually all uppercase.

A: So the solution was to change the ORACLE_SID using the command .oraenv
then it promoted me to change ORACLE_SID= [SID] ? ApertureSID
Finally I just checked that using the command env |grep ORACLE and re-run the sqlplus. WORKED
very helpful tutorial : http://blog.dbvisit.com/whats-going-on-connected-to-an-idle-instance-but-database-is-running/


text:
Q: El shortcut para comentar de emmet no funciona en brackets hace tiempo que uso emmet con Atom y funciona perfectamente, pero tengo que editar una cosa a través de brackets y el shortcut de comentar con emmet no funciona.
He probado las siguientes soluciones:

*

*Desinstalar atom

*Desinstalar emmet

*Desinstalar brackets y todas sus carpetas de preferencias

*sobreescribir el shortcut

Cuando lo hago desde el menú superior si que funciona, aunque al lado del nombre de la acción no aparece ningún shortcut como en las demás acciones

Tampoco el shortcut para comentar de beackets funciona. ¿Alguien sabe qué está ocurriendo o cómo solucionarlo?
Gracias,
Pedro


text:
Q: $f\in K[X]$ irreducible odd degree, $\alpha, \beta\in\bar K$ distinct roots of $f$ $\Rightarrow$ neither $\alpha+\beta\in K$ nor $\alpha\beta\in K$ My task is to show following:
Let $ f \in K[X]$ irreducible with odd degree.
If $\alpha , \beta \in \bar K$ are distinct roots of $f$, where $ \bar K$ is an algebraic closure of $K$, neither $\alpha + \beta \in K$ nor $ \alpha \beta \in K$.
I have no idea, how to go on. Some hints or (partial) solutions would be really nice.

A: Let us first assume that $f(x)$ is separable.
Let $L$ be the splitting field of $f(x)$. Then $L/K$ is Galois, and the Galois group $G=Gal(L/K)$ acts transitively on the set of zeros of $f(x)$.
Assume that $\alpha+\beta=z\in K$ for some roots $\alpha,\beta$. In other words, $\beta=z-\alpha$ is also a root. For each $\sigma\in G$ we get that
$$z-\sigma(\alpha)=\sigma(z)-\sigma(\alpha)=\sigma(\beta).$$ Here $\sigma(\alpha)$ and $\sigma(\beta)$ are also roots of $f(x)$, and by transitivity of $G$ any root of $f(x)$ will appear as $\sigma(\alpha)$ for some $\sigma\in G$. We have proven that:

For any root $\gamma$ of $f(x)$, the element $z-\gamma$ is also a root of $f(x)$.

So the mapping $\delta:\alpha\mapsto z-\alpha$ is a permutation of the roots. If $\delta(\alpha)=\alpha$, then $2\alpha=z$. This is a contradiction because either we have $\alpha=z/2\in K$, or (in characteristic two) $z=0$ and $\alpha=-\alpha$ is a double root. So $\delta$ cannot have fixed points.
As $\delta^2(\alpha)=\alpha$ it follows that $\delta$ permutes the roots in 2-cycles. But there are an odd number of them so this is a contradiction.
An alternative end game would be to use the fact that by Vieta relations the sum of all the roots of $f(x)$ is an element of $K$ when pairing up all the roots, save for a single exception, would imply that the unpaired root would also be an element of $K$.
As you asked for hints only I am leaving it to you to figure out what modifications to this argument are needed to show that $\alpha\beta\notin K$.

If $f(x)$ is non-separable and irreducible then, $K$ has characteristic $p$,  $f(x)=g(x^{p^t})$ for some $t$, and $g(x)$ is an irreducible separable polynomial of odd degree over $K$. The roots of $g$ are gotten by raising the roots of $f$ to the power $p^t$. So if $\alpha$ and $\beta$ are distinct root of $f$ then $\alpha^{p^t}$ and $\beta^{p^t}$ are roots of $g$ (you prove that they are distinct, it's not hard!). Therefore the above result tells us that
$$\alpha^{p^t}+\beta^{p^t}=(\alpha+\beta)^{p^t}$$ is not an element of $K$. Therefore neither is $\alpha+\beta$. Ditto for the product.


text:
Q: Simplifying inverse trigonometric expressions such as $\cos^{-1}\left(\frac{x^2-1}{x^2+1}\right)+\tan^{-1}\left(\frac{2x}{x^2-1}\right)$ Okay so I'm just looking for a short cut method or a method that is not so long for simplifying expressions like this
$$\cos^{-1}\left(\frac{x^2-1}{x^2+1}\right)+\tan^{-1}\left(\frac{2x}{x^2-1}\right)$$
Here is how I do it: I take the first term of the equation and convert it to $\tan^{-1}$ form, and then I apply the formula of $\tan^{-1}a +   \tan^{-1}b$. But this method is really time consuming; plus, it results in mistakes most of the times. Any alternatives or how you would do it, let me know, I'll be grateful. Thanking in anticipation.
Edit. Do I put $x= \tan y$ and solve? That should make it easy.

A: $$
\frac{1-\tan^2(u)}{1+\tan^2(u)}=\cos(2u)\implies
\cos^{-1}\left(\frac{x^2-1}{x^2+1}\right)
=\left\{\begin{array}{}
\pi+2\tan^{-1}(x)&\text{if }x\lt0\\
\pi-2\tan^{-1}(x)&\text{if }x\gt0
\end{array}\right.
$$
$$
\frac{2\tan(u)}{1-\tan^2(u)}=\tan(2u)\implies
\tan^{-1}\left(\frac{2x}{x^2-1}\right)
=\left\{\begin{array}{}
-\pi-2\tan^{-1}(x)&\text{if }x\lt-1\\
-2\tan^{-1}(x)&\text{if }-1\lt x\lt1\\
\pi-2\tan^{-1}(x)&\text{if }x\gt1
\end{array}\right.
$$
Therefore,
$$
\cos^{-1}\left(\frac{x^2-1}{x^2+1}\right)+\tan^{-1}\left(\frac{2x}{x^2-1}\right)
=\left\{\begin{array}{}
0&\text{if }x\lt-1\\
\pi&\text{if }-1\lt x\le0\\
\pi-4\tan^{-1}(x)&\text{if }0\lt x\lt1\\
2\pi-4\tan^{-1}(x)&\text{if }x\gt1
\end{array}\right.
$$

A: Revised for the last part
In your specific case
$$
\cos ^{ - 1} \left( {\frac{{x^2  - 1}}
{{x^2  + 1}}} \right) + \tan ^{ - 1} \left( {\frac{{2x}}
{{x^2  - 1}}} \right)
$$
you may note that:
$$
\left\{ \begin{gathered}
  x^2  - 1 = \operatorname{Re} \left( {\left( {x + i} \right)^2 } \right) \hfill \\
  2x = \operatorname{Im} \left( {\left( {x + i} \right)^2 } \right) \hfill \\
  \left( {x^2  + 1} \right) = \left| {\left( {x + i} \right)} \right|^2  = \left| {\left( {x + i} \right)^2 } \right| \hfill \\
\end{gathered}  \right.
$$
so that
$$
\begin{gathered}
 f(x)= \cos ^{ - 1} \left( {\frac{{x^2  - 1}}
{{x^2  + 1}}} \right) + \tan ^{ - 1} \left( {\frac{{2x}}
{{x^2  - 1}}} \right) =  \hfill \\
   = \cos ^{ - 1} \left( {\frac{{\operatorname{Re} \left( {\left( {x + i} \right)^2 } \right)}}
{{\left| {\left( {x + i} \right)^2 } \right|}}} \right) + \tan ^{ - 1} \left( {\frac{{\operatorname{Im} \left( {\left( {x + i} \right)^2 } \right)}}
{{\operatorname{Re} \left( {\left( {x + i} \right)^2 } \right)}}} \right) =  \hfill \\
   = \cos ^{ - 1} \left( {\cos \left( {2\arg \left( {x + i} \right)} \right)} \right) + \tan ^{ - 1} \left( {\tan \left( {2\arg \left( {x + i} \right)} \right)} \right) \hfill \\
\end{gathered}
$$
Here we have to stop and do some case distinction, because
of the codomain limitation in the definition of $arccos$ and $arctan$, which if overlooked will cause the error signalled by Jean-Claude Arbaut.
In fact
$$
\cos ^{ - 1} \left( {\cos \alpha } \right) = \left| {\alpha _ *  } \right|\quad \quad \tan ^{ - 1} \left( {\tan \alpha } \right) = \alpha _{\, *  * } \quad \left| {\;\alpha _{\, *  * }  \ne \pi /2} \right.
$$
where the star indices indicate the necessary reductions mod $2\pi$ and $\pi$, that is
$$
\begin{gathered}
  \alpha _{\, * }  = \pi  - \bmod \left( {\pi  - \alpha ,\;2\,\,\pi } \right)\quad \left| \; \right. - \pi  < \alpha _{\, * }  \leqslant \pi  \hfill \\
  \alpha _{\, *  * }  = \pi /2 - \bmod \left( {\pi /2 - \alpha ,\;\,\pi } \right)\quad \left| \; \right. - \,\pi /2 < \alpha _{\, *  * }  \leqslant \pi /2 \hfill \\
\end{gathered}
$$
So the development above continues as:
$$
\begin{gathered}
  f(x) = \cos ^{ - 1} \left( {\frac{{x^2  - 1}}
{{x^2  + 1}}} \right) + \tan ^{ - 1} \left( {\frac{{2x}}
{{x^2  - 1}}} \right)\quad \left| {\;x \ne 0,\; \pm 1} \right.\quad  =  \hfill \\
   = \cos ^{ - 1} \left( {\cos \left( {2\arg \left( {x + i} \right)} \right)} \right) + \tan ^{ - 1} \left( {\tan \left( {2\arg \left( {x + i} \right)} \right)} \right) =  \hfill \\
   = \left| {\left( {2\arg \left( {x + i} \right)} \right)_ *  } \right| + \left( {2\arg \left( {x + i} \right)} \right)_{\, *  * }  =  \hfill \\
   = \left| {\left( {2\tan ^{ - 1} \left( {1/x} \right)} \right)_ *  } \right| + \left( {2\tan ^{ - 1} \left( {1/x} \right)} \right)_{\, *  * }  \hfill \\
\end{gathered}
$$
for finally arriving at
$$
f(x) = \left\{ {\begin{array}{*{20}c}
   0 & {x <  - 1}  \\
   \pi  & { - 1 < x \leqslant 0}  \\
   {4\tan ^{ - 1} \left( {1/x} \right) - \pi } & {0 < x < 1}  \\
   {4\tan ^{ - 1} \left( {1/x} \right)} & {1 < x}  \\
 \end{array} } \right.
$$
where the critical points have been filled according to the limit values
of $f(x)$.


text:
Q: Could not load neutron_lbaas.drivers.haproxy.namespace_driver.HaproxyNSDriver I'm am beginner in openstack and I have install openstack ocata successfully.I using link below to install lbaas:
https://docs.openstack.org/ocata/networking-guide/config-lbaas.html
When i want to install lbaasv2 I encounter with error below:
openstack@ubuntu:~$ sudo neutron-lbaasv2-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/lbaas_agent.ini
Guru meditation now registers SIGUSR1 and SIGUSR2 by default for backward compatibility. SIGUSR1 will no longer be registered in a future release, so please use SIGUSR2 to generate reports.
2018-01-21 22:43:12.408 10772 INFO neutron.common.config [-] Logging enabled!
2018-01-21 22:43:12.409 10772 INFO neutron.common.config [-] /usr/bin/neutron-lbaasv2-agent version 10.0.4
2018-01-21 22:43:12.411 10772 WARNING stevedore.named [req-6ebf45ef-7ff4-43c2-8c9a-d9b1f3acc839 - - - - -] Could not load neutron_lbaas.drivers.haproxy.namespace_driver.HaproxyNSDriver
^C2018-01-21 22:43:19.697 10772 INFO oslo_service.service [-] Caught SIGINT signal, instantaneous exiting

I enter commands in controller node.
Thanks a lot.

A: That warning appears to be "cosmetic" - i.e. you can ignore it, and the agent should work OK - at least it does for me. Someone probably should file a bug on this. I may do that myself.


text:
Q: Sidebar with django, layout or view? I want to make a sidebar for my webapplication. It contains the following content:

*

*A search bar

*a list of tags

*links to recent posts (with year and month)

I want to include this sidebar in every site/view. So my first guess is that it would belong to a layout.
But it's also dynamic and as far as i know layouts are static.
How do I avoid redundancy in my views/layouts and still have the sidebar on every site?

A: To have context data passed to multiple templates you have different options in django; You could either:

*

*Make a Template Tag which can pull in the relevant data and render it and reuse it in every template you need to (or just insert it in a base template and use template inheritance).

*Use a context processor: It will be called with every request and add data to every view's context that uses RequestContext.

*Using Django's class based views you could have all your views inherit from a base view which adds data to your context.
If you need data from your database I would rather go with using a template tag than using a context processor as it will be called for every view.

A: For static content in your sidebar (e.g. search form), its straight forward template/html.
For the dynamic content like list of tags, recent posts:
Once in the template you have identified a elements (div or something else) to put this info, you can populate its content using either your custom template tag or having custom context processor.
In your case, if the content doesn't really depend upon request parameter or url, template tag would be better choice.
Reference Custom template tag Custom Context Processor