text:
Q: JSON display method I have scenario where I could use your help for the best practice and efficient code.
I have a JSON Array like below
[
    {
        "Date": "2014-07-16",
        "DiscPoint": "Description 1",
        "DisBy": "Person 1"
    },
    {
        "Date": "2014-07-16",
        "DiscPoint": "Description 2",
        "DisBy": "Person 2"
    },
    {
        "Date": "2014-07-16",
        "DiscPoint": "Description 3",
        "DisBy": "Person 3"
    }
]

How do I omit the first element while iterating the JSONArray, Please note I have to omit it only after the first iteration.
I need to display the date for every new date. Please help me out in this scenario.

A: In $.each() function just add if-statement which will be skipping first index, which is equal to 0.
$.each(yourArray, function(index, value) {
    if (index != 0) {
        // do something
    }
});


text:
Q: WSO2 GREG : Multi environment Configuration I have set up 2 ESB (uat & dev) with 1 shared registry basically using the following:
http://wso2.com/library/tutorials/2010/04/sharing-registry-space-across-multiple-product-instances/
I'm having difficulty adding an uat endpoint & finding it within the esb-uat.  If I used
<mount path="/_system/governance" overwrite="true">
    <instanceId>RemoteGreg</instanceId>
    <targetPath>/_system/governance/branches/uat</targetPath>
</mount>

Within the registry, would I expect to see a tree '_system/governance/branches/uat' or do I have to create it?
If I use registry's 'Add Endpoint', I can enter Name/Version/Address/Environment. Is the environment 'branch/uat' or just 'uat'?
If I browse the endpoint I get
/_system/governance/trunk/endpoints/ep-<name-address data>

Its referencing trunk, not a branch, & 'uat' is no where to be seen. I'm obviously missing something pretty basic here. Is there an example of data entry for shared registry?

redpajama_set_name: RedPajamaStackExchange


text:
Q: cloneNode() JS call not working in Safari I am using cloneNode() it's working fine in IE but it's not working in Safari.
function ApplyNowWizard_addVehicleTypeList(vehicleDOM)
{
   oParent = $(this.data).get(0);
   oParent.documentElement.appendChild(vehicleDOM.cloneNode(true).documentElement);
}

where vehicleDom type is IXMLDOMDocument2.
vehicleDOM.cloneNode(true) giving null in safari.

A: Follow the link, I think possibly this is the solution
http://jsdom.wordpress.com/2011/03/14/appendchild-problem-in-google-chrome-and-safari/
Also note
Opera and Safari cannot clone Document or DocumentType nodes (Opera throws a DOMException (code 9: NOT_SUPPORTED_ERR), where Safari creates a null object); Firefox and Internet Explorer can clone these types of nodes (where they're available in the first place).
Ref: http://reference.sitepoint.com/javascript/Node/cloneNode


text:
Q: NestJS: Initialize certain MongoDB collection as soon as connection is made I am very new to NestJs and I would like to build a web app that uses MongoDB.
So what I gonna do is whenever as soon as app is loading mongodb connection should be made and add some logic in callback function.
With Express framework this is the code of logic what I wanna do.
mongoose
  .connect(mongoDB, {
    user: process.env.MONGODB_USER,
    pass: process.env.MONGODB_PASSWORD,
    useNewUrlParser: true,
    useUnifiedTopology: true,
  })
  .then(async () => {
    //don't show the log when it is test
    if (process.env.NODE_ENV !== "test") {
      console.log("Connected to %s", mongoDB);
      console.log("MongoDB is connected ... \n");

      initDB.InitializeDB();
      dailyReport.DailyReport();
    }
  })
  .catch((err) => {
    console.error("App starting error:", err.message);
    process.exit(1);
  });

In above code there are two functions.
1st: Logging if DB connection is successful or failed
2nd: When successful I initialize some collections and exit app if failed
I saw NestJs documentation to implement this logic here
import { Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';

@Module({
  imports: [MongooseModule.forRoot('mongodb://localhost/nest')],
})
export class AppModule {}

But I am not sure where is the callback function for MongoDB connection.
Can anyone give me answer for this by implementing Express logic using NestJs?

A: You could do the initialization in the onModuleInit() lifecycle method. Check here for more information: https://docs.nestjs.com/fundamentals/lifecycle-events#lifecycle-events
Code would look like this:
@Module({
  imports: [MongooseModule.forRoot('mongodb://localhost/nest')],
})
export class AppModule {
  @InjectConnection() private connection: Connection;

  onModuleInit() {
    // execute logic + access mongoDB via this.connection
  }
}


text:
Q: Magento 2 get Product Url in Foreach In Magento 2, I trying to get the Product URL using this code $_product->getProductUrl (). But it is having only the first product's url to all the products. How to fix it.
Used the Following Code:
$_collection = $this->objectManager->get ( '\Magento\Catalog\Model\Product' )->getCollection ();
 $_collection = $collection->getData();
 foreach ( $_collection as $_product ) {
 $_product = $this->objectManager->get ( 'Magento\Catalog\Model\Product' )->load ( $_product['entity_id'] );

      echo $product_url = $_product->getProductUrl ();
}

A: Use this code :
=> Using object manager :
$product = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection')
    foreach($product as $_product){
       echo $_product->getProductUrl();
    }

=> Using Factory Method :
protected $_productcollectionFactory;

    public function __construct(
        ..............
        Context $context,
        \Magento\Catalog\Model\ResourceModel\Product\Collection $productcollectionFactory,
        ..............
    ) {
        parent::__construct($context);
        ..............
        $this->_productcollectionFactory = $productcollectionFactory;
        ..............

    }

    public function execute()
    {
        $product_url = [];
        $proColl = $this->_productcollectionFactory->getCollection();
        foreach($proColl as $_product){
           $product_url[] = $_product->getProductUrl();
        }
        print_r($product_url);
    }

=> Get url by product Id :
public function __construct(
   \Magento\Catalog\Model\ProductRepository $productRepository,
) {
  $this->_productRepository = $productRepository;
}

Then you load the product based on the product id:
public function getProductUrl($productId){
  $product = $this->_productRepository->getById($productId);
  return $product->getUrlModel()->getUrl($product);
}

Note : Don't use object manager directly

A: You can use below code
protected $_productFactory;

public function __construct(

    \Magento\Catalog\Model\ProductFactory $productFactory,
    ..............
) {

    ..............
    $this->_productFactory = $productFactory;
    ..............
  }

public function execute()
{
    $productCollection = $this->_productFactory->create()->getCollection();
    $productRequireData = array();
    foreach($productCollection as $_productCollection)
    {
        $productRequireData[] = array('product_url'=>$_productCollection->getProductUrl(),'id'=>$_productCollection->getId());

    }

    return $productRequireData;
}

Filter the collection as per your requirement.
Or you can use custom function to display result into phtml file.

A: Using object manager  (But its not recommended )
 $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
 $_product = $objectManager->get('Magento\Catalog\Model\ProductFactory')->create()->load( $id);
 echo $_product->getProductUrl();


text:
Q: numpy reshape() when last shape int is = 1 It appears that a trailing 1 in the shape parameter simple transposes the base ndarray, is that the correct way to think about it?
    In [22]: np.ones((3, 2))
    Out[22]:
    array([[ 1.,  1.],
           [ 1.,  1.],
           [ 1.,  1.]])

    In [23]: np.ones((3, 2, 1))
    Out[23]:
    array([[[ 1.],
            [ 1.]],

           [[ 1.],
            [ 1.]],

           [[ 1.],
            [ 1.]]])

I'm wondering if there are performance reasons to specify the trailing 1 as well.

A: The 2 Numpy arrays are different in structure while the number of values stay the same.  Example: If you were thinking about a spreadsheet np.ones((3, 2)) would have 2 columns of data and 3 rows while np.ones((3, 2, 1)) would have only 1 column and 2 rows over 3 sheets.
You can go from one to the other using reshape() so just think about the block of data in the most helpful configuration knowing you can change it later.
examples np.ones((3,2)).reshape(1,2,1,3) (this is now 4 dimensions with the same number of values)
As for performance there isn't any difference.
It's still a big block of the same types of data referenced efficiently.


text:
Q: Lipschitz and Uniqueness of an IVP
Consider the IVP $$\frac{dx}{dt}=1+x^2, \ \ \ x(0)=1.$$ I am trying to show that $f(x)=1+x^2$ is Lipschitz and hence the above IVP has a unique solution.

My attempt:
I considered $f(x)=1+x^2$. Now if $f$ is Lipschitz, then $\exists L\in\mathbb{R}, \ \text{such that} \ \forall x,y\in\mathbb{R}$, $$|f(x)-f(y)|\leq L|x-y|.$$
Now, \begin{align}
L&\geq \frac{|1+x^2-1-y^2|}{|x-y|} \\
&=\frac{|(x-y)(x+y)|}{|x-y|} \\
&=|x+y|
\end{align}
I'm a bit unsure of how to proceed. How can I use the initial value conditions to further my answer?

A: All you need for uniqueness is local Lipschitz property of $f(x)=1+x^2$: for any $x,y \in [a,b]$, by the Lagrange Theorem,
$$|f(x)-f(y)|=|f'(t)||x-y|\leq L|x-y|$$
where $L=\max\{2t : t\in [a,b]\}=2\max(|a|,|b|)$ (or, according to you approach, we can also take $L=2\max(|a|,|b|)\geq |x|+ |y|\geq |x+y|$).
By the way, in this case, uniqueness follows by solving the ODE after separating the variables:
$$\int_1^{x(t)}\frac{dx}{1+x^2}=\int_0^{t}dt\implies \arctan(x(t))-\frac{\pi}{4}=t\implies x(t)=\tan\left(t+\frac{\pi}{4}\right).$$


text:
Q: My computer reboots very frequently I have a problem with one computer.

*

*It restarts very frequently after some time of being powered up, even being idle sometimes.

*Moreover, (only in some occasions) when i push the power button it doesn't do anything (it remains shutted down)...To fix this problem i must wait some hours and then it starts working "magically" or i must disconnect the power supply cable from the motherboard and connect it again.

*Finally, the well known blue screens of death randomly appears. They aren't the same, they are different.
These are the three symptoms. I have done some things to try to fix this problem but i cannot achieve that. The things i have done are the following:

*

*I have tried changing the power supply. I have connected 2 others power supplies and the problem persisted.

*I have cleaned the memories and connect them to other RAM slot, but the problem continues.

*I have checked the CPU temperature with SPEED FAN and it showed that the temperature was 51ºC (Is this a high temperature for CPU?). I have cleaned the dust from the CPU but the problem persists...
I'm not at home now and i don't remember the exact models of each component, i will edit this post as soon as I arrive home with the correct specification of my computer.
CPU: Intel Pentium 4 2.6 Mhz
MOTHER: AsROCK
RAM: 256 RAM 333 mhz
HD: 80Gb WD
Power Supply: 500 watts
I have discard SO problems, hard-disk problems or memory problems because of symptom number 2 That's very strange, is like something in the mother or in the boot process.
Thanks and hope you could help me.

A: I would have said change the PSU, but as you have already said that, I will skip that step.
Take a look at Bluescreenview, this utility should allow you to view any previous blue screens. Try to see in more detail if there is any links between the problems.
That being said, due to the age of your computer (a P4 with 333mhz memory), it is very likely that your motherboard was probably one of the many millions affected by faulty capacitors, or it has simply had a good run and reached the end of its life.
Blown capacitors -
Blown capacitors can be the cause of many "random" problems which appear to be completely unrelated, very annoying and hard to diagnose.

The top should be almost flat (with slight indents out embossed sections depending on specification... look at the middle one) but you do not want to see any big bumps such as the first one or any leakage as the last one.

A: From what you tell, my first guess is the system gets too hot. Thats not just the CPU, but any part like the RAM, the power converter, stuff like that.
When it crashes, run your fingers over the hardware and touch all parts. If anything is so hot you remove your fingers instantly, it is too hot. Maybe use one of those touch-free thermometers. Also, the part with the photo of Elkos is a good idea. Asrock used a lot of cheap components.
Do a system check. First and easy is memtest86+. Download the current release, burn and boot the CD. If the computer runs more than an hour with that, start looking for other stuff. Try having the computer run 48hrs on memtest in the end.
Boot from a Live-Linux CD. Does that run stable? If yes, grab another hard disk. We´re on superuser here, you have a couple of disks lying around, havent you? Make a fresh install. Make a test after each installation step.
Download the "ultimate boot cd" and fiddle with what it has to offer.

A: 51C is not especially hot for a CPU, but do you know the temp of your GPU (the processor on your video card)?

A: I've had a similar problem in the past with my P4.  What fixed it for me was replacing the "goo" that sits between the CPU and the heat sink.  In my experience, the CPU never got all that hot, but the temperature would spike and cause a shutdown.  The goo that came with the CPU had essentially dried out over the years and was no longer making much of a connection.  It had a vaguely voodoo feeling to it, but I picked up a $10 tube of the pretty good stuff at Fry's, reattached the heat sink and the the problem went away.

A: Things to worry about...

*

*bad motherboard. PC's are made with cheap electrolytic capacitors that have short lifetimes that additionally vary with temperature. One bad cap won't do any harm but if a bunch of them go bad they need replacing or just a new system board. There are better (solid tantalum) capacitors but they are a lot more expensive so they are never seen in peecees

*high power (hot) IC's don't actually last forever despite their lack of moving parts. Manufacturing defects or things like metal migration can cause chips to go bad. Solution: replace system board or CPU.

*overtemperature CPU crash. It's rare to see thermal grease used on a mass-produced machine but a machine built by an individual or shop may well have used it. Thermal grease does a good job for a while but is known to not age well. Thermal interface pads are a better alternative. Do not take the CPU heatsink off unless you are prepared to replace the thermal interface with either thermal grease or a new pad. The pads are not reusable. I have heard of people using nothing at all and producing spectacularly unreliable systems.

*overclocking. Try underclocking.

A: If it is rebooting without a BSOD or other error being displayed, you could investigate the Windows Crash Recovery settings which may give more clues. I had nVidia driver issues once which were causing exactly these sort of random reboots.
Right click on my computer > Properties > Select the 'Advanced' tab > and under 'startup and recovery' click the 'settings' button. This will open a new window, and under the 'System Failure' heading, uncheck 'Automatically restart.'

A: I had this happen to me just this weekend.  It turned out to be my video card.  The card was not overheating or anything apparent.  I swapped out the card for an old one I still had and all the issues stopped.


text:
Q: jump to vim commands help from vim script or vimrc when i'm modifying a .vim file or the .vimrc i can get vim helps by running a simple command like this
:help modelines

and shows me the help in a split window.
but how can i get the same help, with a keystroke combo in stead of typing the command? like jumping with tags "C-]" but for a command in source code

A: :set keywordprg=:help

Then type Shiftk


text:
Q: Hide everything inside label except img I want to hide everything inside label except image.

.payment_method_vipps label :not(img){
 display: none!important;
}

<input id="payment_method_vipps" type="radio" class="input-radio" name="payment_method" value="vipps" data-order_button_text="Betal med Vipps">

   vipps

I have already tried to use the :not selector but it hides either everything or nothing. Thanks for your time and help.

A: this option is a bit tricky but can work
label[for=payment_method_vipps] {font-size:0;}

A: Since the img is a child of label[for="payment_method_vipps"], everything that hides the label will also hide its contents (i.e. the image). So it probably won't be possible with this HTML structure.
The one thing you can try it to set the label (text) color to transparent:

label[for="payment_method_vipps"] {
  color: transparent;
}

  <input id="payment_method_vipps" type="radio" class="input-radio" name="payment_method" value="vipps" data-order_button_text="Betal med Vipps">

   vipps

If that doesn't work for some reason, you'd have to wrap the text ("vipps") into a span to which you can apply display: none.

A: You could do it like this. First hide the label and all of its content. Then set the visibility of the image to visible.
Perhaps it's not the best practice to place the img inside the label tag. You could nest the text into an span tag.

.payment_method_vipps label{
    visibility: hidden;
}

.payment_method_vipps label img{
    visibility: visible;
}

<input id="payment_method_vipps" type="radio" class="input-radio" name="payment_method" value="vipps" data-order_button_text="Betal med Vipps">

   vipps


text:
Q: How to remove the chapter box for chapter*{} in fncychap? I am using fncychap with the following configuration in a document:
\usepackage[Bjornstrup]{fncychap}
\ChTitleVar{\raggedleft\Large\rm\bfseries}

When I create a new chapter without a title, e.g. Dedication, a half-empty gray box is drawn on the page.
\newcommand{\dedication}{
\pagestyle{plain}
        \chapter*{}
        \addcontentsline{toc}{chapter}{Dedication}
}

\dedication {
    \begin{quote}
        \raggedleft {\em to ...}
    \end{quote}
}

I have looked at different parameters provided in the documentation but none of them seems to be related to removing this box on chapter*{}.
I was wondering if I can modify the definition of dedication or modify some configurations of fncychap to remove this box on certain chapters.
P.S. I prefer the text to be written where it is normally written and not moved up to where the gray box is.

A: Copy the following lines before the chapters where you want to header gone:
% Remove the gray box for chapter* with empty titles
\makeatletter
  \renewcommand{\DOTIS}[1]{%
    \vskip 40\p@%
}
\makeatother

And copy the following lines after the chapter is finished.
% Bring the gray box back for chapter* with titles
\makeatletter
  \renewcommand{\DOTIS}[1]{%
    \fboxsep=0pt
    \colorbox[gray]{.85}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}\\%
    \nointerlineskip\raggedright%
    \fboxsep=\myhi%
    \colorbox[gray]{.85}{\parbox[t]{\mylen}{\CTV\FmTi{#1}}}\par\nobreak%
    \vskip 40\p@%
}
\makeatother


text:
Q: Removing buttons from the html editor I've been searching the codex, and I'm probably overlooking something somewhere, but could someone tell if it would be possible to remove a button/quicktag from the WordPress html editor?

A: With the quicktag_settings filter:
function wpa_47010( $qtInit ) {
    $qtInit['buttons'] = 'strong,em,link,block,del,img,ul,ol,li,code,more,spell,close,fullscreen';
    return $qtInit;
}
add_filter('quicktags_settings', 'wpa_47010');

The default is:
$qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,spell,close';

Though 'fullscreen' usually gets added too at the end. So I just deleted the 'ins' button.
Edit to add:
If you wish to create a custom button the following tutorial might help.

A: I'm late to this party I know, but might I add that it's better to be agnostic about the default buttons provided by Wordpress. So instead of typing the buttons you want, I choose to remove the buttons I don't want:
function nmt_quicktags_buttons( $qt_init) {
    $del_buttons = array('del','ins','img','code');
    $qt_init['buttons'] = implode(',', array_diff(explode(',',$qt_init['buttons']), $del_buttons));
    return $qt_init;
}

Now if anyone at Wordpress decides the quicktags-toolbar gets a new button, it will show up in your editor without a code change of your plugin/function.


text:
Q: mod_rewrite .htaccess causing 500 server error if URl does not exist I've just started using mod_rewrite, this is what I use for a quite basic structured website with multiple language support:
RewriteEngine on
ErrorDocument 404 /error404.php

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z]{2})/([^/]+)$ $2.php?lang=$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z]{2})/$ index.php?lang=$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z]{2})$ index.php?lang=$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ $1.php [L]

My idea was that languages are indicated at the beginning of the URl and need to be two characters (a-z or A-Z). After that there will be a string that refers to a php-file which has the same filename as the string, just .php attached. The language will be added as a GET-Variable (?lang=en).
So, an URl could look like this: /en/index and should then be redirected to index.php?lang=en.
If the URl does not start with a language, but directly with the string, then no GET-variable will be attached to the string. E.g. /index should refer to index.php. If there is no string, then index should be used as default.
So far, so good. Works fine. Just if I enter a string (no matter if I use 2 characters for language or not), the site always shows an 500 Internal Server Error, instead of going to error404.php. Also, if I delete this line (404) in .htaccess, it is still the same error.
So, I assume that there is something wrong with the other lines in the .htaccess that cause this error, does anybody have an idea what this could be?
Any help is highly appreciated!

A: Your rules are looping. At a glance, it looks like your last one:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ $1.php [L]

Say I have this URL, http://your.domain.com/blah, and the file blah.php doesn't exist. This is what's happening.

*

*URI = blah, !-f is true, it's not a file

*URI = blah, !-d is true, it's not a directory

*URI = blah, internal rewrite to blah.php

*blah != blah.php, rewrite rules loop

*URI = blah.php !-f is true, it's not a file

*URI = blah.php !-d is true, it's not a directory

*URI = blah.php, internal rewrite to blah.php.php

*blah.php != blah.php.php, rewrite rules loop

This goes on until the rewrite engine has had enough and returns a 500 server error.
You can do one of 2 things here:

*

*Add a directive to make all looping stop no matter what, which is an easy to get around this kind of stuff. But it will break rules that require looping. I don't see anything like that in your rules so it's safe (at least for now) to do this. Just add this to the top of your rules:
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule ^ - [L]

*Do a pre-emptive check to see if the php file actually exists:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/]+)$ $1.php [L]

A: Helmut, try this (the last rule is the reason for the 500 internal error, and this also includes the suggestion of @DaveRandom to merge rule 2 and 3):
RewriteEngine on
ErrorDocument 404 /error404.php

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z]{2})/([^/]+)$ $2.php?lang=$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z]{2})/?$ index.php?lang=$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9]+)$ $1.php [L]


text:
Q: how to access and modify google workspace domain user's google drive files as a domain administrator using google apps scripts Objective:
as a google workspace domain admin for a school that uses google workspace education, I want to create a google apps script that given a google workspace user's email address (the current owner), the scritp should be able to get a list of all the user's folders and files in their google drive and then it should also be able to transfer the ownership of those folders and files to domain user and add the current owner as a viewer so they can only see the folders/files but can't modify them in any way.
things I tried:

*

*DriveApp can access files/folders and change the ownership of the file/folder but only if you are the owner, and I want to do this as the domain admin, regardless which user owns the google drive and respective files/folders.

*Drive API, seems to do the same as DriveApp as far you're the owner, I couldn't figure out how to give Drive API admin permissions so I can see every domain user google drive file list, if that's even possible.

*GAM advance: I found this as management tool, I set it and it migh do what I need but it's bit complex for me, plus I was really hoping to be able to build the tool myself.

What worked halfway:
I found this: https://github.com/googleworkspace/apps-script-oauth2#using-service-accounts which refers to using a service account. It took a while but I manage to get a list of items that exist on a user's google drive with the script below. but I can't figure out how to access those files/folders so I can change the ownership or set viewers on them. I think I read that the service account will only give me read-only access so I'm doubting this is even possible.
Here's what I got so far:
function main(){
  // Private key and client email of the service account.
  var key = getJsonKey()
  var clientEmail = 'service_account_email_setup_in_google_dev_console';
  // Email address of the user to impersonate.
  var userEmail = 'a_regular_domain_user@my_google_workspace_domain.com';

  try{
    var drive = getDriveService_(key,userEmail,clientEmail);
    if (drive.hasAccess()) {
      // this code gets me a json response with items that list id's and urls and other
      //file metadata of the
      // files that belongs to the domain user, this is as far as i got.
      var url = 'https://www.googleapis.com/drive/v2/files';
      var response = UrlFetchApp.fetch(url, {
         headers: {
           Authorization: 'Bearer ' + drive.getAccessToken()
         }
       });
       var result = JSON.parse(response.getContentText());
       //the following code returns a fileid in the user's google
       //drive not shared with the admin
       var fileid = JSON.stringify(result.items[0].id)
       Logger.log(fileid);
       //but the following code returns an error indicating that the
       //file is not found (in reality it's not accessible by the
       //admin account)
       var file = Drive.Files.get(fileid);

       //access a list of items and as I traverse it I'd like to
       //change the ownership and
       //add the the current user as a file viewer
       //??

    } else {
      Logger.log(drive.getLastError());
    }
  }catch (e){
    Logger.log(e)
  }
}

// Load the JSON key file with private key for service account
function getJsonKey(){
  var keyFile = DriveApp.getFileById("json_fileid_in_drive_obtained_from_googledevcons");
  var key = JSON.parse(keyFile.getBlob().getDataAsString()).private_key;
  return key
}

function reset() {
  getDriveService__().reset();
}

//get the google drive from the domain user's email address
function getDriveService_(key,userEmail,clientEmail) {
  return OAuth2.createService('GoogleDrive:' + userEmail)
      .setTokenUrl('https://oauth2.googleapis.com/token')
      .setPrivateKey(key)
      .setIssuer(clientEmail)
      .setSubject(userEmail)
      .setPropertyStore(PropertiesService.getUserProperties())
      .setCache(CacheService.getUserCache())
      .setScope('https://www.googleapis.com/auth/drive');
}

Any help is appreciated :)

A: You are going in the right direction, the only part you are missing currently is setting up Domain Wide Delegation this will allow you to impersonate the users in your domain so you can make the changes on behalf of them by granting the service account permissions through the above mentioned DWD.
Since you have already created the Oauth2Service you will just need to send the user to impersonate through the OauthParams:
const oauthParams = {
    serviceName: 'Nameofyourservice',
    serviceAccount,
    scopes: ['https://www.googleapis.com/auth/appsmarketplace.license', 'https://www.googleapis.com/auth/userinfo.email', 'https://mail.google.com', 'https://www.googleapis.com/auth/iam'],
    userToImpersonate: 'usertoimpersonate@test.com',
  };

The scopes were from the Marketplace API as an example.


text:
Q: How to check if a string matches a specific expression? I want to write a method that  check if a string matches the following format: "Name Surname" in Java. There will be max one space between Name and Surname, and both the starting letter of name and surname should be in capital letters.
Here is what I did:
public static Boolean correctFormat(ArrayList<String> e)
   {
       int x = 0;
       for(int i = 0; i < e.size(); i++)
       {
           if (e.get(i).indexOf(" ") != -1 && str.substring()
           {
               x++;
           }

  }

However, I could not find a way to check if name and surname's starting letter capital. Name and surname length can vary.
Note: The parameter of the method is ArrayList, so it takes ArrayList as an input.

A: you can use string split and character.isuppercase() and looping process to solve your issue as shown below
public class Test {

    public static boolean validateString(String string){
        String[] stringArray = string.split(" ");
        if(null == string || stringArray.length>2 || stringArray.length == 1) return false;
        for(String s : stringArray){
            if(!(Character.isUpperCase(s.toCharArray()[0])))return false;
        }
        return true;
    }

    public static void main(String[] args) {
        String s  = "Hello World";
        List<String> names = new ArrayList<>();
        names.add(s);
        names.forEach(string -> System.out.println("Is the string "+string+" valid :"+ validateString(s)));

    }

}

output : Is the string Hello World valid :true

A: You may use regex to check your conditions and iterate through your ArrayList using for-each loop.
    public static Boolean correctFormat(ArrayList<String> e)
    {
        String camelCasePattern = "([A-Z][a-z]+ [A-Z][a-z]+)";
        for(String s : e)
            if(!s.matches(camelCasePattern))
                return false;
        return true;
    }

The above code will return true only when all elements in ArrayList e will match as per the defined pattern.


text:
Q: c++ reference to a class member but not changing value Please help me to review the following code.
I am wondering why the variable "b" is not the modified value.
I can not change the value using reference ?
Thanks!
#include <iostream>

using namespace std;

class Foo{
    public:
        int a = 1;
        int& check(){
            return a;
        };
};

int main()
{
    int b;
    Foo foo;

    b = foo.check();
    cout << b << endl;

    foo.check() = 2;
    cout << foo.a << endl;
    cout << b << endl;

    return 0;
}

The output is
1
2
1

A: As @Igor Tandetnik indicated, foo.check returns a reference, but b is an int, not a reference to int, so it keeps the original value.
What you want can be achieved by ...
#include <iostream>

using namespace std;

class Foo
{
public:
    int a = 1;
    int &check()
    {
        return a;
    };
};

int main()
{
    Foo foo;
    int &b { foo.check() };

    cout << b << endl;

    foo.check() = 2;
    cout << foo.a << endl;
    cout << b << endl;

    return 0;
}


text:
Q: LibGDX static AssetManager for Desktop Only Game I know there is a lot of topic on that issue but for my case the only one I found here wasn't answered.
So i'm asking the same question:
Do I need to worry about setting my AssetManager static for a desktop only Game ?
Now just to summarize and clarify the Mobile Game static reference problem, lets say I also wanted to use a static AssetManager on a Mobile Game (because I find it more convenient). I know this will cause the Texture to be disposed on pause() but I can just reload them on resume() right ?
Lets say I have an animation for a player that use the Texture A (previously loaded into a static AssetManager). If the game is paused, the AssetManager reference will  most likely be lost. If on the resume() method I recreate this AssetManager (MyGame.asset = new AssetManager()) and I reload the Texture A, what will happend to my animation ? Will I need to reload it again also ?
I found this phrase in the Texture Javadoc :  Managed textures get reloaded automatically. I assume this is only valable for non static AssetManager am I right ?
The last questions are only here to summarize the use of a static AssetManager on Mobile Application.

A: As Abhishek Aryan correctly pointed out: using static variables for your resources is a serious indication of a fundamental design flaw. You should worry about that regardless the platform you are running your application on, so also on desktop. Depending on the rest of your design you might or might not run into issues.
Usually with these kind of design flaws, it seems to be working just fine for you at first. But later on you will run into issues. Unfortunately by that time you are already so far progressed in your development that you can't easily correct the fundamental issue and need to hack around it instead.

Note btw that it technically is perfectly possible to use static resources on any platform as long as you properly manage them (which is harder than just not using them). For example, libgdx itself is build around the Gdx static members.

To answer your other questions:

I know this will cause the Texture to be disposed on pause() but I can just reload them on resume() right ?

That is incorrect. Textures will never be disposed in pause, nor do you need to reload them in resume.

If the game is paused, the AssetManager reference will most likely be lost.

That is incorrect. I'm not sure why you would think that, but that's not the case.

Will I need to reload it again also ?

If you decide to dispose your old texture (which you would have to do yourself, it is not done automatically for you) then any Animation that uses that texture will be invalid. So, indeed if you want your animation to use a different texture then you will have to either update your animation or recreate it.

I assume this is only valable for non static AssetManager am I right ?

No, managed textures don't care whether you are using static resources. They are are always reloaded when the context is loss. Note that it is very unlikely that you will ever run into this situation, so you don't have to care about this.
You might also want to read this post i wrote a while ago on this topic.


text:
Q: ASP.net ObjectSource Parameter I have an ObjectDataSource with a parameter from a query string. I'm getting the following error:Value was either too large or too small for an Int32.I believe the query string might be too long for it's datatype. The InfoSheetID is populated from the database. Is there another option I can take or modify the ObjectDataSource to prevent the error?
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
OldValuesParameterFormatString="original_{0}"
        SelectMethod="GetInfoByInfoID"
        TypeName="BLL.InfoViewBLL">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="2148663911" Name="InfoSheetID"
                QueryStringField="InfoSheetID" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>

A: Int32.MaxValue is  2'147'483'647, that is lower than 2'148'663'911 which you use.
You can change type to Int64 or refactore your code to avoid using so big values.
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
OldValuesParameterFormatString="original_{0}"
        SelectMethod="GetInfoByInfoID"
        TypeName="BLL.InfoViewBLL">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="2148663911" Name="InfoSheetID"
                                                    ^^^^^^^^^^
                QueryStringField="InfoSheetID" Type="Int64" />
                                                     ^^^^^
        </SelectParameters>
    </asp:ObjectDataSource>


text:
Q: Linux: Bind UDP listening socket to specific interface (or find out the interface a datagram came in from)? I have a daemon I'm working on that listens for UDP broadcast packets and responds also by UDP.  When a packet comes in, I'd like to know which IP address (or NIC) the packet came TO so that I can respond with that IP address as the source.  (For reasons involving a lot of pain, some users of our system want to connect two NICs on the same machine to the same subnet.  We tell them not to, but they insist.  I don't need to be reminded how ugly that is.)
There seems to be no way to examine a datagram and find out directly either its destination address or the interface it came in on.  Based on a lot of googling, I find that the only way to find out the target of a datagram is to have one listening socket per interface and bind the sockets to their respective interfaces.
First of all, my listening socket is created this way:
s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)

To bind the socket, the first thing I tried was this, where nic is a char* to the name of an interface:
// Bind to a single interface
rc=setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, nic, strlen(nic));
if (rc != 0) { ... }

This has no effect at all and fails silently.  Is the ASCII name (e.g. eth0) the correct type of name to pass to this call?  Why would it fail silently?  According to man 7 socket, "Note that this only works for some socket types, particularly AF_INET sockets.  It is not supported for packet sockets (use normal bind(8) there)."  I'm not sure what it means by 'packet sockets', but this is an AF_INET socket.
So the next thing I tried was this (based on bind vs SO_BINDTODEVICE socket):
struct sockaddr_ll sock_address;
memset(&sock_address, 0, sizeof(sock_address));
sock_address.sll_family = PF_PACKET;
sock_address.sll_protocol = htons(ETH_P_ALL);
sock_address.sll_ifindex = if_nametoindex(nic);
rc=bind(s, (struct sockaddr*) &sock_address, sizeof(sock_address));
if (rc < 0) { ... }

That fails too, but this time with the error Cannot assign requested address.  I also tried changing the family to AF_INET, but it fails with the same error.
One option remains, which is to bind the sockets to specific IP addresses.  I can look up interface addresses and bind to those.  Unfortunately, is a bad option, because due to DHCP and hot-plugging ethernet cables, the addresses can change on the fly.
This option may also be bad when it comes to broadcasts and multicasts.  I'm concerned that binding to a specific address will mean that I cannot receive broadcasts (which are to an address other than what I bound to).  I'm actually going to test this later this evening and update this question.
Questions:

*

*Is it possible to bind a UDP listening socket specifically to an interface?

*Or alternatively, is there a mechanism I can employ that will inform my program that an interface's address has changed, at the moment that change occurs (as opposed to polling)?

*Is there another kind of listening socket I can create (I do have root privileges) that I can bind to a specific interface, which behaves otherwise identically to UDP (i.e other than raw sockets, where I would basically have to implement UDP myself)?  For instance, can I use AF_PACKET with SOCK_DGRAM?  I don't understand all the options.

Can anyone help me solve this problem?  Thanks!
UPDATE:
Binding to specific IP addresses does not work properly.  Specifically, I cannot then receive broadcast packets, which is specifically what I am trying to receive.
UPDATE:
I tried using IP_PKTINFO and recvmsg to get more information on packets being received.  I can get the receiving interface, the receiving interface address, the target address of the sender, and the address of the sender.  Here's an example of a report I get on receipt of one broadcast packet:
Got message from eth0
Peer address 192.168.115.11
Received from interface eth0
Receiving interface address 10.1.2.47
Desination address 10.1.2.47

What's really odd about this is that the address of eth0 is 10.1.2.9, and the address of ech1 is 10.1.2.47.  So why in the world is eth0 receiving packets that should be received by eth1?  This is definitely a problem.
Note that I enabled net.ipv4.conf.all.arp_filter, although I think that applies only to out-going packets.

A: The solution that I found to work is as follows.  First of all, we have to change ARP and RP settings.  To /etc/sysctl.conf, add the following and reboot (there's also a command to set this dynamically):
net.ipv4.conf.default.arp_filter = 1
net.ipv4.conf.default.rp_filter = 2
net.ipv4.conf.all.arp_filter = 1
net.ipv4.conf.all.rp_filter = 2

The arp filter was necessary to allow responses from eth0 to route over a WAN.  The rp filter option was necessary to strictly associate in-coming packets with the NIC they came in on (as opposed to the weak model that associates them with any NIC that matches the subnet).  A comment from EJP led me to this critical step.
After that, SO_BINDTODEVICE started working.  Each of two sockets was bound to its own NIC, and I could therefore tell which NIC a message came from based on the socket it came from.
s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
rc=setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, nic, IF_NAMESIZE);
memset((char *) &si_me, 0, sizeof(si_me));
si_me.sin_family = AF_INET;
si_me.sin_port = htons(LISTEN_PORT);
si_me.sin_addr.s_addr = htonl(INADDR_ANY);
rc=bind(s, (struct sockaddr *)&si_me, sizeof(si_me))

Next, I wanted to respond to in-coming datagrams with datagrams whose source address is that of the NIC the original request came from.  The answer there is to just look up that NIC's address and bind the out-going socket to that address (using bind).
s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
get_nic_addr(nics, (struct sockaddr *)&sa)
sa.sin_port = 0;
rc = bind(s, (struct sockaddr *)&sa, sizeof(struct sockaddr));
sendto(s, ...);

int get_nic_addr(const char *nic, struct sockaddr *sa)
{
    struct ifreq ifr;
    int fd, r;
    fd = socket(AF_INET, SOCK_DGRAM, 0);
    if (fd < 0) return -1;
    ifr.ifr_addr.sa_family = AF_INET;
    strncpy(ifr.ifr_name, nic, IFNAMSIZ);
    r = ioctl(fd, SIOCGIFADDR, &ifr);
    if (r < 0) { ... }
    close(fd);
    *sa = *(struct sockaddr *)&ifr.ifr_addr;
    return 0;
}

(Maybe looking up the NIC's address every time seems like a waste, but it's way more code to get informed when an address changes, and these transactions occur only once every few seconds on a system that doesn't run on battery.)

A: You can get the destination address used by the sender via the IP_RECVDSTADDR option if your platform supports it, by using recvmsg(). It's rather complicated, described in Unix Network Programming, volume I, 3rd edition, #22.2, and in the man page.
Re your edit, you are up against what is known as the 'weak end system model' of TCP/IP. Basically once a packet arrives the system can choose to deliver it via any appropriate interface listening to the correct port. It's discussed in the TCP/IP RFCs somewhere.

A: You're passing an illegal value to setsockopt.
rc=setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, nic, strlen(nic));

The man page says of SO_BIND_TO_DEVICE:

The passed option is a variable-length null-terminated interface name string with the maximum size of IFNAMSIZ

strlen doesn't include the terminating null.  You can try:
rc=setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, nic, 1 + strlen(nic));

dnsmasq has this working correctly, and uses
setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, intname, IF_NAMESIZE)

A: I believe you may be approaching the problem from the wrong angle. In the general case, interfaces can have multiple IP address at the same time so knowing which interface you are attached to is not going to give you the IP address (in the general case)
Instead, don't worry too much about the interfaces being used and focus on the IP addresses being used. First get the list all your IP addresses using getifaddrs() and bind one socket to each address.
select() can be used to wait for packets on all your sockets at once. Use the socket that received the packet to determine the destination address of the packet. Also, the socket that received the packet can be used to send a reply which will automatically set the source address appropriately.
You may occasionally need to check for new IP addresses, but you will get an error on a socket if DHCP gives you a new address.

A: I know this is an old thread but I did not find the answer I was looking for here.
Binding a raw socket to an interface such that the socket does not see any packets from another interface (including broadcast, IGMP, etc) worked for me by using the info I found here:
https://cs.wikipedia.org/wiki/Raw_socket
The functionality of the BindRawSocketToInterface() function was what I needed.
Hope this helps someone else.
Cheers!


text:
Q: androidStudio log doesn't work I cannot get log to work on my phone. I only get this error in Android Studio:

11-01 03:28:56.427 24227-24375/com.example.segall.caveofprogcourse E/GED: Failed to get GED Log Buf, err(0)
Android studio 2.1.3
Ubuntu 16.04 LTS
Sony Xperia M5
android 6.0 api 23

I have USB Debugging on.
Edit
This code in onCreate method
Log.d("mylog", " LOG WORKS ");
Log.e("mylog", "onCreate called really?"); // I added this Log

gets the following results:
11-01 21:51:23.561 7820-7820/com.example.segall.caveofprogcourse E/mylog: onCreate called really?
11-01 21:51:23.619 7820-7873/com.example.segall.caveofprogcourse E/GED: Failed to get GED Log Buf, err(0)

surprisingly, the Log.e works. Anyone know why this might have happened?
Edit 2
I created new project only with two logs in onCreate
    Log.d("mylog","Log.d on create this  is not working");
    Log.e("mylog","Log.e surprisingly this works");

I put a few empty line so it's easy to spot
log filter from app:
11-02 02:24:08.858 24802-24802/com.example.segall.logapp W/ResourceType: Found multiple library tables, ignoring...
11-02 02:24:08.863 24802-24802/com.example.segall.logapp W/System: ClassLoader referenced unknown path: /data/app/com.example.segall.logapp-1/lib/arm64
11-02 02:24:08.885 24802-24811/com.example.segall.logapp I/System: FinalizerDaemon: finalize objects = 1
11-02 02:24:09.038 24802-24802/com.example.segall.logapp W/System: ClassLoader referenced unknown path: /data/app/com.example.segall.logapp-1/lib/arm64
11-02 02:24:09.180 24802-24802/com.example.segall.logapp W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable

11-02 02:24:09.366 24802-24802/com.example.segall.logapp E/mylog: Log.e surprisingly this works

11-02 02:24:09.435 24802-24833/com.example.segall.logapp E/GED: Failed to get GED Log Buf, err(0)

11-02 02:24:09.439 24802-24833/com.example.segall.logapp I/OpenGLRenderer: Initialized EGL, version 1.4
11-02 02:24:09.448 24802-24833/com.example.segall.logapp I/OpenGLRenderer: Get enable program binary service property (1)
11-02 02:24:09.448 24802-24833/com.example.segall.logapp I/OpenGLRenderer: Initializing program atlas...
11-02 02:24:09.449 24802-24833/com.example.segall.logapp I/OpenGLRenderer: Program binary detail: Binary length is 360191, program map length is 152.
11-02 02:24:09.449 24802-24833/com.example.segall.logapp I/OpenGLRenderer: Succeeded to mmap program binaries. File descriptor is 38, and path is /dev/ashmem�.
11-02 02:24:09.449 24802-24833/com.example.segall.logapp I/OpenGLRenderer: No need to use file discriptor anymore, close fd(38).
11-02 02:24:09.452 24802-24833/com.example.segall.logapp W/libEGL: [ANDROID_RECORDABLE] format: 1
11-02 02:24:09.569 24802-24802/com.example.segall.logapp I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@aec4c2c time:73133463

log filter no filter:
--------- beginning of system
11-02 02:29:48.790 1014-2030/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.segall.logapp/.MainActivity} from uid 2000 from pid 29625 on display 0
11-02 02:29:48.790 1014-2030/? W/PackageManager: checkUidPermission(): android.permission.START_ANY_ACTIVITY of 2000 is denied.
11-02 02:29:48.792 1014-1231/? I/libPerfService: 1: set freq: 1950000
11-02 02:29:48.792 1014-1231/? I/libPerfService: 1: set: 4
11-02 02:29:48.793 1014-2030/? I/PowerManagerService: setBrightness mButtonLight 0.
11-02 02:29:48.798 1014-2036/? W/PackageManager: checkUidPermission(): android.permission.WRITE_MEDIA_STORAGE of 10014 is denied.
11-02 02:29:48.798 1014-2036/? W/PackageManager: checkUidPermission(): android.permission.READ_EXTERNAL_STORAGE of 10014 is denied.
11-02 02:29:48.800 330-330/? I/BufferQueue: [unnamed-330-1869](this:0x7fae55d400,id:1869,api:0,p:-1,c:-1) BufferQueue core=(330:/system/bin/surfaceflinger)
11-02 02:29:48.800 330-330/? I/BufferQueueConsumer: [unnamed-330-1869](this:0x7fae55d400,id:1869,api:0,p:-1,c:330) connect(C): consumer=(330:/system/bin/surfaceflinger) controlledByApp=false
11-02 02:29:48.800 330-330/? I/BufferQueueConsumer: [unnamed-330-1869](this:0x7fae55d400,id:1869,api:0,p:-1,c:330) setConsumerName: unnamed-330-1869
11-02 02:29:48.800 330-330/? I/BufferQueueConsumer: [Starting com.example.segall.logapp](this:0x7fae55d400,id:1869,api:0,p:-1,c:330) setConsumerName: Starting com.example.segall.logapp
11-02 02:29:48.800 330-330/? I/BufferQueueConsumer: [Starting com.example.segall.logapp](this:0x7fae55d400,id:1869,api:0,p:-1,c:330) setDefaultBufferSize: width=1 height=1
11-02 02:29:48.803 330-330/? I/BufferQueueConsumer: [Starting com.example.segall.logapp](this:0x7fae55d400,id:1869,api:0,p:-1,c:330) setDefaultBufferSize: width=1080 height=1920
11-02 02:29:48.803 330-330/? I/SurfaceFlinger: [Built-in Screen (type:0)] fps:1.709773,dur:4094.11,max:3980.13,min:16.10
11-02 02:29:48.807 330-443/? I/BufferQueueProducer: [Starting com.example.segall.logapp](this:0x7fae55d400,id:1869,api:2,p:1014,c:330) connect(P): api=2 producer=(1014:system_server) producerControlledByApp=false
11-02 02:29:48.807 330-1043/? I/BufferQueueProducer: [Starting com.example.segall.logapp](this:0x7fae55d400,id:1869,api:2,p:1014,c:330) new GraphicBuffer needed
11-02 02:29:48.809 29645-29645/? I/art: Late-enabling -Xcheck:jni
11-02 02:29:48.809 1014-2036/? I/ActivityManager: Start proc 29645:com.example.segall.logapp/u0a14 for activity com.example.segall.logapp/.MainActivity
11-02 02:29:48.810 1014-1032/? W/PackageManager: checkUidPermission(): android.permission.INTERNET of 10014 is denied.
11-02 02:29:48.815 1014-1036/? I/WindowManager: Focus moving from Window{da2cb0d u0 com.android.systemui/com.android.systemui.recents.RecentsActivity} to null
11-02 02:29:48.815 1014-1036/? I/WindowManager: Losing focus: Window{da2cb0d u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
11-02 02:29:48.825 1014-1378/? I/libPerfService: perfSetFavorPid - pid:29645, 73cd
11-02 02:29:48.839 29645-29645/com.example.segall.logapp W/ResourceType: Found multiple library tables, ignoring...
11-02 02:29:48.844 330-443/? I/BufferQueueProducer: [com.android.systemui/com.android.systemui.recents.RecentsActivity](this:0x7fae55e800,id:1867,api:1,p:-1,c:330) disconnect(P): api 1
11-02 02:29:48.844 330-443/? I/BufferQueueConsumer: [com.android.systemui/com.android.systemui.recents.RecentsActivity](this:0x7fae55e800,id:1867,api:1,p:-1,c:330) getReleasedBuffers: returning mask 0xffffffffffffffff
11-02 02:29:48.849 330-1043/? I/BufferQueueProducer: [com.android.systemui/com.android.systemui.recents.RecentsActivity](this:0x7fae55e800,id:1867,api:1,p:-1,c:330) disconnect(P): api 1
11-02 02:29:48.851 29645-29654/com.example.segall.logapp I/System: FinalizerDaemon: finalize objects = 1
11-02 02:29:48.853 29645-29645/com.example.segall.logapp W/System: ClassLoader referenced unknown path: /data/app/com.example.segall.logapp-1/lib/arm64
11-02 02:29:48.975 29645-29645/com.example.segall.logapp W/System: ClassLoader referenced unknown path: /data/app/com.example.segall.logapp-1/lib/arm64
11-02 02:29:48.977 1014-2030/? W/PackageManager: checkUidPermission(): android.permission.INTERACT_ACROSS_USERS_FULL of 10014 is denied.
11-02 02:29:48.977 1014-2030/? W/PackageManager: checkUidPermission(): android.permission.REAL_GET_TASKS of 10014 is denied.
11-02 02:29:48.977 1014-2030/? W/PackageManager: checkUidPermission(): android.permission.GET_TASKS of 10014 is denied.
11-02 02:29:48.998 330-330/? I/BufferQueueProducer: [FrameBufferSurface_0](this:0x7fb0759000,id:0,api:1,p:330,c:330) queueBuffer: fps=2.00 dur=5985.78 max=5805.78 min=14.24
11-02 02:29:49.063 330-330/? I/BufferQueueConsumer: [com.android.systemui/com.android.systemui.recents.RecentsActivity](this:0x7fae55e800,id:1867,api:1,p:-1,c:-1) disconnect(C)
11-02 02:29:49.064 330-330/? I/BufferQueue: [com.android.systemui/com.android.systemui.recents.RecentsActivity](this:0x7fae55e800,id:1867,api:1,p:-1,c:-1) ~BufferQueueCore
11-02 02:29:49.128 29645-29645/com.example.segall.logapp W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
11-02 02:29:49.143 1014-2075/? W/PackageManager: checkUidPermission(): android.permission.INTERACT_ACROSS_USERS of 10014 is denied.
11-02 02:29:49.143 1014-14701/? W/PackageManager: checkUidPermission(): android.permission.INTERACT_ACROSS_USERS_FULL of 10014 is denied.
11-02 02:29:49.213 1014-4093/? I/PowerManagerService: setBrightness mButtonLight 0.
11-02 02:29:49.217 1014-1377/? I/PowerManagerService: setBrightness mButtonLight 0.
11-02 02:29:49.217 1014-1378/? I/PowerManagerService: setBrightness mButtonLight 0.
11-02 02:29:49.219 1014-30758/? I/PowerManagerService: setBrightness mButtonLight 0.

11-02 02:29:49.317 29645-29645/com.example.segall.logapp E/mylog: Log.e surprisingly this works

11-02 02:29:49.320 330-443/? I/SurfaceFlinger: EventThread Client Pid (29645) created
11-02 02:29:49.323 330-443/? I/SurfaceFlinger: EventThread Client Pid (29645) created
11-02 02:29:49.334 330-1043/? I/SurfaceFlinger: [SF client] NEW(0x7fae011a80) for (1014:system_server)
11-02 02:29:49.367 1014-1986/? W/PackageManager: checkUidPermission(): android.permission.STATUS_BAR of 10014 is denied.
11-02 02:29:49.368 330-330/? I/BufferQueue: [unnamed-330-1870](this:0x7fae55e800,id:1870,api:0,p:-1,c:-1) BufferQueue core=(330:/system/bin/surfaceflinger)
11-02 02:29:49.368 330-330/? I/BufferQueueConsumer: [unnamed-330-1870](this:0x7fae55e800,id:1870,api:0,p:-1,c:330) connect(C): consumer=(330:/system/bin/surfaceflinger) controlledByApp=false
11-02 02:29:49.368 330-330/? I/BufferQueueConsumer: [unnamed-330-1870](this:0x7fae55e800,id:1870,api:0,p:-1,c:330) setConsumerName: unnamed-330-1870
11-02 02:29:49.368 330-330/? I/BufferQueueConsumer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:0,p:-1,c:330) setConsumerName: com.example.segall.logapp/com.example.segall.logapp.MainActivity
11-02 02:29:49.368 330-330/? I/BufferQueueConsumer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:0,p:-1,c:330) setDefaultBufferSize: width=1 height=1
11-02 02:29:49.376 330-330/? I/BufferQueueConsumer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:0,p:-1,c:330) setDefaultBufferSize: width=1080 height=1920
11-02 02:29:49.379 1014-1036/? I/WindowManager: Focus moving from null to Window{4f3b63c u0 com.example.segall.logapp/com.example.segall.logapp.MainActivity}
11-02 02:29:49.379 1014-1036/? I/WindowManager: Gaining focus: Window{4f3b63c u0 com.example.segall.logapp/com.example.segall.logapp.MainActivity}

11-02 02:29:49.380 29645-29672/com.example.segall.logapp E/GED: Failed to get GED Log Buf, err(0)

11-02 02:29:49.384 29645-29672/com.example.segall.logapp I/OpenGLRenderer: Initialized EGL, version 1.4
11-02 02:29:49.394 29645-29672/com.example.segall.logapp I/OpenGLRenderer: Get enable program binary service property (1)
11-02 02:29:49.394 29645-29672/com.example.segall.logapp I/OpenGLRenderer: Initializing program atlas...
11-02 02:29:49.395 29645-29672/com.example.segall.logapp I/OpenGLRenderer: Program binary detail: Binary length is 360191, program map length is 152.
11-02 02:29:49.395 29645-29672/com.example.segall.logapp I/OpenGLRenderer: Succeeded to mmap program binaries. File descriptor is 38, and path is /dev/ashmem�.
11-02 02:29:49.395 29645-29672/com.example.segall.logapp I/OpenGLRenderer: No need to use file discriptor anymore, close fd(38).
11-02 02:29:49.398 330-440/? I/BufferQueueProducer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:1,p:29645,c:330) connect(P): api=1 producer=(29645:com.example.segall.logapp) producerControlledByApp=true
11-02 02:29:49.398 29645-29672/com.example.segall.logapp W/libEGL: [ANDROID_RECORDABLE] format: 1
11-02 02:29:49.399 330-1044/? I/BufferQueueProducer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:1,p:29645,c:330) new GraphicBuffer needed
11-02 02:29:49.406 330-443/? I/BufferQueueProducer: [StatusBar](this:0x7fb075a400,id:8,api:1,p:1335,c:330) queueBuffer: fps=0.15 dur=6482.88 max=6482.88 min=6482.88
11-02 02:29:49.460 1014-1036/? I/ActivityManager: [AppLaunch] Displayed Displayed com.example.segall.logapp/.MainActivity: +661ms
11-02 02:29:49.460 1014-1036/? I/Timeline: Timeline: Activity_windows_visible id: ActivityRecord{548a061 u0 com.example.segall.logapp/.MainActivity t1972} time:73473354
11-02 02:29:49.460 1014-1231/? I/libPerfService: 1: set: 1
11-02 02:29:49.460 1014-1231/? I/libPerfService: 1: set freq: 0
11-02 02:29:49.460 1014-1231/? I/libPerfService: 1: set vcore level: 0
11-02 02:29:49.515 330-1043/? I/BufferQueueProducer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:1,p:29645,c:330) new GraphicBuffer needed
11-02 02:29:49.531 2491-2496/? I/PerfService: PerfServiceNative_getPackName
11-02 02:29:49.532 1014-1378/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.532 1014-1378/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.532 1014-1378/? E/PerfService: com.example.segall.logapp
11-02 02:29:49.534 1014-1378/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.534 1014-1378/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.534 1014-1378/? E/PerfService: com.example.segall.logapp
11-02 02:29:49.534 2491-2496/? I/PerfService: com.example.segall.logapp
11-02 02:29:49.534 2491-2496/? I/PerfService: PerfServiceNative_getPackName
11-02 02:29:49.534 1014-14701/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.534 1014-14701/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.534 1014-14701/? E/PerfService: com.example.segall.logapp

screen of logcat

A: *

*Try to don't use filter on the top right of logcat

*Re-check your device is connected and logcat listen to the correct device

*Choose log type verbose

*You may need to download the configuration file from developer console and add it to your project. Second step of this link.File name is google-services.json

*check your lib configuration especially Firebase config.

A: I had the same problem. Please update your Android Studio. It was a bug

A: With Linux(Ubuntu), you have Set up your system to detect your device. You may check these Google guidelines
You need to add a udev rules file that contains a USB configuration for each type of device you want to use for development.
Before doing this, Verify that your application is "debuggable" in your manifest or build.gradle file.
 android {
        buildTypes {
            debug {
                debuggable true
            }

In the AndroidManifest.xml  file, add android:debuggable="true" to the <application> element.
Now set up your system to detect your device using a udev rules file. Add a udev rules file that contains a USB configuration for each type of device you want to use for development. In the rules file, each device manufacturer is identified by a unique vendor ID, as specified by the ATTR{idVendor} property. So you have to know Sonys vendor id in your case: 054c

*

*Log in as root and create this file: /etc/udev/rules.d/51-android.rules
i.e
sudo gedit /etc/udev/rules.d/51-android.rules

Use this format to add each vendor to the file: 054c is sonys vendor id.
SUBSYSTEM=="usb", ATTR{idVendor}=="054c", MODE="0666", GROUP="plugdev"

If you add SUBSYSTEM=="usb", ATTR{idVendor}=="054c", MODE="0666", GROUP="plugdev" Android studio will detect Sony.

*Now execute: chmod a+r /etc/udev/rules.d/51-android.rules
Close and start Studio. Then run run your project. Studio will detect it


text:
Q: How i will be able to release port used by Ants Performance Software So That I Will be able to restart my IIS I am facing one problem while using Ants Performance Software. I am using it for monitoring my IIS. I used it for monitoring my IIS for long hours like more than 8 hours.Then Ants Performance software got hanged And now I am not able to even stop it. And that port number is also getting locked means Ants Performance is not releasing that port. So now even I am not able to restart my IIS. Because it is throwing message that this port is getting used by some other application. Please help anyone how to handle this.
Thanks.


text:
Q: How to create a sequence starting with a character and then with numbers in R How to create a sequence starting with a character and then with numbers in R
I wanna to create a sequence like the following:
y1998 y1999 y2000 till y2011

A: There's ::
1998:2011

And ' or " to create string constants:
'y'

And paste0 to concatenate both:
paste0('y', 1998:2011)

Note how the paste0 function is applied to the second parameter, element by element. That's one of R's strengths.


text:
Q: Nested Array Value twig 3rd child element I've tried a nested Loop in Opencart Twig Template  but I cant get the child values
{% for category in couriers.couriers %}
    {% set children = category.service_types %}
    {% for service_t in children %}

            {{ service_t.service_id }}
            {{ category.name }}
            {{ service_t.service_name }}
            {{ service_t.display_name }}	][1]][1]
            {{ service_t.form_required }}
            {{ service_t.min_delivery_days }}
            {{ service_t.max_delivery_days }}

            {% for rate_br in service_t.rate_breakup %}
                {{ rate_br.base_rate }}
            {% endfor %}

    {% endfor %}
{% endfor %}

My data looks like this


text:
Q: How to insert infinite scroll to Laravel Project Am very new to Jquery and Ajax being used in laravel and been trying to implement infinite scroll to my project and i have no idea where to start
The Controller:
$books= DB::table('books')->where('status', 'post')->orderBy('created_at', 'DESC')->paginate(15);

   if ($books->isEmpty())
   {
     $books= null;

     return view('landingpage')->withBooks($books);
   }
   return view('landingpage')->withBooks($books);

The view
   @if ($books== null)

 Be the first to share your shopping experience  here

        @else

 @foreach ($books as $item)

 {{$item->title}}

                rate}}.png" style="width:50%" alt="Image">

{{$item->firstname}} {{$item->lastname}}

@endforeach
{{$books->links()}}

                @endif

The JS


text:
Q: How pvalue is calculated internally here ? And what is the data point for which it is calculating pvalue I got a into a question while going through poisson distribution.
Here it is:---
A nuclear pump failed 5 times out of 94.32 days.
Give a 95% confidence interval (CI) for the failure rate per day
So i ran:--
poisson.test(x = 5, T = 94.32, r = 1, alternative = "two.sided", conf.level = 0.95)
Which gave output of:-
Exact Poisson test

data:  5 time base: 94.32
number of events = 5, time base = 94.32, p-value < 2.2e-16
alternative hypothesis: true event rate is not equal to 1
95 percent confidence interval:
 0.01721254 0.12371005
sample estimates:
event rate
0.05301103

But i did not understand on what value pvalue is calculated and how it is calculated here ?

A: As @linog mentioned in his comment, typing poisson.test into R will print the source code for the function.
The relevant bit is:
⋮
m <- r * T
PVAL <- switch(alternative, less = ppois(x, m), greater = ppois(x -
            1, m, lower.tail = FALSE), two.sided = {
            if (m == 0) (x == 0) else {
                relErr <- 1 + 1e-07
                d <- dpois(x, r * T)
                if (x == m) 1 else if (x < m) {
                  N <- ceiling(2 * m - x)
                  while (dpois(N, m) > d) N <- 2 * N
                  i <- seq.int(from = ceiling(m), to = N)
                  y <- sum(dpois(i, m) <= d * relErr)
                  ppois(x, m) + ppois(N - y, m, lower.tail = FALSE)
                } else {
                  i <- seq.int(from = 0, to = floor(m))
                  y <- sum(dpois(i, m) <= d * relErr)
                  ppois(y - 1, m) + ppois(x - 1, m, lower.tail = FALSE)
                }
            }
        })
⋮

And particularly in this case:
N <- ceiling(2 * m - x)
while (dpois(N, m) > d) N <- 2 * N
i <- seq.int(from = ceiling(m), to = N)
y <- sum(dpois(i, m) <= d * relErr)
ppois(x, m) + ppois(N - y, m, lower.tail = FALSE)

with the final line being the p-value that's calculated for the given x, r, and T values.
If $X \sim \textrm{Poisson}(rT)$, the p-value for the two sided test is given by:
$$ \sum_{x=0}^{\infty} \mathbb{P}(X = x) * \mathbb{I}_{\mathbb{P}(X=x) \le \mathbb{P}(X = 5)}$$
Where $\mathbb{I}$ is the indicator function.
This is just the sum of all possible observed values that are as probable or less probable than the true observed value, given the null hypothesis ($\lambda = rT$). This is the basic idea of a two-sided test - we want to know the probability of observing any value as extreme or more extreme than the one we did (given the null).
The reason for the extra work in the source code is because we can't take the sum over an infinite number of $x$ values - we have to choose a cutoff after which the probabilities become small enough that they don't matter. Where this cutoff is depends on x, r, and T.
Addressing your comment -
$\lambda$ (the mean & variance of the Poisson) is equal to the rate ($r$) times the exposure ($T$). So here $\lambda=94.32$.
To find the two-sided probability, we add all the probabilities that are less than the probability of the observed value. This includes both the left and right tails of the Poisson. The left tail probability can be calculated with ppois(x = 5, lambda = 94.32, lower.tail = TRUE).
The right tail is a bit more tricky, as we need to find the point on the right tail where the values become as or more extreme (less probable to observe) than the observed value.
The following works for these values, though you'll need a more rigorous method such as that used by poisson.test to work with different parameters.
i <- 0:1000

# First value on the right tail that's more extreme than 5
right_tail <- min(which(dpois(i, 94.32) <= dpois(5, 94.32) & i > 5))
p_left <- ppois(5, 94.32)
# Subtract one from right_tail first to go from 0-index to 1-index of i,
# then subtract one more to include the probability of the first value (right_tail)
p_right <-  ppois(right_tail - 1 - 1, 94.32, lower.tail = FALSE)
p_val <- p_left + p_right


text:
Q: Why am I getting a NoClassDefFoundError on HttpServletRequest that is pointing to ServletFileUpload? I recently started using JMeter to load test my webapp, locally on my pc. I have a jsp page for uploading images. The images are processed by my servlet. When I tried the process today, I got the following exception/error :
exception

javax.servlet.ServletException: Servlet execution threw an exception

root cause

java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
    org.apache.commons.fileupload.servlet.ServletFileUpload.isMultipartContent(ServletFileUpload.java:68)
    spyder.servlets.imageProcessing.ImageProcessingServlet.uploadEditedImagesToDB(ImageProcessingServlet.java:527)
    spyder.servlets.imageProcessing.ImageProcessingServlet.doPost(ImageProcessingServlet.java:153)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Here is the code from my servlet that the exception is referring to -
boolean isPart = ServletFileUpload.isMultipartContent(req);

....and yes, I've put all the necessary import statements in the class.
I can't recall making any changes to anything on my system that would cause this problem. This process has always run without any problems, so I don't understand what is causing it to fail like this now. Its rather coincidental, I think, that it is failing after I've been using JMeter...

A: This means that your servlet container does not have the servlet api. Take a clean installation of Tomcat and try to deploy there. First check that you have the servlet api jar in tomcat/lib. And make sure you don't have it in webapps/yourapp/WEB-INF/lib

A: All 3rd party webapp libraries like Commons FileUpload belong in /WEB-INF/lib of your webapp, not elsewhere. This exception can occur whenever you've placed it in JRE/lib or JRE/lib/ext.
And indeed, as Bozho mentions, you need to ensure as well that you haven't moved/copied/duplicated any servletcontainer-specific libraries (which should be left untouched in Tomcat/lib) around in different places of the classpath. But that should IMO not have resulted in this kind of exception. It's basically telling that the classloader which loaded the FileUpload API has totally no knowledge about the Servlet API.
If you read the Tomcat classloading HOW-TO, then you'll see that the libraries in JRE/lib and JRE/lib/ext are loaded by a different classloader (bootstrap) than the ones in Tomcat/lib (common) and /WEB-INF/lib (webapp). The bootstrap classloader has  no knowledge about common and webapp libraries. It's the other way round. The common classloader has knowledge about the bootstrap classloader and the webapp classloader has knowledge about both. Since the Servlet API is normally loaded by the common classloader, this can only mean that the FileUpload API was loaded by the bootstrap classloader. And this is wrong :)


text:
Q: Equality of $2$ infinite series If $$\sum_{k=0}^{\infty}a_kt^k = \sum_{k=0}^{\infty}b_kt^k \quad \forall t \in \mathbb{R}  \implies (a_k=b_k  \ \forall k \in \mathbb{N_{0}} )   $$
Prove or make counterexample.I think it's true but don't know how to proceed.
I start $$ \lim_{n\to\infty}\sum_{k=0}^{n}a_kt^k =\lim_{m\to\infty}\sum_{k=0}^{m}b_kt^k  $$
I can only get that $a_0 = b_0$ by setting $t=0$.But then i tried same trick to do for $a_1 = b_1 $ but that didn't help me.
Maybe it is something trivial but I can't see it.

A: This is a property of power series if it is assumed that the series converge in $(-r,r)$ for  some $r>0$. The coefficients of a convergent power series $\sum a_n t^{n}$ are simply $\frac {f^{(n)} (0)} {n!}$ where $f$ is the sum of the series.
Reference: Any book on Complex Analysis starts with this this theorem. But you can simply replace complex numbers by real numbers in the proof and it works fine for real series also.

A: Let $f(t) = \sum_{k = 0}^\infty a_kt^k$, $g(t) = \sum_{k = 0}^\infty b_kt^k$. By hypothesis, $f(t) = g(t)$ $ \forall t \in \mathbb{R}$. Then
$$ f'(0) = \lim_{h \to 0} \frac{f(h) - f(0)}{h} = a_1$$
and
$$ g'(0) = \lim_{h \to 0} \frac{g(h) - f(0)}{h} = b_1.$$
Hence $a_1 = b_1$. By continuing this way, you prove equality $a_k = b_k$ for every $k \in \mathbb{N}$.
Notice that you don't actually need equality of the two series for every $t \in \mathbb{R}$, but only for every $t$ in a fixed neighborhood of zero.

A: The property is equivalent to
$$\forall t:d(t):=\sum_{k=0}^\infty d_kt^k=0\implies \forall k:d_k=0.$$
Clearly, $d(0)=0\implies d_0=0$.
Then as $d(t)$ converges, so does $e(t):=\dfrac{d(t)}t=\displaystyle\sum_{k=1}^\infty d_kt^{k-1}$, and $\lim_{t\to0}e(t)=0=d_1$. You can iterate.


text:
Q: The action can't be completed because the folder or a file in it is open in another program I want to remove an unnecessary file from drive c:\ the message

The action can't be completed because the folder or a file in it is
  open in another program

Please help me how to remove it.

A: That's pretty much what the error says: you can't delete the file because it is in use by another program.
The simplest way to solve the problem for an inexperienced user is to reboot the machine, then try to delete the file again.  If this does not work, try to reboot in Safe Mode (hit F8 at boot) with the minimum number of services launched.
You can also try to identify the program (from the Task Manager) that's holding the lock and kill it, if you know what you're doing.


text:
Q: Firebase Magic Link in Jetpack Compose (II) TLDR; Deep link data is observed at the Activity, but is null at the Composable.
I'm refactoring a view-based screen which contains an Android App Link. My legacy implementation was operational but I'm missing something as I do this work in Compose.
The expected value of link is present and correctly received/logged at the Activity's onResume.
// .ui.compose.ComposeActivity.kt
override fun onResume() {
    super.onResume()
    intent?.data?.let { d ->
        d.queryParameterNames.forEach { p ->
            Timber.v(">> $p :${d.getQueryParameter(p)}") // prints ">> link: mySpecialValue"
        }
    }
}

The project has that single Activity, with this manifest declaration.
<!-- AndroidManifest.xml -->
<activity
    android:name=".ui.compose.ComposeActivity"
    android:exported="true"
    android:theme="@style/Theme.App.DayNight.NoActionBar">

    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>

    <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data
            android:host="es0329.com"
            android:scheme="https" />
    </intent-filter>
</activity>

The Firebase ActionCodeSettings data.
actionCodeSettings {
    url = "https://es0329.com/"
    handleCodeInApp = true
    setAndroidPackageName(
        BuildConfig.APPLICATION_ID,
        INSTALL_IF_NOT_AVAILABLE,
        BuildConfig.VERSION_NAME
    )
}

The Magic Link is sent via email and clicking it wakes the app, then segues to the intended (Composable) screen.
fun RootNavGraph(navController: NavHostController) {
    AnimatedNavHost(
        navController = navController,
        route = "root_graph",
        startDestination = "auth_graph"
    ) {
        authNavGraph(navController)
    }
}

That destination is configured programmatically, in a nested nav graph as follows.
fun NavGraphBuilder.authNavGraph(navController: NavHostController) {
    navigation(
        route = "auth_graph",
        startDestination = "auth"
    ) {
        composable(
            route = "auth",
            deepLinks = listOf(
                navDeepLink {
                    uriPattern = "https://es0329.com/?link={link}"
                    action = Intent.ACTION_VIEW
                }
            )
            // Same result with/without "arguments".
            // arguments = listOf(
            //   navArgument(KEY_LINK) { type = NavType.StringType }
            // )
        ) { entry ->
            LoginScreen(link = entry.arguments?.getString("link"))
        }
    }
}

The pertinent UI layers are the project's single ComposeActivity, and the new LoginScreen.
However, the value of that link is always null at the screen-level Composable.
@Composable
fun LoginScreen(viewModel: LoginViewModel = hiltViewModel(), link: String? = null) {
    Timber.v(">> link: ${link ?: "null"}") // prints ">> link: null"
}

So the expected payload is observed at the Activity, but null at the Composable.


text:
Q: How do I allocate size for a dynamic array in c++? So I wrote a method in c++ where I remove a range of elements in an array. The thing is this is a dynamic array and the size of the array must always be a certain size. So if I remove alot of elements from the array and leave at least 5 empty spaces then I need to remove those 5 empty spaces. I already wrote a similar method where I remove one element. This is the line that checks to see if there's too much space:
if (size - 1 == allocated_size - BLOCK_SIZE){

Where size is the number of elements in the array, allocated_size is how much space is in the array and BLOCK_SIZE is 5. So with my other remove method, I need to do a similar check however what if I have an array of 15 elements and I remove 10 elements. Then I would have to remove 10 spaces in the array but I'm not sure how to do that. Here's what I have right now:
if (size - range <= allocated_size - BLOCK_SIZE){
            try {
                new_array = new int[allocated_size - BLOCK_SIZE];
            } catch (bad_alloc){
                throw exception (MEMORY_EXCEPTION);
            }

Where range is the number of elements I'm removing. My theory is that maybe I could make another variable and when I declare the array I say allocated_size - BLOCK_SIZE * n so if I need to remove 10 spaces then n would be 2. The problem I'm having trouble implementing that.

A: Could you use some int arithmetic,
the number of empty slots in your array will be:
int empty_slots = allocated_size - size;

The number of empty blocks will be:
int empty_blocks = empty_slots / 5;

integer division truncates so for 0 - 4 empty slots you will have 0 empty blocks for 5-9 empty slots you will have 1 empty block etc...
But don't you really want to know how big to make your new array? wouldn't that always be size, so:
int blocks_need = size / 5;                // truncates
if (size % 5 > 0) {
    blocks_need = blocks_needed + 1;   // add a block if needed
}
new_array = new int[blocks_needed * 5];

or size + extra capacity if you want some extra capacity in your array.


text:
Q: Custom navigation bar in beamer? I need to get the navigation bar format in the diagram below on my frames. Any suggestions?
 \documentclass[svgnames]{beamer}
\usetheme{Rochester}
%\usetheme{CambridgeUS}
\usepackage[british]{babel}
\usepackage{tikz}
\usetikzlibrary{positioning}

%%%%%%%%%%%%%%%%%%%%%%%-----------------Navigation Panel-----------------%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\makeatletter
\pgfdefobject{beamerslidenavlight}{\pgfpoint{-10pt}{-1pt}}{\pgfpoint{20pt}{5pt}}
 {\pgfpathqmoveto{-3bp}{0.5bp}
  \pgfpathqlineto{-7bp}{3bp}
  \pgfpathqlineto{-3bp}{5.5bp}
  \pgfusepathqfill
  \pgfpathqmoveto{13bp}{0.5bp}
  \pgfpathqlineto{17bp}{3bp}
  \pgfpathqlineto{13bp}{5.5bp}
  \pgfusepathqfill}

\def\insertslidenavigationsymbol{%
  \begin{pgfpicture}{-5pt}{-1.5pt}{20pt}{5.5pt}
    \color{black}\pgfuseobject{beamerslidenavlight}%
  \end{pgfpicture}\kern-30pt%
  \hyperlinkslideprev{\beamer@linkspace{16pt}}%
  \Acrobatmenu{GoToPage}{\beamer@linkspace{8pt}}%
  \hyperlinkslidenext{\beamer@linkspace{6pt}}}
\makeatother

\defbeamertemplate*{navigation symbols}{myvertical}{%
\vbox{\begin{tikzpicture}[remember picture,overlay]
  \node[fill=gray!20,draw,anchor=south east]
  (symbols)
  at ([yshift=50pt]current page.south east)
  {\insertslidenavigationsymbol};
  \node[text width=30pt,fill=gray!20,inner ysep=3pt,below=2 pt of symbols.south,text=black,font=\itshape,align=center]
  (page)
  {Page~\textcolor{red}{\insertframenumber}\ of~\textcolor{red}{\inserttotalframenumber}};
  \draw[gray!70,line width=1pt]
    (page.north west) -- (page.north east)
    (page.south west) -- (page.south east)
    (symbols.north) -- (symbols.south)
    (symbols.north west) -- (symbols.north east)
    (symbols.south west) -- (symbols.south east)
    ;
    \end{tikzpicture}}%
}
%%%%%% ------------------------------------ FONT FAMILIES----------------------------------------- %%%%%%%%

%\usepackage{courier}
%\renewcommand*\familydefault{\ttdefault} %% Only if the base font of the document is to be typewriter style
%\usepackage[T1]{fontenc}
                            %%%%%%-------Latin Modern Typewriter---------%%%%%%%

\usepackage{lmodern}
\renewcommand*\familydefault{\ttdefault} %% Only if the base font of the document is to be typewriter style
\usepackage[T1]{fontenc}

%%%%%%----------------------TITLE---------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%

\title[]{}

%%%%%%%%%--------------------------AUTHOR-------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%-------------------------------COLLEGE AND DATE------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%

\institute{}
\date{\today}

%%%%%%%%%--------------------------COLOR THEME-----------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%

 %\usecolortheme[RGB]{227, 11, 92}{structure}
\usecolortheme[RGB={178, 34, 34}]{structure}

%%%%%%%%%------------------------FOOTLINE--------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%

\defbeamertemplate*{footline}{ru theme}{%
  \leavevmode%
  \centering
  \hbox{%
  \begin{beamercolorbox}[wd=.50\paperwidth,ht=4.25ex,dp=1ex,center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\insertshortauthor
    \leftskip=0.5cm
  \end{beamercolorbox}%
 % \begin{beamercolorbox}[wd=.2\paperwidth,ht=4.25ex,dp=1ex,center]{author in head/foot}%
%    \usebeamerfont{author in head/foot}\insertshortdate
%  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.4\paperwidth,ht=4.25ex,dp=1ex,center]{title in head/foot}%
    \usebeamerfont{title in head/foot}\insertshorttitle
  \end{beamercolorbox}%
   \begin{beamercolorbox}[wd=0.08\paperwidth,ht=4.25ex,dp=1ex,right]{title in head/foot}%
    \insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
  \end{beamercolorbox}}%
  \vskip0pt%
}

%%%%%%%%%------------------------HEADERLINE---------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%

%HEADER LINE

\makeatletter
\defbeamertemplate*{headline}{}{%
  %
    \leavevmode%
    \hspace*{0.065\paperwidth}
    \hbox{%
    \begin{beamercolorbox}[wd=.86\paperwidth,ht=10.25ex,dp=1ex,center,rounded=true,shadow=true]{frametitle}
      \ifx\beamer@sidebarside\beamer@lefttext%
      \else%
        \hfill%
      \fi%
      \ifdim\beamer@sidebarwidth>0pt%
        \usebeamercolor[bg]{logo}%
        \vrule width\beamer@sidebarwidth height \beamer@headheight%
        \hskip-\beamer@sidebarwidth%
        \hbox to \beamer@sidebarwidth{\hss\vbox to
          \beamer@headheight{\vss\hbox{\color{fg}\insertlogo}\vss}\hss}%
      \else%
        \vrule width0pt height \beamer@headheight%
      \fi%
    \end{beamercolorbox}
    }
}

\defbeamertemplate*{frametitle}{}
  {%
    \nointerlineskip%
    \vskip-\beamer@headheight%
    \vbox to \beamer@headheight{%
      \vfil
      \leftskip=-\beamer@leftmargin%
      \advance\leftskip by 0.07\paperwidth%0.3cm%
      \rightskip=-\beamer@rightmargin%
      \advance\rightskip by0.3cm plus1fil%
      {\usebeamercolor[fg]{frametitle}\usebeamerfont{frametitle}\insertframetitle\par}%
      {\usebeamercolor[fg]{framesubtitle}\usebeamerfont{framesubtitle}\insertframesubtitle\par}%
      \vbox{}%
      \vskip-1em%
      \vfil
    }%
  }
\makeatother
%
%%%%%%%%%---------------------------TITLE PAGE-------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%

\setbeamertemplate{title page}[default][colsep=-4bp,rounded=true,shadow=true,ht=11ex]
\setbeamertemplate{navigation symbols}{}

 %%%%%%%%---------------------------- PRESENTATION SLIDES -----------------------------------%%%%%%%%%%%%%%%%%%%%%

 %%%%%%%%%-------------------------------TITLEPAGE---------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\begin{frame}[plain]
 \titlepage
\end{frame}

%%%%%%%%%----------------------------------------TABLE OF CONTENTS----------%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}{\bfseries Table of Contents}
  \tableofcontents
\end{frame}

%%%%%%%%%----------------------------INTRODUCTION-----------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%

  \end{document}

A: Update
With the actual settings (you need to comment out or delete \setbeamertemplate{navigation symbols}{} and add \makeatletter, \makeatother as in my origincal code):
 \documentclass[svgnames]{beamer}
\usetheme{Rochester}
%\usetheme{CambridgeUS}
\usepackage[british]{babel}
\usepackage{tikz}
\usetikzlibrary{positioning}

%%%%%%%%%%%%%%%%%%%%%%%-----------------Navigation Panel-----------------%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\pgfdefobject{beamerslidenavlight}{\pgfpoint{-10pt}{-1pt}}{\pgfpoint{20pt}{5pt}}
 {\pgfpathqmoveto{-3bp}{0.5bp}
  \pgfpathqlineto{-7bp}{3bp}
  \pgfpathqlineto{-3bp}{5.5bp}
  \pgfusepathqfill
  \pgfpathqmoveto{13bp}{0.5bp}
  \pgfpathqlineto{17bp}{3bp}
  \pgfpathqlineto{13bp}{5.5bp}
  \pgfusepathqfill}

\def\insertslidenavigationsymbol{%
  \begin{pgfpicture}{-10pt}{-1.5pt}{20pt}{5.5pt}
    \color{black}\pgfuseobject{beamerslidenavlight}%
  \end{pgfpicture}\kern-30pt%
  \hyperlinkslideprev{\beamer@linkspace{16pt}}%
  \Acrobatmenu{GoToPage}{\beamer@linkspace{8pt}}%
  \hyperlinkslidenext{\beamer@linkspace{6pt}}}
\makeatother

\defbeamertemplate*{navigation symbols}{myvertical}{%
\vbox{\begin{tikzpicture}[remember picture,overlay]
  \node[fill=gray!20,anchor=south east]
  (symbols)
  at ([yshift=50pt]current page.south east)
  {\insertslidenavigationsymbol};
  \node[text width=30pt,fill=gray!20,inner ysep=3pt,below=2 pt of symbols.south,text=black,font=\normalsize\Tiny\itshape,align=center]
  (page)
  {Page~\textcolor{red}{\insertframenumber}\ of~\textcolor{red}{\inserttotalframenumber}};
  \draw[gray!70,line width=1pt]
    (page.north west) -- (page.north east)
    (page.south west) -- (page.south east)
    (symbols.north) -- (symbols.south)
    (symbols.north west) -- (symbols.north east)
    (symbols.south west) -- (symbols.south east)
    ;
    \end{tikzpicture}}%
}
\makeatother
%%%%%% ------------------------------------ FONT FAMILIES----------------------------------------- %%%%%%%%

%\usepackage{courier}
%\renewcommand*\familydefault{\ttdefault} %% Only if the base font of the document is to be typewriter style
%\usepackage[T1]{fontenc}
                            %%%%%%-------Latin Modern Typewriter---------%%%%%%%

\usepackage{lmodern}
\renewcommand*\familydefault{\ttdefault} %% Only if the base font of the document is to be typewriter style
\usepackage[T1]{fontenc}

%%%%%%----------------------TITLE---------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%

\title[]{}

%%%%%%%%%--------------------------AUTHOR-------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%-------------------------------COLLEGE AND DATE------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%

\institute{}
\date{\today}

%%%%%%%%%--------------------------COLOR THEME-----------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%

 %\usecolortheme[RGB]{227, 11, 92}{structure}
\usecolortheme[RGB={178, 34, 34}]{structure}

%%%%%%%%%------------------------FOOTLINE--------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%

\defbeamertemplate*{footline}{ru theme}{%
  \leavevmode%
  \centering
  \hbox{%
  \begin{beamercolorbox}[wd=.50\paperwidth,ht=4.25ex,dp=1ex,center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\insertshortauthor
    \leftskip=0.5cm
  \end{beamercolorbox}%
 % \begin{beamercolorbox}[wd=.2\paperwidth,ht=4.25ex,dp=1ex,center]{author in head/foot}%
%    \usebeamerfont{author in head/foot}\insertshortdate
%  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.4\paperwidth,ht=4.25ex,dp=1ex,center]{title in head/foot}%
    \usebeamerfont{title in head/foot}\insertshorttitle
  \end{beamercolorbox}%
   \begin{beamercolorbox}[wd=0.08\paperwidth,ht=4.25ex,dp=1ex,right]{title in head/foot}%
    \insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
  \end{beamercolorbox}}%
  \vskip0pt%
}

%%%%%%%%%------------------------HEADERLINE---------------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%

%HEADER LINE

\makeatletter
\defbeamertemplate*{headline}{}{%
  %
    \leavevmode%
    \hspace*{0.065\paperwidth}
    \hbox{%
    \begin{beamercolorbox}[wd=.86\paperwidth,ht=10.25ex,dp=1ex,center,rounded=true,shadow=true]{frametitle}
      \ifx\beamer@sidebarside\beamer@lefttext%
      \else%
        \hfill%
      \fi%
      \ifdim\beamer@sidebarwidth>0pt%
        \usebeamercolor[bg]{logo}%
        \vrule width\beamer@sidebarwidth height \beamer@headheight%
        \hskip-\beamer@sidebarwidth%
        \hbox to \beamer@sidebarwidth{\hss\vbox to
          \beamer@headheight{\vss\hbox{\color{fg}\insertlogo}\vss}\hss}%
      \else%
        \vrule width0pt height \beamer@headheight%
      \fi%
    \end{beamercolorbox}
    }
}

\defbeamertemplate*{frametitle}{}
  {%
    \nointerlineskip%
    \vskip-\beamer@headheight%
    \vbox to \beamer@headheight{%
      \vfil
      \leftskip=-\beamer@leftmargin%
      \advance\leftskip by 0.07\paperwidth%0.3cm%
      \rightskip=-\beamer@rightmargin%
      \advance\rightskip by0.3cm plus1fil%
      {\usebeamercolor[fg]{frametitle}\usebeamerfont{frametitle}\insertframetitle\par}%
      {\usebeamercolor[fg]{framesubtitle}\usebeamerfont{framesubtitle}\insertframesubtitle\par}%
      \vbox{}%
      \vskip-1em%
      \vfil
    }%
  }
\makeatother
%
%%%%%%%%%---------------------------TITLE PAGE-------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%

\setbeamertemplate{title page}[default][colsep=-4bp,rounded=true,shadow=true,ht=11ex]
%\setbeamertemplate{navigation symbols}{}

 %%%%%%%%---------------------------- PRESENTATION SLIDES -----------------------------------%%%%%%%%%%%%%%%%%%%%%

 %%%%%%%%%-------------------------------TITLEPAGE---------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\begin{frame}[plain]
 \titlepage
\end{frame}

%%%%%%%%%----------------------------------------TABLE OF CONTENTS----------%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}{\bfseries Table of Contents}
  \tableofcontents
\end{frame}

%%%%%%%%%----------------------------INTRODUCTION-----------------------------------------------%%%%%%%%%%%%%%%%%%%%%%%%%

  \end{document}

Here you go:
\documentclass{beamer}
\usetheme{Rochester}
\usepackage{tikz}
\usetikzlibrary{positioning}

\makeatletter
\pgfdefobject{beamerslidenavlight}{\pgfpoint{-10pt}{-1pt}}{\pgfpoint{20pt}{5pt}}
 {\pgfpathqmoveto{-3bp}{0.5bp}
  \pgfpathqlineto{-7bp}{3bp}
  \pgfpathqlineto{-3bp}{5.5bp}
  \pgfusepathqfill
  \pgfpathqmoveto{13bp}{0.5bp}
  \pgfpathqlineto{17bp}{3bp}
  \pgfpathqlineto{13bp}{5.5bp}
  \pgfusepathqfill}

\def\insertslidenavigationsymbol{%
  \begin{pgfpicture}{-10pt}{-1.5pt}{20pt}{5.5pt}
    \color{black}\pgfuseobject{beamerslidenavlight}%
  \end{pgfpicture}\kern-30pt%
  \hyperlinkslideprev{\beamer@linkspace{16pt}}%
  \Acrobatmenu{GoToPage}{\beamer@linkspace{8pt}}%
  \hyperlinkslidenext{\beamer@linkspace{6pt}}}
\makeatother

\defbeamertemplate*{navigation symbols}{myvertical}{%
\vbox{\begin{tikzpicture}[remember picture,overlay]
  \node[fill=gray!20,draw,anchor=south east]
  (symbols)
  at ([yshift=50pt]current page.south east)
  {\insertslidenavigationsymbol};
  \node[text width=30pt,fill=gray!20,inner ysep=3pt,below=2 pt of symbols.south,text=black,font=\itshape,align=center]
  (page)
  {Page~\textcolor{red}{\insertframenumber}\ of~\textcolor{red}{\inserttotalframenumber}};
  \draw[gray!70,line width=1pt]
    (page.north west) -- (page.north east)
    (page.south west) -- (page.south east)
    (symbols.north) -- (symbols.south)
    (symbols.north west) -- (symbols.north east)
    (symbols.south west) -- (symbols.south east)
    ;
\end{tikzpicture}}%
}

\begin{document}

\begin{frame}
test
\end{frame}

\begin{frame}
test
\end{frame}

\end{document}


text:
Q: Magento 2 - multiple emails sent only over 3 accounts Im not sure if this is a bug inside of 2.2, or 2 in general & or if its just related to myself. Because if this is a bug, then i'll open it in github, but if it means I'm doing something stupid then please let me know.
The issue:
On adding 3 email addresses to the following:

Admin -> Stores -> Configuration -> Sales -> Sales emails -> Send Order Email Copy To

I'm receiving 2 copies of the New order every time a new order is placed. Obviously this is annoying, but what seems to be strange is, if there is less than 3 inside of the Send Order Email Copy To then only one copy of the New order comes through.
Has anyone else had this issue, or experienced this? Im pretty lost on it. I've checked the email logs on the server and fro some reason its doubled up on everything!
Could it be related to the cron? Could it be related to outside of magento?

A: *

*Try to send emails with Enabled/Disabled
Store > Configration > Sales > Sales Emails > General Settings > Asynchronous sending

*In case of Asynchronous sending is Enabled, check what you are correct install RabbitMQ http://devdocs.magento.com/guides/v2.2/install-gde/prereq/install-rabbitmq.html)

*Always check log files.


text:
Q: How To use ExecuteSqlCommandAsync I've been trying to figure out ExecuteSqlCommandAsync, which I haven't been able to find any good documentation on.
if (OldMarketRightsIDs.Count > 0)
{
    //This is where I want to have the task Begin
    TaskReturn = Data.MK3Model.Database.ExecuteSqlCommandAsync("DELETE FROM TitleMarketRights WHERE ID in (" + string.Join(", ", OldMarketRightsIDs) + ")");
}

//This is the Code I want To execute in between
var NewMarketRights = MarketRights.Select(m => new
{
    Key = m.Key,
    Value = m.Value.Except(CurrentMarketRights[m.Key].Select(c => c.FK_ProductRight).ToList())
}).ToList();

foreach (var mr in NewMarketRights)
{
    foreach (var ProdID in mr.Value)
    {
        Data.MK3Model.TitleMarketRights.Add(new TitleMarketRight { FK_MarketID = (mr.Key == 0) ? null : (int?)mr.Key, FK_TitleID = ID, FK_ProductRight = ProdID });
    }
}

//This is where I want to wait until the task is complete before continuing
var i = await TaskReturn;

This Example doesn't compile, it gets an error await operator can only be used with an async Method.  Any Ideas on how to get this working

A: Your code is fine. It just needs to be inside an async method:
public async Task FooAsync()
{
    if (OldMarketRightsIDs.Count > 0)
    {
        TaskReturn = Data.MK3Model.Database.ExecuteSqlCommandAsync("DELETE FROM TitleMarketRights WHERE ID in (" + string.Join(", ", OldMarketRightsIDs) + ")");
    }

    var NewMarketRights = MarketRights.Select(m => new
    {
        Key = m.Key,
        Value = m.Value.Except(CurrentMarketRights[m.Key].Select(c => c.FK_ProductRight).ToList())
    }).ToList();

    foreach (var mr in NewMarketRights)
    {
        foreach (var ProdID in mr.Value)
        {
            Data.MK3Model.TitleMarketRights.Add(new TitleMarketRight { FK_MarketID = (mr.Key == 0) ? null : (int?)mr.Key, FK_TitleID = ID, FK_ProductRight = ProdID });
        }
    }

    var i = await TaskReturn;
}

That's what allows you to use await. Behind the scenes a state machine is built that handles the asynchronous nature of you method. The method needs to have the async keyword and return a Task or Task<T> if you have a return value.
If you would want to have it as a lambda expression then:
Func<Task> fooAsync = async () =>
{
    if (OldMarketRightsIDs.Count > 0)
    {
        TaskReturn = Data.MK3Model.Database.ExecuteSqlCommandAsync("DELETE FROM TitleMarketRights WHERE ID in (" + string.Join(", ", OldMarketRightsIDs) + ")");
    }

    var NewMarketRights = MarketRights.Select(m => new
    {
        Key = m.Key,
        Value = m.Value.Except(CurrentMarketRights[m.Key].Select(c => c.FK_ProductRight).ToList())
    }).ToList();

    foreach (var mr in NewMarketRights)
    {
        foreach (var ProdID in mr.Value)
        {
            Data.MK3Model.TitleMarketRights.Add(new TitleMarketRight { FK_MarketID = (mr.Key == 0) ? null : (int?)mr.Key, FK_TitleID = ID, FK_ProductRight = ProdID });
        }
    }

    var i = await TaskReturn;
};

var task = fooAsync();

A: You should just do this:
if (OldMarketRightsIDs.Count > 0)
{
    await Data.MK3Model.Database.ExecuteSqlCommandAsync("DELETE FROM TitleMarketRights WHERE ID in (" + string.Join(", ", OldMarketRightsIDs) + ")");
}

//This code won't execute till the await has finished
var NewMarketRights = MarketRights.Select(m => new
{
    Key = m.Key,
    Value = m.Value.Except(CurrentMarketRights[m.Key].Select(c => c.FK_ProductRight).ToList())
}).ToList();

foreach (var mr in NewMarketRights)
{
    foreach (var ProdID in mr.Value)
    {
        Data.MK3Model.TitleMarketRights.Add(new TitleMarketRight { FK_MarketID = (mr.Key == 0) ? null : (int?)mr.Key, FK_TitleID = ID, FK_ProductRight = ProdID });
    }
}

When the await is hit, the state machine will take a snapshot and while the Async function is firing off, the process is free to do other things. But the code will not continue in this block until the Async function has finished firing. When it has, the state machine will comeback with the point at which to continue firing, aka that last if brace.
await just allows the process to do other things whilst this Async function is fired.
Also remember to have the surrounding function include the async keyword:
public async void DoSomething()
{

}

So the above will not "fire and forget" aka, just start and work in the background. In order to achieve that, I believe you call Data.MK3Model.Database.ExecuteSqlCommandAsync().Start() to make it start. MSDN Task