Can not reference other .net core project from unit test project

Question: I am trying to use xunit to unit test a project I have. I have created a new .Net core class Library project and referenced the other project, but the classes I want do not show up.
This is the project.json file in the test project(I know there is no xunit yet)

Resharper knows it is there, but when I press the option nothing happens.

UPDATE: Project.Json for WeatherMob
Comment: The time of .NET Core in VS2015 has passed. Move to VS2017 and you will see it's super easy.
Answer: You need to reference your main project in your test projects project dependencies.
<code>"dependencies" : {
  "NETStandard.Library" : "1.6.0",
  "WeatherMob": "1.0.0-*"
}
</code>
Also this will only work if the directory structure is correct.  Meaning the WeatherMob and Test project need to be in the same folder.
<code>  /src
    --WeatherMob
    --WeatherMobTests
</code>
Comment: I get this error when I add the reference
"One or more projects are incompatible with .NETStandard,Version=v1.6.
    One or more packages are incompatible with .NETStandard,Version=v1.6."
Comment: WeatherMob is a .net 4.5 project? Or a .net core?
Comment: .net Core project
Comment: Can you post the project.json for WeatherMob? Also it might be good to ensure all your nuget packages are at the latest.  Sometimes an old package can cause this error.
Comment: I went ahead and did it.
Comment: NETStandard1.6 most libraries are at 1.1.0 I think if you update this project that would fix the compatibility error.
Comment: Isn't that a downgrade?
Comment: No Sorry I mean like Microsoft.AspNetCore.Mvc is at 1.1.0.  If you're using VS 2015 you can right click on references and click on Manage Nuget Packages and then go to the updates tab.  It should list all available updates there.
Comment: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/132796/discussion-between-woot-and-sepehr-sobhani).


Adicionar uma classe numa div baseada na class temporaria de outra

Question: Estou utilizando o lazyload para um projeto, ele carrega imagens progressivamente.
https://github.com/verlok/lazyload
Quando as imagens estão carregando, a classe "loading" entra em atividade na tag ...
e quando termina de carregar, a classe loading é substituída pela classe "loaded"
Quero saber se seria possível adicionar uma classe numa div baseado na atividade da classe loading.
Fiz uma exemplo bastante rústico, só para demonstrar meu objetivo.
if ($('img').hasClass('loading')) {
$("body").addClass("images-is-loading");
$(".post-thumbnail").addClass("post-images-is-loading");
}

Alguém sabe como eu poderia fazer isso? Agradeço.
Comment: "adicionar uma classe numa div baseado na atividade da classe loading" - como assim ? Dê um exemplo concreto. E parece-me que isso é um [problema XY](https://pt.meta.stackoverflow.com/questions/499/o-que-%C3%A9-o-problema-xy). A sua ideia global desta solução é qual ?
Comment: Não vejo como poderia ser mais claro num caso desses, não imagino uma solução para esse problema, meu exemplo rústico foi apenas para demonstrar a situação.

veja essa demo
http://www.andreaverlicchi.eu/lazyload/demos/lazily_load_lazyLoad.html

use o inspetor do navegador, você verá que a class "loading" entra em atividade enquanto está carregando as imagens, e quando termina é substituída pela class "loaded"

o quero é adicionar uma class em outro elemento enquanto a classe loading estiver em atividade.
Comment: Mas está a tentar replicar a biblioteca de lazyloading que citou implementando à mão ? Ou quer apenas adicionar uma classe ao body se alguma imagem ainda está a carregar ? Tanto em jquery como em javascript puro tem o evento `load` que pode implementar para quando uma imagem carrega totalmente
Comment: Só quero apenas adicionar uma classe no body enquanto se alguma imagem ainda está a carregar! é apenas isso.
Comment: Eu não tenho uma ideia de como fazer isso. Por isso a pergunta. O exemplo na minha pergunta só foi para demonstrar o que preciso, não foi minha ideia de solução. Preciso adicionar uma classe no Body ou em uma div, enquanto a classe loading que aparece temporariamente enquanto as imagens estão carregando.
Answer: Você pode fazer isso contando quantas imagens não possuem a class .loaded na div. Quando todas tiverem a classe, você faz o que deseja. No exemplo abaixo reduzi a quantidade de imagens para melhor demonstração:

// lazy load plugin
var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.LazyLoad=t()}(this,function(){"use strict";var e={elements_selector:"img",container:document,threshold:300,data_src:"src",data_srcset:"srcset",class_loading:"loading",class_loaded:"loaded",class_error:"error",callback_load:null,callback_error:null,callback_set:null,callback_enter:null},t=function(e,t){return e.getAttribute("data-"+t)},n=function(e,t,n){return e.setAttribute("data-"+t,n)},r=function(e){return e.filter(function(e){return!t(e,"was-processed")})},s=function(e,t){var n,r=new e(t);try{n=new CustomEvent("LazyLoad::Initialized",{detail:{instance:r}})}catch(e){(n=document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized",!1,!1,{instance:r})}window.dispatchEvent(n)},o=function(e,n){var r=n.data_srcset,s=e.parentNode;if("PICTURE"===s.tagName)for(var o,a=0;o=s.children[a];a+=1)if("SOURCE"===o.tagName){var i=t(o,r);i&&o.setAttribute("srcset",i)}},a=function(e,n){var r=n.data_src,s=n.data_srcset,a=e.tagName,i=t(e,r);if("IMG"===a){o(e,n);var c=t(e,s);return c&&e.setAttribute("srcset",c),void(i&&e.setAttribute("src",i))}"IFRAME"!==a?i&&(e.style.backgroundImage='url("'+i+'")'):i&&e.setAttribute("src",i)},i="classList"in document.createElement("p"),c=function(e,t){i?e.classList.add(t):e.className+=(e.className?" ":"")+t},l=function(e,t){i?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},u=function(e,t){e&&e(t)},d=function(e,t,n){e.removeEventListener("load",t),e.removeEventListener("error",n)},f=function(e,t){var n=function n(s){_(s,!0,t),d(e,n,r)},r=function r(s){_(s,!1,t),d(e,n,r)};e.addEventListener("load",n),e.addEventListener("error",r)},_=function(e,t,n){var r=e.target;l(r,n.class_loading),c(r,t?n.class_loaded:n.class_error),u(t?n.callback_load:n.callback_error,r)},v=function(e,t){u(t.callback_enter,e),["IMG","IFRAME"].indexOf(e.tagName)>-1&&(f(e,t),c(e,t.class_loading)),a(e,t),n(e,"was-processed",!0),u(t.callback_set,e)},m=function(t,n){this._settings=_extends({},e,t),this._setObserver(),this.update(n)};m.prototype={_setObserver:function(){var e=this;if("IntersectionObserver"in window){var t=this._settings;this._observer=new IntersectionObserver(function(n){n.forEach(function(n){if(n.isIntersecting||n.intersectionRatio>0){var r=n.target;v(r,t),e._observer.unobserve(r)}}),e._elements=r(e._elements)},{root:t.container===document?null:t.container,rootMargin:t.threshold+"px"})}},update:function(e){var t=this,n=this._settings,s=e||n.container.querySelectorAll(n.elements_selector);this._elements=r(Array.prototype.slice.call(s)),this._observer?this._elements.forEach(function(e){t._observer.observe(e)}):(this._elements.forEach(function(e){v(e,n)}),this._elements=r(this._elements))},destroy:function(){var e=this;this._observer&&(r(this._elements).forEach(function(t){e._observer.unobserve(t)}),this._observer=null),this._elements=null,this._settings=null}};var b=window.lazyLoadOptions;return b&&function(e,t){if(t.length)for(var n,r=0;n=t[r];r+=1)s(e,n);else s(e,t)}(m,b),m});

var img_len;
(function() {
    var lazyLoadInstances = [];
    // The "lazyLazy" instance of lazyload is used (kinda improperly)
    // to check when the .horzContainer divs enter the viewport
    var lazyLazy = new LazyLoad({
        elements_selector: ".horzContainer",
        // When the .horzContainer div enters the viewport...
        callback_set: function(el) {
            // ...instantiate a new LazyLoad on it
            var oneLL = new LazyLoad({
                container: el
            });
            // Optionally push it in the lazyLoadInstances
            // array to keep track of the instances
            lazyLoadInstances.push(oneLL);
        }
    });

    $("body").addClass("images-is-loading");

    // conto a quantidade de imagens
    img_len = $(".horzContainer img").length;

})();

$(".horzContainer").on("scroll", function(){
   if($(".horzContainer img.loaded").length == img_len){
      $("body").removeClass("images-is-loading");
      alert("Todas as imagens foram carregadas");
   }
});
    html {
        box-sizing: border-box;
    }

    *,
    *:before,
    *:after {
        box-sizing: inherit;
    }

    .horzContainer {
        max-width: 100%;
        overflow: auto;
        display: flex;
    }

    .item {
        min-width: 200px;
    }

    figure {
        margin: 10px;
    }

    img {
        width: 200px;
        height: 200px;
    }

Lorem ipsum 01

Lorem ipsum 02

Lorem ipsum 03

Lorem ipsum 04

Lorem ipsum 05

Lorem ipsum 06

Lorem ipsum 07

Lorem ipsum 08

Lorem ipsum 09

Lorem ipsum 10

Lorem ipsum 11

Lorem ipsum 12

Lorem ipsum 13

Lorem ipsum 14

Lorem ipsum 15

Lorem ipsum 01

Lorem ipsum 02

Lorem ipsum 03

Lorem ipsum 04

Lorem ipsum 05

Lorem ipsum 06

Lorem ipsum 07

Lorem ipsum 08

Lorem ipsum 09

Lorem ipsum 10

Lorem ipsum 11

Lorem ipsum 12

Lorem ipsum 13

Lorem ipsum 14

Lorem ipsum 15


Why is loss treated as 0 or infinity here?

Question: I'm reading a beginner's book about deep learning and in the introduction, the following cautionary tale is written:

Now, assume that you built a classifier and trained it to predict if a mushroom is poisonous based on a photograph. Say our poison-detection classifier outputs  $\mathbb{P}(y=deathcap|image)=0.2$. In other words, the classifier is 80% confident that our mushroom is not a death cap. Still, you'd have to be a fool to eat it. That's because the certain benefit of a delicious dinner isn't worth a 20% risk of dying from it. In other words, the effect of the uncertain risk by far outweighs the benefit. Let's look at this in math. Basically, we need to compute the expected risk that we incur, i.e. we need to multiply the probability of the outcome with the benefit (or harm) associated with it:
$$L(action|x)= \mathbb{E}_{y∼p(y|x)}[loss(action,y)]$$
Hence, the loss  $L$  incurred by eating the mushroom is $L(a=eat|x)=0.2\cdot\infty+0.8\cdot0=\infty$, whereas the cost of discarding it is  $L(a=discard|x)=0.2\cdot0+0.8\cdot1=0.8$.

I am confused about why the loss calculations are framed this way. Why is the $loss$ function's range $[0, \infty)$? Could someone explain these expectation calculations?
Answer: The loss is tied in to the problem at hand. In this case, they're saying that if you live you suffer no loss and if you die you suffer infinite loss. You could choose to calculate your loss differently. Perhaps you could figure that you make \$30 per day in interest income so your "loss" if you live is -30, while you calculate that if you die now you'll have lost \$800,000 in lifetime earnings. It's up to you, but no loss and infinite loss seem reasonable for a life-and-death situation from a personal viewpoint. (Given that you will surely die if you eat a poisonous mushroom.)
What may be bothering you is the choice of 0 and infinity, because both of these numbers multiplied times anything return the same value, which render the specific likelihood values unimportant (as long as neither are zero). It doesn't matter if the likelihood of dying is 99% or 0.0001% if the loss is infinite either way.
So what this is saying is that your computer vision algorithm -- given your choice of losses -- will probably never be accurate enough for you to be willing to eat a mushroom that it says is okay.
Comment: Indeed, it seems like the choices were hyperbolic; that seems to be exactly the point, though. I appreciate the answer.


Views PDF Change Table Layout Setting

Question: I am using Views PDF Module in my project.
This module provide only limited settings for table layout i want to generate pdf according to custom design as given below:

The pdf file generated through views PDf module currently as below:

so, please tell me how to design my pdf table in Views PDF Module.
Answer: I done this before using global text field and html. Add all needed fields into view and exclude them from display. Then create an html layout using field replacement patterns according to your requirement using a Global:Text field. Then generate PDF.
Hope this helps you.
Comment: you have any working url for this or any demo link. please share
Comment: @KamalOberoi I dont have any sharable URLs. My requirement was to create  a formatted pdf with 5 images and details of content type.
Comment: it's ok. i am trying some other thing may be it's done.

Views PDF Change Table Layout Setting


changing from panel to gridview - error with layout

Question: Hey guys so where before I was hard coding the panel I wanted to display on screen with:
<asp:Panel ID="Panel1" runat="server" CssClass="PrintHeader" HorizontalAlign="Center">

                    Construction Contracts

                    317 Upper Road, Mountblock, Liverpool, Co. Such&Such BT70 6HJ

                    Invoice Number: <%: this.CurrentInvoiceName %>

                    MEASUREMENT FOR PAYMENT

                    V.A.T. No. 851 119 123

            </asp:Panel>

which produced:

I then used a GridView with boundField, to pull across the details from the table and display them on sreen..Trouble is i'm having a little difficulty with the layout.
I'm using:
<asp:GridView ID="GridView1" CssClass="PrintHeader" HorizontalAlign="Center" runat="server" Width="100px" AllowSorting="true" AutoGenerateColumns="false" DataSourceID="GridDataSource">
                <Columns>

                        <asp:BoundField DataField="id" HeaderText="InvoiceInfoID" ReadOnly="True" SortExpression="InvoiceInfoID" />
                        <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                        <asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />
                        <asp:BoundField DataField="County" HeaderText="County" SortExpression="County" />
                        <asp:BoundField DataField="Postcode" HeaderText="Postcode" SortExpression="Postcode" />
                        <asp:BoundField DataField="Invoice Number" HeaderText="Invoice Number" SortExpression="Invoice Number"/>
                        <asp:BoundField DataField="Info" HeaderText="Info" SortExpression="Info" />
                        <asp:BoundField DataField="VAT Number" HeaderText="VAT Number" SortExpression="VAT Number"/>

                                </Columns>

                                <PagerStyle CssClass="footer"/>
                                <PagerTemplate>
                                    <asp:GridViewPager runat="server" />
                                </PagerTemplate>
                                <EmptyDataTemplate>
                                    There are currently no details to display.
                                </EmptyDataTemplate>

                </asp:GridView>

                 <asp:SqlDataSource ID="GridDataSource" runat="server"
                            ConnectionString="<%$ConnectionStrings:ClarkesTest4FromMaster1ConnectionString %>"
                            SelectCommand="SELECT id, [Name], [Address], [County], [Postcode], [Invoice Number], [Info], [VAT Number] FROM [Invoice Info] ORDER BY [Name]" >
                 </asp:SqlDataSource>

and this looks like:

I would like to change the table to display as my previous layout, without the table, and each row on top of each other, not beside it, i've tried show column=false and stuff like that, also tried using a panel which cant be done,
Can anyone please advise what attribute i need to edit in order to achieve what I want?
Thank you
EDIT:
Thanks for all the replies everyone i've tried the repeater:
so:
<asp:Panel ID="Panel2" runat="server" CssClass="PrintHeader" HorizontalAlign="Center">
                        <asp:Repeater ID="InvoiceHeader" DataSourceID="GridDataSource" runat="server">
                            <ItemTemplate>
                                <asp:Label ID="Name" runat="server" Text='<%Eval("invoice_Info")%>'> </asp:Label>

                            </ItemTemplate>
                        </asp:Repeater>
                    </asp:Panel>
 <asp:SqlDataSource ID="GridDataSource" runat="server"
                            ConnectionString="<%$ConnectionStrings:ClarkesTest4FromMaster1ConnectionString %>"
                            SelectCommand="SELECT id, [Name], [Address], [County], [Postcode], [Invoice Number], [Info], [VAT Number] FROM [Invoice Info] ORDER BY [Name]" >
                 </asp:SqlDataSource>

then in code behind:
 ClarkeDBDataContext db = new ClarkeDBDataContext();

        invoice_Info =
        (from invoiceInfo in db.Invoice_Infos
         select invoiceInfo).FirstOrDefault();

        Header.DataBind();
The page displays: <%Eval("invoice_Info")%>

could someone advise where i am going wrong?
Thank ye
Comment: Have a single column inside Griview and bind the data and give the ItemStyle-HorizontalAlign="Center" for the Template Field and make the Gridview boarder to 0,hope you will be get the previous format.
Comment: Thanks for that, tried it but to no avail
Answer:  <asp:GridView ID="grdid" runat="server" AutoGenerateColumns="false" EmptyDataText="No records" ShowHeader="false">
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>

                Construction Contracts

                317 Upper Road, Mountblock, Liverpool, Co. Such&Such BT70 6HJ

                Invoice Number: <%#Eval("CurrentInvoiceName")%>

                MEASUREMENT FOR PAYMENT

                V.A.T. No. 851 119 123

                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>

Use code in this way.
Bind your grid with appropriate column values.
Answer: In place of <%Eval("invoice_Info")%> use <%#Eval("invoice_Info")%>


What is the name of the object on the strings of the violin behind the bridge

Question: I see on some violins there is something on the A and E strings between the tail peace and the bridge.
What is it called and what does it do?

I found a similar thing on the violins of the soloist in these videos.
I don't know if these are different from the picture above:
(look at 4:20):

This one is only on the D string:

Here everybody has it on their instrument, violin, viola, cello (look at 7:59):
Answer: It's a damper, or mute, like this one here
When you wish to mute the sound of the instrument you slide it near to the bridge in order to dampen the bridge vibrations.
Comment: @Tim it's only the same in that they both mute the sound.  The resulting timbre varies a lot depending on what kind of mute you use and what material (rubber vs wood) in the case of "comb" mutes.
Comment: Is that the same as the sort of comb I used to use to put on the bridge? Maybe a modern version?
Comment: The purpose is the same, but with an alternative design. I don't play the violin  myself but I have heard people complaining that this type of  mute tends to ruin the strings.
Comment: To clarify, for future visitors: 1) there are many models of violin-family mutes; 2) if they're behind the bridge, they're not currently being used and are just "stored" there, and 3) they're not always needed. Every instrument shows one in _Butterfly Lovers_ because parts of the piece call for them.
Answer: The partial mutes on one or two strings are sometimes called "wolf tone supressors"- they do reduce volume to certain or a single string. They differ from typical mutes by not muting all strings and are used generally whenever an instrument or a string and instrument combination has an uneven response (some frequencies or harmonics or overall volume of that or those particular strings is louder than needs be). The one weight on one string is speciffically set up so as to kill a higher order harmonic or to dampen a certain frequency that the particular violin has too much of...The undesired effect, akin to unpleasant resonances in certain low quality speakers (or a wolf's howl hence the name), only appears at a certain frequency and is most likely a combined effect of string gage, playing style, string material,tension etc and not necessarily a fault of the instrument; in fact, tuning an instrument to the level of fitting custom issued wolf tone supressors is no cheap or easy trick, and usually is reserved to professional top-quality instruments.


Probability when sampling from multiple urns

Question: I have the following problem:
I have 2 urns, one which contains which contains 20% red balls and another which contains 80% red balls. Each time I select (with replacement) a ball, I am blind and have an equal chance of selecting from each urn.
What is the probability of selecting a red ball?
It seems to me in the long run I should obtanin 50% red balls so it's 0.5. But this does seem misleading somehow?
Many thanks!
Comment: This looks like a homework question to me. If this is true, could you please add the [`self-study`](http://stats.stackexchange.com/tags/self-study/info) tag? Thank you. Why do you think your result is misleading?
Answer: <code>                                 /--- 80% --- Red
                             /--/
                            /---\
                           /     \--- 20% --- Carmine
                          50%
                      ---/
-_- (you blindfolded)
                      ---\
                          50%
                           \     /--- 20% --- Red
                            \---/
                             \--\
                                 \--- 80% --- Amaranth
</code>
You've got a $50\%$ chance of going up. At that point you have an $80\%$ chance of scoring Red. Good thing you're blindfolded, otherwise you might mistake Carmine for Red. Anyways, what's the probability of you following this path and hitting red?
$$
P(\text{up and red}) = 0.5 \cdot 0.8 = 0.4
$$
What about going down? Well, since you're not given the chance of mistaking Amaranth for Red (I really hope no one knows what Amaranth looks like), the math is pretty much the same.
$$
P(\text{down and red}) = 0.5 \cdot 0.2 = 0.1
$$
Since you're equally like to go both ways your probabilities add up. Thus you end up with
$$
P(\text{red}) = 0.4 + 0.1 = 0.5
$$
Save for the confusing colors and color names this should not seem too misleading. Good luck playing the game. I hope they give you good odds.
Answer: I find it quite useful to draw a tree diagram for such problems:

The numbers represent probabilities. You have select each urn with probability $0.5$. In the first urn, there are $20\%$ red balls, so the probability to draw a red ball is $0.2$. For the second urn, the probability to draw a red ball is $0.8$. The red probabilities at the end of the branches are the products of probabilities leading to these branches. The probabilities at the end of the tree have to sum to $1$. I have marked the outcomes were you draw a red ball with a blue frame. To combine probabilities across the branches of the tree, add them up. From the tree diagram it becomes obvious that your result is correct: $P(\text{Red ball})=0.1 + 0.4 = 0.5$.


Find right triangle inscribed in circle from two points on separate legs

Question: I am getting started on problem solving, and need help with the following exercise of "Solving mathematical problems, a personal perspective". The full question is as follows:
"We are given a circle and two points A and B inside the circle. If possible, construct a right-angled triangle inscribed in the circle such that one leg of the right-angled triangle contains A and the other leg contains B; see figure below. (Hint: solve for the right-angled vertex.)"

I'm not familiar with these kinds of problems, and quite frankly don't know where to start. If you can provide an answer, could you please start it off with a hint, as I don't really want to be spoon-fed all the way. Thanks!
Answer: If $C$ is the right angle vertex of a triangle that satisfies the problem statement, note that $\triangle ABC$ is also a right triangle with right angle at $C.$
Find the set of all points that can be the right-angled vertex of a right triangle whose other vertices are $A$ and $B.$
The point $C$ cannot be anywhere except in that set of points.
Of course, $C$ must also be on the given circle.
You now have two facts about $C$ which can help you to find that point.
(Note that there might be more than one choice or there might be none, depending on how the construction goes.)
Comment: Just read this, and I want to thank you. I just figured it out (I think). You are supposed to draw a circle such that $AB$ is its diameter, and the solutions are the intersections it has with the original circle. If this is correct, (otherwise please tell me), then maybe you can transform your hint into the full answer for the future.
Comment: You got it from the hint.
Comment: @DollarStoreRichard  What happens if the constructied circle is so small that there is no intersection with the given circle?
Comment: @Mick Then there's no solution. You need two points that subtend a right angle from some point on the circumference of the given circle; it's easy to place two points inside the circle that don't satisfy that requirement.
Comment: @DavidK Right. I just want to let DollarStoreRichard know that his observation is only partially correct.
Answer: Suppose the circle is of radius $R$ centered at the origin, and that point $A$ is $a$ units away from the center, and makes an angle of $\theta_1$ with the positive $x$ axis.  Similarly, point $B$ is $b$ units from the center, and makes an angle of $\theta_2$ from the positive $x$ axis.
$A = a (\cos \theta_1, \sin \theta_1 )$
$B = b (\cos \theta_2, \sin \theta_2)$
The vertex of the right angle is $V = R (\cos \phi, \sin \phi ) $
Condition is:
$(V - A ) \cdot (V - B ) = 0 $
Expanding,
$ V \cdot V - (A + B) \cdot V + A \cdot B = 0 $
This becomes,
$ R^2 - (A + B) \cdot V + A \cdot B = 0 $
Let $C = A + B$, then the last equation becomes,
$ R C_x \cos \phi + R C_y \sin \phi = R^2 + A \cdot B $
which has two solutions in $\phi$ as long as
$ \left| \dfrac{R^2 + A \cdot B }{R \sqrt{ (A + B) \cdot (A + B ) } } \right| \lt 1 $
Finally we have to find the other two vertices of the right triangle, so let point $A$ lie on $VU$, then
$U = V + t VA$
where we know that U \cdot U = R^2, therefore,
$ (V + t VA) \cdot (V + t VA) = R^2 $
But $V \cdot V = R^2$, and $t $ cannot be zero (this corresponds to $V$ itself), hence,
$ t = - 2 \dfrac{ V \cdot VA }{ VA \cdot VA } $
Finally the point $W$, such that $B$ lies on $VW$ is given by
$W = - U $
Comment: Thank you for answering, but I think this is not in the spirit of the previous problems I've been solving, as they involve more "geometrical" answer.
Comment: What is the prerequisite for the course?  First, can you find a point C that forms a right angle when drawn through A and B, that isn't on the circle?  How do you know if C is on the circle or not?  Will you be using trigonometry or is trig not a prereq of the course?


How to redirect into a specific page variant

Question: I installed panels, page manager, ctools and page manager redirect.
I made a (panel) page say foo1
- admin/structure/pages/add with variant type Panel. In this I put 5 variants named foo1variant1, foo1variant2, foo1variant3, foo1variant4, foo1variant5,
I also setup a page manager redirect say foo2:
- admin/structure/pages/add with variant type redirect.
In the end I should give the url it should go to foo1 en into foo1variant3, .
How to do this?
Answer: Variants on the same Page always have the same URL.  The variant that is shown is determined by the selection criteria.
If the selection criteria for Variant 1 fails, it moves on to Variant 2.
If the selection criteria for Variant 2 also fails, then it will try to show Variant 3.
The only exception to the 'same URL' rule is if you have optional Arguments (that start with ! instead of %) in which case you can have a url of foo and foo/bar handled by the same page.


Are distinct irreducible monic polynomials relatively prime?

Question: I'm trying to prove the statement:

Any two distinct irreducible monic polynomials are
relatively prime (coprime).

Attempt: Let $\phi_1(x)$ and $\phi_2(x)$ be two distinct irreducible polynomials. Assume they are not relatively prime. Then there exists a polynomial, $h(x)$, such that

$\phi_1(x) = h(x)h'(x) \quad \text{and} \quad \phi_2(x) = h(x)h''(x) $,

for polynomials $h'(x)$ and $h''(x)$ of appropriate degree. But this implies that $\phi_1(x)$ and $\phi_2(x)$ can be expressed as a product of two polynomials. Hence, they can't be irreducible.
Comment: I'm not too sure if the proof is correct. I haven't seemed to have used the conditions that the polynomials are both distinct and monic. What am I doing wrong?
I don't have much background in abstract algebra. I came across this thereom in an appendix on polynomials in a book on liner algebra, so I am going through it to cover the unit on minimal polynomials.
Comment: The appendix doesn't commit to a field. I think it is implicit the fields is either $\mathbb{R}$ or $\mathbb{C}$, as is the case with most linear algebra books.
Answer: Recall that constants count as polynomials - so, for example, $x^2 + 2x + 2$ can be written as $(x^2 + 2x + 2) \cdot 1$. Thus, $x^2 + 2x + 2$ and $2x^2 + 4x + 4$ aren't relatively prime, because $2x^2 + 4x + 4 = (x^2 + 2x + 2) \cdot 2$. That's where the monic condition comes in.
The distinct condition comes from the fact that if $\phi_1$ and $\phi_2$ are not distinct, then $\phi_2 = \phi_1 \cdot 1$.
Comment: So as of yet, my proof is incomplete; but the part of it that it stated is right?
Comment: @JunaidAftab Well, almost. The statement "$\phi_1(x)$ cannot be expressed as the product of two polynomials" is false; it can't be expressed as the product of two *nonconstant* polynomials. So your proof so far just shows that either $h(x)$ is a constant or both $h'(x)$ and $h''(x)$ are.
Answer: Hint $ $ If $\,p,q\,$ are irreducible then nonunit $\,d\mid p,q\,\Rightarrow\, up = d = vq\ $ for units (invertibles) $u,v,\,$ so $\, q = v^{-1}u p,\,$ so comparing lead coef's using $\,p,q\,$ monic yields $\,v^{-1}u = 1,\,$ hence $\,q = p$.
Remark $ $ The sketched proof (implicitly) uses the fact that only constants can be units, which need not hold true in rings that are not integral domains, e.g. see here. Generally factorization theory is more complicated in non-domains, e.g. $\rm\:x = (3+2x)(2-3x)\in \Bbb Z_6[x].\:$ Basic notions such as associate and irreducible bifurcate into a few inequivalent notions, e.g. see here.


Como travar a tela de fundo e permitir apenas o Scrooll no menu

Question: Eu to com um problema aqui, eu criei um menu que tem rolagem, porém quando tenho que rolar, preciso que a tela de fundo fique travada e apenas role na medida do menu... Aqui estão as fotos:

O código é o seguinte:
HTML (A partir do div="content o código se mantém igual")
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Notícias</title>

    <meta charset=UTF-8>
    <meta name=viewport content="width=device-width, initial-scale=1.0">
    <meta name=description content="Introdução à produção de sites responsivos">
    <meta name=keywords content="">
    <meta name=author content='Equipe 05'>

    <link rel="stylesheet" media="screen and (max-width:480px)" href="css/style480/menu.css">
    <link rel="stylesheet" media="screen and (max-width:480px)" href="css/style480/carrosselPagCurso.css">
    <link rel="stylesheet" media="screen and (max-width:480px)" href="css/style480/stylePagCursos480.css">
    <link rel="stylesheet" media="screen and (max-width:480px)" href="css/style480/footer480.css">

    <link rel="shortcut icon" href="imagens/fiebIVazio.png" type="image/x-icon">

                <input type="checkbox" id="check">

Home

Cursos

Unidades

Notícias

Vestibulinho

Teste Vocacional

Contato

Cadastrar

Login

CSS do Botão (Eu fiz o código do botão em css)
#check{
    display:none;
}
#icone{
    position: absolute;
    z-index: 5;
    margin-left: 63.2%;
    margin-top: 4%;
}
.barra{
    width: 100%;
    position:absolute;
    text-align:  center;
    z-index: 3;
    transition: all .2s linear;
}
#navMenu{
    width: 100%;
    position:absolute;
    visibility: hidden;
}
#navMenu a{
    text-decoration:none;
}
.link{
    background-color:#494950;
    padding: 9.4%;
    font-family:"arial";
    font-size: 18pt;
    transition: .2s ease-in-out;
    color:#f4f4f9;
    border-bottom: 2px solid #222;
    opacity:0;
}
.link:hover{
    background-color:#050542;
}

#check:checked ~ .barra #navMenu a .link{
    opacity:1;
    margin-top: 0%;
    visibility: visible;
}
label{
    width: 46px;
    float: left;
    opacity:0;
    height: 44px;
    position: relative;
    float: left;
    position: absolute;
    box-shadow:5px 2px 23px;
    transition: all 0.1s linear;
    border-radius: 50%;
    cursor: pointer;
}
label:hovert + #menu{
    opacity: 1;
}
#menu{
    width: 43px;
    float: left;
    opacity: 0.6;
    height: 43px;
    position: relative;
    background-color: #4c0c3f;
    box-shadow: 5px 2px 23px;
    transition: all 0.1s linear;
    border-radius: 50%;
    position: absolute;
    margin-left: 84%;
    z-index: 4;
    margin-top: 4%;
}
#check{
    position: absolute;
    display:none;
    z-index: 4;
}
span{
    width: 59%;
    height: 7%;
    top: 47%;
    left: 21%;
    position: absolute;
    background-color: #fff;
    transition: all 0.1 linear;
}
span:before{
    content:'';
    top: 7px;
    position: absolute;
    background-color: #fff;
    transition: all 0.1s linear;
    width: 100%;
    height: 100%;
}
span:after{
    content:'';
    bottom: 7px;
    position: absolute;
    background-color: #fff;
    transition: all 0.1s linear;
    width: 100%;
    height: 100%;
}

#check:checked + label + div > span{
    background-color: transparent;
}
#check:checked + label + div > span:after{
    transform: translate(0px, 6px) rotate(45deg);
}
#check:checked + label + div > span:before{
    transform: translate(0px, -8px) rotate(-45deg);
}
#check:checked + label + div > .tent{
    border-radius: 50%;
}

Se precisar de algo é só falar
Ps: Ja tentei colocar isso mas não deu certo:
body{
    overflow: hidden;
}
#check:checked > body{
    overflow: visible;
}

Comment: Cara mas com o código que vc postou na pergunta o menu está muito longe de estar igual ao da imagem... Na verdade ele nem está funcionando a ponto de podermos simular o seu problema para tentar uma solução...
Comment: Eu tinha dado uma diminuida no código pra facilitar a compreensão, mas não sabia que não deu certo, então agora postei o código completo do menu
Answer: Tenta colocar isso no background que você quer que fique fixado:
background-attachment: fixed;


Portamento only when gate already opened

Question: In the factory synth, Oki Computer, there is a portamento/glide knob. I would like to alter the instrument so that a new note (ie. the gate has closed) begins on it's default pitch rather than pulling the pitch from the previous note.
It looks like this would be done in the gate pitch > mono module:

or perhaps within the gate pitch > mono > glide itself:

The portamento goes away when I remove the (highlight) cable between the GI output and the Glide GI input and am thinking maybe some kind of use of a Compare module will do the trick.
Update
First of all, I realized that I can achieve the musical goal in this case simply by manually manipulating the amount of portamento with the knob, turning it down for non-legato lines. However, I aim to make sense of the wonderful answer to this question anyway.
Based on the input from answer below, I am working on building the various version of this module. The first thing I realized is that portamento happens between the pitch input and the sound generation. So it goes:
pitch input > portamento > oscillators
There's a tutorial here by Mike Huckaby, which demonstrates putting the pitch input through a 1 pole filter, and converting the low-pass output from the filter from analog to event data, while using a control (knob) to generate the input on the 1 pole filter, which might step (as in this example) by increments of 1 between -60 and 60 Hertz (mostly below the audible range).
You get something that looks like this:

So I think that perhaps for the "Monophonic Legato-Only Portamento" approach it would be inserting the "Single Trigger Gate>Separator>Hold>Selector" module, something like this, but I don't know what is coming out of the selector module, how to tell what is coming out of it, or what it is supposed to feed.

(Selector input should be around 128, not 0.)
The AllKeyGate macro from accepted answer works nicely.
Attempting now to implement the Portamento macro that implements is, including a pitch filter:

Not sure if I have all of the connections correctly from the image below:
Comment: I assume you mean that you want portamento when playing legato style and no portamento when leaving gaps between the notes? Are you using it as a monophonic or polyphonic synth?
Comment: @YourUncleBob it's monophonic. Or at least the monophonic mode of Oki Computer that I am playing with. From what you guys are saying, I am wondering if Reaktor is the wrong animal for this part.
Comment: One thing I'm curious about is, is there a term to describe `portamento when playing legato style and no portamento when leaving gaps between the notes`?
Comment: @piiperi If you build your own Single-Trigger Gate, the simple trick of temporarily setting the portamento time to zero at the start of non-legato notes seems to result in useful polyphonic legato portamento.
Comment: I deleted my comment about legato being difficult to do, because there are many different cases of monophonic and polyphonic instruments. Suffice it to say that the Single-Trigger Gate module does not work like you'd expect it to work, and you need to work around it.
Comment: The P input in the filter is pitch (MIDI note numbers), not frequency (Hz). A range of -60 to 60 corresponds to approx. 0.25 Hz to 261 Hz. You should add an OR module after the Separator so that every positive event is converted into a value 1, and set the constant for the Selector to something like 128 (because a higher filter frequency means a shorter portamento time). Btw, if you hold the mouse over a wire, the current value going through it is displayed. You can also display values in the instrument panel by attaching e.g. a Lamp to it, and setting the lamp's numerical value to "visible".
Comment: @YourUncleBob Getting back to this again after a few aborted attempts over the last few months. I plan to select your answer as "correct", once I have finally implemented it and confirmed that it works.
Answer: For a monophonic instrument, or a polyphonic instrument with the number of voices set to one, you can use simple tricks to get legato-only portamento to work. Here's one such solution, which temporarily sets the portamento time to its minimum value at the start of non-legato notes:

You start with the Single Trigger Gate module, which creates a gate signal of all keys/voices combined, which means that it doesn't send a new key-on event when playing legato. You set both its minimum and maximum output value to 1, so that every key-on event has a value of 1 whatever the velocity is.
You then use a Separator module to filter out the key-off events, and use the key-on events to trigger a Hold module with a very short time, e.g. 1 millisecond. You then use the output of the Hold module to select between the time setting for the portamento, and a constant time value (indicated in red in the image) that is low enough so that the new pitch is reached within the 1 millisecond that you've set in the Hold module.
The end result is that whenever you play a note after a gap, the portamento time is set to its minimum setting so that the pitch jumps to the new note instantly, and then the portamento time is set back to its original setting.
Depending on how the portamento module or macro is programmed, you may have to adapt the Hold module time and the alternative low time setting for the portamento to get the desired result. If you use a 1-Pole Low-Pass Filter module on the pitch signal as portamento, then a filter pitch of 128 is high enough to jump five octaves without noticeable glide. A higher filter frequency means a shorter portamento time. So that's a number that you might use for the bottom input on the Selector module (in red, above).

The method described above also works to an extent for polyphonic instruments. You can play monophonic non-legato lines without portamento, and legato lines and chords with portamento. You can also set the Hold module time to something like 100ms, and then you can play non-legato chords without portamento.
Depending on whether you set the Voice Assign in the instrument's properties to "Newest" or "Oldest", you'll get slightly different results.
There are some anomalies, e.g. when you set a long portamento and release time, play a few notes that are still changing pitch during their release phase, and then play another note, the new note will cause all the notes to suddenly jump to their final pitch. This can be fixed with the version below, which combines the Single Trigger Gate module output with each voice's own gate signal:

This still leaves some problems, caused by the Single Trigger Gate, which doesn't function as you'd expect when playing non-legato notes while holding down one or more keys. Of course, as always in Reaktor, we can just build our own, which behaves the way we want it to; combining Selective Note Gate modules, we can make a monophonic gate macro that keeps track of every key on the keyboard, independent of the instrument's polyphony:

The above macro combines twelve Selective Note Gate modules, to keep track of the keys in one octave; combining multiple of these macros gives us a complete all-key gate:

If you replace the Single Trigger Gate module by the above All-Key Gate macro in the version with the combined monophonic and polyphonic Hold modules, with a hold time of around 50 ms, you have a useful polyphonic portamento. As before, setting the instrument's Voice Assign to "oldest" or "newest" will give slightly different results.

When you use the 1-Pole Low-Pass Filter module to create portamento, there is the additional complication that the Pitch signal never quite reaches its target, and all notes are slightly flat or sharp, depending on whether the pitch gradually changed from a lower or a higher note. (In an instrument which requires exact pitches, such as an FM synth with seperate portamento settings per operator, this could be problematic; in other instruments it may be less noticeable.)
This slight pitch offset depends on the filter frequency and the note number. However, if we shift the pitches to the range 128 ~ 255 before the filter and then subtract 128 again after the filter, the offsets are the same for all notes:
Filter     Note
Pitch     Offset

  48     ±0.0004    (fast)
  36     ±0.0008
  24     ±0.0016
  12     ±0.0033
   0     ±0.0065
 -12     ±0.0131
 -24     ±0.0262
 -36     ±0.0524
 -48     ±0.1048    (slow)

Below is a portamento macro which compensates this offset, to produce precise pitches. It also incorporates the legato portamento functionality, using the All-Key Gate macro described above.

It has four inputs:

P (Pitch) in MIDI note numbers: 0 ~ 127 (polyphonic)
G (Gate) note off: 0, note on: 1 ~ 127 (polyphonic)
T (Time) portamento time: 0 ~ 127 (monophonic)
H (Hold) time in ms: 0 ~ 127 (monophonic)

When the portamento time is set to 0, the filter is bypassed, to avoid any hint of portamento. When the Hold time is set to 0, portamento is applied to every note; when Hold time is set to 1, portamento is only applied to legato notes; a higher setting, around 50 or so, allows all notes in a chord to be considered non-legato, even when the keys are not pressed at exactly the same time.
The constant value 60, which is merged with the Pitch input, provides an initial key value; the first notes you play after loading or restarting the instrument will rise or fall from this note number; it can be set to any value from 0 to 127. The constant value 43 sets the time range to approximately 0.01 ~ 10 seconds for a 5-octave glide; increase or decrease this value to have shorter or longer portamento times.
The output of the portamento macro is an audio-rate signal; for the smoothest results, don't convert it to an event-rate signal, but connect it to the F (frequency) input of oscillators (with an Exponential Pitch to Frequency conversion module between them), and connect a constant value of -276.478 (which corresponds to 0 Hz) to the oscillator's P (pitch) input. Note that other pitch modulation (pitch bend wheel, LFO, envelopes, ...) should always be added to the pitch signal after the portamento.
Comment: You deserve some kind of a medal for this stuff.
Comment: In your first example, what is the source of the `portamento` module?
Comment: @MikeiLL I deliberately didn't show the portamento macro, because this should work with any portamento module or macro that has an input for time or speed. The idea is simply to temporarily set the time to its lowest (or speed to its highest) value at the start of each non-legato note.
Comment: Is the all-key gate macro available somewhere in the NI user library? I think I considered such a contraption, but gave up on the idea after figuring out there would have to be 128 x something. My working solution used a poly-gate to single-trigger gate thingy, but IIRC its note tracking ability was limited by the polyphony in that instrument. So the actual instrument has to be "fake mono".
Comment: @piiperi I don't know; I enjoy tinkering and coming up with my own solutions, so I rarely look at the user library. Only the note number in the *selective note gate* module has to be set manually every time; the rest is just clicking *duplicate*. And a range of 12 - 108 is more than enough.
Comment: Working my way to understanding this, I have added an update to the question.
Comment: @YourUncleBob the AllKeyGate module is working very nicely. In the `portamento` module, 1. is `T` going into the `minus` as well as the `or` to it's right? 2. Is the `pitch/stpFlt` going to `up/down` as well as `+128`? 3. Is `128` going into `+` as well as `-`? Updating my question with images.
Comment: @MikeiLL 1. Yes (otherwise there'd be no point in the minus module). 2. Yes, the Step Filter output goes to the Pitch Up/Down macro, the Add module and the Selector module. 3. Indeed; you add 128 to the signal going into the filter, then subtract it again afterwards.
Comment: @YourUncleBob With the implementation in my above images, a Portamento time of `0` is producing no output whatsoever. Higher settings produce really low pitches on the keyboard and stranger intonation: a major 3rd between F and C, a major second between C and G, etc...
Comment: @MikeiLL Oops, I forgot to mention that the output of the portamento macro (P) is of course a pitch signal (i.e. a note number), so you have to run it through an Exponential Pitch to Frequency module before connecting it to the F input of an oscillator.
Comment: @YourUncleBob I should know that by now. Still not doing what I want, though. Now every key seems to generate the same frequency, which is so low it sounds like ticks when the `p` input on the oscillator is `-276.478`, and gets more tone-like around `30`.


301="Moved Permanently" curl php

Question: Colegas.
Estou a desenvolver um sistema, porem está dando esse erro no curl. Alguém sabe informar o que pode ser?
Answer: Provavelmente você precisa aceitar redirecionamentos.
Acrescente o parâmetro CURLOPT_FOLLOWLOCATION ao Curl:
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

Isso irá habilitar para seguir o header "Location:", de sua requisição, assim o Curl irá seguir o redirecionamento previsto pelo erro 301.
Você pode definir a quantidade de redirecionamentos, usando CURLOPT_MAXREDIRS junto ao Curl, por exemplo:
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);

O CURLOPT_MAXREDIRS tem a função de limitar o número de redirecionamentos, neste caso 5, mas pode ser alterado.
Você também pode usar o CURLOPT_AUTOREFERER para atualizar o "Referer:" para o último "Location:" obtido, pode ser necessário em alguns casos.

301="Moved Permanently" curl php


Which is greater: $n^{1.01} $ or $n\cdot log_{10}(n)$ ?

Question: Can someone please explain how the right side can be less than the left side? I have plugged numerous numbers into n and every time I get the left side being less than the right side. My professor is convinced the right side is less than the left side. He has a PHD in math so he should be right. I just don't understand his explanation.
$n^{1.01} < n\cdot log_{10}(n)$
$1000^{1.01} < 1000*log_{10}(1000)$
$1071.51 < 3000$
Comment: The question amounts to asking which is larger, $\sqrt[100]{n}$ or $\log(n)$. For sufficiently large $n$, what do you think?
Answer: In the race between a (positive) power and a logarithm, the power wins eventually.
So $n^{0.01} > \lg(n)$ for all sufficiently large $n$, and thus $n^{1.01} > n \lg(n)$ for those same $n$.  But how large is
"sufficiently large"?  In this case, $n > 3.8125 \times 10^{237}$ approximately.
Comment: Sir, is there any calculus trick to show that?
Comment: @Sush  Yes.  The usual method is to use L'Hospital's rule.  You can use it to show that $\ln^a(x)/x^b$ converges to $0$ as $x$ diverges to $\infty$ for any $a,b>0$.  So any power of $x$, no matter how small, eventually grows (much) larger (and faster) than any power of $\ln$, no matter how large.  As Robert's posts indicates, "eventually" can be a very long time.
Comment: @zibadawatimmy, Thanks a lot. I think it should be $\log_a(x)/x^b$, right?
Comment: How were you able to calculate $ 3.8125 \times 10^{237}$ as being "sufficiently large" enough? That number is so big I would have no idea where to start.
Comment: I think we pupils should use [Wolfram|Alpha](http://www.wolframalpha.com/input/?i=find+n+for+n%5E0.01%3Dlog+n). Note that we get two solutions for $n$, but at $n=2.746\dots$ , graph of $log (n)$ crosses graph of $n^{0.01}$ from beneath and thus after $n=3.8125 \times 10^{237}$ only, we get that $n^{1.01} > n \log(n)$. Note also that, for interval $0\leq n< 2.746\dots$,too, inequality $n^{1.01} > n \log(n)$ holds.
Comment: @Sush No, but you can change the base of the logarithm as well and everything stays true.  I meant the $a$ as a power.  So, for example, $\ln^2(x)=(\ln(x))^2$.
Comment: @zibadawatimmy, Thanks a lot. I thought that way too! beautiful and amazing mathematics.


Programmatically create a node with alias and menu item using Entity API

Question: I've seen the excellent documentation on Drupal.org about how to create a node in code, but that documentation doesn't address how to create the node's alias.  I've seen code snippets that use $node->path; and $node->menu with node_save($node); which works, but with $entity->path->set(); or with $entity->menu->set(); I'm receiving the following error message:

Unknown data property path.
  Unknown data property menu.

Why does this not work with entity api and how can I modify my code (below) to make it work?
<?php
/**
 * Testing programatic content creation.
 */
function mymodule_update_7000() {
  $about = _create_node_and_menu_item('About', 'about', 'main-menu', 'About the site');
  dpm($about);
}

/**
 * Helper function creates a node, with alias, and menu item, and
 * returns the mlid.
 * @param  string  $title      the title of the node
 * @param  string  $alias      the URL alias
 * @param  string  $menu_name  the machine name of the menu, eg 'main-menu'
 * @param  string  $menu_title the title of the menu item, if none is
 *                             provide, the $title will be used.
 * @param  integer $plid       the numeric id of the parent menu item
 *                             (defaults to 0).
 * @param  integer $uid        the numeric user id (defaults to 1)
 * @param  string  $body       the body copy to use on the node, defaults
 *                             to lorem ipsum.
 * @return Entity              the node entity object that was created.
 */
function _create_node_and_menu_item($title, $alias, $menu_name = '', $menu_title = '', $plid = 0, $uid = 1, $body = '') {
  if (!$body) {
    $body = '
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus
';
  }
  $node = entity_create('node', array(
    'type' => 'page',
    'uid' => $uid,
    'status' => 1,
    'comment' => 1,
    'promote' => 0,
  ));

  // Get a wrapper for adding meta-data.
  $entity = entity_metadata_wrapper('node', $node);
  // Using the wrapper, we do not have to worry about telling Drupal
  // what language we are using. The Entity API handles that for us.
  $entity->title->set($title);
  $entity->body->set(array('value' => $body));

  if ($alias) {
    // FIXME this line is broken :'(
    $entity->path->set(array('alias' => $alias));
  }
  if ($menu_name) {
    if (!$menu_title) {
      $menu_title = $title;
    }
    // FIXME this line is broken :'(
    $entity->menu->set(array(
      'link_title' => $menu_title,
      'menu_name' => $menu_name,
      'plid' => 0,
      'enabled' => 1,
    ));
  }
  // Save the entity and its meta-data.
  $entity->save();
  return $entity;
}

I realize there are other ways to create a path using path_save(), but this is predicated on knowing the node id first.  A valid answer here would show how to do this purely with Entity API and one call to $entity->save(). Is it possible?
Answer: I would suggest that you use the node_save() and have a $node->path set to create the desired path alias, rather than using $entity->save() because if inspect (via dpm()) the output of an entity_load() of a node, you would see nothing there related to the node's path alias.
Of course you could use $entity->save() > then fetch the node/entity id > and then use [path_save()][1] too.
Comment: @JamesWilson If you can be bothered to implement it you could get this working - it'll involve implementing [`hook_entity_property_info_alter()`](http://drupalcontrib.org/api/drupal/contributions!entity!entity.api.php/function/hook_entity_property_info_alter/7) to add the `path` property, then a custom getter and setter to handle updating the data in the path table
Comment: Thanks, after looking at entity/modules/node.info.inc  its obvious that both menu and path are not implemented, so the only real way to do this in "one single save" step, is to use `node_save()`. Drats :(
Comment: @Clive, you're right, and from the technical standpoint, that would be the real solution to this question.
Answer: For path alias you can add path alias settings to array which passes entity_create function like this:
 $node = entity_create('node', array(
'type' => 'page',
'uid' => $uid,
'status' => 1,
'comment' => 1,
'promote' => 0,
'path'=>array('alias'=>'your-path-alias',
               'pathauto' => false), //if you use module pathauto));

Same principal should work with menu item settings.
Answer: After calling $entity->save();, the newly created id should be in the entity object. You can take a look with debug($entity);. Then you use path_save().
Alternatively, use the entity_id('node, $entity); to get the id.
In order to have the entity API change the path for you, you can use hook_node_presave() and call path_save() in it.
Comment: Hmf I responded to the OP changes to many times already. Anyway the path save in database is a second query since it inserts a second record anyway.
Comment: Sorry, Wtower for updating the OP.  I should have been clearer that I was looking for a solution with one single function call and the original version did state nearly that, and Sumeet correctly interpreted what I meant. Your answers are nearly the same, except that you suggest path_save() only which i clearly stated in the OP wouldn't be a satisfactory answer. For me, the next-best solution is node_save().
Comment: No worries. The funny thing is that I had originally suggested that node_save would be best for you, but removed it since you insisted on editing the post. Why do you insist on a single function call though?


How to solve a floor equation?

Question: I am trying to solve the following equation, but I've found some difficulties.
$$\lfloor\sqrt x\rfloor=\lfloor\sqrt[3] x\rfloor\quad\quad(x\in \mathbb R)$$
Comment: All values of x belongs to this interval $ 0 \leq x < 4 $ are solution.
Comment: I assume it's floor function from the title?
Comment: What is E in this case?
Comment: instead to write  [x] I 've wrote E(x) but it s the same thing
Comment: @wuppertal so far, $0$ and $1$ are the only legitimate solutions for me...
Comment: What kind of difficulties did you have?
Comment: thank you so much for you 're particpation but dplease could you give how do you found the solution cause i didn't understand
Comment: It is better to write
$\large\left\lfloor y^{3}\right\rfloor
 =
 \left\lfloor y\right\rfloor$.
Comment: @DanielY I fail to understand your comment. What about `x=2`? (To keep things simple.)
Comment: I don't have any ideas about the methode that could help
Comment: to solve this kind of floor inequation
Comment: @Did, as I said in my comment ("so far"), that's a partial answer...Eventually mama got it write...way to go!
Comment: ok but how you could found those inervalles
Comment: tell me you're methode
Answer: If $x\lt0$, $\sqrt{x}$ is undefined hence the question makes no sense. For every $x$ in $[0,1)$, $\sqrt{x}$ and $\sqrt[3]{x}$ are both in $[0,1)$ hence $\lfloor\sqrt{x}\rfloor=\lfloor\sqrt[3]{x}\rfloor=0$.
If $x\gt1$, $\lfloor\sqrt{x}\rfloor=\lfloor\sqrt[3]{x}\rfloor$ if and only if there exists an integer $n$ such that $n\leqslant\sqrt[3]{x}\leqslant\sqrt{x}\lt n+1$. Since $x\gt1$, one knows that $n\geqslant1$. The double inequality is equivalent to $n^3\leqslant x\lt(n+1)^2$, in particular one must have $n^3\lt(n+1)^2$. For $n\geqslant1$, this means that $n=1$ or $n=2$. Thus, every $x$ such that $1^3\leqslant x\lt(1+1)^2$ or $2^3\leqslant x\lt(2+1)^2$ is a solution.
Finally, the set of solutions is $[0,4)\cup[8,9)$.
Comment: $\large\left\lfloor 0.5\right\rfloor = 0 \not= 1$.
Comment: @FelixMarin That is true. And?
Comment: @Did, you had a $1$ that was supposed to be a $0$. I fixed it. It did not infect anything else.
Comment: thank you so much that's what i was searching for . :)
Comment: You are welcome. But next time, please insert your thoughts on the question you ask. "I've found some difficulties" is definitely not informative enough.
Comment: @dfeuer Oops, me stoopid. Thanks.
Comment: @FelixMarin Thanks for pointing the typo.

How to solve a floor equation?


How to getCurrentPageNumber() in Itext 7

Question: In Itext 5, PdfWriter used to have a method called getCurrentPageNumber().
Itext 7 does not have it anymore.
How can I get the current page number since the entire pdf is going to use the same Document instance ( PdfDocument pdfDocument = new PdfDocument(writer))from start to end?
Use case: An apllication written using itext5 needs to be rewritten using itext7.
Our app generates PDF files for our customer's monthly bills.
Structure of the pdf:

Create document:
 PdfWriter writer = new PdfWriter(new FileOutputStream(filename));
 PdfDocument pdfDocument = new PdfDocument(writer);
 Document document = new Document(pdfDocument, PageSize.A4);
 document.setMargins(235, 35, 0, 38);
 buildBody(pdfData, document, writer);

For every page I use an IEventHandler for the Start and another one for the End of the pages to add some data at the Header and Footer.
 pdfDocument.addEventHandler(PdfDocumentEvent.START_PAGE, new
 StartPageHandler<>(pdfData, document, this));
 pdfDocument.addEventHandler(PdfDocumentEvent.END_PAGE, new
 EndPageHandler<>(pdfData, document, this));

3.Each IEventHandler instance has this format(except the rectangle values):
Rectangle rectangle = new Rectangle(51, 50, 500, 60); (This is for the END_PAGE)
Rectangle[] columns = new Rectangle[] {rectangle};
document.setRenderer(new ColumnDocumentRenderer(document, columns));
document.add(lineSeparatorHeader);
document.add(paragraphInfo); // information used in the Header/Footer

The buildBody(pdfData, document, writer) method (from step 1) was using the writer.getCurrentPageNumber() method in order to check if the content we wanted to add has exceeded the space on the page and has passed on another page. If it passed on another page, I would have to add some extra information (somehow as a title in the body of the page) before the rest of the content is added. (It used to work with itext5)
Comment: In iText 7 you don't necessarily have a single current page number anymore as you don't necessarily have a single `Document` (or similar) object working on your PDF anymore. Thus, please explain the context some more.
Comment: I have updated the description of the problem. Any documentation links that explain how  paging  and  layouts work  in itext7 are highly appreciated.
Comment: Do I understand your item 4 correctly that the `buildBody` method used to call `getCurrentPageNumber` itself? I.e. not some event listener as described in item 2 and 3 but `buildBody` itself? In that case I assume the presence of the event listeners is irrelevant, isn't it? I'll write an answer under that assumption.
Comment: Yes. buildBody() used to call getCurrentPageNumber() itself. The presence of the listener is not irelevant since it is used for the generation of the HEADER and of the FOOTER on every new page. The buildBody() method does not have anything to do with the FOOTER and the HEADER. It only must generate content for inbetween HEADER and FOOTER
Comment: *"The presence of the listener is not irelevant"* - then how does it influence the `getCurrentPageNumber()` call in `buildBody()`?
Comment: When you said: "In that case I assume the presence of the event listeners is irrelevant, isn't it? ", it makes me think of irrelevant in the entire context. The presence of the IEventListener is irelevant for the buildBody() method, BUT it is relevant for the HEADER and the FOOTER of every page. I think this is just a communication missunderstanding.
Answer: Considering that the code you want to port apparently used the iText 5 PdfDocument/PdfWriter pattern, the current page number in that code always was the currently last page number, i.e. the current number of pages in the document being created.
In iText 7 these numbers are not automatically the same; if you port the code keeping the general architecture, though, those numbers most likely will remain the same in your iText 7 code, too.
In iText 7 you can get the current number of pages from the PdfDocument in question:
PdfDocument pdfDocument = ...;
...
int currentNamberOfPages = pdfDocument.getNumberOfPages();

Currently your buildBody method signature does not include the PdfDocument (which made sense in iText 5). For iText 7 you should consider changing the signature to include the PdfDocument. Most likely, though, you won't need the PdfWriter anymore which you then can exclude.
If you need to keep that method signature for some obscure reason, you can retrieve the PdfDocument from the Document using the getPdfDocument method.
Comment: You are right. Since I am using the same Document instance from start to end, pdfDocument.getNumberOfPages() returns the page I am currently working on. Thank you!


Bootstrap with replacement with small number of repetitions

Question: In this youtube video about bootstrap resampling, the creator states that when the number of bootstrap processes is small, the distribution of the parameter being estimated can no longer be thought to have a normal distribution (see from the 8:50 mark).
Since the parameter's distribution is not normal, the standard deviation can't be obtained via the standard formula:

The author thus states that one needs to use the CDF to calculate where the 68% confidence interval values are and obtain from there an estimation of the standard deviation.
My question is: where can I get a source for this workaround for obtaining the standard deviation when the number of times the bootstrap process is repeated is small?

I'm interested in this because I'm using bootstrap with replacement to estimate the uncertainty of a parameter and I can't possibly repeat it thousands of times (not even dozens actually) because it would be impossibly time consuming.
Comment: "always" is a big word, but looking at the percentiles (with possible adjustments) for computing confidence intervals fits more naturally within the logic of the bootstrap.
Comment: In many case the whole point of using the bootstrap is that the sampling distribution of the statistic is unknown, so in general I would not expect that distribution to be normal (Gaussian) even with a large number of bootstrap replications.
Comment: @MaartenBuis so are you saying one should always use the CDF method to calculate the uncertainty?
Comment: from what I heard, isn't the bootstrap generally supposed to be done with replacement though?
Answer: A few reactions that are too long for a comment:
Don't ask us for sources of what somebody claimed on youtube. Ask the creator of the video. The idea of using the normal quantiles to estimate the scale of the distribution obviously comes from robust statistics, and my vague recollection is that it may be due to Tukey. Note that with 20 bootstrap replicates, the 68% confidence interval is going to be far more lousy that the estimate of $s$ that you would get from the standard formula.
The formula for $s^2$ provides an unbiased estimator no matter whether the underlying distribution is normal or not (but it has to have the second moment, of course). What the normality affects is whether that $s^2$ (scaled by $\sigma^2$) will have a $\chi^2$ distribution (and hence the ratios with $s$ in the denominator will have a true $t$-distribution), but unless something really crazy is going on, the $t$-distributions are remarkably robust to non-normality.
To improve performance of the bootstrap with small number of replicates, one can consider balanced schemes that allows one to produce exactly the same estimates of variance that the complete perfect bootstrap would. Most people are just used to Monte Carlo versions of the bootstrap, so their hair may stand up on their heads when they would hear about deterministic bootstrap, but one should not forget that the distant goal is the complete bootstrap, and whatever gets us closer to it is helpful.


Factorization of polynomials

Question: Prove that $x^m  + \alpha^m$  is not divisible by $x-\alpha$.
I tried it using the principle of mathematical induction but wasn't able to do it.
Comment: [https://en.wikipedia.org/wiki/Factor_theorem](https://en.wikipedia.org/wiki/Factor_theorem)
Answer: Note that $x^m - \alpha^m$ is divisible by $x - \alpha$. If $x^m + \alpha^m$ were too, then  $x^m$ would be also. But $x-\alpha$ does not divide $x^m$ unless $\alpha = 0$.
Answer: Assuming your polynomials have coefficients on a field. Divisibility of $f(x)$ by $x-\alpha$ implies $\alpha$ is a root of $f(x)$. But $\alpha^m+\alpha^m\neq 0$ unless $\alpha=0$.
Answer: Hint: For all polynomials $f$, we have $f(x)=(x-\alpha)q(x)+f(\alpha)$. Now take $f(x)=x^m + \alpha^m$.
Answer: $P$ and $Q$ are arbitrary functions, and $a$ is an arbitrary real number. We write $P(x)$ like this:
$$P(x) = Q(x - a) * (x - a) + R(a)$$
Here $R(x)$ is just $P(x) mod (x - a)$. So if we calculate $P(a)$, we have:
$P(a) = Q(0) * 0 + R(a) = R(a)$
So $P(a)$ is the remainder. So if we want to calculate the remainder of the division: $\frac{x^m + \alpha ^ m}{x-\alpha}$, we put $x=\alpha$ then we get:
$2 * \alpha^m$
So the remainder is not always zero (since $\alpha$ is not necessarily zero). So it is not divisible.

Factorization of polynomials


wkhtmltopdf (with pdfkit) installed on Ubuntu but not working in Rails

Question: I've done hours of research trying to get PDFKit to work in my production environment. Everything works fine in development, and "kind of" works on my production server.

I'm running 64bit Ubuntu server with Nginx/Passenger.
I can successfully create a pdf from my web root using wkhtmltopdf google.com public/test5.pdf -- so I know that wkhtmltopdf is installed and working
I can successfully create a PDF using PDFKit using rails console where i can run kit = PDFKit.new('http://google.com') then file = kit.to_file('public/test.pdf') -- so at least in rails console I know that PDFKit is able to run successfully

But, this just isn't working on the actual website. When I visit the URL (which works in development mode) http://staging.myapp.com/tours/5/print_tour.pdf I get the "We're sorry but something went wrong" error. My Passenger error log only shows this:

Rack: /home/deploy/myapp/current: No such file or directory - bundle exec which wkhtmltopdf
But, I can run bundle exec which wkhtmltopdf fine from my web root?

I'm stumped as wkhtmltopdf runs fine from the command line, as does PDFKit in rails console, but somehow something breaks when serving the page from Nginx/Passenger. Help! :-)
Comment: I've installed wkhtmltopdf using steps similar to this--it installs fine but doesn't fix the issue I have. http://wingdspur.com/2012/12/installing-wkhtmltopdf-on-ubuntu/
Comment: `wkhtmltopdf`  started under `xvfb` mode right
Comment: @Viren I'm unsure how to tell if it's being run in xvfb mode? Do you know how I can tell? And what this means as far as running wkhtmltopdf? What I can say is that wkhtmltopdf runs fine from the command line when in the root rails directory. thanks!
Answer: What path does which wkhtmltopdf return and is it different than the path in your development environment?
PDFkit expects wkhtmlpdf to be in /usr/local/bin so if you haven't installed the wkhtmlpdf binary to that location, make sure you specified the path in an initializer like so:
# config/initializers/pdfkit.rb
PDFKit.configure do |config|
  config.wkhtmltopdf = '/path/to/wkhtmltopdf'
  # config.root_url = "http://staging.myapp.com" # Use only if your external hostname is unavailable on the server.
end

If your problem isn't related to PDFkit trying to call wkhtmltopdf from the wrong path on the server, have you tried seeing if another gem like wicked_pdf is able to use wkhtmltopdf properly?
Comment: I got this working and not sure what exactly what was going on. The problem was that there were several issues so it was confusing to decipher. First, @wingdspur, for some reason my installation is using 'usr/bin/wkhtmltopdf` instead of `/usr/local/bin/wkhtmltopdf` but i just created a simlink so the "real" executable is in usr/local. Second, even when the executable was found I needed to apply an override by creating an initializer file--follow this link for details: https://github.com/pdfkit/pdfkit/issues/82 . Third was that I needed to look at the correct log files in /log/ dir to see error


An English reference for convolution construction of heat kernel

Question: Could someone please point me to an English reference for the construction of the heat kernel on a compact manifold using the method of convolution, as described in the book of Berger, Gauduchon and Mazet (which is in French)?
This book is already quite detailed, but I am having trouble deriving, for example, Lemme E.III.7 (the $C^l$ statement in particular), so it would be nice to see another treatment of this.
Cheers.
Answer: One possible reference would be Steven Rosenberg's "The Laplacian on a Riemannian Manifold", chapter 3, which develops the same method. For non-compact manifolds admitting an action of certain groups with compact quotient, you could see Donnelly's 1979 paper. The first part of this paper essentially adapts the original argument to the cocompact setting with very few changes in technique. See https://projecteuclid.org/euclid.ijm/1256048110.
Another reference for the original construction could be http://www.math.mcgill.ca/toth/spectral%20geometry.pdf.


Give an example of $f$ that is $C^\infty$, $\int_0^\infty f(t)dt$ converges but $f$ does not converge.

Question: Today, my teacher asked about a real function that was integrable, but such that $\displaystyle\lim_{t\to \infty}f(t)\neq 0$ ($f$ need not have a limit).
It's easy to forge an example: a function that has tightening spikes each with areas $1/n^2$ does the trick.

He then asked for a real $C^\infty$ function that was integrable, but such that $\displaystyle\lim_{t\to \infty}f(t)\neq 0$ ($f$ need not have a limit).

One heuristic argument is to take the previous function and "smoothen" the spikes. However, he referred to a nicer function that can be defined explicitely.
Do you have an idea ? I've looked for something involving $\sin,\cos,\tan$
Comment: Are you familiar with standard bump functions? See http://en.wikipedia.org/wiki/Bump_function
Comment: @SamDeHority Yes, what do you plan on doing with them ?
Comment: Does "integrable" refer to Riemann or Lebesgue?
Comment: @DanielFischer Riemann I guess ($\int_0^\infty f(t)$ converges)
Comment: In that case, cnick's answer gives an explicit example.
Answer: why not something like $f(x) = \sin(x^2)$?  It has to oscillate faster as you go towards infinity so that it adds/subtracts less and less area each time in order for the integral to converge.
Comment: Right. You should add this reference in your answer http://math.stackexchange.com/questions/279540/how-to-show-that-int-0-infty-sinx2-dx-converges?rq=1
Answer: HINT: Try to construct "smooth mountains" by using the Cauchy function
$$h:x\mapsto \begin{cases}
e^{-\frac{1}{x}} &\text{if }x>0\\
0&\text{if }x\leq 0
\end{cases}$$
which is very useful for constructing $C^\infty$ functions with that kind of properties.


Como criar nomes de variáveis durante a execução de um código?

Question: Preciso de uma pequena ajuda.
Durante a execução de um código eu obtenho uma lista com x entradas (o tamanho da lista varia de acordo com o input). Cada entrada dessa lista é um array linha com um certo numero de elementos, não necessariamente iguais entre si.
Para facilitar o acesso durante o resto do código, eu gostaria de nomear cada entrada dessa lista como uma variável no seguinte esquema:
lista[0] = cD_x

lista[1] = cA_x

lista[2] = cA_(x-1)

lista[3] = cA_(x-2)

...

lista[x] = cA_1

Como x varia a cada execução não tenho ideia de como fazer isso.
Alguem pode me dar uma ajuda, por favor?
Comment: Tem como explicar por quê acessar uma variável criada dinamicamente será melhor que acessar o índice de uma lista?
Answer: Você não precisa necessariamente identificar os arrays, e provavelmente nem deva fazê-lo, já que são dinâmicos. Veja o exemplo:
tudo = [];

# Adicionando listas sem identificador em "tudo"
tudo.append([1, 2, 3, 4, 5, 6])
tudo.append(['banana', 'laranja', 'manga'])
tudo.append([0.456, 2.56, 0.0000004, 0.223, 33.33333])
tudo.append([True, True, False, True, False, False])

# A menos que você queira explicitamente identificar algo
# Aqui um lista tem o nome "especial"
especial = [4, 'Moscou', 32, 'Severino Raimundo', 0.5]
tudo.append(especial)

# E agora eis uma das formas de percorrer tudo o que existe
for lista in tudo:
    print()
    for elemento in lista:
        print(str(elemento))

# Podemos nos referir as listas por índice também
# Nesse caso você tem um "i" e um "j" nos quais "se agarrar"
for i in range(len(tudo)):
    print()
    print('LISTA ' + str(i) + ':')
    for j in range(len(tudo[i])):
        print('index[' + str(j) + '] = ' + str(tudo[i][j]))

Reescrita do segundo laço de acordo com a sugestão do Anderson Carlos Woss:
# Podemos nos referir as listas por índice também
# Nesse caso você tem um "i" e um "j" nos quais "se agarrar"
for i, lista in enumerate(tudo):
    print()
    print('LISTA ' + str(i) + ':')
    for j, elemento in enumerate(lista):
        print('index[' + str(j) + '] = ' + str(elemento))

Comment: @AndersonCarlosWoss Editei a resposta inserindo sua sugestão.


Is there any workaround to invert the color of svg icons in IE?

Question: I am passing the following URL to an imageUrl property:
'{!URLFOR($Asset.slds, "assets/icons/utility/expand.svg")}'

due to already having these svg icons. I then invert them because they come through as white when they are not used in svg tags:
.k-tabstrip-items .k-item .k-image {
        width: 30px;
        margin-left: 1%;
        margin-top: -10px;
        -webkit-filter: invert(100%);
        -moz-filter: invert(100%);
        -ms-filter: invert(100%);
        -o-filter: invert(100%);
    }

    .k-tabstrip-items .k-item .k-state-active .k-image {
        -webkit-filter: invert(0%);
        -moz-filter: invert(0%);
        -ms-filter: invert(0%);
        -o-filter: invert(0%);
    }

However, this of course does not work in IE, neither does image masking... Is there some workaround to make these icons black in IE? I am struggling to find a workable solution (if there really is one). It could be that it will just require having black colored icons... But wanted to check if there was something I could do with CSS to get this work.
Answer: You can change the fill color from a svg:
Html:
<svg enable-background="new 0 0 56.693 56.693" height="56.693px" id="Layer_1" version="1.1" viewBox="0 0 56.693 56.693" width="56.693px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <g>
    <path d="M30.071,27.101v-0.077c-0.016,0.026-0.033,0.052-0.05,0.077H30.071z"/>
    <path id="linkedin" fill="#000" d="M49.265,4.667H7.145c-2.016,0-3.651,1.596-3.651,3.563v42.613c0,1.966,1.635,3.562,3.651,3.562h42.12   c2.019,0,3.654-1.597,3.654-3.562V8.23C52.919,6.262,51.283,4.667,49.265,4.667z M18.475,46.304h-7.465V23.845h7.465V46.304z    M14.743,20.777h-0.05c-2.504,0-4.124-1.725-4.124-3.88c0-2.203,1.67-3.88,4.223-3.88c2.554,0,4.125,1.677,4.175,3.88   C18.967,19.052,17.345,20.777,14.743,20.777z M45.394,46.304h-7.465V34.286c0-3.018-1.08-5.078-3.781-5.078   c-2.062,0-3.29,1.389-3.831,2.731c-0.197,0.479-0.245,1.149-0.245,1.821v12.543h-7.465c0,0,0.098-20.354,0-22.459h7.465v3.179   c0.992-1.53,2.766-3.709,6.729-3.709c4.911,0,8.594,3.211,8.594,10.11V46.304z"/>
  </g>
</svg>

Css:
svg #linkedin {
  fill: red; //or #ff0000
}

In the svg the path must have the id "linkedin" to change color
<path id="linkedin" fill="#000" d="M49.265,[...],10.11V46.304z"/>

Copy of a previous answer from me
Comment: just flag as a dupliate if that's what you think it is.


Validar um QLineEdit para só pegar Double

Question: Estou usando o QDoubleValidator data = new QDoubleValidator(0.00, 1000.00, 2, lineEdit);
Porém na hora de inserir o valor real no campo da lineEdit ele não recorre o ponto (.) como separador decimal e sim vírgula (,).
Isso ocasiona problemas na hora de pegar o valor digitado no campo porque o programa não pega nenhum valor com número usando vírgulas.
Como resolver esse problema deixando o ponto (.) como separador decimal?
Answer: Você precisa definir o locale do QDoubleValidator:
auto validator = new QDoubleValidator(0, 1000.00, 2, lineEdit);
validator->setLocale(QLocale("pt_BR"));
lineEdit->setValidator(validator);

Observe que, por padrão, o Qt usa o locale do sistema. Se você usar o código acima pra fixar o locale, seu programa vai deixar de obedecer às preferências do usuário.