Bestsellers of current month rest api

I need to get bestsellers products for the current month. I use Magento\Sales\Model\ResourceModel\Report\Bestsellers\Collection, but I get bestsellers for all months, I used the following code to get it for current month

$  collection = $  this->productCollection->create('Magento\Sales\Model\ResourceModel\Report\Bestsellers\Collection');  $  data=array();     $  collection->setPeriod('monthly');     //$  collection->setPeriod('year');       $  currentMonth = date('Y-m');     foreach ($  collection as $  item) {         if($  item['period'] == $  currentMonth){             array_push($  data,$  item->getData());         }      } 

but that code will take more time for every coming month.

Is there a way to get products of current month directly from database?

Reinstall System app which is uninstalled for the current user?

So, I have already posted this on reddit, but I might reach a better audience here.
I “uninstalled” google play games using this guide by XDA. Now I need to reinstall it. This is the command, how I should be able to reinstall the app: adb shell cmd package install-existing <name of package>
But there is one problem: My phone is on Android Lollipop, and the command doesn’t exist there. I manually tried to install the apk back, with adb and with normal package installer. The Settings app always says something like Not installed for user” (translated from other language).

So I have 2 Questions:
1) In which Android version was this command introduced?
and 2) How can I get this app back?

PS: I have root access, but would prefer a non rooted solution.

AdSense reinstated, but current balance is 0

Hey guys. I've got an email on Mar 2016 that my Adsense account has been disabled due to invalid activity. After 3 years and 1 month of thinking what I did wrong and why it happened, I filled out an appeal and I succeeded. My AdSense account has just been reinstated. I am really glad I can participate in this ecosystem again.

However, there is only one thing I want to know about it and maybe there is some guy who experienced the same and hopefully have some solution or advice. My current…

AdSense reinstated, but current balance is 0

What is preventing me from simply constructing a hash that’s lower than the current target?

I just started learning about Bitcoin, and something I can figure out is why miners have to use a random process (hashing a nonce) to get lower than the target. For example, if the target is

00000000000001ae00000000000000 

why not just produce

000000000000000000000000000001 

to become the winner? I have no practical experience mining, I’m guessing my ignorance lies in the requirements of how a hash is produced. If so, where can I found about those requirements? Thanks.


EDIT: For clarity, I mean this in the sense of what part of the technology requires me to use a hash function? As opposed, to just constructing something that looks like a valid hash.

Pass/set `current directory` to/for a shell script from Java in Ubuntu 16.04

While trying to automate an installation process in Ubuntu 16.04 with a .jar file, I did not know how to solve the following problem:

Problem description

Part of the installation files automatically generate the following file called generate in location /usr/share/taskd/pki/:

generate                                                                                                                   #!/bin/sh  # For a public or production server, purchase a cert from a known CA, and skip # the next step.  # For development, testing and personal server management, create a CA key and # cert, and use that to generate a server key and cert.  Creates: #   ca.key.pem #   ca.cert.pem #   server.key.pem #   server.cert.pem  ./generate.ca ./generate.server  # Generate a certificate revocation list (CRL).  The initial CRL is empty, but # can grow over time.  Creates: #   server.crl.pem  ./generate.crl  # The above is sufficient to operate a server.  What follows is a per-client # process.  Creates: #   $  {1}.key.pem #   $  {1}.cert.pem  ./generate.client client 

I have a java project that executes the installation commands,which I run from location /mnt/c/example folder/setup.jar. The java code that runs the command consists of: p = Runtime.getRuntime().exec(String[] command) and the actual command under consideration is created by:

commands[10] = new String[ commands[10][0] = "sudo"; commands[10][1] = "/usr/share/taskd/pki/generate"; 

Whereas the original shell command is:

cd /usr/share/taskd/pki sudo ./generate 

To solve my xy-problem of running the ./generate file, I can

  1. Create it in java with absolute paths, (copy it to the /usr/share/taskd/pki/ folder) and run it.
  2. Create a shell command that actually executes the commands, instead of a .jar file.

Question

However, I was wondering how I can pass the “current directory” of /usr/share/taskd/pki/ to the shell script named generate in that location, such that the ./generate.ca, ./generate/server, ./generate.crl and ./generate.client client are executed correctly/found.

Doubts

This might seem like purely a programming question which should be posted in Stack Overflow, but I think the essence is platform specific; how to pass environments/paths in Ubuntu between 2 scripts in different locations. I currently cannot predict whether the final answer will be generally applicable to Linux or Ubuntu 16.04. If this perspective or assumption is incorrect please let me know.