Q: Upgraded to Az modules from AzureRM now cannot login with Runbook I have just started looking at Azure Automation and created my first Runbook today and everything was working fine.  I then read that AzureRM was replaced with the Az module so thought I had better migrate my Runbook and get straight onto the new stuff!
My original code was working absolutely fine using the AzureRM modules, but since upgrading to the latest Az modules I just can't authenticate.  My automation account is exactly the same from a configuration perspective other than I have added in all of the matching Az modules to allow me to use them in my run books.
{
    $servicePrincipalConnection=Get-AutomationConnection -Name 'AzureRunAsConnection'

    $servicePrincipalConnection.TenantID
    $servicePrincipalConnection.ApplicationID
    $servicePrincipalConnection.CertificateThumbprint

    Connect-AzAccount -ServicePrincipal `
        -Tenant $servicePrincipalConnection.TenantID `
        -ApplicationId $servicePrincipalConnection.ApplicationID `
        -CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint

    Write-Verbose "Connected to Azure using Automation Connection" -verbose
}

I currently get the following error and am at a complete loss as to the reason, documentation is very thin on the ground and the bits I have found simply show what I already have!
should be present. If you are accessing as application please make sure service principal is properly created in the
tenant.
At Do-Authentication:9 char:9
+
    + CategoryInfo          : CloseError: (:) [Connect-AzAccount], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand

A: Oh lord how many times do I answer my own question right after posting it!!!
I did attempt to delete some modules from the list that is the AzureRM ones, I didn't think it let me do it so I ended up just leaving them, I have no idea whether that is relevant or not but thought I'd mention it.
On the Automation Account blad within the Azure portal I clicked on the "Run as accounts" option and it said it was incomplete, I deleted and recreated it and now everything works OK.
Might help someone else so thought I'd post the answer.

A: There are quite a few things to consider while the Az module in Azure Automation. This doc talks about these in greater detail. There is also a note that is worth quoting, from the same doc:

Hope this helps.


Q: correct syntax for merge This question might appear to be very stupid but I don't understand how to merge two sorted vectors with std::merge.
I tried some code using cplusplus reference.
struct t
{
  t(int x):a(x){}
  int a;
};
bool operator<(const t& p,const t&b)
{
  return p.a<b.a;
}

 int main()
 {
  vector<t> a,b,c;
  a.push_back(t(10));
  a.push_back(t(20));
  a.push_back(t(30));
  b.push_back(t(1));
  b.push_back(t(50));
  merge(a.begin(),a.end(),b.begin(),b.end(),c.begin());
  return 0;
 }

There is a segmentation fault with this code.

A: You will want to make sure c is big enough, or grows:
std::merge(a.begin(),a.end(),b.begin(),b.end(),std::back_inserter(c));

Alternatively:
c.resize(a.size() + b.size());
std::merge(a.begin(),a.end(),b.begin(),b.end(),c.begin());

See it Live On Coliru
#include <algorithm>
#include <vector>
#include <iterator>
struct t
{
    t(int x):a(x){}
    int a;
};
bool operator<(const t& p,const t&b)
{
    return p.a<b.a;
}

int main()
{
    std::vector<t> a,b,c;
    a.push_back(t(10));
    a.push_back(t(20));
    a.push_back(t(30));
    b.push_back(t(1));
    b.push_back(t(50));
    std::merge(a.begin(),a.end(),b.begin(),b.end(),std::back_inserter(c));
    return 0;
}


Q: How to stop Translate when I need? I have a cupboard with boxes. When I look on the box and press mouse button, I want to open/close it with Translate. I want to move box, till it's X coordinate will be 1.0 (and start point is 1.345). But it moves longer than that point.

I tried to use FixedUpdate, but it doesn't helped..
public LayerMask mask;

private bool shouldClose;
private bool changeXCoordinate;
private Transform objectToMove;

void Update ()
{
    if (changeXCoordinate)
        OpenCloseBox();
    else if(DoPlayerLookAtCupboardBox() && Input.GetMouseButtonDown(0))
        changeXCoordinate = true;
}

bool DoPlayerLookAtCupboardBox()
{
    RaycastHit _hit;
    Ray _ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0));
    bool isHit = Physics.Raycast(_ray, out _hit, 1.5f, mask.value);

    if (isHit && !changeXCoordinate)
    {
        objectToMove = _hit.transform;
        return true;
    }
    else
        return false;
}

void OpenCloseBox()
{
    if (shouldClose)
    {
        if(objectToMove.position.x != 1.345f) // It must stop at this point, but it don't
        {
            changeXCoordinate = false;
            shouldClose = !shouldClose;
        }
        else
            objectToMove.Translate(Vector3.right * Time.deltaTime);
    }
    else
    {
        if (objectToMove.position.x >= 0.1f) // The same problem here..
        {
            changeXCoordinate = false;
            shouldClose = !shouldClose;
        }
        else
            objectToMove.Translate(Vector3.left * Time.deltaTime);
    }
}

A: Its better to use a tween engine , like http://dotween.demigiant.com/.
If you install Dotween the you can simply use
transform.DOMove(new vector3(1 ,0 , 1) , duration);

You can also set Ease for tweens. or use Oncomplete fucntions;
transform.DOMove(new vector3(1 ,0 , 1) , duration).SetEase(Ease.OutCubic).OnCompelete(() => { shouldClose = true; });

But the answer for your question is that positions are not exact numbers so you shouldn't use something like this != , you must use < or > .
to fix you problem i would recommend you to do something like this ;
if(x > 1.345f)
{
    x = 1.345f
}

This will fix your problem.

A: In this kind of situation, you should use an animation, this allows full control on any aspect of the movement.
If you really want to use code, you could use Vector3.MoveTowards which creates a linear translation from position A to position B by a certain step amount per frame:
transform.position = Vector3.MoveTowards(transform.position, targetPosition, step * Time.deltaTime);

As for your issue, you are checking if the position is a certain float. But comparing float is not accurate in computer due to inaccuracy of value.
1.345 is most likely 1.345xxxxxx and that is not the same as 1.34500000. So it never equal.
EDIT: Using equality also results in the fact that you are checking if the value is greater or equal. But consider this:
start : 10 movement : 3

if(current >= 0){ move(movement);}

frame1 : 10
frame2 : 7
frame3 : 4
frame4 : 1
frame5 : -2 we stop here

This is why you should use animation or MoveTowards when wishing to move to exact point. Or add extra:
if(current >= 0){ move(movement);}
else { position = 0; }


Q: ¿Cómo puedo pasar imagenes a cloud firestore en Android Studio? Tengo una BD en Cloud Firestore, en donde listo caracteristicas de articulos y una de ellas es la foto que logro conseguirla con un uri si es de la galeria y la ruta en string si es una foto (la foto se guarda en los archivos de la app en el dispositivo). La cuestion es como puedo pasarlo para luego mostrarlo en un recyclerview que ya tengo creado y funciona pero no muestra la foto.
He visto varios metodos que lo hacen con el Storage, pero quiero saber si es mas comodo usarlo dentro de la bd con el atributo de tipo referencia

A: Primero deberías de comprobar en tu gradle haber si has metido la librería del storage de firebase.
implementation 'com.google.firebase:firebase-storage:19.2.0'

Luego te dejo aquí el ejemplo de una app que hice yo en la cual subía imagenes a firestore.
   private StorageReference mStorage;

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

        //Aquí creas el metodo de obtención de la imagen ya sea por galeria o camara
        //Luego del metodo de obtención llamas al metodo y te lo subiría directamente
        //creando una carpeta "Fotos" en caso de que no exista

}
private void SubirProducto() {
        final StorageReference FilePath = mStorage.child("Fotos").child(imageUri.getLastPathSegment());

        FilePath.putFile(imageUri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
            @Override
            public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {

              //Esto seria para descargar su token de enlace y poder acceder a ella
              //Si no lo quieres poner no hace falta
              FilePath.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
                    @Override
                    public void onSuccess(Uri uri) {

                    }
                });

            }
        });

    }


Q: Turn warnings into error only within supplied diff At a company I used to work at, the build system was set up to turn warnings into errors only within changed code. It worked by supplying generating a diff (typically between the branch you were trying to merge and master and then supplying that diff to some compilation tool, and the tool would produce warnings only within the supplied diff.
This was great as it allowed you to e.g. deprecate some function, and have the build system prevent people from introducing new uses of that function, and then remove old usages of that function later.
Unfortunately, I didn't look at the setup closely enough before I left the company, and don't know how to replicate it. My question: How can I replicate this setup?
Question is tagged Clang but I would also be interested in answers that use tooling from other compilers.

A: If I had to implement that, my first idea would be:

*

*Get merged file.

*Analyze diff to figure out which regions were changed.

*Generate a new file and inject #pragma directives1 that locally enable/disable warnings around the changed regions.

*Also inject #line directives to make it look like warnings/errors are coming from the original file.

*Compile modified file and save compiler warnings/errors.

*Delete modified file.

*Present compiler diagnostics to the user.

1 E.g. https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas for GCC.

A: Clang supports GCC's #pragma diagnostic.
For example:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuninitialized"

// ... changed code here ...

#pragma GCC diagnostic pop

MSVC also has something similar:
#pragma warning(push, 3)
// ... changed code here ...
#pragma warning(pop)


Q: When ArcMap Rest Create Replica command is used, what is returned? I can access a feature service, and initiate a create replica command - but i am not sure how to digest what is returned.
Example code below:
# Setting up the POST request
create_replica_form_data = {'replicaName':'traggatmot_pull',
                     'layers':0,
                     'layerQueries':'',
                     'geometry':'',
                     'geometryType':'esriGeometryEnvelope',
                     'inSR':'',
                     'replicaSR':'',
                     'transportType':'esriTransportTypeEmbedded',
                     'returnAttachments':'false',
                     'returnAttachmentsDataByUrl':'true',
                     'async':'false',
                     'syncModel':'perLayer',
                     'attachmentsSyncDirection':'none',
                     'replicaOptions':'',
                     'dataFormat':'json',
                     'f':'pjson',
                     'token':token}

r = requests.post("http://services3.arcgis.com/XXXXXXXXXXXXXXX/arcgis/rest/services/XXXXXXXXXXXX/FeatureServer/createReplica", data=create_replica_form_data)

with open("layer_pull.json", 'w') as outfile:
    json.dump(r.json(), outfile)

arcpy.JSONToFeatures_conversion("layer_pull.json", os.path.join("layer_pull.gdb", "layer_pull"))

Error:
arcgisscripting.ExecuteError: ERROR 001558: Error parsing json file 'sades_pull_01_12_2016.json'.
Failed to execute (JSONToFeatures).

This error seems to suggest that the JSON object returned by the CreateReplica request is not in the format that ArcMap is expect.  Here is a snapshot of the beginning:

Is this a GDB in JSON format?  How do I get this file into a GDB?


Q: How to clear boost function? Having a non-empty boost::function, how to make it empty (so when you call .empty() on it you'll get true)?

A: Simply assign it NULL or a default constructed boost::function (which are empty by default):
#include <boost/function.hpp>
#include <iostream>

int foo(int) { return 42; }

int main()
{
    boost::function<int(int)> f = foo;
    std::cout << f.empty();

    f = NULL;
    std::cout << f.empty();

    f = boost::function<int(int)>();
    std::cout << f.empty();
}

Output: 011

A: f.clear() will do the trick. Using the example above
#include <boost/function.hpp>
#include <iostream>

int foo(int) { return 42; }

int main()
{
    boost::function<int(int)> f = foo;
    std::cout << f.empty();

    f.clear();
    std::cout << f.empty();

    f = boost::function<int(int)>();
    std::cout << f.empty();
}

will yield the same result.


Q: No 'Access-Control-Allow-Origin' error in http get I am getting the following error message in ionic project, when i execute http get function.

No 'Access-Control-Allow-Origin' header is present on the requested
  resource. Origin 'https://creator.ionic.io' is therefore not allowed
  access.

My code is, how do i add the headers to remove such error

var ret = {
        all:function(){
            var deferred = $q.defer();

            $http.get(zones_url).then(function(resp){
                console.log(resp);
            });
            return deferred.promise;
        }
    }
        return ret;

Can anyone advice me please.


Q: Modeling attrition of customers - survival analysis? I have a dataset of the following form:
PersonID  Factor1  Factor2  TimeActive  Attrited
   1         A      alpha      19          1
   2         B       zeta      27          0
   3         A      gamma      4           0

Where each row is a person who has certain values for Factor1 and Factor2 (in this case two arbitrary features), and a time that they have been active. For example, person 3 started 4 months ago and has not attrited yet, but person 1 started more than 19 months ago and has attrited.
I would like to use a survival analysis-like method to forecast how long the people that are currently still active will stay active. This should take into account the values they have for Factor1 and Factor2 as well as how long they have been "alive" up until this point.
Is something like a Kaplan-Meier estimator appropriate for this kind of analysis? I have done the legwork to get my data into what I believe to be the right form, now just a bit stuck on how to analyze it.
Thanks for any help!


Q: Figuring out C Declarations like: double (*b)[n] I'm trying to figure out some C declarations. What is the meaning of these C declarations?
double (*b)[n];
double (*c[n])();
double (*d())[n];

A: The basic rule to parse C declarations is "read from right to left and the inside out jumping toward the right when leaving a pair of parenthesis", i.e. start the the most deeply nested pair of parenthesis and then work yourself out looking toward the right. Technically you must know operator associativity, but it works well enough in most situations.
Now lets apply this (simplified) rule to your question:

double (*b)[n];
         ^

b is a

double (*b)[n];
        ^

pointer to

double (*b)[n];
           ^^^

and array

double (*b)[n];
^^^^^^

of doubles.

double (*c[n])();
         ^^^^

c is an array of

double (*c[n])();
        ^

pointers to

double (*c[n])();
              ^^

functions

double (*c[n])();
^^^^^^

returning double.

double (*d())[n];
         ^^^

d is a function

double (*d())[n];
        ^

returning a pointer to

double (*d())[n];
             ^^^

an array of

double (*d())[n];
^^^^^^

doubles

There's a neat utility found on most *nixes, called cdecl, which takes a C declaration string and turns it into a natural language sentence.

A: Let try this way.
first, you should be familiar with these three symbols:
1. *  -- a pointer.
2. [] -- an array.
3. () -- a function.(notice: not parentheses)
we take "double (*d())[n]" as an example.
the first step is to find out the identifier in the declaration, an identifier is the name of variable, here it is "d".
(i)
-- what is "d"?
------------------------------------------------------------------------
look to the right side of the identifier, to see if there is a "[]" or a "()" :
...d[]...: d is an array.
...d()...: d is a function.

if neither, look to the left side, to see if there is a "*" :
...*d...: d is a pointer.
------------------------------------------------------------------------
now we've found that d is a function.
use x to replace d(), then the declaration becomes "double (*x)[n]"
(ii)
-- what is "x"?
------------------------------------------------------------------------
repeat (i), we find that x is a pointer.
that means, d is a function returning a pointer.
------------------------------------------------------------------------
use y to replace *x, then the declaration becomes "double y[n]"
(iii)
-- what is "y"?
------------------------------------------------------------------------
repeat (i), we find that y is an array of n elements.
that means, d is a function returning a pointer to an array of n elements.
------------------------------------------------------------------------
use z to replace y[n], then the declaration becomes "double z"
(iv)
-- what is "z"?
------------------------------------------------------------------------
repeat (i), we find that z is a double.
that means, d is a function returning a pointer to an array of n double elements.
------------------------------------------------------------------------
let's see another expression:
void (*(*f)(int)[n])(char)
1.
  we find f.
2.
  f is a pointer. *f -> a
  void (*a(int)[n])(char)
3.
  a is a function. a() -> b
  void (*b[n])(char)
  --f is a pointer to a function (with an int parameter)--
4.
  b is an array. b[] -> c
  void (*c)(char)
  --f is a pointer to a function returning an array (of n elements)--
5.
  c is a pointer. *c -> d
  void d(char)
  --f is a pointer to a function returning an array of n pointers--
6.
  d is a function returning void.
  --f is a pointer to a function returning an array of n pointers to functions (with a char parameter) returning void--

A: double (*b)[n];

b is a pointer to an array of n doubles
double (*c[n])();

c is an array of n pointers to functions taking unspecified number of arguments and returning double
double (*d())[n];

d is a function taking unspecified number of arguments and returning a pointer to an array of n doubles
In general, in order to parse these kind of declarations in your head, take the following approach. Let's see the last declaration, for example
 double (*d())[n];

what is the first thing that is done to d? It is called with (), therefore it's a function taking unspecified number of arguments and returnig... what's the thing done with the result? It is dereferenced (*), therefore it's a pointer to. The result is then indexed, therefore it's an array of n... what's left? a double, therefore of doubles. Reading the parts in bold, you'll get your answer.
Let's see another example
 void (*(*f)(int)[n])(char)

Here, f is first dereferenced, therefore it's a pointer to... it's then called with (int), therefore a function taking int and returning , the result is then indexed with [n], so an array of n. The result is dereferenced again, so pointers to. Then the result is called by (char), so functions taking char and returning (all is left is void) void. So f is a pointer to a function taking int and returning an array of n pointers to functions taking char and returning void.
HTH

A: There are two great resources to understand "C gibberish":

*

*http://cdecl.org/ - Online service that translates "C gibberish ↔ English"

*The "Clockwise/Spiral Rule" by David Anderson if you want to understand what better what is going on

Output of cdecl.org:

*

*double (*c[n])(): Syntax error (n is not valid here)

*double (*c[])(): declare c as array of pointer to function returning double


Q: sed inline editing fails for multiple sed statements I want to append #SB# at the beginning of every line where it matches a given string
incron.sh
sed -i -e'/test1/s/^/#SB#/g' file1
sed -i -e'/test2/s/^/#SB#/g' file1
sed -i -e'/test4/s/^/#SB#/g' file1

file1
/apps/pmserver $ cat file1
00 45 /ser/bat/ab.sh test1
00 45 /ser/bat/ab.sh test2
00 45 /ser/bat/ab.sh test3
00 45 /ser/bat/ab.sh test4
/apps/pmserver $

I am using Korn Shell.
I can output to a new file but it doesn't work if I have more than one sed statement in a script as shown above. I am getting error
sed: Not a recognized flag: i

What I am trying to do is comment out a few crontab entries belonging to particular team. test1 test2... are their file names and these need to be turned off.

A: The -i argument to sed is a GNU extension. You are likely not running GNU sed, which is why you're getting the error about -i being unrecognized.

A: Your sed is non-GNU (probably) so -i for in place editing is not supported. You can avoid it by using a temporary file:
sed -i -e'/test1/s/^/#SB#/g' file1

becomes
sed -e'/test1/s/^/#SB#/g' file1 > temp_file
mv temp_file file1

Of course you can do it better by using mktemp like this
tmpfile=`mktemp`; sed -e '/test1/s/^/#SB#/g' file1 > $tmpfile; mv $tmpfile file1

Absolutely to avoid sed and redirect without temporary file as your original file will get truncated.

A: You can use Vim in Ex mode:
ex -sc 'g/\vtest(1|2|4)/s/^/#SB#/' -cx file1

*

*g global regex

*\v turn on magic

*s substitute

*x save and close

A: The answers explain, that -i is non standard, one even explains to use a temporary file instead, but they ignore the main question how to do it for multiple statements.
You could of course redirect each statement and copy back after each statement. But you don't need separate sed calls for each statement anyhow, you can specify several scripts with several -e:
sed -e '/test1/s/^/#SB#/g' -e '/test2/s/^/#SB#/g' -e' /test4/s/^/#SB#/g' file1

Or you can concatenate sed commands with ;:
sed '/test1/s/^/#SB#/g;/test2/s/^/#SB#/g;/test4/s/^/#SB#/g' file1

In your example you can even find a regular expression to combine the replacements:
sed '/test[124]/s/^/#SB#/g' file1

Ans once we are improving the script: The g flag to the s commands stands for "substitute all occurences on the line", but as each line has only one beginning (^), you can drop it, so your final job is
sed '/test[124]/s/^/#SB#/' file1 > /tmp/file1 && mv /tmp/file1 file1

(The && is used to avoid destroying you file when sed fails)


Q: calculate mean value for the missing values I need to calculate the mean of neighbor values to replace it with NaN value, but the problem is, I don't want to make my code more complicated.
For example,

I have there 20 countries and 4 car types from 2010 to 2020, but there are some missing values in the beginning or middle or end sometimes next two each other.
The solution came in my mind is that I slice the data and then replace the NaN with 3 neighbors before and after the missed valueS, but it is not always in the middle so there would be in beginning 3 missed values.
What is the best solution for the missing values?

A: Try this
import numpy as np
import pandas as pd

sample_date = { 'countries': ['USA','Canada','USA','UK','USA','UK','DE'],
                'car_type': ['sedan','sedan','Hatchback','coupe','sedan','coupe','coupe'],
                'years': [2010,2010,2011,2011,2017,2017,2010],
                'price': [4000,np.NaN,4000,4000,np.NaN,np.NaN,4000]}
data = pd.DataFrame(sample_date)

fillValue = 4000

data['price'].fillna(value=fillValue, inplace=True)
print('update Dataframe:')
print(data)
mean_value=data['price'].mean()

print(mean_value)

answer will be 4000 as I'm replacing NaN with neighbors as '4000'


Q: Netbeans (Java): 3rd library works but how could I compile it into jar? I'm using 3rd libraries (substance, trident) and I added them as libraries (I added the .jar's) to my project in Netbeans. This works also but if I use the builded jar outside the project directory it doesn't work like it should (the choosen UI don't show), I get the error:

java.lang.ClassNotFoundException:
  org.pushingpixels.substance.api.skin.SubstanceOfficeBlue2007LookAndFeel

I set that UI/LookAndFeel like that in my code:
UIManager.setLookAndFeel("org.pushingpixels.substance.api.skin.SubstanceOfficeBlue2007LookAndFeel");

How could I make this work/run?

A: You've got 2 choices:

*

*Put the library jar on the
classpath.

*Assemble\Build the library jar with
the regular jar.

For option 1, you most likely need the jar located "near" the main jar on the file system; though, this is not necessarily a requirement. When you run the jar you then include the library jar on the classpath.
For option 2, you use some type of tool like maven's assembly plugin or the fatjar plugin in Eclipse (sorry, I don't know what the analog is in NB).
I hope this helps.


Q: Laptop numpad very hot to touch I feel the numpad section of my laptop's keyboard hot when I type my PIN. The standard keyboard section is normal. Fan is loud. How do I fix this?

A: If the keyboard is hot and the fan is running fast, then almost for sure, there is an accumulation of dust inside the laptop.
You need to shut it down, remove the battery, open the case and clean it out inside. Soft brush and very light vacuum to pick up the dust.
Get it clean, close it up and test.


Q: How to use Get-WinEvent to get all information between a specific time period? Some background
I am encountering some crash and freeze issues I want to get a better handle on. For this, I want to investigate all available event & log information for a specific time period.
I have a very good handle on when something bad happened, but not why.
So, f.e. I would like to pull all potentially relevant information from a specific day between a specific 15min period, say "26-11-2021 15:00" to "26-11-2021 15:15".
If found it hard to use the inbuilt windows event-viewer to give me access to this information, as I couldn't figure out how to get information across all log-files to show up in a compact way.

Then I learnt about PowerShell (started as admin) and the Get-WinEvent tool. However, I'm lost in the documentation and couldn't achieve my primary goal:
How can I create a 'filtered' text-file of all (relevant) log-entries from a specific time-period?
After quite some time of internet-browsing, I found a partial solution to my problem, copy-pasting some one-liner I found:

Get-WinEvent -ListLog * | % {Get-WinEvent -FilterHashTable @{LogName=$_.LogName;StartTime="26-11-2021 15:00";EndTime="26-11-2021 15:15"; Level=(1,2,3) } -ea 0} | sort timecreated -des >> C:\temp\events.txt

This is helpful, but without understanding the syntax much, I've noticed two shortcomings:

*

*The output log entries are sometimes truncated, f.e.:

*I don't seem to catch really all entries. In particular, I know that in a specific period a system-restart occurred and would show up in the Event Viewer as critical/error event:

But I can't find that in the generated text-output for the same period of time.
So this led me to believe, that I still don't have found the best way to get what I want.
Any help highly appreciated.


Q: Next.js Add slug/params to clean URL I have a structure with a clean URL in the "pages" folder like this ...
/pages/items/[pageNumber]/index.tsx

And if I use router.push I use it like this to get to that page ...
router.replace("/items/[pageNumber]", "/items/1")

That works great, but now I want to add a query params (for filter) to that URL, how can I do that?
I tried this ...
router.push(`/items/[pageNumber]/`, `/items/1/?${filterParams}`, { shallow: true });

But that doesn't work, and I'm wondering how to do that.

A: When you use it like this
router.push(`/items/[pageNumber]/`, `/items/1/?${filterParams}`, { shallow: true });

you are not passing query params to the page, you are only showing them in the address bar, I guess.
How about something like this:
router.push({
  pathname '/items/[pageNumber]/',
  query: {
    param1: 'yes',
  },
}, {
  pathname: '/items/1/',
  query: {
    param1: 'yes',
  },
});

Don't forget to update query part for your case.


Q: Get list item count from all lists on all webs of site I found the following post that returns lists items from all lists on all webs within a site. I am trying to figure out how to return the list item count instead of the list items. Any assistance would be appreciated.
JSOM dynamicly get two announcements from all lists in all webs
UPDATE:
I am able to return details of all document libraries on a site using this:
function retrieveAllListProperties() {
    var clientContext = new SP.ClientContext.get_current();
    var oWebsite = clientContext.get_web();
    this.collList = oWebsite.get_lists();
    clientContext.load(collList);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}

function onQuerySucceeded() {
    var tCount = 0;
    var listInfo = 'Lists on the current site:' + '\n\n';
    var listEnumerator = collList.getEnumerator();
    while (listEnumerator.moveNext()) {
        var oList = listEnumerator.get_current();
        if (oList.get_baseTemplate() === 101) {
            listInfo += 'URL: ' + oList.get_parentWebUrl() + '  |  Title: ' + oList.get_title() + '  |  BaseType: ' + oList.get_baseTemplate() + '  |  Count: ' + oList.get_itemCount() + '\n';
            tCount += + oList.get_itemCount();
        }
    }
    listInfo += '\nTotal Documents: ' + tCount;
    console.log(listInfo);
}

function onQueryFailed(sender, args) {
    console.log('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}

I am able to return all sites and sub sites of a site collection using this:
function getAllWebs(success,error)
{
    var siteUrl = '/sites/usaraf/g357';

   var ctx = SP.ClientContext.get_current();
   var web = ctx.get_site().get_rootWeb();
   var result = [];
   var level = 0;
   var getAllWebsInner = function(web,result,success,error)
   {
      level++;
      var ctx = web.get_context();
      var webs = web.get_webs();
      ctx.load(webs,'Include(Title,ServerRelativeUrl,Webs)');
      ctx.executeQueryAsync(
         function(){
            for(var i = 0; i < webs.get_count();i++){
                var web = webs.getItemAtIndex(i);
                result.push(web);
                if(web.get_webs().get_count() > 0) {
                   getAllWebsInner(web,result,success,error);
                }
            }
            level--;
            if (level == 0 && success)
              success(result);
        },
        error);
   };

   getAllWebsInner(web,result,success,error);
}

getAllWebs(
 function(allwebs){
    for(var i = 0; i < allwebs.length;i++){
        console.log(allwebs[i].get_title() + "-" + allwebs[i].get_serverRelativeUrl());
    }
 },
function(sender,args){
     console.log(args.get_message());
});

I am trying to figure out how to tie the two together so I return the following for all specified lists on all sites and sub sites.
Lists on the current site:

URL: /sites/usaraf-ea/visa  |  Title: Applications  |  BaseType: 101  |  Count: 24
URL: /sites/usaraf-ea/visa  |  Title: docDropOff  |  BaseType: 101  |  Count: 28
URL: /sites/usaraf-ea/visa  |  Title: docResources  |  BaseType: 101  |  Count: 5
URL: /sites/usaraf-ea/visa  |  Title: Documents  |  BaseType: 101  |  Count: 2
URL: /sites/usaraf-ea/visa  |  Title: Site Assets  |  BaseType: 101  |  Count: 23

Total Documents: 82

A: When you got listitem collection, you could call listItems.get_count() to return items count.
Sample code:
<script type="text/javascript">
        var clientContext = null;
        var web = null;
        ExecuteOrDelayUntilScriptLoaded(getListItemsCount, "sp.js");
        function getListItemsCount() {
            clientContext = new SP.ClientContext.get_current();
            web = clientContext.get_web();
            var list = web.get_lists().getByTitle("Child");
            var camlQuery = new SP.CamlQuery();
            this.listItems = list.getItems(camlQuery);
            clientContext.load(listItems, 'Include(Id)');
            clientContext.executeQueryAsync(function () {
                alert(listItems.get_count());
            },
            function () {
                alert('error');
            });
        }
    </script>


Q: Controlling Multiple Switch button in Android I'm Building a simple profile manager android application Using Switch Button in Android.
There are 3 switches named General,Silent and Vibrate.
Problem is all 3 switches are working together

I want the General Switch to be disabled when the silent switch is activated and silent to be disable when the general Switch is activated.
Where is my Code and what should be added ?
general = (Switch) findViewById(R.id.generalSwitch);
    silent  = (Switch) findViewById(R.id.silentSwitch);
    vibrate = (Switch) findViewById(R.id.vibrateSwitch);

    myAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

    general.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v){
            myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
            Toast.makeText(MainActivity.this,"General Mode Activated",Toast.LENGTH_LONG).show();
        }
    });

    silent.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            myAudioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
            Toast.makeText(MainActivity.this,"Silent Mode Activated",Toast.LENGTH_LONG).show();
        }
    });

    vibrate.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            myAudioManager.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
            Toast.makeText(MainActivity.this,"Vibrate Mode Activated", Toast.LENGTH_LONG).show();
        }
    });

`

A: Test with this:
    general.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

            if(isChecked){
                silent.setChecked(false);
            }

        }
    });

    silent.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

            if(isChecked){
                general.setChecked(false);
            }

        }
    });

if general switch is inactive and silent switch is active, when you press general, this change your state to active and you change silent switch to inactive.

A: When you say disabled first thing I imagine is switch can not to be touchable. Like in the picture.

If you want to do something like this you should add in setOnClickListener block
something like ;
silent.setEnabled(false)

But I think you meant that;
When the silent switch is ON general switch is OFF and when the general switch is ON silent switch is OFF
Than you can use setChecked method.
Like this;
 general.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v){
            myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
            Toast.makeText(MainActivity.this,"General Mode Activated",Toast.LENGTH_LONG).show();
 silent.setChecked(false);
        }
    });

    silent.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            myAudioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
            Toast.makeText(MainActivity.this,"Silent Mode Activated",Toast.LENGTH_LONG).show();
 general.setChecked(false);
        }
    });


Q: how to hide some models in django grappelli admin? How to hide some of the models?
I need them registred to be used by other models, while calling via FK or nested etc.
I found one solution which is rather much about view layer of (MVC)
http://blog.jholster.com/post/1534211028/hide-app-names-in-django-admin
I would like to set it in admin.py, that some of registred models are hidden.

A: If the models are in your application, just don't register them in the first place. If the model is in a third party app like the django.contrib.auth then use AdminSite unregister method. You can put this in any admin.py or urls.py important is to be discovered by the admin.autodiscover.
# admin.py
from django.contrib.auth.models import User

admin.site.unregister(User)


Q: ImportError: DLL load failed: The file cannot be accessed by the system Traceback (most recent call last):

  File "<ipython-input-9-a40793f9ded7>", line 7, in <module>
    from sklearn.model_selection import train_test_split

  File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\__init__.py", line 76, in <module>
    from .base import clone

  File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\base.py", line 16, in <module>
    from .utils import _IS_32BIT

  File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\__init__.py", line 20, in <module>
    from .validation import (as_float_array,

  File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\validation.py", line 21, in <module>
    from .fixes import _object_dtype_isnan

  File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\fixes.py", line 18, in <module>
    from scipy.sparse.linalg import lsqr as sparse_lsqr  # noqa

  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse\linalg\__init__.py", line 113, in <module>
    from .isolve import *

  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse\linalg\isolve\__init__.py", line 6, in <module>
    from .iterative import *

  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 10, in <module>
    from . import _iterative

ImportError: DLL load failed: The file cannot be accessed by the system.

Got this error while trying to run some already used python scripts on pycharm. Has anybody had this error before and has he solved it? It started after I installed a package in python but never used it. The problem is located when I try to import train_test_split on scikit-learn and tensorflow, the sklearn package and seaborn. The other parts of the code seem unaffected.
I have already reinstalled anaconda and python as well as changing the python files. Any help would be greatly appreciated.

A: After reinstalling the python as well as updating all the packages (conda update --all) and changing the PATH file, it seems that the issue is solved in all of my IDE's except PyCharm. It seems that all that remains is an interpreter issue. I will post updates if something else comes into my attention.


Q: how to derive the mean square risk equation I notice there is an equation
$$E_{X,Y\sim P}[(f(X)-Y)^2] = E_{X\sim P_X}[(f(X)-E[Y|X])^2] + E_{X,Y\sim P}[(Y-E[Y|X])^2]$$
LHS = $E[(f(X)-E[Y|X])^2] + E[(Y-E[Y|X])^2] + 2E[(f(X)-E[Y|X])(E[Y|X]-Y)]$
I know $E(E[Y|X]-Y)) = 0$, but how to see $f(X)-E[Y|X]$ and $E[Y|X]-Y$ are independent?

A: $$E_X\left\{E_{Y|X}[(f(X)-E_{Y|X}[Y|X])(E_{Y|X}[Y|X]-Y)]\right\}$$
$$=E_X\left\{(f(X)-E_{Y|X}[Y|X])E_{Y|X}(E_{Y|X}[Y|X]-Y)\right\} $$
$$=E_X\left\{(f(X)-E_{Y|X}[Y|X])(E_{Y|X}[Y|X]-E_{Y|X}(Y))\right\} $$
$$=E_X\left\{(f(X)-E_{Y|X}[Y|X])(E_{Y|X}[Y|X]-E_{Y|X}(Y|X))\right\} $$
$$=E_X\left\{(f(X)-E_{Y|X}[Y|X])0\right\} $$
$$=0$$
The key step is that $f(X)-E_{Y|X}(Y|X)$ is function of $X$ and has no $Y$ involved, So in the first step when $E_{Y|X}$ is performed, $f(X)-E_{Y|X}(Y|X)$ is a constant in term of $Y$ and can be separated.


Q: WordPress: Getting title tag in PHP variable I am using Yoast SEO for SEO on the website. In my header file I have added
<title><?php wp_title( '|', true, 'right' ); ?></title>
I have also added <?php wp_head(); ?> in header.
Also enabled Force rewrite titles but still the title tag which I have added in page while editing it, in SEO Snippet is not displaying on webpage.
I have not added support for add_theme_support( 'title-tag' ); - Adding it and removing title tag from head also won't make any difference
So my question here is how I can grab the title tag Added in snippet and at list echo it out in page. On API for Yoast they have listed some hooks and filters but their are no examples.
Can get it by wpseo_title?

A: Make sure to add add_theme_support( 'title-tag' ); in functions.php and remove any <title></title> tags from header.php


Q: php streaming wav in firefox vs chrome I have a hidden audio element in a page, and i'm setting the source dynamically. im setting it as a php page with a GET request that finds the file based on the GET parameter.
However, the audio element is taking the wav file just fine in Chrome but not in firefox. Here is the query and html

<audio id = "play_wav" controls>
set source

and here's get_wav.php
if(isset($_GET['fname])){
    $fname = $_GET['fname'];
    readfile($fname);
}

So this is working to play streaming audio in chrome but not in firefox. The source is still being set it's just not loading. Any suggestions?

A: First off, you should not store the audio files in the same directory as your php files because its easy to protect from someone loading your PHP files by using the basename() function to isolate the filename else you must make further checks its not a php or system file path thats been passed to the $_GET['fname'] parameter, you should also put a .htaccess in the media folder with deny from all in it, this will stop direct access and if you want to be able to stream with seek-able functionality then you need to handle the HTTP_RANGE headers.
<?php
if(!empty($_GET['fname'])){
    $file_name = './wav_files/'.basename($_GET['fname']);
    stream($file_name, 'audio/wav');
}

/**
 * Streamable file handler
 *
 * @param String $file_location
 * @param Header|String $content_type
 * @return content
 */
function stream($file, $content_type = 'application/octet-stream') {

    // Make sure the files exists
    if (!file_exists($file)) {
        header("HTTP/1.1 404 Not Found");
        exit;
    }

    // Get file size
    $filesize = sprintf("%u", filesize($file));

    // Handle 'Range' header
    if(isset($_SERVER['HTTP_RANGE'])){
        $range = $_SERVER['HTTP_RANGE'];
    }elseif($apache = apache_request_headers()){
        $headers = array();
        foreach ($apache as $header => $val){
            $headers[strtolower($header)] = $val;
        }
        if(isset($headers['range'])){
            $range = $headers['range'];
        }
        else $range = FALSE;
    } else $range = FALSE;

    //Is range
    if($range){
        $partial = true;
        list($param, $range) = explode('=',$range);
        // Bad request - range unit is not 'bytes'
        if(strtolower(trim($param)) != 'bytes'){
            header("HTTP/1.1 400 Invalid Request");
            exit;
        }
        // Get range values
        $range = explode(',',$range);
        $range = explode('-',$range[0]);
        // Deal with range values
        if ($range[0] === ''){
            $end = $filesize - 1;
            $start = $end - intval($range[0]);
        } else if ($range[1] === '') {
            $start = intval($range[0]);
            $end = $filesize - 1;
        }else{
            // Both numbers present, return specific range
            $start = intval($range[0]);
            $end = intval($range[1]);
            if ($end >= $filesize || (!$start && (!$end || $end == ($filesize - 1)))) $partial = false;
        }
        $length = $end - $start + 1;
    }
    // No range requested
    else {
        $partial = false;
        $length = $filesize;
    }

    // Send standard headers
    header("Content-Type: $content_type");
    header("Content-Length: $length");
    header('Accept-Ranges: bytes');

    // send extra headers for range handling...
    if ($partial) {
        header('HTTP/1.1 206 Partial Content');
        header("Content-Range: bytes $start-$end/$filesize");
        if (!$fp = fopen($file, 'rb')) { // Error out if we can't read the file
            header("HTTP/1.1 500 Internal Server Error");
            exit;
        }
        if ($start) fseek($fp,$start);
        while($length){
            set_time_limit(0);
            $read = ($length > 8192) ? 8192 : $length;
            $length -= $read;
            print(fread($fp,$read));
        }
        fclose($fp);
    }
    //just send the whole file
    else readfile($file);
    exit;
}
?>


Q: Prove that the map $\theta(f(\alpha))=f^\sigma(\beta)$ is injective I'm reading Lang's algebra chapter about Field theory and Galois theory. There is a theorem that says:

Let $k$ be a field, $E$ an algebraic extension of $k$, and
  $\sigma:k\to L$ an embedding into an algebraically closed field $L$.
  Then there is an extension of $\sigma$ to an embedding of $E$ in $L$.

The proof uses Zorn' lemma but also uses the following (I think) to prove that the maximal element is indeed the desired embedding:

If $E=k(\alpha)$ (The smallest field containing $k$ and $\alpha$),
  $\alpha$ is algebraic over $k$ and $\sigma:k\to L$ is an embedding
  into an algebraically closed field $L$ then there is an extension of
  $\sigma$ to an embedding $\theta:k(\alpha)\to L$

Lang sets $\theta(f(\alpha))=f^\sigma(\beta)$ where $f\in k[X]$ and $\beta$ is a root of $f^\sigma$. I understand that such a map is well defined and an homomorphism but I can't see why it is injective (Lang's doesn't say so explicitly but his proof requires that $\theta$ be injective (I think))

A: Homomorphisms of fields are always injective provided you require $1$ to be sent to $1$. This is because fields have only trivial ideals, so the kernel must be $\{0\}$.


Q: thymeleaf get first 3 objects Could you please help me.
I want to display my first 3 objects from product, I don't how it must be.
I try to use thymeleaf sequence, but it don't work. Maybe somebody can hint me how it could be done.
HTML:

Delete

Edit

Controller:
@GetMapping("/products")
public String seeAllProductsIntoAList(Model model){
    model.addAttribute("products", productService.findAll());
    model.addAttribute("categories", categoryService.findAll());
    return "/productView/products";
}

It would be great if somebody can hint me with this issue.
Thank you.

A: Since products is list of Product, you have to iterate over that list. On thymeleaf you can use th:each attribute to do iteration. So for your case you can use something as below. Give it a try.
<th:each="product,iterStat: ${products}" th:if="${iterStat.index} <3">

I am not entirely sure but based on your question you wanted only first three objects. For this you can use status variable that are defined in th:each. More detail you can find here.

A: Here's the way you do it with the #{numbers} context object.

    Delete
    Edit


Q: Codeigniter Email class inside a model Is it possible to use the Codeigniter Email class within a Model?
I have been trying to but it refuses to load the mail object. In general, are libraries allowed to be loaded into models?
Code
<?php

class ClubInvitation extends DataMapper {

        var $table = "club_invitations";
        var $has_one = array("club");

        public function __construct($id){
            parent::__construct($id);
            $this->load->library('email');
        }

        public function inviteEmailToClub($email, $club, $message){
            $invite = new ClubInvitation();
            $invite->email = $email;
            $invite->code = random_string('unique', null);
            //$invite->save($club);

            $club->ClubAdmin->limit(1);
            $mainClubAdmin = $club->ClubAdmin->get()->User->get();
            $data['club'] = $club;
            $data['message'] = $message;
            $data['club_leader'] = $mainClubAdmin;
            $data['invite_code'] = $invite->code;

            $email_body = $this->WBLayout->emailTemplate('invited_to_club', $data);
            $this->email->from($mainClubAdmin->User->getAccount()->email, $club->name);
            $this->email->to($email);
            $this->email->subject($club->name.' has invited you to join');
            $this->email->message($email_body);
            $this->email->send();
        }

}

A: Normally, libraries are loaded in controller and accessed from there, not from models. You could just return the array of data from your model to controller and use email library from controller itself. If thats not feasible for you, then try doing:
public function __construct($id){
   parent::__construct($id);
}

public function inviteEmailToClub($email, $club, $message){
   $CI =& get_instance();
   $CI->load->library('email');
   .....
   $CI->email->from($mainClubAdmin->User->getAccount()->email, $club->name);
   ....
}


Q: PostgreSQL 1 to many trigger procedure I wrote this query in PostgreSQL:
CREATE OR REPLACE FUNCTION pippo() RETURNS TRIGGER AS $$
BEGIN
  CHECK (NOT EXISTS (SELECT * FROM padre WHERE cod_fis NOT IN (SELECT padre FROM paternita)));
END;
$$ LANGUAGE plpgsql;

It returns:

Syntax error at or near CHECK.

I wrote this code because I have to realize a 1..n link between two tables.

A: You can't use CHECK here. CHECK is for table and column constraints.
Two further notes:

*

*If this is supposed to be a statement level constraint trigger, I'm guessing you're actually looking for IF ... THEN RAISE EXCEPTION 'message'; END IF;
(If not, you may want to expand and clarify what you're trying to do.)

*The function should return NEW, OLD or NULL.


Q: words to describe unqualified person The context:
Our manager is always complaining us about using private phones during working hours. However, whenever our General Director is out of the office. This manager keeps using his phone or doing private things the whole day. Supposed that,
if he criticize us next time, can we say

You're not capable of criticizing us because you are also using your
  phone all day long.

I'm not sure if it is correct  and natural or not. Could you help me?
About the context, actually I just made it up to speak my mind easily. I might not dare to say that to my manager :)). I will use your suggestions in another similar context with another person.

A: A couple of idiomatic ways to point out the boss' hypocrisy in this matter would be

*

*You're a fine one to talk  (This could be shortened to just "You're one to talk"): you are guilty of doing the thing you have just criticized.
see TheFreeDictionary.com's definition

*That's rich, coming from you (This could also be shortened, to just "That's rich!"): That's an unfair criticism because the behavior of the person saying it is the same.
 see TheFreeDictionary.com's definition

Again, as noted elsewhere, actually saying these to your boss will most likely get you in trouble.  But shifting them to the third person ("He's a fine one to talk" and "That's rich, coming from him!") makes them very well-suited for commiserating with your coworkers about him.

A:
Supposed that, if he criticize us next time, can we say, "You're not capable of criticizing us because you are also using your phone all day long."

As the word "hypocrite" is already discussed, you could also describe such instances using the following idioms:
1) The person does not practice what he/she preaches.
- (from one of the search results) to do the things that you advise other people to do.
2) The person does not walk the talk.
- (from the link) This phrase indicates that failing to match behavior with talk results in loss of credibility and trust.
e.g.,
"He should not tell me not to do this because he doesn't practice what he preaches." or
"He should not tell me not to do this because he doesn't walk the talk."

A: I don't think capable fits in your examples as he has the capacity to say so. You could try shouldn't instead:

You shouldn't criticize us because you are also using your phone all day long.

You can use shouldn't to give your opinion about the manager's actions. You can simplify it with for:

You shouldn't criticize us for something you do all day long.

If you're interested in an alternate phrase, you could consider look who's talking:

look who's talking
  One is guilty of the same thing they have just criticized. A: "Kathy never pays attention in class." B: "Look who's talking! Just today I saw you reading a magazine during the lecture."
  (TFD)

Example.

Manager: Checking your phone during work hours is bad for productivity!
  You: Look who's talking! You're on your phone all day.

As others have mentioned, talking to your manager this way could get you in trouble, so be careful.

A: I don't think it's natural at all because I don't think a native English speaker would say "criticize" there. Criticize is too formal for a conversation like that, but you might use it in an e-mail or a StackExchange post asking what to do about your horrible boss.
You could use "complain" instead, like "Who are you to complain? You were on your phone all day yesterday." But actually I think most people would just say, "Weren't you on your phone all day yesterday?" and leave the rest of the meaning implied.
If you wanted something more idiomatic, you could say "Isn't that the pot calling the kettle black?" which means roughly that someone shouldn't complain about something they also do.
P.S. As others have pointed out, all of these will certainly get you in trouble at work, so these phrases are more common in social settings.

A: Setting aside the workplace issues ...
are not capable of criticizing and you are also are grammatical but a tad stiff there. You'd want to say

You can't criticize us since you're using your phone all day long too.
Since you're using your phone all day long too, you can't criticize us.

And if you really want to "get in your manager's face" about it:

Who are you to criticize us when you use your phone all day long too.

P.S. This is a rhetorical question (and thus a kind of assertion) whose answer resolves to You are not anyone to criticize us.  In other words, "You have no right to criticize us".  It is similar to Who do you think you are, criticizing us!  In other words, "What special rights or privileges do you believe you have, that would allow you to criticize us!" And the implied answer is "None!"

A: According to the Cambridge Dictionary, capable means having the ability, power, or qualities to be able to do something. Clearly, your boss is capable of telling you not to use your phone, as he is actually doing it.
What you can say is that he is being a hypocrite (someone who says they have particular moral beliefs but behaves in way that shows these are not sincere) or, better, that he has double standards (a rule or standard of good behaviour that, unfairly, some people are expected to follow or achieve but other people are not). You could also simply say that it is not fair to forbid you to do something that he also does.
Whether it's a good idea to say something like this to your boss is another matter. Your boss probably thinks that his position entitles him to certain privileges that you are not entitled to, and would be annoyed if you made it clear that you view things differently.
Note that, for habitual actions, we normally use simple present "you use your phone" rather than present continuous "you are using your phone".

A: There is also a statement of "That's the Pot calling the Kettle black." Idiomatically from the way iron cookware can develop black streaks from soot and burning from open flame cooking, the implication is, again, that the person  who is criticising you is also guilty of the same thing, or in the same state as you, so cannot speak from a position of superiority.
The only problem you may find with this is in certain cultures and situations, the word black holds a lot of cultural and political overtones that were nothing to do with the original idiom but may be read into it by the listener.
Even this has now been subject to usage contraction, and a simple response of "pot/kettle" may suffice.


Q: Php, Mysql can't retrieve column data for each row I'm trying to give each modal form a unique id based on results retrieved from my database so that different data will be passed onto the php form processor. I have 1 table that is placed in a form which has the unique value for each row being "mapid"
However, each row also has a modal which I've placed another form in but the only value I'm getting is the first row of the sql query. Please help.
    $sql = "SELECT mapid, location, DATE_FORMAT(date,'%d/%m/%y') AS date, status FROM maps ORDER BY status DESC, date DESC ";
$result = $mysqli->query($sql);

if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {

echo
'
<form action="map.php" method="post">

         '. $row["mapid"].'

         '. $row["location"].'

         ' . ($row["status"]=='0' ? 'Last Done' : (($row["status"]=='1') ? 'Started' : 'Done')).'

         '.$row["date"].'

         ' .
        (($row["status"]=='0') ?
            '<input type="hidden" name="mapid" value="'. $row["mapid"].'"/>
            <input type="hidden" name="start" value="start"/>
                <button class="btn btn-primary" name="getmap" type="submit">Start</button>'

        : (($row["status"]=='1') ?
            '<input type="hidden" name="mapid" value="'. $row["mapid"].'"/>
            <input type="hidden" name="resume" value="resume"/>
            <button class="btn btn-danger" type="submit" name="getmap" value="'. $row["mapid"].'">Resume</button>'

        : (($row["status"]=='2') ?
           '<input type="hidden" name="mapid" value="'. $row["mapid"].'"/>
            <input type="hidden" name="process" value="process"/>
                <button class="btn btn-primary" type="submit" name="getmap">Process</button>'
        : ''))) . '

</form>

            <button class="btn btn-primary" data-toggle="modal" data-target="#assign['. $row["mapid"].']">Assign</button>

                <form action="work/allocate.php" method="post">

Assign Map

                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        ×
                    </button>

                    <input type="hidden" name="mapid">

 Assign Map '. $row["mapid"].' - '. $row["location"].'  to:

                    <input class="form-control" id="name" name="name" type="text" >

                    <button class="btn btn-primary" name="assigned" id="assigned" type="submit">Assign</button>

               </form>

    '

A: Just needed to give the modal a unique id by adding ['. $row["mapid"].'] next to #assign.

            <button class="btn btn-primary" data-toggle="modal" data-target="#assign['. $row["mapid"].']" value"">Assign</button>


Q: AKS - Kube State metrics Supported versions I am using AKS and recently upgraded to AKS 1.24.6.
How to determine what version of kube state metrics supports what AKS version?
I am looking at this https://github.com/kubernetes/kube-state-metrics
I am unable to understand the matrix given between Kube state metrics and Client-Go version.

A: According to the matrix, you can either use v2.5.0 or v2.6.0.


Q: Return result when count is below given value in spring mongodb I am relatively new to mongodb and spring data.
I am looking for a way to perform operation below in thread-safe manner. In implementation below, it is possible that result set will exceed 1000 after if statement is executed and just before result is queried.
How do I perform such operation atomically?
if (mongoTemplate.count(myQuery, Document.class) > 1000) {
    throw new ResultSetTooLargeException()
}

return mongoTemplate.find(myQuery, Document::class.java)

A: You cannot do it atomically but you can use limit which reduces it.
return mongoTemplate.find(myQuery.limit(1000), Document::class.java)


Q: Slick2d locating an x and y through pixel colour I am trying to make holdable items for my slick2d game, I figured a good way to do this would be to have a hand on the player, to do this i have 1 pixel a unique colour, allowing me to locate that colour, and the x +y.
It worked perfectly until i tried to scale up the image and i get this crazy out of bounds exeception.
this is my code to find the x and y:
    public int[] getLocation(Image i, Color c){
    Image scaled = i.getScaledCopy(getWidth(), getHeight());
    for(int x = 0; x < scaled.getWidth(); x++){
        for(int y = 0; y < scaled.getHeight(); y++){
            if(scaled.getColor(x, y).r == c.r && scaled.getColor(x, y).g == c.g && scaled.getColor(x, y).b == c.b){
                int[] xy = {x,y};
                return xy;

            }
        }
    }
    return null;
}

and this is how i use it
    float x = (float) (getLocation(walkLeft.getCurrentFrame(), new Color(1, 1, 1))[0] + getX());
    float y = (float) (getLocation(walkLeft.getCurrentFrame(), new Color(1, 1, 1))[1] + getY());
    g.fillRect(x, y, 2, 2);

the exception is:
java.lang.ArrayIndexOutOfBoundsException: 16384

and it leads me back to this line:
                if(i.getColor(x, y).r == c.r && i.getColor(x, y).g == c.g && i.getColor(x, y).b == c.b){

in the getLocation method..
I have a feeling its dead easy, yet its stumped me. Thanks to anyone to responds.

A: The loop(s) in getLocation loop over the dimensions of a 2x scaled copy of the Image, but then attempt to access the pixels of the original. Given the original is half the size, when you are half-way through the loop you will be out of bounds of the image dimensions. Either:

*

*Don't scale the Image

*If you must scale the Image, check the pixel value of the scaled image rather than the original.

As an aside, the code posted contains redundant calls...a) in getLocation if you are going to scale, consider scaling the image once rather than placing that code within the loop itself b) no need to call getLocation twice with the same parameters. Call it once and just use the returned array


Q: I have a .mp4 video how i can add water mark I have .mp4 video and i want to generate new video from that with watermarked on proper place.
Is there possibilities where i can create function and pass video it will return me Water marked video.

A: try this :
This code is add a text or string ON the video and after saving video you will play on any player.
Most Advantage of this code is Provide video with sound. And all things in one code(that is text and image).
    #import <AVFoundation/AVFoundation.h>

    -(void)MixVideoWithText
    {
        AVURLAsset* videoAsset = [[AVURLAsset alloc]initWithURL:url options:nil];
        AVMutableComposition* mixComposition = [AVMutableComposition composition];

        AVMutableCompositionTrack *compositionVideoTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
        AVAssetTrack *clipVideoTrack = [[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0];
        AVMutableCompositionTrack *compositionAudioTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
        AVAssetTrack *clipAudioTrack = [[videoAsset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0];
        //If you need audio as well add the Asset Track for audio here

        [compositionVideoTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, videoAsset.duration) ofTrack:clipVideoTrack atTime:kCMTimeZero error:nil];
        [compositionAudioTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, videoAsset.duration) ofTrack:clipAudioTrack atTime:kCMTimeZero error:nil];

        [compositionVideoTrack setPreferredTransform:[[[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] preferredTransform]];

        CGSize sizeOfVideo=[videoAsset naturalSize];

        //TextLayer defines the text they want to add in Video
        //Text of watermark
        CATextLayer *textOfvideo=[[CATextLayer alloc] init];
        textOfvideo.string=[NSString stringWithFormat:@"%@",text];//text is shows the text that you want add in video.
        [textOfvideo setFont:(__bridge CFTypeRef)([UIFont fontWithName:[NSString stringWithFormat:@"%@",fontUsed] size:13])];//fontUsed is the name of font
        [textOfvideo setFrame:CGRectMake(0, 0, sizeOfVideo.width, sizeOfVideo.height/6)];
        [textOfvideo setAlignmentMode:kCAAlignmentCenter];
        [textOfvideo setForegroundColor:[selectedColour CGColor]];

        //Image of watermark
        UIImage *myImage=[UIImage imageNamed:@"one.png"];
        CALayer layerCa = [CALayer layer];
        layerCa.contents = (id)myImage.CGImage;
        layerCa.frame = CGRectMake(0, 0, sizeOfVideo.width, sizeOfVideo.height);
        layerCa.opacity = 1.0;

        CALayer *optionalLayer=[CALayer layer];
        [optionalL addSublayer:textOfvideo];
        optionalL.frame=CGRectMake(0, 0, sizeOfVideo.width, sizeOfVideo.height);
        [optionalL setMasksToBounds:YES];

        CALayer *parentLayer=[CALayer layer];
        CALayer *videoLayer=[CALayer layer];
        parentLayer.frame=CGRectMake(0, 0, sizeOfVideo.width, sizeOfVideo.height);
        videoLayer.frame=CGRectMake(0, 0, sizeOfVideo.width, sizeOfVideo.height);
        [parentLayer addSublayer:videoLayer];
        [parentLayer addSublayer:optionalLayer];
        [parentLayer addSublayer:layerCa];

        AVMutableVideoComposition *videoComposition=[AVMutableVideoComposition videoComposition] ;
        videoComposition.frameDuration=CMTimeMake(1, 30);
        videoComposition.renderSize=sizeOfVideo;
        videoComposition.animationTool=[AVVideoCompositionCoreAnimationTool videoCompositionCoreAnimationToolWithPostProcessingAsVideoLayer:videoLayer inLayer:parentLayer];

        AVMutableVideoCompositionInstruction *instruction = [AVMutableVideoCompositionInstruction videoCompositionInstruction];
        instruction.timeRange = CMTimeRangeMake(kCMTimeZero, [mixComposition duration]);
        AVAssetTrack *videoTrack = [[mixComposition tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0];
        AVMutableVideoCompositionLayerInstruction* layerInstruction = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:videoTrack];
        instruction.layerInstructions = [NSArray arrayWithObject:layerInstruction];
        videoComposition.instructions = [NSArray arrayWithObject: instruction];

        NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0];
        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
        [dateFormatter setDateFormat:@"yyyy-MM-dd_HH-mm-ss"];
        NSString *destinationPath = [documentsDirectory stringByAppendingFormat:@"/utput_%@.mov", [dateFormatter stringFromDate:[NSDate date]]];

        AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:mixComposition presetName:AVAssetExportPresetMediumQuality];
        exportSession.videoComposition=videoComposition;

        exportSession.outputURL = [NSURL fileURLWithPath:destinationPath];
        exportSession.outputFileType = AVFileTypeQuickTimeMovie;
        [exportSession exportAsynchronouslyWithCompletionHandler:^{
        switch (exportSession.status)
        {
            case AVAssetExportSessionStatusCompleted:
                NSLog(@"Export OK");
                if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(destinationPath)) {
                    UISaveVideoAtPathToSavedPhotosAlbum(destinationPath, self, @selector(video:didFinishSavingWithError:contextInfo:), nil);
                }
                break;
            case AVAssetExportSessionStatusFailed:
                NSLog (@"AVAssetExportSessionStatusFailed: %@", exportSession.error);
                break;
            case AVAssetExportSessionStatusCancelled:
                NSLog(@"Export Cancelled");
                break;
        }
      }];
    }
Shows the error they will come after saving video.

    -(void) video: (NSString *) videoPath didFinishSavingWithError: (NSError *) error contextInfo: (void *) contextInfo
    {
        if(error)
            NSLog(@"Finished saving video with error: %@", error);
    }

From :https://stackoverflow.com/a/22016800/3901620


Q: If two tangents can be drawn to distinct branches of hyperbola $x^2-\frac{y^2}{4}=1$ from the point $(a,a^2)$, then pick the options
$ a\in (-2,0)$
$a\in (0,2)$
$a\in (-\infty, -2)$
$a\in (\infty, 2)$

The equation for tangent is
$$a^2=ma \pm \sqrt{m^2-4}$$
$$m^2-4=a^4+m^2a^2-2ma^3$$
$$m^2(1-a^2)+2ma^3-(4+a^4)=0$$
For two distinct values
$$a^6+(1-a^2)(a^4+4)>0$$
$$a^4-4a^2+4>0$$
$$(a^2-2)^2>0$$
So $a>\sqrt 2$ and $a<-\sqrt 2$
But this doesn’t match with any of the given options. What’s am I doing wrong?

A: Note that the asymptotes of $x^2-\frac{y^2}{4}=1$ are $y=\pm 2x$, which intersect $y=x^2$, the curve of $(a,a^2)$ at $x=\pm2$.
Geometrically, for any point $(a,a^2)$ above the asymptotes, there is only one tangent line that can be drawn to either branch of the hyperbola, which can also be seen from that $a^2=ma \pm \sqrt{m^2-4}$ has only one root $m$ for each branch for $|a| >2$.
Thus, the options are $a\in(-\infty,-2)$ and $a\in (2,\infty)$.

A: You’ve drawn the wrong conclusion from the last inequality. The square of any real number is nonnegative, so for any $a\ne\pm\sqrt2$, $(a^2-2)^2\gt0$.
The more fundamental problem with your approach to a solution, though, is that you’re looking at the wrong condition. You’re looking for points on the parabola $y=x^2$ though which two tangents can be drawn, but two tangents can be drawn to a hyperbola through any point that lies between its branches except along its asymptotes (and even there, if you consider the asymptotes to be tangents at infinity). The only two points on the parabola that aren’t in between the hyperbola’s branches are its two points of intersection with it, corresponding to $a=\pm\sqrt2$. What you really need to consider instead is where the points of tangency lie. Since this hyperbola’s branches lie on either side of the $y$-axis, this means that the $x$-coordinates of the points of contact should have opposite signs.
The extension of the chord of contact is the polar of $(a,a^2)$, namely $$ax-{a^2y\over4}=1.$$ Find the intersections of this line with the hyperbola and then find the conditions on $a$ for the product (or ratio, whichever gives you a simpler expression to work with) of their $x$-coordinates to be negative. You’ll need to take some care with values of $a$ for which either expression vanishes since by examining the product or ratio you’re effectively using the reciprocal of one or the other of them.


Q: Does OpenVPN server require a public IP address? Does OpenVPN server require a public IP address so that an OpenVPN client can connect from anywhere? I mean anywhere where internet access is granted.

A: Yes, OpenVPN server requires a public, routable IP address and uses port 1194/UDP by default.


Q: How to send a single-image in MediaPipe Javascript? Can you explain me how to send a single-image in MediaPipe Hand with Javascript? (from an uploaded image)
I used the Mediapipe Hand python-solution with a single-image like in the jupyther/google collab demo
I would like to do the same operation in javascript but I can't find any solution
Thanks !


Q: How do I create a top 3 chart list in google sheet I have a column in google sheet that has random numbers from 1 to 20.
I want to create a chart that shows the top 3 numbers that occurred in that column.
Example:
Lucky numbers:

so on....
TIA

A: Let's assume the answer to my questions was 'yes', you want the three numbers that occur most often and how often they occur.
I've tried a couple of ways of doing this. One way is to sort the numbers and use FREQUENCY to get the frequencies. Then you could use a query like this to get the top 3
=query(A1:B20,"select A,B order by B desc limit 3")

Another way is to get the mode, then the mode excluding the most frequent, then the mode excluding both of the previous ones etc.
=ArrayFormula(mode(if(iserror(match(A$2:A$20,F$1:F1,0)),A$2:A$20)))

starting in F2 - you don't need to sort them.
Then you can just use COUNTIF to get how many times they occur.
Then just put them into a chart.


Q: Write to a unique attribute of a non unique div folks!
I have two variables:
var day =  $(this).text();
var day_id =   $(this).data('num');

I have HTML inputs with unique ID:
<input class="update_day" data-id="88" type="text" value="5" name="day">
<input class="update_day" data-id="89 type="text" value="5" name="day">
<input class="update_day" data-id="90" type="text" value="5" name="day">

etc...
I need to update a SPECIFIC input (stored in variable "day_id") with certain data (stored in "day")
It is supposed to look like this:
$(".update_day WHERE data-id= day_id).val(day);

Thank you in advance! Sorry for the newbee question. I have honestly been trying to solve it myself.

A: Try
$(".update_day[data-id='90']").val(day);

if value is stored in variable day_id
$(".update_day[data-id='" + day_id + "']").val(day);

Attribute equals selector


Q: SSIS 2012 SP1 "Value of null is not valid for stream" error on designer components I have just migrated a project from SSIS 2005 to SSIS 2012
Apart from the project, I had a custom pipeline component, which was also migrated to .NET 4.0, and installed in SQL Server DTS directory and the GAC, as usual.
After the migration, when I tried to open and configure the migrated component I got the error: "Value of null is not valid for stream".
The error only happened in "SSDT for BI" of VS 2012. When I tried to open and use the component in SQL Server Data Tools (VS 2010, not 2012, shell) it work without flaws.
So, this is a problem exclusive to SQL Server 2012 SP1 and SSDT for BI for VS2012

A: This problem affects SQL Server 2012 SSIS, and, in some occasssions, it doesn't even allow to open SSIS packages.
This error is solved with a Microsoft patch which can be downloaded from this page:
Micsosoft KB 2832017
Particularly, to solve the problem in VS, as VS is a 32 bit application, you only have to install the x86 download.


Q: Flatness of torus and surfaces of higher genus For the very first sight it may be surprise that the ordinary torus $S^1 \times S^1$ is flat: one argument to see this is the following. One can imagine a torus as a square with opposite sides identified and the square is obviously flat. However there are surfaces with higher genus (higher numbers of "holes") which also can be represented as polygons (4$g$ polygon for a surface of genus $g$) with sides indetified. However higher genus surfaces are negatively curved. So my question is

Why higher genus surfaces are negatively curved while they can be represented as flat polygons with sides identified?

A: If you try to turn those polygon identifications into flat metrics you run into a problem at the vertices: the angles don't add up. This issue can only be addressed for the square.

A: Theorem Benzecri. A closed surface is flat if and only it is euler number is zero.
Goldman, W. Two papers which change my life: Milnor seminal work on flat manifolds and bundles.
http://arxiv.org/pdf/1108.0216.pdf
p.4 which has a good outline of the proof.
To be more precise, a surface of genus $g>1$ than cannot be endowed with a differentiable metric whose curvature vanishes identically, since it cannot be endowed with a Koszul derivative which is flat, here flat means that the curvature and the torsion form vanish identically, since we know that the torsion form of the Levi-Civita connection vanishes, a differentiable manifold endowed with a flat differentiable metric has a flat structure; i.e it is an affine manifold. It is a well-known theorem that a  Riemannian closed flat manifolds are finitely covered by the torus $T^n$, their fundamental groups are crystallographic groups, so again this theorem also implies that the only oriented surface endowed with a flat metric is the torus.
Remark that in the case of dimension 2, Milnor in his paper On the existence of a connection with curvature zero, Comm. Math.
Helv. 32 (1958), 215-223
Milnor has generalized the work of Benzecri, by computing an equality which represents an obstruction for a bundle defined on a surface to be flat.


Q: Is it possible to transfer Late-2011 MacBook Pro 15" SSD to new late-2016 iMac as primary drive? My personal Late-2011 15" MBP is having issues and I'm considering replacing it with an iMac (either early/late 2016).
If I did decide to get an iMac, would I be able to simply put my MBP SSD into the new iMac, set it as my boot drive, and have a reasonable expectation that it would just work?  If not, is it even possible?  If possible, what is typically involved?


Q: Add controller for "plugin::users-permissions.user" [strapi v4] I can create a controller for created contentType, ex: api::restaurant.restaurant.
https://docs.strapi.io/developer-docs/latest/development/backend-customization/controllers.html
But for built-in plugins, ex: plugin::users-permissions.user, I don't know where to put the controller.

Strapi Version: 4.0.2


Q: Ошибка при установке в Pycharm pip install django-vimeo
Collecting django-vimeo
  Using cached django-vimeo-0.1.8.tar.gz (13 kB)
  Preparing metadata (setup.py) ... done
Collecting PyVimeo<0.4,>=0.3.2
  Using cached PyVimeo-0.3.10.tar.gz (5.8 kB)
  Preparing metadata (setup.py) ... done
Collecting Django<1.10,>=1.5
  Using cached Django-1.9.13-py2.py3-none-any.whl (6.6 MB)
Collecting xxhash<0.5,>=0.4.3
  Using cached xxhash-0.4.3.zip (22 kB)
  Preparing metadata (setup.py) ... done
Collecting requests>=2.4.0
  Using cached requests-2.27.1-py2.py3-none-any.whl (63 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting charset-normalizer~=2.0.0
  Using cached charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\gulse\desktop\grafen\lib\site-packages (from requests>=2.4.0->PyVimeo<0.4,>=0.3.2->django-
vimeo) (1.26.9)
Collecting idna<4,>=2.5
  Using cached idna-3.3-py3-none-any.whl (61 kB)
Using legacy 'setup.py install' for django-vimeo, since package 'wheel' is not installed.
Using legacy 'setup.py install' for PyVimeo, since package 'wheel' is not installed.
Using legacy 'setup.py install' for xxhash, since package 'wheel' is not installed.
Installing collected packages: xxhash, Django, certifi, idna, charset-normalizer, requests, PyVimeo, django-vimeo
  Running setup.py install for xxhash ... error
  error: subprocess-exited-with-error

  × Running setup.py install for xxhash did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      c:\users\gulse\desktop\grafen\lib\site-packages\setuptools\installer.py:30: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Require
ments should be satisfied by a PEP 517 installer.
        SetuptoolsDeprecationWarning,
      WARNING: The wheel package is not available.
      running install
      c:\users\gulse\desktop\grafen\lib\site-packages\setuptools\command\install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use b
uild and pip and other standards-based tools.
        setuptools.SetuptoolsDeprecationWarning,
      running build
      running build_ext
      building 'xxhash' extension
      creating build
      creating build\temp.win32-cpython-37
      creating build\temp.win32-cpython-37\Release
      creating build\temp.win32-cpython-37\Release\xxhash
      "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD
 -DVERSION=0.4.3 -DXXHASH_VERSION=r42 -Ic:\users\gulse\desktop\grafen\include -IC:\Users\gulse\AppData\Local\Programs\Python\Python37-32\include -IC:\Users
\gulse\AppData\Local\Programs\Python\Python37-32\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\includ
e" /Tcpython-xxhash.c /Fobuild\temp.win32-cpython-37\Release\python-xxhash.obj
      python-xxhash.c
      C:\Users\gulse\AppData\Local\Programs\Python\Python37-32\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or
 directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x86\\cl.exe' failed w
ith exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> xxhash

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

При установке vimeo выходит эта ошибка, я устанавливала windows SDK 10 не помогло. Можете помочь


Q: How to display X-Y data with different colors using arcmap I have a list of lat/lon coordinates for data points that I want to put on a map.  I want to have the size and/or color of the points to change based on additional columns on the excel sheet with the coordinates (kind of like a bubble chart).  Is it possible to do this in GIS? I am using arcmap 10.2.

A: This is quintessential gis. The process depends on your available software.
Esri
http://desktop.arcgis.com/en/arcmap/10.3/map/working-with-layers/drawing-a-layer-using-categories.htm
Or
Qgis (open source)
http://docs.qgis.org/2.0/en/docs/training_manual/vector_classification/classification.html
You could start either process by importing csv with your x/y values and the symbology fields.


Q: Determine all points where $f(x+iy) = 2xy + i(x+\frac 2 3 y^3)$ is differentiable in $\mathbb C$. Consider the function $f : \mathbb C \rightarrow \mathbb C$ given by $f(x+iy) = 2xy + i(x+\frac 2 3 y^3)$.
I want to determine all points at which $f$ is differentiable as a complex function.
To do this, I must decide the points $z_0$ for which the limit $$\lim_{h \rightarrow 0} \frac {f(z_0 + h) -f(z_0)} {h}$$ exist.
I've tried to evaluate this limit directly, but it gets very complicated. Is there an easier way ?
Should I decompose $f$ into sums and products of other functions ?

A: I suspect, that this question asks you to find out for which complex numbers the Cauchy-Riemann equations hold. So, you need to calculate the partial derivatives and solve the equalities finding out which $z$ make them true:
$$\frac{\partial u}{\partial x} = \frac{\partial v}{\partial y}$$
and
$$\frac{\partial v}{\partial x} = -\frac{\partial u}{\partial y}$$
In your case, $u(x, y) = 2xy$ and $v(x, y) = x + \frac{2}{3}y^3$, which makes your $f(x, y) = u(x, y) + iv(x, y)$.
I don't think that finding the limit is the right approach.


Q: How to access in the template, reactive form, an array in an array I'm a beginner in programming and i try to understand what i'm doing wrong. :)
I've create a reactive Form that contains an array of string that contains a string an an array of string.
it looks like this:

And the json file looks like this:
  public dbData: any =  {
    'ITEMS':[
      {
        'NAME': 'Farine',
        'QUANTITY': ['140', '60']
      }]
  };

I arrive to create the FormGroup correctly:

When i submit it looks correct:

But i don't arrive to display it in the template correctly :(
page.ts:
export class Form2Page implements OnInit, OnDestroy {
  itemsForm: FormGroup;

  constructor(private formBuilder: FormBuilder) {}

  ngOnInit() {
    this.initForm();
  }

  initForm() {
    this.itemsForm = new FormGroup({
      'items': new FormArray([])
    });
    console.log('From initForm', this.itemsForm);
  }

  onFormSubmit() {
    console.log('Submit : ', this.itemsForm.value);
  }

  onAddItems() {
    const control = new FormGroup({ name: new FormControl(''),
                                    quantity: new FormArray([])});

    (<FormArray>this.itemsForm.get('items')).push(control);
    console.log('Add From', this.itemsForm);
  }

Page.html
<ion-content>

    {{dbData.ITEMS[0].QUANTITY[1]}}

  <form [formGroup]="itemsForm" (ngSubmit)="onFormSubmit()">

    <ion-button type="button" (click)="onAddItems()">New Item</ion-button>

ITEMS

          <ion-label>Name :
            <input type="text" formControlName="name">
          </ion-label>

              <ion-label>Quantity :
                <input type="text" [formControlName]="j">
              </ion-label>

    <ion-button type="submit">Submit</ion-button>
  </form>
</ion-content>

Thanks for your help :)

A: I haven't implemented in Ionic. But you can use the exact same thing in Ionic too:
import { Component } from '@angular/core';
import { FormBuilder, FormGroup, FormArray, FormControl } from '@angular/forms';

export interface Data {
  ITEMS: Array<Item>;
}

export interface Item {
  NAME: string;
  QUANTITY: Array<string>;
}

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  dbData: Data = {
    'ITEMS': [
      {
        'NAME': 'Farine',
        'QUANTITY': ['140', '60']
      }]
  };

  itemsForm: FormGroup;

  constructor(private formBuilder: FormBuilder) { }

  ngOnInit() {
    this.itemsForm = new FormGroup({
      'ITEMS': this.formBuilder.array(this.dbData.ITEMS.map(item => this.createItem(item)))
    });
  }

  onFormSubmit() {
    console.log('Submit : ', this.itemsForm.value);
  }

  onAddItems() {
    (<FormArray>this.itemsForm.get('ITEMS')).push(this.createItem({ NAME: '', QUANTITY: [] }));
  }

  addQuantity(i) {
    (<FormArray>(<FormArray>this.itemsForm.get('ITEMS')).at(i).get('QUANTITY')).push(this.formBuilder.control(''));
  }

  private createItem(item: Item) {
    return this.formBuilder.group({
      NAME: [item.NAME],
      QUANTITY: this.formBuilder.array(item.QUANTITY.map(item => this.formBuilder.control(item)))
    });
  }

}

And in the template:

{{ itemsForm.value | json }}

<form [formGroup]="itemsForm" (ngSubmit)="onFormSubmit()">
  <button type="button" (click)="onAddItems()">New Item</button>

ITEMS

        Name :
          <input type="text" formControlName="NAME">

            Quantity :
              <input type="text" [formControlName]="j">

          <button (click)="addQuantity(i)">Add Quantity</button>

  <button type="submit">Submit</button>
</form>

Here's a Working Sample StackBlitz for your ref.

A: There are multiple issues in your code
please see the fixed code here

*

*You need to add controls/form to array, just having any empty form array is not enough

*For loading data into your form, you need to refactor a little bit, because you need to loop through your items and add control/form to your array


Q: Azure event hubs metrics not appearing when deploying with terraform When deploying with some other components (of a data pipeline) like function app and cosmosdb, metrics graphs on azure event hubs portal are not appearing instead graphs show "Resource not found".
But when I deploy the same terraform code for event hubs namespace without other components, metric graphs appears. Here is terraform code:
locals {
  ip_rule_map = flatten([
    for cidr in ["182.191.83.208"] : [
      {
        action  = "Allow"
        ip_mask = cidr
      }
    ]
  ])
}
resource "azurerm_eventhub_namespace" "avro-ingestion" {
  name                = "test-eh"
  location            = "Central US"
  resource_group_name = "test-rg"
  sku                 = "Standard"
  capacity            = 1

  network_rulesets = false ? [{
    default_action                 = "Deny"
    ip_rule                        = local.ip_rule_map
    virtual_network_rule           = []
    trusted_service_access_enabled = true
    }] : [
    {
      default_action                 = "Allow"
      ip_rule                        = local.ip_rule_map
      virtual_network_rule           = []
      trusted_service_access_enabled = true
    }
  ]

  tags = {
    Name      = "avro-ingestion"
    Purpose   = "data-ingestion-infra-deployment"
    CreatedBy = "emumba"
  }
}

resource "azurerm_eventhub_namespace_authorization_rule" "user_managed" {
  name                = "UserManagedSharedAccessKey"
  namespace_name      = azurerm_eventhub_namespace.avro-ingestion.name
  resource_group_name = "test-rg"

  listen = true
  send   = true
  manage = true
}
resource "null_resource" "schema-registry" {
  depends_on = [
    azurerm_eventhub_namespace.avro-ingestion
  ]
  provisioner "local-exec" {
    interpreter = ["/bin/bash", "-c"]
    command     = "az eventhubs namespace schema-registry create --name test-schema-group  --namespace-name test-eh --resource-group test-rg --schema-compatibility Backward --schema-type Avro"
  }
}

resource "azurerm_eventhub" "thunder" {
  name                = "test"
  namespace_name      = azurerm_eventhub_namespace.avro-ingestion.name
  resource_group_name = "test-rg"
  partition_count     = 2
  message_retention   = 1

}

resource "azurerm_eventhub_consumer_group" "function-app-cg" {
  name                = "fApp-cons-group"
  namespace_name      = azurerm_eventhub_namespace.avro-ingestion.name
  eventhub_name       = azurerm_eventhub.thunder.name
  resource_group_name = "test-rg"
}

main.tf file where I am calling all modules along with event hubs namespace module:
resource "random_string" "random_Sacc1" {
  length      = 4
  special     = false
  upper       = false
  min_lower   = 1
  min_numeric = 1
}

resource "random_string" "random_Sacc2" {
  length      = 2
  special     = false
  upper       = false
  min_lower   = 1
  min_numeric = 1
}

module "azure-resource-group" {
  source = "../../modules/resource-group"

  region         = var.region
  res_group_name = var.res_group_name
}

module "azure-virtual-network" {
  depends_on = [
    module.azure-resource-group
  ]
  source = "../../modules/virtual-network"

  rg_name               = module.azure-resource-group.name
  rg_location           = module.azure-resource-group.location
  vn_name               = var.vn_name
  vn_cidrs              = var.vn_cidrs
  subnets               = var.subnets
  subnet_cidrs          = var.subnet_cidrs
  pub_nsg_name          = var.pub_nsg_name
  private_nsg_name      = var.private_nsg_name
  internet_ip_cidr_list = var.internet_ip_cidr_list

}

module "azure-ad-app-registration" {
  depends_on = [
    module.azure-resource-group
  ]
  source = "../../modules/app-role-assignment"

  app-display-name = var.app-display-name
  rg_name          = module.azure-resource-group.name
}

module "azure-eventhubs" {
  source                = "../../modules/event-hubs"
  ns_name               = var.eventhub_namespace_name
  eventhub_name         = var.eventhub_name
  cons_group_name       = var.cons_group_name
  rg_name               = module.azure-resource-group.name
  rg_location           = module.azure-resource-group.location
  enable_private_access = var.enable_private_access
  cidr_list             = var.public_cidr_list
  vnet_id_dns           = module.azure-virtual-network.vnet-id
  private_ep_subnet     = module.azure-virtual-network.private-subent1-id
  dns_zone_name         = var.dns_zone_name_private_ep
  schema_group_name = var.eventhub_schema_group_name
}

module "azure-storage-account" {
  depends_on = [
  module.azure-virtual-network
  ]
  source = "../../modules/storage-account"

  storage_acc_name      = "${var.storage_acc_name}${random_string.random_Sacc1.id}"
  rg_name               = module.azure-resource-group.name
  rg_location           = module.azure-resource-group.location
  enable_private_access = var.enable_private_access
  cidr_list             = var.public_cidr_list
  vnet_id_dns           = module.azure-virtual-network.vnet-id
  private_ep_subnet     = module.azure-virtual-network.private-subent1-id
  dns_zone_name         = var.dns_zone_name_private_ep

}

module "azure-cosmos-db" {
  source = "../../modules/cosmos-db"

  acc_name                 = var.cosmos_acc_name
  db_name                  = var.cosmos_db_name
  rg_name                  = module.azure-resource-group.name
  rg_location              = module.azure-resource-group.location
  cosmos_db_container_name = var.cosmos_db_container_name
  enable_private_access    = var.enable_private_access
  cidr_list                = var.public_cidr_list
  vnet_id_dns              = module.azure-virtual-network.vnet-id
  private_ep_subnet        = module.azure-virtual-network.private-subent1-id
  dns_zone_name            = var.dns_zone_name_private_ep
  synapse_link = var.enable_synapse_link
}

# module "fApp-azure-storage-account" {
#   source = "../../modules/storage-account"

#   storage_acc_name      = "${var.storage_acc_fApp_name}${random_string.random_Sacc2.id}"
#   rg_name               = module.azure-resource-group.name
#   rg_location           = module.azure-resource-group.location
#   enable_private_access = var.enable_private_access
#   cidr_list             = var.public_cidr_list
#   private_ep_subnet     = element(module.azure-virtual-network.subnet_id_list, 1)
#   dns_zone_name         = var.dns_zone_name_private_ep

# }

module "data-ingestion-fApp" {
  depends_on = [
    module.azure-cosmos-db,
    module.azure-eventhubs,
    module.azure-storage-account
  ]
  source = "../../modules/function-app"

  rg_name                  = module.azure-resource-group.name
  rg_location              = module.azure-resource-group.location
  application_insight_name = var.application_insight_name
  fApp_service_plan_name   = var.fApp_service_plan_name
  fApp_name                = var.fApp_name
  fApp-storage_acc_name    = "${var.storage_acc_fApp_name}${random_string.random_Sacc2.id}"
  enable_private_access    = var.enable_private_access
  vnet_id_dns              = module.azure-virtual-network.vnet-id
  private_ep_subnet        = module.azure-virtual-network.private-subent1-id
  integration_vnet_name    = module.azure-virtual-network.vnet-name
  integration_subnet_name  = module.azure-virtual-network.private-subent2-name
  func_configurations = { "AZURE_CLIENT_ID" = module.azure-ad-app-registration.client_id
    "AZURE_CLIENT_SECRET"                = module.azure-ad-app-registration.client_secret,
    "AZURE_TENANT_ID"                    = module.azure-ad-app-registration.tenant_id,
    "EVENTHUB_NAME"                      = var.eventhub_name,
    "EVENTHUB_FULLY_QUALIFIED_NAMESPACE" = "${var.eventhub_namespace_name}.servicebus.windows.net",
    "SCHEMA_GROUP_NAME"                  = var.eventhub_schema_group_name,
    "OUTPUT_CONTAINER"                   = var.storage_acc_container_name,
    "OUTPUT_PATH"                        = var.storage_acc_container_path,
    "COSMOS_DB_URI"                      = module.azure-cosmos-db.cosmos_account_uri,
    "COSMOS_DB_PRIMARY_KEY"              = module.azure-cosmos-db.cosmos_account_primary_key,
    "COSMOS_DB_NAME"                     = var.cosmos_db_name,
    "COSMOS_DB_CONTAINER_NAME"           = var.cosmos_db_container_name,
    "a10devops_namespace_connection"     = module.azure-eventhubs.eventhub_conn_str,
  "a10devops_storage_connection" = module.azure-storage-account.storage_account_conn_str }
}


Q: Tool Tip to show entire GridView row I want to create a tooltip feature that will display all of a user data that is being displayed in a gridview.
Expected Result: A GridView displays Last_Name,First_Name,Telephone,Cell_Phone. I want a tool tip to display with a mousehover over that users row of information and display all of the data in that tooltip. The data is only generated when a users uses my search box feature so it can't be a static tooltip string. I"m using a sqldatasource to fill in the gridview which i'm not sure how to call. The only thing I can find is by making the gridview a label which I don't want to do. Any guidance would be much appreciated.
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource1" GridLines="None" HorizontalAlign="Center" AllowPaging="True" AllowSorting="True" ForeColor="#333333">
    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    <Columns>
        <asp:BoundField DataField="Last_Name" HeaderText="Last_Name" SortExpression="Last_Name" />
        <asp:BoundField DataField="First_Name" HeaderText="First_Name" SortExpression="First_Name" />
        <asp:BoundField DataField="Middle_Int" HeaderText="Middle_Int" SortExpression="Middle_Int" />
        <asp:BoundField DataField="Telephone" HeaderText="Work Telephone" SortExpression="Telephone" />
        <asp:BoundField DataField="Cell_Phone" HeaderText="Work Cell" SortExpression="Cell_Phone" />
    </Columns>
</asp:GridView>

SQLDataSource Connection:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:myconnection %>" SelectCommand="SELECT [Last_Name], [First_Name], [Middle_Int], [Rank], [Telephone], [Cell_Phone], [Unit], [UserName]  FROM [Person_Search] WHERE (([Middle_Int] LIKE '%' + @Middle_Int + '%') OR ([Cell_Phone] LIKE '%' + @Cell_Phone + '%')  OR ([First_Name] LIKE '%' + @First_Name + '%')  OR ([Telephone] LIKE '%' + @Telephone + '%') OR ([Unit] = @Unit) OR ([Last_Name] LIKE '%' + @Last_Name + '%') OR ([UserName] LIKE '%' + @UserName + '%'))">
    <SelectParameters>
        <asp:ControlParameter ControlID="TextBox1" Name="Middle_Int" PropertyName="Text" />
        <asp:ControlParameter ControlID="TextBox1" Name="Cell_Phone" PropertyName="Text" Type="String" />
        <asp:ControlParameter ControlID="TextBox1" Name="First_Name" PropertyName="Text" Type="String" />
        <asp:ControlParameter ControlID="TextBox1" Name="Telephone" PropertyName="Text" Type="String" />
        <asp:ControlParameter ControlID="TextBox1" Name="Last_Name" PropertyName="Text" Type="String" />
    </SelectParameters>
</asp:SqlDataSource>

Label Control View Code:
<asp:TemplateField HeaderText="Logid">
<ItemTemplate>
     <asp:Label ID="Label1" runat="server" Text='<%# Bind("cityid") %>' ToolTip='<%# Bind("cityName") %>' ></asp:Label>
 </ItemTemplate>

A: You can use the RowDataBound event to add the ToolTip property to a GridViewRow.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    //check if the row is d datarow
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        //cast the row back to a datarowview
        DataRowView row = e.Row.DataItem as DataRowView;

        StringBuilder tooltip = new StringBuilder();

        //add the data to the tooltip stringbuilder
        tooltip.Append(row["Last_Name"] + ", ");
        tooltip.Append(row["First_Name"] + ", ");
        tooltip.Append(row["Middle_Int"] + ", ");
        tooltip.Append(row["Telephone"] + ", ");
        tooltip.Append(row["Cell_Phone"]);

        //add the tooltip attribute to the row
        e.Row.Attributes.Add("ToolTip", tooltip.ToString());
    }
}