text:
Q: what is the iPad mini screen resolution or frame size? Interviewer ask me about resolution  or bounds of ipad mini? is it same as Ipad 2?
Or what is the exact answer for this ?

A: Yes, it has the same resolution as the iPad 2 and original iPad, 1024 x 768.

A: If you need in terms of frame/bounds then :
CGFloat width = [UIScreen mainScreen].bounds.size.width;

A: screen resolution for IPAD mini is 1,024×768


text:
Q: Silverlight website sometimes showing a blank window while navigating I have a silverlight application with multiple pages which are being navigated to within a frame control. However there is this one page, while navigating to, suddenly makes the window go blank, which gives me no choice, but to refresh the application. This only occurs rarely, but I would like to know the reason for it and if it could be stopped.

A: (sorry for my bad english)
Probably there is some exception happening. On your App.xaml.cs, put a breakpoint on the Application_UnhandledException method and see if it is being called when you navigate to the page. If it is, e.ExceptionObject contains the exception that is causing this problem.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Error installing openstack on centos In order to setup openstack using centos 7 with virtualbox, i got the following error while running packstack --allinone
Pre installing Puppet and discovering hosts' details[ ERROR ]

ERROR : Failed to run remote script, stdout:
stderr: Warning: Permanently added '192.168.56.24' (ECDSA) to the list of known hosts.
+ trap t ERR
+ facter -p
++ t
++ exit 12

I have only one host : 192.168.56.24 (where i run the installation)
Any ideas ?

A: One way of solving this is to edit ~/.ssh/config
and add:
Host 192.168.0.*
    StrictHostKeyChecking no
    UserKnownHostsFile=/dev/null

This link should also be very useful even though it is on ubuntu: https://askubuntu.com/questions/87449/how-to-disable-strict-host-key-checking-in-ssh


text:
Q: Parameter of a method nested in a lambda expression changing when invoked I have the following, which runs at the initialization of a node graph system for every ports of a node;
    private void Initialize()
    {
        // stats.Length return 3;
        for (int i = 0; i < stats.Length; i++)
            stats[i].Initialize(this, () => GetStats(i));
    }

    private void GetStats(int index)
    {
        // Issue; index returns 3
    }

If I print the i in the for loop, I get 0, 1, 2 as expected when I have 3 items.
Somehow, if I print index in GetStats, I get 3.
I'm just at lost here, how is a value-type parameter in a method nested in a lambda can change value? Am I doing something stupid?


text:
Q: Web GUI Merge Requests Failing after Gitlab Update to 6.6.4 I ran the updates from 5.4 to 6.6.4 to our system and now merge requests in the web gui do not work.  All the checks in gitlab pass and the application is configured correctly - all green lights in the checks.
At first we were getting the endlessly spinning "Checking for ability to automatically merge…" status.  Clearing the gitlab-satellites folder resolved that issue.
Now, we get the box to "accept merge request"  and it appears that the merge goes through but, it does not.
Any ideas on what is going on and how to fix it?
Thanks
System information
System:     Ubuntu 12.04
Current User:   git
Using RVM:  no
Ruby Version:   2.0.0p247
Gem Version:    2.0.3
Bundler Version:1.3.5
Rake Version:   10.1.1


text:
Q: How to I pass data from a top level route to inner routes in React? I have a react application that has routes configured as such
/packages/:packageId/years/:yearsId where /packages returns a component that has a link to /packages/:packageId which continues rendering down to the final path of /packages/:packageId/years/:yearsId.
Now the issue is that I'd like to fetch data from an API starting from /packages/:packageId and pass it down to the component which renders from /packages/:packageId.
I'm wondering what the best strategy to do this would be. Currently, I'm passing state through a link component to link between the components as
import { faAngleRight } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Link } from "react-router-dom";

interface IProps {
    path: string;
    state?: object
}

/**
 * A right facing angle that acts as a <Link /> component in the cell of tables.
 * @param {IProps}
 */
const ArrowLink = ({ path, state }: IProps) => {
    return (
        <Link
            to={{
                pathname: path,
                state: state
            }}>
                <FontAwesomeIcon
                    icon={faAngleRight}
                    size="lg"
                    aria-label="open menu icon"
                />
        </Link>
    );
};

export default ArrowLink;

but I'm wondering if there is a better way of doing things. Should I be using a Context and passing down information from the top level? I thought about going down this path, but I wasn't sure what to do if someone just went to /packages/:packageId/years/:yearsId immediately (as then the data would not have been loaded from the top level API call). Would I just have to make a function in the Context in order to have a function that fetches data if the Context is null or something?

A: react-router-dom uses context internally so I suggest you use what it gives you and don't complicate your code unnecessarily. here is what I think you need to do based on your descriptions.
you need to check the state you're getting from react router in the /packages/:packageId/years/:yearsId component and see if it exists or not, if it doesn't exist just call your api (this is for the user who go directly to that component).
for those users who go from /packages/:packageId component to /packages/:packageId/years/:yearsId component you already made an api call and you just pass the result through react router state.
your /packages/:packageId/years/:yearsId component should look like this:

const location = useLocation();
useEffect(() => {
  if(location.state){
    //use the state
  }else {
    //make an api call
  }
}, [])

if you showed actual code from those components I could be more specific


text:
Q: Re-usable, Self Host SVG icons in CSS pseudo elements (`:before` and `:after`) Background
I have recently read an article which talks about self-hosting your static assets and explains the risk of using CDN's or external infrastructure. This got me to think on hosting fonts & icons myself.
I'm aware that you can self-host fonts by downloading a font and using the file-path as a URL - to include that in your CSS. And you can also download or create an SVG for any icon and use it as a HTML element.
Question
But is it possible to use a self-hosted SVG in a CSS pseudo element like in the content property :before and :after? Similar to how Font Awesome allows you to mention content code for their icons
Note: My main intention is re-usability of same SVG in multiple CSS classes

A: Yes, through the data URIs; using the brackground or content property.

.icon::before {
  display: inline-block;
  content:'';
  width: 24px;
  height: 24px;
}

.icon-menu::before {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 0, 0, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
<!doctype html>

        <title>Developer</title>


text:
Q: Proper storage of ferric cloride PCB etchant I etch about half a dozen printed circuit boards each year at home, using an aqueous ferric chloride AKA iron(III) chloride etchant solution. As I want to minimize the costs and hassle of buying new and disposing of old etchant, I would like to know what steps can I take for maximizing the amount of boards I can etch with a given amount of etchant. I have no background in chemistry, so any suggestions are appreciated.

*

*I prepare a certain amount of etchant solution at a time, use it until it fails to dissolve copper effectively, and finally transfer it to a waste tank awaiting disposal. Does the batch size affect the amount of circuit boards I can etch with a given amount of ferric chloride?

*Is etchant sensitive to light or fluctuating temperatures while in storage?

*Is etchant oxygenation beneficial or detrimental? Many vendors of the chemical and several PCB fabrication tutorials clearly state that FeCl3 etchant stores indefinitely if kept in an airtight container. On the other hand commercial PCB etching devices purposefully stir the etchant by blowing air bubbles trough it, oxygenating the solution in the process, seemingly without adverse effects.

A: If you store Ferric Chloride in a sealed glass jar, it stays viable for years - I have some that I prepared 10 years ago and it still works fine. Just keep the jar out of direct sunlight and somewhere not too warm - mine is stored in the garage out of the way - it's not temperature controlled and that doesn't seem to matter.
You can also prolong the etchant by the way you use it. Typically you would just dip the board in a pool of the etchant, but this is not so good as it will reduce the effectiveness of the etchant as it fills with cupric chloride (remnant from etching).
The way I read somewhere (and subsequently use) is to put a small amount on a sponge (like the sort you use for washing up, though not one that you ever plan to use for washing up ever again!). Then, making sure you are wearing gloves, simply wipe the sponge across the board that you are etching. You will notice the sponge starts going green. You can keep adding small amounts more onto the sponge as it gets used up.
This actually results in a nice quick etch, and it means pretty much all of the etchant on the sponge is used up. It also means you don't pollute your jar of ferric chloride with copper meaning it stays at full strength.

Ferric Chloride isn't nice stuff in terms of disposal (well in terms of anything but etching speed really), so the alternative would be to go the safer route of using Hydrochloric Acid + Hydrogen Peroxide. This stuff is easier to dispose of as far as I know.


text:
Q: modal not loading values into controls on modal I'm having an issue where my code is calling a Modal and when the modal loads and it is supposed to fill the controls on the modal with the values sent into the javascript. It loads with no errors except for the fact that all the controls are empty. I'm new to ajax and javascript so its probably somehting simple I am missing.
Thanks.
Here is my Javascript:
function RowClickedResults(sender, eventArgs) {
sender.get_masterTableView().fireCommand("View", eventArgs._itemIndexHierarchical);
}

    function createEditAccount(ReceivedDate, DepositedDate, tbCompanyName, tbCheckAmount, tbCheckNum, tbDesc, cbResultsBreak, cbResultAcctNum, tbResultBreak, tbResultNotes) {
    $("#EditAccount").modal('show');
    $('#EditAccount').on('load', function () {
        var rDate = $telerik.findControl(document, "rdResultReceiveDate");
        var dDate = $telerik.findControl(document, "rdResultDepositDate");
        var Comp = $telerik.findControl(document, "tbResultCompany");
        var CheckAmt = $telerik.findControl(document, "tbResultCheckAmt");
        var CheckNum = $telerik.findControl(document, "tbResultCheckNum");
        var Desc = $telerik.findControl(document, "tbResultsDesc");
        var Break = $telerik.findControl(document, "cbResultsBreak");
        var AcctNum = $telerik.findControl(document, "cbResultAcctNum");
        var BreakAmt = $telerik.findControl(document, "tbResultBreak");
        var Notes = $telerik.findControl(document, "tbResultNotes");
        rDate.set_selectedDate = ReceivedDate;
        dDate.set_selectedDate = DepositedDate;
        Comp.text = tbCompanyName;
        CheckAmt.text = tbCheckAmount;
        CheckNum.text = tbCheckNum;
        Desc.text = tbDesc;
        AcctNum.value = cbResultAcctNum;
        BreakAmt.text = tbResultBreak;
        Notes.text = tbResultNotes;
    });

}

here is my Modal:

Edit Account Receivable

                                            <asp:Label runat="server" Text="Received Date: " />
                                            <telerik:RadDatePicker runat="server" ID="rdResultReceiveDate" Culture="en-US" />

                                            <asp:Label runat="server" Text="Deposited Date: " />
                                            <telerik:RadDatePicker runat="server" ID="rdResultDepositDate" Culture="en-US" />

                                            <asp:Label runat="server" Text="Company: " />
                                            <asp:TextBox runat="server" ID="tbResultCompany" />

                                            <asp:Label runat="server" ID="lblResultCheck" Text="Check Amount: " />
                                            <asp:TextBox runat="server" ID="tbResultCheckAmt" />

                                            <asp:Label runat="server" Text="Check Number: " />
                                            <asp:TextBox runat="server" ID="tbResultCheckNum" />

                                            <asp:Label runat="server" Text="Description: " />
                                            <asp:TextBox runat="server" ID="tbResultsDesc" />

                                            <asp:Label runat="server" Text="Break Down: " />
                                            <telerik:RadComboBox runat="server" RenderMode="Lightweight" ID="cbResultsBreak" AutoPostBack="false"
                                                AppendDataBoundItems="true" CloseDropDownOnBlur="true" DropDownAutoWidth="Enabled"
                                                ShowDropDownOnTextboxClick="true" Enabled="true" OnSelectedIndexChanged="BreakDownSelectedIndexChanged">
                                            </telerik:RadComboBox>

                                            <asp:Label runat="server" Text="Account Number: " />
                                            <telerik:RadComboBox runat="server" RenderMode="Lightweight" ID="cbResultAcctNum" AutoPostBack="false"
                                                AppendDataBoundItems="true" CloseDropDownOnBlur="true" DropDownAutoWidth="Enabled"
                                                ShowDropDownOnTextboxClick="true" Enabled="true">
                                            </telerik:RadComboBox>

                                            <asp:Label runat="server" Text="Break Down: " />
                                            <asp:TextBox runat="server" ID="tbResultBreak" />

                                            <asp:Label runat="server" Text="Notes(Optional): " />
                                            <asp:TextBox runat="server" ID="tbResultNotes" />

                                    <asp:LinkButton runat="server" ID="btnEditSave" CssClass="btn btn-success" OnClientClick="saveEditAccount(this); return false;" OnClick="btnSaveEdit_Click">Save</asp:LinkButton>

                                    <button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>

            <telerik:RadWindowManager RenderMode="Lightweight" ID="RadWindowManager2" runat="server" />

Here is where my javascript is called :
<telerik:RadGrid ID="rgResults" runat="server" FooterStyle-ForeColor="#BA1A8B"
                            HeaderStyle-BackColor="#39ac99"
                            HeaderStyle-Font-Bold="true" AlternatingRowStyle-BackColor="White"
                            AllowPaging="true" PageSize="10"
                            OnItemCommand="rgResults_ItemCommand"
                            OnNeedDataSource="rgResults_NeedDataSource"
                            OnItemDataBound="rgResults_ItemDataBound"
                            OnPreRender="rgResults_PreRender"
                            AutoGenerateColumns="false">
                            <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="false">
                                <Selecting AllowRowSelect="true"></Selecting>
                                <ClientEvents OnRowClick="RowClickedResults" />
                            </ClientSettings>
                            <MasterTableView DataKeyNames="Deposited_Date">
                                <Columns>
                                    <telerik:GridTemplateColumn UniqueName="commandColumn">
                                        <ItemTemplate>
                                            <telerik:RadImageButton ID="btnDelete" runat="server" CommandName="Delete" ImageUrl="~/Content/Images/delete.gif" />
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridBoundColumn HeaderText="Deposit Date" DataField="Deposited_Date" UniqueName="Deposited_Date" />
                                    <telerik:GridBoundColumn HeaderText="Company Name" DataField="Company_Name" UniqueName="Company_Name" />
                                </Columns>
                            </MasterTableView>
                            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
                        </telerik:RadGrid>

Here is my code behind:
case "View":
                {

                    foreach (GridDataItem item in rgResults.Items)
                    {
                        string Deposit = item.GetDataKeyValue("Deposited_Date").ToString();
                        ar = ydb.Accounts_Receivable.ToList().Where(t => t.Deposited_Date == DateTime.Parse(Deposit)).ToList();
                        foreach (Accounts_Receivable ar2 in ar.ToList())
                        {
                            if (SearchByDate.SelectedDate.Value.ToString() == Deposit)
                            {
                                if (ar2.Posted_Date == null)
                                {
                                    Accounts_Receivable_Breakdown arb = ar2.Accounts_Receivable_Breakdown.ToList().Where(t => t.Accounts_Receivable_ID == ar2.Accounts_Receivable_ID).First();
                                    ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), "createEditAccount(\"" + ar2.Received_Date.Value.ToString() + "\",\"" + ar2.Deposited_Date.ToString() + "\",\"" +
                                        ar2.Company_Name + "\",\"" + ar2.Check_Amount + "\",\"" + ar2.Check_Number + "\",\"" +
                                         ar2.Description_ + "\",\"" + arb.Breakdown_Amount +
                                         "\",\"" + arb.Account_Number + "\",\"" + arb.Breakdown_Amount + "\",\"" + arb.Notes + "\");", true);
                                }
                                else
                                {
                                    rdResultReceiveDate.Enabled = false;
                                    rdResultReceiveDate.Enabled = false;
                                    tbResultCompany.ReadOnly = true;
                                    tbResultCheckAmt.ReadOnly = true;
                                    tbResultCheckNum.ReadOnly = true;
                                    tbResultsDesc.ReadOnly = true;
                                    cbResultAcctNum.Enabled = false;
                                    Accounts_Receivable_Breakdown arb = ar2.Accounts_Receivable_Breakdown.ToList().Where(t => t.Accounts_Receivable_ID == ar2.Accounts_Receivable_ID).First();
                                    ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), "createEditAccount(\"" + Eval("ar2.Received_Date.Value").ToString() + "\",\"" + Eval("ar2.Deposited_Date").ToString() + "\",\"" +
                                        Eval("ar2.Company_Name") + "\",\"" + Eval("ar2.Check_Amount") + "\",\"" + Eval("ar2.Check_Number") + "\",\"" +
                                         Eval("ar2.Description_") + "\",\"" + Eval("arb.Breakdown_Amount") +
                                         "\",\"" + Eval("arb.Account_Number") + "\",\"" + Eval("arb.Breakdown_Amount") + "\",\"" + Eval("arb.Notes") + "\");", true);
                                }
                            }
                        }
                    }

                    break;
                }

A: Figured out the issue. The code had to do a postback since I touched the serverside code and the modal was inside of my updatepanel. Moving the modal out of the update panel let the code finish the postback before trying to find the controls and set the data to them.


text:
Q: how to check whether null value is present in an array.if present how can we assign "NULL" at that place? i have an array like this...
  $myArray = array('id' => '144', 'category' =>'21', 'rating' => '');

i need to get the result as
  $myArray = array('id' => '144', 'category' =>'21', 'rating' => 'NULL');

A: Try this
    $array = array_map(function($val) {
       return $val === "" ? NULL : $val;
    }, $a)


text:
Q: Problems running Apache and PHP with the mcrypt and mhash extensions Here's my problem:
I'm trying to install PHP and Apache on a 64-bit windows environment. I started out with 64-bit Apache 2.4.10 and 64-bit PHP 5.5.20. Everything installed great and then I found out I needed to use the mcrypt and mhash extensions. I could only find these extensions on SourceForge, and it looks like they're only available in 32 bit. So, I reinstalled Apache 32-bit and PHP 32-bit. But then I encountered a problem that the PHP5apache module wouldn't work because it's a 64-bit module apparently. Is there a solution which will allow me to run Apache and PHP with these modules together on Windows?
Thanks for reading and I appreciate any help!

A: Turns out the mcrypt extension comes already as of PHP 5.3. And  mhash for me is no longer relevant so I'm considering this question answered.


text:
Q: How to inverse
* selection using :not() and :contains()? I want to make a live search with jQuery. Here's my code:
$("#searchInput").on("keyup", function () {
        var searchTerm = $("#searchInput").val();
        $('li:contains("' + searchTerm + '")').show().siblings(':not(li:contains("' + searchTerm + '"))').hide();
});

Showing
 which contains "searched text" work properly but the second part (hiding the rest of the items) doesn't work completely.
How can I hide
s when I search for unrelated word?

A: You can use jQuery.not
Solution 1

$("#searchInput").on("keyup", function() {
  var searchTerm = $("#searchInput").val();
  $("ul li").show().not($('li:contains("' + searchTerm + '")')).hide();
});

<input type="text" id="searchInput" />

  Hello

  World

  List 1

 Word

  Another Li

You can use jQuery filter ( see below snippet)
Solution 2

$("#searchInput").on("keyup", function() {
  var searchTerm = $("#searchInput").val();
  $("ul li").show().filter(function() {
    return $(this).text().indexOf(searchTerm) == -1
  }).hide();
});

<input type="text" id="searchInput" />

  Hello

  World

  List 1

 Word

  Another Li


text:
Q: ES6-like object shorthand for Python dictionary For API interaction, I need to 'summarize' some variables in a dictionary. A basic approach would be like
a = 1
b = 2
c = 3

d = {
    'a': a,
    'b': b,
    'c': c,
}

which seems to be somehow repetitive, especially for 15+ variables.
To reduce optical clutter and repetition, I wondered whether Python does have something like ES6's object shorthand which allows to do:
const a = 1;
const b = 2;
const c = 3;

const obj = {
    a,
    b,
    c
}

I found an answer to a similar question, but accessing the variables via the locals() function seems to be a somehow ugly workaround.
Does Python support an ES6-comparable shorthand notation to create a dictionary from variables?

A: What you're looking for doesn't exist in Python.

A: This ought to lessen typing. The key is to the dict constructor rather than the literal declaration syntax {}
#can also use outside vars
d = 4

obj = dict(
a = 1,
b = 2,
c = 3,
d = d,
)


text:
Q: plain text with share option list gives error Okay so i have a weird error here that i can't figure out. I am sharing data with share option list in android "android.intent.action.SEND".
Sharing single image works perfectly, but when i try to share just plain text such as "asdfdgdsfsa", the program throws this error

"Java.Lang.RuntimeException: Unable to instantiate activity
  ComponentInfo{com.companyname.Revamp/Revamp.RecieveDataFromApp.RecieveDataFromApp}:
  java.lang.ClassNotFoundException: Didn't find class
  "Revamp.RecieveDataFromApp.RecieveDataFromApp" on path:
  DexPathList[[zip file
  "/data/app/com.companyname.Revamp-HFm6SmD1Y-A76OQwcwCXIA==/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.Revamp-HFm6SmD1Y-A76OQwcwCXIA==/lib/x86,
  /system/fake-libs,
  /data/app/com.companyname.Revamp-HFm6SmD1Y-A76OQwcwCXIA==/base.apk!/lib/x86,
  /system/lib, /vendor/lib]] ".

  protected override void OnCreate(Bundle bundle)
    {

        Intent intent = Intent;
        String action = Intent.Action;
        String type = intent.Type;

        if (Intent.ActionSend.Equals(action) && type != null)
        {
            // This is what we are trying to get working here.
            if ("text/plain".Equals(type))
            {
                // Handle text being sent
                // ...
                // ...
                // ...
            }
            else if (type.StartsWith("image/"))
            {
                // Handle single image being sent
                // ...
                // ...
                // ...
            }
        }
        else if (Intent.ActionSendMultiple.Equals(action) && type != null)
        {
            //This works
            if (type.StartsWith("image/"))
            {
                // Handle multiple images being sent
                // ...
                // ...
                // ...
            }
        }
        else
        {
            // Handle other intents, such as being started from the home screen
        }

        TabLayoutResource = Resource.Layout.Tabbar;
        ToolbarResource = Resource.Layout.Toolbar;

        base.OnCreate(bundle);

        global::Xamarin.Forms.Forms.Init(this, bundle);
        LoadApplication(new App());
    }

    <activity android:name="Revamp.RecieveDataFromApp.RecieveDataFromApp" android:icon="@drawable/ic_home">
  <intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="image/*" />
  </intent-filter>
  <intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="text/plain" />
  </intent-filter>
  <intent-filter>
    <action android:name="android.intent.action.SEND_MULTIPLE" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="image/*" />
  </intent-filter>

  <intent-filter>
    <action android:name="android.intent.action.GET_CONTENT" />

    <category android:name="android.intent.category.DEFAULT" />

    <data android:mimeType="*/*" />
  </intent-filter>
</activity>

A: I have tested your code and reproduce the issue. You could try to set the intent-filter in code, not in AndroidManifest.xml.
For example:
[Activity(Label = "RecieveDataFromApp", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
[IntentFilter(new[] { Intent.ActionSend }, Categories = new[] { Intent.CategoryDefault }, DataMimeType = "image/*", Label = "RecieveDataFromApp")]
[IntentFilter(new[] { Intent.ActionSend }, Categories = new[] { Intent.CategoryDefault }, DataMimeType = "text/plain", Label = "RecieveDataFromApp")]
[IntentFilter(new[] { Intent.ActionSendMultiple }, Categories = new[] { Intent.CategoryDefault }, DataMimeType = "image/*", Label = "RecieveDataFromApp")]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
   ...
   ...
   ...
}


text:
Q: Disjoint subsets of exactly n elements Given a set = {1, 2, 3, 4, 5, 6} and a number n = 2, how can i get all the disjointed subsets like [ [{1, 2}, {3, 4}, {5, 6}], [{1,3}, {2, 4}, {5, 6}], etc..]
They have to be disjointed 3 by 3 ( 6/2 = 3 ; i.e. all numbers in the original set must be used, and the cardinal of subsets must be equal to each other)
I found this code and I kept trying to modify it in order to show only those with 2 (as an example) elements, but didn't reach an end
Any help?
import itertools

def partition(list_, k):

    #partition([1, 2, 3, 4], 2) -> [[1], [2, 3, 4]], [[1, 2], [3, 4]], ..., [[1, 3], [2, 4]], [[3], [1, 2, 4]]

    if k == 1:  # base case 1: k == 1, just yield itself as a list
        yield [list_]
    elif k == len(list_):  # base case 2: k == len(list_), yield each item in the list wrapped in a list
        yield [[s] for s in list_]
    else:
        head, *tail = list_

       # head, *tail = list_  # head = the first element, tail = the rest
        for p in partition(tail, k-1):  # case 1: head -> 1, partition(tail, k-1) -> k-1.
                                        # head + partition(tail, k-1) -> 1+k-1 -> k
            yield [[head], *p]
        for p in partition(tail, k):  # case 2: head -> 1, partition(tail, k) -> k.
                                      # bloat x to [e1, e2, e3] -> [[x+e1, e2, e3], [e1, x+e2, e3], [e1, e2, x+e3]]
            for i in range(len(p)):
                yield p[:i] + [[head] + p[i]] + p[i+1:]  # bloat head to partition(tail, k) -> k


text:
Q: Intuitive "proof" or explanation of a result in Friedman's urn Let $g, r, a, b$ be positive integers. In Friedman's urn model we have an urn with $r$ red and $g$ green balls in it. In each step we take one ball out of urn, register its color and return it to the urn. Additionally, we put $a$ more balls of this color and $b$ more balls of the other color.
Let $X_n$ be the relative amount of green balls in the box after $n$-th step. It can be proven (e.g. Richard Durrett, Probability: Theory and Examples, pages 254-255) that
$$\lim_{n\to\infty}X_n = \frac12\quad\text{a.e.}$$
If one thinks about this statement for a second it would most probably strike him as extremely counter-intuitive. The proof cited above make use of square integrable martingales, and unfortunately doesn't seem to give intuitive explanation of this phenomena.
I'm looking for an explanation which would explain on some heuristic level why this result is in some sense logical. An idea for more intuitive proof would also definitely be helpful.
I would also like to note that if we take $b=0$ the model becomes well-known Polya-Eggenberger urn model for which we have
$$\lim_{n\to\infty}X_n\sim B\left(\frac{g}{a}, \frac{r}{a}\right).$$

A: You might be interested in the article by David A. Freedman on Friedman's urn. He reports a simple and intuitive proof due to Ornstein, which only uses the strong law
of large numbers.
In his notation the urn contains $W_n$ white balls and $B_n$ black balls at time $n$, $a$ and $b$ have the same meaning as in the question.

D. Ornstein has obtained this very intuitive proof that $(W_n + B_n)^{-1}W_n$ converges
  to $1/2$ with probability 1 for $b > 0$. Suppose first $a > b$. If $0 \leq  x \leq 1$ and
  $$\mathbb P\left\{\limsup \frac{W_n}{W_n + B_n} \leq x\right\} = 1,$$
  by an easy variation of the Strong Law, with probability 1, in $N$ trials there will be at most $Nx + o(N)$ drawings of a white ball; so at least $N(1 - x) - o(N)$ drawings of black. Therefore, with probability 1, $\limsup (W_n+ B_n)^{-1}B_n$ is bounded above by
  $$\lim\limits_{N\to\infty}\frac{a[Nx + o(N)] + b[N(1 - x) - o(N)]}{N(a + b)}=\frac{b+(a-b)x}{a+b}.$$
  Starting with $x = 1$ and iterating,
  $$\mathbb P\left\{\limsup \frac{W_n}{W_n + B_n} \leq \frac{1}{2}\right\} = 1$$
  follows. Interchange white and black to complete the proof for $a > b$. If $a < b$, and
  $$\mathbb P\{\limsup (W_n + B_n)^{-1}W_n \leq x\} = 1,$$
  then a similar argument shows
  $$\mathbb P\left\{\limsup\frac{B_n}{W_n + B_n} < \frac{a+(b-a)x}{a + b}\right\}=1$$
  The argument proceeds as before, except both colors must be considered simultaneously.


text:
Q: I am getting Uncaught ReferenceError: wysiwygSetup is not defined Please anyone can help me here, I am getting the require undefined in js, below is my code. Thank you
My code:
          <script>
        require([
            "jquery",
            "mage/translate",
            "mage/adminhtml/events",
            "mage/adminhtml/wysiwyg/tiny_mce/setup"
        ], function(jQuery) {
            wysiwygCompanyDescription = new wysiwygSetup("company_description", {
                "width": "100%",
                "height": "200px",
                "plugins": [{
                    "name": "image"
                }],
                "tinymce4": {
                    "toolbar": "formatselect | bold italic underline | alignleft aligncenter alignright | bullist numlist | link table charmap",
                    "plugins": "advlist autolink lists link charmap media noneditable table contextmenu paste code help table",
                }
            });
            wysiwygCompanyDescription.setup("exact");
        });
    </script>

and the error is:
(index):725 Uncaught ReferenceError: wysiwygSetup is not defined
    at (index):725
    at Object.execCb (db2cfb207124dfa2df050f1ef1a6e743.js:1650)
    at Module.check (db2cfb207124dfa2df050f1ef1a6e743.js:866)
    at Module.<anonymous> (db2cfb207124dfa2df050f1ef1a6e743.js:1113)
    at db2cfb207124dfa2df050f1ef1a6e743.js:132
    at db2cfb207124dfa2df050f1ef1a6e743.js:1156
    at each (db2cfb207124dfa2df050f1ef1a6e743.js:57)
    at Module.emit (db2cfb207124dfa2df050f1ef1a6e743.js:1155)
    at Module.check (db2cfb207124dfa2df050f1ef1a6e743.js:917)
    at Module.<anonymous> (db2cfb207124dfa2df050f1ef1a6e743.js:1113)

A: You can use below code to use wysiwyg editor.
HTML :
<textarea id="company_description" name="company_description"></textarea>

Script :
<script type="text/javascript">
require([
    'jquery',
    'mage/adminhtml/wysiwyg/tiny_mce/setup'
], function(jQuery){
    wysiwyg = new wysiwygSetup('company_description', {
        'width':'100%',
        'height':'300px',
        'plugins':[{'name':'image'}],
        'tinymce4':{'toolbar':'formatselect | bold italic underline | alignleft aligncenter alignright | bullist numlist | link table charmap','plugins':'advlist autolink lists link charmap media noneditable table contextmenu paste code help table'
        }
    });
    wysiwyg.setup('exact');
});
</script>

Hope this will help you!


text:
Q: How to add a custom text field in Magento v1.5 Catalog/Mange products/General tab in admin panel? How to add a custom text field in Magento v1.5 Catalog/Mange products/General tab in admin panel?
please help me if any body have expertise on this..

A: Since Magento maintains Catalog Product as EAV structure, so it will be best (in the interest of Magento functionality & feasibility) to provide the text field as an attribute in the General Tab of Catalog Product details page in the Admin section.
We will go through step by step process of adding an attribute to all the Products:-

*

*Go to the "Manage Attributes" page (Main Menu > Catalog > Attributes > Manage Attributes), to find the list of all the available Catalog Attributes.

*Click the "Add New Attribute" button to add a new attribute.

*Provide the following in the form (Word of Caution: Don't try to change any of the properties in this Attribute details page, unless you are sure of what you are doing.):-

*

*First we will fill up the required fields for the tab "Properties".

*Provide your Attribute Code, in the "Attribute Code" field.

*Let the "Catalog Input Type" be "Text Field", as you wanted to have text field only.

*If you want to pre-populate this text field with any value, then you will need to provide that text in the "Default Value" field.

*If you want to provide this attribute to all the product types, then you need not change the value of the "Apply To" dropdown (which by default is "All Product Types"). Otherwise you can change this value to "Selected Product Types" & automatically a list of all the available Magento Product Types will appear in another dropdown, from where you need to select your required product types for this attribute.

*For the "Visible on Product View Page on Front-end" field, you need to select the value "Yes", if you want this text field to appear in the front-end Product details page.

*Now we will fill the tab "Manage Label/Options", in the left hand panel. Click on that tab to open that tab's details page.

*Provide the label in both the fields available which will be shown both in the front-end & in the admin section.

*Click the "Save Attribute" button to add this attribute.

*Magento will provide a notice that you need to re-index one / two Indexes from the "Index Management" section, with the link of this section provided.

*Click on that link to go to the "Index Management" section & re-index those indexes which are marked in red.

*Now go to the "Manage Attribute Sets" page (Main Menu > Catalog > Attribute > Manage Attribute Sets).

*Click on the "Default" row of the Set Name, to view its details page.

*Open the FTP or your local Explorer, to go inside the "var" folder.

*Delete the "cache" folder, so that configuring the attribute set do not get disturbed due to the Cache.

*Coming back to the browser, go to the rightmost section (named "Unassigned Attributes") to find your created attribute in the list.

*Drag that attribute into the middle section (named "Groups"). There will be many groups available by default. Since you want your attribute to be in the "General" tab, so you should drag & put your attribute in the "General" group only after / before any suitable attribute. Be careful in this area, as no other attribute(s) should get misplaced.

*Now click the "Save Attribute Set" button & your work is complete.

To check whether the above process worked correctly or not, go to the Product details page in the Admin section & in the "General" tab, you should be ale to find your own created attribute sitting perfectly with a text field happily among others.
Hope it helps.


text:
Q: How to implement POST http endpoint using spring integration? I have following configuration:
@Configuration
@EnableIntegration
@IntegrationComponentScan
public class Config {

    @Bean
    public IntegrationFlow integrationFlow() {
        return IntegrationFlows.from(Http.inboundGateway("/spring_integration_post")
                .requestMapping(m -> m.methods(HttpMethod.POST))
                .requestPayloadType(String.class)
        ).channel("responseChannel")
                .get();
    }
}

But when request I see following log on server side:
org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:138) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:105) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:73) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:453) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:401) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:187) ~[spring-messaging-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:166) ~[spring-messaging-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47) ~[spring-messaging-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:109) ~[spring-messaging-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:431) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.handler.AbstractMessageProducingHandler.doProduceOutput(AbstractMessageProducingHandler.java:284) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:265) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:223) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:129) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:169) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:115) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:132) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:105) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:73) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:453) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:187) ~[spring-messaging-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.messaging.core.GenericMessagingTemplate.doSendAndReceive(GenericMessagingTemplate.java:233) ~[spring-messaging-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.messaging.core.GenericMessagingTemplate.doSendAndReceive(GenericMessagingTemplate.java:47) ~[spring-messaging-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.messaging.core.AbstractMessagingTemplate.sendAndReceive(AbstractMessagingTemplate.java:46) ~[spring-messaging-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.integration.core.MessagingTemplate.sendAndReceive(MessagingTemplate.java:97) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.gateway.MessagingGatewaySupport.doSendAndReceive(MessagingGatewaySupport.java:499) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.gateway.MessagingGatewaySupport.sendAndReceiveMessage(MessagingGatewaySupport.java:470) ~[spring-integration-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.http.inbound.HttpRequestHandlingEndpointSupport.actualDoHandleRequest(HttpRequestHandlingEndpointSupport.java:362) ~[spring-integration-http-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.http.inbound.HttpRequestHandlingEndpointSupport.doHandleRequest(HttpRequestHandlingEndpointSupport.java:253) ~[spring-integration-http-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.integration.http.inbound.HttpRequestHandlingMessagingGateway.handleRequest(HttpRequestHandlingMessagingGateway.java:112) ~[spring-integration-http-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:53) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

I have no idea where should I subscribe. How can I write request handler to process request and prepare response ?

A: First of all it doesn't look like you need an @IntegrationComponentScan. This one is especially for the @MessagingGateway parsing. If you don't use this kind of gateways, consider to remove it. More info in Docs: https://docs.spring.io/spring-integration/docs/5.2.0.BUILD-SNAPSHOT/reference/html/gateway.html#messaging-gateway-annotation
The Dispatcher has no subscribers clearly says that there is some DirectChannel bean and this one is not used anywhere as an inputChannel for subscription, e.g. via @ServiceActivator or IntegrationFlows.from().
Looking to the code you have provided, it feels like your .channel("responseChannel") goes without any downstream processing.
You need to get used to EIP principles and determine for yourself that everything in Spring Integration is connected via channels, but sometime if another side is missed (or stopped), you are going to have such an exception since there is no way to send and forget: the DirectChannel is just for EIP semantics and everything is called on the same thread like in plain Java code flow.

A: Eventually I was able to solve the problem:
@Configuration
@EnableIntegration
public class Config {

    @Bean
    public IntegrationFlow integrationFlow() {
        return IntegrationFlows.from(Http.inboundGateway("/spring_integration_post")
                .requestMapping(m -> m.methods(HttpMethod.POST))
                .requestPayloadType(String.class))
                .handle((GenericHandler<String>) (payload, headers) -> "SERVER " + payload)
                .get();
    }
}


text:
Q: Creating a table with PSQL as clone of another table but excluding a column Short Version:
What psql command should I use to create temporary table, which is a clone of a given table, excluding a given column?
create temp table bar_temp as <columns from foo.bar excluding 'insert_date'>

Reasoning:
I have some very large CSV files I want to bulk upload into a Postges DB (currently 8.4 - migrating to 9.x).
When uploading these CSV files I want to add an additional field for example a "date" field.
Using this post as inspiration: (How to update selected rows with values from a CSV file in Postgres?) I'm trying to do the following:

*

*Create a temp table from the schema of the target table excluding the "date" column.

*Run '\COPY' command to upload into the temp table.

*Update the entries in the target table with the entries in the temp table + the additional date column entry.

This is all straight forward except for step 1. If the column names are known in advance this line can be hard coded. In my case I have a number of similar input files with corresponding tables and want the solution to be flexible to handle changes in schema.
My hacky solution is to have a pre-processing script that determines the temp table schema then writes that CREATE command to the SQL script before running, eg:
"SELECT 'SELECT ' || array_to_string(ARRAY(SELECT 'o' || '.' || c.column_name FROM information_schema.columns As c WHERE table_name = '$table' AND  c.column_name NOT IN('dt')), ',') || ' FROM $schema.$table As o'"
which gives me something like
SELECT o.name,o.address from foo.bar As o
which can then be used in the create statement
create temp table temp_tbl as SELECT o.name,o.address from foo.bar As o
However I think that there should be away of doing this schema discovery step within PSQL script itself.
I've looked at using "EXEC" but as far as I can see I would need to put this in a function, the return type of this needs to list the table columns!
Any suggestions?

A: You could do something like this:
create table foo like bar;
alter table foo drop column baz;
-- and now full the thing

A: Thanks to Denis' point in the right direction here's my template script:
create temp table $tempTable as SELECT * from $schema.$table where false;
alter table $tempTable drop column $dateColumn;
\\COPY $tempTable FROM '$file' CSV HEADER
DELETE from $schema.$table where $dateColumn='$dt'::date;\
INSERT into $schema.$table select '$dt'::date, * from $tempTable;
DROP TABLE $tempTable;

Though I'm still interested to know how I could have got EXECUTE working..


text:
Q: If $f$ is uniformly continuous on $\mathbb{R}$, $f(x) \ge a >0$ and $g(x) = 1/f(x)^2$, then $g(x)$ is uniformly continuous I get to the this point
$$
|g(x)-g(y)| =
\left|\frac{1}{f(x)^2} - \frac{1}{f(y)^2}\right| =
\left|\frac{f(x)^2 - f(y)^2}{f(x)^2f(y)^2}\right| \leq \frac{1}{a^4} |f(x)-f(y)|\,|f(x)+f(y)|.
$$
I want to use my assumption $|x-y| < \delta$, but I don't know how to do that given $|f(x)-f(y)|$.

A: You've just been a little too fast with using the bound:
$$\begin{align}
\left\lvert \frac{f(x)^2-f(y)^2}{f(x)^2f(y)^2}\right\rvert &= \left\lvert f(x) - f(y)\right\rvert\left\lvert \frac{f(x) + f(y)}{f(x)^2f(y)^2}\right\rvert\\
&= \left\lvert f(x) - f(y)\right\rvert\left\lvert \frac{1}{f(x)f(y)^2} + \frac{1}{f(x)^2f(y)}\right\rvert\\
&\leqslant  \left\lvert f(x) - f(y)\right\rvert\frac{2}{a^3}
\end{align}$$
takes you home.

A: An upper bound that is not as resourceful but also serves is as follows:
\begin{align*}
|g(x)-g(y)|
=& \left|\frac{1}{f(x)^2} - \frac{1}{f(y)^2}\right|
\\
=&
\left|\frac{f(x)^2 - f(y)^2}{f(x)^2f(y)^2}\right|
\\
=&
\left|\frac{1}{f(x)^2} \right|\cdot \left|\frac{1}{f(y)^2}
\right|\cdot \left|\color{red}{f(x)\cdot f(x)} - f(y)\cdot f(y)\right|
\\
=
&
\left|\frac{1}{f(x)^2} \right|\cdot \left|\frac{1}{f(y)^2} \right|
\cdot
\left|\Big[ \color{red}{\big(f(x)-f(y)\big)}+ \color{blue}{f(y)} \Big]
\cdot \Big[ \color{red}{\big(f(x)-f(y)\big)}+ \color{blue}{f(y) }\Big] - f(y)\cdot f(y)\right|
\\
=
&
\left|\frac{1}{f(x)^2} \right|\cdot \left|\frac{1}{f(y)^2} \right|
\cdot
\bigg|
\color{red}{\Big(f(x)-f(y)\Big)\cdot \Big(f(x)-f(y)\Big)}
+2\cdot\color{blue}{f(y)}\cdot \color{red}{\Big(f(x)-f(y)\Big)}
\bigg|
\end{align*}
Due to do the triangle inequality, $\cfrac{1}{f(x)}\leq \cfrac{1}{a}$ and$ \cfrac{1}{f(y)}\leq \cfrac{1}{a}$:
\begin{align*}
|g(x)-g(y)|
\leq
&
\left|\frac{1}{a^4} \right|
\cdot
\Big|\color{red}{\big(f(x)-f(y)\big)}\Big|\cdot
\Big|\color{red}{\big(f(x)-f(y)\big)}\Big|
\\
&
\qquad\qquad +
\left|\frac{1}{a^3} \right|
\cdot
\left|\frac{1}{f(y)} \right|
\cdot2\cdot\big|\color{blue}{f(y)}\big|\cdot \Big|\color{red}{\big(f(x)-f(y)\big)}\Big|
\\
\leq
&
\left|\frac{1}{a^4} \right|
\cdot
\Big|\color{red}{\big(f(x)-f(y)\big)}\Big|\cdot \Big|\color{red}{\big(f(x)-f(y)\big)}\Big|
+\left|\frac{2}{a^3} \right|
\cdot
\Big|\color{red}{\big(f(x)-f(y)\big)}\Big|
\\
\end{align*}


text:
Q: i am trying to print words from a sentence in c++ but its giving me Segmentation Fault(core dump) I am trying to print the words from a sentence but it's giving the error:

Segmentation Fault (core dump)

Is it due to the use of gets() function, or is it something else?
void words(char* sentence){
    int len =strlen(sentence);
    for(int i=0;i<len;i++){
        char word[100];
        int j=0;
        while(sentence[i]!='\0' || sentence[i]!=' '){
            word[j++] = sentence[i++];
        }
    word[j] ='\0';
    cout<<word<<endl;
    }
}
int main(){
    char str[100];
    gets(str);
    words(str);
    return 0;
}

A: Your main code itself is not proper.
char str[100];
    gets(str);
How you will make sure that always input to str will be 100.If input exceed 100 it will cause crash.


text:
Q: Multisite Subdomain 404 errors I am a beginner in wordpress.I was in need to setup multisite, i managed to setup everything as mentioned in the codex. I created a subdomain, it appears on the dashboard under site, but when i click on it it shows 404 page not found error. Dns wild card is set, the wp config file and .htacess(i copied the network setup in to it).Any help will be appreciated.Thanks.
my .ht access file=>
'   # Use PHP 5.3
    AddHandler application/x-httpd-php53 .php
    suPHP_ConfigPath /opt/php53/lib
    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
</IfModule>'

# END WordPress

wp_config file=>
'define('WP_DEBUG', false);

/* Multisite */
define( 'WP_ALLOW_MULTISITE', true );

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', '***.net');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

/* That's all, stop editing! Happy blogging. */'

Reply

A: i was using an addon domain, so the wildcard setting was different.I tried setting it in this way http://support.hostgator.com/articles/hosting-guide/lets-get-started/dns-name-servers/wildcard-dns-what-is-it-and-how-do-i-use-it after few hours everything worked fine.


text:
Q: Presence of xsd link overriding xslt I am really new working with XML, XSD or XSLT.
What I am trying to do is the following:

*

*Output data is transferred in the XML format.

*The user can review the XML file

*The user is not used to XML and wants the view the data inside a nice table instead of XML code

*I created a XSLT file for that purpose

I am done with the XSLT file (besides adjusting the colour schema etc).
The problem I have now is that in the xml file there is a link to an external xsd file (xmlns =..). As long as this code is present the rendered XML is missing the extracted input (xsl:value-of select=...).
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<Table1 xmlns="http://www.test.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

My xslt code looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">

    Id of

    <xsl:value-of select="//idOf"/>

</xsl:template>
</xsl:stylesheet>

What am I doing wrong?
THX!

A: Try (edited according to michael.hor257k's comment)
<xsl:stylesheet version="2.0"
xmlns:test="http://www.test.xsd"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="test">

And then add test: to all you accesssing your xml structure, e.g. <xsl:value-of select="//test:idOf"/>
The xmlns="http://www.test.xsd" is not just a "Link" in your XML but it declares the default namespace - using xsd as a file extension here may be a taste thing but you can't access the data in the XML without using it.


text:
Q: Geometric Interpretation of Non Negative Matrix Factorization I'm trying to learn about the geometric interpretation of NMF. I have found the paper by Slim Essid to be very useful. I would like to make a plot like the one in Figure 1 just for a k=2 Topics (i.e. the 2d case). What are the axes in Figure 1. Thanks for your help.

A: The axes are literally dimensions in the feature space. Vectors inside are data points. Vectors between the data and the positive axes are the "topics". I think Page 22--24 (especially Figure 3.1) of Gillis' thesis (https://www.dropbox.com/s/dyfusffzymewoim/Thesis_gillis.pdf?dl=0) should be helpful for the precise definition of these things. Sec 3 of https://www.stanford.edu/~vcs/papers/NMFCDP.pdf is also very clear about the geometric interpretation of NMF (it is probably where it first appeared).


text:
Q: How to I make my program a main function? I would like my program to have  a main function so I can run it as a module or main program. Main functions are new to me and I have no idea how to do this.
#!/usr/bin/python3
def main():
#left dashboard
    ld = raw_input("Left dashboard switch (0 or 1): ")

#right dashboard
    rd = raw_input("Right dasboard switch (0 or 1): ")

#child lock
    cl = raw_input("Child lock switch (0 or 1): ")

#master lock
    ml = raw_input("Master unlock switch (0 or 1): ")

#left inside
    li = raw_input("Left inside handle (0 or 1): ")

#left outside
    lo = raw_input("Left outside handle (0 or 1): ")

#right inside
    ri = raw_input("Right inside handle (0 or 1): ")

#right outside
    ro = raw_input("Right outside handle (0 or 1): ")

#gear shift
    gs = raw_input("Gear shift position (P, N, D , 1 ,2 ,3 or R): ")

    d = 0
    r = 0
    l = 0
    if gs == "P" and ml == "1" and cl == "0":
            d = 1
    if ri == "1" or ro == "1" or rd == "1":
            r = 1
    if li == "1" or lo == "1" or ld == "1":
            l = 1
    if d == 0:
            print "Both doors closed"
if _name_ == "_main_":
    main()

A: def main():
    #code here

if __name__ == '__main__': main()

all your  code needs to be encased in the main function. The function is them called at the bottom
python docs - __main__.
More info on main here


text:
Q: MVC URL structure Have the following link in Index.cshtml:
 @Html.ActionLink("Edit", "Edit", new { clientId = item.ClientId ,      overrideId=item.OverrideId})

and route as:
 routes.MapRoute(
          name: "Edit",
           url: "{controller}/{action}/{clientId}/{overrideId}",
          defaults: new { controller = "ClientOverride", action = "Edit", clientId =       UrlParameter.Optional, overrideId = UrlParameter.Optional }
       );

When redirect occurs from Index to Edit, the following URL is created:
.../clientoverride/edit/6?overrideId=1
while I would expect something like:
.../clientoverride/edit/6/1
Why so inconsistent URL is created? What can I do to make it look like a tree structure with clientoverride/edit/6/1 at the end?

A: Try using Html.RouteLink instead of Html.ActionLink.
For links to routes that have more than one argument, you're better placed using @Html.RouteLink as it's for custom routes.
In your instance, you'd use @Html.RouteLink("Edit", "Edit", new { clientId = item.ClientId, overrideId = item.OverrideId})
The above example uses Html.RouteLink(LINKTEXT, ROUTENAME, VALUES)
The reason you're getting the URL you're seeing is that Html.ActionLink always assumes the default route format so any additional parameters end up getting turned into a query string.
Make sure your custom route is above the default route too.

A: Put this on top of all the rules used for clientoverride controller:-
    routes.MapRoute(
         name: "Edit",
          url: "{controller}/{action}/{clientId}/{overrideId}",
         defaults: new { controller = "ClientOverride", action = "Edit", clientId = UrlParameter.Optional, overrideId = UrlParameter.Optional }
      );

As your default route map is forming the url in this format/clientoverride/edit/6?overrideId=1. So, after changing the sequence it will solve your problem.


text:
Q: get object position as specified in CSS to modify in jQuery First question, so please let me know if I could/should be asking this more succinctly/clearly...
I'm working on an experimental script that vibrates objects with a given class with increasing intensity over time. I'm working with jRumble as a base. My script needs to get the initial CSS position of objects to be vibrated and then add the modifying var. I set this up like so at first:
$this.animate({
    'left': parseFloat($this.css( "left" )) + rx + 'px',

which works great in Chrome, but Safari and iOS return different values. This explained the problem: jquery $('selector').css('top') returns different values for IE, firefox and Chrome, so I switched to using .offset:
offset = $(".offreg").offset();

...
'left': offset.left + rx + 'px',

but this is problematic because the script iterates-- .offset returns the current position each time instead of the initial one. I tried placing the var outside of the iterating section, but this (obviously) doesn't work because it is no longer associated with the "this" of the rumble script. The var is then set at the value of the first element with class .offreg.
The page itself is here: http://sallymaier.github.io/off-register/
I'm going to revert to the last version that worked in Chrome. My github is public, so you can see my mess-making there I think.
Full script as it works in Chrome below:
var offRegister = function() {

    if (!($ = window.jQuery)) { // see if jQuery is already called, if not, calling script
      script = document.createElement( 'script' );
      script.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';
      script.onload=runRumbler;
      document.body.appendChild(script);
    }
    else {
      runRumbler();
    }

    function runRumbler() {
        $(document).ready(function(){

            var count = 0;

            $(function addone(){
                count = count+1;

                (function($) {
                  $.fn.jrumble = function(options){  // jRumble by Jack Rugile. http://jackrugile.com/jrumble/

                    /*========================================================*/
                    /* Options
                    /*========================================================*/
                    var defaults = {
                      x: count/5,
                      y: count/5,
                      rotation: 0,
                      speed: 200,
                      opacity: false,
                      opacityMin: .5
                    },
                    opt = $.extend(defaults, options);

                    return this.each(function(){

                      /*========================================================*/
                      /* Variables
                      /*========================================================*/
                      var $this = $(this),
                        x = opt.x*2,
                        y = opt.y*2,
                        rot = opt.rotation*2,
                        speed = (opt.speed === 0) ? 1 : opt.speed,
                        opac = opt.opacity,
                        opacm = opt.opacityMin,
                        inline,
                        interval;

                      /*========================================================*/
                      /* Rumble Function
                      /*========================================================*/
                      var rumbler = function(){
                        var rx = Math.floor(Math.random() * (x+1)) -x/2,
                            ry = Math.floor(Math.random() * (y+1)) -y/2,
                            rrot = Math.floor(Math.random() * (rot+1)) -rot/2,
                            ropac = opac ? Math.random() + opacm : 1;

                        /*========================================================*/
                        /* Ensure Movement From Original Position
                        /*========================================================*/
                        rx = (rx === 0 && x !== 0) ? ((Math.random() < .5) ? 1 : -1) : rx;
                        ry = (ry === 0 && y !== 0) ? ((Math.random() < .5) ? 1 : -1) : ry;

                        /*========================================================*/
                        /* Check Inline
                        /*========================================================*/
                        if($this.css('display') === 'inline'){
                          inline = true;
                          $this.css('display', 'inline-block');
                        }

                        /*========================================================*/
                        /* Rumble Element
                        /*========================================================*/
                        $this.animate({
                          'left': parseFloat($this.css( "left" )) + rx + 'px', // move from declared position
                          'top': parseFloat($this.css( "top" )) + ry+'px',
                          '-ms-filter':'progid:DXImageTransform.Microsoft.Alpha(Opacity='+ropac*100+')',
                          'filter':'alpha(opacity='+ropac*100+')',
                          '-moz-opacity':ropac,
                          '-khtml-opacity':ropac,
                          'opacity':ropac,
                          '-webkit-transform':'rotate('+rrot+'deg)',
                          '-moz-transform':'rotate('+rrot+'deg)',
                          '-ms-transform':'rotate('+rrot+'deg)',
                          '-o-transform':'rotate('+rrot+'deg)',
                          'transform':'rotate('+rrot+'deg)'
                        });

                      }; /* close rumble function */

                      /*========================================================*/
                      /* Rumble CSS Reset
                      /*========================================================*/
                      var reset = {
                        'left':0,
                        'top':0,
                        '-ms-filter':'progid:DXImageTransform.Microsoft.Alpha(Opacity=100)',
                        'filter':'alpha(opacity=100)',
                        '-moz-opacity':1,
                        '-khtml-opacity':1,
                        'opacity':1,
                        '-webkit-transform':'rotate(0deg)',
                        '-moz-transform':'rotate(0deg)',
                        '-ms-transform':'rotate(0deg)',
                        '-o-transform':'rotate(0deg)',
                        'transform':'rotate(0deg)'
                      };

                      /*========================================================*/
                      /* Rumble Start/Stop Trigger
                      /*========================================================*/
                        $this.bind({
                        'startRumble': function(e){
                          e.stopPropagation();
                          clearInterval(interval);
                          interval = setInterval(rumbler, speed)
                        },
                        'stopRumble': function(e){
                          e.stopPropagation();
                          clearInterval(interval);
                          if(inline){
                            $this.css('display', 'inline');
                          }
                          $this.css(reset);
                        }
                      });

                    });// End return this.each
                  };// End $.fn.jrumble

                })(jQuery);

                /*===============================================================*/
                /* Specify selector to vibrate below.
                /* For bookmarklet, 'div' will vibrate all elements,
                /* in plugin this can be specifically targeted to a class or id.
                /*===============================================================*/

                $('.offreg').jrumble();
                $('.offreg').trigger('startRumble');

             setTimeout(addone, 1000); // how many seconds to wait before adding to count, increasing vibration

            }); // end addone()

         });
    };
  };

offRegister();

A: I've been playing around with this source code the last couple minutes, and it seems to me the problem stems from the use of position: absolute on the rumbling elements themselves. In the jRumble docs http://jackrugile.com/jrumble/#documentation it says that 'For rumble elements that are position fixed/absolute, they should instead be wrapped in an element that is fixed/absolute'.
So if you set your container element to position: absolute and then position all the interior divs relative to the container, you'll no longer need to alter the jRumble source code and redefine the plugin every iteration to change the default position or compute the offset of each element - all you'll have to do is increment the x and y values in the jRumble call itself.
The code below is UNTESTED, but I think you want something closer to this (again, this all hinges on the .offreg elements being position: relative):
$(document).ready(function(){
  var count = 0;

  function addone(){
    count++;
    $('.offreg').jrumble({
      x: count,
      y: count,
      rotation: 1
    });
    $('.offreg').trigger('startRumble');

    setTimeout(addone, 1000);
  }
});

A: I like Sean's answer of sidestepping the need for adding code to override $.fn.jrumble, which creates a brittle maintenance point and makes $.fn.jrumble unusable outside this code block (since it depends on the variable "count").
For the immediate issue of the variable scope, if you still need to solve that problem, I'd suggest moving the redefinition of $.fn.jrumble out of addone(), and then scoping a variable, "offset", outside of said redefinition. Then refer to that variable in your call to $this.animate(). Code is below, but again, Sean's answer should make this unnecessary.
var offRegister = function() {
    if (!($ = window.jQuery)) { // see if jQuery is already called, if not, calling script
        script = document.createElement( 'script' );
        script.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';
        script.onload=runRumbler;
        document.body.appendChild(script);
    }
    else {
        runRumbler();
    }
};
function runRumbler() {
    $(document).ready(function(){
        var count = 0;
        var offset;
        function addone() {
            ...
            $('.offreg').jrumble();
            $('.offreg').trigger('startRumble');
            offset = $('.offreg').offset();
            setTimeout(addone, 1000); // how many seconds to wait before adding to
        }
        (function($){
            $.fn.jrumble = function(options){
                ...
                $this.animate({
                      'left': parseFloat(offset) + rx + 'px',
                      ...
                });
                ...
            };
        )(jQuery);
        ...

}
offRegister();

Another suggestion: make the whole thing an anonymous function. Instead of:
var offRegister = function() {
    ...
}
offRegister();

Try:
(function(){
    ...
})();

That way you don't stick a variable "offRegister" in the global namespace. In this case, doing so isn't a problem, but in general code that you want to reuse elsewhere is cleaner if it doesn't introduce new globals.


text:
Q: What is the radius of the circle?
Please help with this grade nine math problem.  How does one calculate the radius if the two sides of the right angle triangle are 85cm.  The sides of the triangle are tangent to the circle.

A:
Hint. $AD = DB = AF$ and $FC = OE = r$.

A:
It's useful to realize that the "left" and "right" radia, as drawn in the above picture, will be parallel to the respective cathetae.
Then you get:
$$C=\sqrt{A^2+A^2}=\sqrt{2}A$$
The height of the triangle is then:
$$h=\sqrt{A^2-\left(\frac{C}{2}\right)^2}=\sqrt{A^2-\frac{A^2}{2}}=\frac{1}{\sqrt{2}}A$$
Define x-axis along the base of the triangle and y-axis along the height.
Unit vectors at a 45° angle to the x-axis are given by:
$$\vec{u}_1=\frac{1}{\sqrt{2}}\left({1}\atop{1}\right)~~~~~,~~~~~\vec{u}_2=\frac{1}{\sqrt{2}}\left({1}\atop{-1}\right)$$
You can check $\vec{u}\cdot\vec{u}=1$.
Now use that the distance from any of the two 45° angles to the two nearest spots where the circle touches the triangle is the same, namely $C/2=A/\sqrt{2}$.
With this you can establish a vectorial relation between the following vectors:
$$h\vec{e}_y+\left(A-\frac{C}{2}\right)\vec{u}_2=R\vec{e}_y+R\vec{u}_1$$
Where $\vec{e}_y=(0,1)$ is the unit vector along the y-axis. This gives you two equations.
The y-axis equation is:
$$h-\frac{1}{\sqrt{2}}\left(A-\frac{C}{2}\right)=R+\frac{1}{\sqrt{2}}R\\\frac{A}{\sqrt{2}}-\frac{1}{\sqrt{2}}\left(A-\frac{A}{\sqrt{2}}\right)=\left(1+\frac{1}{\sqrt{2}}\right)R\\\frac{A}{2}=\left(1+\frac{1}{\sqrt{2}}\right)R\\R=\frac{A}{2+\sqrt{2}}$$
The x-axis equation is:
$$\frac{1}{\sqrt{2}}\left(A-\frac{C}{2}\right)=\frac{1}{\sqrt{2}}R\\\left(1-\frac{1}{\sqrt{2}}\right)A=R\\R=\frac{\left(1-\frac{1}{\sqrt{2}}\right)\left(2+\sqrt{2}\right)}{2+\sqrt{2}}A\\R=\frac{2-\sqrt{2}+\sqrt{2}-1}{2+\sqrt{2}}A\\R=\frac{A}{2+\sqrt{2}}$$
Both answers properly agree, so that the world is a happy and sunny place.

A: Hint : $A=rs$
where $A=\text{area},r=\text{inradius},s=\text{semiperimeter}$

A: Let $a\ (=85{\rm cm})$ be the length of the legs and $r$ the radius of the circle. Then
$${1\over2}\bigl(\sqrt{2}a\bigr)+r=a\ ,$$
which implies
$$r=\left(1-{\sqrt{2}\over2}\right)\>a\ .$$


text:
Q: Does jQuery support reading JSON from X-JSON HTTP headers? Is jQuery able to read JSON data from X-JSON HTTP headers returned by the server? I've been searching through the jQuery docs, but all the examples I can find use JSON returned in the request body rather than the headers.

A: Yes, you need to call the getResponseHeader method of the XMLHttpRequest object, and do the JSON de-serialization manually:
function getHeaderJSON(xhr) {
  var json;
  try { json = xhr.getResponseHeader('X-Json') }
  catch(e) {}

  if (json) {
    var data = eval('(' + json + ')'); // or JSON.parse or whatever you like
    return data
  }
}

Note that the try/catch is for some versions of Firefox where if the header is not present an error is thrown. I can't remember which version(s) were affected.
You have a couple ways to get a reference to the XMLHttpRequest object in jQuery:

*

*hook into the complete callback of the ajax request, as opposed to the expected success callback (jQuery is kind of inconsistent wrt to what args are passed in what order to what callback function or global ajax trigger):
$.ajax({
  // ...
  complete: function(xhr) {
    var data = getHeaderJSON(xhr);
    // do with data as you wish
  }
})

*Alternatively you can save a reference to the XMLHttpRequest object returned to you from calls to .ajax/.get/.post etc, via a Closure. This allows you to use it inside whatever callback you choose (ie success or complete, or error for that matter):
var xhr = $.ajax({
  // ...
  success: function() {
    var data = getHeaderJSON(xhr); // access xhr var via closure
    // do with data as you wish
  }
});

So to answer your title directly: no, jQUery obviously doesn't support this OOTB.

A: as of 1.4 jQuery's success: callback receives XMLHttpRequest -- (data,textStatus,XMLHttpRequest). So you don't have to use the complete: callback anymore, as laid out above.
Wish I could reply to the previous answer instead of adding a new answer.


text:
Q: Windows 2012 Service Shows as Degraded I wanted to ask does anyone know what the definition of a degraded service is?
I'm monitoring some systems using nagios and check_wmi_plus, it runs the following WMI query:
select name, displayname, Started, StartMode, State, Status FROM Win32_Service

The State comes back as running, but the Status as degraded for one particular service (an in house application that is known for crashing).
This status only seems to be mentioned in WMI so now I'm in a bit of a battle because from the front end everything seems fine but from the monitoring system we warn of the system being degraded, so any additional information on this problem and how to resolve it (other than just bouncing the service) would be great.
The most I've found is the service didn't close down correctly.
Many thanks.

A: In the check_wmi_plus change log for 1.62 the following was added:

Added some additional text when services were in a degraded state.
  Previously they were listed/counted as being "bad" but the display
  message was confusing as it still showed them as "running". Thanks to
  Paul Jobb.

According to Mircosoft a service in a "degraded" state is as follows:

"Service is working, but in a reduced state."


text:
Q: Interpolate points along a 3d line Although I outline the problem in R, answers in R and Python are welcome.
Suppose we have a set of points in x,y,z that define a discrete path (or set of connected line segments) over a vector of time t. These paths are not monotonic in z.
path <- data.frame(x = c(245, 233, 270, 400, 380),
                   y = c(245, 270, 138, 225, 300),
                   z = c(0, 1.2, 5, 3, 9),
                   t = 1:5)

plot3D::scatter3D(path$x, path$y, path$z, type = "b", bty = "g",
                  phi = 0, col = "red", pch = 20, ticktype = "detailed")

How can I interpolate along the path at some arbitrary resolution in z?
For example, say I wanted to retain a resolution in z of 1 unit. The points along z are 0, 1.2, 5, 3, 9. Therefore, one possible solution that satisfies this constraint is to interpolate at 1, 2, 3, 4, 4, 4, 5, 6, 7, 8 in the z direction, yielding the blue points in the figure below (labels indicate z location):

Ultimately, I would like the coordinates of the blue dots. We can brute force the solution by sequentially solving for the equation of the line in 3d for each pair of points z, and then interpolating along each line segment. However, I want to make sure I'm not missing some existing implementation or clever hack.

A: I used purrr::map just to tie it all together into a single tibble, but you could easily do them independently. The only problem is if your x or y is NOT monotonic over z. Then you'll need to do a fourth variable indicating row order, and it gets even more complicated from there.
library(dplyr)
library(purrr)
library(plotly)

path3d <- data.frame(
  x = c(245, 233, 270, 400, 380),
  y = c(245, 270, 138, 225, 300),
  z = c(0, 1.2, 3, 5, 9)
  )

path3d_interp <- list(
  x = approxfun(path3d$z, path3d$x),
  y = approxfun(path3d$z, path3d$y)
) %>%
  map(~.x(1:8)) %>% as_tibble() %>%
  mutate(z = 1:8)

      x     y     z
  <dbl> <dbl> <int>
1  235   266.     1
2  249.  211.     2
3  270   138      3
4  335   182.     4
5  400   225      5
6  395   244.     6
7  390   262.     7
8  385   281.     8

plot_ly(path3d) %>%
  add_paths(x = ~x, y = ~y, z = ~z) %>%
  add_markers(
    x = ~x, y = ~y, z = ~z,
    data = path3d_interp
    )

Updated for non-monotonic in z:
I can't think of an especially elegant way to predict x and y exactly if there isn't exactly 1 solution for each desired z. The general outline I'd suggest is creating a funX, funY, and funZ of each variable, as predicted by your time t. Then using a very high-resolution vector of new t values and subsetting it for funZ(new_t_values). You'll never get exactly to the values you're looking for, but you can approximate them to the desired arbitrary precision:
path3d <- data.frame(
  x = c(245, 233, 270, 400, 380),
  y = c(245, 270, 138, 225, 300),
  z = c(0, 1.2, 5, 3, 9),
  t = 1:5
  )

Just to get a good visual of what's going on here with respect to t:
library(ggplot2)
ggplot(path3d) +
  geom_path(aes(t, x), color = "blue") +
  geom_path(aes(t, y), color = "red") +
  geom_path(aes(t, z*50), color = "orange") +
  labs(y = "x, y, z*50")

This is looping over each column of path3d (x, y, z, and t) and creating a linear interpolation function for each variable against t as a predictor.
path3d_interp_funs <-
  map(path3d, ~approxfun(path3d$t, .x))

Inspect the full range of t:
Now we can make a high resolution vector across the entire range of t, here 1 million elements. You can increase this as much as your precision requires and your memory allows.
new_t_values <- seq(min(path3d$t), max(path3d$t), length.out = 1e6)

 1.000000 1.000004 1.000008 1.000012 1.000016 1.000020 ...

Generate the full path of z:
Now we see what the z values are for each possible t in the range.
z_candidates <- path3d_interp_funs$z(new_t_values)

0.000000e+00 4.800005e-06 9.600010e-06 1.440001e-05 1.920002e-05 2.400002e-05 ...

Test where approximate-z is closest to your desired z:
So now we take each desired value of z (1:8), and ask which element of the z_candidates vector has the smallest absolute deviation from it. This returns indices we can use to subset new_t_values.
t_indices <- map_dbl(1:8, ~which.min(abs(z_candidates-.x)))

208334 302632 750000 434211 500001 875000 916667 958333

A sanity check: do those chosen t values result in the zs you want?
path3d_interp_funs$z(new_t_values[t_indices])

0.9999994 1.9999958 3.0000020 3.9999986 4.9999960 5.9999970 7.0000060 7.9999910

Generate your desired data:
So let's loop over each of those approximating functions, evaluating each one at our new chosen values of t:
path3d_interp <-
  path3d_interp_funs %>%
  map(~.x(new_t_values[t_indices])) %>%
  as_tibble()

# A tibble: 8 x 4
      x     y     z     t
  <dbl> <dbl> <dbl> <dbl>
1  235.  266. 1.000  1.83
2  241.  242. 2.00   2.21
3  400.  225. 3.00   4.00
4  260.  173. 4.00   2.74
5  270.  138. 5.00   3.00
6  390.  262. 6.00   4.50
7  387.  275. 7.00   4.67
8  383.  287. 8.00   4.83

Visualize your results
You can check to make sure the points do indeed fall on the correct paths:
ggplot(path3d) +
  geom_path(aes(t, x), color = "blue") +
  geom_path(aes(t, y), color = "red") +
  geom_path(aes(t, z*50), color = "orange") +
  geom_point(data = path3d_interp, aes(t, x), color = "blue") +
  geom_point(data = path3d_interp, aes(t, y), color = "red") +
  geom_point(data = path3d_interp, aes(t, z*50), color = "orange") +
  geom_text(data = path3d_interp, aes(t, z*50, label = round(z))) +
  labs(y = "x, y, z*50")

And see them in 3D:
plot_ly(path3d) %>%
  add_paths(x = ~x, y = ~y, z = ~z) %>%
  add_markers(
    x = ~x, y = ~y, z = ~z,
    data = path3d_interp
    )  %>%
  add_text(
    x = ~x, y = ~y, z = ~z, text = ~round(z),
    data = path3d_interp
  )

Updated again:
At the risk of being way too long-winded, I was reminded of the uniroot function, which does a pretty good job of this backsolving:
t_solutions <- map(1:8,
  ~uniroot(
    function(x) path3d_interp_funs$z(x) - .x,
    interval = range(path3d$t)
  )
) %>% map_dbl("root")

  1.833333 2.210526 2.473684 2.736842 4.333333 4.500000 4.666667 4.833333

However, you may notice that these solutions aren't the same as the ones from the previous method!

uniroot found solutions closer to the extremes of the interval, and not in the local region where the function changes direction. But that brings up the issue that there may be multiple t values for each of your desired z values. So a more robust solution:
root_finder <- function(f, zero, range, cuts) {

  endpts <- seq(range[1], range[2], length.out = cuts+1)

  range_list <- map2(endpts[-(cuts+1)], endpts[-1], c)

  safe_root <- possibly(uniroot, otherwise = NULL)
  f0 <- function(x) f(x) - zero

  map(range_list, ~safe_root(f0, interval = .x, maxiter = 100)$root) %>%
    compact() %>%
    unlist() %>%
    unique()

}

This function takes a function, a new desired "zero" for uniroot to solve for, a range of values to test the function over, and how many buckets to divide that range into. Then it tests for a solution in each bucket, and returns NULL if none is found. It then throws out the NULLs and removes any duplicates (if a solution is exactly at the border of a bucket, for example).
root_finder(path3d_interp_funs$z, zero = 4, range = range(path3d$t), cuts = 10)

2.736842 3.500000 4.166667

Then you can loop over all your desired z values to find the value(s) of t that satisfy it.
t_solutions <- map(
    1:8,
    ~root_finder(path3d_interp_funs$z, zero = .x, range = range(path3d$t), cuts = 100)
  ) %>% unlist()

1.833333 2.210526 2.473684 4.000000 2.736842 3.500000 4.166667 3.000000 4.333333 4.500000 4.666667 4.833333

Then again passing these t values into each of the functions you created earlier, you can make a dataframe of all of them.
map(path3d_interp_funs, ~.x(t_solutions)) %>%
  as_tibble()

       x     y     z     t
   <dbl> <dbl> <dbl> <dbl>
 1  235   266.  1.    1.83
 2  241.  242.  2.    2.21
 3  251.  207.  3.    2.47
 4  400   225   3     4
 5  260.  173.  4     2.74
 6  335   182.  4     3.5
 7  397.  238.  4.    4.17
 8  270   138   5     3
 9  393.  250.  5.00  4.33
10  390   262.  6     4.5
11  387.  275   7.    4.67
12  383.  288.  8.00  4.83


text:
Q: Merging the two leftmost column at the end of a Table A frustrated \LaTeX user here. I want to merge the end of my table so the "terrain correction uncertainty" get merged with cell below the "No." column.

What I want:

What I have done is this:
\begin{table} [!htb]
    \caption{Summary of uncertainties in the AVF Bouguer anomaly data}
    \medskip
    \centering
    \begin{tabular}{| m{23pt} | m{180pt}| m{180pt} |}
        \hline
        \rowcolor{black!30}
        \rule[-1ex]{0pt}{2.5ex} \Centering \bfseries No.
        & \Centering \bfseries Source of Uncertainty & \Centering \bfseries Estimated Uncertainty (mGal)\\
        \hline
        \rule[-1ex]{0pt}{2.5ex}
        \Centering 1 & \makecell[l]{ Latitude correction \\ (horizontal positioning)} &\Centering $\pm0.05$ mGal \\
        \hline
        \rule[-1ex]{0pt}{2.5ex}
        \multicolumn{2}{c}{Terrain correction uncertainty} &\Centering $\pm0.03$ mGal \\
        \hline
    \end{tabular}
    \label{Tab:AVFUncertTable}
\end{table}

the \multicolumn at the end gives out "Misplaced \omit. ...umn{2}{c}{Terrain correction uncertainty}" error. All example that I read in StackExchange all give header merging. I need footer merging.
Please help.

A:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}

\usepackage[table]{xcolor}
\usepackage{makecell}
\renewcommand\theadfont{\bfseries}

\begin{document}
    \begin{table} [!htb]
        \caption{Summary of uncertainties in the AVF Bouguer anomaly data}
        \medskip
        \centering
        \begin{tabular}{m{23pt} m{180pt} m{180pt}}

            \rowcolor{black!30}

            \thead{No.}
                &  \thead{Source of Uncertainty}
                    & \thead{Estimated Uncertainty (mGal)}\\

            1 & \makecell[l]{ Latitude correction \\ (horizontal positioning)} & $\pm0.05$ mGal \\
            \hline

            \multicolumn{2}{r}{Terrain correction uncertainty} &$\pm0.03$ mGal \\
            \hline
        \end{tabular}
        \label{Tab:AVFUncertTable}
    \end{table}
\end{document}

A: With {NiceTabular} of nicematrix (with a advantage: the rules won't seem to disappear near the gray cells in some PDF readers at some levels of zoom).
\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\begin{table} [!htb]
\caption{Summary of uncertainties in the AVF Bouguer anomaly data}
\medskip
\centering
\begin{NiceTabular}{wc{23pt}m{180pt}wc{180pt}}%
  [hvlines,colortbl-like,cell-space-limits=3pt]
\rowcolor{black!30}
\bfseries No. & \centering \bfseries Source of Uncertainty &  \bfseries Estimated Uncertainty (mGal)\\
1 & \Block[l]{}{ Latitude correction \\ (horizontal positioning)} & $\pm0.05$ mGal \\
\Block[r]{1-2}{Terrain correction uncertainty} & & $\pm0.03$ mGal \\
\end{NiceTabular}
\label{Tab:AVFUncertTable}
\end{table}

\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes).

A: Your problem is solved by @Bernard comment, but in writting of your table use of the tabularray package can be quite handy:
\documentclass{article}
\usepackage[skip=1ex]{caption}
\usepackage{xcolor}
\usepackage{tabularray}

\usepackage{siunitx}

\begin{document}
\begin{table} [!htb]
    \caption{Summary of uncertainties in the AVF Bouguer anomaly data}
    \label{Tab:AVFUncertTable}
\centering
    \begin{tblr}{hlines, vlines,
                 colspec = {c X[l,m] X[c,m] },
                 rowsep=5pt,
                 row{1} = {font=\bfseries, bg=gray!50}
                }
No. & \SetCell[c=1]{c} Source of Uncertainty
            & \SetCell[c=1]{c} Estimated Uncertainty (mGal) \\
1   & {Latitude correction \\ (horizontal positioning)}
            & \qty{\pm0.05}{mGal}       \\
\SetCell[c=2]{r}    Terrain correction uncertainty
    &       & \qty{\pm0.03}{mGal}       \\
    \end{tblr}
\end{table}
\end{document}

Syntax of writing tabularray table is different than at standard tables. For details see package documentation.

*

*\SetCell[c=2]{r} is equivalent to \multicolumn{2}{r} ... command at standard tables

*\row{1} = {font=\bfseries, bg=gray!50} define font in the first row and background color


text:
Q: MyBatis dynamic ResultMap. How to return list of different POJO objects? MyBatis mapping issue.
Suppose we have a table USERS
CREATE TABLE USERS(
   USER_ID int(10) NOT NULL AUTO_INCREMENT,
   LOGIN varchar(100) NOT NULL,
   EMAIL varchar(255),
   SALARY int(10),
   AVG_SCORE int(10),
   PRIMARY KEY ( USER_ID )
);

And there are 3 POJO classes -
public class User {
    private Long id;
    private String login;
    private String email;

...getters/setters
}

and two more classes extending User
public class Student extends User {
    private Integer score;
...getters/setters
}

public class Teacher extends User {
    private Integer salary;
...getters/setters
}

and a mapper (I use XML but actually it does not matter).
<select id="selectAll" resultMap="<dynamicResultMapHere>">
    SELECT * FROM USERS
    <some conditions here>
</select>

I would like to get List<Teacher> or List<Student> instances depending on whether SALARY column is empty or not.
How to add the dynamic results filling?
Actually the case is more complicated. I somehow need to return different results depending on query parameters.

A: Check documentation about discriminator.
It will require a resultMap for specific fields of Student and Teacher referenced by a resultMap for User (for common fields) and a <discriminator> part.
A pseudo column will likely be required:
SELECT (CASE WHERE salary IS NULL THEN 1 ELSE 2 END) AS userType

and then
<discriminator javaType="int" column="userType">
    <case value="1" resultMap="studentResultMap" />
    <case value="2" resultMap="teacherResultMap" />
</discriminator>


text:
Q: Achieve same results with ToString() as with String.Format Can't figure out how to implement this task:
I need to format a decimal like this
 var formatted = String.Format("{0:G}%", numberOfDecimalType);

So, the result should be number formatted number with trailing % sign.
The problem is that I need to get this result using .ToString() method.
I've tried numberOfDecimalType.ToString("G%") and different other variants but it didn't help
Is it possible?

A: You won't be able to append the "%" to the end using a single ToString call; you'll need to format the decimal using ToString and then append the percent sign separately:
var formatted = numberOfDecimalType.ToString("G") + "%";

A: You can add literal characters by using a custom numeric format string:
var formatted = numberOfDecimalType.ToString(@"#,##0.##\%");

The backslash ensures that % is treated as a literal character rather than a special formatting instruction.
Note, though, that this is not an exact replacement of G, i.e., you might need to adjust the number of #s to accommodate for the required number of decimal places.

A: You could simply append the percent, couldn't you?
formatted = numberOfDecimalType.ToString("G") + "%";