text:
Q: Kendo Widget not staying in partialview So, I'm working on a website that'll visualize data. I'm trying to create it with partial views. When I click on a tab to show a pie chart, the pie chart displays on the bottom of the page. I'd like it to show up "navResult".
. When I type blah blah in side the paragraph element it stays inside the "navResult" div. I'm not sure if it's Kendo overriding a stylesheet or what.
EDIT: Also, when the PartialView link is clicked on and a H2 or other header element is in that partialview, there is a gap created between the navbar and the header. ex =
<!DOCTYPE html>

        <title>@ViewBag.Title - My Telerik MVC Application</title>
        <link href="@Url.Content("~/Content/bootstrap.css")" rel="stylesheet" type="text/css" />

        @Scripts.Render("~/bundles/modernizr")
        @Scripts.Render("~/bundles/jquery")

        <link href="https://kendo.cdn.telerik.com/2017.3.913/styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
    <link href="https://kendo.cdn.telerik.com/2017.3.913/styles/kendo.mobile.all.min.css" rel="stylesheet" type="text/css" />
    <link href="https://kendo.cdn.telerik.com/2017.3.913/styles/kendo.default.min.css" rel="stylesheet" type="text/css" />

        <link rel="stylesheet" type="text/css" href="~/Content/MainPage.css" />

                    THIS IS BARELY ANY INFORMATION IN THE HEADER

                <button type="button" class="navbar-toggle" data-toggle="collpase" data-target=".nav">
                    <snap class="icon-bar"></snap>
                    <snap class="icon-bar"></snap>
                    <snap class="icon-bar"></snap>
                </button>

                        @Ajax.ActionLink("Robot", "Robot", "Home", new AjaxOptions() { UpdateTargetId = "navResult" })

                        @Ajax.ActionLink("Data", "Data", "Home", new AjaxOptions() { UpdateTargetId = "navResult" })

                        @Ajax.ActionLink("Client", "Client", "Home", new AjaxOptions() { UpdateTargetId = "navResult" })

                this will represent info from the nav bar

            @RenderBody()

Model
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace RobotUI.Controllers
{
    public class HomeController : Controller
    {
        // GET: Home
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Robot()
        {
            return PartialView();
        }
        public ActionResult Client()
        {
            return PartialView();
        }
        public ActionResult Data()
        {
            return PartialView();
        }
    }
}

And the viewpage I'm trying to click on is Robot...
@{
    ViewBag.Title = "Robot";
}
    @(Html.Kendo().Chart()
        .Name("chart")
                .Title(title => title
                    .Text("Share of Internet Population Growth, 2007 - 2012")
                    .Position(ChartTitlePosition.Bottom))
        .Legend(legend => legend
            .Visible(false)
        )
        .ChartArea(chart => chart
            .Background("transparent")
         )
        .HtmlAttributes(new { style = "background: center no-repeat url(" + @Url.Content("~/Content/shared/world-map.png") })
        .Series(series =>
        {
            series.Pie(new dynamic[] {
                new {category="Asia",value=53.8,color="#9de219"},
                new {category="Europe",value=16.1,color="#90cc38"},
                new {category="LatinAmerica",value=11.3,color="#068c35"},
                new {category="Africa",value=9.6,color="#006634"},
                new {category="MiddleEast",value=5.2,color="#004d38"},
                new {category="NorthAmerica",value=3.6,color="#033939"}
            })
            .Labels(labels => labels
                .Template("#= category #: \n #= value#%")
                .Background("transparent")
                .Visible(true)
            )
            .StartAngle(150);
        })
        .Tooltip(tooltip => tooltip
            .Visible(true)
            .Format("{0}%")
        )
    )

Here is the css file
ul{
    list-style-type:none;
    margin:0;
    padding:0;
    width: 100%;
    height: 100%;
    overflow:auto;
    background-color:#f1f1f1;
}
li{
    text-align: center;
}

li:last-child{
    border-bottom: none;
}

li a{
display:block;
color:#000;
padding: 8px 16px;
text-decoration: none;
}

li a:hover{
    background-color: #555;
    color:white;
}
body, html {
    padding: 0;
    margin: 0;
    position: relative;
    height: 100%;
}

div.page-header {
    margin: 0;
    width: 100%;
    top: 0px;
    height: 10%;
    box-sizing: border-box;
    background-color: #ffe3e2;
}

div.header-content {
}

div.Main-Content {
    width: 100%;
    height: 100%;
}

div.nav {
    height: 100%;
    width: 20%;
    float: left;
}
.KendoView
{
    vertical-align:top;
}

div.navResult {
    height: 100%;
    width: 80%;
    float: right;
    background-color: #705756;
}

A: To fix these type of styling issues, I suggest you place the control inside a container tag (such as span or div) and apply the styling that you need.
Here is an example:
@{
    ViewBag.Title = "Robot";
}

    @(Html.Kendo().Chart()
        .Name("chart")
                .Title(title => title
                    .Text("Share of Internet Population Growth, 2007 - 2012")
                    .Position(ChartTitlePosition.Bottom))
        .Legend(legend => legend
            .Visible(false)
        )
        .ChartArea(chart => chart
            .Background("transparent")
         )
        .HtmlAttributes(new { style = "background: center no-repeat url(" + @Url.Content("~/Content/shared/world-map.png") })
        .Series(series =>
        {
            series.Pie(new dynamic[] {
                new {category="Asia",value=53.8,color="#9de219"},
                new {category="Europe",value=16.1,color="#90cc38"},
                new {category="LatinAmerica",value=11.3,color="#068c35"},
                new {category="Africa",value=9.6,color="#006634"},
                new {category="MiddleEast",value=5.2,color="#004d38"},
                new {category="NorthAmerica",value=3.6,color="#033939"}
            })
            .Labels(labels => labels
                .Template("#= category #: \n #= value#%")
                .Background("transparent")
                .Visible(true)
            )
            .StartAngle(150);
        })
        .Tooltip(tooltip => tooltip
            .Visible(true)
            .Format("{0}%")
        )
    )

Basically, I put your widget inside a div tag and applied the float style on it. You might use other styling properties such as margins. The better solution would be defining a class in your style sheet and using the class attribute in the div tag.


text:
Q: Show that a system of 4 equations has a unique solution I have a system of equations and I would like your help to show that it has a unique solution with respect to $\lambda_1,\lambda_2,\lambda_3$.
More precisely, let the system be
$$
\begin{cases}
c\lambda_1=\lambda_3a\\
b\lambda_1=\lambda_2a\\
\lambda_1+\lambda_2+\lambda_3=1\\
\end{cases}
$$
where it is assumed that $a,b,c,\lambda_1,\lambda_2,\lambda_3$ are strictly positive and $a+b+c=1$.
Question: I want to show that $\lambda_1=a, \lambda_2=b, \lambda_3=c$ is the unique solution of the system. I tried various substitution routes but couldn't come up with any clean steps. Could you help?

A: We get $$\lambda_2=\frac{b}{a}\lambda_1$$
$$\lambda_3=\frac{c}{a}\lambda_1$$ so
$$\lambda_1+\frac{b}{a}\lambda_1+\frac{c}{a}\lambda_1=1$$
Can you proceed?
From this equation (using that $$a+b+c=1$$) we get $$\lambda_1=a$$

A: Hint Multiplying both sides of the last equation gives
$$a = a \lambda_1 + a \lambda_2 + a \lambda_3,$$
and substituting using the first two equations gives
$$a = a \lambda_1 + (b \lambda_1) + (c \lambda_1) .$$

 Factoring gives $a = (a + b + c) \lambda_1 = \lambda_1$. Now, the first two equations tell us that $\lambda_1$ determines $\lambda_2$ and $\lambda_3$.

A: The determinant of the system is
$$\begin{vmatrix}c&0&-a\\b&-a&0\\1&1&1\end{vmatrix}=-a(a+b+c)\ne0,$$
hence the solution is unique.

A: Rescaling the variables by the factors $a,b,c$ respectively,
$$\mu_1=\mu_2=\mu_3,\\a\mu_1+b\mu_2+c\mu_3=1$$ is trivial to solve.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why does the pow function give me nan as an answer? I have a program that reads in 5 integers and gives out results of various calculations using those numbers. I am having particular trouble calculating the geometric mean. I am aware that you are supposed to multiply the numbers together and take the nth root of the result.
my code is as follows (assume all #includes and main method are correct.):
int num1, num2, num3, num4, num5;

cout << "Enter five integers: \n";
cin >> num1 >> num2 >> num3 >> num4 >> num5;

double gMean = pow((num1 * num2 * num3 * num4 * num5), (1.0/5.0));
cout << "Geometric mean     = " << gMean << endl;

This code works for small numbers, such as 1, 2, 3, 4, 5, but when I input large numbers it gives me nan as the answer.
The numbers I need to work in this are : 85, 43, 95, 100, and 78
My question is: Why does the pow() function give me nan as the answer when the larger numbers are put in but return the correct answers when small numbers are put in?
EDIT: First question answered. Now that I know that I am having overflow issues, how do I go about resolving it?

A: From the man page of pow(x,y):
   If x is a finite value less than 0, and y is a finite noninteger,
a domain error occurs, and a NaN is returned.

   Except as specified below, if x or y is a NaN, the result is a NaN.

   If x is negative, then large negative or positive y values yield a NaN
as the function result, with  errno  set  to  EDOM,  and  an  invalid
   (FE_INVALID)  floating-point  exception.  For example, with pow(),
one sees this behavior when the absolute value of y is greater than about
   9.223373e18.

So looks like first case in your case.

A: To (possibly) avoid the overflow, re-write as
double gMean = pow(num1, (1.0/5.0)) *
               pow(num2, (1.0/5.0)) *
               pow(num3, (1.0/5.0)) *
               pow(num4, (1.0/5.0)) *
               pow(num5, (1.0/5.0))

A: The problem is not in  the pow. The expression
num1 * num2 * num3 * num4 * num5

is the culprit by itself. If you look at the resultant value in debugger you will probably see some meaningless negative value. This is what makes pow fail. If fails with domain error if the first argument is negative and the second argument is not an integer.
The product of 85, 43, 95, 100, and 78 does not fit into the range of int on your platform. It overflows and leads to undefined behavior. This is what you observe.
Evaluate the value of that expression as
(double) num1 * num2 * num3 * num4 * num5

and your pow should give a more meaningful result.

A: You are overflowing what a double can store.  The numbers are too large and cause the doubles you are inputting to overflow.
Also, you can check for these issues based on some events that occur during errors as described in the documentation here:
http://en.cppreference.com/w/cpp/numeric/math/pow
Edited for clarity:  pow() takes a double as it's input, so when you multiply all those ints together, you can cause an overflow when the result is typecast to a double.  Also, the math itself can cause the overflow.


text:
Q: java.net.ProtocolException: unexpected end of stream in retrofit I am using retrofit and okhttp to make a server call. But sometimes I get an error which crashes with the following log.(I am using a GET call):
Log:
: java.net.ProtocolException: unexpected end of stream
  at com.squareup.okhttp.internal.http.Http1xStream$ChunkedSource.read(Http1xStream.java:442)
at okio.RealBufferedSource$1.read(RealBufferedSource.java:371)
at java.io.InputStream.read(InputStream.java:162)
 at retrofit.Utils.streamToBytes(Utils.java:43)
 at retrofit.Utils.readBodyToBytesIfNecessary(Utils.java:81)
  at retrofit.RestAdapter.logAndReplaceResponse(RestAdapter.java:483)
at retrofit.RestAdapter.access$500(RestAdapter.java:107)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:338)
at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
 at retrofit.Platform$Android$2$1.run(Platform.java:142)
 at java.lang.Thread.run(Thread.java:818)

Code:
 final OkHttpClient okHttpClient = new OkHttpClient();
    okHttpClient.setReadTimeout(60, TimeUnit.SECONDS);
    okHttpClient.setConnectTimeout(60, TimeUnit.SECONDS);

        RestAdapter restAdapter = new RestAdapter.Builder()
.setClient(new OkClient(okHttpClient))
          .setEndpoint(URL).build();
        myapi myapi_rest = restAdapter.create(myapi.class);
        myapi_rest.my_call(
                sno,
                new Callback<Response>() {

                    @Override
                    public void success(Response result, Response response) {

                    }

                    @Override
                    public void failure(RetrofitError error) {
                        // Log.i("Failure", "Error"+error.getMessage());

                    }
                });


text:
Q: Open email with subject line that redirects to a new page I was trying to use an email address with a subject that will redirect to a new page. I have already done that before and it was working fine but today I am having trouble to work with this!

*

*The email should be: reg.immunology@succinctcomms.com

*The subject line should be: Registered interest | EADV Fight Club | Wednesday 9th October 2019 | Madrid&body=Please accept this email as confirmation that I would like to register to attend the Janssen Exchange Fight Club event at EADV. [Insert name]%0A%0A[Insert place of work]%0A%0A[Insert any dietary requirements]

*Destination should be: http://janssenmedicalcloud.co.uk/exchange-hub/EADV-Dermatology-Webinar-2019?ea=pHhMpRmzH2
I can not use JS because I am working on an email template.
Any kind of suggestion or help would be very appreciatable.

mailto:reg.immunology@succinctcomms.com?subject=Registered interest | EADV Fight Club | Wednesday 9th October 2019 | Madrid&body=Please accept this email as confirmation that I would like to register to attend the Janssen Exchange Fight Club event at EADV. [Insert name]%0A%0A[Insert place of work]%0A%0A[Insert any dietary requirements]&destination=http://janssenmedicalcloud.co.uk/exchange-hub/EADV-Dermatology-Webinar-2019?ea=pHhMpRmzH2"


text:
Q: pass javascript var into iframe I'd like to select a random youtube video from a list of 5 videos. I use javascript to assign the videos into an array then select one randomly. I then attempt to pass the variable of the random selected video in the iframe, however it's not loading the video.
3 questions: Am I passing the variable correctly? Is it even possible to pass a variable into an iframe that is accessing a different domain? If not, is there recommendations on how to achieve the desired outcome?

A: Try this:

A: using jQuery: try this one. (iframe is the id of the iframe tag)
$(document).ready(function(){
$('#iframe').src='http://www.youtube.com/embed/+vtubeselected?rel=0'+<whatever no want to add>
});


text:
Q: What do I do if my WordPress site is suddenly sanitizing portions of URLs it shouldn't? Nobody has touched wp-admin for this site in weeks. Suddenly, URLs are being sanitized in ways that break everything. The question marks of query parameters are being replaced with URL escape code %3F, which is obviously breaking nearly every script and stylesheet include that's affected. The result is content like this:
<script type='text/javascript' src='wp-content/plugins/woocommerce/assets/js/select2/select2.full.min.js%3Fver=4.0.3'></script>

<script type='text/javascript' src='wp-includes/js/wp-embed.min.js%3Fver=5.4.1'></script>

Some, but not all URLs in the document are affected. Scripts and some anchor elements are affected.
In addition to this URL madness, it seems like portions of the main site are being included in every single page - i.e., the homepage's markup is being embedded within wp-admin pages, etc.
The effect is that the site can essentially not be used - large dynamic portions of pages, especially the main landing page, simply fail to load or appear malformed due to missing scripts and stylesheets.
I should add that it's nearly impossible to navigate wp-admin given the absurd state that it's in at the moment, so I can't really find my way around to do regular diagnostics.
How do I even begin to fix something like this? If this wasn't a moneymaking site with plenty of content I haven't even touched ('the last guy' decided to install dozens of plugins whose purposes are difficult to decipher, are possibly redundant, and might break everything if removed) I would gladly just reinstall everything.
I have attempted:

*

*Removing a "WP Fastest Cache" plugin which, according to some, 'breaks everything' as of this month. Edit: It looks like this plugin is parasitic. After deactivating it, clearing my local cache, etc., pages still contain a comment marking them as having been cached by it...

*Visiting and re-saving permalink settings in wp-admin as suggested by a comment I found in a similar issue elsewhere.
 -

A: It turns out that the folder wp-content/mu-plugins, for whatever reason, didn't contain plugins, but instead a dump of broken copies of most pages on the site, as well as an outdated copy of the entire public_html directory, with another plugins folder nested inside of it, etc! How that happened is beyond me, but simply removing the entire folder corrected all errors on the site and actually significantly improved its performance!
Note: If you are encountering a similar issue, DO NOT use this as your go-to solution unless you are absolutely sure it is a problem: mu-plugins should normally contain critical plugins.

A: %3F is used for ? and can be a result of urlencode function.
Some plugin may use the urlencode php function to encode instead of WordPress esc_url()
Troubleshoot Method

*

*Open the complete website project in some editor which have find in files feature.

*Find if any %3F is present in code files. There may be a possibility of manual entry by any plugin developer.

*Find urlencode php function.

*If you find some then check the where it is implemented. and replace that with ecs_url() or you can remove if its with in any unnecessary plugin.

In case nothing found:

*

*Find the occurrence of select2.full.min.js

*Check if its a plugin instead of woocommerce tried to load in any problematic way.

Implement the site in your local host and check by removing the plugins one by one. Of course the site will break but just look after the %3F encoding problem and which plugin is causing that. After that you can take alternate solution to that plugin or you can change the code of that plugin.
This is just a procedure to find the cause of the problem.
If you wish you could specify the site url or can reply me on comments for further help.


text:
Q: Add an ASP Button inside a asp table cell I have an ASP.NET Table that has rows added to it through C# and I was wondering is it possible to add an ASP Button inside a cell using C# code behind? I have looked around and not found anything that relates to what I am trying to do/

A: Button button=new Button();
button.Text="Hello, world!";
table.Rows[0].Cells[0].Controls.Add(button);

Create the button, set its properties and then add it to the Controls collection of the control you want to add it to. Remember that you should do this in Page_Init in order to maintain ViewState for dynamic controls (or manually add the control to the ViewState).

A: public void AddButton()
    {

          // Create new row and add it to the table.
          TableRow tRow = new TableRow();
          Table1.Rows.Add(tRow);
          for (cellCtr = 1; cellCtr <= cellCnt; cellCtr++) {
             // Create a new cell and add it to the row.
             TableCell tCell = new TableCell();
             tCell.Text = "Row " + rowCtr + ", Cell " + cellCtr;
             tRow.Cells.Add(tCell);
           Button bt = new Button();
           bt.text = "Click Me";
           bt.OnClick += OnClick;
           tRow.controls.add(bt);

    void GreetingBtn_Click(Object sender,  EventArgs e)
    {
      // do whatever you want to do
    }


text:
Q: Definition of Cartier divisors My question regards the definition of Cartier divisors.
Let $X$ be a scheme correspoding to a variety over an algebraically closed field, and $\mathcal{K}$ the constant sheaf of rational functions of $X$. Let $\mathcal{K}^{*}$ the sheaf of invertible elements of $\mathcal{K}$, and $\mathcal{O}_{X}^{*}$ be the sheaf of invertible elements of the structure sheaf.
A Cartier divisor on $X$ is a global section of $\mathcal{K}^{*}/\mathcal{O}_{X}^{*}$.
On Robin Hartshone's book "Algebraic Geometry", I read that any Cartier divisor is determined by an open covering $\{U_{i}\}$ of the underlying topological space of $\mathcal{K}^{*}/\mathcal{O}_{X}^{*}$, and for each $U_{i}$ an element $t_{i}\in \Gamma (U_{i},\mathcal{K}^{*})$ such that $t_{i}/t_{j}\in \Gamma (U_{i}\cap U_{j}, \mathcal{O}_{X}^{*})$ for any $i,j$.
It is not clear to me how the latter definition relates to the first one.

A: This actually has nothing to do with divisors: it is a purely abstract fact about sheaves.
If $A$ and $B$ are abelian sheaves such that $A \subseteq B$, then we can define the quotient presheaf $P$ by setting $P(U) := B(U) / A(U)$. The quotient sheaf $C := B / A$ is the sheaf associated to $P$: this is where the idea of an element defined locally on the sets of an open covering comes from.
In fact, one can show that the stalks satisfy $C_x \cong B_x / A_x$ for every point $x$, and that for any open set $U$ containing $x$ and any section $s \in C(U)$, there is an open set $V$ containing $x$ on which $s|_V$ is in the image of an element in $B(V)$.
Once we're down to the level of abelian groups, we invoke the fact that in general, for abelian groups $H \subseteq G$, one can name elements of $G/H$ by giving an element of $g$ in the right equivalence class. Then the assertion that the elements named by $g$ and by $g'$ are equal in $G/H$ becomes that $g-g' \in H$.


text:
Q: How to select an element from a dropdown using playwright with typescript? As a beginner I am trying to select an element from a dropdown box using the following code
const dropdown = await page1.getByRole('textbox', { name: 'Select' }).click();
await dropdown.selectOption({value: 'slice59'});

But it see the property selectOption does not exist.
How to do it correctly?
The html looks like this:

<input type="hidden">

              <input type="text" placeholder="Select" autocomplete="off" spellcheck="false" class="ivu-select-input">

No matching data

5Cells

            ... and other li elements

A: You cannot use selectOption there, you need <select> element to use that API.
https://playwright.dev/docs/api/class-locator#locator-select-option
Check out this answer:
playwright click a button inside a dropdown
You could use a locator like this:
await page.locator(':has-text("5Cells")').click();

To click on this item.


text:
Q: XHTML version recommended according to w3.org What is the recommended xhtml version to use these days according with w3.org?
I don´t know but it seems the last recommendation is xhtml 1.1.
But not sure.

A: The most recent version of XHTML to reach Recommendation status is 1.1.
HTML 5 has an XML serialisation and is at Candidate Recommendation status.


text:
Q: Scaling for Android devices with starling causing some layout issues I'm using multi resolution technique number three as written in this article
and to determine the scale factor and stage size, I'm using this piece of code originally written by Jeff :
        if (Capabilities.screenDPI >= 200) {
            if (Capabilities.screenDPI >= 280) {
                AssetFactory.contentScaleFactor = 2;
            }
            else {
                AssetFactory.contentScaleFactor = 1.5;
            }
        }
        else {
            AssetFactory.contentScaleFactor = 1;
        }

        var mViewPort:Rectangle = new Rectangle(0, 0, stage.fullScreenWidth, stage.fullScreenHeight);

        mStarling = new Starling(Startup, stage,mViewPort);
        mStarling.stage.stageWidth = stage.fullScreenWidth /  AssetFactory.contentScaleFactor;
        mStarling.stage.stageHeight = stage.fullScreenHeight / AssetFactory.contentScaleFactor;

Then I use this scale factor to determine which sized assets I need to pick.
So now, I have a background which I strech to  stage width and size. This technique works great when I'm testing with most devices but then we have devices like the Barnes and Noble Nook Color.
The device has a resolution of 600x1024 with 170 dpi. This means that it's going to pick the smallest assets (320x480) and strech it to 600x1024. Which ofcourse is pixalated. Any ideas on how to get over this issue?
I'm also attaching a test application which shows the issue in detail https://dl.dropbox.com/u/2192209/scaling%20test.zip

A: What worked for me best so far is not scaling Starling's viewport at all. It should always remain the base size (320x480).
Then you have a scale factor about how big the texture should be. It's a built feature of Starling when creating a texture - passing a scale factor.
What this means is that if your stage is 640x960, your scale factor will be 2. Your image (Bitmap object), will have ACTUAL SCREEN size of 320x480 (fullscreen, 1:1 with stage size), BUT it's texture (loaded asset BitmapData) will be twice as big (640x960, 1:1 with phone size).
For easier understanding - the stage of Starling (320x480) will be scaled up to fit your phone's resolution (320 -> 640). But your images will be scaled down to fit in the stage (640 -> 320). So you get perfectly normal images.
This helps you maintain fixed size of stage. It's really helpful, because otherwise it would be hard to position objects - if you want the object to be in the middle, it's sometimes 160, sometimes 320, etc. This means you always have to set position/size with calculations, which is an overload.
Hope that helps!
edit: Just remembered of a site I've used to determine my main size and assets ratios: http://screensiz.es/phone

A: How about setting max scale size? If the conclusion of the calculations above takes you to scale that is grater than 2, use bigger assets to reduce the scale ratio.
Your calculation only takes screenDPI in count, try combining them with screen resolution as well.


text:
Q: How can I install CPAN modules locally without root access (DynaLoader.pm line 229 error)? Doesn't work with other modules, but to give an example. I installed Text::CSV_XS with a CPAN setting:
'makepl_arg' => q[PREFIX=~/lib],

When I try running a test.pl script:

$ perl test.pl

#!/usr/bin/perl

use lib "/homes/foobar/lib/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi";

use Text::CSV_XS;

print "test";

I get

Can't load '/homes/foobar/lib/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/Text/CSV_XS/CSV_XS.so' for module Text::CSV_XS: /homes/foobar/lib/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/Text/CSV_XS/CSV_XS.so: cannot open shared object file: No such file or directory at /www/common/perl/lib/5.8.2/i686-linux/DynaLoader.pm line 229.
at test.pl line 6
Compilation failed in require at test.pl line 6.
BEGIN failed--compilation aborted at test.pl line 6.

I traced the error back to DynaLoader.pm it happens at this line:
# Many dynamic extension loading problems will appear to come from
# this section of code: XYZ failed at line 123 of DynaLoader.pm.
# Often these errors are actually occurring in the initialisation
# C code of the extension XS file. Perl reports the error as being
# in this perl code simply because this was the last perl code
# it executed.

my $libref = dl_load_file($file, $module->dl_load_flags) or
    croak("Can't load '$file' for module $module: ".dl_error());

CSV_XS.so exists in the above directory

A: When you installed the module, did you watch the output? Where did it say it installed the module? Look in lib. Do you see the next directory you expect?
Look in ~/lib to see where eveything ended up to verify that you have the right directory name in your use lib statement:
% find ~/lib -name CSV_XS.so

Once you see where it is installed, use that directory name in your use lib (or PERL5LIB or whatever).
I expect you have a lib/lib in there somehow. The PREFIX is just the, well, prefix, and the installer appends other directory portions to that base path. That includes lib, man, bin, etc.

A: Try this instead:
'makepl_arg' => q[PREFIX=~/]

PREFIX sets the base for all the directories you will be installing into  (bin, lib, and so forth.)
You may also be running into shell expansion problems with your '~'.  You can try to expand it yourself:
'makepl_arg' => q[PREFIX=/home/users/foobar]

It would also be helpful if you included the commands you used to get the error you are asking about.

A: Personally I would suggest to use local::lib. :)

A: It looks from the error message ("at /www/common ...") that your script is a CGI or mod_perl script. The web server is probably not running as the user 'foo', under whose home directory you've installed the module - that could result in the web server being unable to read that directory.
It may also be running in a "chroot jail", which would mean that the directory in which you've installed the module may not be visible to the script.
In other words, just because you can see the module, does not mean that the web server, and therefore your script, can do so. You should check the relevant file permissions, and if the server is chrooted, whether your module directory is mounted within the virtual file system.

A: Does the file in question (CSV_XS.so) exist?
Does it exist at the listed location?
If you do:
set |grep PERL

What is the output?
Have you successfully installed other local perl modules?

A: I strongly suggest installing your own perl in your own home directory, if you have space.  Then you can keep everything under your control and keep your own module set, as well as escaping if the admins are keeping you on an older version of perl.  (Not to mention preserving yourself if they upgrade some day and leave out all the modules you are relying on.)


text:
Q: Does every linear integer polynomial give a square at some integer? My question is, if you have some function
$$f(x)=nx+c$$
which accepts only integer inputs of $x$, where $n>0$ and $c$ are fixed integer constants, can you always find an $x$ such that
$$f(x)=k^2$$
where $k$ is an integer, i.e. the result is a perfect square.

A: No: all squares are equal to $0$ or $1$ modulo $3$, so $n=3$, $c=2$ is a counterexample. Indeed, you can probably find infinitely many such, since the same is true modulo $4$, and probably for larger moduli.

A: Note that if $y$ is a perfect square then $y\equiv0,1\pmod4$:

*

*$z\equiv0\pmod4 \implies z^2\equiv 0^2\equiv0\pmod4$

*$z\equiv1\pmod4 \implies z^2\equiv 1^2\equiv1\pmod4$

*$z\equiv2\pmod4 \implies z^2\equiv 2^2\equiv0\pmod4$

*$z\equiv3\pmod4 \implies z^2\equiv 3^2\equiv1\pmod4$

Therefore:
If $n\equiv0\pmod4$ and $c\equiv2,3\pmod4$ then $nx+c\equiv2,3\pmod4$ hence not a perfect square.

A: Although the question has already been answered, I would like to put my two cents with certain cases for which the answer is positive.
We are considering $n$ integer and $c$ positive integer. If
$$
f(x)=nx+c=k^2,
$$
then
$$
x=\frac{k^2-c}{n}
$$
Now, assume $c$ is a perfect square. Then,
$$
x=\frac{(k+\sqrt{c})(k-\sqrt{c})}{n},
$$
and the answer is positive, as we can observe by taking $k=n-\sqrt{c}$:
$$
x=\frac{(n-\sqrt{c}+\sqrt{c})(n-\sqrt{c}-\sqrt{c})}{n} = \frac{n(n-2\sqrt{c})}{n}=n-2\sqrt{c}.
$$
For the sake of completeness, you can check this with $n=70$, $c=25$, which yields $k=65$ and $x=60$.

A: All depend of the constants $(c,n)$. You need that $x^2-c\equiv0\space (mod\space n)$ in order to have solution. For example, for $(c,n)=(3,7)$ you have no solution and for $(c,n)=(4,7)$ you have.


text:
Q: select within 20 kilometers based on latitude/longitude i have a mysql table structured as per the example below:
POSTAL_CODE_ID|PostalCode|City|Province|ProvinceCode|CityType|Latitude|Longitude
7|A0N 2J0|Ramea|Newfoundland|NL|D|48.625599999999999|-58.9758
8|A0N 2K0|Francois|Newfoundland|NL|D|48.625599999999999|-58.9758
9|A0N 2L0|Grey River|Newfoundland|NL|D|48.625599999999999|-58.9758

now what i am trying to do is create a query that will select results within selected kilometers of a searched location
so lets say they search for "grey river" and select "find all results within 20 kilometers"
it should obviously select "grey river", but it should also select all locations within 20 kilometers of grey river based on the latitudes and longitudes.
i really have no idea how to do this. i've read up on the haversine formula but have no idea how to apply this to a mysql SELECT.
any help would be much appreciated.

A: SELECT  *
FROM    mytable m
JOIN    mytable mn
ON      ACOS(COS(RADIANS(m.latitude)) * COS(RADIANS(mn.latitude)) * COS(RADIANS(mn.longitude) - RADIANS(m.longitude)) + SIN(RADIANS(m.latitude)) * SIN(radians(mn.latitude))) <= 20 / 6371.0
WHERE   m.name = 'grey river'

If your table is MyISAM you may want to store your points in a native geometry format and create a SPATIAL index on it:
ALTER TABLE mytable ADD position POINT;

UPDATE  mytable
SET     position = POINT(latitude, longitude);

ALTER TABLE mytable MODIFY position NOT NULL;

CREATE SPATIAL INDEX sx_mytable_position ON mytable (position);

SELECT  *
FROM    mytable m
JOIN    mytable mn
ON      MBRContains
                (
                LineString
                        (
                        Point
                                (
                                X(m.position) - 0.009 * 20,
                                Y(m.position) - 0.009 * 20 / COS(RADIANS(X(m.position)))
                                ),
                        Point
                                (
                                X(m.position) + 0.009 * 20,
                                Y(m.position) + 0.009 * 20 / COS(RADIANS(X(m.position))
                                )
                        ),
                mn.position
                )
        AND ACOS(COS(RADIANS(m.latitude)) * COS(RADIANS(mn.latitude)) * COS(RADIANS(mn.longitude) - RADIANS(m.longitude)) + SIN(RADIANS(m.latitude)) * SIN(radians(mn.latitude))) <= 20 / 6371.0
WHERE   m.name = 'grey river'

A: SELECT `s`.suburb_id,`s`.suburb_name,`s`.lat,`s`.long, (((acos(sin(($lat*pi()/180)) * sin((s.lat*pi()/180))+cos(($lat*pi()/180)) * cos((s.lat*pi()/180)) * cos((($long - s.long)*pi()/180))))*180/pi())*60*1.1515*1.609344) AS distance FROM (`mst_suburbs` as s) HAVING distance <= 20 ORDER BY `s`.suburb_id DESC

This query works for me to get all the lat,long between 12 km distance.I have mst_suburbs is may table which having the lat and long column.$lat and $long are my two php variable .and I am passing the desired  lat,long to get the nearest 12km lat long list from the mst_suburb. You just need to change the name of the column according to your table and pass the lat,long to query.

A: It's a little complicated algorithm, but here's a link to one solution

A: You simply take your haversine formula and apply it like this:
SELECT   *,
         6371 * ACOS(SIN(RADIANS( $lat1 )) * SIN(RADIANS(`Latitude`)) +
         COS(RADIANS( $lat1 )) * COS(RADIANS(`Latitude`)) * COS(RADIANS(`Longitude`) -
         RADIANS( $lon1 ))) AS `distance`
FROM     `table`
WHERE    `distance` <= 20
ORDER BY `distance` ASC

Replace $lat1 and $lon1 with the latitude and longitude you want to compare against.


text:
Q: Why are the graphs of the inverses of trigonometric function incomplete For example, let's take a look at arcsin.
If I try to graph arcsin(x) in a graphing calculator. It turns out like this (Graph of arcsin(x) in GeoGebra). Shouldn't it look more like this (Graph of x=sin(y) in GeoGebra) since y=arcsin(x) is the same equation as x=sin(y)? Why does it stop like that? I comprehend that in order for an equation to be a function every point on the x-axis must have exactly one image on the y-axis, but wouldn't that just mean arcsin, arccos and arctan aren't functions?

A: Actually no, $x=\sin(y)$ is not equivalent to $y=\arcsin(x)$. Someone told you that $\arcsin$ is the inverse of $\sin$, but as you've noticed $\sin$ does not have an inverse. By definition $y=\arcsin(x)$ if and only if $x=\sin(y)$ and $-\pi/2\le y\le\pi/2$.


text:
Q: Visual Studio 2019 post-build event I need to start an external process when project debug starts.
I've wrote these lines in "Post-build event command line":
if $(ConfigurationName) == Debug (
  powershell start-process node "C:\Sviluppo\nodejs\index.js"
)

but this starts node everytime I compile the solution (in debug mode). I would like to start it only if application starts, not at compiling time.
I wouldn't like to use Process.start, if possible.

A: Since this is essentially a "pre-debug" command, you should add it to Configuration Properties > Debugging > Command. Probably easiest to have Powershell also start your $TargetPath
There's no point in the if $(ConfigurationName) == Debug test if you simply add the command to only the Configuration=Debug settings.


text:
Q: CKEditor delete Format combobox When I delete the Format combobox in toolbar, CKEditor deletes my own formatting.
I would like to use formatting as separate buttons. Is that even possible?

A: CKEditor by default has some filter rules, which prevent of having trash in output HTML.
When you add a plugin, then such plugin usually register set of rules which are necessary for its work. E.g. When you add an image plugin then <img> tags starts to be allowed in editor contents.
So when you remove formatting plugin, then most probably you also remove those filtering rules. That's why your formatting is removed from the editor. You can add your own custom rules with: extraAllowedContent.
I don't know how are you going to add separate buttons with formatting, but in case of creating your own plugin you can also register proper filter rules inside your plugin code.


text:
Q: setstate for checkboxmodal in dialog Here is an example that I used CheckBoxModal to create checkbox list in dialog box,
However, I couldn't get the immediate reflection after I clicked the checkbox button.
Here is the code
Container(
      height: 180,
      child: ListView(
          shrinkWrap: false,
          physics: NeverScrollableScrollPhysics(),
          children: [
            Wrap(
              crossAxisAlignment: WrapCrossAlignment.center,
              alignment: WrapAlignment.center,
              children: [
                ...getinstruction
                    .map(
                      (item) => Container(
                        width: 150,
                        child: StatefulBuilder(builder: (context, setState) {
                          return ListTile(
                            onTap: () {
                              onItemClicked(item);
                            },
                            leading: Checkbox(
                              value: item.value,
                              onChanged: (bool? value) {
                                onItemClicked(item);
                              },
                            ),
                            title: Text(item.title),
                          );
                        }),
                      ),
                    )
                    .toList(),
              ],
            ),
          ]),
    );

A: You need to use setState to get it to rebuild
onChanged: (bool? value) {
    setState(() => onItemClicked(item));
},

However you need to make sure that item.value is updated on onItemClicked, or within the onChanged function.
See Example from the flutter website on how this is done


text:
Q: Patching Sun Solaris Hi recently we have an application issue which requires patching of sun solaris.
Problem is that there are many zones created in this solaris server which are used by other applications.
So if it is possible that certain patches could affect the current applications.
What is the best way to handle this kind of situation?

A: If you're patching the kernel, then your patches affect everyone: there's only one copy of the kernel.
If you're patching application software, then you can apply those patches to affect only certain zones.
Have a look at the Zones FAQ.

A: The solution really depends entirely on where the problem lies and what sort of fix you're applying.  In many cases, if the problem is in the kernel, you can patch it in such a way that the patch will only apply to a process with a given flag.  If it's in a library or some such, you could have a harder time.  In short, we really need a lot more info to give you a solid answer.

A: Is the patch you need to apply timezone-related?  If not, you may be able to only apply the one patch.
Your best bet is to set up a staging system that's software-wise identical to this box, get it working, and then install your patches and test.

A: One trick I have used is to make the global "forget" about its zones. Stop the zones, get them to the "installed state", thendelete them from /etc/zones.index.xml (after taking a backup copy of that one, of course). You can now perform the upgrade, without affecting the zones. After patching and rebooting, reinstall the original index.xml and attach the zones with the -F option; otherwise they will apply the patches when attached.
But mind you, this is not a situation toy really wish to keep forever. Sooner or later you really ought to bring the zones to latest level, too.
And before I forget: this trick does not work if you have "sparse" zones.


text:
Q: Why cant AutoFac Resolve my class? I am having problems with AutoFac being able to resolve a constructor to resolve my type
I have a base type DataProviderBase
public abstract class DataProviderBase<TEntity>
  where TEntity : class, IEntity
{
  protected DataProviderBase()
  {
  }
}

This has an associated interface
public interface IDataProvider<TEntity>
    where TEntity : class, IEntity
{

}

I then have BidDataProvider that inherits from this
public class BidDataProvider : DataProviderBase<Bid>, IBidDataProvider
{
    public BidDataProvider()
    {

    }
}

This has an associated interface
public interface IBidDataProvider : IDataProvider<Bid>
{

}

In my module I register the data provider
public class LivePriceManagerModule : Module
{
    protected override void Load(ContainerBuilder builder)
    {
        builder.RegisterType<BidDataProvider>()
            .As<IBidDataProvider>()
            .SingleInstance();
    }
}

I then have an NServiceBus message handler which I need to get a BidDataProvider injected into
public class CreateBidHandler : IHandleMessages<CreateBid>
{
    private IBidDataProvider _bidDataProvider;

    public CreateBidHandler(IBidDataProvider bidDataProvider)
    {
        Argument.IsNotNull(() => bidDataProvider);

        _bidDataProvider = bidDataProvider;
    }
}

When I run my application I get the error below
Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = CreateBidHandler (ReflectionActivator), Services = [NServiceBus.IHandleMessages`1[[Inspired.TradingPlatform.Messages.Commands.CreateBid, Inspired.TradingPlatform.Messages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Inspired.TradingPlatform.LivePriceManager.Handlers.CreateBidHandler], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Inspired.TradingPlatform.LivePriceManager.Handlers.CreateBidHandler' can be invoked with the available services and parameters:
Cannot resolve parameter 'Inspired.TradingPlatform.LivePriceManager.Services.IBidDataProvider bidDataProvider' of constructor 'Void .ctor(Inspired.TradingPlatform.LivePriceManager.Services.IBidDataProvider)'. (See inner exception for details.) ---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Inspired.TradingPlatform.LivePriceManager.Handlers.CreateBidHandler' can be invoked with the available services and parameters:
Cannot resolve parameter 'Inspired.TradingPlatform.LivePriceManager.Services.IBidDataProvider bidDataProvider' of constructor 'Void .ctor(Inspired.TradingPlatform.LivePriceManager.Services.IBidDataProvider)'.
   at Autofac.Core.Activators.Reflection.ReflectionActivator.GetValidConstructorBindings(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)

Does anyone know why my constructor cannot be found?
Autofac should be able to see it as BidDataProvider does not have a constructor that needs parameters
I have tried various combinations of concrete classes and interfaces in both the registration of the type and in the handler

A: The resolution was to ensure that all of the assemblies are loaded when the application starts up.  Without this, the types are not registered properly


text:
Q: What happens to variables when are not used in a module? utils.js
const array = [1,2,3,4,5,6,7,8];

export default (props)=>{return <div>{array.map(()=>do something)}</div>}

index.js
import Comp from './utils.js';

I know that when you require a module, it remains in memory cache, so if you call it twice it, the module will not run and give you back the exported functions.
In this case we have a const variable. The exported function has a reference to variable and because the exported function remains in cache that means that the const variable remains also and is not GB. Is this right? If not what does actually happen?

A: Yes - the const variable stays, because you never set it to NULL.
This is because the closure-variables are still used when you keep a reference to them in the exported default that is cached. So the GC can never collect this variable/const (assuming the GC is not buggy).
See also what is this "require".


text:
Q: How to read draft message address , it always returns null value I am implementing sms application, I want to store all sms values into internal xml file and restore sms values from xml file into sms application, so far inbox messages and sent messages working fine but problem with draft messages.
please help me on this , thank you.

A: // Create Draft box URI
Uri draftURI = Uri.parse("content://sms/draft");

// List required columns
String[] reqCols = new String[] { "_id", "address", "body" };

// Get Content Resolver object, which will deal with Content Provider
ContentResolver cr = getContentResolver();

// Fetch Sent SMS Message from Built-in Content Provider
Cursor c = cr.query(draftURI, reqCols, null, null, null);

<uses-permission android:name="android.permission.READ_SMS"></uses-permission>

tutorial link


text:
Q: Vertical and Horizontal Recyclerview in the same layout I see a lot of apps using this layout but i never understand how to create something like this:
Recyclerview Layout
What i have to do?

*

*Create 3 recyclerview inside the same layout

*Use a main recyclerview and in adapter "inflate" the Horizontal and Vertical

*Something else?

I don't know if it's possible inflate different recyclerview(horizontal and vertical) in the same Adapter.

A: That's called a nested recycler view. you basically have a vertical recycler view in which you inflate your child recycler views and inside the child recycler views you inflate your final CardViews.
Here is a tutorial


text:
Q: How to write XPath to capture text that is not tagged I'm trying to scrap customer reviews from a site and ran into an interesting set-up.

  ReviewerName
  - yyyy-mm-dd

Review

  was this helpful links

For the life of me I can't come up with an XPath that will capture the date (- yyyy-mm-dd), as there is no HTML formatting around it. Anyone have a solution?
Jon

A: Assuming a structure like this:

    ReviewerName - yyyy-mm-dd

The following xpath selects the date yyyy-mm-dd
substring-after(/div/b/following-sibling::text()[1],' - ')


text:
Q: What are the default forecolor and backcolor of a disabled control? I checked a lot of sites in Google and I found a great number of explanations how to change the colours of a disabled control.
I was unable however to find what the standard colours of a disabled control are. I know the standard colours for enabled controls:
Color controlEnabledBackColor = SystemColors.Control; // ARGB=(255, 240, 240, 240)
Color controlEnabledForeColor = SystemColors.ControlText; // ARGB=(255, 0, 0, 0)

What I am trying to find out is:
 Color controlDisabledBackColor = SystemColors.???; // ARGB=(?, ?, ?, ?)
 Color controlDisabledForeColor = SystemColors.???; // ARGB=(?, ?, ?, ?)

the colours themselves for the disabled controls and not only their names. Please advise how I can find out in C# or where the colours for the disabled control are specified.
Thank you in advance.


text:
Q: Is it possible to get calling page name inside a jsp 2.0 custom tag? I'm writing a custom JSP tag using the JSP 2 tag files. Inside my tag I would like to know which page called the tag in order to construct URLs. Is this possible with out passing it through an attribute?

A: Turns out that the request object actually is available, but only in the EL portion of a tag. So this would work:
<form action="${pageContext.request.requestURI}">

But not this:
<form action="<%=request.requestURI%>">

Or this:
<form action="<%=pageContext.request.requestURI%>">

A: I think that within the tag code, you can examine the request object and its url, and determine the page from that.

A: It is possible to access the request from within the tag file, via the pageContext member variable.
public class YourTag extends TagSupport {
    public int doStartTag() throws JspException {
        HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
        String pathInfo = req.getPathInfo();

A: The request object is available in the tag. It doesn't matter if you use a class or a tag file. In tag files, it is available in Java scriptlets as well as in EL.
However, it is available as a ServletRequest object and not an HttpServletRequest object (in EL the class of the object doesn't matter, but it does in scriptlets).
In addition, in your scriptlets you need to access the full method, not just a property name. So your code is supposed to be:
<form action="<%= pageContext.getRequest().getRequestURI() %>">

but even that won't work because getRequestURI() is a method of HttpServletRequest [1], not of ServletRequest. So either use EL, or use longer scriptlets in your tag file and cast the request object.
[1] http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpServletRequest.html#getRequestURI()


text:
Q: How invoke state machine from aws cloud watch event? Here is example for lambda invocation by event:
EventRule:
  Type: AWS::Events::Rule
  Properties:
    Description: "EventRule"
    EventPattern:
      source:
        - "aws.ec2"
      detail-type:
        - "EC2 Instance State-change Notification"
      detail:
        state:
          - "stopping"
    State: "ENABLED"
    Targets:
      -
        Arn:
          Fn::GetAtt:
            - "LambdaFunction"
            - "Arn"
        Id: "TargetFunctionV1"
PermissionForEventsToInvokeLambda:
  Type: AWS::Lambda::Permission
  Properties:
    FunctionName:
      Ref: "LambdaFunction"
    Action: "lambda:InvokeFunction"
    Principal: "events.amazonaws.com"
    SourceArn:
      Fn::GetAtt:
        - "EventRule"
        - "Arn"

How to modify this tp be able to invoke state machine not lambda? I have replaced "LambdaFunction with "MyStateMachine"
but how modify PermissionForEventsToInvokeLambda? There is no AWS::StepFunctions::Permission in cloudformation :-(

A: Here's an snippet from the template we used to have to trigger state machine processing from an S3 event:
  InboundBucketPutObjectRule:
    Type: 'AWS::Events::Rule'
    Properties:
      Name: !Sub 'inbound-bucket-put-object-rule'
      EventPattern:
        source:
          - aws.s3
        detail-type:
          - AWS API Call via CloudTrail
        detail:
          eventSource:
            - s3.amazonaws.com
          eventName:
            - PutObject
            - CopyObject
            - CompleteMultipartUpload
          requestParameters:
            bucketName:
              - !Ref InboundBucket
      Targets:
        - Id: ProcessNewObject
          Arn: !Ref StateMachine
          RoleArn: !GetAtt
            - StateMachineStartExecutionRole
            - Arn
  StateMachineStartExecutionPolicy:
    Type: 'AWS::IAM::ManagedPolicy'
    Properties:
      ManagedPolicyName: !Sub 'state-machine-start-execution'
      Roles:
        - !Ref StateMachineStartExecutionRole
      PolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Action:
              - 'states:StartExecution'
            Resource:
              - !Ref StateMachine
  StateMachineStartExecutionRole:
    Type: 'AWS::IAM::Role'
    Properties:
      RoleName: !Sub 'state-machine-start-execution'
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service: events.amazonaws.com
            Action: 'sts:AssumeRole'
  StateMachine:
    Type: 'AWS::StepFunctions::StateMachine'
    Properties:
      StateMachineName: !Sub 'state-machine'

Taken from real template so I had to anonymize this which might have introduced errors.
Template structure:

*

*InboundBucketPutObjectRule is the CloudWatch event which gets triggered on file uploads.

*StateMachineStartExecutionPolicy + StateMachineStartExecutionRole essentially allow CloudWatch event to start execution of a state machine.

*StateMachine - the state machine which should be started (definition omitted).

I wrote above that we used to have this - but not anymore. Please see the following answer for our current solution:

https://stackoverflow.com/a/57563395/303810


text:
Q: problem in showing the map in android app I am trying to show a particular place in my android app. I have generated the Fingeprint key and submitted it to Google and got back an API key.
But still in my coding there are lot of errors, the errors mainly in the following import files
{import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MapView.LayoutParams;}

the following is the code of my app
{
public class ViewMap extends MapActivity
{
    MapView mapView;
    MapController mc;
    GeoPoint p;

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mapview);

        mapView = (MapView) findViewById(R.id.mapView);
        LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);
        View zoomView = mapView.getZoomControls();

        zoomLayout.addView(zoomView,
            new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
        mapView.displayZoomControls(true);

        mc = mapView.getController();
        String coordinates[] = {"1.352566007", "103.78921587"};
        double lat = Double.parseDouble(coordinates[0]);
        double lng = Double.parseDouble(coordinates[1]);

        p = new GeoPoint(
            (int) (lat * 1E6),
            (int) (lng * 1E6));

        mc.animateTo(p);
        mc.setZoom(17);
        mapView.invalidate();
    }

     protected boolean isRouteDisplayed()
     {
            return false;
     }
}

}

I have lot of errors inside the coding too, such as in GeoPoint, mc,MapView etc
Please help me solve this issue

A: Do you have a line like this in your manifest file?
<uses-library android:name="com.google.android.maps" />

And you may want to override the isRouteDisplayed unless your actively providing route information
You would need at least these to do much in mapview
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;

A: Did you select Google APIs for your target - refer to the image shown here

A: Is your project build target targeting Google APIs or Android APIs?
Just in case you need to know, rightclick on your project, go to Properties->Android
If you do not have Google APIs, go to Window-> Android SDK and AVD Manager-> Available Packages -> Third Party Addons and you should be able to see it


text:
Q: Converting Ant to Maven: problem with target attribute "depends" on Ant I am converting ant to maven2.
In build.xml, I have:
<target name="clean">
  <delete file="${dir.dist}/${api.jarfile}" />
  <delete dir="${dir.build}/**" />
</target>
<target name="prepare1" depends="clean">
  <mkdir dir="${dir.build}" />
  <mkdir dir="${dir.generated.code.junit}/build" />
  <mkdir dir="${dir.dist}" />
</target>
<target name="prepare2" depends="clean">
  <mkdir dir="${dir.deploy}" />
  <mkdir dir="${dir.dist}" />
</target>

I am using the maven-antrun-plugin which is working fine with the first target. However, for the second target, antrun does not support "depends". I can do a trick like: put the first target in clean-phase and the second in post-clean phase. So the second target will be run after the first target. But For the 3rd target, this trick will not work because the 3rd target should be run only after the 1st target (I don't want 2nd target run when 3rd run).
Anyway, this trick will not work because my build.xml is a big file with many targets and the relationship between them is complicated.
Is there anyway that can fix this?
Is there any thing in maven that make one task depend on another task?

A: a) Why not just throw them together? When you run ant with maven, you can't call individual targets anyway, you are binding an ant run to a maven phase. So you could do the following in the clean phase:
  <plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.4</version>
    <executions>
      <execution>
        <phase>clean</phase>
        <configuration>
          <tasks>
             <delete file="${dir.dist}/${api.jarfile}" />
             <delete dir="${dir.build}/**" />
             <mkdir dir="${dir.build}" />
             <mkdir dir="${dir.generated.code.junit}/build" />
             <mkdir dir="${dir.dist}" />
             <mkdir dir="${dir.deploy}" />
             <mkdir dir="${dir.dist}" />
          </tasks>
        </configuration>
        <goals>
          <goal>run</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

and if you need some more work in other phases, add more executions:
      </execution> <!-- end tag from above -->
      <execution>
        <phase>generate-sources</phase>
        <configuration>
          <tasks>
               <!-- some more ant tasks -->
          </tasks>
        </configuration>
        <goals>
          <goal>run</goal>
        </goals>
      </execution>

b) if you use maven, you should think like maven does. A lot of what you are doing in your ant task is default maven behavior.
In the clean phase, the clean:clean goal is executed, which deletes the target directory (and the jar along with it). If you put all of the dirs you are using underneath target (which is considered good practice in maven), maven will delete them (and create them) automatically.
Maven is all about convention:

*

*anything that is generated goes inside target

*classes and resources for the main artifact go inside target/classes

*classes and resources for testing go inside target/test-classes

*generated resources go inside target/generated-resources/yourfoldername

*generated sources go inside target/generated-sources/yourfoldername

All major plugins expect you to follow these conventions (they have defaults according to them) and using them will make maven life a lot easier.
E.g. mvn clean will ensure that you delete everything that was generated.
There are a few exceptions, plugins that have to store data in different places and therefore can't be picked up by clean:clean. These plugins usually provide alternative clean mojos (eclipse:clean and idea:clean are examples), but try not to create more exceptions.
Also, according to maven convention, nothing should be created in phase clean. There are plenty of phases to generate stuff, like generate-resources, generate-sources, generate-test-resources, generate-test-sources. Also: creating folders is usually unnecessary, all maven plugins I know create folders as needed when writing files.


text:
Q: Sorting dictionary - functools.reduce ignores negative values? I have a dictionary like below:
d = [{152: 1}, {151: 3}, {152: 4}, {153: 5}, {153: 10}, {154: -0.1}]

I want to sort them like below:
{151: 3, 152: 5, 153: 15, 154: -0.1}

I tried the below by following this answer ...
sorted = dict(functools.reduce(operator.add, map(collections.Counter, d)))

The output I got is :
{151: 3, 152: 5, 153: 15}

I do not understand why functools.reduce(operator.add, ) removes the {154: -0.1}. Isn't operator.add just a plain summation method?

operator.add(a, b)
operator.add(a, b)
Return a + b, for a and b numbers.

Questions

*

*What could be the workaround to achieve the desired output?

*Why does functools.reduce(operator.add, ) remove the negative value?

A: The Counter class is designed for positive counts so -0.1 is treated as 0 by its addition method (as would any other negative result).  You could do this using a loop and a regular dictionary (no library needed):
dicts = [{152: 1}, {151: 3}, {152: 4}, {153: 5}, {153: 10}, {154: -0.1}]

r = dict()
for d in dicts:
    r.update({k:r.get(k,0)+v for k,v in d.items()})

print(r)
{152: 5, 151: 3, 153: 15, 154: -0.1}

The documentation for Counter states that Each operation can accept inputs with signed counts, but the output will exclude results with counts of zero or less

A: A pandas solution
>>>import pandas as pd
>>>d = [{152: 1}, {151: 3}, {152: 4}, {153: 5}, {153: 10}, {154: -0.1}]
>>>pd.DataFrame(d).sum().to_dict()
{152: 5.0, 151: 3.0, 153: 15.0, 154: -0.1}

A: operator.add is a plain summation method, please see its source code: operator.add

Why does functools.reduce(operator.add, ) remove the negative value?
Your one-line code is equivalent to Counter({152: 1}) + Counter({151: 3}) + Counter({152: 4}) + Counter({153: 5}) + Counter({153: 10}) + Counter({154: -0.1})
However, the add method for Counter will remove negative values, check its source: counter-add
Thus, the value for key 154 will be ignored.

How to make your work done?
t = {}
for i in d:
    for k in i.keys():
        t[k] = t[k]+i[k] if k in t else i[k]


text:
Q: Question on one point compactification I was given the following question in my general topology class assignment which is multi parts - most of which I managed alright by myself some of which I need help on. We are given a non compact topological space $(X,\tau)$. Then we expand $X$ by a point not in $X$, call this point $\infty$ and define $X^*=X\cup\{\infty\}$ with the following topology
$$\tau^* =\tau\cup\{V\subset X^*|\infty \in V \text{ and }X\setminus V\text{ is closed and compact}\}.$$
I am given this line before the questions itself: "Denote the embedding map by $i:X\to X^*$". I do not understand this but assume they mean the inclusion map, i.e., sending every member of $X$ to itself in $X^*$. Do you think that's what is meant by embedding map? I know any map that is a homeomorphism is an embedding by definition. I think this is a clue meaning the inclusion map.
Here is the question itself in all parts I am asked to prove:

*

*Show that $ (X^*,\tau^* ) $ is a topological space. (DONE)

*Show that $i:X\to im(X)$ is a homeomorphism with $im(X)$ endowed with the subspace topology. (DONE, assuming $i$ is indeed the inclusion map.)

*Show that $im(X)$ is open and dense in $X^*$ and its complement is a singleton . (STUCK HERE)

*Show that $(X^*,\tau^*)$ is compact. (DONE)

*Assume that $(X^*,\tau^*)$ is Hausdorff. Prove the following: for any Hausdorff topological space $(X',\tau')$ and a mapping
$i':X\to X'$ such that properties 2 3 4 above hold, there exists a homeomorphism $f:X*\to X'$  such that $f\circ i=i'$. (REALLY STUCK)

The moral of this as they say is that $i$ and $X^*$ are uniquely determined up to homeomorphism.

*Show that the one-point compactification of $\mathbb{R}^n$ is homeomorphic to $\mathbb{S}^n$  by looking at the stereographic projection $s:\mathbb{S}^n\setminus (1,0,...,0)\to\mathbb{R}^n$,
$$s(x_0,x_1,...,x_n) = (x_1/(1-x_0),...,x_n/(1-x_0)).$$

We are asked to prove that its inverse is an embedding of $\mathbb{R}^n$ in $\mathbb{S}^n$ and use part 5 after verifying its conditions. (REALLY REALLY STUCK)
I realize this might be a very long question but I am hoping someone could help me on this very important question on parts I couldn't do and to tell me if $i$ is indeed the inclusion map.
Thank you all very kindly

A:

*Since $X\in\tau\subseteq\tau^*$, $X$ is open in $X^*$. For density, the only point in $X^*\setminus X$ is $\infty$. Let $V$ be an open neighbourhood (in $X^*$) of $\infty$. Then $X\setminus V$ is closed and compact in $X$, but since we know that $X$ is non compact, then $X\setminus V\neq X$, so that $V\cap X\neq\varnothing$. This proves that $X$ is dense in $X^*$. The complement of $i(X)=X$ is the singleton $\left\{\infty\right\}$/

*Note that $X^*$ is made up of two different parts: $X$ and the point $\infty$. We have to identify these parts in $X'$. It should be clear that $i'(X)$ acts as $X$, and that the remaining point in $X'$ acts as $\infty$. More precisely, let $\left\{\infty'\right\}=X'\setminus i'(X)$ (by property 3, the complement of $i'(X)$ is a singleton). Define $f:X^*\to X'$ by setting $f(x)=i'(x)$ for $x\in X$ and $f(\infty)=\infty'$.

The main problem here is to check that $f$ is continuous at $\infty$. Let $V'$ be an open neighbourhood of $\infty'$ in $X'$. Let's show that $i'(X)\setminus V'$ is closed and compact in $i'(X)$. Closedness is immediate. For compactness, let $\mathcal{U}$ be an open cover of $i'(X)\setminus V$ (in the relative topology of $i'(X)$. Then $\mathcal{U}\cup\left\{V'\right\}$ is an open cover of $X'$ (in $\tau'$), so there exists a finite subcover $\mathcal{U}'\subseteq \mathcal{U}$ such that $\mathcal{U}'\cup\left\{V'\right\}$ covers $X'$, so $\mathcal{U}'$ covers $i'(X)\setminus V$.
Since $i'$ is a homeomorphism, $X\setminus(i')^{-1}(V')$ is closed and compact. Let $V=((i')^{-1}(V'))\cup\left\{\infty\right\}$. Then $V\in \tau^*$ is an open neighbourhood of $\infty$ in $X^*$ and $f(V)\subseteq V'$.

*The inverse of the stereographic projection is the embedding of $\mathbb{R}^n$ in $\mathbb{S}^n$. The inverse of the stereographic projection (which is already continuous) is
$$i'(x_1,\ldots,x_n)=\left(\frac{-1+x_1^2+\cdots+x_n^2}{1+x_1^2+\cdots+x_n^2},\frac{2x_1}{1+x_1^2+\cdots+x_n^2},\ldots,\frac{2x_n}{1+x_1^2+\cdots+x_n^2}\right)$$
so it is also continuous. Thus, $i'$ is a homeomorphism of $\mathbb{R}^n$ onto its image, $\mathbb{S}^n\setminus(1,0,\ldots,0)$, which is open and dense in $\mathbb{S}^n$, and whose complement is the singleton $(1,0,\ldots,0)$. Moreover, $\mathbb{S}^n$ is compact. By 5., there exists an homeomorphism between $\mathbb{S}^n$ and $(\mathbb{R}^n)^*$.


text:
Q: Running hstart from MSYS I'm trying to automate some things on my computer. And here's what I ran into. I'm running this command from MSYS prompt:
hstart /elevate "cmd /k netstat -anb"

First a message box with title "Failed to create process - Hstart" appears, saying: "C:/Program Files (x86)/Git/elevate" A new non-elevated console is then opened with a message: "The requested operation requires elevation." It works as expected if run from cmd.exe. What is even happening and how to make it work?

A: It appears MSYS performs automatic paths conversion, if it's to run an executable "not dependent on msys-1.0.dll." So for it work you can double the slash:
hstart //elevate "cmd /k netstat -anb"

Here are some more links, just in case.


text:
Q: Flutter integration test - Failed to stop the app - only on iOS I am doing an integration test for my app on both simulators android and iOS
the android one finish like expected All tests passed and application stopped
but the iOS one finish testing and all Tests passed but finish with error "Failed to stop app"
my app.dart file
import 'package:flutter_driver/driver_extension.dart';
import 'package:myapp/main.dart' as app;

void main(){
  enableFlutterDriverExtension();
  app.main();
}

my app_test.dart file
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart';

void main(){
  group('Empty App',(){

    FlutterDriver? driver;

    setUpAll(() async {
      driver = await FlutterDriver.connect();
    });

    tearDownAll(() async {
      if (driver != null){
        await driver!.close();
      }
    });

    test('find widgets',() async{
      final text1 = find.byValueKey('Today');
      expect(await driver!.getText(text1),'Today');
    });
  });
}

I am using android studio on MacBook Air M1
What can I do to solve this error?
Thanks

A: See https://github.com/flutter/flutter/issues/85538 for further information. The tests exit with 0, not with an error. It seems to be still ongoing.


text:
Q: How to upvote responsibly Sometimes you just happen to read an answer in a topic in which you are not an expert in, and it sounds convincing enough, it shows careful effort and attention to details in the writing, and the author seems knowledgeable enough about the subject (see notes below), but this is simply not your area of expertise and you can't honestly say if it's correct or not.
What do you do? Do you upvote?

Note: there's a distantly related phenomenon of upvoting because of author's high rep (e.g. Upvoting based on celebrity, too many upvotes ("excessive rep slurping") and The Problem with Reputation: Does High Reputation Attract Too Many 'Up-Votes'?). This scenario is different in that while a person's rep may play a factor, it's only a supporting one.
Ultimately the perceived high quality of the answer itself is why you think it may deserve an upvote, and the problem of whether or not it's responsible for you to do it is there even if the person has a low rep.

To complicate matters, and to anticipate the arguments that votes are based on usefulness not correctness, let's say that the answer is pretty much useless for you. Perhaps it's related to an obscure language that you don't plan on picking up any time soon, or perhaps it's an area not in your career direction at the moment, etc.
...and yet you somehow saw this question/answer. Hey, these things happen.
So the answer is useless, and you don't know if it's correct or not, and yet somehow (based on subjective factors, perhaps) you think maybe it deserves an upvote. Is it responsible to do so?

A: I think you should not vote if you don't understand both the answer and what the OP is asking.
Answers must be both accurate and precise. There is a set of accurate answers that get large numbers of up votes, despite the fact that they are not precise. In other words the answer is correct in its technical details, but it doesn't answer the question.
This, I believe, happens because many people vote without careful consideration. Sometimes they vote without technical knowledge, but more often they skim the question and read to the first answer that is not a syntax error, and upvote it.
Responsible upvoting means reading and understanding the question and the answer.
This answer prompted me to write the above. The answer is correct, but doesn't really answer the question. The question isn't phrased in the clearest manner, but it can be understood. The only reason that answer got so many upvotes was that people weren't upvoting responsibly. People were just acknowledging that range() can be a useful function in PHP.
To be honest, I upvoted that answer too. It took a comment from the OP for me to realize that they probably was looking for something else  (Fair warning, that's my answer, but I think it's a legitimate illustration of this phenomenon)
So, it's really easy to upvote irresponsibly. You see a pretty answer, and you upvote it. It takes much more time to understand not just the technical details, but the context of the question. Especially since answers are often written in a clearer style than questions. There are definitely many beautiful questions on this site, but there are also many badly composed questions.
Finally, it can be said that accurate answers which are precisely NOT what the OP was asking for are still useful to someone, so they deserve an upvote, but I think the site would be much more useful and amenable to search if people, myself included, just slowed down and gave slightly more careful consideration to the upvote.

A: I vote only on topics in which I am somewhat versed and only if I think that the answer deserves more votes than it has already. If I'm in a callous mood, then I downvote answers with too many votes. I'm not very forgiving with errors or inaccuracies in answers by high ranked members. I assume that an novice member might have problems to communicate their thoughts due to a lack of experience or language barrieres (I bet many people play here to improve their communication skills), but a senior should be a role model in communication style and precision. People like me well may be the necessary counterweight to the celebrity voting the OP mentioned.

A: If the answer is primarily technical (and not architectural) you should not be upvoting without knowledge. It is entirely possible to write a programming language where 2 + 2 == 4 would come out false. Why you would do that, I don't know, but you could. So if you have no technical knowledge of the area, even intuitively correct answers could turn out to be wrong, or worse, dangerous. (Encryption anyone?)
If the question is more subjective or architectural, and well-explained, this is to say, it is so well explained that even you can understand it then yes, I would say that you could (cautiously) upvote it. Well-explained answers are nearly always helpful, even if they don't work. This is because the thought process that goes into solving a problem is often enlightening, and users who have thought out and explained (put effort into) their answers are much more likely to come back and engage the OP on the occasions that they happen to be wrong.
Bottom line: If you don't know, Don't Vote.

A: The old ethics test works here:
What would happen if everyone else behaved exactly like you?
If the answer, as it is in this case, is that the system would break, or be adversely affected, then you picked the wrong action.
Imagine there are two answers to a question:

*

*One is right, but poorly (albeit
clearly) worded.

*The other is a well-written, thoughtful, well-intentioned response that happens to be factually incorrect (or useless to the OP, which is essentially the same thing).

*Now assume that everyone who votes is like you, in that they don't know the answer, but vote for the clearly well-intentioned response, since it looks like it's probably right, and they don't know that it's not.

*None of the voters in this world vote for the right answer, since none of them know that it's right, and it doesn't reflect the same thoughtfulness as the wrong one.

The outcome is that you have a wrong (or useless) response with a ton of votes on top, a correct answer with no votes buried below, and an OP and a bunch of visitors either doing something wrong, or thinking that the site is full of know-nothings.
If you can't tell that an answer is either correct or useful, up-voting it undermines the quality of answers on the site.

A: Ask yourself - If I only had one upvote to spend during the day, would I upvote this?

A: The responsible thing to do is to never betray your own opinion with your votes.
More than just being an indicator of what is useful, your votes are an indicator of what you think is useful. If you think an answer deserves your upvote, then it does. If you are indecisive or uncomfortable because of unfamiliarity, then withhold your vote until you decide.
Upvoting what others may skip or downvote is not irresponsible unless you're actually upvoting in bad faith.

A: Check comments to the answer, and if there's no negative responses from the users who are active in the relevant tags, upvote.  Effort should be rewarded, and some domains just don't have enough people to reward good answers well enough.

A:
Sometimes you just happen to read an answer in a topic in which you are not an expert in, and it sounds convincing enough, it shows careful effort and attention to details in the writing, and the author seems knowledgeable enough about the subject (see notes below), but this is simply not your area of expertise and you can't honestly say if it's correct or not.
What do you do? Do you upvote?

Apparently, people do. For example, the accepted answer to this question has 33 upvotes, yet the main point about zero-sized arrays is completely wrong.

A: In spite of the drumbeat of encouragement to 'vote early, vote often,' I counsel erring on the side of zero.
First of all, nearly all questions deserve a zero. They present one person's particular problem in a readable form. Fine. 0. To deserve +1, they should be very well written, or manage to capture a very common problem in such a way that just reading the question will help other people navigate the space.
Of course, many questions deserve a -1, due to illiteracy, incompleteness, or presumption (plz snd me the codez).
On the answer side, a quick answer that contributes a useful fact deserves a 0. If it happens to hit the OP's problem on the head, and the OP votes it up once, well, fine. It doesn't need 2, or 27 me-too votes.


text:
Q: Area 51 "vote to delete" rejection needs re-worded If you start a proposal and realize that its not going to gain traction, naturally, you'd want to delete it.
Some proposals gain enough traction to prevent that, and the "Sorry, you can't do that" message still relates to SO:

"Sorry, this proposal cannot be
  deleted: too many existing answers. or
  upvoted/accepted answers"

While yes, it says proposal, I suggest s/answers/example\ questions/ in the notification.
Tagging this as a bug, but it isn't really, I'm just not sure what else it could be tagged. Introducing remnant-from-so-on-area51 seemed kind of silly.

A: The wording for this message has been fixed. Thanks!
As you can probably guess, we globally replaced "question" with "proposal" in the SO codebase when starting Area 51 (this worked suprisingly well). We didn't do the same with "answer" --> "example question" (everything broke) so we were left with a few bugs like this one.


text:
Q: Plethora of CMake errors about absolute and relative destinations when generating OpenCV 2.4.6 (and a bit) Having downloaded the latest OpenCV source code from github on the 26th of October 2013 I have run CMake (cmake-gui 2.8.12) to first 'Configue' and then 'Generate' the projects. Generating the build directory throws a bunch of errors, starting with Error in generation process, project files may be invalid:

The first group I think it is safe for me to ignore, they look like this:

CMake Warning (dev) in
  apps/haartraining/CMakeLists.txt:
  Policy CMP0022 is not set:
  INTERFACE_LINK_LIBRARIES defines the
  link   interface.  Run "cmake
  --help-policy CMP0022" for policy details.  Use the   cmake_policy
  command to set the policy and suppress
  this warning.
Static library target
  "opencv_haartraining_engine" has a
  INTERFACE_LINK_LIBRARIES property.
  This should be preferred as the source
  of the link interface for this
  library.  Ignoring the property and
  using   the link implementation as the
  link interface instead. This warning
  is for project developers.  Use
  -Wno-dev to suppress it.

But the last list of errors has me more worried. What are these? Should I act on them? How should I fix them?

CMake Error: install(EXPORT "OpenCVModules") given absolute DESTINATION "/lib" but the export references an installation of target "opencv_core" which has relative DESTINATION "lib".
CMake Error: install(EXPORT "OpenCVModules") given absolute DESTINATION "/lib" but the export references an installation of target "opencv_core" which has relative DESTINATION "bin".
CMake Error: install(EXPORT "OpenCVModules") given absolute DESTINATION "/lib" but the export references an installation of target "opencv_flann" which has relative DESTINATION "lib".
CMake Error: install(EXPORT "OpenCVModules") given absolute DESTINATION "/lib" but the export references an installation of target "opencv_flann" which has relative DESTINATION "bin".
[...]
CMake Error: install(EXPORT "OpenCVModules") given absolute DESTINATION "/lib" but the export references an installation of target "opencv_videostab" which has relative DESTINATION "lib".
CMake Error: install(EXPORT "OpenCVModules") given absolute DESTINATION "/lib" but the export references an installation of target "opencv_videostab" which has relative DESTINATION "bin".

========== EDIT ===========
I wonder if the problem here is that the CMake value CMAKE_USE_RELATIVE_PATHS which is present when running CMake on the code for release 2.4.6 is not present when running CMake on the latest code. If so, what is the fix?

A: I used the same situation width you, cmake 2.8.12, OpenCV 2.4.6, what i chose for the "specify the generator for this project" was VS10(I used VC10), and chose "used default native compilers" under it. but I was success at last.


text:
Q: Issue with Replace function when editing strings So currently I am trying to update an old excel file's macro codes so that we can use it with a new program. Though I am new to VB I know some C++ and Java from college so I was able to get just about everything working but this section of code. So basically, we are converting excel information to .CVS and when we do the conversion seems to give some of the information three quotation marks on either side instead of the single set like it is listed in the excel document.
To make a simple fix I just added this extra set of code to search each string for quotation marks and remove all but a single set. Instead it seems to just continue replacing sections of the entire string until there is only 1 quotation mark left...do y'all know what the issue might be?
I know this is some poorly written code especially since I havent moved on to fix the infinite loop BUT the main concern right now is just how I am misusing the Replace function.
    For X = 1 To 56
    String2 = Sheets(1).Cells(X, 1)
    Z = 1
    Do While Z <> Len(String2)
        If Mid(String2, Z, 1) = Chr(34) Then
            If Mid(String2, Z + 1, 1) = Chr(34) Then
                String2 = Replace(String2, """", "", Z, 1)
                        ' Replace(String2, Char(34) + Char(34), "", Z, 1)
                Sheets(1).Cells(X, 1) = String2
                Z = 1
            Else
                Z = Z + 1
                End If
        Else
            Z = Z + 1
            End If
    Loop
    Next

The File Information being altered:

"MH 7 to Tipton1",7.942,1,1,0.22
  4.9,1,18.8
  "SINGLE CABLE",15,206.8
  ""--""",0,0   ^^ This is a string that gets eaten by the Replace
  function after a few loops. It continues till (",0,0") Previous
  strings were not altered in operation.
  0,"""--""",0,"""H""","""--""",100,21.1
  0,"""--""",0,"""VU""","""U""",200,5.1
  5.1,"""U""",0,"""N""","""--""",0,0
  0,"""--""",0,"""H""","""--""",100,21.4
  0,"""--""",0,"""VU""","""U""",200,6.5
  0,"""--""",0,"""VD""","""U""",100,11.5
  0,"""--""",0,"""N""","""--""",0,0
  0,"""--""",0,"""VU""","""U""",100,11.5
  0,"""--""",0,"""VD""","""U""",100,11.5
  0,"""--""",23.1,"""N""","""--""",0,0
  0,"""--""",0,"""VU""","""U""",100,3.6
  0,"""--""",0,"""VD""","""U""",100,3.6
  0,"""U""",120.8,"""N""","""--""",0,0
  0,"""--""",0,"""H""","""--""",12,30.9
  "Test4.pll"

A: I cant quite tell from your question but if all you are trying to do is replace triple quotes and with single quotes then you can remove the entire do loop and just put
string2=replace(string2,"""""""","""")

inside the for loop to replace contents of the entire string rather than just each character.
So
For X = 1 To 56
    String2 = Sheets(1).Cells(X, 1).value

    String2 = Replace(String2, """""""", """")

    Sheets(1).Cells(X, 1).value = String2

Next

or even
For X = 1 To 56

    Sheets(1).Cells(X, 1).value = Replace(Sheets(1).Cells(X, 1).value, """""""", """")

Next

EDIT
You'll also want to use .value for getting the cell value


text:
Q: Polymorphism issue with instantiating sub classes I have an abstract base class Company and 2 sub classes fProfit and Nfprofit that derive from Company when I try to instantiate either of the sub classes I get the following error.
C:\Qt\Qt5.3.0\Tools\QtCreator\bin\test\nfprofit.cpp:19: error: prototype for 'QString Nfprofit::getName()' does not match any in class 'Nfprofit'
 QString Nfprofit::getName() {
         ^

C:\Qt\Qt5.3.0\Tools\QtCreator\bin\test\nfprofit.h:17: error: candidate is: virtual QString Nfprofit::getName() const
     QString getName() const;
             ^

My headers for Company and Nfprofit are below.  Any idea what I'm doing wrong?
code:
class Company {
public:
virtual QString getName() const = 0;
virtual QString getDateFormed() const = 0;
virtual QString toString() const = 0;
};

class Nfprofit : public Company
{
public:
    Nfprofit(QString name, QString date, bool charitable);

    //setters
    void setName(QString name);
    void setDateFormed(QString date);
    void setCharitableStatus(bool charitable);

    //getters
    QString getName() const;
    QString getDateFormed() const;
    QString getCharitableStatus() const;

    QString toString() const;
private:
    QString m_name, m_dateFormed;
    bool m_charitable;
};

A: This is what the error message is telling you:
Your member is a declared as const:
QString getName() const;

But your definition isn't const:
QString Nfprofit::getName() { .... }

You need to make it const:
QString Nfprofit::getName() const { .... }
                            ^^^^^


text:
Q: A nice representation for number fields Due to the primitive element theorem we can consider a number field as $\mathbf{L} = \mathbf{Q}[X]/(f)$ where $f$ is a monic polynomial in $\mathbf{Q}$.
Often the ring of integers $\mathcal{O}$ of this number field is not monogenic: there is no algebraic integer $\alpha \in \mathcal{O}$ so that its powers are a $\mathbf{Z}$-basis of $\mathcal{O}.$
I have two questions:

*

*Is there always an algebraic integer $\alpha \in \mathcal{O}$ so that its powers are a $\mathbf{Q}$-basis of $\mathbf{L}$? Ie can we always take the $f$ above to be a monic integer polynomial. (Obviously, for monogenic fields such an element exists.)

*If so, given a number field in the form above, can this element be constructed ?

A: The answer to your first question is yes: Assume $a \in L$ and let $\sum_{i=0}^n k_iX^i$ be a polynomial with root $a$, $k_n \neq 0$ and such that all the $k_i \in \mathbb{Z}$. Then, the element $k_na$ is integral because it is a root of
$$\bigg(\sum_{i=0}^{n-1}k_n^{n-1-i}k_iX^i\biggr)+X^n$$
This shows that for each $a \in L$ there is a $k \in \mathbb{Z} \setminus\{0\}$ such that $ka$ is integral. Now, apply this to the case where $a$ is a primitive element.
Answer to your second question: If you already have a primitive element $a$, the chances are good that you will be able to transform it into an integral primitive element: Just find a nonzero polynomial $f(X) \in \mathbb{Z}[X]$ with $f(a)=0$ and apply the above procedure.
(However, there is no general procedure for finding a primitive element as far as I know.)


text:
Q: Randomizer game - two semantic errors import random
print "This is a Coin War!"
coins_each = raw_input("How many coins for each player?:")
coins_each = int(coins_each)
player1 = coins_each
player2 = coins_each
possibilities = ["Heads", "Tails"]
count = 1
while player1 >= 0 and player2 >= 0:
    print "Round", count, "Player A:", player1, "Player B:", player2
    coin1 = random.choice(possibilities)
    coin2 = random.choice(possibilities)
    count = count + 1
    print "\tCoin A:", coin1
    print "\tCoin B:", coin2
    if coin1 == coin2:
        player1 = player1+1
        player2 =player2-1
        print "Same ---> A wins"
        print ("")
    else:
        player1 = player1-1
        player2= player2+1
        print "Different--->B wins",
        print ("")
    if player1 == 0:
        print "Player B wins the game"
    if player2 == 0:
        print "Player A wins the game"

Right now, I'm hitting two roadblocks. The "Player A wins the game" is printing before the last round shows. And sometimes the game doesn't terminate when one hits zero - which I'm sure has something to do with my while loop.
Both errors can be seen here:
:

A: I think you want to change
while player1 >= 0 and player2 >= 0:

to
while player1 > 0 and player2 > 0:

since you want the loop to stop if either player1 == 0 or player2 == 0.

A: I think using the condition
while player1 > 0 and player2 > 0:

will help you exit when either player wins. Also you can display the count of coins with each player after you increment/decrement their values. So when the count is decreased, it'll show 0 at which case the conditions satisfy and you'll exit the loop. At this point of time there shouldn't be anymore rounds.


text:
Q: remove table row with html5 data attribute in column I have a button that is in every row of a table. That button uses the html5 data attribute. That attribute comes from the server.

...
<button class="deletebutton" data-delete="<?php echo $result_cameras[$i]["camera_hash"]; ?>">Delete Camera</button>

...

I try to process it with that attribute in jquery:
jQuery(document).on("click", ".deletebutton", function() {
    var camerahash = jQuery(this).data("delete");
    jQuery.ajax({
       url: "index.php?option=com_cameras&task=deletecamera&camera_hash="+ camerahash +"&format=raw",
       success: function(){
            jQuery("selector here to identify tr of table using camerahash").remove();
        }
    });
});

Since I have camerahash (data attribute) already for other things it would be nice to use that to identify the table row even though but it is part of a column. But I'm not really sure what selector to use here to identify the table row for the corresponding column?
It doesn't have to be this way, but I thought this would be clean-ish.

A: You can store a reference to this in a variable ($this), and then use closest() to find which table row it belongs to in your callback.
jQuery(document).on("click", ".deletebutton", function() {
    var camerahash = jQuery(this).data("delete");
    var $this = $(this);
    jQuery.ajax({
       url: "index.php?option=com_cameras&task=deletecamera&camera_hash="+ camerahash +"&format=raw",
       success: function(){
            $this.closest('tr').remove();
        }
    });
});


text:
Q: What does "STA-ASSOC" mean? Looking at the wireless statistics on a TL-WR740N wireless router, I sometimes see the MAC address "00-20-00-A5-22-1A" connecting, with the current status being "STA-ASSOC".
The manual actually shows exactly this current status as example on page 52.
I don't know this MAC address, and it has sent packets to the router, but I haven't seen received packets yet.
The router uses WPA/WPA2 with AES as encryption, which is what it shows when my workstation connects to the router.
Does anyone know what STA-ASSOC is, and if someone have access to the router?

A: Hi I just found out what it is:
STA-ASSOC is a device that was already associate to the wi-fi router and is standing by connection (trying to connect-password changed maybe).
STA-AUTH - device awaiting authorization from router (maybe you had changed the password and the device is trying to reconnect but with the wrong password).

A: Station associated.  Not sure what device it is though.

A: 00-20-00-A5-22-1A is a Lexmark print server.

A: You can't MAC address filter such stations according to my knowledge.
PS3 and iPod tend to take on such roles especially when MAC filtered.


text:
Q: XML file with namespace doesn't load with XSLT I have the my XML file as below:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="menu.xsl" type="text/xsl" xmlns:k="Kitchen" ?>
<k:breakfast_menu>

<k:food>
<k:name>Belgian Waffles</k:name>
<k:price>$5.95</k:price>
<k:description>Two of our famous Belgian Waffles with plenty of real maple syrup</k:description>
<k:calories>650</k:calories>
</k:food>

</k:breakfast_menu>

The XSLT file is:
<?xml version="1.0" encoding="UTF-8"?>

<xsl:for-each select="k:breakfast_menu/k:food">

    <xsl:value-of select="k:name"/> -
    <xsl:value-of select="k:price"/>

    <xsl:value-of select="k:description"/>
     (<xsl:value-of select="k:calories"/> calories per serving)

</xsl:for-each>

But this doesn't load it.
I am working off an example and the original example works but it didn't use namespaces. I have added the xmlns:k="Kitchen" namespace and corresponding changes to both files but now the browser doesn't display the data.
What I really want to see is how the XSLT works when the the source XML file uses namespaces and hence my changes. Anyone can see what am I doing wrong?

A: You've added xmlns:k="Kitchen" within a processing instruction, where it has no effect. It needs to go on an element.
Nice to see someone using "simplified stylesheets" - an underused feature, in my view.