RESULTS PI / PIP NOV 2019

Finalized 11/15/19 and waiting for more notifications. NY, USA YouTube Adsense Partner Publishing. Will keep everyone up to date. Happy Piping

Edit] I think this was posted in the wrong sub-thread. Adsense> Payments. Can someone clarify if this can be postponed, if so? Sorry and thanks !!

Use the JSON results from a SharePoint API search response

I'm using the SharePoint REST API to do a search. I pull back the JSON results and read them as follows:

HttpWebRequest endpointRequest = (HttpWebRequest)HttpWebRequest.Create(querystring);

endpointRequest.Method = "GET";
endpointRequest.Accept = "application/json; odata=verbose";
endpointRequest.UseDefaultCredentials = true;
HttpWebResponse endpointResponse =(HttpWebResponse)endpointRequest.GetResponse();

Stream webStream = endpointResponse.GetResponseStream();
StreamReader responseReader = new StreamReader(webStream);
var results = responseReader.ReadToEnd();

This works fine, I can see the results in JSON format. So in VS 2017 I created a class from the JSON and here are the classes that were created from the JSON (this was done automatically with File => Paste Special => Paste JSON As Classes:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class SharePointRESTResults
    {
        public class Rootobject
        {
            public D d { get; set; }
        }

        public class D
        {
            public Query query { get; set; }
        }

        public class Query
        {
            public __Metadata __metadata { get; set; }
            public int ElapsedTime { get; set; }
            public Primaryqueryresult PrimaryQueryResult { get; set; }
            public Properties1 Properties { get; set; }
            public Secondaryqueryresults SecondaryQueryResults { get; set; }
            public string SpellingSuggestion { get; set; }
            public Triggeredrules TriggeredRules { get; set; }
        }

        public class __Metadata
        {
            public string type { get; set; }
        }

        public class Primaryqueryresult
        {
            public __Metadata1 __metadata { get; set; }
            public Customresults CustomResults { get; set; }
            public string QueryId { get; set; }
            public string QueryRuleId { get; set; }
            public object RefinementResults { get; set; }
            public Relevantresults RelevantResults { get; set; }
            public object SpecialTermResults { get; set; }
        }

        public class __Metadata1
        {
            public string type { get; set; }
        }

        public class Customresults
        {
            public __Metadata2 __metadata { get; set; }
            public object() results { get; set; }
        }

        public class __Metadata2
        {
            public string type { get; set; }
        }

        public class Relevantresults
        {
            public __Metadata3 __metadata { get; set; }
            public object GroupTemplateId { get; set; }
            public object ItemTemplateId { get; set; }
            public Properties Properties { get; set; }
            public object ResultTitle { get; set; }
            public object ResultTitleUrl { get; set; }
            public int RowCount { get; set; }
            public Table Table { get; set; }
            public int TotalRows { get; set; }
            public int TotalRowsIncludingDuplicates { get; set; }
        }

        public class __Metadata3
        {
            public string type { get; set; }
        }

        public class Properties
        {
            public Result() results { get; set; }
        }

        public class Result
        {
            public __Metadata4 __metadata { get; set; }
            public string Key { get; set; }
            public string Value { get; set; }
            public string ValueType { get; set; }
        }

        public class __Metadata4
        {
            public string type { get; set; }
        }

        public class Table
        {
            public __Metadata5 __metadata { get; set; }
            public Rows Rows { get; set; }
        }

        public class __Metadata5
        {
            public string type { get; set; }
        }

        public class Rows
        {
            public Result1() results { get; set; }
        }

        public class Result1
        {
            public __Metadata6 __metadata { get; set; }
            public Cells Cells { get; set; }
        }

        public class __Metadata6
        {
            public string type { get; set; }
        }

        public class Cells
        {
            public Result2() results { get; set; }
        }

        public class Result2
        {
            public __Metadata7 __metadata { get; set; }
            public string Key { get; set; }
            public object Value { get; set; }
            public string ValueType { get; set; }
        }

        public class __Metadata7
        {
            public string type { get; set; }
        }

        public class Properties1
        {
            public Result3() results { get; set; }
        }

        public class Result3
        {
            public __Metadata8 __metadata { get; set; }
            public string Key { get; set; }
            public string Value { get; set; }
            public string ValueType { get; set; }
        }

        public class __Metadata8
        {
            public string type { get; set; }
        }

        public class Secondaryqueryresults
        {
            public __Metadata9 __metadata { get; set; }
            public object() results { get; set; }
        }

        public class __Metadata9
        {
            public string type { get; set; }
        }

        public class Triggeredrules
        {
            public __Metadata10 __metadata { get; set; }
            public object() results { get; set; }
        }

        public class __Metadata10
        {
            public string type { get; set; }
        }

    }
}

I'm trying to deserialize the results as follows:

 SharePointRESTResults resultX = JsonConvert.DeserializeObject(results());

It seems to be serialized, but I'm having trouble getting the class properties out. I have tried:

var y = resultX.(d).(query).(Primaryqueryresult).(Relevantresults).(Table).(Rows).(results).(0).(Cells).(results).(0).(Key);

to try to get the results, but I get the message "The name # d is not present in the current context". Has anyone tried to do this? Any help is greatly appreciated.

Game theory – a question about the results of the reverse induction

Thank you for your reply to Mathematics Stack Exchange!

  • Please be sure too answer the question, Provide details and share your research!

But avoid

  • Ask for help, clarify or respond to other answers.
  • Make statements based on opinions; Cover them with references or personal experience.

Use MathJax to format equations. Mathjax reference.

For more information, see our tips for writing great answers.

python – Best practice to ensure the connection and response of external API results

I have this code in python (With django Firmware) that connects to an external API and updates some values ​​in this service. Each step depends on the previous step (step 2 requires step 1 to return) True and so on (including a valid connection to the API). How can I ensure that all these steps are performed concurrently, and if a single step fails, how can I reset and run them in another attempt? Here is the code. Note that every class method in this external service does something.

# 1. add new value to account
if cls.add_balance(subscription_code, increase_amount):
# 2. set new base balance
if cls.set_topup_reset_action(
        subscription_code,
        new_base_balance,
):
    # 3. renew filters
    new_base_balance_20_percent = math.floor((Decimal(
        new_base_balance) * Decimal(20)) / Decimal(100))
    if cls.set_filter_80_percent(
            subscription_code,
            new_base_balance_20_percent,
    ) and cls.set_filter_100_percent(
        subscription_code,
    ):
        # 4. renew thresholds
        if cls.set_threshold_profile_80_percent(
                subscription_code,
        ) and cls.set_threshold_profile_100_percent(
            subscription_code,
        ):
            return True
return False

Drupal 7 Webform Dropdown, Switching from Multipe to One, Delivery View Does Not Display Multiple Results

I've created a web form with a component drop-down list in Drupal 7. I have several & # 39; selected for multiple selections. Now I have to deselect "Multiple" and give users only one choice in the drop-down list.

If you now display the delivery data, only the top selection will be displayed in the last data with multiple selection. How can I display the multiple selection in the past, although I only allow a selection in the component?

Applications – Simple Android calculator that gives wrong results

I just started learning Android app development. As a beginner project, I build a simple calculator app, but every time I execute it, all the other functions besides the addition function will give false results.
Here is the Java code I wrote. (MainActivity.java)

package com.example.calc;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
    TextView result; 
    EditText number1, number2;  
    Button add;
    Button sub;
    Button mul;
    Button div;

    public float result_num = 0;
    public int num1;
    public int num2;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        result = (TextView) findViewById(R.id.result);

        number1 = (EditText) findViewById(R.id.number1);
        number2 = (EditText) findViewById(R.id.number2);
        //numbers
        add = (Button) findViewById(R.id.add);
        sub = (Button) findViewById(R.id.sub);
        mul = (Button) findViewById(R.id.mul);
        div = (Button) findViewById(R.id.div);

        ///////////Calculation part///////////

        add.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                num1 = Integer.parseInt(number1.getText().toString());
                num2 = Integer.parseInt(number2.getText().toString());
                result_num = (num1 + num2);
                result.setText(String.valueOf(result_num));

            }
        });
        sub.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                num1 = Integer.parseInt(number1.getText().toString());
                num2 = Integer.parseInt(number1.getText().toString());
                result_num = (num1 - num2);
                result.setText(String.valueOf(result_num));
            }
        });
        mul.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                num1 = Integer.parseInt(number1.getText().toString());
                num2 = Integer.parseInt(number1.getText().toString());
                result_num = (num1 * num2);
                result.setText(String.valueOf(result_num));
            }
        });
        div.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                num1 = Integer.parseInt(number1.getText().toString());
                num2 = Integer.parseInt(number1.getText().toString());
                result_num = (num1 / num2);
                result.setText(String.valueOf(result_num));
            }
        });
    }
}

The XML code for the app. (Activity_main.xml)

I use a linear layout




    

    

    

    

Please help me.
Thanks.

Exchange Order – Pricing from Binance API trades / get_order results

I'm wondering how to calculate a price (per unit) for 1 order executed in 2 trades.

The 2 trades (GET / api / v3 / myTrades):

 {'commission': '0.00002301',
  'commissionAsset': 'BNB',
  'id': 536694,
  'isBestMatch': True,
  'isBuyer': False,
  'isMaker': False,
  'orderId': 23456244,
  'orderListId': -1,
  'price': '0.01023100',
  'qty': '3.00000000',
  'quoteQty': '0.03069300',
  'symbol': 'WABIBNB',
  'time': 1573580584514},
 {'commission': '0.00019020',
  'commissionAsset': 'BNB',
  'id': 536695,
  'isBestMatch': True,
  'isBuyer': False,
  'isMaker': False,
  'orderId': 23456244,
  'orderListId': -1,
  'price': '0.01014400',
  'qty': '25.00000000',
  'quoteQty': '0.25360000',
  'symbol': 'WABIBNB',
  'time': 1573580584514})

The order: (GET / api / v3 / order):

{'clientOrderId': 'vt0wm640c8DFewafYyrqnW',
 'cummulativeQuoteQty': '0.28429300',
 'executedQty': '28.00000000',
 'icebergQty': '0.00000000',
 'isWorking': True,
 'orderId': 23456244,
 'orderListId': -1,
 'origQty': '28.00000000',
 'origQuoteOrderQty': '0.00000000',
 'price': '0.01013600',
 'side': 'SELL',
 'status': 'FILLED',
 'stopPrice': '0.01032200',
 'symbol': 'WABIBNB',
 'time': 1573580483202,
 'timeInForce': 'GTC',
 'type': 'STOP_LOSS_LIMIT',
 'updateTime': 1573580584514}

I calculated the price with that cummulativeQuoteQty and divide it by executedQty, leads to 0.01015332,

But honestly, I was never so sure about that and now I saw that TabTrader was displaying a price of 0.010187,

My question is: How should you proceed exactly if the price should be used for the determination of profits?

PS. Taking the quantity-weighted prices out of the market leads to another value:

ipdb> weigted_price_from_trades = (0.01023100 * 3 + 28 * 0.01014400) / 28.
0.011240178571428573