text:
Q: SEARCH PEOPLE NEARBY I am developing a Tinder-like app and I would need some advice on how to start searching for people nearby (obviously they have to be part of my database so be registered).
As a database I used Firebase. I have already created the Registration page, Login, Personal Settings, Insert photos, city and description, delete account etc ..
I would like to create on the Home page some cards of the people sought, simply filtered by Gender, Age and distance in Km. This is the Settings page:
SETTINGS XML:
 <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/whiteshadowbackground">

    <Button
        android:id="@+id/back_settings"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginLeft="16dp"
        android:layout_marginTop="636dp"
        android:layout_marginEnd="16dp"
        android:layout_marginRight="16dp"
        android:text="BACK"
        app:backgroundTint="#7C0F0F"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <SeekBar
        android:id="@+id/setDistance"
        style="@style/Widget.AppCompat.SeekBar"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginStart="16dp"
        android:layout_marginLeft="16dp"
        android:layout_marginTop="112dp"
        android:layout_marginEnd="16dp"
        android:layout_marginRight="16dp"
        android:max="1000"
        android:progress="100"
        android:scaleX="2"
        android:scaleY="2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <com.google.android.material.slider.RangeSlider
        android:id="@+id/agespinner"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:valueTo="90"
        android:valueFrom="18"
        app:values="@array/agechoice"
        android:stepSize="1"
        android:progress="18"
        android:min="18"
        android:max="90"
        android:scaleX="2"
        android:scaleY="2"
        app:tickVisible="false"
        app:trackColorActive="#9F1309"
        app:trackColorInactive="#9C9C9C"
        app:haloColor="#9C9C9C"
        app:thumbColor="@color/white"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.502"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/agetext" />

    <TextView
        android:id="@+id/SetDistanceFont"
        android:layout_width="198dp"
        android:layout_height="22dp"
        android:layout_marginStart="32dp"
        android:layout_marginLeft="32dp"
        android:layout_marginEnd="32dp"
        android:layout_marginRight="32dp"
        android:layout_marginBottom="24dp"
        android:fontFamily="@font/aclonica"
        android:text="Maximum Distance"
        android:textSize="18sp"
        app:layout_constraintBottom_toTopOf="@+id/setDistance"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.013"
        app:layout_constraintStart_toStartOf="parent" />

    <TextView
        android:id="@+id/Distance"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="245dp"
        android:layout_marginLeft="245dp"
        android:layout_marginBottom="44dp"
        android:text="KM"
        app:layout_constraintBottom_toBottomOf="@+id/setDistance"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="@+id/SetDistanceFont" />

    <TextView
        android:id="@+id/Gendertext"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:fontFamily="@font/aclonica"
        android:text="Gender"
        android:textSize="18sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.096"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/setDistance" />

    <Spinner
        android:id="@+id/spinner"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.779"
        app:layout_constraintStart_toEndOf="@+id/Gendertext"
        app:layout_constraintTop_toBottomOf="@+id/setDistance" />

    <TextView
        android:id="@+id/agetext"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="44dp"
        android:fontFamily="@font/aclonica"
        android:text="Age"
        android:textSize="18sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.093"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/Gendertext" />

</androidx.constraintlayout.widget.ConstraintLayout>

JAVA SETTINGS:
    package com.example.authenticatorapp;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.SeekBar;
import android.widget.Spinner;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.google.android.material.slider.RangeSlider;
import com.google.android.material.slider.RangeSlider.OnChangeListener;
import com.google.firebase.auth.FirebaseAuth;

public class Settings extends AppCompatActivity implements AdapterView.OnItemSelectedListener {

    FirebaseAuth auth;
    Button back_settings;
    SeekBar setDistance;
    TextView Distance;
    Spinner spinner;
    RangeSlider agespinner;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_settings);

        back_settings = findViewById(R.id.back_settings);
        setDistance = findViewById(R.id.setDistance);
        Distance = findViewById(R.id.Distance);
        spinner = findViewById(R.id.spinner);
        agespinner = findViewById(R.id.agespinner);

        //SETTARE LA DISTANZA
        setDistance.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                Distance.setText(String.valueOf(progress) + "KM");
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {

            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {

            }
        });

        //SETTARE L'ETA'
           // RangeSlider.OnChangeListener(new RangeSlider.OnChangeListener()){
                //slider.getValues() is returning an array of the (thumb-)values.

        //SETTARE IL SESSO
        //CREA L'ARRAY DEFINITO IN RESOURCES>VALUES>STRING E LO COLLEGA ALLO SPINNER
        ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,R.array.genderchoice, android.R.layout.simple_spinner_item);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(adapter);
        spinner.setOnItemSelectedListener(this);

        //CLICK SUL BOTTONE BACK PROFILO
        back_settings.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v) {
                startActivity(new Intent(getApplicationContext(),Profile.class));
            }
        });

    }

    //L'ADAPTER DELL'INTERFACCIA PER IL SESSO,PRENDE IL VALORE E LO METTE IN UNA STRINGA
    @Override
    public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    String sesso = parent.getItemAtPosition(position).toString();
    }

    @Override
    public void onNothingSelected(AdapterView<?> parent) {

    }
}

Anyone have any ideas? I thank you in advance!! :)


text:
Q: Issue loading the backbone view for the first time I want to load one of my javascript automatically on the load of my html page.
The html page on load of which I want to load my js file.
<!DOCTYPE html>

    <meta charset="ISO-8859-1">
    <title>Insert title here</title>

Backbone Tutorial Blogroll App

        <button type="button" id="newButton">Click Me!</button>

The javascript I want to load is
LoadView.js
define([
        'jquery',
        'underscore',
        'backbone',
        'LoadView',
        'text!NewViewCheck.html',

        ], function($, _, Backbone, LoadView, NewViewCheck) {
    var Task = Backbone.Model.extend({
        defaults: {}
    });
    TheView = Backbone.View.extend({
        model: new Task(),
        events: {
            'click #newButton': 'initializeView',
        },
        //'template' provides access to instance data when rendering the view
        template: _.template(NewViewCheck),
        initialize: function() {
            console.log('Inside the initialize function');
            this.render();
        },
        render: function() {
            //this.$el.html(this.template());
            console.log(labelsLocale);
            this.$el.html(this.template({}));
            $('#dialogContent').empty().append(this.$el);
            $('#addUserDefinedOption').modal('show');
        },
        initializeView: function() {
            var theView = new TheView();
            console.log('abc');
        },
    });
    $(document).ready(function() {
        //console.log('abc');
    })
});

I am getting the following error
Uncaught Error: Mismatched anonymous define() module
Please help me thanks in advance.

A: The error is because you have:

The docs says:

If you manually code a script tag in HTML to load a script with an anonymous define() call, this error can occur.

And that's what you're doing.
And in solutions:

*

*Be sure to load all scripts that call define() via the RequireJS API. Do not manually code script tags in HTML to load scripts that have define() calls in them.

*If you manually code an HTML script tag, be sure it only includes named modules, and that an anonymous module that will have the same name as one of the modules in that file is not loaded.

So simply load it using requireJS from your main file or name the module

redpajama_set_name: RedPajamaStackExchange


text:
Q: Heroku-18 w/ .NET Core GDI+: Unable to load DLL 'libgdiplus': The specified module could not be found Since upgrading from Heroku-16 to Heroku-18 stack, my .NET Core 2.2 App that references System.Drawing.Common to use GDI+ throws the error:
System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
--->System.DllNotFoundException: Unable to load DLL 'libgdiplus': The specified module could not be found.
at System.Runtime.InteropServices.FunctionWrapper `1.get_Delegate()
 at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
 at System.Drawing.SafeNativeMethods.Gdip..cctor()

This is because libc6-dev is not installed (see this issue). I'm using heroku-buildpack-apt to install both libgdiplus and libc6-dev), but it appears that the package is no longer available at runtime on Heroku-18, only at build time (see this page).
From the build log:
remote: -----> Fetching .debs for libc6-dev
remote:        Reading package lists...
remote:        Building dependency tree...
remote:        Reinstallation of libc6-dev is not possible, it cannot be downloaded.
remote:        0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Reverting back to Heroku-16 solves the issue.
How can this I make this work on the Heroku-18 stack?? Anyone found a way?

A: From Heroku support:

I am really sorry for the trouble but it will not be possible in my view. This package libc6-dev2.27-3ubuntu1 means that the package is available only at build time, but not at runtime. Moreover if you have some requirement you can check https://elements.heroku.com/buildpacks/eugeneotto/heroku-buildpack-secp256k1 but this is not officially supported buildpack and we do not provide support for this.

A: .NET Core 3.x, together with the latest version of System.Drawing.Common, contain fixes which remove the dependency on libc6-dev.
If installing libc6-dev is not possible, you can try to:

*

*Upgrade to .NET Core 3.0

*Upgrade to libgdiplus 4.6.0 or later (I'd recommend 4.7.0)


text:
Q: Mathematica implementations of classical genetic algorithm optimization Are there any Mathematica implementations of genetic algorithm optimization routines, including third-party and commercial? (DifferentialEvolution isn't quite what is required.) Also, more generally, are there any Mathematica libraries/depositories?

A: The 'classic' text on GAs, and much more, with code, is Jacob, Illustrating Evolutionary Computation with Mathematica. https://read.amazon.com/kp/embed?asin=B00BCRB6JO&preview=newtab&linkCode=kpe&ref_=cm_sw_r_kb_dp_08NE06RNH7T0DWF35EVW


text:
Q: Handle Azure Devops pipeline resource over rest api I have an Azure DevOps pipeline with the resource section is given below
resources:
  repositories:
  - repository: test
    type: git
    name: Hackfest/template
  pipelines:
  - pipeline: Build
    source: mybuild
    branch: main
    # version:  # Latest by default
    trigger:
      branches:
        include:
        - main

I'm trying to invoke the pipeline using a rest api call. The body of the rest api call is given  below
    $body='{
    "definition": {            "id": "3321"        },
     "resources": {
       "pipelines": {
         "Build": {
            "version": "20220304.15",
            "source": "mybuild"
           }
          }
        },
    "sourceBranch": "main"

}'
With the above json string I'm able to invoke the pipeline build, but it is not picking the artifacts from version 20220304.15 of the build "mybuild". Rather it is taking the latest artifact version of mybuild and starting the build.
How I should modify the above body string to pick the correct version of the "mybuild"?

A: With the Runs - Run Pipeline this is worked for me:
"resources":  {
                  "repositories":  {
                                       "self":  {
                                                    "refName":  "refs/heads/dev"
                                                }
                                   },
                  "pipelines":  {
                                    "Build":  {
                                                         "version":  "Build_202203040100.1"
                                                     }
                                }
              }


text:
Q: KendoUI Treeview expand nodes based on value I have a kenodui treeview that I am trying to expand the top level nodes if they have the following values: "Active" or "Closed", the remaining nodes can remain closed. I am using the following code to create my treeview:
if (CI.Popup.treeview == null) {
        CI.Popup.treeview = $("#RelatedPropertyListing").kendoTreeView({
            template: "#= item.Name #",
            dataImageUrlField: "image",
            dataSource: CI.Popup.treeDS,
            dataTextField: ["Name", "Name"],
            encoded: true
        }).data("kendoTreeView");
    }

My datasource is defined as a json kendo.data.HierarchicalDataSource. I have tried generating the treeview using html instead of a datasource but it was unbareably slow so I have to use this method.
Any ideas how I can expand only those nodes that have a value of "Active" or "Closed"???
Thanks in advance for any help.

A: If you can slightly change your returned data, you can set expanded to true for each node that you want expanded and KendoUI will automatically take care of it.
Example:
var data = [
    {
        text    : "node 1",
        expanded: true,
        items   : [
            { text: "node 1.1" },
            {
                text    : "node 1.2",
                expanded: false,
                items   : [
                    { text: "node 1.2.1" },
                    { text: "node 1.2.2" },
                    { text: "node 1.2.3" }
                ]
            },
            { text: "node 1.3" }
        ]
    }
];

var treeview = $("#treeview-left").kendoTreeView({
    dataSource  : data,
    loadOnDemand: true
}).data("kendoTreeView");

JSFiddle in here


text:
Q: @Scheduled and @Async are sharing same threadpool in spring-boot I have configured two different thread pools, one for @Scheduled and other for @Async. However, I notice that the thread-pool for @Async is not being used.
Here is the Scheduler configuration
@Configuration
@EnableScheduling
public class SchedulerConfig implements SchedulingConfigurer {
    private final int POOL_SIZE = 10;

    @Override
    public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
        ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
        threadPoolTaskScheduler.setPoolSize(POOL_SIZE);
        threadPoolTaskScheduler.setThreadNamePrefix("my-sched-pool-");
        threadPoolTaskScheduler.initialize();
        scheduledTaskRegistrar.setTaskScheduler(threadPoolTaskScheduler);
    }
}

Here is the Configuration for Async
@Configuration
@EnableAsync
public class AppConfig {

 @Bean(name = "asyncTaskExecutor")
    public TaskExecutor asyncExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(15);
        executor.setMaxPoolSize(15);
        executor.setQueueCapacity(100);
        executor.setThreadNamePrefix("my-async-pool-");
        executor.initialize();
        return executor;
    }
}

Here is how I invoke them
@Scheduled(fixedRateString = "2000" )
    public void schedule() {
      log.debug("here is the message from schedule");
      asyncMethod();
    }

@Async("asyncTaskExecutor")
public void asyncMethod(){
  log.info("here is the message from async");
}

Here are the logs
{"thread":"my-sched-pool-1","level":"DEBUG","description":"here is the message from schedule"}
{"thread":"my-sched-pool-1","level":"INFO","description":"here is the message from async"}

As you can notice, both logs are having same pool of that scheduler. but I expect to see the second one to come from async

A: If you call @Async methods from the same class they are declared you are effectively bypassing Spring's proxy mechanism and that is why your example is not working. Try calling the method from a separate class annotated with @Service or any of the other @Component types.
@Service
SomeScheduledClass {

  private final SomeAsyncClass someAsyncClass;

  public SomeScheduledClass(SomeAsyncClass someAsyncClass) {
    this.someAsyncClass = someAsyncClass;
  }

  @Scheduled(fixedRateString = "2000" )
  public void schedule() {
    log.debug("here is the message from schedule");
    someAsyncClass.asyncMethod();
  }
}

@Service
SomeAsyncClass {
  @Async("asyncTaskExecutor")
  public void asyncMethod(){
    log.info("here is the message from async");
  }
}


text:
Q: Work e-mail edit/delete of a user in SharePoint 2016 I Want to delete a particular email address using REST API for a user as the owner have left the org and the email is bouncing with delivery failed error message.
Cant delete entire user as used in workflow.

A: You can use PowerShell to disable or delete a mailbox for a user.
Disable or delete a mailbox in Exchange Server for your reference:
https://docs.microsoft.com/en-us/exchange/recipients/disconnected-mailboxes/disable-or-delete-mailboxes?view=exchserver-2019


text:
Q: Applications of Gauss sums For proving the quadratic reciprocity, Gauss sums are very useful. However this seems an ad-hoc construction. Is this useful in a wider context? What are some other uses for Gauss sums?

A: They are also used to describe something called the Talbot Effect:
http://www.phy.bris.ac.uk/people/berry_mv/research.html
look at #8 in the list. I attended a seminar by Mike Berry about 12 years ago where he claimed that the Talbot Effect was a physical manifestation of Gauss Sums.

A: Gauss sums and exponential sums in general are particularly useful for determining the size of certain algebraic varieties in finite fields or even in general abelian groups.  If one defines
$$
A_t = \{x \in \mathbb{F}_q^d : f(x) = t\}
$$
where $t \in \mathbb{F}_q\setminus\{0\}$, then by orthogonality we have
$$
|A_t| = q^{-1} \sum_{s \in \mathbb{F}_q} \sum_{x \in \mathbb{F}_q^d} \chi(s (f(x) - t)),
$$
where $\chi$ is any nontrivial additive character on $\mathbb{F}_q$.
For example, if one considers $x = (x_1, \dots , x_d) \in \mathbb{F}_q^d$ and defines $f(x) = x_1^2 + \dots + x_d^2$, then $A_t$ would be some finite field analogue of a sphere.  Bounding such a set would then be equivalent to bounding
$$
q^{-1}\sum_{s \in \mathbb{F}_q} \left(\sum_{x \in \mathbb{F}_q} \chi(sx^2) \right)^d \chi(-st).
$$
Gauss Sums and in particular well-known bounds for Gauss sums imply that such a sum is of size $q^{d-1}(1 + o_d(1))$ as $q \to \infty$.
As Qiaochu points out above, such bounds are nice to have when one works with the discrete Fourier transform.

A: Srinivasa Ramanujan actually had discovered some definite integral formulas related to the Gauss sums. Please see the below article:

*

*Some definite integrals connected with Gauss sums. Messenger of Mathematics XLIV, $1915$, $75-85$

From Wikipedia: ( Sorry, I can't explain this.)

*

*The absolute value of Gauss sums is usually found as an application of Plancherel's theorem on finite groups.

Another application of the Gauss sum: How to prove that: $\tan(3\pi/11) + 4\sin(2\pi/11) = \sqrt{11}$

*

*http://www.isibang.ac.in/~sury/luckyoct10.pdf

A: A small additional note, in line with an earlier answer: Gauss sums are, literally, the Lagrange resolvents obtained in the course of expressing roots of unity in terms of radicals. (Yes, then the Kummer-Stickelberger business can be used to effectively obtain the actual radical expressions...:  here .)

A: Gauss sums are not an ad-hoc construction!  I know two ways to motivate the definition, one of which requires that you know a little Galois theory and the other which is totally mysterious to me.
Here is the Galois-theoretic explanation.  Let $\zeta_p$ be a primitive $p^{th}$ root of unity, for $p$ prime.  The cyclotomic field $\mathbb{Q}(\zeta_p)$ is Galois, so one can define its Galois group, the group of all field automorphisms which preserve $\mathbb{Q}$.  Such an automorphism is determined by what it does to $\zeta_p$, and it must send $\zeta_p$ to another primitive $p^{th}$ root of unity.  It follows that the Galois group $G = \text{Gal}(\mathbb{Q}(\zeta_p)/\mathbb{Q})$ is isomorphic to $(\mathbb{Z}/p\mathbb{Z})^{\times}$, which is cyclic of order $p-1$.
Now suppose $p$ is odd.  As a cyclic group of even order, $G$ has a unique subgroup $H$ of index two given precisely by the multiplicative group of quadratic residues $\bmod p$, so by the fundamental theorem of Galois theory the fixed field $\mathbb{Q}(\zeta_p)^H$ is the unique quadratic subextension of $\mathbb{Q}(\zeta_p)$.  And it's not hard to see that this unique quadratic subextension must be generated by
$$\sum_{\sigma \in H} \sigma(\zeta_p) = \sum_{a \text{ is a QR}} \zeta_p^a = \frac{1}{2} \left( \sum_{a=1}^{p-1} \zeta_p^{a^2} \right)$$
which you will of course recognize as a Gauss sum!  So the Gauss sum generates a quadratic subextension, and any of various methods will tell you that this subextension is precisely $\mathbb{Q}(\sqrt{p^{\ast}})$ where $p^{\ast} = (-1)^{ \frac{p-1}{2} } p$.  (This does not actually require any computation: if you know enough algebraic number theory, it follows from a consideration of which primes ramify in cyclotomic extensions.)
The totally mysterious explanation is that Gauss sums naturally appear when you start thinking about the discrete Fourier transform.  For example, the trace of the DFT matrix is a Gauss sum.  But more mysteriously, Gauss sums are eigenfunctions of the DFT in a certain sense.  (I sketch how this works here.)  There is a sort of mysterious connection here to the Gaussian distribution, which is an eigenfunction of the continuous Fourier transform; see this MO question.  Again, I don't know what to make of this.  There is a book by Berg called The Fourier-analytic proof of quadratic reciprocity and it may or may not be about this construction.

A: Not just quadratic reciprocity, one can use them to prove higher
reciprocity laws: see Ireland and Rosen's A Classical Introduction
to Modern Number Theory. They also turn up in the functional
equation for Dirichlet L-functions (and are massively generalized in the
topic of root numbers).

A: It can be used to prove a certain theorem called the Stickelberger's theorem, the likes of which can in turn be used for proving things like Catalan's Conjecture.


text:
Q: Dial up connection using vb6 Currently I'm developing a real-time stock market price list grabber in classic vb6 which will connect to the internet if there is no active internet connection. for internet connection process I used the code below using rasapi32.dll, But unfortunately it always returns ERROR CODE :- 621, The phone-book cannot be opened.
THE CODE IS
'This program let you dial to your dial-up connections using whether
'the stored user name and password or  the ones you specifies
'(It use RasDial for dialing)
'You need a form with a list,2 textbox and a command button
Option Explicit

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, ByVal pSrc As String, ByVal ByteLen As Long)
Private Declare Sub ZeroMemory Lib "kernel32.dll" Alias "RtlZeroMemory" (Destination As Any, ByVal Length As Long)
Const RAS95_MaxEntryName = 256
Const RAS_MaxPhoneNumber = 128
Const RAS_MaxCallbackNumber = RAS_MaxPhoneNumber
Const UNLEN = 256
Const PWLEN = 256
Const DNLEN = 12
Private Type RASDIALPARAMS
   dwSize As Long ' 1052
   szEntryName(RAS95_MaxEntryName) As Byte
   szPhoneNumber(RAS_MaxPhoneNumber) As Byte
   szCallbackNumber(RAS_MaxCallbackNumber) As Byte
   szUserName(UNLEN) As Byte
   szPassword(PWLEN) As Byte
   szDomain(DNLEN) As Bytehttp://stackoverflow.com/questions/1361069/how-can-i-access-hidden-class-variables-in-vb6
End Type
Private Type RASENTRYNAME95
    'set dwsize to 264
    dwSize As Long
    szEntryName(RAS95_MaxEntryName) As Byte
End Type
Private Declare Function RasDial Lib "rasapi32.dll" Alias "RasDialA" (ByVal lprasdialextensions As Long, ByVal lpcstr As String, ByRef lprasdialparamsa As RASDIALPARAMS, ByVal dword As Long, lpvoid As Any, ByRef lphrasconn As Long) As Long
Private Declare Function RasEnumEntries Lib "rasapi32.dll" Alias "RasEnumEntriesA" (ByVal reserved As String, ByVal lpszPhonebook As String, lprasentryname As Any, lpcb As Long, lpcEntries As Long) As Long
Private Declare Function RasGetEntryDialParams Lib "rasapi32.dll" Alias "RasGetEntryDialParamsA" (ByVal lpcstr As String, ByRef lprasdialparamsa As RASDIALPARAMS, ByRef lpbool As Long) As Long

Private Function Dial(ByVal Connection As String, ByVal UserName As String, ByVal Password As String) As Boolean
    **Dim rp As RASDIALPARAMS, h As Long, resp As Long**
    rp.dwSize = Len(rp) + 6
    ChangeBytes Connection, rp.szEntryName
    ChangeBytes "", rp.szPhoneNumber 'Phone number stored for the connection
    ChangeBytes "*", rp.szCallbackNumber 'Callback number stored for the connection
    ChangeBytes UserName, rp.szUserName
    ChangeBytes Password, rp.szPassword
    ChangeBytes "*", rp.szDomain 'Domain stored for the connection
    'Dial
    resp = RasDial(ByVal 0, ByVal 0, rp, 0, ByVal 0, h)    'AddressOf RasDialFunc
    MsgBox resp
    Dial = (resp = 0)
End Function

Private Function ChangeToStringUni(Bytes() As Byte) As String
    'Changes an byte array  to a Visual Basic unicode string
    Dim temp As String
    temp = StrConv(Bytes, vbUnicode)
    ChangeToStringUni = Left(temp, InStr(temp, Chr(0)) - 1)
End Function

Private Function ChangeBytes(ByVal str As String, Bytes() As Byte) As Boolean
    'Changes a Visual Basic unicode string to an byte array
    'Returns True if it truncates str
    Dim lenBs As Long 'length of the byte array
    Dim lenStr As Long 'length of the string
    lenBs = UBound(Bytes) - LBound(Bytes)
    lenStr = LenB(StrConv(str, vbFromUnicode))
    If lenBs > lenStr Then
        CopyMemory Bytes(0), str, lenStr
        ZeroMemory Bytes(lenStr), lenBs - lenStr
    ElseIf lenBs = lenStr Then
        CopyMemory Bytes(0), str, lenStr
    Else
        CopyMemory Bytes(0), str, lenBs 'Queda truncado
        ChangeBytes = True
    End If
End Function

Private Sub Command1_Click()
    Dial List1.Text, Text1, Text2
End Sub

Private Sub List1_Click()
    Dim rdp As RASDIALPARAMS, t As Long
    rdp.dwSize = Len(rdp) + 6
    ChangeBytes List1.Text, rdp.szEntryName
    'Get User name and password for the connection
    t = RasGetEntryDialParams(List1.Text, rdp, 0)
    If t = 0 Then
        Text1 = ChangeToStringUni(rdp.szUserName)
        Text2 = ChangeToStringUni(rdp.szPassword)
    End If
End Sub

Private Sub Form_Load()
    'example created by Daniel Kaufmann (daniel@i.com.uy)
    'load the connections
    Text2.PasswordChar = "*"
    Command1.Caption = "Dial"
    Dim s As Long, l As Long, ln As Long, a$
    ReDim r(255) As RASENTRYNAME95

    r(0).dwSize = 264
    s = 256 * r(0).dwSize
    l = RasEnumEntries(vbNullString, vbNullString, r(0), s, ln)
    For l = 0 To ln - 1
        a$ = StrConv(r(l).szEntryName(), vbUnicode)
        List1.AddItem Left$(a$, InStr(a$, Chr$(0)) - 1)
    Next
    If List1.ListCount > 0 Then
        List1.ListIndex = 0
        List1_Click
    End If
End Sub

Please help me

A: This may be no help at all, but googling turned up several suggestions that there may be missing components or a corrupt phonebook: Error 621: Cannot Open Phonebook


text:
Q: Is there any way to refresh an embed as if the user has sent the command again after 3 seconds in discord.js? I am actually working on a discord.js music bot and I want to the progress bar to edit after every 3 seconds until the song ends so is there any way to do that?
I have searched about this all over the internet but didn't found any answers..
my code:
module.exports = {
    name: 'nowplaying',
    aliases: ['np'],
    category: 'Music',
    utilisation: '{prefix}nowplaying',

    execute(client, message) {
        if (!message.member.voice.channel) return message.channel.send(`${client.emotes.error} - You're not in a voice channel !`);

        if (message.guild.me.voice.channel && message.member.voice.channel.id !== message.guild.me.voice.channel.id) return message.channel.send(`${client.emotes.error} - You are not in the same voice channel !`);

        if (!client.player.getQueue(message)) return message.channel.send(`${client.emotes.error} - No music currently playing !`);

        const track = client.player.nowPlaying(message);
        const filters = [];

        Object.keys(client.player.getQueue(message).filters).forEach((filterName) => client.player.getQueue(message).filters[filterName]) ? filters.push(filterName) : false;

        message.channel.send({
            embed: {
                color: 'RED',
                author: { name: track.title },
                footer: { text: 'Developed by Haruke#6969' },
                fields: [
                    { name: 'Channel', value: track.author, inline: true },
                    { name: 'Requested by', value: track.requestedBy.username, inline: true },
                    { name: 'From playlist', value: track.fromPlaylist ? 'Yes' : 'No', inline: true },

                    { name: 'Views', value: track.views, inline: true },
                    { name: 'Duration', value: track.duration, inline: true },
                    { name: 'Filters activated', value: filters.length + '/' + client.filters.length, inline: true },

                    { name: 'Volume', value: client.player.getQueue(message).volume, inline: true },
                    { name: 'Repeat mode', value: client.player.getQueue(message).repeatMode ? 'Yes' : 'No', inline: true },
                    { name: 'Currently paused', value: client.player.getQueue(message).paused ? 'Yes' : 'No', inline: true },

                    { name: 'Progress bar', value: client.player.createProgressBar(message, { timecodes: true }), inline: true }
                ],
                thumbnail: { url: track.thumbnail },
                timestamp: new Date(),
            },
        });
    },
};

A: You can use .then and setInterval. You just need to continuously edit the embed every 3 seconds. Then remove the interval once the song ended.
let interval;
message.channel.send(/*...*/).then(m => {
interval = setInterval(() => {
if(!client.getQueue(m)) return clearInterval(interval);
m.edit(/*...*/)

        }, 3000)
})

Replace the /*...*/ with your send data (the {embed: {...}})

A: I can't rewrite your code completely without seeing more of the code, but try using a while loop and using the difference between the current time and the time the song started to check if the song is over, and edit embed every three seconds until it's over.
// ... the rest of your code above

const sleep = (milliseconds) => {
    return new Promise(resolve => setTimeout(resolve, milliseconds))
}

let songDuration = // whatever you'd use get song duration in seconds
let startTimestamp = Date.now()

while ((Date.now() - startTimestamp) / 1000 < songDuration) {
    // your code to edit the embed
    await sleep(3000) // make sure this executes async!
}


text:
Q: Is there a good way to wrap an existing Python based web application to require a login? I'm in the process of installing an open-source Python based web application to an internal server here at work.  The existing code is open - it doesn't require a login to view it - but one of the requirements is that users have to be approved before they can see anything.
Is there a good way (using Apache configuration files for example, but any method would be great) to wrap the application so that any access requires a login?  I would like to avoid modifying the open-source code (a maintenance nightmare every time a new release comes out).
Any thoughts or suggestions?

A: Apache supports Authentication, Authorization and Access Control.
It is a detailed process, and summarising it here would not do it justice. I refer you to the link provided,


text:
Q: Importing scss partials inside another scss partial can i import scss partials inside another scss partial? Eg- importing _abc.scss inside _xyz.scss

A: yes, with this simple code (syntax) : @import "anotherScssFile.scss";
Consider you have two scss files together, called config.scss and main.scss, if you want to import the config.scss file in main.scss, you can add this code in the first line of your main.scss :
@import "./config.scss"; /* this is what you want! */
.
.
.

in your case code must be like this (in _xyz.scss):
@import "path_to_abc_container_directory/_abc.scss";


text:
Q: External display color problem So I have a weird problem...

This only happens when I boot into macOS (10.14.4), when I boot into Win10 via bootcamp, everything is perfect and no color issues at all.
So this rules out any hardware problems.
I am not too familiar with macOS so maybe its just a user setting somewhere but the color options under display don't do anything to solve the issue.
Suggestions?

A: Here is the fix! It has to do with the EDID settings.
https://michaelcivitillo.com/overriding-edid-on-osx-for-external-monitors/


text:
Q: Adding DisplayName attribute dynamically in asp.net mvc4 I have an asp.net mvc4 razor form that contains a series of checkboxes.
The checkboxes are populated from a list that is generated dynamically. The list is in the below model:
public class UserViewModel
{
    [Required]
    [MaxLength(32)]
    [DataType(DataType.Text)]
    [DisplayName("ID")]
    public string UserId { get; set; }

    public List<SkillSetSelector> SkillSets { get; set; }
}

public class SkillSetSelector
{
    public string Code { get; set; }

    public string Description { get; set; }

    public bool Selected { get; set; }
}

I am then populating the checkboxes in the form thus:
    @for (int i = 0; i < Model.SkillSets.Count;i++ )
{

 @Html.CheckBoxFor(m => m.SkillSets[i]) @Model.SkillSets[i].Description

    }

My problem is that I would like to assign the DisplayName attribute of each checkbox dynamically. I.e. I want it to be the same value as Skillsets[i].Description. Currently when the model is sent back to the controller there is no was of knowing which item it each check box belongs to as the description is returned null - the selected value is correct but you have nothing except the order of the fields to tell you which item is which. Is there any way of doing this? The checkboxes have to be dynamic as the data they are based on is user definable.
Thanks.

A: DisplayName data annotation attributes require constant values. You cant set it dynamically.
But you can refer the values from Resource files or create your own Custom Model Meta Data Provider for this
Please check this Article for Custom Model MetaData Provider implementation

A: Thanks for your help Murali.
In the end I got around the problem of not knowing which item was what when it was sent back by adding a hidden textbox with the item's id:
@for (int i = 0; i < Model.SkillSets.Count;i++ )
{

@Html.CheckBoxFor(m => m.SkillSets[i].Selected) @Model.SkillSets[i].Description

@Html.TextBoxFor(m => m.SkillSets[i].ID, new {id = "custselecthidden" })

}

That way the ID was sent back in the model and I now know what is what.


text:
Q: Gated Content for assets in aem I need to create a gated content setup in aem. So basically, the page ( which contains some assets) should only be reachable after the user has submitted a form. And the assets should also be not accessible directly without submitting the form. So I have created a servlet filter to achieve this, the page logic works fine but when I access assets directly the request is not reaching the servlet filters. The below is my code please let me know if there is some mistake or there is any other preferred method, I have also tried setting this ServiceRanking(1)
@Component(service = Filter.class,
    property = {
            EngineConstants.SLING_FILTER_SCOPE + "=" + EngineConstants.FILTER_SCOPE_REQUEST,
    })
@ServiceRankin(-700)

public class GatedContentFilter implements Filter {

@Override
public void doFilter(final ServletRequest request, final ServletResponse response,
                     final FilterChain filterChain) throws IOException, ServletException {

    final SlingHttpServletRequest slingRequest = (SlingHttpServletRequest) request;

    final SlingHttpServletResponse slingResponse = (SlingHttpServletResponse) response;
    final Resource resource = slingRequest.getResource();

    if(resource.getPath().startsWith("/content/abc")) {
       //page logic
    }
    else if (resource.getPath().startsWith("/content/dam/abc/gated-assets")) {
        //assets logic
    }

    filterChain.doFilter(request, response);
}

@Override
public void init(FilterConfig filterConfig) {
}

@Override
public void destroy() {
}

}


text:
Q: I can't grab single characters by voice from the user in the GDK So I need to grab single characters from the user in google glass.  This is for entering passwords, captchas, spelling user names, etc.  I've tried using the sample code:
private static final int SPEECH_REQUEST = 0;

private void displaySpeechRecognizer() {
    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    startActivityForResult(intent, SPEECH_REQUEST);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == SPEECH_REQUEST && resultCode == RESULT_OK) {
        List<String> results = data.getStringArrayListExtra(
            RecognizerIntent.EXTRA_RESULTS);
        String spokenText = results.get(0);
        // Do something with spokenText.
    }
    super.onActivityResult(requestCode, resultCode, data);
}

But it seems to try and always interpret what I'm saying as words.  It works okay for numbers, but when trying to spell characters like a password, I get random results.

A: You could try using this method and passing in an array of letters, you can also run this within an activity so you could keep on the same page, just adding each letter to a view as it is heard and carry on listening until you it hears 'finish' or something similar.


text:
Q: Sublime build system to open file at local server address For a website I'm developing with the help of a local server (running at http://127.0.0.1:4000), I try to write a build system for my Sublime Text project settings.
I have access to these variables (provided by Sublime Text):

*

*$file: Stores the absolute path to the file on disk:C:\Users\User\dev\repos\base\dir\index.html

*$project_path: Stores the location of the project file (usually the root of the project):C:\Users\User\dev\repos\base
Now what I want is the content of $file but instead of the $project_path I want http://127.0.0.1:4000/~base. For that task I tried the following with Bash cmd.exe:
CALL SET result=%file:%project_path%=http://127.0.0.1:4000\~base\% && echo %result%

This gives the desired result, however I can't seem to be able to apply it to the build system inside Sublime Text.
For now, I try to generate the correct address and output it via cmd.exe:

{
    "build_systems":
    [
        {
            "name": "Preview in browser",
            "selector": "text.html",
            "windows":
            {
                "shell": true,
                "cmd": [
                    "start", "cmd", "/k",
                    "CALL SET result=$file:$project_path=http://127.0.0.1:4000\\~base\\ && echo $result"
                ]
            }
        }
    ]
}

Result:
> echo %result%
C:\Users\Philipp\dev\repos\base\dir\index.html:C:\Users\Philipp\dev\repos
\base=http://127.0.0.1:4000\~base\

So the substitution is not working when doing it in the build system, but in cmd.exe it does. I'm confused.

A: You can do something like this:
{
    "build_systems":
    [
        {
            "name": "Preview in browser",
            "selector": "text.html",
            "windows":
            {
                "shell_cmd": "CALL SET filePath=$file && CALL SET result=%filePath:$project_path=http://127.0.0.1:4000\\~base% && CALL C:/Progra~2/Google/Chrome/Application/chrome.exe %result%"
            }
        }
    ]
}

The problem was with windows replacement and variable asignation rather than with sublime builds.
As it has been said in chat and comments multiple CALL are necessary to use the real value variable because if not used windows will expand their value at parse time before the wanted value is asigned at execution time. In addition, shell_cmd can be used to run a unique command in shell.


text:
Q: Should I should use 'to' or 'for' in the following sentence?
Could you please provide admin credentials to me and Sandy for feel free to add a new user or change?

and the second one

Could you please provide admin credentials to us for feel free to add a new user or change?

Am I using to and for properly here?
What should I use? And what is the rule?

A:
Could you please provide admin credentials to Sandy and me

Change the order from me and Sandy to Sandy and me and add a period (.), and this is a proper sentence.

Could you please provide admin credentials to us

Add a period (.), and this is a proper sentence.
I don't understand what you mean by the rest:

...for feel free to add a new user or change?

A: Could you please provide admin credentials to us so that we can feel free to add a new user or change?
If you use 'for' here, then you'll have to change feel to feeling, which will be incorrect usage of the idiom- feel free.


text:
Q: Are "coded" and "encoded" synonymous? I was creating a domain for a website, but I couldn't understand the difference (if there is any) between the words coded and encoded.
What's the right use of them? Or are they just synonyms I can use interchangeably without worrying about context or register?

A: They have slightly different connotations which you may want to pay attention to: coded is more frequently used to describe the action of coding (in past tense), while encoded is often first interpreted as an adjective describing something that has been, well, encoded. If you're a programmer, it's not very idiomatic to say "I encoded some sweet software" if you mean you wrote the code to it; and saying "That video file is coded" (instead of encoded) is misleading. So, if your dilemma is between www.peoplecodedlinux.com and www.peopleencodedlinux.com, the former is a better choice.

A: As this chart shows, both terms have become far more common over recent decades...

My feeling is that encoded is associated with technical contexts where the method of encryption is more important than the encrypted information itself. Thus, from Google Books...

sent a coded message:4060 hits; sent an encoded message:62 hits.
(The human) genome is encoded (in DNA):311 hits; ...genome is coded...:49 hits.

In more metaphorical contexts ("She declined my offer of a drink at the bar, which I took as a coded message that she didn't fancy me"), I definitely wouldn't use encoded.

A: First of all convert to current tense we have code and encode.
Code - To write programs but also rarely used as encode.
Encode - To transform into another format for various reasons including standards and application of the format. Or criptify. Never used as coding in context of creating programs.


text:
Q: I want make a list and and show in double list I want to make a list fetching data from Database. And I want to show the list double, means half data in one column and half second column. I'm using PHP MySQL and HTML.

A: Here's the general idea without writing it all for you. Loop through your results and when you hit halfway end the current list and start a new one.
You'd probably need to round the halfway point but you should be able to use this to do what you want. Use CSS to position the lists how ever you want. Next time post some code 1st though.
$query = YOUR_QUERY
$count = 0; // Set a counter
$total = mysql_num_rows($query); // Get the total

echo '
';
while ($row = mysql_fetch_array($query)) { // Loop through the query
    echo '
'.$row['something'].'
'; // Output your li

    if ($count == ($total / 2) { // If you reach half way, start a new list
        echo '

';
    }
    $count++;
}
echo '
';

A: Assuming $returned_data is an associative array,
   echo '
';
    foreach($returned_data as $k => $v)
    {
      echo '
';
      echo    ''.$k.'	'.$v.'	';
      echo '
';
    }
    echo '
';

A: You need to count the records, and then calculate how many rows are required per column:
$result = mysql_query("SELECT * FROM `my_table` WHERE `foo` = 'bar'");
$num_records = mysql_num_rows($result);
$num_columns = 2;
$rows_per_col = ceil($num_records / $num_columns);
$records = array();

while($row = mysql_fetch_array($result))
{
    $records[] = $row;
}

// Now get the columns in two arrays:
$col1 = array_slice($records, 0, ($rows_per_col - 1));
$col2 = array_slice($records, $rows_per_col);

// Now loop over the data:
echo '
';
foreach($col1 as $row)
{
    echo "\n\t", '', $row, '';
}
echo '
';
echo '
';
foreach($col2 as $row)
{
    echo "\n\t", '', $row, '';
}
echo '
';

Then you need to add some CSS to float the columns left, and set their width:
div.col {
    float: left;
    padding: 2%;
    width: 46%;
}
    div.col span.row {
        display: block;
        line-height: 20px;
    }

A: Try to use css for this:
.list-half {
    display: inline-block;
    float: left; /* to pretend whitespace breaks */
    width: 50%;
}

And the output:

<?php foreach ( $data as $value ) { ?>

<?php echo $value ?>

<?php } ?>

Dont forget to clear the floats.


text:
Q: Text files in the path configuration file I'm using the text plugin of RequireJS. Is it possible to reference a text file in the path configuration file? I've tried
require.config({
   paths: {
       'myTemplate': 'text!templates/myTemplate.html'
   }
});

but that didn't work.

A: The reason it isn't working is because RequireJS plugins are designed to be used as part of a require command, not in the config.
Try:
require.config({
   paths: {
       'myTemplate': 'templates/myTemplate.html'
   }
});

and in your module:
define(
    ['text!myTemplate'],

    function () {}
)

A: RamenRecon's answer helped, but in my case I think it was slightly confusing by using myTemplate for the path and template name. The key I found is to only substitute the Path, but not the actual file name. As a result, to abstract the path to /subSystem/templates/myTemplate.htm using require and the path configuration, set the configuration as follows:
require.config({
   paths: {
      templatePath: 'subsystem/templates'
   }
});

And then in your module definition:
define(['text!templatePath/myTemplate.htm'],
   function(template) {}
);


text:
Q: A problem about real quadratic field I have calculated some real quadratic field 's Hilbert class field with class number $2$,and I found they were satisfied $Gal(H_{K}/Q)\cong Z/2Z\oplus Z/2Z$,here $H_{K}$  is the Hilbert class field of a real quadratic field $K$ whose class number is $2$.Is it true for all quadratic field with class number $2$? How to prove it?(ps:I'm a beginner of algebraic number theory ,and I'm very interested in Hlibert class field .)

A: This is a consequence of "genus theory". If $K / \mathbf{Q}$ is an abelian extension, then the "genus field" of $K$ is the maximal extension $L / K$ such that $L/K$ is unramified and $L/\mathbf{Q}$ is abelian. You can read more about genus theory here: https://en.wikipedia.org/wiki/Genus_field.
In your case, the fact that $H_K$ is Galois over $\mathbf{Q}$ and $[H_K : \mathbf{Q}] = 4$ implies that $H_K$ must be abelian over $\mathbf{Q}$ (since there are no nonabelian groups of order 4); so $H_K$ coincides with the genus field $L_K$. The genus field of of a quadratic field is always a composite of quadratic fields, so $H_K$ must have Galois group $C_2 \times C_2$.
(More generally, for any quadratic field (real or imaginary), genus theory completely describes the 2-torsion part of the class group.)


text:
Q: show an array values in nested FOR loop of str_replace where array values are part of replacement I'm trying to replace these tags [mtgcard] cardname [/mtgcard] in a string, but while replacing I want also the cardname to be the part of an hyperlink (example below)
Here is the function (found on stackoverflow) I use to get the CARDNAMES from the string:
function getContents($str, $startDelimiter, $endDelimiter) {
  $contents = array();
  $startDelimiterLength = strlen($startDelimiter);
  $endDelimiterLength = strlen($endDelimiter);
  $startFrom = $contentStart = $contentEnd = 0;
  while (false !== ($contentStart = strpos($str, $startDelimiter, $startFrom))) {
    $contentStart += $startDelimiterLength;
    $contentEnd = strpos($str, $endDelimiter, $contentStart);
    if (false === $contentEnd) {
      break;
    }
    $contents[] = substr($str, $contentStart, $contentEnd - $contentStart);
    $startFrom = $contentEnd + $endDelimiterLength;
  }
  return $contents;
}

and It does work fine, below is the string where I'll replace tags:
        $string  = "we have a card  [mtgcard]tarmogoyf[/mtgcard] ";
        $string .= "and [mtgcard]forest[/mtgcard] ";

    //here i get all the values between [mtgcard] [/mtgcard]
    $arr = getContents($string, '[mtgcard]', '[/mtgcard]');

This gives me Array ( [0] => tarmogoyf [1] => forest )
    //I count them for te loop
        $count = count($arr);

        for($i = 0; $i < $count; $i++) {
//here I replace the [mtgcard] with
//and [/mtgcard] with
            $string = str_ireplace(array("[mtgcard]", "[/mtgcard]"),array("", ""), $string);
            $arr[$i]++;
        }
        echo $string;

the above script shows:
we have a card
 1. tarmogoyf
 2. forest

And this is perfectly what i wanted but in part as I want to finish the hyperlink with the cardname to have a correct path for exmaple https://deckbox.org/mtg/cardname
For this tried the above FOR loop with these changes:
$count = count($arr);
    for($i = 0; $i < count($arr); $i++) {
        $string = str_ireplace(array("[mtgcard]", "[/mtgcard]"),array("", ""), $string);
        $arr[$i]++;
    }

And I get this result:
 1. tarmogoyf
 2. forest

All hyperlinks have the first value of array($arr) and I tried also the nested foreach loop but the output repeats double time. what I want is :
1. tarmogoyf
     2. forest

Any suggestion would be accepted also on working fine script to make it better.

A: If you want to just replace the [mtgcard] elements in the string, this is most easily achieved using preg_replace to do a regular expression-based replacement:
$string  = "we have a card  [mtgcard]tarmogoyf[/mtgcard] ";
$string .= "and [mtgcard]forest[/mtgcard] ";

$string = preg_replace('/\[mtgcard\](.*?)\[\/mtgcard\]/', '$1', $string);
echo $string;

Output:
we have a card  tarmogoyf and forest

If you want to generate an array of all the [mtgcard] elements, you can use preg_match_all to find the contents of the elements, and then just concatenate the necessary pieces to convert them into links:
$string  = "we have a card  [mtgcard]tarmogoyf[/mtgcard] ";
$string .= "and [mtgcard]forest[/mtgcard] ";

preg_match_all('/\[mtgcard\](.*?)\[\/mtgcard\]/', $string, $matches);
$arr = $matches[1];
foreach ($arr as &$a) {
    $a = "$a";
}
print_r($arr);

Output:
Array (
    [0] => tarmogoyf
    [1] => forest
)

Demo on 3v4l.org


text:
Q: what voltage required to replace schottky diode to zener diode I have very basic question. what value of zener voltage I need to replace schottky diode with Vrrm=40V?

A: Zener diodes are silicon junctions, which have a forward voltage around 0.7v, and a stable non-destructive reverse breakdown (as long as you stick to dissipation limits) at their specified zener voltage. They are only really used for their reverse characteristic, the forward characteristic is essentially a by-product of their construction.
Schottky diodes are hetero-contacts, with a forward voltage around 0.4v, a high (with respect to silicon) reverse leakage, that increases strongly with temperature and can cause a surprising thermal runaway in some diodes if not heat-sinked properly, and a destructive reverse breakdown when the reverse voltage exceeds some poorly specified threshold.
They have different applications. If you want to do a lateral thinking exercise, then the only time they might be considered interchangeable is when used as rectifiers, when the maximum reverse voltage is below the zener voltage, and within the reverse spec of the schottky. But that would be a very strange way to use a zener!


text:
Q: How to check if array contains array in elegant way? Here is my code in python, which checks whether smaller sub-arrays in big array are inside in one of the sub-arrays. I don't know which is the biggest sub-array's index, so I can not compare against index. Maybe it's good to sort. But if there are more than one big subarrays?
i.e. I want to have in final array only those big sub-arrays, which contain smaller sub-arrays
[[1, 2, 3], [4, 5, 6], [1, 2, 3, 4, 5, 6], [7,8], [9, 10, 11, 12],  [7, 8, 9, 10, 11, 12]]
Second, what should I do if order of the elements can be random, e.g.:
[[1, 3, 2], [4, 5, 6], [1, 2, 3, 4, 5, 6], [7,8], [9, 10, 11, 12],  [7, 8, 9, 10, 11, 12]]
Here is my code:
arr1 = [[1, 2, 3], [4, 5, 6], [1, 2, 3, 4, 5, 6], [7,8], [9, 10, 11, 12],  [7, 8, 9, 10, 11, 12]]

arr2 = []
arrInd = 0
arrInd2 = len(arr1)
for k in arr1:
    for n in reversed(arr1):
        if set(n).issubset(set(k)):
            arr2.append(k)

print(arr2)

I would like to see as output:
[[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]]
But I have:
[[4, 5, 6], [1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6], [7, 8], [9, 10, 11, 12], [7, 8, 9, 10, 11, 12], [7, 8, 9, 10, 11, 12], [7, 8, 9, 10, 11, 12]]
UPDATE
Because there were so many good questions I have to add some more details.
1) There is an array of arrays:
arr1 = [[]]
2) it contains some sub-arrays like these ones [1, 2, 3], [4, 5, 6], [4, 6, 5], [7, 8, 9, 10, 11, 12], [11, 12, 13, 14, 15], [1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12, 13, 14, 15], [111, 222, 333], [444, 555], [777, 888], [111, 222, 333, 444, 555], [111, 222, 333, 444, 555, 777, 888], [1000, 2000, 3000]
What is possible?
1) Inside arrays order may vary: [4, 5, 6], [4, 6, 5] and [1, 2, 3, 4, 5, 6], so it won't be numerical order, in fact in real data (I am currently testing) there may be even letters, like A77, B81;
2) There are big and small arrays, there is always a biggest one (or several), which never intersects with other biggest arrays, so here [1, 2, 3, 4, 5, 6] and [7, 8, 9, 10, 11, 12, 13, 14, 15] - they can not intersect with each other, but they contain some mini sub-arrays;
3) Each big sub-array contains some smaller ones. However, not all of them and some small arrays can exist independently. For instance: [1, 2, 3, 4, 5, 6] contains [1, 2, 3], [4, 5, 6], [4, 6, 5], but it doesn't contain [7, 8, 9, 10, 11, 12], [11, 12, 13, 14, 15] or [111, 222, 333];
4) There also may be intermediate "big arrays": [111, 222, 333, 444, 555] is smaller, compared to [111, 222, 333, 444, 555, 777, 888] so the first one [111, 222, 333, 444, 555] must be excluded.
5*)I would like to add big arrays to arr2 (final array) without small once, except for case *** [1000, 2000, 3000] to arr2 (final array)
What my code was supposed to do?
It was supposed to go through arr1 and oppose different elements to each other in order to detect whether n element contains k element and vice-versa, as it goes from start to end for k in arr1: and from end to start for n in reversed(arr1):
UPDATE 2. Comparison of lengths!
if len(n) < len(k):
    for k in arr1:
        for n in reversed(arr1):
            if len(n) < len(k):
                if set(n).issubset(set(k)):
                    arr2.append(k)

And it is much closer. Actually it is almost it, but it makes duplicates, judging by the amount of which, it seems that problem of order (1) is not a problem at all:
arr2 = [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12, 13, 14, 15], [7, 8, 9, 10, 11, 12, 13, 14, 15], [111, 222, 333, 444, 555], [111, 222, 333, 444, 555], [111, 222, 333, 444, 555, 777, 888], [111, 222, 333, 444, 555, 777, 888], [111, 222, 333, 444, 555, 777, 888], [111, 222, 333, 444, 555, 777, 888]]
It is, of course possible to start the removal of duplicates and to run arr2 in such a way again to get rid of [111, 222, 333, 444, 555] which is actually part of [111, 222, 333, 444, 555, 777, 888], but there must be a more elegant way.

A: So you are trying to get rid of all those lists which contain only elements which are also in another list?
def eachMasterList(allLists):
  allSets = [ set(lst) for lst in allLists ]
  for lst, s in zip(allLists, allSets):
    if not any(s is not otherSet and s < otherSet for otherSet in allSets):
      yield lst

To use the function, try this:
print(list(eachMasterList([[1, 2, 3], [4, 5, 6], [1, 2, 3, 4, 5, 6], [7,8], [9, 10, 11, 12], [7, 8, 9, 10, 11, 12]])))

A: You have a big list of lists, and you want to look up a lot of lists in it? Do it like you would handle looking up any other kind of object in a big collection: Store them (or a suitable version, to be exact) in a set to allow fast lookup.
Lists cannot be set elements, but you can transform the small lists to tuples and store those:
myindex = set(tuple(sm) for sm in big_list)

Then to check if [1, 3, 4] is in your big_list, you just say:
if tuple([1, 3, 4]) in myindex:
    ...

If you want to match lists regardless of order (so that [1, 3, 4] is considered equal to [3, 1, 4]), turn them into sets too. But not regular sets (they can't be set elements either), but frozenset:
myindex = myindex = set(frozenset(sm) for sm in big_list)

That's about it.

A: You can use a recursion function :
>>> l =[(1, 3, 2), (4, 5, 6), (1, 2, 3, 4, 5, 6), (7, 8), (9, 10, 11, 12), (7, 8, 9, 10, 11, 12)]

>>> def find_max_sub(l):
...    for i,j in enumerate(l):
...       for t,k in enumerate(l[i+1:],1):
...             if set(j).intersection(k):
...                 return find_max_sub([set(l.pop(i))|set(l.pop(t))]+l)
...    return l
...
>>> find_max_sub(l)
[(1, 2, 3, 4, 5, 6), (7, 8, 9, 10, 11, 12)]

All you need is looping over your main list and compare the elements in list with other and when you find to sub lists that have any intersection you pop those elements and add new sub list to main list then call the function with new list.

A: Are you looking for this?
def get_subset_list():
    for arr in arrays:
        others = [x for x in arrays if x != arr]
        for other in others:
            for val in arr:
                if val not in other:
                    break
            else:
                break
        else:
            yield arr

import json
x = get_subset_list()
print set([json.dumps(y) for y in x])

A: You can simply compare two arrays by converting them into strings then comparing by __contains__
print (''.join(arr1).__contains__(''.join(arr2)))


text:
Q: Wordpress site not redirecting properly We have developed a wordpress site recently, if i just type http://example.com in browser i will get the site, but if i type www.example.com it is not displaying anything, what happened to it, is there any problem to my htaccess? My site url and homeurl is http://example.com, i have tried with different options in my htaccess badluck, i just want to redirect the www.example.com to http://example.com.

A: Try this into htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

A: Can you check which IP address it points to when www version of your url is accessed ? Is it the same as your non-www version one ? If YES, then paste the below code on top of the htaccess file. Search and replace all the www versioned urls from DB to non-www versioned( if any ).
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^example\.com
RewriteRule (.*) http://example.com/$1 [R=301,L]

To check if both urls are pointing to same host, you can use Flagfox addon


text:
Q: ¿Como puedo obtener la fecha o periodo de fecha pasando el numero de semana? Si desde SQL tengo el numero de la semana "1" como puedo obtener la fecha o el rango de fechas de esa semana. Se que para obtener el numero de la semana se hace con "DATEPART" ¿Existe algún modo de invertir la operación para que me proporcione la fecha usando el numero de semana?

A: Si tienes un número de semana entonces deberías tener una fecha o año de origen, en cuyo caso simplemente deberías sumar la semana a la fecha de origen, por ejemplo si tu origen es el año 2022, podrías hacer algo así:
declare @NroSemana INT = 2

select dateadd(wk, @NroSemana -1, '2022-01-01' )


text:
Q: high traffic mysql hosts I'm wondering if any of you sql buffs out there have any suggestions for a high speed mySQL server. I need something that can handle roughly 33 updates and 33 queries per second, per user.
and for now I really only need to handle say, 10 users.
I know it's hard to say because it depends on the statements so maybe if I supply them it will be of help.
each user is calling :
33x per second
SELECT Online, Xloc, Yloc FROM accounts WHERE AccountID = " + getlocI

and polling:
33x per second
UPDATE `accounts` SET `Online`='"+InitialStat.Onlineint+"', `Xloc`='"+Game.currentx+"',
`Yloc`='"+Game.currenty+"' WHERE (`AccountID`='"+UserVerify.clientID+"') LIMIT 1

with a larger UPDATE only once per minute:
UPDATE `accounts` SET `Online`='"+InitialStat.Onlineint+"',`Zone`='"+Game.currentzone+"',`Xloc`='"+Game.currentx+"', `Yloc`='"+Game.currenty+"', `Level`='"+InitialStat.PlayerLevel+""
                        + "', `XP`='"+InitialStat.XP+"', `Health`='"+InitialStat.health+"', `Magic`='"+InitialStat.magic+"', `Stamina`='"+InitialStat.stamina+""
                        + "', `Strength`='"+InitialStat.strength+"', `Defense`='"+InitialStat.defense+"', `Vitality`='"+InitialStat.vitality+""
                        + "', `Agility`='"+InitialStat.agility+"', `Intelligence`='"+InitialStat.intelligence+"', `Dexterity`='"+InitialStat.dexterity+""
                        + "', `Luck`='"+InitialStat.luck+"', `Gold`='"+InitialStat.gold+"' WHERE (`AccountID`='"+UserVerify.clientID+"') LIMIT 1

the larger UPDATE statement isn't too big of a deal since it happens far less frequently.
But the fastest I can get my other ones to go is somewhere around once per second.
Is there any way I can find out a ballpark of what I would need in a server to get those to function as fast as I'd like them to? I'm currently using a VH, I'd rather not go the dedicated server route yet because this is still in development, so spending a few hundred a month of the server is a bit much.
Any help would be greatly appreciated. If you need more info please let me know.

A: While MySQL is in-memory database (tables you are querying should be in memory to get quite nice performance) so you have to have enough of RAM to hold accounts table in buffer pool (innodb_buffer_pool_size). Can you calculate the size of your table (query information_schema.tables for this information)? For example, if it's 10G and you can get 10G at least (it would be nice to have at least +20-30%) so you can go with virtual server. If you cant afford 10G RAM (for example you need 700G RAM) you should think about sharding (moving data to different servers by accountId).
It's a good option to use partition by accountId it will reduce amount of blocking inserts/updates.
MySQL 5.5/5.6 has a nice feature to load/dump buffer_pool to you do need to do warm up after each server restart (look at innodb_buffer_pool_load_at_startup, innodb_buffer_pool_dump_at_shutdown).
That is where I would start. General advice: change settings in my.cnf and benchmark them.
Hope it helps

A: I think you are trying to solve the problem with the wrong tools: MySQL is a relational database, designed to store large collections of data for long term in a durable fashion. You seem to be storing in the database a small amount of data for synchronisation, that is very dynamic, a workload that (even it is possible for the load you propose) it is not designed for that. Your data seems to be very state, session-like, for which application memory (shared memory) is designed. Real-time data is stored on main memory, not on the disk datastore. Or -if you could not use that-, other kind of data stores that doesn't require such durability/locking like MySQL may work better, like memcached.
If you really need to use MySQL, which I don't recommend for this pattern, 300 IOPS is something that any dedicated server can do, but a virtual host may be very limited or constrained by the other users (and very variable performance, as it cannot guarantee the service quality). MyISAM will do table locks, InnoDB will have too much durability overhead. Memory may work if the table locks take less than intended TPS, if not you will also suffer the table locks. And all that, no to talk about the SQL layer overhead.


text:
Q: Simple dynamics problem I was trying to solve a simple problem where it was given that the velocity of a box on a smooth surface is:
$$ v = 0.05s^{3/2} $$
Where s is the number of meters that the box travels from rest.  The question was:  what is the acceleration of the box when the distance traveled is 10m.  Now there are many ways to solve this problem, but I took the following approach:
$$ ds/dt = 0.05s^{3/2} $$
$$ \frac{ds}{0.05s^{3/2}} = dt $$
Integrate from 0 to s and 0 to t for the left and right hand sides, respectively
$$ -40s^{-1/2} = t $$
$$ s^{1/2} = -40/t $$
$$ s(t) = \frac{1600}{t^2} $$
$$ v(t) = \frac{-3200}{t^3} $$
$$ a(t) = \frac{9600}{t^4} $$
Let $T$ be the time to reach $10$ m
$$ 10 = \frac{1600}{T^2} $$
$$ T = \sqrt{160} $$
$$ a(s = 10m) = \frac{9600}{T^4} $$
However, I stopped here because according to s(t), I saw that as time increases, the distance traveled from the origin decreases, which is inconsistent with the intuition that the given velocity equation gives me, which is that distance traveled should increase over time.
Where did my thinking go wrong?

A: Differentiate $v$ with respect to time.
On the left hand side you will get the acceleration $a$.
On the right hand side you will get an expression which includes $s$ and $\frac {ds}{dt}$ which is $v$ which is ?

A: The approach really fails, because the proposed motion is kind of broken.
Including the integration constant, the distance traveled as a function of time becomes:
$s(t) = \frac{1600}{(t+C)^2}$
Since we want $s=0$ when $t=0$, the constant C becomes infinity. This means that, the motion can not really start from rest -- it takes infinite time to do so. This is evident from the problem -- at $s=0$, the speed is zero. Not only is the speed zero, the acceleration is also (you will find if you solve the problem) is zero. All higher derivatives are also zero! The damn thing will never move.
But...
The problem can still be solved. Even if it takes infinite time (ugh) we can find what the acceleration is when the distance traveled is a given $s$.
Now, here is the trick you need:
You know $v(s)$. You want $a(s)$.
$a(s) = \frac{dv(s)}{dt}$
$ a(s) = \frac{dv(s)}{ds} \cdot \frac{ds}{dt}$
Proceeding from here leads to the answer, which is not difficult to obtain. That is, you will be able to calculate $a(s=10)$. What you still will not be able to find out is when that happens... Because it never happens.
I would classify this as a non-kosher problem, if this is intended as a physics problem. The motion never starts as described. As such, the "when" of having traveled $10m$ is non-existent. You could not measure this even in principle as an experiment, which takes this into the realm of philosophy rather than physics.


text:
Q: Getting a specific data from webpage using only class items I have a source code on a webpage that I wish to extract (I've narrowed it down to exactly what is relevant here:

    Wagamama

Now the trick here is that I want to get the word Wagamama into a message box but that word changes on every page of that site so I need to get that element but there is no ID on this page. Therefore I was thinking of doing a search for the class named "sideInfoPlayer" first and then find the "wrap" class within the previous class block.
I have written the below to get the first one but do not know how to tackle the second one and then get the desired value.
        HtmlElementCollection col = webBrowser1.Document.GetElementsByTagName("div");
        foreach (HtmlElement element in col)
        {
            string cls = element.GetAttribute("className");
            if (String.IsNullOrEmpty(cls) || !cls.Equals("sideInfoPlayer"))
                continue;
        }

I hope you can help unstuck me on this one.

A: You have better options. Look at http://htmlagilitypack.codeplex.com/
And here: How can i parse html string
First you'll need to add reference to HtmlAgilityPack library by downloading it manually or with NuGet package manager.
// loading html into HtmlDocument
var doc = new HtmlWeb().Load("http://website.com/mypage");
// walking through all nodes of interest
foreach (var node in doc.DocumentNode.SelectNodes("//div[@class='sideInfoPlayer']/span[@class='wrap']"))
{
  // here is your text: node.InnerText
}

//div[@class='sideInfoPlayer']/span[@class='wrap'] is called Xpath Expression and this one literally means "get me all span elements with class=wrap that are children of div element with class=sideInfoPlayer.
I didn't test it, but it should work.


text:
Q: What are some features of Git that Github doesn't support? I love using Github and have been interested in learning more about how git works behind the scenes. Are there any cool features of git that I haven't been exposed to through github.com?

A: In principle, all Github does is host your Git repository. Anything you do in your repository to add to/mangle its history is totally orthogonal to what features Github offers. Any differences/restrictions are in the hosting side of things, so the real question is: what's the difference to hosting your repositories yourself on your own server?
When using Git on your own server, it allows you to provide your own code to inspect and possibly reject pushes, using a hooks mechanism. This means that you can write a hook script that makes sure only certain people can push changes to certain subdirectories of your repository, for example. A whole lot of other things can be done with this, of course – you're only limited by your imagination. And maybe reality. ;)
Github doesn't want to run arbitrary code you provide for your repositories, of course, so you can't do quite as fancy custom things if your repository is hosted there. They do allow you to send notifications to other servers via HTTP, though, so while you can't make your own rules for restricting pushes, at least you can let other services know about them.
To get an idea of what else can be done with self-hosted repositories, check out Gitolite (heads up: setting it up requires a certain level of experience with server administration). It has a few extra tricks to restrict fetches, too, even though Git doesn't provide a hook for that.


text:
Q: Laravel email sending is very slow I have a site where i have used laravel email verification for user registration and other email sending functions . It works on localhost
but when i upload it on bluehost
It is running very slow like
after about 1 to 2 hours only the email is going to the reciever email
I have used webmail and its driver for sending mail If i use Smtp it says Connection could not be establish and if i use sendmail driver the same thing happens email takes alot of time .
My .env configuration
MAIL_DRIVER=mail
MAIL_HOST=mail.openroomlist.com
MAIL_PORT=465
MAIL_USERNAME=support@openroomlist.com
MAIL_PASSWORD=********
MAIL_ENCRYPTION=tls

A: Try with ssl:
MAIL_ENCRYPTION=ssl

Or try this:
MAIL_DRIVER=mail
MAIL_HOST=mail.openroomlist.com
MAIL_PORT=26
MAIL_USERNAME=support@openroomlist.com
MAIL_PASSWORD=********
MAIL_ENCRYPTION=null

Reference:
Send email on Bluehost shared hosting
More details about bluehost email sending:
https://my.bluehost.com/hosting/help/email-application-setup


text:
Q: Flutter Navigation, Required Argument, Separate Routes File, How to Properly Code So I'm following a tutorial and jumped ahead of myself but would really like to get this working. I've moved the navigation into a 'routes_constants.dart' and 'routes.dart'. The constants if fine. The routes is where I've run into an issue. After spending hours trying to locate and learn myself I'm asking for help.
I have a 'FoodScreen' with 'final Category category'. The issue is calling the required category in the routes.dart switch/case/default code.
I've placed the code from routes.dart below. For those of you who know this 'stuff' I'm sure it is simple... and soon I hope it will be for me also. Thank you in advance for any assistance you could provide.
This is the error/help messages. I've tried and tried but haven't been able to conquer this!
Message Start:
(new) FoodScreen FoodScreen(
Set set, {
required Category category,
Object? argument,
})
package:myapp/models/food_screen.dart
The named parameter 'category' is required, but there's no corresponding argument.
Try adding the required argument.
Message End.
routes.dart code below:
import 'package:flutter/material.dart';
import 'package:myapp/models/category.dart';
import 'package:myapp/models/category_screen.dart';
import 'package:myapp/models/category_item.dart';
import 'package:myapp/models/food_screen.dart';
import 'package:myapp/routes/route_constants.dart';

Route<dynamic> generateRoute(RouteSettings routeSettings) {
  // Getting arguments passed in while calling Navigator
  final args = routeSettings.arguments;

  switch (routeSettings.name) {
    case RouteNames.CategoryScreenRoute:
      return MaterialPageRoute(builder: (context) => CategoryScreen());
    case RouteNames.FoodScreenRoute:
      return MaterialPageRoute(builder: (context) => FoodScreen(??? THIS NEEDS FIX ???));
    default:
      return MaterialPageRoute(builder: (context) => CategoryScreen());
  }
}

FoodScreen.dart code below:
import 'package:flutter/material.dart';
import 'package:myapp/models/category.dart';

class FoodScreen extends StatelessWidget {
  final Category category;
  FoodScreen(
    Set set, {
    required this.category,
    Object? argument,
  });
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.black,
        title: Text('${category.content}'),
      ),
      body: Center(
          child: Text(
          'Category: ${category.content}',
          style: TextStyle(fontSize: 24),
          ),
          ),
    );
  }
}

A: I'm pretty new to Flutter as well, but I believe if the goal is to pass a category to your FoodScreen when you call it using Navigator, you can do the following:
routes.dart:
...
case RouteNames.FoodScreenRoute:
      return MaterialPageRoute(builder: (context) => FoodScreen(
          category: ModalRoute.of(context)!.settings.arguments as Category
      ));
...

FoodScreen.dart:
import 'package:flutter/material.dart';
import 'category.dart';

class FoodScreen extends StatelessWidget {
  final Category category;

  const FoodScreen({
    Key? key,
    required this.category,
  }) : super(key: key); // I believe its best to give widgets keys

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.black,
        title: Text('${category.content}'),
      ),
      body: Center(
        child: Text(
          'Category: ${category.content}',
          style: TextStyle(fontSize: 24),
        ),
      ),
    );
  }
}

Then I think you'll be able to call your FoodScreen using
Navigator.pushNamed(context, RouteNames.FoodScreenRoute,
                    arguments: category); //where this category has been declared earlier
              };

I can't actually test this until I get home, but let me know if it works.


text:
Q: OOP - inheritance [Java] bb refers Derived  class, when i call show() method,  but when i print bb.b  - is prints Base class property .
Why is this happening?
class Base {
    int b=10;
    public void show() {

        System.out.println("Base show() called");

    }
}

class Derived extends Base {

    int b=20;
    public void show() {

        System.out.println("Derived show() called");

    }

}

public class MainClass {

    public static void main(String[] args) {

        Base bb = new Derived();;

        bb.show();
        System.out.println(bb.b);

    }

}

output :
Derived show() called
10

A: While you declare your variable as a Base obj (i.e. Base bb = new Derived();), that does not mean your b object is no longer an instance of Derived (verify this with b instanceof Derived).
This is called hiding and is similar to what people usually do when declaring variables that might later change implementation for example private List<String> someList = new ArrayList<>();. In more technical terms: it's a way of decoupling your code from a specific implementation.
As to why b is 10 (the Base class's value) and not 20: that is because you are explicitly referring to b value in Base class (as mentioned by Timothy Truckle's answer). If you were to explicitly cast your b object back to Derived type, you will see 20 being printed instead:
System.out.println(((Derived)b).b);

A: You output is 10because you explicitly access variable b in class Base.
Beside the technical aspect doing so this is not OOP since it violates the most important OO principle: information hiding / encapsulation.

A: There is no polymorphism for fields in Java.
Variables are resolved compile-time, methods run-time. so always Base Class variables (not child's inherited variables) will be accessed.
So whenever upcasting happens always remember

*

*Base Class variables will be accessed.

*Sub Class methods(overridden methods if overriding happened else inherited methods as it is from parent) will be called.

A: This is because the compiler implements special run time polymorphism for methods only. This is also called method overriding.
For variables, the value will always be from the Base class, because that is the type of bb object regardless of the class with with it is instantiated.


text:
Q: URLQuery item does not grab the location coordinate I am wondering what can the be reason of my issue. I am using core  location in order to get the my coordinates location, which I  use in the network method as a URLQueryItem in order to get a response from the API. But the console output shows that the latitude query and longitude query are both equal to 0 while I have my a latitude and longitude value. I use the network method inside my viewdidload.
Thanks for all responses and explanations.
  var queryLattitudeItem : Double = 0
  var queryLongitudeItem : Double = 0

func network () {

        let configuration = URLSessionConfiguration.default
        configuration.waitsForConnectivity = true
        let session = URLSession(configuration: configuration)
        guard let urls = URL(string:"https://api.yelp.com/v3/businesses/search") else { return }
        var urlcomponent = URLComponents(string: "\(urls)")
        let queryLat = URLQueryItem(name:"latitude" , value: "\(queryLattitudeItem)")
        let queryLong = URLQueryItem(name: "longitude", value: "\(queryLongitudeItem)")
        let queryItemterm = URLQueryItem(name: "term", value: "restaurant")
        let queryLimit = URLQueryItem(name: "limit", value: "10")
        urlcomponent?.queryItems = [queryItemterm,queryLat,queryLong,queryLimit]
        print(urlcomponent!)
        print(queryLat)
        print(queryLong)
        var request = URLRequest(url: urlcomponent!.url!)
        request.httpMethod = "GET"
        request.addValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")
        request.addValue("application/json", forHTTPHeaderField: "Content-Type")

        let task = session.dataTask(with: request) { (data, response, error) in

            if let response = response as? HTTPURLResponse {
                print(response)

            } else{
                print("error")
            }

func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
        let location = locations[locations.count - 1]

        if location.horizontalAccuracy > 0 {
            locationManager.stopUpdatingLocation()
          print("\(location.coordinate.longitude), \(location.coordinate.latitude)")

        }
        let latitude : Double = (location.coordinate.latitude)
        let longitude : Double = location.coordinate.longitude
        print("This is lat: \(latitude), et long\(longitude)")
        queryLattitudeItem = latitude
        queryLongitudeItem = longitude

    }

Console output
https://api.yelp.com/v3/businesses/search?term=restaurant&latitude=0.0&longitude=0.0&limit=10
latitude=0.0
longitude=0.0
-73.984638, 40.759211
This is lat: 40.759211, et long-73.984638
<NSHTTPURLResponse: 0x600003a91ec0> { URL: https://api.yelp.com/v3/businesses/search?term=restaurant&latitude=0.0&longitude=0.0&limit=10 } { Status Code: 200, Headers {
    "Accept-Ranges" =     (

A: One stylistic thing I'd do with your code is utilize some sort of structure for storing strings so they're not littered throughout your code. When something fouls up, you can go to one spot to debug it rather than plowing through a bunch of code. Here, I store the string in an enum as a static let (b/c I hate rawValues):
enum Endpoint {
    static let yelp = "https://api.yelp.com/v3/businesses/search"
}

Next, I'd ditch the var declarations for latitude and longitude:
var queryLattitudeItem : Double = 0 //  nuke
var queryLongitudeItem : Double = 0 //  nuke

Instead, I'd update your network request method to accept a CLLocationCoordinate2D straight from the delegate method, like so:
func getYelpInfo(for coordinate: CLLocationCoordinate2D) {

    // omitted your networking code...this is just the URL creation code

    var components = URLComponents(string: Endpoint.yelp)
    let queryLat = URLQueryItem(name: "latitude", value: String(coordinate.latitude))
    let queryLong = URLQueryItem(name: "longitude", value: String(coordinate.latitude))
    let queryLimit = URLQueryItem(name: "limit", value: "10")
    components?.queryItems = [queryLat, queryLong, queryLimit]

    // You could use a guard statement here if you want to exit out, too
    if let url = components?.url {
        var request = URLRequest(url: url)
        // do your networking request
    }

    print(components!.url!.absoluteString)
}

Next, in your didUpdateLocations, I'd call the updated method, like so:
getYelpInfo(for: location.coordinate)

Your updated method looks like this:
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
    let location = locations[locations.count - 1]

    if location.horizontalAccuracy > 0 {
        locationManager.stopUpdatingLocation()
        getYelpInfo(for: location.coordinate)
        print("\(location.coordinate.longitude), \(location.coordinate.latitude)")

    }
}


text:
Q: How to deploy azure bot using bot frame work composer? I have created an azure bot using Bot framework composer. When I tried to deploy the bot in azure I ran Into an issue {"name":"CREATE_LUIS_AUTHORING_RESOURCE_ERROR","message":"Error - The subscription is not registered to use namespace 'Microsoft.CognitiveServices'. See https://aka.ms/rps-not-found for how to register subscriptions.","stack":"Error\n at new CustomizeError (/Applications/Bot Framework Composer.app/Contents/Resources/app.asar.unpacked/extensions/azurePublish/dist/extension.js:269072:25)\n at createCustomizeError (/Applications/Bot Framework Composer.app/Contents/Resources/app.asar.unpacked/extensions/azurePublish/dist/extension.js:269077:10)\n at AzureResourceMananger.deployLuisAuthoringResource (/Applications/Bot Framework Composer.app/Contents/Resources/app.asar.unpacked/extensions/azurePublish/dist/extension.js:269865:13)"}. See provision.Azure Bot.log in your bot folder
What should I do to deploy this bot in azure?

A: To overcome this issue we need to select an S1 subscription while creating an azure bot from pricing section.


text:
Q: Calculating $\int_0^{\pi/4} \frac{\cot (x)}{\cot ^2(x)+\sqrt{\cot (x)}} \, dx$ This is not really one of that kind of integrals that Mathematica cannot handle with, but given
the case of a contest, how would we like to handle with it? I would like so much to know your
ideas  about tackling such integrals. Can we make things here really simple? Solutions are optional.
Calculate
$$\int_0^{\pi/4} \frac{\cot (x)}{\cot ^2(x)+\sqrt{\cot (x)}} \, dx$$
Supplementary question: calculate
$$\int_0^{\pi/4} \frac{x \cot (x)}{\cot ^2(x)+\sqrt{\cot (x)}} \, dx.$$

A: Just let
$$
u=\cot x.
$$
You will get the integral
$$
\int_1^{+\infty}\frac{u}{u^2+\sqrt{u}}\frac{1}{1+u^2}\,du,
$$
which I'm sure you can handle with your skills (just let $s=\sqrt{u}$ and you have a rational function).


text:
Q: Is there a way to update dict values with array values? I'm currently working with the following code:
def ability_stat_roll():
    stat_rolls_stored = []
    for i in range(6):
        stat_rolls = []
        for j in range(4):
            num = random.randint(1, 6)
            stat_rolls.append(num)
        del stat_rolls[stat_rolls.index(min(stat_rolls))]
        stat_rolls_stored.append(sum(stat_rolls))
        stat_rolls_stored.sort(reverse=True)
    print(stat_rolls_stored)

ability_stat_roll()

Which would result in a list like below: (For example)
stat_array = [15, 14, 13, 12, 10, 8]

What I'm trying to figure out is is there a way to take the values from the list and input into a dict for a more user friendly way, example of dict below:
stat_dict = {"str": 0, "dex": 0, "con": 0, "int": 0, "wis": 0, "cha": 0}

I have attempted to try to do the Update Dict function but I keep getting errors that it's not valid form of Update Dict. I don't want to append the list as the dict value above already has keys that I would want. Is there a function that would be able to update the dict values from a list?
What I want the end result to be is the following:
"str": 15, "dex": 14, "con": 13, "int": 12, "wis": 10, "cha": 8

Is this possible to do? I'm new to Python and just trying to get my hands wet with trying to create different types of programs.
Answer thanks to the comment below:
def ability_stat_roll():
    stat_rolls_stored = []
    for i in range(6):
        stat_rolls = []
        for j in range(4):
            num = random.randint(1, 6)
            stat_rolls.append(num)
        del stat_rolls[stat_rolls.index(min(stat_rolls))]
        stat_rolls_stored.append(sum(stat_rolls))
        stat_rolls_stored.sort(reverse=True)
    print(stat_rolls_stored)

    null_stat_dict = {"str": 0, "dex": 0, "con": 0, "int": 0, "wis": 0, "cha": 0}

    for i, stat in zip(null_stat_dict, stat_rolls_stored):
        null_stat_dict[i] += stat
    print(null_stat_dict)

ability_stat_roll()

Which when ran the below is the result:
[17, 13, 12, 11, 10, 4]
{'str': 17, 'dex': 13, 'con': 12, 'int': 11, 'wis': 10, 'cha': 4}

A: You can zip those two and add the number in stat_array to its corresponding key in stat_dict:
for k, num in zip(stat_dict, stat_array):
     stat_dict[k] += num

Output:
{'str': 15, 'dex': 14, 'con': 13, 'int': 12, 'wis': 10, 'cha': 8}

A: If you have a dictonary and an array of the same length and both are ordered you can step through them both and update the values like this:
for index, key in enumerate(stat_dict.keys()):
    stat_dict[key] = stat_array[index]

To update a single element in the dictonary you use the key as an index like this:
stat_dict['int'] = 99
stat_dict['str'] = stat_array[0]